layout: Merge BoxFragment::used_overflow into ComputedValuesExt::effective_overflow (#35670) (#35670)

* Update wpt-test



* Merge used_overflow to effective_overflow; remove duplicate call



* Remove more duplicate calls; update effective_overflow logic



* Update reference link&style



* Apply final review suggestions

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
Euclid Ye 2025-03-03 05:44:59 +08:00 committed by GitHub
parent b56a3caea0
commit 28cea920ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 54 additions and 47 deletions

View file

@ -39,7 +39,7 @@ use crate::fragment_tree::{
PositioningFragment, SpecificLayoutInfo,
};
use crate::geom::{AuOrAuto, PhysicalRect, PhysicalSides};
use crate::style_ext::{AxesOverflow, ComputedValuesExt};
use crate::style_ext::ComputedValuesExt;
#[derive(Clone)]
pub(crate) struct ContainingBlock {
@ -1372,23 +1372,6 @@ impl BoxFragment {
Some(display_list.define_clip_chain(*parent_clip_chain_id, [clip_id]))
}
// TODO: merge this function with style.effective_overflow()
fn used_overflow(&self) -> AxesOverflow {
let mut overflow = self.style.effective_overflow();
let is_replaced_element = self.base.flags.contains(FragmentFlags::IS_REPLACED);
if is_replaced_element {
if overflow.x != ComputedOverflow::Visible {
overflow.x = ComputedOverflow::Clip;
}
if overflow.y != ComputedOverflow::Visible {
overflow.y = ComputedOverflow::Clip;
}
}
overflow
}
fn build_overflow_frame_if_necessary(
&self,
display_list: &mut DisplayList,
@ -1396,7 +1379,7 @@ impl BoxFragment {
parent_clip_chain_id: &wr::ClipChainId,
containing_block_rect: &PhysicalRect<Au>,
) -> Option<OverflowFrameData> {
let overflow = self.used_overflow();
let overflow = self.style.effective_overflow(self.base.flags);
if overflow.x == ComputedOverflow::Visible && overflow.y == ComputedOverflow::Visible {
return None;
@ -1483,8 +1466,6 @@ impl BoxFragment {
display_list.wr.pipeline_id,
);
let overflow = self.style.effective_overflow();
let sensitivity = AxesScrollSensitivity {
x: overflow.x.into(),
y: overflow.y.into(),