mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:17:35 +00:00
LibWeb: Clip hidden overflow by absolute rect of containing block
Since handling overflow: hidden in PaintableBox::before_children_paint while following paint traversal order can't result in correctly computed clip rectangle for elements that create their own stacking context (because before_children_paint is called only for parent but overflow: hidden can be set somewhere deeper but not in direct ancestor), here introduced new function PaintableBox::clip_rect() that computes clip rectangle by looking into containing block. should_clip_overflow flag that disables clip for absolutely positioned elements in before_children_paint and after_children_paint is removed because after changing clip rectangle to be computed from not parent but containing block it is not needed anymore (absolutely positioned item is clipped if it's containing block has hidden overflow)
This commit is contained in:
parent
c1401b37c4
commit
f3d57e1157
10 changed files with 55 additions and 40 deletions
|
@ -96,6 +96,8 @@ public:
|
|||
return m_overflow_data->scrollable_overflow_rect;
|
||||
}
|
||||
|
||||
Optional<Gfx::IntRect> clip_rect() const;
|
||||
|
||||
void set_overflow_data(Optional<OverflowData> data) { m_overflow_data = move(data); }
|
||||
void set_containing_line_box_fragment(Optional<Layout::LineBoxFragmentCoordinate>);
|
||||
|
||||
|
@ -110,8 +112,8 @@ public:
|
|||
DOM::Document const& document() const { return layout_box().document(); }
|
||||
DOM::Document& document() { return layout_box().document(); }
|
||||
|
||||
virtual void before_children_paint(PaintContext&, PaintPhase, ShouldClipOverflow) const override;
|
||||
virtual void after_children_paint(PaintContext&, PaintPhase, ShouldClipOverflow) const override;
|
||||
virtual void before_children_paint(PaintContext&, PaintPhase) const override;
|
||||
virtual void after_children_paint(PaintContext&, PaintPhase) const override;
|
||||
|
||||
virtual Optional<HitTestResult> hit_test(Gfx::FloatPoint const&, HitTestType) const override;
|
||||
|
||||
|
@ -153,6 +155,8 @@ private:
|
|||
Optional<Gfx::FloatRect> mutable m_absolute_rect;
|
||||
Optional<Gfx::FloatRect> mutable m_absolute_paint_rect;
|
||||
|
||||
Optional<Gfx::IntRect> mutable m_clip_rect;
|
||||
|
||||
mutable bool m_clipping_overflow { false };
|
||||
Optional<BorderRadiusCornerClipper> mutable m_overflow_corner_radius_clipper;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue