mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Propagate overflow values from <body>
to root element (#31618)
The specification gives instructions for how these values should be propagated. The other big changs here is that they aren't applied to the `<body>`. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
03d64d0675
commit
716f4a006d
17 changed files with 82 additions and 27 deletions
|
@ -25,7 +25,7 @@ use style::values::specified::ui::CursorKind;
|
|||
use style_traits::CSSPixel;
|
||||
use webrender_api::{self as wr, units, ClipChainId, ClipId, CommonItemProperties};
|
||||
use wr::units::LayoutVector2D;
|
||||
use wr::BoxShadowClipMode;
|
||||
use wr::{BoxShadowClipMode, ScrollSensitivity};
|
||||
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::conversions::ToWebRender;
|
||||
|
@ -77,6 +77,7 @@ impl DisplayList {
|
|||
content_size: units::LayoutSize,
|
||||
pipeline_id: wr::PipelineId,
|
||||
epoch: wr::Epoch,
|
||||
root_scroll_sensitivity: ScrollSensitivity,
|
||||
) -> Self {
|
||||
Self {
|
||||
wr: wr::DisplayListBuilder::new(pipeline_id),
|
||||
|
@ -85,6 +86,7 @@ impl DisplayList {
|
|||
content_size,
|
||||
pipeline_id,
|
||||
epoch,
|
||||
root_scroll_sensitivity,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ use crate::cell::ArcRefCell;
|
|||
use crate::display_list::conversions::{FilterToWebRender, ToWebRender};
|
||||
use crate::display_list::DisplayListBuilder;
|
||||
use crate::fragment_tree::{
|
||||
BoxFragment, ContainingBlockManager, Fragment, FragmentTree, PositioningFragment,
|
||||
BoxFragment, ContainingBlockManager, Fragment, FragmentFlags, FragmentTree, PositioningFragment,
|
||||
};
|
||||
use crate::geom::{PhysicalRect, PhysicalSides};
|
||||
use crate::style_ext::ComputedValuesExt;
|
||||
|
@ -1247,6 +1247,24 @@ impl BoxFragment {
|
|||
return None;
|
||||
}
|
||||
|
||||
// From https://drafts.csswg.org/css-overflow/#propdef-overflow:
|
||||
// > UAs must apply the overflow-* values set on the root element to the viewport when the
|
||||
// > root element’s display value is not none. However, when the root element is an [HTML]
|
||||
// > html element (including XML syntax for HTML) whose overflow value is visible (in both
|
||||
// > axes), and that element has as a child a body element whose display value is also not
|
||||
// > none, user agents must instead apply the overflow-* values of the first such child
|
||||
// > element to the viewport. The element from which the value is propagated must then have a
|
||||
// > used overflow value of visible.
|
||||
//
|
||||
// TODO: This should only happen when the `display` value is actually propagated.
|
||||
if self
|
||||
.base
|
||||
.flags
|
||||
.contains(FragmentFlags::IS_BODY_ELEMENT_OF_HTML_ELEMENT_ROOT)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
let tag = self.base.tag?;
|
||||
let external_id = wr::ExternalScrollId(
|
||||
tag.to_display_list_fragment_id(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue