From a74c56bc1ba1617698af1425336209e568384c07 Mon Sep 17 00:00:00 2001 From: Sebastian Zaha Date: Mon, 17 Jul 2023 17:12:54 +0200 Subject: [PATCH] LibWeb: Remove unused code The LineBoxFragment::Type enum was used earlier in the inline layouting, but in the current algorithm there is a single type of LineBoxFragment. --- Userland/Libraries/LibWeb/Layout/LineBox.cpp | 4 ++-- Userland/Libraries/LibWeb/Layout/LineBox.h | 2 +- Userland/Libraries/LibWeb/Layout/LineBoxFragment.h | 11 +---------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/LineBox.cpp b/Userland/Libraries/LibWeb/Layout/LineBox.cpp index 27316692c1..92dad9797a 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/LineBox.cpp @@ -15,7 +15,7 @@ namespace Web::Layout { -void LineBox::add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom, LineBoxFragment::Type fragment_type) +void LineBox::add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom) { bool text_align_is_justify = layout_node.computed_values().text_align() == CSS::TextAlign::Justify; if (!text_align_is_justify && !m_fragments.is_empty() && &m_fragments.last().layout_node() == &layout_node) { @@ -26,7 +26,7 @@ void LineBox::add_fragment(Node const& layout_node, int start, int length, CSSPi } else { CSSPixels x_offset = leading_margin + leading_size + m_width; CSSPixels y_offset = 0.0f; - m_fragments.append(LineBoxFragment { layout_node, start, length, CSSPixelPoint(x_offset, y_offset), CSSPixelSize(content_width, content_height), border_box_top, border_box_bottom, fragment_type }); + m_fragments.append(LineBoxFragment { layout_node, start, length, CSSPixelPoint(x_offset, y_offset), CSSPixelSize(content_width, content_height), border_box_top, border_box_bottom }); } m_width += leading_margin + leading_size + content_width + trailing_size + trailing_margin; } diff --git a/Userland/Libraries/LibWeb/Layout/LineBox.h b/Userland/Libraries/LibWeb/Layout/LineBox.h index bfc958d648..b9c691cb22 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBox.h +++ b/Userland/Libraries/LibWeb/Layout/LineBox.h @@ -20,7 +20,7 @@ public: CSSPixels bottom() const { return m_bottom; } CSSPixels baseline() const { return m_baseline; } - void add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom, LineBoxFragment::Type = LineBoxFragment::Type::Normal); + void add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom); Vector const& fragments() const { return m_fragments; } Vector& fragments() { return m_fragments; } diff --git a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h index a7778dfa82..96a8ae8e8e 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h +++ b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h @@ -17,13 +17,7 @@ class LineBoxFragment { friend class LineBox; public: - enum class Type { - Normal, - Leading, - Trailing, - }; - - LineBoxFragment(Node const& layout_node, int start, int length, CSSPixelPoint offset, CSSPixelSize size, CSSPixels border_box_top, CSSPixels border_box_bottom, Type type) + LineBoxFragment(Node const& layout_node, int start, int length, CSSPixelPoint offset, CSSPixelSize size, CSSPixels border_box_top, CSSPixels border_box_bottom) : m_layout_node(layout_node) , m_start(start) , m_length(length) @@ -31,7 +25,6 @@ public: , m_size(size) , m_border_box_top(border_box_top) , m_border_box_bottom(border_box_bottom) - , m_type(type) { } @@ -39,7 +32,6 @@ public: int start() const { return m_start; } int length() const { return m_length; } CSSPixelRect const absolute_rect() const; - Type type() const { return m_type; } CSSPixelPoint offset() const { @@ -88,7 +80,6 @@ private: CSSPixels m_border_box_top { 0 }; CSSPixels m_border_box_bottom { 0 }; CSSPixels m_baseline { 0 }; - Type m_type { Type::Normal }; }; }