mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Eliminate ScrollRootId
Just use WebRender's ClipId directly. This will allow us to create and use ReferenceFrames in the future, if we need to do that. It will also make it easier to have Servo responsible for creating the root scrolling area, which will allow removing some old hacks in the future.
This commit is contained in:
parent
7919e591a4
commit
d150cc9f95
24 changed files with 226 additions and 281 deletions
|
@ -19,7 +19,7 @@ use euclid::{Matrix4D, Point2D, Rect, Size2D};
|
|||
use euclid::num::{One, Zero};
|
||||
use euclid::rect::TypedRect;
|
||||
use euclid::side_offsets::SideOffsets2D;
|
||||
use gfx_traits::{ScrollRootId, StackingContextId};
|
||||
use gfx_traits::StackingContextId;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use ipc_channel::ipc::IpcSharedMemory;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
|
@ -34,7 +34,7 @@ use style::computed_values::{border_style, filter, image_rendering, mix_blend_mo
|
|||
use style_traits::cursor::Cursor;
|
||||
use text::TextRun;
|
||||
use text::glyph::ByteIndex;
|
||||
use webrender_traits::{self, ColorF, GradientStop, ScrollPolicy, WebGLContextId};
|
||||
use webrender_traits::{self, ClipId, ColorF, GradientStop, ScrollPolicy, WebGLContextId};
|
||||
|
||||
pub use style::dom::OpaqueNode;
|
||||
|
||||
|
@ -377,7 +377,7 @@ pub struct StackingContext {
|
|||
pub scroll_policy: ScrollPolicy,
|
||||
|
||||
/// The id of the parent scrolling area that contains this StackingContext.
|
||||
pub parent_scroll_id: ScrollRootId,
|
||||
pub parent_scroll_id: ClipId,
|
||||
}
|
||||
|
||||
impl StackingContext {
|
||||
|
@ -393,7 +393,7 @@ impl StackingContext {
|
|||
transform: Option<Matrix4D<f32>>,
|
||||
perspective: Option<Matrix4D<f32>>,
|
||||
scroll_policy: ScrollPolicy,
|
||||
parent_scroll_id: ScrollRootId)
|
||||
parent_scroll_id: ClipId)
|
||||
-> StackingContext {
|
||||
StackingContext {
|
||||
id: id,
|
||||
|
@ -411,8 +411,8 @@ impl StackingContext {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn root() -> StackingContext {
|
||||
StackingContext::new(StackingContextId::new(0),
|
||||
pub fn root(pipeline_id: PipelineId) -> StackingContext {
|
||||
StackingContext::new(StackingContextId::root(),
|
||||
StackingContextType::Real,
|
||||
&Rect::zero(),
|
||||
&Rect::zero(),
|
||||
|
@ -422,11 +422,11 @@ impl StackingContext {
|
|||
None,
|
||||
None,
|
||||
ScrollPolicy::Scrollable,
|
||||
ScrollRootId::root())
|
||||
pipeline_id.root_scroll_node())
|
||||
}
|
||||
|
||||
pub fn to_display_list_items(self) -> (DisplayItem, DisplayItem) {
|
||||
let mut base_item = BaseDisplayItem::empty();
|
||||
pub fn to_display_list_items(self, pipeline_id: PipelineId) -> (DisplayItem, DisplayItem) {
|
||||
let mut base_item = BaseDisplayItem::empty(pipeline_id);
|
||||
base_item.stacking_context_id = self.id;
|
||||
base_item.scroll_root_id = self.parent_scroll_id;
|
||||
|
||||
|
@ -495,11 +495,12 @@ impl fmt::Debug for StackingContext {
|
|||
/// Defines a stacking context.
|
||||
#[derive(Clone, Debug, HeapSizeOf, Deserialize, Serialize)]
|
||||
pub struct ScrollRoot {
|
||||
/// The unique ID of this ScrollRoot.
|
||||
pub id: ScrollRootId,
|
||||
/// The WebRender clip id of this scroll root based on the source of this clip
|
||||
/// and information about the fragment.
|
||||
pub id: ClipId,
|
||||
|
||||
/// The unique ID of the parent of this ScrollRoot.
|
||||
pub parent_id: ScrollRootId,
|
||||
pub parent_id: ClipId,
|
||||
|
||||
/// The position of this scroll root's frame in the parent stacking context.
|
||||
pub clip: ClippingRegion,
|
||||
|
@ -509,9 +510,9 @@ pub struct ScrollRoot {
|
|||
}
|
||||
|
||||
impl ScrollRoot {
|
||||
pub fn to_push(&self) -> DisplayItem {
|
||||
pub fn to_push(&self, pipeline_id: PipelineId) -> DisplayItem {
|
||||
DisplayItem::PushScrollRoot(box PushScrollRootItem {
|
||||
base: BaseDisplayItem::empty(),
|
||||
base: BaseDisplayItem::empty(pipeline_id),
|
||||
scroll_root: self.clone(),
|
||||
})
|
||||
}
|
||||
|
@ -555,7 +556,7 @@ pub struct BaseDisplayItem {
|
|||
pub stacking_context_id: StackingContextId,
|
||||
|
||||
/// The id of the scroll root this item belongs to.
|
||||
pub scroll_root_id: ScrollRootId,
|
||||
pub scroll_root_id: ClipId,
|
||||
}
|
||||
|
||||
impl BaseDisplayItem {
|
||||
|
@ -565,7 +566,7 @@ impl BaseDisplayItem {
|
|||
clip: &ClippingRegion,
|
||||
section: DisplayListSection,
|
||||
stacking_context_id: StackingContextId,
|
||||
scroll_root_id: ScrollRootId)
|
||||
scroll_root_id: ClipId)
|
||||
-> BaseDisplayItem {
|
||||
// Detect useless clipping regions here and optimize them to `ClippingRegion::max()`.
|
||||
// The painting backend may want to optimize out clipping regions and this makes it easier
|
||||
|
@ -585,7 +586,7 @@ impl BaseDisplayItem {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn empty() -> BaseDisplayItem {
|
||||
pub fn empty(pipeline_id: PipelineId) -> BaseDisplayItem {
|
||||
BaseDisplayItem {
|
||||
bounds: TypedRect::zero(),
|
||||
metadata: DisplayItemMetadata {
|
||||
|
@ -595,7 +596,7 @@ impl BaseDisplayItem {
|
|||
clip: ClippingRegion::max(),
|
||||
section: DisplayListSection::Content,
|
||||
stacking_context_id: StackingContextId::root(),
|
||||
scroll_root_id: ScrollRootId::root(),
|
||||
scroll_root_id: pipeline_id.root_scroll_node(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -866,7 +867,6 @@ pub struct ImageDisplayItem {
|
|||
#[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
|
||||
pub struct WebGLDisplayItem {
|
||||
pub base: BaseDisplayItem,
|
||||
#[ignore_heap_size_of = "Defined in webrender_traits"]
|
||||
pub context_id: WebGLContextId,
|
||||
}
|
||||
|
||||
|
@ -931,11 +931,9 @@ pub struct ImageBorder {
|
|||
pub fill: bool,
|
||||
|
||||
/// How to repeat or stretch horizontal edges (border-image-repeat).
|
||||
#[ignore_heap_size_of = "WebRender traits type, and tiny"]
|
||||
pub repeat_horizontal: webrender_traits::RepeatMode,
|
||||
|
||||
/// How to repeat or stretch vertical edges (border-image-repeat).
|
||||
#[ignore_heap_size_of = "WebRender traits type, and tiny"]
|
||||
pub repeat_vertical: webrender_traits::RepeatMode,
|
||||
}
|
||||
|
||||
|
@ -1136,7 +1134,7 @@ impl DisplayItem {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn scroll_root_id(&self) -> ScrollRootId {
|
||||
pub fn scroll_root_id(&self) -> ClipId {
|
||||
self.base().scroll_root_id
|
||||
}
|
||||
|
||||
|
@ -1262,7 +1260,6 @@ pub struct WebRenderImageInfo {
|
|||
pub width: u32,
|
||||
pub height: u32,
|
||||
pub format: PixelFormat,
|
||||
#[ignore_heap_size_of = "WebRender traits type, and tiny"]
|
||||
pub key: Option<webrender_traits::ImageKey>,
|
||||
}
|
||||
|
||||
|
@ -1279,7 +1276,7 @@ impl WebRenderImageInfo {
|
|||
}
|
||||
|
||||
/// The type of the scroll offset list. This is only populated if WebRender is in use.
|
||||
pub type ScrollOffsetMap = HashMap<ScrollRootId, Point2D<f32>>;
|
||||
pub type ScrollOffsetMap = HashMap<ClipId, Point2D<f32>>;
|
||||
|
||||
|
||||
pub trait SimpleMatrixDetection {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue