diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2021-09-18 21:31:08 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-19 22:53:35 +0200 |
commit | 3b6325e7874292f78305014ab0312afad902b7cc (patch) | |
tree | 6cbc26775b29a4eed0f45a3f1aa70eb7b8eb1a3d /Userland | |
parent | aaf12929d51d5e352b5d1ed544762f6ef6769249 (diff) | |
download | serenity-3b6325e7874292f78305014ab0312afad902b7cc.zip |
LibWeb: Move InlineNode background code from `paint_fragment` -> `paint`
`paint_fragment()` seems to never get called. Moving the painting to
`paint()` fixes the background.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/InlineNode.cpp | 13 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/InlineNode.h | 1 |
2 files changed, 6 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp index 0ef7b62d85..bc7a6c8a84 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineNode.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineNode.cpp @@ -40,18 +40,17 @@ void InlineNode::split_into_lines(InlineFormattingContext& context, LayoutMode l } } -void InlineNode::paint_fragment(PaintContext& context, const LineBoxFragment& fragment, PaintPhase phase) const +void InlineNode::paint(PaintContext& context, PaintPhase phase) { auto& painter = context.painter(); if (phase == PaintPhase::Background) { - painter.fill_rect(enclosing_int_rect(fragment.absolute_rect()), computed_values().background_color()); + containing_block()->for_each_fragment([&](auto& fragment) { + if (is_inclusive_ancestor_of(fragment.layout_node())) + painter.fill_rect(enclosing_int_rect(fragment.absolute_rect()), computed_values().background_color()); + return IterationDecision::Continue; + }); } -} - -void InlineNode::paint(PaintContext& context, PaintPhase phase) -{ - auto& painter = context.painter(); if (phase == PaintPhase::Foreground && document().inspected_node() == dom_node()) { // FIXME: This paints a double-thick border between adjacent fragments, where ideally there diff --git a/Userland/Libraries/LibWeb/Layout/InlineNode.h b/Userland/Libraries/LibWeb/Layout/InlineNode.h index 5f6d4d4597..e2e39600f3 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineNode.h +++ b/Userland/Libraries/LibWeb/Layout/InlineNode.h @@ -16,7 +16,6 @@ public: virtual ~InlineNode() override; virtual void paint(PaintContext&, PaintPhase) override; - virtual void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const override; virtual void split_into_lines(InlineFormattingContext&, LayoutMode) override; }; |