mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:57:35 +00:00
LibWeb: Account for all clipped border radii in containing block chain
With this change, instead of applying only the border-radius clipping from the closest containing block with hidden overflow, we now collect all boxes within the containing block chain and apply the clipping from all of them.
This commit is contained in:
parent
1ae416fa94
commit
d4932196cc
9 changed files with 133 additions and 32 deletions
40
Userland/Libraries/LibWeb/Painting/ClipFrame.h
Normal file
40
Userland/Libraries/LibWeb/Painting/ClipFrame.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Painting/BorderRadiiData.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
||||
struct BorderRadiiClip {
|
||||
CSSPixelRect rect;
|
||||
BorderRadiiData radii;
|
||||
};
|
||||
|
||||
struct ClipFrame : public RefCounted<ClipFrame> {
|
||||
Vector<BorderRadiiClip> const& border_radii_clips() const { return m_border_radii_clips; }
|
||||
void add_border_radii_clip(BorderRadiiClip border_radii_clip)
|
||||
{
|
||||
for (auto& existing_clip : m_border_radii_clips) {
|
||||
if (border_radii_clip.rect == existing_clip.rect) {
|
||||
existing_clip.radii.union_max_radii(border_radii_clip.radii);
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_border_radii_clips.append(border_radii_clip);
|
||||
}
|
||||
|
||||
CSSPixelRect rect() const { return m_rect; }
|
||||
void set_rect(CSSPixelRect rect) { m_rect = rect; }
|
||||
|
||||
private:
|
||||
CSSPixelRect m_rect;
|
||||
Vector<BorderRadiiClip> m_border_radii_clips;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue