mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
layout: Do not include position:fixed
children when calculating scrollable overflow for root element (#38618)
Reimplementation of: #35931 For a `FragmentTree` we define a scrollable overflow calculation that includes the overflow all of it's children `Fragments`. In practice we are using this calculation for scrolling area of the viewport and defining the root scroll frames. However, since uncontained fixed positioned element is located outside of the document and should not be scrolled, and therefore it would make no sense to include them in the calculation of its scrollable overflow as well. Testing: New and existing WPT tests Fixes: #38617 Fixes: #38182 --------- Signed-off-by: Jo Steven Novaryo <jo.steven.novaryo@huawei.com>
This commit is contained in:
parent
7dcd89a6f9
commit
7489a0349f
4 changed files with 58 additions and 5 deletions
|
@ -10,6 +10,7 @@ use compositing_traits::display_list::AxesScrollSensitivity;
|
|||
use fxhash::FxHashSet;
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use style::animation::AnimationSetKey;
|
||||
use style::computed_values::position::T as Position;
|
||||
|
||||
use super::{BoxFragment, ContainingBlockManager, Fragment};
|
||||
use crate::ArcRefCell;
|
||||
|
@ -124,9 +125,26 @@ impl FragmentTree {
|
|||
let scrollable_overflow = self.root_fragments.iter().fold(
|
||||
self.initial_containing_block,
|
||||
|overflow, fragment| {
|
||||
fragment
|
||||
.calculate_scrollable_overflow_for_parent()
|
||||
.union(&overflow)
|
||||
// Need to calculate the overflow for each fragments within the tree
|
||||
// because it is required in the next stages of reflow.
|
||||
let overflow_from_fragment =
|
||||
fragment.calculate_scrollable_overflow_for_parent();
|
||||
|
||||
// Scrollable overflow should be accumulated in the block that
|
||||
// establishes the containing block for the element. Thus, fixed
|
||||
// positioned fragments whose containing block is the initial
|
||||
// containing block should not be included in overflow calculation.
|
||||
// See <https://www.w3.org/TR/css-overflow-3/#scrollable>.
|
||||
if fragment
|
||||
.retrieve_box_fragment()
|
||||
.is_some_and(|box_fragment| {
|
||||
box_fragment.borrow().style.get_box().position == Position::Fixed
|
||||
})
|
||||
{
|
||||
return overflow;
|
||||
}
|
||||
|
||||
overflow.union(&overflow_from_fragment)
|
||||
},
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue