mirror of
https://github.com/servo/servo.git
synced 2025-07-16 20:03:39 +01:00
Rename ScrollRoot to ClipScrollNode
ScrollRoot is an ever increasingly inaccurate name for this thing and WebRender consistently uses ClipScrollNode nowadays. Stick with the WebRender terminology to be consistent.
This commit is contained in:
parent
ee46bc57ed
commit
cedc7ebc53
4 changed files with 128 additions and 127 deletions
|
@ -77,7 +77,7 @@ impl<'a> ScrollOffsetLookup<'a> {
|
||||||
None => return None,
|
None => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let scroll_offset = self.full_offset_for_scroll_root(&clip_id);
|
let scroll_offset = self.full_offset_for_clip_scroll_node(&clip_id);
|
||||||
*point = Point2D::new(point.x - Au::from_f32_px(scroll_offset.x),
|
*point = Point2D::new(point.x - Au::from_f32_px(scroll_offset.x),
|
||||||
point.y - Au::from_f32_px(scroll_offset.y));
|
point.y - Au::from_f32_px(scroll_offset.y));
|
||||||
let frac_point = inv_transform.transform_point2d(&Point2D::new(point.x.to_f32_px(),
|
let frac_point = inv_transform.transform_point2d(&Point2D::new(point.x.to_f32_px(),
|
||||||
|
@ -93,18 +93,18 @@ impl<'a> ScrollOffsetLookup<'a> {
|
||||||
Some(sublookup)
|
Some(sublookup)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_scroll_root(&mut self, scroll_root: &ScrollRoot) {
|
fn add_clip_scroll_node(&mut self, clip_scroll_node: &ClipScrollNode) {
|
||||||
self.parents.insert(scroll_root.id, scroll_root.parent_id);
|
self.parents.insert(clip_scroll_node.id, clip_scroll_node.parent_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn full_offset_for_scroll_root(&mut self, id: &ClipId) -> Vector2D<f32> {
|
fn full_offset_for_clip_scroll_node(&mut self, id: &ClipId) -> Vector2D<f32> {
|
||||||
if let Some(offset) = self.calculated_total_offsets.get(id) {
|
if let Some(offset) = self.calculated_total_offsets.get(id) {
|
||||||
return *offset;
|
return *offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
let parent_offset = if !id.is_root_scroll_node() {
|
let parent_offset = if !id.is_root_scroll_node() {
|
||||||
let parent_id = *self.parents.get(id).unwrap();
|
let parent_id = *self.parents.get(id).unwrap();
|
||||||
self.full_offset_for_scroll_root(&parent_id)
|
self.full_offset_for_clip_scroll_node(&parent_id)
|
||||||
} else {
|
} else {
|
||||||
Vector2D::zero()
|
Vector2D::zero()
|
||||||
};
|
};
|
||||||
|
@ -160,8 +160,8 @@ impl DisplayList {
|
||||||
offset_lookup,
|
offset_lookup,
|
||||||
result);
|
result);
|
||||||
}
|
}
|
||||||
&DisplayItem::DefineClip(ref item) => {
|
&DisplayItem::DefineClipScrollNode(ref item) => {
|
||||||
offset_lookup.add_scroll_root(&item.scroll_root);
|
offset_lookup.add_clip_scroll_node(&item.node);
|
||||||
}
|
}
|
||||||
&DisplayItem::PopStackingContext(_) => return,
|
&DisplayItem::PopStackingContext(_) => return,
|
||||||
&DisplayItem::Text(ref text) => {
|
&DisplayItem::Text(ref text) => {
|
||||||
|
@ -237,8 +237,8 @@ impl DisplayList {
|
||||||
result);
|
result);
|
||||||
}
|
}
|
||||||
&DisplayItem::PopStackingContext(_) => return,
|
&DisplayItem::PopStackingContext(_) => return,
|
||||||
&DisplayItem::DefineClip(ref item) => {
|
&DisplayItem::DefineClipScrollNode(ref item) => {
|
||||||
offset_lookup.add_scroll_root(&item.scroll_root);
|
offset_lookup.add_clip_scroll_node(&item.node);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if let Some(meta) = item.hit_test(*point, offset_lookup) {
|
if let Some(meta) = item.hit_test(*point, offset_lookup) {
|
||||||
|
@ -558,20 +558,20 @@ impl fmt::Debug for StackingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
||||||
pub enum ScrollRootType {
|
pub enum ClipScrollNodeType {
|
||||||
ScrollFrame(ScrollSensitivity),
|
ScrollFrame(ScrollSensitivity),
|
||||||
StickyFrame(StickyFrameInfo),
|
StickyFrame(StickyFrameInfo),
|
||||||
Clip,
|
Clip,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines a stacking context.
|
/// Defines a clip scroll node.
|
||||||
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
||||||
pub struct ScrollRoot {
|
pub struct ClipScrollNode {
|
||||||
/// The WebRender clip id of this scroll root based on the source of this clip
|
/// The WebRender clip id of this scroll root based on the source of this clip
|
||||||
/// and information about the fragment.
|
/// and information about the fragment.
|
||||||
pub id: ClipId,
|
pub id: ClipId,
|
||||||
|
|
||||||
/// The unique ID of the parent of this ScrollRoot.
|
/// The unique ID of the parent of this ClipScrollNode.
|
||||||
pub parent_id: ClipId,
|
pub parent_id: ClipId,
|
||||||
|
|
||||||
/// The position of this scroll root's frame in the parent stacking context.
|
/// The position of this scroll root's frame in the parent stacking context.
|
||||||
|
@ -580,15 +580,15 @@ pub struct ScrollRoot {
|
||||||
/// The rect of the contents that can be scrolled inside of the scroll root.
|
/// The rect of the contents that can be scrolled inside of the scroll root.
|
||||||
pub content_rect: Rect<Au>,
|
pub content_rect: Rect<Au>,
|
||||||
|
|
||||||
/// The type of this ScrollRoot.
|
/// The type of this ClipScrollNode.
|
||||||
pub root_type: ScrollRootType
|
pub node_type: ClipScrollNodeType,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ScrollRoot {
|
impl ClipScrollNode {
|
||||||
pub fn to_define_item(&self, pipeline_id: PipelineId) -> DisplayItem {
|
pub fn to_define_item(&self, pipeline_id: PipelineId) -> DisplayItem {
|
||||||
DisplayItem::DefineClip(box DefineClipItem {
|
DisplayItem::DefineClipScrollNode(box DefineClipScrollNodeItem {
|
||||||
base: BaseDisplayItem::empty(pipeline_id),
|
base: BaseDisplayItem::empty(pipeline_id),
|
||||||
scroll_root: self.clone(),
|
node: self.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,7 +610,7 @@ pub enum DisplayItem {
|
||||||
Iframe(Box<IframeDisplayItem>),
|
Iframe(Box<IframeDisplayItem>),
|
||||||
PushStackingContext(Box<PushStackingContextItem>),
|
PushStackingContext(Box<PushStackingContextItem>),
|
||||||
PopStackingContext(Box<PopStackingContextItem>),
|
PopStackingContext(Box<PopStackingContextItem>),
|
||||||
DefineClip(Box<DefineClipItem>),
|
DefineClipScrollNode(Box<DefineClipScrollNodeItem>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Information common to all display items.
|
/// Information common to all display items.
|
||||||
|
@ -1215,12 +1215,12 @@ pub struct PopStackingContextItem {
|
||||||
|
|
||||||
/// Starts a group of items inside a particular scroll root.
|
/// Starts a group of items inside a particular scroll root.
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
||||||
pub struct DefineClipItem {
|
pub struct DefineClipScrollNodeItem {
|
||||||
/// Fields common to all display items.
|
/// Fields common to all display items.
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
|
|
||||||
/// The scroll root that this item starts.
|
/// The scroll root that this item starts.
|
||||||
pub scroll_root: ScrollRoot,
|
pub node: ClipScrollNode,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// How a box shadow should be clipped.
|
/// How a box shadow should be clipped.
|
||||||
|
@ -1252,7 +1252,7 @@ impl DisplayItem {
|
||||||
DisplayItem::Iframe(ref iframe) => &iframe.base,
|
DisplayItem::Iframe(ref iframe) => &iframe.base,
|
||||||
DisplayItem::PushStackingContext(ref stacking_context) => &stacking_context.base,
|
DisplayItem::PushStackingContext(ref stacking_context) => &stacking_context.base,
|
||||||
DisplayItem::PopStackingContext(ref item) => &item.base,
|
DisplayItem::PopStackingContext(ref item) => &item.base,
|
||||||
DisplayItem::DefineClip(ref item) => &item.base,
|
DisplayItem::DefineClipScrollNode(ref item) => &item.base,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1292,7 +1292,7 @@ impl DisplayItem {
|
||||||
// test elements with `border-radius`, for example.
|
// test elements with `border-radius`, for example.
|
||||||
let base_item = self.base();
|
let base_item = self.base();
|
||||||
|
|
||||||
let scroll_offset = offset_lookup.full_offset_for_scroll_root(&self.scroll_node_id());
|
let scroll_offset = offset_lookup.full_offset_for_clip_scroll_node(&self.scroll_node_id());
|
||||||
let point = Point2D::new(point.x - Au::from_f32_px(scroll_offset.x),
|
let point = Point2D::new(point.x - Au::from_f32_px(scroll_offset.x),
|
||||||
point.y - Au::from_f32_px(scroll_offset.y));
|
point.y - Au::from_f32_px(scroll_offset.y));
|
||||||
|
|
||||||
|
@ -1349,8 +1349,8 @@ impl fmt::Debug for DisplayItem {
|
||||||
return write!(f, "PopStackingContext({:?}", item.stacking_context_id);
|
return write!(f, "PopStackingContext({:?}", item.stacking_context_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let DisplayItem::DefineClip(ref item) = *self {
|
if let DisplayItem::DefineClipScrollNode(ref item) = *self {
|
||||||
return write!(f, "DefineClip({:?}", item.scroll_root);
|
return write!(f, "DefineClipScrollNode({:?}", item.node);
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(f, "{} @ {:?} {:?}",
|
write!(f, "{} @ {:?} {:?}",
|
||||||
|
@ -1377,7 +1377,7 @@ impl fmt::Debug for DisplayItem {
|
||||||
DisplayItem::Iframe(_) => "Iframe".to_owned(),
|
DisplayItem::Iframe(_) => "Iframe".to_owned(),
|
||||||
DisplayItem::PushStackingContext(_) |
|
DisplayItem::PushStackingContext(_) |
|
||||||
DisplayItem::PopStackingContext(_) |
|
DisplayItem::PopStackingContext(_) |
|
||||||
DisplayItem::DefineClip(_) => "".to_owned(),
|
DisplayItem::DefineClipScrollNode(_) => "".to_owned(),
|
||||||
},
|
},
|
||||||
self.bounds(),
|
self.bounds(),
|
||||||
self.base().local_clip
|
self.base().local_clip
|
||||||
|
|
|
@ -1680,7 +1680,7 @@ impl BlockFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn overflow_style_may_require_scroll_root(&self) -> bool {
|
pub fn overflow_style_may_require_clip_scroll_node(&self) -> bool {
|
||||||
match (self.fragment.style().get_box().overflow_x,
|
match (self.fragment.style().get_box().overflow_x,
|
||||||
self.fragment.style().get_box().overflow_y) {
|
self.fragment.style().get_box().overflow_y) {
|
||||||
(overflow_x::T::auto, _) | (overflow_x::T::scroll, _) | (overflow_x::T::hidden, _) |
|
(overflow_x::T::auto, _) | (overflow_x::T::scroll, _) | (overflow_x::T::hidden, _) |
|
||||||
|
|
|
@ -18,19 +18,19 @@ use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Transform3D, TypedSize2D};
|
||||||
use euclid::Vector2D;
|
use euclid::Vector2D;
|
||||||
use flex::FlexFlow;
|
use flex::FlexFlow;
|
||||||
use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED};
|
use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED};
|
||||||
use fnv::FnvHashMap;
|
|
||||||
use flow_ref::FlowRef;
|
use flow_ref::FlowRef;
|
||||||
|
use fnv::FnvHashMap;
|
||||||
use fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ImageFragmentInfo, ScannedTextFragmentInfo};
|
use fragment::{CanvasFragmentSource, CoordinateSystem, Fragment, ImageFragmentInfo, ScannedTextFragmentInfo};
|
||||||
use fragment::{SpecificFragmentInfo, TruncatedFragmentInfo};
|
use fragment::{SpecificFragmentInfo, TruncatedFragmentInfo};
|
||||||
use gfx::display_list;
|
use gfx::display_list;
|
||||||
use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDetails, BorderDisplayItem};
|
use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDetails, BorderDisplayItem};
|
||||||
use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, ClippingRegion};
|
use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, ClipScrollNode};
|
||||||
use gfx::display_list::{DisplayItem, DisplayItemMetadata, DisplayList, DisplayListSection};
|
use gfx::display_list::{ClipScrollNodeType, ClippingRegion, DisplayItem, DisplayItemMetadata};
|
||||||
use gfx::display_list::{GradientDisplayItem, IframeDisplayItem, ImageBorder, ImageDisplayItem};
|
use gfx::display_list::{DisplayList, DisplayListSection, GradientDisplayItem, IframeDisplayItem};
|
||||||
use gfx::display_list::{LineDisplayItem, NormalBorder, OpaqueNode, PushTextShadowDisplayItem};
|
use gfx::display_list::{ImageBorder, ImageDisplayItem, LineDisplayItem, NormalBorder, OpaqueNode};
|
||||||
use gfx::display_list::{PopTextShadowDisplayItem, RadialGradientDisplayItem, ScrollRoot};
|
use gfx::display_list::{PopTextShadowDisplayItem, PushTextShadowDisplayItem};
|
||||||
use gfx::display_list::{ScrollRootType, SolidColorDisplayItem, StackingContext, StackingContextType};
|
use gfx::display_list::{RadialGradientDisplayItem, SolidColorDisplayItem, StackingContext};
|
||||||
use gfx::display_list::{TextDisplayItem, TextOrientation, WebRenderImageInfo};
|
use gfx::display_list::{StackingContextType, TextDisplayItem, TextOrientation, WebRenderImageInfo};
|
||||||
use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId};
|
use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId};
|
||||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
|
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
|
@ -143,14 +143,14 @@ fn get_cyclic<T>(arr: &[T], index: usize) -> &T {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct StackingContextInfo {
|
struct StackingContextInfo {
|
||||||
children: Vec<StackingContext>,
|
children: Vec<StackingContext>,
|
||||||
scroll_roots: Vec<ScrollRoot>,
|
clip_scroll_nodes: Vec<ClipScrollNode>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StackingContextInfo {
|
impl StackingContextInfo {
|
||||||
fn new() -> StackingContextInfo {
|
fn new() -> StackingContextInfo {
|
||||||
StackingContextInfo {
|
StackingContextInfo {
|
||||||
children: Vec::new(),
|
children: Vec::new(),
|
||||||
scroll_roots: Vec::new(),
|
clip_scroll_nodes: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,11 +166,11 @@ pub struct StackingContextCollectionState {
|
||||||
/// The root of the StackingContext tree.
|
/// The root of the StackingContext tree.
|
||||||
pub root_stacking_context: StackingContext,
|
pub root_stacking_context: StackingContext,
|
||||||
|
|
||||||
/// StackingContext and ScrollRoot children for each StackingContext.
|
/// StackingContext and ClipScrollNode children for each StackingContext.
|
||||||
stacking_context_info: FnvHashMap<StackingContextId, StackingContextInfo>,
|
stacking_context_info: FnvHashMap<StackingContextId, StackingContextInfo>,
|
||||||
|
|
||||||
/// A map establishing the parent child relationship of every ScrollRoot.
|
/// A map establishing the parent child relationship of every ClipScrollNode.
|
||||||
pub scroll_root_parents: FnvHashMap<ClipId, ClipId>,
|
pub clip_scroll_node_parents: FnvHashMap<ClipId, ClipId>,
|
||||||
|
|
||||||
/// The current stacking context id, used to keep track of state when building.
|
/// The current stacking context id, used to keep track of state when building.
|
||||||
/// recursively building and processing the display list.
|
/// recursively building and processing the display list.
|
||||||
|
@ -207,7 +207,7 @@ impl StackingContextCollectionState {
|
||||||
pipeline_id: pipeline_id,
|
pipeline_id: pipeline_id,
|
||||||
root_stacking_context: StackingContext::root(pipeline_id),
|
root_stacking_context: StackingContext::root(pipeline_id),
|
||||||
stacking_context_info: FnvHashMap::default(),
|
stacking_context_info: FnvHashMap::default(),
|
||||||
scroll_root_parents: FnvHashMap::default(),
|
clip_scroll_node_parents: FnvHashMap::default(),
|
||||||
current_stacking_context_id: StackingContextId::root(),
|
current_stacking_context_id: StackingContextId::root(),
|
||||||
current_real_stacking_context_id: StackingContextId::root(),
|
current_real_stacking_context_id: StackingContextId::root(),
|
||||||
current_clip_and_scroll_info: root_clip_info,
|
current_clip_and_scroll_info: root_clip_info,
|
||||||
|
@ -227,20 +227,20 @@ impl StackingContextCollectionState {
|
||||||
info.children.push(stacking_context);
|
info.children.push(stacking_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_scroll_root(&mut self, id: ClipId) -> bool {
|
fn has_clip_scroll_node(&mut self, id: ClipId) -> bool {
|
||||||
self.scroll_root_parents.contains_key(&id)
|
self.clip_scroll_node_parents.contains_key(&id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_scroll_root(&mut self, scroll_root: ScrollRoot) {
|
fn add_clip_scroll_node(&mut self, clip_scroll_node: ClipScrollNode) {
|
||||||
// We want the scroll root to be defined before any possible item that could use it,
|
// We want the scroll root to be defined before any possible item that could use it,
|
||||||
// so we make sure that it is added to the beginning of the parent "real" (non-pseudo)
|
// so we make sure that it is added to the beginning of the parent "real" (non-pseudo)
|
||||||
// stacking context. This ensures that item reordering will not result in an item using
|
// stacking context. This ensures that item reordering will not result in an item using
|
||||||
// the scroll root before it is defined.
|
// the scroll root before it is defined.
|
||||||
self.scroll_root_parents.insert(scroll_root.id, scroll_root.parent_id);
|
self.clip_scroll_node_parents.insert(clip_scroll_node.id, clip_scroll_node.parent_id);
|
||||||
let info = self.stacking_context_info
|
let info = self.stacking_context_info
|
||||||
.entry(self.current_real_stacking_context_id)
|
.entry(self.current_real_stacking_context_id)
|
||||||
.or_insert(StackingContextInfo::new());
|
.or_insert(StackingContextInfo::new());
|
||||||
info.scroll_roots.push(scroll_root);
|
info.clip_scroll_nodes.push(clip_scroll_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,18 +251,18 @@ pub struct DisplayListBuildState<'a> {
|
||||||
/// The root of the StackingContext tree.
|
/// The root of the StackingContext tree.
|
||||||
pub root_stacking_context: StackingContext,
|
pub root_stacking_context: StackingContext,
|
||||||
|
|
||||||
/// StackingContext and ScrollRoot children for each StackingContext.
|
/// StackingContext and ClipScrollNode children for each StackingContext.
|
||||||
stacking_context_info: FnvHashMap<StackingContextId, StackingContextInfo>,
|
stacking_context_info: FnvHashMap<StackingContextId, StackingContextInfo>,
|
||||||
|
|
||||||
/// A map establishing the parent child relationship of every ScrollRoot.
|
/// A map establishing the parent child relationship of every ClipScrollNode.
|
||||||
pub scroll_root_parents: FnvHashMap<ClipId, ClipId>,
|
pub clip_scroll_node_parents: FnvHashMap<ClipId, ClipId>,
|
||||||
|
|
||||||
/// The items in this display list.
|
/// The items in this display list.
|
||||||
pub items: FnvHashMap<StackingContextId, Vec<DisplayItem>>,
|
pub items: FnvHashMap<StackingContextId, Vec<DisplayItem>>,
|
||||||
|
|
||||||
/// Whether or not we are processing an element that establishes a scroll root, used
|
/// Whether or not we are processing an element that establishes scrolling overflow. Used
|
||||||
/// to determine what ScrollRoot to place backgrounds and borders into.
|
/// to determine what ClipScrollNode to place backgrounds and borders into.
|
||||||
pub processing_scroll_root_element: bool,
|
pub processing_scrolling_overflow_element: bool,
|
||||||
|
|
||||||
/// The current stacking context id, used to keep track of state when building.
|
/// The current stacking context id, used to keep track of state when building.
|
||||||
/// recursively building and processing the display list.
|
/// recursively building and processing the display list.
|
||||||
|
@ -287,8 +287,8 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
root_stacking_context: state.root_stacking_context,
|
root_stacking_context: state.root_stacking_context,
|
||||||
items: FnvHashMap::default(),
|
items: FnvHashMap::default(),
|
||||||
stacking_context_info: state.stacking_context_info,
|
stacking_context_info: state.stacking_context_info,
|
||||||
scroll_root_parents: state.scroll_root_parents,
|
clip_scroll_node_parents: state.clip_scroll_node_parents,
|
||||||
processing_scroll_root_element: false,
|
processing_scrolling_overflow_element: false,
|
||||||
current_stacking_context_id: StackingContextId::root(),
|
current_stacking_context_id: StackingContextId::root(),
|
||||||
current_clip_and_scroll_info: root_clip_info,
|
current_clip_and_scroll_info: root_clip_info,
|
||||||
iframe_sizes: Vec::new(),
|
iframe_sizes: Vec::new(),
|
||||||
|
@ -300,19 +300,19 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
items.push(display_item);
|
items.push(display_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_scroll_root_id(&self, scroll_root_id: ClipId) -> ClipId {
|
fn parent_clip_scroll_node_id(&self, clip_scroll_node_id: ClipId) -> ClipId {
|
||||||
if scroll_root_id.is_root_scroll_node() {
|
if clip_scroll_node_id.is_root_scroll_node() {
|
||||||
return scroll_root_id;
|
return clip_scroll_node_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_assert!(self.scroll_root_parents.contains_key(&scroll_root_id));
|
debug_assert!(self.clip_scroll_node_parents.contains_key(&clip_scroll_node_id));
|
||||||
*self.scroll_root_parents.get(&scroll_root_id).unwrap()
|
*self.clip_scroll_node_parents.get(&clip_scroll_node_id).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_background_or_border_of_scroll_root(&self, section: DisplayListSection) -> bool {
|
fn is_background_or_border_of_clip_scroll_node(&self, section: DisplayListSection) -> bool {
|
||||||
(section == DisplayListSection::BackgroundAndBorders ||
|
(section == DisplayListSection::BackgroundAndBorders ||
|
||||||
section == DisplayListSection::BlockBackgroundsAndBorders) &&
|
section == DisplayListSection::BlockBackgroundsAndBorders) &&
|
||||||
self.processing_scroll_root_element
|
self.processing_scrolling_overflow_element
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_base_display_item(&self,
|
fn create_base_display_item(&self,
|
||||||
|
@ -322,8 +322,8 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
cursor: Option<Cursor>,
|
cursor: Option<Cursor>,
|
||||||
section: DisplayListSection)
|
section: DisplayListSection)
|
||||||
-> BaseDisplayItem {
|
-> BaseDisplayItem {
|
||||||
let clip_and_scroll_info = if self.is_background_or_border_of_scroll_root(section) {
|
let clip_and_scroll_info = if self.is_background_or_border_of_clip_scroll_node(section) {
|
||||||
ClipAndScrollInfo::simple(self.parent_scroll_root_id(self.current_clip_and_scroll_info.scroll_node_id))
|
ClipAndScrollInfo::simple(self.parent_clip_scroll_node_id(self.current_clip_and_scroll_info.scroll_node_id))
|
||||||
} else {
|
} else {
|
||||||
self.current_clip_and_scroll_info
|
self.current_clip_and_scroll_info
|
||||||
};
|
};
|
||||||
|
@ -365,12 +365,12 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
|
|
||||||
let pipeline_id = self.layout_context.id;
|
let pipeline_id = self.layout_context.id;
|
||||||
if stacking_context.context_type != StackingContextType::Real {
|
if stacking_context.context_type != StackingContextType::Real {
|
||||||
list.extend(info.scroll_roots.into_iter().map(|root| root.to_define_item(pipeline_id)));
|
list.extend(info.clip_scroll_nodes.into_iter().map(|root| root.to_define_item(pipeline_id)));
|
||||||
self.to_display_list_for_items(list, child_items, info.children);
|
self.to_display_list_for_items(list, child_items, info.children);
|
||||||
} else {
|
} else {
|
||||||
let (push_item, pop_item) = stacking_context.to_display_list_items(pipeline_id);
|
let (push_item, pop_item) = stacking_context.to_display_list_items(pipeline_id);
|
||||||
list.push(push_item);
|
list.push(push_item);
|
||||||
list.extend(info.scroll_roots.into_iter().map(|root| root.to_define_item(pipeline_id)));
|
list.extend(info.clip_scroll_nodes.into_iter().map(|root| root.to_define_item(pipeline_id)));
|
||||||
self.to_display_list_for_items(list, child_items, info.children);
|
self.to_display_list_for_items(list, child_items, info.children);
|
||||||
list.push(pop_item);
|
list.push(pop_item);
|
||||||
}
|
}
|
||||||
|
@ -2330,13 +2330,13 @@ pub trait BlockFlowDisplayListBuilding {
|
||||||
stacking_context_type: BlockStackingContextType,
|
stacking_context_type: BlockStackingContextType,
|
||||||
can_establish_containing_block: EstablishContainingBlock)
|
can_establish_containing_block: EstablishContainingBlock)
|
||||||
-> ClipAndScrollInfo;
|
-> ClipAndScrollInfo;
|
||||||
fn setup_scroll_root_for_position(&mut self,
|
fn setup_clip_scroll_node_for_position(&mut self,
|
||||||
state: &mut StackingContextCollectionState,
|
state: &mut StackingContextCollectionState,
|
||||||
border_box: &Rect<Au>);
|
border_box: &Rect<Au>);
|
||||||
fn setup_scroll_root_for_overflow(&mut self,
|
fn setup_clip_scroll_node_for_overflow(&mut self,
|
||||||
state: &mut StackingContextCollectionState,
|
state: &mut StackingContextCollectionState,
|
||||||
border_box: &Rect<Au>);
|
border_box: &Rect<Au>);
|
||||||
fn setup_scroll_root_for_css_clip(&mut self,
|
fn setup_clip_scroll_node_for_css_clip(&mut self,
|
||||||
state: &mut StackingContextCollectionState,
|
state: &mut StackingContextCollectionState,
|
||||||
preserved_state: &mut SavedStackingContextCollectionState,
|
preserved_state: &mut SavedStackingContextCollectionState,
|
||||||
stacking_relative_border_box: &Rect<Au>);
|
stacking_relative_border_box: &Rect<Au>);
|
||||||
|
@ -2566,9 +2566,9 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
self.transform_clip_to_coordinate_space(state, preserved_state);
|
self.transform_clip_to_coordinate_space(state, preserved_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setup_scroll_root_for_position(state, &stacking_relative_border_box);
|
self.setup_clip_scroll_node_for_position(state, &stacking_relative_border_box);
|
||||||
self.setup_scroll_root_for_overflow(state, &stacking_relative_border_box);
|
self.setup_clip_scroll_node_for_overflow(state, &stacking_relative_border_box);
|
||||||
self.setup_scroll_root_for_css_clip(state, preserved_state, &stacking_relative_border_box);
|
self.setup_clip_scroll_node_for_css_clip(state, preserved_state, &stacking_relative_border_box);
|
||||||
self.base.clip = state.clip_stack.last().cloned().unwrap_or_else(max_rect);
|
self.base.clip = state.clip_stack.last().cloned().unwrap_or_else(max_rect);
|
||||||
|
|
||||||
// We keep track of our position so that any stickily positioned elements can
|
// We keep track of our position so that any stickily positioned elements can
|
||||||
|
@ -2592,7 +2592,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
containing_clip_and_scroll_info
|
containing_clip_and_scroll_info
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup_scroll_root_for_position(&mut self,
|
fn setup_clip_scroll_node_for_position(&mut self,
|
||||||
state: &mut StackingContextCollectionState,
|
state: &mut StackingContextCollectionState,
|
||||||
border_box: &Rect<Au>) {
|
border_box: &Rect<Au>) {
|
||||||
if self.positioning() != position::T::sticky {
|
if self.positioning() != position::T::sticky {
|
||||||
|
@ -2640,28 +2640,28 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
to_sticky_info(sticky_position.left,
|
to_sticky_info(sticky_position.left,
|
||||||
to_max_offset(constraint_rect.max_x(), border_box_in_parent.max_x())));
|
to_max_offset(constraint_rect.max_x(), border_box_in_parent.max_x())));
|
||||||
|
|
||||||
let new_scroll_root_id = ClipId::new(self.fragment.unique_id(IdType::OverflowClip),
|
let new_clip_scroll_node_id = ClipId::new(self.fragment.unique_id(IdType::OverflowClip),
|
||||||
state.pipeline_id.to_webrender());
|
state.pipeline_id.to_webrender());
|
||||||
let parent_id = self.clip_and_scroll_info(state.pipeline_id).scroll_node_id;
|
let parent_id = self.clip_and_scroll_info(state.pipeline_id).scroll_node_id;
|
||||||
state.add_scroll_root(
|
state.add_clip_scroll_node(
|
||||||
ScrollRoot {
|
ClipScrollNode {
|
||||||
id: new_scroll_root_id,
|
id: new_clip_scroll_node_id,
|
||||||
parent_id: parent_id,
|
parent_id: parent_id,
|
||||||
clip: ClippingRegion::from_rect(border_box),
|
clip: ClippingRegion::from_rect(border_box),
|
||||||
content_rect: Rect::zero(),
|
content_rect: Rect::zero(),
|
||||||
root_type: ScrollRootType::StickyFrame(sticky_frame_info),
|
node_type: ClipScrollNodeType::StickyFrame(sticky_frame_info),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let new_clip_and_scroll_info = ClipAndScrollInfo::simple(new_scroll_root_id);
|
let new_clip_and_scroll_info = ClipAndScrollInfo::simple(new_clip_scroll_node_id);
|
||||||
self.base.clip_and_scroll_info = Some(new_clip_and_scroll_info);
|
self.base.clip_and_scroll_info = Some(new_clip_and_scroll_info);
|
||||||
state.current_clip_and_scroll_info = new_clip_and_scroll_info;
|
state.current_clip_and_scroll_info = new_clip_and_scroll_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup_scroll_root_for_overflow(&mut self,
|
fn setup_clip_scroll_node_for_overflow(&mut self,
|
||||||
state: &mut StackingContextCollectionState,
|
state: &mut StackingContextCollectionState,
|
||||||
border_box: &Rect<Au>) {
|
border_box: &Rect<Au>) {
|
||||||
if !self.overflow_style_may_require_scroll_root() {
|
if !self.overflow_style_may_require_clip_scroll_node() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2681,9 +2681,9 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
// If we already have a scroll root for this flow, just return. This can happen
|
// If we already have a scroll root for this flow, just return. This can happen
|
||||||
// when fragments map to more than one flow, such as in the case of table
|
// when fragments map to more than one flow, such as in the case of table
|
||||||
// wrappers. We just accept the first scroll root in that case.
|
// wrappers. We just accept the first scroll root in that case.
|
||||||
let new_scroll_root_id = ClipId::new(self.fragment.unique_id(IdType::OverflowClip),
|
let new_clip_scroll_node_id = ClipId::new(self.fragment.unique_id(IdType::OverflowClip),
|
||||||
state.pipeline_id.to_webrender());
|
state.pipeline_id.to_webrender());
|
||||||
if state.has_scroll_root(new_scroll_root_id) {
|
if state.has_clip_scroll_node(new_clip_scroll_node_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2705,24 +2705,24 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
let content_size = Size2D::new(content_size.x, content_size.y);
|
let content_size = Size2D::new(content_size.x, content_size.y);
|
||||||
|
|
||||||
let parent_id = self.clip_and_scroll_info(state.pipeline_id).scroll_node_id;
|
let parent_id = self.clip_and_scroll_info(state.pipeline_id).scroll_node_id;
|
||||||
state.add_scroll_root(
|
state.add_clip_scroll_node(
|
||||||
ScrollRoot {
|
ClipScrollNode {
|
||||||
id: new_scroll_root_id,
|
id: new_clip_scroll_node_id,
|
||||||
parent_id: parent_id,
|
parent_id: parent_id,
|
||||||
clip: clip,
|
clip: clip,
|
||||||
content_rect: Rect::new(content_box.origin, content_size),
|
content_rect: Rect::new(content_box.origin, content_size),
|
||||||
root_type: ScrollRootType::ScrollFrame(sensitivity),
|
node_type: ClipScrollNodeType::ScrollFrame(sensitivity),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let new_clip_and_scroll_info = ClipAndScrollInfo::simple(new_scroll_root_id);
|
let new_clip_and_scroll_info = ClipAndScrollInfo::simple(new_clip_scroll_node_id);
|
||||||
self.base.clip_and_scroll_info = Some(new_clip_and_scroll_info);
|
self.base.clip_and_scroll_info = Some(new_clip_and_scroll_info);
|
||||||
state.current_clip_and_scroll_info = new_clip_and_scroll_info;
|
state.current_clip_and_scroll_info = new_clip_and_scroll_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a scroll root for a block to take the `clip` property into account
|
/// Adds a scroll root for a block to take the `clip` property into account
|
||||||
/// per CSS 2.1 § 11.1.2.
|
/// per CSS 2.1 § 11.1.2.
|
||||||
fn setup_scroll_root_for_css_clip(&mut self,
|
fn setup_clip_scroll_node_for_css_clip(&mut self,
|
||||||
state: &mut StackingContextCollectionState,
|
state: &mut StackingContextCollectionState,
|
||||||
preserved_state: &mut SavedStackingContextCollectionState,
|
preserved_state: &mut SavedStackingContextCollectionState,
|
||||||
stacking_relative_border_box: &Rect<Au>) {
|
stacking_relative_border_box: &Rect<Au>) {
|
||||||
|
@ -2750,14 +2750,14 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
// We use the node id to create scroll roots for overflow properties, so we
|
// We use the node id to create scroll roots for overflow properties, so we
|
||||||
// use the fragment address to do the same for CSS clipping.
|
// use the fragment address to do the same for CSS clipping.
|
||||||
// TODO(mrobinson): This should be more resilient while maintaining the space
|
// TODO(mrobinson): This should be more resilient while maintaining the space
|
||||||
// efficiency of ScrollRootId.
|
// efficiency of ClipScrollNode.
|
||||||
let new_scroll_root_id = ClipId::new(self.fragment.unique_id(IdType::CSSClip),
|
let new_clip_scroll_node_id = ClipId::new(self.fragment.unique_id(IdType::CSSClip),
|
||||||
state.pipeline_id.to_webrender());
|
state.pipeline_id.to_webrender());
|
||||||
|
|
||||||
// If we already have a scroll root for this flow, just return. This can happen
|
// If we already have a scroll root for this flow, just return. This can happen
|
||||||
// when fragments map to more than one flow, such as in the case of table
|
// when fragments map to more than one flow, such as in the case of table
|
||||||
// wrappers. We just accept the first scroll root in that case.
|
// wrappers. We just accept the first scroll root in that case.
|
||||||
if state.has_scroll_root(new_scroll_root_id) {
|
if state.has_clip_scroll_node(new_clip_scroll_node_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2765,17 +2765,18 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
preserved_state.push_clip(state, &clip_rect, self.positioning());
|
preserved_state.push_clip(state, &clip_rect, self.positioning());
|
||||||
|
|
||||||
let parent_id = self.clip_and_scroll_info(state.pipeline_id).scroll_node_id;
|
let parent_id = self.clip_and_scroll_info(state.pipeline_id).scroll_node_id;
|
||||||
state.add_scroll_root(
|
state.add_clip_scroll_node(
|
||||||
ScrollRoot {
|
ClipScrollNode {
|
||||||
id: new_scroll_root_id,
|
id: new_clip_scroll_node_id,
|
||||||
parent_id: parent_id,
|
parent_id: parent_id,
|
||||||
clip: ClippingRegion::from_rect(&clip_rect),
|
clip: ClippingRegion::from_rect(&clip_rect),
|
||||||
content_rect: Rect::zero(), // content_rect isn't important for clips.
|
content_rect: Rect::zero(), // content_rect isn't important for clips.
|
||||||
root_type: ScrollRootType::Clip,
|
node_type: ClipScrollNodeType::Clip,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let new_clip_and_scroll_info = ClipAndScrollInfo::new(new_scroll_root_id, new_scroll_root_id);
|
let new_clip_and_scroll_info = ClipAndScrollInfo::new(new_clip_scroll_node_id,
|
||||||
|
new_clip_scroll_node_id);
|
||||||
self.base.clip_and_scroll_info = Some(new_clip_and_scroll_info);
|
self.base.clip_and_scroll_info = Some(new_clip_and_scroll_info);
|
||||||
state.current_clip_and_scroll_info = new_clip_and_scroll_info;
|
state.current_clip_and_scroll_info = new_clip_and_scroll_info;
|
||||||
}
|
}
|
||||||
|
@ -2850,7 +2851,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
DisplayListSection::BlockBackgroundsAndBorders
|
DisplayListSection::BlockBackgroundsAndBorders
|
||||||
};
|
};
|
||||||
|
|
||||||
state.processing_scroll_root_element = self.has_scrolling_overflow();
|
state.processing_scrolling_overflow_element = self.has_scrolling_overflow();
|
||||||
|
|
||||||
// Add the box that starts the block context.
|
// Add the box that starts the block context.
|
||||||
self.fragment
|
self.fragment
|
||||||
|
@ -2868,7 +2869,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
|
|
||||||
self.base.build_display_items_for_debugging_tint(state, self.fragment.node);
|
self.base.build_display_items_for_debugging_tint(state, self.fragment.node);
|
||||||
|
|
||||||
state.processing_scroll_root_element = false;
|
state.processing_scrolling_overflow_element = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Vector2D, Rect, SideOffsets2D, Size2D};
|
use euclid::{Point2D, Vector2D, Rect, SideOffsets2D, Size2D};
|
||||||
use gfx::display_list::{BorderDetails, BorderRadii, BoxShadowClipMode, ClippingRegion};
|
use gfx::display_list::{BorderDetails, BorderRadii, BoxShadowClipMode, ClipScrollNodeType};
|
||||||
use gfx::display_list::{DisplayItem, DisplayList, DisplayListTraversal, ScrollRootType};
|
use gfx::display_list::{ClippingRegion, DisplayItem, DisplayList, DisplayListTraversal};
|
||||||
use gfx::display_list::StackingContextType;
|
use gfx::display_list::StackingContextType;
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use style::computed_values::{image_rendering, mix_blend_mode, transform_style};
|
use style::computed_values::{image_rendering, mix_blend_mode, transform_style};
|
||||||
|
@ -488,27 +488,27 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
stacking_context.filters.to_filter_ops());
|
stacking_context.filters.to_filter_ops());
|
||||||
}
|
}
|
||||||
DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(),
|
DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(),
|
||||||
DisplayItem::DefineClip(ref item) => {
|
DisplayItem::DefineClipScrollNode(ref item) => {
|
||||||
builder.push_clip_id(item.scroll_root.parent_id);
|
builder.push_clip_id(item.node.parent_id);
|
||||||
|
|
||||||
let our_id = item.scroll_root.id;
|
let our_id = item.node.id;
|
||||||
let item_rect = item.scroll_root.clip.main.to_rectf();
|
let item_rect = item.node.clip.main.to_rectf();
|
||||||
let webrender_id = match item.scroll_root.root_type {
|
let webrender_id = match item.node.node_type {
|
||||||
ScrollRootType::Clip => {
|
ClipScrollNodeType::Clip => {
|
||||||
builder.define_clip(Some(our_id),
|
builder.define_clip(Some(our_id),
|
||||||
item_rect,
|
item_rect,
|
||||||
item.scroll_root.clip.get_complex_clips(),
|
item.node.clip.get_complex_clips(),
|
||||||
None)
|
None)
|
||||||
}
|
}
|
||||||
ScrollRootType::ScrollFrame(scroll_sensitivity) => {
|
ClipScrollNodeType::ScrollFrame(scroll_sensitivity) => {
|
||||||
builder.define_scroll_frame(Some(our_id),
|
builder.define_scroll_frame(Some(our_id),
|
||||||
item.scroll_root.content_rect.to_rectf(),
|
item.node.content_rect.to_rectf(),
|
||||||
item.scroll_root.clip.main.to_rectf(),
|
item.node.clip.main.to_rectf(),
|
||||||
item.scroll_root.clip.get_complex_clips(),
|
item.node.clip.get_complex_clips(),
|
||||||
None,
|
None,
|
||||||
scroll_sensitivity)
|
scroll_sensitivity)
|
||||||
}
|
}
|
||||||
ScrollRootType::StickyFrame(sticky_frame_info) => {
|
ClipScrollNodeType::StickyFrame(sticky_frame_info) => {
|
||||||
builder.define_sticky_frame(Some(our_id), item_rect, sticky_frame_info)
|
builder.define_sticky_frame(Some(our_id), item_rect, sticky_frame_info)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue