mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Move containment checks to Layout::Node
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
It fits better there and avoids having to reach into the Element all the time.
This commit is contained in:
parent
4989c5c793
commit
a0be82b2cb
Notes:
github-actions[bot]
2025-05-13 12:32:25 +00:00
Author: https://github.com/Psychpsyo
Commit: a0be82b2cb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4565
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/kalenikaliaksandr
10 changed files with 145 additions and 169 deletions
|
@ -129,8 +129,7 @@ void ViewportPaintable::assign_clip_frames()
|
|||
auto overflow_y = paintable_box.computed_values().overflow_y();
|
||||
// Note: Overflow may be clip on one axis and visible on the other.
|
||||
auto has_hidden_overflow = overflow_x != CSS::Overflow::Visible || overflow_y != CSS::Overflow::Visible;
|
||||
auto element = as_if<DOM::Element>(paintable_box.layout_node().dom_node());
|
||||
if (has_hidden_overflow || paintable_box.get_clip_rect().has_value() || (element && element->has_paint_containment())) {
|
||||
if (has_hidden_overflow || paintable_box.get_clip_rect().has_value() || paintable_box.layout_node().has_paint_containment()) {
|
||||
auto clip_frame = adopt_ref(*new ClipFrame());
|
||||
clip_state.set(paintable_box, move(clip_frame));
|
||||
}
|
||||
|
@ -185,14 +184,12 @@ void ViewportPaintable::assign_clip_frames()
|
|||
// any such mechanism through other properties, such as overflow, resize, or text-overflow.
|
||||
// NOTE: This clipping shape respects overflow-clip-margin, allowing an element with paint containment
|
||||
// to still slightly overflow its normal bounds.
|
||||
if (auto element = as_if<DOM::Element>(block->dom_node())) {
|
||||
if (element->has_paint_containment()) {
|
||||
// NOTE: Note: The behavior is described in this paragraph is equivalent to changing 'overflow-x: visible' into
|
||||
// 'overflow-x: clip' and 'overflow-y: visible' into 'overflow-y: clip' at used value time, while leaving other
|
||||
// values of 'overflow-x' and 'overflow-y' unchanged.
|
||||
clip_x = true;
|
||||
clip_y = true;
|
||||
}
|
||||
if (block->has_paint_containment()) {
|
||||
// NOTE: Note: The behavior is described in this paragraph is equivalent to changing 'overflow-x: visible' into
|
||||
// 'overflow-x: clip' and 'overflow-y: visible' into 'overflow-y: clip' at used value time, while leaving other
|
||||
// values of 'overflow-x' and 'overflow-y' unchanged.
|
||||
clip_x = true;
|
||||
clip_y = true;
|
||||
}
|
||||
|
||||
if (clip_x || clip_y) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue