From 5721b2a3daff849abe51e8e661c67730798dfb31 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 6 Jan 2021 10:34:31 +0100 Subject: [PATCH] LibWeb: Rename LayoutStyle => CSS::ComputedValues This object represents the CSS "computed values" so let's call it that. --- .../LayoutStyle.h => CSS/ComputedValues.h} | 8 +- Libraries/LibWeb/DOM/Document.cpp | 2 +- .../LibWeb/Layout/BlockFormattingContext.cpp | 160 +++++++++--------- Libraries/LibWeb/Layout/Box.cpp | 14 +- Libraries/LibWeb/Layout/FormattingContext.cpp | 26 +-- Libraries/LibWeb/Layout/ImageBox.cpp | 2 +- .../LibWeb/Layout/InlineFormattingContext.cpp | 22 +-- Libraries/LibWeb/Layout/InlineNode.cpp | 10 +- Libraries/LibWeb/Layout/ListItemBox.cpp | 2 +- Libraries/LibWeb/Layout/ListItemMarkerBox.cpp | 2 +- Libraries/LibWeb/Layout/Node.cpp | 52 +++--- Libraries/LibWeb/Layout/Node.h | 14 +- Libraries/LibWeb/Painting/BorderPainting.cpp | 2 +- Libraries/LibWeb/Painting/BorderPainting.h | 4 +- 14 files changed, 160 insertions(+), 160 deletions(-) rename Libraries/LibWeb/{Layout/LayoutStyle.h => CSS/ComputedValues.h} (97%) diff --git a/Libraries/LibWeb/Layout/LayoutStyle.h b/Libraries/LibWeb/CSS/ComputedValues.h similarity index 97% rename from Libraries/LibWeb/Layout/LayoutStyle.h rename to Libraries/LibWeb/CSS/ComputedValues.h index dda76b5285..5fd9c6a52c 100644 --- a/Libraries/LibWeb/Layout/LayoutStyle.h +++ b/Libraries/LibWeb/CSS/ComputedValues.h @@ -30,7 +30,7 @@ #include #include -namespace Web { +namespace Web::CSS { class InitialValues { public: @@ -53,7 +53,7 @@ public: float width { 0 }; }; -class LayoutStyle { +class ComputedValues { public: CSS::Float float_() const { return m_float; } CSS::Clear clear() const { return m_clear; } @@ -111,10 +111,10 @@ protected: CSS::ListStyleType m_list_style_type { InitialValues::list_style_type() }; }; -class ImmutableLayoutStyle final : public LayoutStyle { +class ImmutableComputedValues final : public ComputedValues { }; -class MutableLayoutStyle final : public LayoutStyle { +class MutableComputedValues final : public ComputedValues { public: void set_color(const Color& color) { m_color = color; } void set_background_color(const Color& color) { m_background_color = color; } diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 5055aaacb7..6ad51f40f8 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -327,7 +327,7 @@ Color Document::background_color(const Palette& palette) const if (!body_layout_node) return default_color; - auto color = body_layout_node->style().background_color(); + auto color = body_layout_node->computed_values().background_color(); if (!color.alpha()) return default_color; return color; diff --git a/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index e7d1281b81..a81100c23c 100644 --- a/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -103,22 +103,22 @@ void BlockFormattingContext::compute_width(Box& box) return; } - auto& style = box.style(); + auto& computed_values = box.computed_values(); float width_of_containing_block = box.width_of_logical_containing_block(); auto zero_value = CSS::Length::make_px(0); auto margin_left = CSS::Length::make_auto(); auto margin_right = CSS::Length::make_auto(); - const auto padding_left = style.padding().left.resolved_or_zero(box, width_of_containing_block); - const auto padding_right = style.padding().right.resolved_or_zero(box, width_of_containing_block); + const auto padding_left = computed_values.padding().left.resolved_or_zero(box, width_of_containing_block); + const auto padding_right = computed_values.padding().right.resolved_or_zero(box, width_of_containing_block); auto try_compute_width = [&](const auto& a_width) { CSS::Length width = a_width; - margin_left = style.margin().left.resolved_or_zero(box, width_of_containing_block); - margin_right = style.margin().right.resolved_or_zero(box, width_of_containing_block); + margin_left = computed_values.margin().left.resolved_or_zero(box, width_of_containing_block); + margin_right = computed_values.margin().right.resolved_or_zero(box, width_of_containing_block); - float total_px = style.border_left().width + style.border_right().width; + float total_px = computed_values.border_left().width + computed_values.border_right().width; for (auto& value : { margin_left, padding_left, width, padding_right, margin_right }) { total_px += value.to_px(box); } @@ -177,8 +177,8 @@ void BlockFormattingContext::compute_width(Box& box) // block minus the used values of 'margin-left', 'border-left-width', 'padding-left', // 'padding-right', 'border-right-width', 'margin-right', and the widths of any relevant scroll bars. float available_width = width_of_containing_block - - margin_left.to_px(box) - style.border_left().width - padding_left.to_px(box) - - padding_right.to_px(box) - style.border_right().width - margin_right.to_px(box); + - margin_left.to_px(box) - computed_values.border_left().width - padding_left.to_px(box) + - padding_right.to_px(box) - computed_values.border_right().width - margin_right.to_px(box); auto result = calculate_shrink_to_fit_widths(box); @@ -190,14 +190,14 @@ void BlockFormattingContext::compute_width(Box& box) return width; }; - auto specified_width = style.width().resolved_or_auto(box, width_of_containing_block); + auto specified_width = computed_values.width().resolved_or_auto(box, width_of_containing_block); // 1. The tentative used width is calculated (without 'min-width' and 'max-width') auto used_width = try_compute_width(specified_width); // 2. The tentative used width is greater than 'max-width', the rules above are applied again, // but this time using the computed value of 'max-width' as the computed value for 'width'. - auto specified_max_width = style.max_width().resolved_or_auto(box, width_of_containing_block); + auto specified_max_width = computed_values.max_width().resolved_or_auto(box, width_of_containing_block); if (!specified_max_width.is_auto()) { if (used_width.to_px(box) > specified_max_width.to_px(box)) { used_width = try_compute_width(specified_max_width); @@ -206,7 +206,7 @@ void BlockFormattingContext::compute_width(Box& box) // 3. If the resulting width is smaller than 'min-width', the rules above are applied again, // but this time using the value of 'min-width' as the computed value for 'width'. - auto specified_min_width = style.min_width().resolved_or_auto(box, width_of_containing_block); + auto specified_min_width = computed_values.min_width().resolved_or_auto(box, width_of_containing_block); if (!specified_min_width.is_auto()) { if (used_width.to_px(box) < specified_min_width.to_px(box)) { used_width = try_compute_width(specified_min_width); @@ -216,8 +216,8 @@ void BlockFormattingContext::compute_width(Box& box) box.set_width(used_width.to_px(box)); box.box_model().margin.left = margin_left.to_px(box); box.box_model().margin.right = margin_right.to_px(box); - box.box_model().border.left = style.border_left().width; - box.box_model().border.right = style.border_right().width; + box.box_model().border.left = computed_values.border_left().width; + box.box_model().border.right = computed_values.border_right().width; box.box_model().padding.left = padding_left.to_px(box); box.box_model().padding.right = padding_right.to_px(box); } @@ -225,14 +225,14 @@ void BlockFormattingContext::compute_width(Box& box) void BlockFormattingContext::compute_width_for_floating_box(Box& box) { // 10.3.5 Floating, non-replaced elements - auto& style = box.style(); + auto& computed_values = box.computed_values(); float width_of_containing_block = box.width_of_logical_containing_block(); auto zero_value = CSS::Length::make_px(0); auto margin_left = CSS::Length::make_auto(); auto margin_right = CSS::Length::make_auto(); - const auto padding_left = style.padding().left.resolved_or_zero(box, width_of_containing_block); - const auto padding_right = style.padding().right.resolved_or_zero(box, width_of_containing_block); + const auto padding_left = computed_values.padding().left.resolved_or_zero(box, width_of_containing_block); + const auto padding_right = computed_values.padding().right.resolved_or_zero(box, width_of_containing_block); // If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'. if (margin_left.is_auto()) @@ -240,7 +240,7 @@ void BlockFormattingContext::compute_width_for_floating_box(Box& box) if (margin_right.is_auto()) margin_right = zero_value; - auto width = style.width().resolved_or_auto(box, width_of_containing_block); + auto width = computed_values.width().resolved_or_auto(box, width_of_containing_block); // If 'width' is computed as 'auto', the used value is the "shrink-to-fit" width. if (width.is_auto()) { @@ -249,8 +249,8 @@ void BlockFormattingContext::compute_width_for_floating_box(Box& box) // block minus the used values of 'margin-left', 'border-left-width', 'padding-left', // 'padding-right', 'border-right-width', 'margin-right', and the widths of any relevant scroll bars. float available_width = width_of_containing_block - - margin_left.to_px(box) - style.border_left().width - padding_left.to_px(box) - - padding_right.to_px(box) - style.border_right().width - margin_right.to_px(box); + - margin_left.to_px(box) - computed_values.border_left().width - padding_left.to_px(box) + - padding_right.to_px(box) - computed_values.border_right().width - margin_right.to_px(box); auto result = calculate_shrink_to_fit_widths(box); @@ -275,22 +275,22 @@ void BlockFormattingContext::compute_height_for_block_level_replaced_element_in_ void BlockFormattingContext::compute_width_for_absolutely_positioned_block(Box& box) { auto& containing_block = *box.containing_block(); - auto& style = box.style(); + auto& computed_values = box.computed_values(); auto zero_value = CSS::Length::make_px(0); auto margin_left = CSS::Length::make_auto(); auto margin_right = CSS::Length::make_auto(); - const auto border_left = style.border_left().width; - const auto border_right = style.border_right().width; - const auto padding_left = style.padding().left.resolved_or_zero(box, containing_block.width()); - const auto padding_right = style.padding().right.resolved_or_zero(box, containing_block.width()); + const auto border_left = computed_values.border_left().width; + const auto border_right = computed_values.border_right().width; + const auto padding_left = computed_values.padding().left.resolved_or_zero(box, containing_block.width()); + const auto padding_right = computed_values.padding().right.resolved_or_zero(box, containing_block.width()); auto try_compute_width = [&](const auto& a_width) { - margin_left = style.margin().left.resolved_or_zero(box, containing_block.width()); - margin_right = style.margin().right.resolved_or_zero(box, containing_block.width()); + margin_left = computed_values.margin().left.resolved_or_zero(box, containing_block.width()); + margin_right = computed_values.margin().right.resolved_or_zero(box, containing_block.width()); - auto left = style.offset().left.resolved_or_auto(box, containing_block.width()); - auto right = style.offset().right.resolved_or_auto(box, containing_block.width()); + auto left = computed_values.offset().left.resolved_or_auto(box, containing_block.width()); + auto right = computed_values.offset().right.resolved_or_auto(box, containing_block.width()); auto width = a_width; auto solve_for_left = [&] { @@ -379,14 +379,14 @@ void BlockFormattingContext::compute_width_for_absolutely_positioned_block(Box& return width; }; - auto specified_width = style.width().resolved_or_auto(box, containing_block.width()); + auto specified_width = computed_values.width().resolved_or_auto(box, containing_block.width()); // 1. The tentative used width is calculated (without 'min-width' and 'max-width') auto used_width = try_compute_width(specified_width); // 2. The tentative used width is greater than 'max-width', the rules above are applied again, // but this time using the computed value of 'max-width' as the computed value for 'width'. - auto specified_max_width = style.max_width().resolved_or_auto(box, containing_block.width()); + auto specified_max_width = computed_values.max_width().resolved_or_auto(box, containing_block.width()); if (!specified_max_width.is_auto()) { if (used_width.to_px(box) > specified_max_width.to_px(box)) { used_width = try_compute_width(specified_max_width); @@ -395,7 +395,7 @@ void BlockFormattingContext::compute_width_for_absolutely_positioned_block(Box& // 3. If the resulting width is smaller than 'min-width', the rules above are applied again, // but this time using the value of 'min-width' as the computed value for 'width'. - auto specified_min_width = style.min_width().resolved_or_auto(box, containing_block.width()); + auto specified_min_width = computed_values.min_width().resolved_or_auto(box, containing_block.width()); if (!specified_min_width.is_auto()) { if (used_width.to_px(box) < specified_min_width.to_px(box)) { used_width = try_compute_width(specified_min_width); @@ -419,25 +419,25 @@ void BlockFormattingContext::compute_height(Box& box) return; } - auto& style = box.style(); + auto& computed_values = box.computed_values(); auto& containing_block = *box.containing_block(); CSS::Length specified_height; - if (style.height().is_percentage() && !containing_block.style().height().is_absolute()) { + if (computed_values.height().is_percentage() && !containing_block.computed_values().height().is_absolute()) { specified_height = CSS::Length::make_auto(); } else { - specified_height = style.height().resolved_or_auto(box, containing_block.height()); + specified_height = computed_values.height().resolved_or_auto(box, containing_block.height()); } - auto specified_max_height = style.max_height().resolved_or_auto(box, containing_block.height()); + auto specified_max_height = computed_values.max_height().resolved_or_auto(box, containing_block.height()); - box.box_model().margin.top = style.margin().top.resolved_or_zero(box, containing_block.width()).to_px(box); - box.box_model().margin.bottom = style.margin().bottom.resolved_or_zero(box, containing_block.width()).to_px(box); - box.box_model().border.top = style.border_top().width; - box.box_model().border.bottom = style.border_bottom().width; - box.box_model().padding.top = style.padding().top.resolved_or_zero(box, containing_block.width()).to_px(box); - box.box_model().padding.bottom = style.padding().bottom.resolved_or_zero(box, containing_block.width()).to_px(box); + box.box_model().margin.top = computed_values.margin().top.resolved_or_zero(box, containing_block.width()).to_px(box); + box.box_model().margin.bottom = computed_values.margin().bottom.resolved_or_zero(box, containing_block.width()).to_px(box); + box.box_model().border.top = computed_values.border_top().width; + box.box_model().border.bottom = computed_values.border_bottom().width; + box.box_model().padding.top = computed_values.padding().top.resolved_or_zero(box, containing_block.width()).to_px(box); + box.box_model().padding.bottom = computed_values.padding().bottom.resolved_or_zero(box, containing_block.width()).to_px(box); if (!specified_height.is_auto()) { float used_height = specified_height.to_px(box); @@ -487,7 +487,7 @@ void BlockFormattingContext::layout_block_level_children(Box& box, LayoutMode la }); if (layout_mode != LayoutMode::Default) { - if (box.style().width().is_undefined() || box.style().width().is_auto()) + if (box.computed_values().width().is_undefined() || box.computed_values().width().is_auto()) box.set_width(content_width); } @@ -500,12 +500,12 @@ void BlockFormattingContext::place_block_level_replaced_element_in_normal_flow(B ASSERT(!containing_block.is_absolutely_positioned()); auto& replaced_element_box_model = child_box.box_model(); - replaced_element_box_model.margin.top = child_box.style().margin().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); - replaced_element_box_model.margin.bottom = child_box.style().margin().bottom.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); - replaced_element_box_model.border.top = child_box.style().border_top().width; - replaced_element_box_model.border.bottom = child_box.style().border_bottom().width; - replaced_element_box_model.padding.top = child_box.style().padding().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); - replaced_element_box_model.padding.bottom = child_box.style().padding().bottom.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); + replaced_element_box_model.margin.top = child_box.computed_values().margin().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); + replaced_element_box_model.margin.bottom = child_box.computed_values().margin().bottom.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); + replaced_element_box_model.border.top = child_box.computed_values().border_top().width; + replaced_element_box_model.border.bottom = child_box.computed_values().border_bottom().width; + replaced_element_box_model.padding.top = child_box.computed_values().padding().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); + replaced_element_box_model.padding.bottom = child_box.computed_values().padding().bottom.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); float x = replaced_element_box_model.margin.left + replaced_element_box_model.border.left @@ -520,21 +520,21 @@ void BlockFormattingContext::place_block_level_replaced_element_in_normal_flow(B void BlockFormattingContext::place_block_level_non_replaced_element_in_normal_flow(Box& child_box, Box& containing_block) { auto& box_model = child_box.box_model(); - auto& style = child_box.style(); + auto& computed_values = child_box.computed_values(); - box_model.margin.top = style.margin().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); - box_model.margin.bottom = style.margin().bottom.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); - box_model.border.top = style.border_top().width; - box_model.border.bottom = style.border_bottom().width; - box_model.padding.top = style.padding().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); - box_model.padding.bottom = style.padding().bottom.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); + box_model.margin.top = computed_values.margin().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); + box_model.margin.bottom = computed_values.margin().bottom.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); + box_model.border.top = computed_values.border_top().width; + box_model.border.bottom = computed_values.border_bottom().width; + box_model.padding.top = computed_values.padding().top.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); + box_model.padding.bottom = computed_values.padding().bottom.resolved_or_zero(containing_block, containing_block.width()).to_px(child_box); float x = box_model.margin.left + box_model.border.left + box_model.padding.left + box_model.offset.left; - if (containing_block.style().text_align() == CSS::TextAlign::LibwebCenter) { + if (containing_block.computed_values().text_align() == CSS::TextAlign::LibwebCenter) { x = (containing_block.width() / 2) - child_box.width() / 2; } @@ -574,7 +574,7 @@ void BlockFormattingContext::place_block_level_non_replaced_element_in_normal_fl } } - if (child_box.style().clear() == CSS::Clear::Left || child_box.style().clear() == CSS::Clear::Both) { + if (child_box.computed_values().clear() == CSS::Clear::Left || child_box.computed_values().clear() == CSS::Clear::Both) { if (!m_left_floating_boxes.is_empty()) { float clearance_y = 0; for (auto* floating_box : m_left_floating_boxes) { @@ -585,7 +585,7 @@ void BlockFormattingContext::place_block_level_non_replaced_element_in_normal_fl } } - if (child_box.style().clear() == CSS::Clear::Right || child_box.style().clear() == CSS::Clear::Both) { + if (child_box.computed_values().clear() == CSS::Clear::Right || child_box.computed_values().clear() == CSS::Clear::Both) { if (!m_right_floating_boxes.is_empty()) { float clearance_y = 0; for (auto* floating_box : m_right_floating_boxes) { @@ -662,7 +662,7 @@ void BlockFormattingContext::layout_floating_child(Box& box, Box& containing_blo float y_in_context_box = box_in_context_rect.y(); // Next, float to the left and/or right - if (box.style().float_() == CSS::Float::Left) { + if (box.computed_values().float_() == CSS::Float::Left) { if (!m_left_floating_boxes.is_empty()) { auto& previous_floating_box = *m_left_floating_boxes.last(); auto previous_rect = rect_in_coordinate_space(previous_floating_box, context_box()); @@ -680,7 +680,7 @@ void BlockFormattingContext::layout_floating_child(Box& box, Box& containing_blo x = 0; } m_left_floating_boxes.append(&box); - } else if (box.style().float_() == CSS::Float::Right) { + } else if (box.computed_values().float_() == CSS::Float::Right) { if (!m_right_floating_boxes.is_empty()) { auto& previous_floating_box = *m_right_floating_boxes.last(); auto previous_rect = rect_in_coordinate_space(previous_floating_box, context_box()); @@ -708,41 +708,41 @@ void BlockFormattingContext::layout_absolutely_positioned_child(Box& box) auto& containing_block = context_box(); auto& box_model = box.box_model(); - auto specified_width = box.style().width().resolved_or_auto(box, containing_block.width()); + auto specified_width = box.computed_values().width().resolved_or_auto(box, containing_block.width()); compute_width(box); layout_inside(box, LayoutMode::Default); compute_height(box); - box_model.margin.left = box.style().margin().left.resolved_or_auto(box, containing_block.width()).to_px(box); - box_model.margin.top = box.style().margin().top.resolved_or_auto(box, containing_block.height()).to_px(box); - box_model.margin.right = box.style().margin().right.resolved_or_auto(box, containing_block.width()).to_px(box); - box_model.margin.bottom = box.style().margin().bottom.resolved_or_auto(box, containing_block.height()).to_px(box); + box_model.margin.left = box.computed_values().margin().left.resolved_or_auto(box, containing_block.width()).to_px(box); + box_model.margin.top = box.computed_values().margin().top.resolved_or_auto(box, containing_block.height()).to_px(box); + box_model.margin.right = box.computed_values().margin().right.resolved_or_auto(box, containing_block.width()).to_px(box); + box_model.margin.bottom = box.computed_values().margin().bottom.resolved_or_auto(box, containing_block.height()).to_px(box); - box_model.border.left = box.style().border_left().width; - box_model.border.right = box.style().border_right().width; - box_model.border.top = box.style().border_top().width; - box_model.border.bottom = box.style().border_bottom().width; + box_model.border.left = box.computed_values().border_left().width; + box_model.border.right = box.computed_values().border_right().width; + box_model.border.top = box.computed_values().border_top().width; + box_model.border.bottom = box.computed_values().border_bottom().width; - box_model.offset.left = box.style().offset().left.resolved_or_auto(box, containing_block.width()).to_px(box); - box_model.offset.top = box.style().offset().top.resolved_or_auto(box, containing_block.height()).to_px(box); - box_model.offset.right = box.style().offset().right.resolved_or_auto(box, containing_block.width()).to_px(box); - box_model.offset.bottom = box.style().offset().bottom.resolved_or_auto(box, containing_block.height()).to_px(box); + box_model.offset.left = box.computed_values().offset().left.resolved_or_auto(box, containing_block.width()).to_px(box); + box_model.offset.top = box.computed_values().offset().top.resolved_or_auto(box, containing_block.height()).to_px(box); + box_model.offset.right = box.computed_values().offset().right.resolved_or_auto(box, containing_block.width()).to_px(box); + box_model.offset.bottom = box.computed_values().offset().bottom.resolved_or_auto(box, containing_block.height()).to_px(box); - if (box.style().offset().left.is_auto() && specified_width.is_auto() && box.style().offset().right.is_auto()) { - if (box.style().margin().left.is_auto()) + if (box.computed_values().offset().left.is_auto() && specified_width.is_auto() && box.computed_values().offset().right.is_auto()) { + if (box.computed_values().margin().left.is_auto()) box_model.margin.left = 0; - if (box.style().margin().right.is_auto()) + if (box.computed_values().margin().right.is_auto()) box_model.margin.right = 0; } Gfx::FloatPoint used_offset; - if (!box.style().offset().left.is_auto()) { + if (!box.computed_values().offset().left.is_auto()) { float x_offset = box_model.offset.left + box_model.border_box().left; used_offset.set_x(x_offset + box_model.margin.left); - } else if (!box.style().offset().right.is_auto()) { + } else if (!box.computed_values().offset().right.is_auto()) { float x_offset = 0 - box_model.offset.right - box_model.border_box().right; @@ -752,11 +752,11 @@ void BlockFormattingContext::layout_absolutely_positioned_child(Box& box) used_offset.set_x(x_offset); } - if (!box.style().offset().top.is_auto()) { + if (!box.computed_values().offset().top.is_auto()) { float y_offset = box_model.offset.top + box_model.border_box().top; used_offset.set_y(y_offset + box_model.margin.top); - } else if (!box.style().offset().bottom.is_auto()) { + } else if (!box.computed_values().offset().bottom.is_auto()) { float y_offset = 0 - box_model.offset.bottom - box_model.border_box().bottom; diff --git a/Libraries/LibWeb/Layout/Box.cpp b/Libraries/LibWeb/Layout/Box.cpp index c7a0a868d0..cbc98040ea 100644 --- a/Libraries/LibWeb/Layout/Box.cpp +++ b/Libraries/LibWeb/Layout/Box.cpp @@ -50,7 +50,7 @@ void Box::paint(PaintContext& context, PaintPhase phase) padded_rect.set_height(height() + box_model().padding.top + box_model().padding.bottom); if (phase == PaintPhase::Background && !is_body()) { - context.painter().fill_rect(enclosing_int_rect(padded_rect), style().background_color()); + context.painter().fill_rect(enclosing_int_rect(padded_rect), computed_values().background_color()); auto bgimage = specified_style().property(CSS::PropertyID::BackgroundImage); if (bgimage.has_value() && bgimage.value()->is_image()) { @@ -68,10 +68,10 @@ void Box::paint(PaintContext& context, PaintPhase phase) bordered_rect.set_y(padded_rect.y() - box_model().border.top); bordered_rect.set_height(padded_rect.height() + box_model().border.top + box_model().border.bottom); - Painting::paint_border(context, Painting::BorderEdge::Left, bordered_rect, style()); - Painting::paint_border(context, Painting::BorderEdge::Right, bordered_rect, style()); - Painting::paint_border(context, Painting::BorderEdge::Top, bordered_rect, style()); - Painting::paint_border(context, Painting::BorderEdge::Bottom, bordered_rect, style()); + Painting::paint_border(context, Painting::BorderEdge::Left, bordered_rect, computed_values()); + Painting::paint_border(context, Painting::BorderEdge::Right, bordered_rect, computed_values()); + Painting::paint_border(context, Painting::BorderEdge::Top, bordered_rect, computed_values()); + Painting::paint_border(context, Painting::BorderEdge::Bottom, bordered_rect, computed_values()); } Layout::NodeWithStyleAndBoxModelMetrics::paint(context, phase); @@ -183,8 +183,8 @@ bool Box::establishes_stacking_context() const return false; if (dom_node() == document().root()) return true; - auto position = style().position(); - auto z_index = style().z_index(); + auto position = computed_values().position(); + auto z_index = computed_values().z_index(); if (position == CSS::Position::Absolute || position == CSS::Position::Relative) { if (z_index.has_value()) return true; diff --git a/Libraries/LibWeb/Layout/FormattingContext.cpp b/Libraries/LibWeb/Layout/FormattingContext.cpp index c6f565aa27..fe7cea679f 100644 --- a/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -128,10 +128,10 @@ static Gfx::FloatSize solve_replaced_size_constraint(float w, float h, const Rep // 10.4 Minimum and maximum widths: 'min-width' and 'max-width' auto& containing_block = *box.containing_block(); - auto specified_min_width = box.style().min_width().resolved_or_zero(box, containing_block.width()).to_px(box); - auto specified_max_width = box.style().max_width().resolved(CSS::Length::make_px(w), box, containing_block.width()).to_px(box); - auto specified_min_height = box.style().min_height().resolved_or_auto(box, containing_block.height()).to_px(box); - auto specified_max_height = box.style().max_height().resolved(CSS::Length::make_px(h), box, containing_block.height()).to_px(box); + auto specified_min_width = box.computed_values().min_width().resolved_or_zero(box, containing_block.width()).to_px(box); + auto specified_max_width = box.computed_values().max_width().resolved(CSS::Length::make_px(w), box, containing_block.width()).to_px(box); + auto specified_min_height = box.computed_values().min_height().resolved_or_auto(box, containing_block.height()).to_px(box); + auto specified_max_height = box.computed_values().max_height().resolved(CSS::Length::make_px(h), box, containing_block.height()).to_px(box); auto min_width = min(specified_min_width, specified_max_width); auto max_width = max(specified_min_width, specified_max_width); @@ -164,7 +164,7 @@ static Gfx::FloatSize solve_replaced_size_constraint(float w, float h, const Rep float FormattingContext::tentative_width_for_replaced_element(const ReplacedBox& box, const CSS::Length& width) { auto& containing_block = *box.containing_block(); - auto specified_height = box.style().height().resolved_or_auto(box, containing_block.height()); + auto specified_height = box.computed_values().height().resolved_or_auto(box, containing_block.height()); float used_width = width.to_px(box); @@ -203,8 +203,8 @@ float FormattingContext::compute_width_for_replaced_element(const ReplacedBox& b auto zero_value = CSS::Length::make_px(0); auto& containing_block = *box.containing_block(); - auto margin_left = box.style().margin().left.resolved_or_zero(box, containing_block.width()); - auto margin_right = box.style().margin().right.resolved_or_zero(box, containing_block.width()); + auto margin_left = box.computed_values().margin().left.resolved_or_zero(box, containing_block.width()); + auto margin_right = box.computed_values().margin().right.resolved_or_zero(box, containing_block.width()); // A computed value of 'auto' for 'margin-left' or 'margin-right' becomes a used value of '0'. if (margin_left.is_auto()) @@ -212,14 +212,14 @@ float FormattingContext::compute_width_for_replaced_element(const ReplacedBox& b if (margin_right.is_auto()) margin_right = zero_value; - auto specified_width = box.style().width().resolved_or_auto(box, containing_block.width()); + auto specified_width = box.computed_values().width().resolved_or_auto(box, containing_block.width()); // 1. The tentative used width is calculated (without 'min-width' and 'max-width') auto used_width = tentative_width_for_replaced_element(box, specified_width); // 2. The tentative used width is greater than 'max-width', the rules above are applied again, // but this time using the computed value of 'max-width' as the computed value for 'width'. - auto specified_max_width = box.style().max_width().resolved_or_auto(box, containing_block.width()); + auto specified_max_width = box.computed_values().max_width().resolved_or_auto(box, containing_block.width()); if (!specified_max_width.is_auto()) { if (used_width > specified_max_width.to_px(box)) { used_width = tentative_width_for_replaced_element(box, specified_max_width); @@ -228,7 +228,7 @@ float FormattingContext::compute_width_for_replaced_element(const ReplacedBox& b // 3. If the resulting width is smaller than 'min-width', the rules above are applied again, // but this time using the value of 'min-width' as the computed value for 'width'. - auto specified_min_width = box.style().min_width().resolved_or_auto(box, containing_block.width()); + auto specified_min_width = box.computed_values().min_width().resolved_or_auto(box, containing_block.width()); if (!specified_min_width.is_auto()) { if (used_width < specified_min_width.to_px(box)) { used_width = tentative_width_for_replaced_element(box, specified_min_width); @@ -241,7 +241,7 @@ float FormattingContext::compute_width_for_replaced_element(const ReplacedBox& b float FormattingContext::tentative_height_for_replaced_element(const ReplacedBox& box, const CSS::Length& height) { auto& containing_block = *box.containing_block(); - auto specified_width = box.style().width().resolved_or_auto(box, containing_block.width()); + auto specified_width = box.computed_values().width().resolved_or_auto(box, containing_block.width()); float used_height = height.to_px(box); @@ -265,8 +265,8 @@ float FormattingContext::compute_height_for_replaced_element(const ReplacedBox& // 'inline-block' replaced elements in normal flow and floating replaced elements auto& containing_block = *box.containing_block(); - auto specified_width = box.style().width().resolved_or_auto(box, containing_block.width()); - auto specified_height = box.style().height().resolved_or_auto(box, containing_block.height()); + auto specified_width = box.computed_values().width().resolved_or_auto(box, containing_block.width()); + auto specified_height = box.computed_values().height().resolved_or_auto(box, containing_block.height()); float used_height = tentative_height_for_replaced_element(box, specified_height); diff --git a/Libraries/LibWeb/Layout/ImageBox.cpp b/Libraries/LibWeb/Layout/ImageBox.cpp index 78ef43555f..a00c551c7a 100644 --- a/Libraries/LibWeb/Layout/ImageBox.cpp +++ b/Libraries/LibWeb/Layout/ImageBox.cpp @@ -113,7 +113,7 @@ void ImageBox::paint(PaintContext& context, PaintPhase phase) auto alt = image_element.alt(); if (alt.is_empty()) alt = image_element.src(); - context.painter().draw_text(enclosing_int_rect(absolute_rect()), alt, Gfx::TextAlignment::Center, style().color(), Gfx::TextElision::Right); + context.painter().draw_text(enclosing_int_rect(absolute_rect()), alt, Gfx::TextAlignment::Center, computed_values().color(), Gfx::TextElision::Right); } else if (auto bitmap = m_image_loader.bitmap()) { context.painter().draw_scaled_bitmap(enclosing_int_rect(absolute_rect()), *bitmap, bitmap->rect()); } diff --git a/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 74b2b6ad06..470591c538 100644 --- a/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -109,7 +109,7 @@ void InlineFormattingContext::run(Box&, LayoutMode layout_mode) if (!containing_block().line_boxes().is_empty() && containing_block().line_boxes().last().fragments().is_empty()) containing_block().line_boxes().take_last(); - auto text_align = containing_block().style().text_align(); + auto text_align = containing_block().computed_values().text_align(); float min_line_height = containing_block().specified_style().line_height(containing_block()); float content_height = 0; float max_linebox_width = 0; @@ -209,16 +209,16 @@ void InlineFormattingContext::dimension_box_on_line(Box& box, LayoutMode layout_ if (box.is_inline_block()) { auto& inline_block = const_cast(downcast(box)); - if (inline_block.style().width().is_undefined_or_auto()) { + if (inline_block.computed_values().width().is_undefined_or_auto()) { auto result = calculate_shrink_to_fit_widths(inline_block); - auto margin_left = inline_block.style().margin().left.resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block); - auto border_left_width = inline_block.style().border_left().width; - auto padding_left = inline_block.style().padding().left.resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block); + auto margin_left = inline_block.computed_values().margin().left.resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block); + auto border_left_width = inline_block.computed_values().border_left().width; + auto padding_left = inline_block.computed_values().padding().left.resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block); - auto margin_right = inline_block.style().margin().right.resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block); - auto border_right_width = inline_block.style().border_right().width; - auto padding_right = inline_block.style().padding().right.resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block); + auto margin_right = inline_block.computed_values().margin().right.resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block); + auto border_right_width = inline_block.computed_values().border_right().width; + auto padding_right = inline_block.computed_values().padding().right.resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block); auto available_width = containing_block().width() - margin_left @@ -231,14 +231,14 @@ void InlineFormattingContext::dimension_box_on_line(Box& box, LayoutMode layout_ auto width = min(max(result.preferred_minimum_width, available_width), result.preferred_width); inline_block.set_width(width); } else { - inline_block.set_width(inline_block.style().width().resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block)); + inline_block.set_width(inline_block.computed_values().width().resolved_or_zero(inline_block, containing_block().width()).to_px(inline_block)); } layout_inside(inline_block, layout_mode); - if (inline_block.style().height().is_undefined_or_auto()) { + if (inline_block.computed_values().height().is_undefined_or_auto()) { // FIXME: (10.6.6) If 'height' is 'auto', the height depends on the element's descendants per 10.6.7. } else { - inline_block.set_height(inline_block.style().height().resolved_or_zero(inline_block, containing_block().height()).to_px(inline_block)); + inline_block.set_height(inline_block.computed_values().height().resolved_or_zero(inline_block, containing_block().height()).to_px(inline_block)); } return; } diff --git a/Libraries/LibWeb/Layout/InlineNode.cpp b/Libraries/LibWeb/Layout/InlineNode.cpp index 763a193ead..ab3974d54f 100644 --- a/Libraries/LibWeb/Layout/InlineNode.cpp +++ b/Libraries/LibWeb/Layout/InlineNode.cpp @@ -46,15 +46,15 @@ void InlineNode::split_into_lines(InlineFormattingContext& context, LayoutMode l { auto& containing_block = context.context_box(); - if (!style().padding().left.is_undefined_or_auto()) { - float padding_left = style().padding().left.resolved(CSS::Length::make_px(0), *this, containing_block.width()).to_px(*this); + if (!computed_values().padding().left.is_undefined_or_auto()) { + float padding_left = computed_values().padding().left.resolved(CSS::Length::make_px(0), *this, containing_block.width()).to_px(*this); containing_block.ensure_last_line_box().add_fragment(*this, 0, 0, padding_left, 0, LineBoxFragment::Type::Leading); } NodeWithStyleAndBoxModelMetrics::split_into_lines(context, layout_mode); - if (!style().padding().right.is_undefined_or_auto()) { - float padding_right = style().padding().right.resolved(CSS::Length::make_px(0), *this, containing_block.width()).to_px(*this); + if (!computed_values().padding().right.is_undefined_or_auto()) { + float padding_right = computed_values().padding().right.resolved(CSS::Length::make_px(0), *this, containing_block.width()).to_px(*this); containing_block.ensure_last_line_box().add_fragment(*this, 0, 0, padding_right, 0, LineBoxFragment::Type::Trailing); } } @@ -64,7 +64,7 @@ void InlineNode::paint_fragment(PaintContext& context, const LineBoxFragment& fr auto& painter = context.painter(); if (phase == PaintPhase::Background) { - painter.fill_rect(enclosing_int_rect(fragment.absolute_rect()), style().background_color()); + painter.fill_rect(enclosing_int_rect(fragment.absolute_rect()), computed_values().background_color()); } } diff --git a/Libraries/LibWeb/Layout/ListItemBox.cpp b/Libraries/LibWeb/Layout/ListItemBox.cpp index e210cfe3bd..06ed92533e 100644 --- a/Libraries/LibWeb/Layout/ListItemBox.cpp +++ b/Libraries/LibWeb/Layout/ListItemBox.cpp @@ -45,7 +45,7 @@ void ListItemBox::layout_marker() m_marker = nullptr; } - if (style().list_style_type() == CSS::ListStyleType::None) + if (computed_values().list_style_type() == CSS::ListStyleType::None) return; if (!m_marker) { diff --git a/Libraries/LibWeb/Layout/ListItemMarkerBox.cpp b/Libraries/LibWeb/Layout/ListItemMarkerBox.cpp index 4fb7d6324d..2b387112e6 100644 --- a/Libraries/LibWeb/Layout/ListItemMarkerBox.cpp +++ b/Libraries/LibWeb/Layout/ListItemMarkerBox.cpp @@ -45,7 +45,7 @@ void ListItemMarkerBox::paint(PaintContext& context, PaintPhase phase) Gfx::IntRect bullet_rect { 0, 0, 4, 4 }; bullet_rect.center_within(enclosing_int_rect(absolute_rect())); // FIXME: It would be nicer to not have to go via the parent here to get our inherited style. - auto color = parent()->style().color(); + auto color = parent()->computed_values().color(); context.painter().fill_rect(bullet_rect, color); } diff --git a/Libraries/LibWeb/Layout/Node.cpp b/Libraries/LibWeb/Layout/Node.cpp index a85ce22f92..18350cbeec 100644 --- a/Libraries/LibWeb/Layout/Node.cpp +++ b/Libraries/LibWeb/Layout/Node.cpp @@ -220,64 +220,64 @@ NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, NonnullRe void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style) { - auto& style = static_cast(m_style); + auto& computed_values = static_cast(m_computed_values); auto position = specified_style.position(); if (position.has_value()) - style.set_position(position.value()); + computed_values.set_position(position.value()); auto text_align = specified_style.text_align(); if (text_align.has_value()) - style.set_text_align(text_align.value()); + computed_values.set_text_align(text_align.value()); auto white_space = specified_style.white_space(); if (white_space.has_value()) - style.set_white_space(white_space.value()); + computed_values.set_white_space(white_space.value()); auto float_ = specified_style.float_(); if (float_.has_value()) - style.set_float(float_.value()); + computed_values.set_float(float_.value()); auto clear = specified_style.clear(); if (clear.has_value()) - style.set_clear(clear.value()); + computed_values.set_clear(clear.value()); auto text_decoration_line = specified_style.text_decoration_line(); if (text_decoration_line.has_value()) - style.set_text_decoration_line(text_decoration_line.value()); + computed_values.set_text_decoration_line(text_decoration_line.value()); auto text_transform = specified_style.text_transform(); if (text_transform.has_value()) - style.set_text_transform(text_transform.value()); + computed_values.set_text_transform(text_transform.value()); if (auto list_style_type = specified_style.list_style_type(); list_style_type.has_value()) - style.set_list_style_type(list_style_type.value()); + computed_values.set_list_style_type(list_style_type.value()); - style.set_color(specified_style.color_or_fallback(CSS::PropertyID::Color, document(), Color::Black)); - style.set_background_color(specified_style.color_or_fallback(CSS::PropertyID::BackgroundColor, document(), Color::Transparent)); + computed_values.set_color(specified_style.color_or_fallback(CSS::PropertyID::Color, document(), Color::Black)); + computed_values.set_background_color(specified_style.color_or_fallback(CSS::PropertyID::BackgroundColor, document(), Color::Transparent)); - style.set_z_index(specified_style.z_index()); - style.set_width(specified_style.length_or_fallback(CSS::PropertyID::Width, {})); - style.set_min_width(specified_style.length_or_fallback(CSS::PropertyID::MinWidth, {})); - style.set_max_width(specified_style.length_or_fallback(CSS::PropertyID::MaxWidth, {})); - style.set_height(specified_style.length_or_fallback(CSS::PropertyID::Height, {})); - style.set_min_height(specified_style.length_or_fallback(CSS::PropertyID::MinHeight, {})); - style.set_max_height(specified_style.length_or_fallback(CSS::PropertyID::MaxHeight, {})); + computed_values.set_z_index(specified_style.z_index()); + computed_values.set_width(specified_style.length_or_fallback(CSS::PropertyID::Width, {})); + computed_values.set_min_width(specified_style.length_or_fallback(CSS::PropertyID::MinWidth, {})); + computed_values.set_max_width(specified_style.length_or_fallback(CSS::PropertyID::MaxWidth, {})); + computed_values.set_height(specified_style.length_or_fallback(CSS::PropertyID::Height, {})); + computed_values.set_min_height(specified_style.length_or_fallback(CSS::PropertyID::MinHeight, {})); + computed_values.set_max_height(specified_style.length_or_fallback(CSS::PropertyID::MaxHeight, {})); - style.set_offset(specified_style.length_box(CSS::PropertyID::Left, CSS::PropertyID::Top, CSS::PropertyID::Right, CSS::PropertyID::Bottom, CSS::Length::make_auto())); - style.set_margin(specified_style.length_box(CSS::PropertyID::MarginLeft, CSS::PropertyID::MarginTop, CSS::PropertyID::MarginRight, CSS::PropertyID::MarginBottom, CSS::Length::make_px(0))); - style.set_padding(specified_style.length_box(CSS::PropertyID::PaddingLeft, CSS::PropertyID::PaddingTop, CSS::PropertyID::PaddingRight, CSS::PropertyID::PaddingBottom, CSS::Length::make_px(0))); + computed_values.set_offset(specified_style.length_box(CSS::PropertyID::Left, CSS::PropertyID::Top, CSS::PropertyID::Right, CSS::PropertyID::Bottom, CSS::Length::make_auto())); + computed_values.set_margin(specified_style.length_box(CSS::PropertyID::MarginLeft, CSS::PropertyID::MarginTop, CSS::PropertyID::MarginRight, CSS::PropertyID::MarginBottom, CSS::Length::make_px(0))); + computed_values.set_padding(specified_style.length_box(CSS::PropertyID::PaddingLeft, CSS::PropertyID::PaddingTop, CSS::PropertyID::PaddingRight, CSS::PropertyID::PaddingBottom, CSS::Length::make_px(0))); - auto do_border_style = [&](BorderData& border, CSS::PropertyID width_property, CSS::PropertyID color_property, CSS::PropertyID style_property) { + auto do_border_style = [&](CSS::BorderData& border, CSS::PropertyID width_property, CSS::PropertyID color_property, CSS::PropertyID style_property) { border.width = specified_style.length_or_fallback(width_property, {}).resolved_or_zero(*this, 0).to_px(*this); border.color = specified_style.color_or_fallback(color_property, document(), Color::Transparent); border.line_style = specified_style.line_style(style_property).value_or(CSS::LineStyle::None); }; - do_border_style(style.border_left(), CSS::PropertyID::BorderLeftWidth, CSS::PropertyID::BorderLeftColor, CSS::PropertyID::BorderLeftStyle); - do_border_style(style.border_top(), CSS::PropertyID::BorderTopWidth, CSS::PropertyID::BorderTopColor, CSS::PropertyID::BorderTopStyle); - do_border_style(style.border_right(), CSS::PropertyID::BorderRightWidth, CSS::PropertyID::BorderRightColor, CSS::PropertyID::BorderRightStyle); - do_border_style(style.border_bottom(), CSS::PropertyID::BorderBottomWidth, CSS::PropertyID::BorderBottomColor, CSS::PropertyID::BorderBottomStyle); + do_border_style(computed_values.border_left(), CSS::PropertyID::BorderLeftWidth, CSS::PropertyID::BorderLeftColor, CSS::PropertyID::BorderLeftStyle); + do_border_style(computed_values.border_top(), CSS::PropertyID::BorderTopWidth, CSS::PropertyID::BorderTopColor, CSS::PropertyID::BorderTopStyle); + do_border_style(computed_values.border_right(), CSS::PropertyID::BorderRightWidth, CSS::PropertyID::BorderRightColor, CSS::PropertyID::BorderRightStyle); + do_border_style(computed_values.border_bottom(), CSS::PropertyID::BorderBottomWidth, CSS::PropertyID::BorderBottomColor, CSS::PropertyID::BorderBottomStyle); } void Node::handle_mousedown(Badge, const Gfx::IntPoint&, unsigned, unsigned) diff --git a/Libraries/LibWeb/Layout/Node.h b/Libraries/LibWeb/Layout/Node.h index 4af3761713..25c9b03a5e 100644 --- a/Libraries/LibWeb/Layout/Node.h +++ b/Libraries/LibWeb/Layout/Node.h @@ -30,11 +30,11 @@ #include #include #include +#include #include #include #include #include -#include #include #include @@ -126,7 +126,7 @@ public: bool can_contain_boxes_with_position_absolute() const; const CSS::StyleProperties& specified_style() const; - const ImmutableLayoutStyle& style() const; + const CSS::ImmutableComputedValues& style() const; NodeWithStyle* parent(); const NodeWithStyle* parent() const; @@ -200,7 +200,7 @@ public: const CSS::StyleProperties& specified_style() const { return m_specified_style; } void set_specified_style(const CSS::StyleProperties& style) { m_specified_style = style; } - const ImmutableLayoutStyle& style() const { return static_cast(m_style); } + const CSS::ImmutableComputedValues& computed_values() const { return static_cast(m_computed_values); } void apply_style(const CSS::StyleProperties&); @@ -208,7 +208,7 @@ protected: NodeWithStyle(DOM::Document&, DOM::Node*, NonnullRefPtr); private: - LayoutStyle m_style; + CSS::ComputedValues m_computed_values; NonnullRefPtr m_specified_style; CSS::Position m_position; @@ -236,11 +236,11 @@ inline const CSS::StyleProperties& Node::specified_style() const return parent()->specified_style(); } -inline const ImmutableLayoutStyle& Node::style() const +inline const CSS::ImmutableComputedValues& Node::style() const { if (m_has_style) - return static_cast(this)->style(); - return parent()->style(); + return static_cast(this)->computed_values(); + return parent()->computed_values(); } inline const NodeWithStyle* Node::parent() const diff --git a/Libraries/LibWeb/Painting/BorderPainting.cpp b/Libraries/LibWeb/Painting/BorderPainting.cpp index d3721245e2..3c5cd8831f 100644 --- a/Libraries/LibWeb/Painting/BorderPainting.cpp +++ b/Libraries/LibWeb/Painting/BorderPainting.cpp @@ -30,7 +30,7 @@ namespace Web::Painting { -void paint_border(PaintContext& context, BorderEdge edge, const Gfx::FloatRect& rect, const LayoutStyle& style) +void paint_border(PaintContext& context, BorderEdge edge, const Gfx::FloatRect& rect, const CSS::ComputedValues& style) { const auto& border_data = [&] { switch (edge) { diff --git a/Libraries/LibWeb/Painting/BorderPainting.h b/Libraries/LibWeb/Painting/BorderPainting.h index 68b4c2c7f0..47633eb980 100644 --- a/Libraries/LibWeb/Painting/BorderPainting.h +++ b/Libraries/LibWeb/Painting/BorderPainting.h @@ -27,7 +27,7 @@ #pragma once #include -#include +#include namespace Web::Painting { @@ -37,6 +37,6 @@ enum class BorderEdge { Bottom, Left, }; -void paint_border(PaintContext&, BorderEdge, const Gfx::FloatRect&, const LayoutStyle&); +void paint_border(PaintContext&, BorderEdge, const Gfx::FloatRect&, const CSS::ComputedValues&); }