From c24d317d8f8fe9ba0f150e35df1ec00211e038c9 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 4 Sep 2023 12:31:23 +0200 Subject: [PATCH] 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. --- Userland/Libraries/LibWeb/Layout/FormattingContext.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 168c0bf4b4..bfa600c713 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/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(*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(*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(*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(*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`!