diff options
Diffstat (limited to 'Libraries/LibWeb')
-rw-r--r-- | Libraries/LibWeb/Layout/LineBox.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/Node.cpp | 12 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/Node.h | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/TableFormattingContext.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/TextNode.cpp | 20 | ||||
-rw-r--r-- | Libraries/LibWeb/Painting/StackingContext.cpp | 2 |
6 files changed, 22 insertions, 22 deletions
diff --git a/Libraries/LibWeb/Layout/LineBox.cpp b/Libraries/LibWeb/Layout/LineBox.cpp index 3e01f9fd40..df08bfe9eb 100644 --- a/Libraries/LibWeb/Layout/LineBox.cpp +++ b/Libraries/LibWeb/Layout/LineBox.cpp @@ -35,7 +35,7 @@ namespace Web::Layout { void LineBox::add_fragment(Node& layout_node, int start, int length, float width, float height, LineBoxFragment::Type fragment_type) { - bool text_align_is_justify = layout_node.style().text_align() == CSS::TextAlign::Justify; + 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) { // The fragment we're adding is from the last Layout::Node on the line. // Expand the last fragment instead of adding a new one with the same Layout::Node. diff --git a/Libraries/LibWeb/Layout/Node.cpp b/Libraries/LibWeb/Layout/Node.cpp index 74c42ae027..406660e503 100644 --- a/Libraries/LibWeb/Layout/Node.cpp +++ b/Libraries/LibWeb/Layout/Node.cpp @@ -57,7 +57,7 @@ Node::~Node() bool Node::can_contain_boxes_with_position_absolute() const { - return style().position() != CSS::Position::Static || is<InitialContainingBlockBox>(*this); + return computed_values().position() != CSS::Position::Static || is<InitialContainingBlockBox>(*this); } const BlockBox* Node::containing_block() const @@ -72,7 +72,7 @@ const BlockBox* Node::containing_block() const if (is<TextNode>(*this)) return nearest_block_ancestor(); - auto position = style().position(); + auto position = computed_values().position(); if (position == CSS::Position::Absolute) { auto* ancestor = parent(); @@ -186,19 +186,19 @@ bool Node::is_floating() const { if (!has_style()) return false; - return style().float_() != CSS::Float::None; + return computed_values().float_() != CSS::Float::None; } bool Node::is_positioned() const { - return has_style() && style().position() != CSS::Position::Static; + return has_style() && computed_values().position() != CSS::Position::Static; } bool Node::is_absolutely_positioned() const { if (!has_style()) return false; - auto position = style().position(); + auto position = computed_values().position(); return position == CSS::Position::Absolute || position == CSS::Position::Fixed; } @@ -206,7 +206,7 @@ bool Node::is_fixed_position() const { if (!has_style()) return false; - auto position = style().position(); + auto position = computed_values().position(); return position == CSS::Position::Fixed; } diff --git a/Libraries/LibWeb/Layout/Node.h b/Libraries/LibWeb/Layout/Node.h index d688aacbef..a92f7bc879 100644 --- a/Libraries/LibWeb/Layout/Node.h +++ b/Libraries/LibWeb/Layout/Node.h @@ -127,7 +127,7 @@ public: const Gfx::Font& font() const; const CSS::StyleProperties& specified_style() const; - const CSS::ImmutableComputedValues& style() const; + const CSS::ImmutableComputedValues& computed_values() const; NodeWithStyle* parent(); const NodeWithStyle* parent() const; @@ -247,7 +247,7 @@ inline const CSS::StyleProperties& Node::specified_style() const return parent()->specified_style(); } -inline const CSS::ImmutableComputedValues& Node::style() const +inline const CSS::ImmutableComputedValues& Node::computed_values() const { if (m_has_style) return static_cast<const NodeWithStyle*>(this)->computed_values(); diff --git a/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Libraries/LibWeb/Layout/TableFormattingContext.cpp index 665706ab0f..865cef64e6 100644 --- a/Libraries/LibWeb/Layout/TableFormattingContext.cpp +++ b/Libraries/LibWeb/Layout/TableFormattingContext.cpp @@ -84,7 +84,7 @@ void TableFormattingContext::calculate_column_widths(Box& row, Vector<float>& co { size_t column_index = 0; auto* table = row.first_ancestor_of_type<TableBox>(); - bool use_auto_layout = !table || table->style().width().is_undefined_or_auto(); + bool use_auto_layout = !table || table->computed_values().width().is_undefined_or_auto(); row.for_each_child_of_type<TableCellBox>([&](auto& cell) { compute_width(cell); if (use_auto_layout) { @@ -103,7 +103,7 @@ void TableFormattingContext::layout_row(Box& row, Vector<float>& column_widths) float tallest_cell_height = 0; float content_width = 0; auto* table = row.first_ancestor_of_type<TableBox>(); - bool use_auto_layout = !table || table->style().width().is_undefined_or_auto(); + bool use_auto_layout = !table || table->computed_values().width().is_undefined_or_auto(); row.for_each_child_of_type<TableCellBox>([&](auto& cell) { cell.set_offset(row.effective_offset().translated(content_width, 0)); diff --git a/Libraries/LibWeb/Layout/TextNode.cpp b/Libraries/LibWeb/Layout/TextNode.cpp index c29291275b..6f8bfd0c2d 100644 --- a/Libraries/LibWeb/Layout/TextNode.cpp +++ b/Libraries/LibWeb/Layout/TextNode.cpp @@ -77,7 +77,7 @@ void TextNode::paint_fragment(PaintContext& context, const LineBoxFragment& frag 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()); } if (phase == PaintPhase::Foreground) { @@ -86,18 +86,18 @@ void TextNode::paint_fragment(PaintContext& context, const LineBoxFragment& frag if (document().inspected_node() == &dom_node()) context.painter().draw_rect(enclosing_int_rect(fragment.absolute_rect()), Color::Magenta); - if (style().text_decoration_line() == CSS::TextDecorationLine::Underline) - painter.draw_line(enclosing_int_rect(fragment.absolute_rect()).bottom_left().translated(0, 1), enclosing_int_rect(fragment.absolute_rect()).bottom_right().translated(0, 1), style().color()); + if (computed_values().text_decoration_line() == CSS::TextDecorationLine::Underline) + painter.draw_line(enclosing_int_rect(fragment.absolute_rect()).bottom_left().translated(0, 1), enclosing_int_rect(fragment.absolute_rect()).bottom_right().translated(0, 1), computed_values().color()); // FIXME: text-transform should be done already in layout, since uppercase glyphs may be wider than lowercase, etc. auto text = m_text_for_rendering; - auto text_transform = style().text_transform(); + auto text_transform = computed_values().text_transform(); if (text_transform == CSS::TextTransform::Uppercase) text = m_text_for_rendering.to_uppercase(); if (text_transform == CSS::TextTransform::Lowercase) text = m_text_for_rendering.to_lowercase(); - painter.draw_text(enclosing_int_rect(fragment.absolute_rect()), text.substring_view(fragment.start(), fragment.length()), Gfx::TextAlignment::CenterLeft, style().color()); + painter.draw_text(enclosing_int_rect(fragment.absolute_rect()), text.substring_view(fragment.start(), fragment.length()), Gfx::TextAlignment::CenterLeft, computed_values().color()); auto selection_rect = fragment.selection_rect(font()); if (!selection_rect.is_empty()) { @@ -135,7 +135,7 @@ void TextNode::paint_cursor_if_needed(PaintContext& context, const LineBoxFragme float cursor_height = fragment_rect.height(); Gfx::IntRect cursor_rect(cursor_x, cursor_top, 1, cursor_height); - context.painter().draw_rect(cursor_rect, style().color()); + context.painter().draw_rect(cursor_rect, computed_values().color()); } template<typename Callback> @@ -302,19 +302,19 @@ void TextNode::split_into_lines(InlineFormattingContext& context, LayoutMode lay bool do_wrap_lines = true; bool do_wrap_breaks = false; - if (style().white_space() == CSS::WhiteSpace::Nowrap) { + if (computed_values().white_space() == CSS::WhiteSpace::Nowrap) { do_collapse = true; do_wrap_lines = false; do_wrap_breaks = false; - } else if (style().white_space() == CSS::WhiteSpace::Pre) { + } else if (computed_values().white_space() == CSS::WhiteSpace::Pre) { do_collapse = false; do_wrap_lines = false; do_wrap_breaks = true; - } else if (style().white_space() == CSS::WhiteSpace::PreLine) { + } else if (computed_values().white_space() == CSS::WhiteSpace::PreLine) { do_collapse = true; do_wrap_lines = true; do_wrap_breaks = true; - } else if (style().white_space() == CSS::WhiteSpace::PreWrap) { + } else if (computed_values().white_space() == CSS::WhiteSpace::PreWrap) { do_collapse = false; do_wrap_lines = true; do_wrap_breaks = true; diff --git a/Libraries/LibWeb/Painting/StackingContext.cpp b/Libraries/LibWeb/Painting/StackingContext.cpp index e07d640613..7524f4fff9 100644 --- a/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Libraries/LibWeb/Painting/StackingContext.cpp @@ -43,7 +43,7 @@ StackingContext::StackingContext(Box& box, StackingContext* parent) // FIXME: Don't sort on every append.. quick_sort(m_parent->m_children, [](auto& a, auto& b) { - return a->m_box.style().z_index().value_or(0) < b->m_box.style().z_index().value_or(0); + return a->m_box.computed_values().z_index().value_or(0) < b->m_box.computed_values().z_index().value_or(0); }); } } |