瀏覽代碼

LibWeb: Remove some unnecessary static_casts to Layout::Box&

UBSAN flagged one of these as invalid, and since it's not even necessary
to cast here anymore, let's just not.
Andreas Kling 1 年之前
父節點
當前提交
c24d317d8f
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Userland/Libraries/LibWeb/Layout/FormattingContext.cpp

+ 4 - 4
Userland/Libraries/LibWeb/Layout/FormattingContext.cpp

@@ -1045,7 +1045,7 @@ CSSPixelRect FormattingContext::content_box_rect_in_static_position_ancestor_coo
     for (auto const* current = box.parent(); current; current = current->parent()) {
         if (current == &ancestor_box)
             return rect;
-        auto const& current_state = m_state.get(static_cast<Box const&>(*current));
+        auto const& current_state = m_state.get(*current);
         rect.translate_by(current_state.offset);
     }
     // If we get here, ancestor_box was not an ancestor of `box`!
@@ -1762,7 +1762,7 @@ CSSPixelRect FormattingContext::border_box_rect_in_ancestor_coordinate_space(Box
     for (auto const* current = box.containing_block(); current; current = current->containing_block()) {
         if (current == &ancestor_box)
             return rect;
-        auto const& current_state = m_state.get(static_cast<Box const&>(*current));
+        auto const& current_state = m_state.get(*current);
         rect.translate_by(current_state.offset);
     }
     // If we get here, ancestor_box was not a containing block ancestor of `box`!
@@ -1783,7 +1783,7 @@ CSSPixelRect FormattingContext::content_box_rect_in_ancestor_coordinate_space(Bo
     for (auto const* current = box.containing_block(); current; current = current->containing_block()) {
         if (current == &ancestor_box)
             return rect;
-        auto const& current_state = m_state.get(static_cast<Box const&>(*current));
+        auto const& current_state = m_state.get(*current);
         rect.translate_by(current_state.offset);
     }
     // If we get here, ancestor_box was not a containing block ancestor of `box`!
@@ -1798,7 +1798,7 @@ CSSPixelRect FormattingContext::margin_box_rect_in_ancestor_coordinate_space(Box
     for (auto const* current = box.containing_block(); current; current = current->containing_block()) {
         if (current == &ancestor_box)
             return rect;
-        auto const& current_state = m_state.get(static_cast<Box const&>(*current));
+        auto const& current_state = m_state.get(*current);
         rect.translate_by(current_state.offset);
     }
     // If we get here, ancestor_box was not a containing block ancestor of `box`!