mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:17:34 +00:00
LibWeb: Apply CSS clip
property to an element as well as its children
d06d4eb
made the `clip` property apply to children of an absolute-
positioned element, but caused it not to be applied to the element the
property was applied to directly.
To fix this, apply the clip in new `before_paint()` and `after_paint()`
functions. Doing so keeps painter state from leaking from `paint()`,
but still allows subclasses of `PaintableBox` clip their contents
correctly without repeating the application of the clip rectangle.
This commit is contained in:
parent
2e45306d42
commit
9d4a1ac2b3
4 changed files with 47 additions and 9 deletions
|
@ -20,6 +20,9 @@ public:
|
|||
static JS::NonnullGCPtr<PaintableBox> create(Layout::Box const&);
|
||||
virtual ~PaintableBox();
|
||||
|
||||
virtual void before_paint(PaintContext&, PaintPhase) const override;
|
||||
virtual void after_paint(PaintContext&, PaintPhase) const override;
|
||||
|
||||
virtual void paint(PaintContext&, PaintPhase) const override;
|
||||
|
||||
bool is_visible() const { return layout_box().is_visible(); }
|
||||
|
@ -186,6 +189,8 @@ public:
|
|||
protected:
|
||||
explicit PaintableBox(Layout::Box const&);
|
||||
|
||||
Optional<CSSPixelRect> get_clip_rect() const;
|
||||
|
||||
virtual void paint_border(PaintContext&) const;
|
||||
virtual void paint_backdrop_filter(PaintContext&) const;
|
||||
virtual void paint_background(PaintContext&) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue