mirror of
https://github.com/servo/servo.git
synced 2025-07-31 11:10:22 +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
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2339,6 +2339,7 @@ dependencies = [
|
||||||
"selectors 0.18.0",
|
"selectors 0.18.0",
|
||||||
"servo_url 0.0.1",
|
"servo_url 0.0.1",
|
||||||
"style 0.0.1",
|
"style 0.0.1",
|
||||||
|
"webrender_traits 0.35.0 (git+https://github.com/servo/webrender)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2383,6 +2384,7 @@ dependencies = [
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"webrender_traits 0.35.0 (git+https://github.com/servo/webrender)",
|
||||||
"webvr_traits 0.0.1",
|
"webvr_traits 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ use euclid::point::TypedPoint2D;
|
||||||
use euclid::rect::TypedRect;
|
use euclid::rect::TypedRect;
|
||||||
use euclid::scale_factor::ScaleFactor;
|
use euclid::scale_factor::ScaleFactor;
|
||||||
use euclid::size::TypedSize2D;
|
use euclid::size::TypedSize2D;
|
||||||
use gfx_traits::{Epoch, ScrollRootId};
|
use gfx_traits::Epoch;
|
||||||
use gleam::gl;
|
use gleam::gl;
|
||||||
use image::{DynamicImage, ImageFormat, RgbImage};
|
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||||
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
||||||
|
@ -39,7 +39,7 @@ use style_traits::viewport::ViewportConstraints;
|
||||||
use time::{precise_time_ns, precise_time_s};
|
use time::{precise_time_ns, precise_time_s};
|
||||||
use touch::{TouchHandler, TouchAction};
|
use touch::{TouchHandler, TouchAction};
|
||||||
use webrender;
|
use webrender;
|
||||||
use webrender_traits::{self, LayoutPoint, ScrollEventPhase, ClipId, ScrollLocation};
|
use webrender_traits::{self, ClipId, LayoutPoint, ScrollEventPhase, ScrollLocation};
|
||||||
use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg};
|
use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
@ -72,19 +72,6 @@ impl ConvertPipelineIdFromWebRender for webrender_traits::PipelineId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait ConvertScrollRootIdFromWebRender {
|
|
||||||
fn from_webrender(&self) -> ScrollRootId;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ConvertScrollRootIdFromWebRender for u64 {
|
|
||||||
fn from_webrender(&self) -> ScrollRootId {
|
|
||||||
// This conversion is lossy on 32 bit platforms,
|
|
||||||
// but we only actually use the bottom 32 bits
|
|
||||||
// on Servo anyway.
|
|
||||||
ScrollRootId(*self as usize)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Holds the state when running reftests that determines when it is
|
/// Holds the state when running reftests that determines when it is
|
||||||
/// safe to save the output image.
|
/// safe to save the output image.
|
||||||
#[derive(Copy, Clone, PartialEq)]
|
#[derive(Copy, Clone, PartialEq)]
|
||||||
|
@ -505,9 +492,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
self.title_for_main_frame();
|
self.title_for_main_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
(Msg::ScrollFragmentPoint(pipeline_id, scroll_root_id, point, _),
|
(Msg::ScrollFragmentPoint(scroll_root_id, point, _),
|
||||||
ShutdownState::NotShuttingDown) => {
|
ShutdownState::NotShuttingDown) => {
|
||||||
self.scroll_fragment_to_point(pipeline_id, scroll_root_id, point);
|
self.scroll_fragment_to_point(scroll_root_id, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
(Msg::MoveTo(point),
|
(Msg::MoveTo(point),
|
||||||
|
@ -793,16 +780,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
self.composition_request = CompositionRequest::DelayedComposite(timestamp);
|
self.composition_request = CompositionRequest::DelayedComposite(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scroll_fragment_to_point(&mut self,
|
fn scroll_fragment_to_point(&mut self, id: ClipId, point: Point2D<f32>) {
|
||||||
pipeline_id: PipelineId,
|
|
||||||
scroll_root_id: ScrollRootId,
|
|
||||||
point: Point2D<f32>) {
|
|
||||||
let id = if scroll_root_id.0 == 0 {
|
|
||||||
ClipId::root_scroll_node(pipeline_id.to_webrender())
|
|
||||||
} else {
|
|
||||||
ClipId::new(scroll_root_id.0 as u64, pipeline_id.to_webrender())
|
|
||||||
};
|
|
||||||
|
|
||||||
self.webrender_api.scroll_node_with_id(LayoutPoint::from_untyped(&point), id);
|
self.webrender_api.scroll_node_with_id(LayoutPoint::from_untyped(&point), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1395,13 +1373,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
fn send_viewport_rects(&self) {
|
fn send_viewport_rects(&self) {
|
||||||
let mut stacking_context_scroll_states_per_pipeline = HashMap::new();
|
let mut stacking_context_scroll_states_per_pipeline = HashMap::new();
|
||||||
for scroll_layer_state in self.webrender_api.get_scroll_node_state() {
|
for scroll_layer_state in self.webrender_api.get_scroll_node_state() {
|
||||||
let external_id = match scroll_layer_state.id.external_id() {
|
if scroll_layer_state.id.external_id().is_none() &&
|
||||||
Some(id) => id,
|
scroll_layer_state.id.is_root_scroll_node() {
|
||||||
None => continue,
|
continue;
|
||||||
};
|
}
|
||||||
|
|
||||||
let stacking_context_scroll_state = StackingContextScrollState {
|
let stacking_context_scroll_state = StackingContextScrollState {
|
||||||
scroll_root_id: external_id.from_webrender(),
|
scroll_root_id: scroll_layer_state.id,
|
||||||
scroll_offset: scroll_layer_state.scroll_offset.to_untyped(),
|
scroll_offset: scroll_layer_state.scroll_offset.to_untyped(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ use SendableFrameTree;
|
||||||
use compositor::CompositingReason;
|
use compositor::CompositingReason;
|
||||||
use euclid::point::Point2D;
|
use euclid::point::Point2D;
|
||||||
use euclid::size::Size2D;
|
use euclid::size::Size2D;
|
||||||
use gfx_traits::ScrollRootId;
|
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, PipelineId};
|
use msg::constellation_msg::{Key, KeyModifiers, KeyState, PipelineId};
|
||||||
use net_traits::image::base::Image;
|
use net_traits::image::base::Image;
|
||||||
|
@ -73,7 +72,7 @@ pub enum Msg {
|
||||||
ShutdownComplete,
|
ShutdownComplete,
|
||||||
|
|
||||||
/// Scroll a page in a window
|
/// Scroll a page in a window
|
||||||
ScrollFragmentPoint(PipelineId, ScrollRootId, Point2D<f32>, bool),
|
ScrollFragmentPoint(webrender_traits::ClipId, Point2D<f32>, bool),
|
||||||
/// Alerts the compositor that the current page has changed its title.
|
/// Alerts the compositor that the current page has changed its title.
|
||||||
ChangePageTitle(PipelineId, Option<String>),
|
ChangePageTitle(PipelineId, Option<String>),
|
||||||
/// Alerts the compositor that the current page has changed its URL.
|
/// Alerts the compositor that the current page has changed its URL.
|
||||||
|
|
|
@ -1036,9 +1036,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
self.handle_alert(pipeline_id, message, sender);
|
self.handle_alert(pipeline_id, message, sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
FromScriptMsg::ScrollFragmentPoint(pipeline_id, scroll_root_id, point, smooth) => {
|
FromScriptMsg::ScrollFragmentPoint(scroll_root_id, point, smooth) => {
|
||||||
self.compositor_proxy.send(ToCompositorMsg::ScrollFragmentPoint(pipeline_id,
|
self.compositor_proxy.send(ToCompositorMsg::ScrollFragmentPoint(scroll_root_id,
|
||||||
scroll_root_id,
|
|
||||||
point,
|
point,
|
||||||
smooth));
|
smooth));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ use euclid::{Matrix4D, Point2D, Rect, Size2D};
|
||||||
use euclid::num::{One, Zero};
|
use euclid::num::{One, Zero};
|
||||||
use euclid::rect::TypedRect;
|
use euclid::rect::TypedRect;
|
||||||
use euclid::side_offsets::SideOffsets2D;
|
use euclid::side_offsets::SideOffsets2D;
|
||||||
use gfx_traits::{ScrollRootId, StackingContextId};
|
use gfx_traits::StackingContextId;
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use ipc_channel::ipc::IpcSharedMemory;
|
use ipc_channel::ipc::IpcSharedMemory;
|
||||||
use msg::constellation_msg::PipelineId;
|
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 style_traits::cursor::Cursor;
|
||||||
use text::TextRun;
|
use text::TextRun;
|
||||||
use text::glyph::ByteIndex;
|
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;
|
pub use style::dom::OpaqueNode;
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ pub struct StackingContext {
|
||||||
pub scroll_policy: ScrollPolicy,
|
pub scroll_policy: ScrollPolicy,
|
||||||
|
|
||||||
/// The id of the parent scrolling area that contains this StackingContext.
|
/// The id of the parent scrolling area that contains this StackingContext.
|
||||||
pub parent_scroll_id: ScrollRootId,
|
pub parent_scroll_id: ClipId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StackingContext {
|
impl StackingContext {
|
||||||
|
@ -393,7 +393,7 @@ impl StackingContext {
|
||||||
transform: Option<Matrix4D<f32>>,
|
transform: Option<Matrix4D<f32>>,
|
||||||
perspective: Option<Matrix4D<f32>>,
|
perspective: Option<Matrix4D<f32>>,
|
||||||
scroll_policy: ScrollPolicy,
|
scroll_policy: ScrollPolicy,
|
||||||
parent_scroll_id: ScrollRootId)
|
parent_scroll_id: ClipId)
|
||||||
-> StackingContext {
|
-> StackingContext {
|
||||||
StackingContext {
|
StackingContext {
|
||||||
id: id,
|
id: id,
|
||||||
|
@ -411,8 +411,8 @@ impl StackingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn root() -> StackingContext {
|
pub fn root(pipeline_id: PipelineId) -> StackingContext {
|
||||||
StackingContext::new(StackingContextId::new(0),
|
StackingContext::new(StackingContextId::root(),
|
||||||
StackingContextType::Real,
|
StackingContextType::Real,
|
||||||
&Rect::zero(),
|
&Rect::zero(),
|
||||||
&Rect::zero(),
|
&Rect::zero(),
|
||||||
|
@ -422,11 +422,11 @@ impl StackingContext {
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
ScrollPolicy::Scrollable,
|
ScrollPolicy::Scrollable,
|
||||||
ScrollRootId::root())
|
pipeline_id.root_scroll_node())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_display_list_items(self) -> (DisplayItem, DisplayItem) {
|
pub fn to_display_list_items(self, pipeline_id: PipelineId) -> (DisplayItem, DisplayItem) {
|
||||||
let mut base_item = BaseDisplayItem::empty();
|
let mut base_item = BaseDisplayItem::empty(pipeline_id);
|
||||||
base_item.stacking_context_id = self.id;
|
base_item.stacking_context_id = self.id;
|
||||||
base_item.scroll_root_id = self.parent_scroll_id;
|
base_item.scroll_root_id = self.parent_scroll_id;
|
||||||
|
|
||||||
|
@ -495,11 +495,12 @@ impl fmt::Debug for StackingContext {
|
||||||
/// Defines a stacking context.
|
/// Defines a stacking context.
|
||||||
#[derive(Clone, Debug, HeapSizeOf, Deserialize, Serialize)]
|
#[derive(Clone, Debug, HeapSizeOf, Deserialize, Serialize)]
|
||||||
pub struct ScrollRoot {
|
pub struct ScrollRoot {
|
||||||
/// The unique ID of this ScrollRoot.
|
/// The WebRender clip id of this scroll root based on the source of this clip
|
||||||
pub id: ScrollRootId,
|
/// and information about the fragment.
|
||||||
|
pub id: ClipId,
|
||||||
|
|
||||||
/// The unique ID of the parent of this ScrollRoot.
|
/// 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.
|
/// The position of this scroll root's frame in the parent stacking context.
|
||||||
pub clip: ClippingRegion,
|
pub clip: ClippingRegion,
|
||||||
|
@ -509,9 +510,9 @@ pub struct ScrollRoot {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ScrollRoot {
|
impl ScrollRoot {
|
||||||
pub fn to_push(&self) -> DisplayItem {
|
pub fn to_push(&self, pipeline_id: PipelineId) -> DisplayItem {
|
||||||
DisplayItem::PushScrollRoot(box PushScrollRootItem {
|
DisplayItem::PushScrollRoot(box PushScrollRootItem {
|
||||||
base: BaseDisplayItem::empty(),
|
base: BaseDisplayItem::empty(pipeline_id),
|
||||||
scroll_root: self.clone(),
|
scroll_root: self.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -555,7 +556,7 @@ pub struct BaseDisplayItem {
|
||||||
pub stacking_context_id: StackingContextId,
|
pub stacking_context_id: StackingContextId,
|
||||||
|
|
||||||
/// The id of the scroll root this item belongs to.
|
/// The id of the scroll root this item belongs to.
|
||||||
pub scroll_root_id: ScrollRootId,
|
pub scroll_root_id: ClipId,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BaseDisplayItem {
|
impl BaseDisplayItem {
|
||||||
|
@ -565,7 +566,7 @@ impl BaseDisplayItem {
|
||||||
clip: &ClippingRegion,
|
clip: &ClippingRegion,
|
||||||
section: DisplayListSection,
|
section: DisplayListSection,
|
||||||
stacking_context_id: StackingContextId,
|
stacking_context_id: StackingContextId,
|
||||||
scroll_root_id: ScrollRootId)
|
scroll_root_id: ClipId)
|
||||||
-> BaseDisplayItem {
|
-> BaseDisplayItem {
|
||||||
// Detect useless clipping regions here and optimize them to `ClippingRegion::max()`.
|
// 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
|
// The painting backend may want to optimize out clipping regions and this makes it easier
|
||||||
|
@ -585,7 +586,7 @@ impl BaseDisplayItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn empty() -> BaseDisplayItem {
|
pub fn empty(pipeline_id: PipelineId) -> BaseDisplayItem {
|
||||||
BaseDisplayItem {
|
BaseDisplayItem {
|
||||||
bounds: TypedRect::zero(),
|
bounds: TypedRect::zero(),
|
||||||
metadata: DisplayItemMetadata {
|
metadata: DisplayItemMetadata {
|
||||||
|
@ -595,7 +596,7 @@ impl BaseDisplayItem {
|
||||||
clip: ClippingRegion::max(),
|
clip: ClippingRegion::max(),
|
||||||
section: DisplayListSection::Content,
|
section: DisplayListSection::Content,
|
||||||
stacking_context_id: StackingContextId::root(),
|
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)]
|
#[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
|
||||||
pub struct WebGLDisplayItem {
|
pub struct WebGLDisplayItem {
|
||||||
pub base: BaseDisplayItem,
|
pub base: BaseDisplayItem,
|
||||||
#[ignore_heap_size_of = "Defined in webrender_traits"]
|
|
||||||
pub context_id: WebGLContextId,
|
pub context_id: WebGLContextId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -931,11 +931,9 @@ pub struct ImageBorder {
|
||||||
pub fill: bool,
|
pub fill: bool,
|
||||||
|
|
||||||
/// How to repeat or stretch horizontal edges (border-image-repeat).
|
/// 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,
|
pub repeat_horizontal: webrender_traits::RepeatMode,
|
||||||
|
|
||||||
/// How to repeat or stretch vertical edges (border-image-repeat).
|
/// 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,
|
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
|
self.base().scroll_root_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1262,7 +1260,6 @@ pub struct WebRenderImageInfo {
|
||||||
pub width: u32,
|
pub width: u32,
|
||||||
pub height: u32,
|
pub height: u32,
|
||||||
pub format: PixelFormat,
|
pub format: PixelFormat,
|
||||||
#[ignore_heap_size_of = "WebRender traits type, and tiny"]
|
|
||||||
pub key: Option<webrender_traits::ImageKey>,
|
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.
|
/// 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 {
|
pub trait SimpleMatrixDetection {
|
||||||
|
|
|
@ -19,18 +19,6 @@ pub mod print_tree;
|
||||||
use range::RangeIndex;
|
use range::RangeIndex;
|
||||||
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
|
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
|
||||||
|
|
||||||
/// The next ID that will be used for a special stacking context.
|
|
||||||
///
|
|
||||||
/// A special stacking context is a stacking context that is one of (a) the outer stacking context
|
|
||||||
/// of an element with `overflow: scroll`; (b) generated content; (c) both (a) and (b).
|
|
||||||
static NEXT_SPECIAL_STACKING_CONTEXT_ID: AtomicUsize = ATOMIC_USIZE_INIT;
|
|
||||||
|
|
||||||
/// If none of the bits outside this mask are set, the stacking context is a special stacking
|
|
||||||
/// context.
|
|
||||||
///
|
|
||||||
/// Note that we assume that the top 16 bits of the address space are unused on the platform.
|
|
||||||
const SPECIAL_STACKING_CONTEXT_ID_MASK: usize = 0xffff;
|
|
||||||
|
|
||||||
/// A newtype struct for denoting the age of messages; prevents race conditions.
|
/// A newtype struct for denoting the age of messages; prevents race conditions.
|
||||||
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
|
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
|
||||||
pub struct Epoch(pub u32);
|
pub struct Epoch(pub u32);
|
||||||
|
@ -46,89 +34,29 @@ impl Epoch {
|
||||||
pub struct StackingContextId(
|
pub struct StackingContextId(
|
||||||
/// The identifier for this StackingContext, derived from the Flow's memory address
|
/// The identifier for this StackingContext, derived from the Flow's memory address
|
||||||
/// and fragment type. As a space optimization, these are combined into a single word.
|
/// and fragment type. As a space optimization, these are combined into a single word.
|
||||||
usize
|
u64
|
||||||
);
|
);
|
||||||
|
|
||||||
impl StackingContextId {
|
impl StackingContextId {
|
||||||
#[inline]
|
|
||||||
pub fn new(id: usize) -> StackingContextId {
|
|
||||||
StackingContextId::new_of_type(id, FragmentType::FragmentBody)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns a new stacking context ID for a special stacking context.
|
|
||||||
fn next_special_id() -> usize {
|
|
||||||
// We shift this left by 2 to make room for the fragment type ID.
|
|
||||||
((NEXT_SPECIAL_STACKING_CONTEXT_ID.fetch_add(1, Ordering::SeqCst) + 1) << 2) &
|
|
||||||
SPECIAL_STACKING_CONTEXT_ID_MASK
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn new_of_type(id: usize, fragment_type: FragmentType) -> StackingContextId {
|
|
||||||
debug_assert_eq!(id & (fragment_type as usize), 0);
|
|
||||||
if fragment_type == FragmentType::FragmentBody {
|
|
||||||
StackingContextId(id)
|
|
||||||
} else {
|
|
||||||
StackingContextId(StackingContextId::next_special_id() | (fragment_type as usize))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the stacking context ID for the outer document/layout root.
|
/// Returns the stacking context ID for the outer document/layout root.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn root() -> StackingContextId {
|
pub fn root() -> StackingContextId {
|
||||||
StackingContextId(0)
|
StackingContextId(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a new sacking context id with the given numeric id.
|
||||||
|
#[inline]
|
||||||
|
pub fn new(id: u64) -> StackingContextId {
|
||||||
|
StackingContextId(id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A unique ID for every scrolling root.
|
int_range_index! {
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct ScrollRootId(
|
#[doc = "An index that refers to a byte offset in a text run. This could \
|
||||||
/// The identifier for this StackingContext, derived from the Flow's memory address
|
point to the middle of a glyph."]
|
||||||
/// and fragment type. As a space optimization, these are combined into a single word.
|
#[derive(HeapSizeOf)]
|
||||||
pub usize
|
struct ByteIndex(isize)
|
||||||
);
|
|
||||||
|
|
||||||
impl ScrollRootId {
|
|
||||||
/// Returns a new stacking context ID for a special stacking context.
|
|
||||||
fn next_special_id() -> usize {
|
|
||||||
// We shift this left by 2 to make room for the fragment type ID.
|
|
||||||
((NEXT_SPECIAL_STACKING_CONTEXT_ID.fetch_add(1, Ordering::SeqCst) + 1) << 2) &
|
|
||||||
SPECIAL_STACKING_CONTEXT_ID_MASK
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn new_of_type(id: usize, fragment_type: FragmentType) -> ScrollRootId {
|
|
||||||
debug_assert_eq!(id & (fragment_type as usize), 0);
|
|
||||||
if fragment_type == FragmentType::FragmentBody {
|
|
||||||
ScrollRootId(id)
|
|
||||||
} else {
|
|
||||||
ScrollRootId(ScrollRootId::next_special_id() | (fragment_type as usize))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the stacking context ID for the outer document/layout root.
|
|
||||||
#[inline]
|
|
||||||
pub fn root() -> ScrollRootId {
|
|
||||||
ScrollRootId(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if this is a special stacking context.
|
|
||||||
///
|
|
||||||
/// A special stacking context is a stacking context that is one of (a) the outer stacking
|
|
||||||
/// context of an element with `overflow: scroll`; (b) generated content; (c) both (a) and (b).
|
|
||||||
#[inline]
|
|
||||||
pub fn is_special(&self) -> bool {
|
|
||||||
(self.0 & !SPECIAL_STACKING_CONTEXT_ID_MASK) == 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn id(&self) -> usize {
|
|
||||||
self.0 & !3
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn fragment_type(&self) -> FragmentType {
|
|
||||||
FragmentType::from_usize(self.0 & 3)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The type of fragment that a stacking context represents.
|
/// The type of fragment that a stacking context represents.
|
||||||
|
@ -146,22 +74,37 @@ pub enum FragmentType {
|
||||||
AfterPseudoContent,
|
AfterPseudoContent,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FragmentType {
|
/// The next ID that will be used for a special stacking context.
|
||||||
#[inline]
|
///
|
||||||
pub fn from_usize(n: usize) -> FragmentType {
|
/// A special stacking context is a stacking context that is one of (a) the outer stacking context
|
||||||
debug_assert!(n < 3);
|
/// of an element with `overflow: scroll`; (b) generated content; (c) both (a) and (b).
|
||||||
match n {
|
static NEXT_SPECIAL_STACKING_CONTEXT_ID: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||||
0 => FragmentType::FragmentBody,
|
|
||||||
1 => FragmentType::BeforePseudoContent,
|
/// If none of the bits outside this mask are set, the stacking context is a special stacking
|
||||||
_ => FragmentType::AfterPseudoContent,
|
/// context.
|
||||||
}
|
///
|
||||||
|
/// Note that we assume that the top 16 bits of the address space are unused on the platform.
|
||||||
|
const SPECIAL_STACKING_CONTEXT_ID_MASK: usize = 0xffff;
|
||||||
|
|
||||||
|
/// Returns a new stacking context ID for a special stacking context.
|
||||||
|
fn next_special_id() -> usize {
|
||||||
|
// We shift this left by 2 to make room for the fragment type ID.
|
||||||
|
((NEXT_SPECIAL_STACKING_CONTEXT_ID.fetch_add(1, Ordering::SeqCst) + 1) << 2) &
|
||||||
|
SPECIAL_STACKING_CONTEXT_ID_MASK
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn combine_id_with_fragment_type(id: usize, fragment_type: FragmentType) -> usize {
|
||||||
|
debug_assert_eq!(id & (fragment_type as usize), 0);
|
||||||
|
if fragment_type == FragmentType::FragmentBody {
|
||||||
|
id
|
||||||
|
} else {
|
||||||
|
next_special_id() | (fragment_type as usize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int_range_index! {
|
pub fn node_id_from_clip_id(id: usize) -> Option<usize> {
|
||||||
#[derive(Deserialize, Serialize)]
|
if (id & !SPECIAL_STACKING_CONTEXT_ID_MASK) != 0 {
|
||||||
#[doc = "An index that refers to a byte offset in a text run. This could \
|
return Some((id & !3) as usize);
|
||||||
point to the middle of a glyph."]
|
}
|
||||||
#[derive(HeapSizeOf)]
|
None
|
||||||
struct ByteIndex(isize)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ use gfx::display_list::{WebRenderImageInfo, OpaqueNode};
|
||||||
use gfx::font_cache_thread::FontCacheThread;
|
use gfx::font_cache_thread::FontCacheThread;
|
||||||
use gfx::font_context::FontContext;
|
use gfx::font_context::FontContext;
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
|
use msg::constellation_msg::PipelineId;
|
||||||
use net_traits::image_cache::{CanRequestImages, ImageCache, ImageState};
|
use net_traits::image_cache::{CanRequestImages, ImageCache, ImageState};
|
||||||
use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
|
use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder};
|
||||||
use opaque_node::OpaqueNodeMethods;
|
use opaque_node::OpaqueNodeMethods;
|
||||||
|
@ -76,6 +77,9 @@ pub fn heap_size_of_persistent_local_context() -> usize {
|
||||||
|
|
||||||
/// Layout information shared among all workers. This must be thread-safe.
|
/// Layout information shared among all workers. This must be thread-safe.
|
||||||
pub struct LayoutContext<'a> {
|
pub struct LayoutContext<'a> {
|
||||||
|
/// The pipeline id of this LayoutContext.
|
||||||
|
pub id: PipelineId,
|
||||||
|
|
||||||
/// Bits shared by the layout and style system.
|
/// Bits shared by the layout and style system.
|
||||||
pub style_context: SharedStyleContext<'a>,
|
pub style_context: SharedStyleContext<'a>,
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ use gfx::display_list::{GradientDisplayItem, IframeDisplayItem, ImageDisplayItem
|
||||||
use gfx::display_list::{LineDisplayItem, OpaqueNode};
|
use gfx::display_list::{LineDisplayItem, OpaqueNode};
|
||||||
use gfx::display_list::{SolidColorDisplayItem, ScrollRoot, StackingContext, StackingContextType};
|
use gfx::display_list::{SolidColorDisplayItem, ScrollRoot, StackingContext, StackingContextType};
|
||||||
use gfx::display_list::{TextDisplayItem, TextOrientation, WebGLDisplayItem, WebRenderImageInfo};
|
use gfx::display_list::{TextDisplayItem, TextOrientation, WebGLDisplayItem, WebRenderImageInfo};
|
||||||
use gfx_traits::{ScrollRootId, 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;
|
||||||
use list_item::ListItemFlow;
|
use list_item::ListItemFlow;
|
||||||
|
@ -38,6 +38,7 @@ use msg::constellation_msg::PipelineId;
|
||||||
use net_traits::image::base::PixelFormat;
|
use net_traits::image::base::PixelFormat;
|
||||||
use net_traits::image_cache::UsePlaceholder;
|
use net_traits::image_cache::UsePlaceholder;
|
||||||
use range::Range;
|
use range::Range;
|
||||||
|
use script_layout_interface::wrapper_traits::PseudoElementType;
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use servo_geometry::max_rect;
|
use servo_geometry::max_rect;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
@ -63,7 +64,7 @@ use style::values::specified::{HorizontalDirection, VerticalDirection};
|
||||||
use style_traits::CSSPixel;
|
use style_traits::CSSPixel;
|
||||||
use style_traits::cursor::Cursor;
|
use style_traits::cursor::Cursor;
|
||||||
use table_cell::CollapsedBordersForCell;
|
use table_cell::CollapsedBordersForCell;
|
||||||
use webrender_traits::{ColorF, GradientStop, RepeatMode, ScrollPolicy};
|
use webrender_traits::{ColorF, ClipId, GradientStop, RepeatMode, ScrollPolicy};
|
||||||
|
|
||||||
trait ResolvePercentage {
|
trait ResolvePercentage {
|
||||||
fn resolve(&self, length: u32) -> u32;
|
fn resolve(&self, length: u32) -> u32;
|
||||||
|
@ -152,7 +153,7 @@ pub struct DisplayListBuildState<'a> {
|
||||||
pub root_stacking_context: StackingContext,
|
pub root_stacking_context: StackingContext,
|
||||||
pub items: HashMap<StackingContextId, Vec<DisplayItem>>,
|
pub items: HashMap<StackingContextId, Vec<DisplayItem>>,
|
||||||
stacking_context_info: HashMap<StackingContextId, StackingContextInfo>,
|
stacking_context_info: HashMap<StackingContextId, StackingContextInfo>,
|
||||||
pub scroll_root_parents: HashMap<ScrollRootId, ScrollRootId>,
|
pub scroll_root_parents: HashMap<ClipId, ClipId>,
|
||||||
pub processing_scroll_root_element: bool,
|
pub processing_scroll_root_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.
|
||||||
|
@ -161,12 +162,12 @@ pub struct DisplayListBuildState<'a> {
|
||||||
|
|
||||||
/// The current scroll root id, used to keep track of state when
|
/// The current scroll root id, used to keep track of state when
|
||||||
/// recursively building and processing the display list.
|
/// recursively building and processing the display list.
|
||||||
pub current_scroll_root_id: ScrollRootId,
|
pub current_scroll_root_id: ClipId,
|
||||||
|
|
||||||
/// The scroll root id of the first ancestor which defines a containing block.
|
/// The scroll root id of the first ancestor which defines a containing block.
|
||||||
/// This is necessary because absolutely positioned items should be clipped
|
/// This is necessary because absolutely positioned items should be clipped
|
||||||
/// by their containing block's scroll root.
|
/// by their containing block's scroll root.
|
||||||
pub containing_block_scroll_root_id: ScrollRootId,
|
pub containing_block_scroll_root_id: ClipId,
|
||||||
|
|
||||||
/// Vector containing iframe sizes, used to inform the constellation about
|
/// Vector containing iframe sizes, used to inform the constellation about
|
||||||
/// new iframe sizes
|
/// new iframe sizes
|
||||||
|
@ -185,14 +186,14 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
pub fn new(layout_context: &'a LayoutContext) -> DisplayListBuildState<'a> {
|
pub fn new(layout_context: &'a LayoutContext) -> DisplayListBuildState<'a> {
|
||||||
DisplayListBuildState {
|
DisplayListBuildState {
|
||||||
layout_context: layout_context,
|
layout_context: layout_context,
|
||||||
root_stacking_context: StackingContext::root(),
|
root_stacking_context: StackingContext::root(layout_context.id),
|
||||||
items: HashMap::new(),
|
items: HashMap::new(),
|
||||||
stacking_context_info: HashMap::new(),
|
stacking_context_info: HashMap::new(),
|
||||||
scroll_root_parents: HashMap::new(),
|
scroll_root_parents: HashMap::new(),
|
||||||
processing_scroll_root_element: false,
|
processing_scroll_root_element: false,
|
||||||
current_stacking_context_id: StackingContextId::root(),
|
current_stacking_context_id: StackingContextId::root(),
|
||||||
current_scroll_root_id: ScrollRootId::root(),
|
current_scroll_root_id: layout_context.id.root_scroll_node(),
|
||||||
containing_block_scroll_root_id: ScrollRootId::root(),
|
containing_block_scroll_root_id: layout_context.id.root_scroll_node(),
|
||||||
iframe_sizes: Vec::new(),
|
iframe_sizes: Vec::new(),
|
||||||
clip_stack: Vec::new(),
|
clip_stack: Vec::new(),
|
||||||
containing_block_clip_stack: Vec::new(),
|
containing_block_clip_stack: Vec::new(),
|
||||||
|
@ -213,7 +214,7 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
info.children.push(stacking_context);
|
info.children.push(stacking_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_scroll_root(&mut self, id: ScrollRootId) -> bool {
|
fn has_scroll_root(&mut self, id: ClipId) -> bool {
|
||||||
self.scroll_root_parents.contains_key(&id)
|
self.scroll_root_parents.contains_key(&id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,9 +226,9 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
info.scroll_roots.push(scroll_root);
|
info.scroll_roots.push(scroll_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parent_scroll_root_id(&self, scroll_root_id: ScrollRootId) -> ScrollRootId {
|
fn parent_scroll_root_id(&self, scroll_root_id: ClipId) -> ClipId {
|
||||||
if scroll_root_id == ScrollRootId::root() {
|
if scroll_root_id.is_root_scroll_node() {
|
||||||
return ScrollRootId::root()
|
return scroll_root_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_assert!(self.scroll_root_parents.contains_key(&scroll_root_id));
|
debug_assert!(self.scroll_root_parents.contains_key(&scroll_root_id));
|
||||||
|
@ -262,7 +263,8 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
|
|
||||||
pub fn to_display_list(mut self) -> DisplayList {
|
pub fn to_display_list(mut self) -> DisplayList {
|
||||||
let mut list = Vec::new();
|
let mut list = Vec::new();
|
||||||
let root_context = mem::replace(&mut self.root_stacking_context, StackingContext::root());
|
let root_context = mem::replace(&mut self.root_stacking_context,
|
||||||
|
StackingContext::root(self.layout_context.id));
|
||||||
|
|
||||||
self.to_display_list_for_stacking_context(&mut list, root_context);
|
self.to_display_list_for_stacking_context(&mut list, root_context);
|
||||||
|
|
||||||
|
@ -283,13 +285,14 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
|
|
||||||
info.children.sort();
|
info.children.sort();
|
||||||
|
|
||||||
|
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_push()));
|
list.extend(info.scroll_roots.into_iter().map(|root| root.to_push(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();
|
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_push()));
|
list.extend(info.scroll_roots.into_iter().map(|root| root.to_push(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);
|
||||||
}
|
}
|
||||||
|
@ -348,6 +351,12 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
/// The logical width of an insertion point: at the moment, a one-pixel-wide line.
|
/// The logical width of an insertion point: at the moment, a one-pixel-wide line.
|
||||||
const INSERTION_POINT_LOGICAL_WIDTH: Au = Au(1 * AU_PER_PX);
|
const INSERTION_POINT_LOGICAL_WIDTH: Au = Au(1 * AU_PER_PX);
|
||||||
|
|
||||||
|
pub enum IdType {
|
||||||
|
StackingContext,
|
||||||
|
OverflowClip,
|
||||||
|
CSSClip,
|
||||||
|
}
|
||||||
|
|
||||||
pub trait FragmentDisplayListBuilding {
|
pub trait FragmentDisplayListBuilding {
|
||||||
/// Adds the display items necessary to paint the background of this fragment to the display
|
/// Adds the display items necessary to paint the background of this fragment to the display
|
||||||
/// list if necessary.
|
/// list if necessary.
|
||||||
|
@ -495,12 +504,16 @@ pub trait FragmentDisplayListBuilding {
|
||||||
base_flow: &BaseFlow,
|
base_flow: &BaseFlow,
|
||||||
scroll_policy: ScrollPolicy,
|
scroll_policy: ScrollPolicy,
|
||||||
mode: StackingContextCreationMode,
|
mode: StackingContextCreationMode,
|
||||||
parent_scroll_id: ScrollRootId)
|
parent_scroll_id: ClipId)
|
||||||
-> StackingContext;
|
-> StackingContext;
|
||||||
|
|
||||||
|
|
||||||
/// The id of stacking context this fragment would create.
|
/// The id of stacking context this fragment would create.
|
||||||
fn stacking_context_id(&self) -> StackingContextId;
|
fn stacking_context_id(&self) -> StackingContextId;
|
||||||
|
|
||||||
|
fn unique_id(&self, id_type: IdType) -> u64;
|
||||||
|
|
||||||
|
fn fragment_type(&self) -> FragmentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_overlapping_radii(size: &Size2D<Au>, radii: &BorderRadii<Au>) -> BorderRadii<Au> {
|
fn handle_overlapping_radii(size: &Size2D<Au>, radii: &BorderRadii<Au>) -> BorderRadii<Au> {
|
||||||
|
@ -1653,7 +1666,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stacking_context_id(&self) -> StackingContextId {
|
fn stacking_context_id(&self) -> StackingContextId {
|
||||||
StackingContextId::new_of_type(self.node.id() as usize, self.fragment_type())
|
StackingContextId::new(self.unique_id(IdType::StackingContext))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_stacking_context(&self,
|
fn create_stacking_context(&self,
|
||||||
|
@ -1661,7 +1674,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
base_flow: &BaseFlow,
|
base_flow: &BaseFlow,
|
||||||
scroll_policy: ScrollPolicy,
|
scroll_policy: ScrollPolicy,
|
||||||
mode: StackingContextCreationMode,
|
mode: StackingContextCreationMode,
|
||||||
parent_scroll_id: ScrollRootId)
|
parent_scroll_id: ClipId)
|
||||||
-> StackingContext {
|
-> StackingContext {
|
||||||
let border_box =
|
let border_box =
|
||||||
self.stacking_relative_border_box(&base_flow.stacking_relative_position,
|
self.stacking_relative_border_box(&base_flow.stacking_relative_position,
|
||||||
|
@ -1839,6 +1852,24 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn unique_id(&self, id_type: IdType) -> u64 {
|
||||||
|
let fragment_type = self.fragment_type();
|
||||||
|
let id = match id_type {
|
||||||
|
IdType::StackingContext | IdType::OverflowClip => self.node.id() as usize,
|
||||||
|
IdType::CSSClip => self as *const _ as usize,
|
||||||
|
};
|
||||||
|
combine_id_with_fragment_type(id, fragment_type) as u64
|
||||||
|
}
|
||||||
|
|
||||||
|
fn fragment_type(&self) -> FragmentType {
|
||||||
|
match self.pseudo {
|
||||||
|
PseudoElementType::Normal => FragmentType::FragmentBody,
|
||||||
|
PseudoElementType::Before(_) => FragmentType::BeforePseudoContent,
|
||||||
|
PseudoElementType::After(_) => FragmentType::AfterPseudoContent,
|
||||||
|
PseudoElementType::DetailsSummary(_) => FragmentType::FragmentBody,
|
||||||
|
PseudoElementType::DetailsContent(_) => FragmentType::FragmentBody,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait BlockFlowDisplayListBuilding {
|
pub trait BlockFlowDisplayListBuilding {
|
||||||
|
@ -1851,7 +1882,7 @@ pub trait BlockFlowDisplayListBuilding {
|
||||||
state: &mut DisplayListBuildState,
|
state: &mut DisplayListBuildState,
|
||||||
preserved_state: &mut PreservedDisplayListState,
|
preserved_state: &mut PreservedDisplayListState,
|
||||||
stacking_context_type: BlockStackingContextType)
|
stacking_context_type: BlockStackingContextType)
|
||||||
-> ScrollRootId;
|
-> ClipId;
|
||||||
fn setup_scroll_root_for_overflow(&mut self,
|
fn setup_scroll_root_for_overflow(&mut self,
|
||||||
state: &mut DisplayListBuildState,
|
state: &mut DisplayListBuildState,
|
||||||
preserved_state: &mut PreservedDisplayListState,
|
preserved_state: &mut PreservedDisplayListState,
|
||||||
|
@ -1862,11 +1893,11 @@ pub trait BlockFlowDisplayListBuilding {
|
||||||
stacking_relative_border_box: &Rect<Au>);
|
stacking_relative_border_box: &Rect<Au>);
|
||||||
fn create_pseudo_stacking_context_for_block(&mut self,
|
fn create_pseudo_stacking_context_for_block(&mut self,
|
||||||
parent_stacking_context_id: StackingContextId,
|
parent_stacking_context_id: StackingContextId,
|
||||||
parent_scroll_root_id: ScrollRootId,
|
parent_scroll_root_id: ClipId,
|
||||||
state: &mut DisplayListBuildState);
|
state: &mut DisplayListBuildState);
|
||||||
fn create_real_stacking_context_for_block(&mut self,
|
fn create_real_stacking_context_for_block(&mut self,
|
||||||
parent_stacking_context_id: StackingContextId,
|
parent_stacking_context_id: StackingContextId,
|
||||||
parent_scroll_root_id: ScrollRootId,
|
parent_scroll_root_id: ClipId,
|
||||||
state: &mut DisplayListBuildState);
|
state: &mut DisplayListBuildState);
|
||||||
fn build_display_list_for_block(&mut self,
|
fn build_display_list_for_block(&mut self,
|
||||||
state: &mut DisplayListBuildState,
|
state: &mut DisplayListBuildState,
|
||||||
|
@ -1880,8 +1911,8 @@ pub trait BlockFlowDisplayListBuilding {
|
||||||
/// TODO(mrobinson): It would be nice to use RAII here to avoid having to call restore.
|
/// TODO(mrobinson): It would be nice to use RAII here to avoid having to call restore.
|
||||||
pub struct PreservedDisplayListState {
|
pub struct PreservedDisplayListState {
|
||||||
stacking_context_id: StackingContextId,
|
stacking_context_id: StackingContextId,
|
||||||
scroll_root_id: ScrollRootId,
|
scroll_root_id: ClipId,
|
||||||
containing_block_scroll_root_id: ScrollRootId,
|
containing_block_scroll_root_id: ClipId,
|
||||||
clips_pushed: usize,
|
clips_pushed: usize,
|
||||||
containing_block_clips_pushed: usize,
|
containing_block_clips_pushed: usize,
|
||||||
}
|
}
|
||||||
|
@ -2041,7 +2072,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
state: &mut DisplayListBuildState,
|
state: &mut DisplayListBuildState,
|
||||||
preserved_state: &mut PreservedDisplayListState,
|
preserved_state: &mut PreservedDisplayListState,
|
||||||
stacking_context_type: BlockStackingContextType)
|
stacking_context_type: BlockStackingContextType)
|
||||||
-> ScrollRootId {
|
-> ClipId {
|
||||||
// If this block is absolutely positioned, we should be clipped and positioned by
|
// If this block is absolutely positioned, we should be clipped and positioned by
|
||||||
// the scroll root of our nearest ancestor that establishes a containing block.
|
// the scroll root of our nearest ancestor that establishes a containing block.
|
||||||
let containing_scroll_root_id = match self.positioning() {
|
let containing_scroll_root_id = match self.positioning() {
|
||||||
|
@ -2056,7 +2087,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
}
|
}
|
||||||
_ => state.current_scroll_root_id,
|
_ => state.current_scroll_root_id,
|
||||||
};
|
};
|
||||||
self.base.scroll_root_id = containing_scroll_root_id;
|
self.base.scroll_root_id = Some(containing_scroll_root_id);
|
||||||
|
|
||||||
let coordinate_system = if self.fragment.establishes_stacking_context() {
|
let coordinate_system = if self.fragment.establishes_stacking_context() {
|
||||||
CoordinateSystem::Own
|
CoordinateSystem::Own
|
||||||
|
@ -2108,11 +2139,11 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_scroll_root_id = ScrollRootId::new_of_type(self.fragment.node.id() as usize,
|
|
||||||
self.fragment.fragment_type());
|
|
||||||
// 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),
|
||||||
|
state.layout_context.id.to_webrender());
|
||||||
if state.has_scroll_root(new_scroll_root_id) {
|
if state.has_scroll_root(new_scroll_root_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2148,17 +2179,18 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
clip.intersect_with_rounded_rect(&clip_rect, &radii)
|
clip.intersect_with_rounded_rect(&clip_rect, &radii)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let parent_id = self.scroll_root_id(state.layout_context.id);
|
||||||
state.add_scroll_root(
|
state.add_scroll_root(
|
||||||
ScrollRoot {
|
ScrollRoot {
|
||||||
id: new_scroll_root_id,
|
id: new_scroll_root_id,
|
||||||
parent_id: self.base.scroll_root_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),
|
||||||
},
|
},
|
||||||
self.base.stacking_context_id
|
self.base.stacking_context_id
|
||||||
);
|
);
|
||||||
|
|
||||||
self.base.scroll_root_id = new_scroll_root_id;
|
self.base.scroll_root_id = Some(new_scroll_root_id);
|
||||||
state.current_scroll_root_id = new_scroll_root_id;
|
state.current_scroll_root_id = new_scroll_root_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2186,9 +2218,8 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
// 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 ScrollRootId.
|
||||||
let fragment_id = &mut self.fragment as *mut _;
|
let new_scroll_root_id = ClipId::new(self.fragment.unique_id(IdType::CSSClip),
|
||||||
let new_scroll_root_id = ScrollRootId::new_of_type(fragment_id as usize,
|
state.layout_context.id.to_webrender());
|
||||||
self.fragment.fragment_type());
|
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -2200,24 +2231,24 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
let content_rect = Rect::new(clip_origin, clip_size);
|
let content_rect = Rect::new(clip_origin, clip_size);
|
||||||
preserved_state.push_clip(state, &content_rect, self.positioning());
|
preserved_state.push_clip(state, &content_rect, self.positioning());
|
||||||
|
|
||||||
|
let parent_id = self.scroll_root_id(state.layout_context.id);
|
||||||
state.add_scroll_root(
|
state.add_scroll_root(
|
||||||
ScrollRoot {
|
ScrollRoot {
|
||||||
id: new_scroll_root_id,
|
id: new_scroll_root_id,
|
||||||
parent_id: self.base.scroll_root_id,
|
parent_id: parent_id,
|
||||||
clip: ClippingRegion::from_rect(&Rect::new(Point2D::zero(), clip_size)),
|
clip: ClippingRegion::from_rect(&Rect::new(Point2D::zero(), clip_size)),
|
||||||
content_rect: content_rect,
|
content_rect: content_rect,
|
||||||
},
|
},
|
||||||
self.base.stacking_context_id
|
self.base.stacking_context_id
|
||||||
);
|
);
|
||||||
|
|
||||||
self.base.scroll_root_id = new_scroll_root_id;
|
self.base.scroll_root_id = Some(new_scroll_root_id);
|
||||||
state.current_scroll_root_id = new_scroll_root_id;
|
state.current_scroll_root_id = new_scroll_root_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_pseudo_stacking_context_for_block(&mut self,
|
fn create_pseudo_stacking_context_for_block(&mut self,
|
||||||
parent_stacking_context_id: StackingContextId,
|
parent_stacking_context_id: StackingContextId,
|
||||||
parent_scroll_root_id: ScrollRootId,
|
parent_scroll_root_id: ClipId,
|
||||||
state: &mut DisplayListBuildState) {
|
state: &mut DisplayListBuildState) {
|
||||||
let creation_mode = if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
|
let creation_mode = if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) ||
|
||||||
self.fragment.style.get_box().position != position::T::static_ {
|
self.fragment.style.get_box().position != position::T::static_ {
|
||||||
|
@ -2251,7 +2282,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
||||||
|
|
||||||
fn create_real_stacking_context_for_block(&mut self,
|
fn create_real_stacking_context_for_block(&mut self,
|
||||||
parent_stacking_context_id: StackingContextId,
|
parent_stacking_context_id: StackingContextId,
|
||||||
parent_scroll_root_id: ScrollRootId,
|
parent_scroll_root_id: ClipId,
|
||||||
state: &mut DisplayListBuildState) {
|
state: &mut DisplayListBuildState) {
|
||||||
let scroll_policy = if self.is_fixed() {
|
let scroll_policy = if self.is_fixed() {
|
||||||
ScrollPolicy::Fixed
|
ScrollPolicy::Fixed
|
||||||
|
@ -2319,7 +2350,7 @@ pub trait InlineFlowDisplayListBuilding {
|
||||||
impl InlineFlowDisplayListBuilding for InlineFlow {
|
impl InlineFlowDisplayListBuilding for InlineFlow {
|
||||||
fn collect_stacking_contexts_for_inline(&mut self, state: &mut DisplayListBuildState) {
|
fn collect_stacking_contexts_for_inline(&mut self, state: &mut DisplayListBuildState) {
|
||||||
self.base.stacking_context_id = state.current_stacking_context_id;
|
self.base.stacking_context_id = state.current_stacking_context_id;
|
||||||
self.base.scroll_root_id = state.current_scroll_root_id;
|
self.base.scroll_root_id = Some(state.current_scroll_root_id);
|
||||||
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);
|
||||||
|
|
||||||
for mut fragment in self.fragments.fragments.iter_mut() {
|
for mut fragment in self.fragments.fragments.iter_mut() {
|
||||||
|
@ -2342,9 +2373,8 @@ impl InlineFlowDisplayListBuilding for InlineFlow {
|
||||||
block_flow.collect_stacking_contexts(state);
|
block_flow.collect_stacking_contexts(state);
|
||||||
}
|
}
|
||||||
_ if fragment.establishes_stacking_context() => {
|
_ if fragment.establishes_stacking_context() => {
|
||||||
fragment.stacking_context_id =
|
fragment.stacking_context_id = fragment.stacking_context_id();
|
||||||
StackingContextId::new_of_type(fragment.fragment_id(),
|
|
||||||
fragment.fragment_type());
|
|
||||||
let current_stacking_context_id = state.current_stacking_context_id;
|
let current_stacking_context_id = state.current_stacking_context_id;
|
||||||
let current_scroll_root_id = state.current_scroll_root_id;
|
let current_scroll_root_id = state.current_scroll_root_id;
|
||||||
state.add_stacking_context(current_stacking_context_id,
|
state.add_stacking_context(current_stacking_context_id,
|
||||||
|
@ -2565,4 +2595,3 @@ pub enum StackingContextCreationMode {
|
||||||
PseudoPositioned,
|
PseudoPositioned,
|
||||||
PseudoFloat,
|
PseudoFloat,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,11 @@ use floats::{Floats, SpeculatedFloatPlacement};
|
||||||
use flow_list::{FlowList, MutFlowListIterator};
|
use flow_list::{FlowList, MutFlowListIterator};
|
||||||
use flow_ref::{FlowRef, WeakFlowRef};
|
use flow_ref::{FlowRef, WeakFlowRef};
|
||||||
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
|
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
|
||||||
use gfx_traits::{ScrollRootId, StackingContextId};
|
use gfx_traits::StackingContextId;
|
||||||
use gfx_traits::print_tree::PrintTree;
|
use gfx_traits::print_tree::PrintTree;
|
||||||
use inline::InlineFlow;
|
use inline::InlineFlow;
|
||||||
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
|
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
|
||||||
|
use msg::constellation_msg::PipelineId;
|
||||||
use multicol::MulticolFlow;
|
use multicol::MulticolFlow;
|
||||||
use parallel::FlowParallelInfo;
|
use parallel::FlowParallelInfo;
|
||||||
use serde::ser::{Serialize, SerializeStruct, Serializer};
|
use serde::ser::{Serialize, SerializeStruct, Serializer};
|
||||||
|
@ -62,6 +63,7 @@ use table_colgroup::TableColGroupFlow;
|
||||||
use table_row::TableRowFlow;
|
use table_row::TableRowFlow;
|
||||||
use table_rowgroup::TableRowGroupFlow;
|
use table_rowgroup::TableRowGroupFlow;
|
||||||
use table_wrapper::TableWrapperFlow;
|
use table_wrapper::TableWrapperFlow;
|
||||||
|
use webrender_traits::ClipId;
|
||||||
|
|
||||||
/// Virtual methods that make up a float context.
|
/// Virtual methods that make up a float context.
|
||||||
///
|
///
|
||||||
|
@ -429,8 +431,14 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
||||||
/// children of this flow.
|
/// children of this flow.
|
||||||
fn print_extra_flow_children(&self, _: &mut PrintTree) { }
|
fn print_extra_flow_children(&self, _: &mut PrintTree) { }
|
||||||
|
|
||||||
fn scroll_root_id(&self) -> ScrollRootId {
|
fn scroll_root_id(&self, pipeline_id: PipelineId) -> ClipId {
|
||||||
base(self).scroll_root_id
|
match base(self).scroll_root_id {
|
||||||
|
Some(id) => id,
|
||||||
|
None => {
|
||||||
|
warn!("Tried to access scroll root id on Flow before assignment");
|
||||||
|
pipeline_id.root_scroll_node()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,7 +969,7 @@ pub struct BaseFlow {
|
||||||
/// list construction.
|
/// list construction.
|
||||||
pub stacking_context_id: StackingContextId,
|
pub stacking_context_id: StackingContextId,
|
||||||
|
|
||||||
pub scroll_root_id: ScrollRootId,
|
pub scroll_root_id: Option<ClipId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for BaseFlow {
|
impl fmt::Debug for BaseFlow {
|
||||||
|
@ -1104,8 +1112,8 @@ impl BaseFlow {
|
||||||
flags: flags,
|
flags: flags,
|
||||||
writing_mode: writing_mode,
|
writing_mode: writing_mode,
|
||||||
thread_id: 0,
|
thread_id: 0,
|
||||||
stacking_context_id: StackingContextId::new(0),
|
stacking_context_id: StackingContextId::root(),
|
||||||
scroll_root_id: ScrollRootId::root(),
|
scroll_root_id: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ use gfx;
|
||||||
use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode};
|
use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode};
|
||||||
use gfx::text::glyph::ByteIndex;
|
use gfx::text::glyph::ByteIndex;
|
||||||
use gfx::text::text_run::{TextRun, TextRunSlice};
|
use gfx::text::text_run::{TextRun, TextRunSlice};
|
||||||
use gfx_traits::{FragmentType, StackingContextId};
|
use gfx_traits::StackingContextId;
|
||||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo};
|
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo};
|
||||||
use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT, LineMetrics};
|
use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT, LineMetrics};
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
|
@ -665,7 +665,7 @@ impl Fragment {
|
||||||
pseudo: node.get_pseudo_element_type().strip(),
|
pseudo: node.get_pseudo_element_type().strip(),
|
||||||
flags: FragmentFlags::empty(),
|
flags: FragmentFlags::empty(),
|
||||||
debug_id: DebugId::new(),
|
debug_id: DebugId::new(),
|
||||||
stacking_context_id: StackingContextId::new(0),
|
stacking_context_id: StackingContextId::root(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ impl Fragment {
|
||||||
pseudo: pseudo,
|
pseudo: pseudo,
|
||||||
flags: FragmentFlags::empty(),
|
flags: FragmentFlags::empty(),
|
||||||
debug_id: DebugId::new(),
|
debug_id: DebugId::new(),
|
||||||
stacking_context_id: StackingContextId::new(0),
|
stacking_context_id: StackingContextId::root(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,7 +719,7 @@ impl Fragment {
|
||||||
pseudo: self.pseudo,
|
pseudo: self.pseudo,
|
||||||
flags: FragmentFlags::empty(),
|
flags: FragmentFlags::empty(),
|
||||||
debug_id: DebugId::new(),
|
debug_id: DebugId::new(),
|
||||||
stacking_context_id: StackingContextId::new(0),
|
stacking_context_id: StackingContextId::root(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ impl Fragment {
|
||||||
pseudo: self.pseudo.clone(),
|
pseudo: self.pseudo.clone(),
|
||||||
flags: FragmentFlags::empty(),
|
flags: FragmentFlags::empty(),
|
||||||
debug_id: self.debug_id.clone(),
|
debug_id: self.debug_id.clone(),
|
||||||
stacking_context_id: StackingContextId::new(0),
|
stacking_context_id: StackingContextId::root(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2798,21 +2798,6 @@ impl Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn fragment_id(&self) -> usize {
|
|
||||||
return self as *const Fragment as usize;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn fragment_type(&self) -> FragmentType {
|
|
||||||
match self.pseudo {
|
|
||||||
PseudoElementType::Normal => FragmentType::FragmentBody,
|
|
||||||
PseudoElementType::Before(_) => FragmentType::BeforePseudoContent,
|
|
||||||
PseudoElementType::After(_) => FragmentType::AfterPseudoContent,
|
|
||||||
PseudoElementType::DetailsSummary(_) => FragmentType::FragmentBody,
|
|
||||||
PseudoElementType::DetailsContent(_) => FragmentType::FragmentBody,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if any of the inline styles associated with this fragment have
|
/// Returns true if any of the inline styles associated with this fragment have
|
||||||
/// `vertical-align` set to `top` or `bottom`.
|
/// `vertical-align` set to `top` or `bottom`.
|
||||||
pub fn is_vertically_aligned_to_top_or_bottom(&self) -> bool {
|
pub fn is_vertically_aligned_to_top_or_bottom(&self) -> bool {
|
||||||
|
|
|
@ -13,9 +13,9 @@ use euclid::size::Size2D;
|
||||||
use flow::{self, Flow};
|
use flow::{self, Flow};
|
||||||
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
|
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
|
||||||
use gfx::display_list::{DisplayItemMetadata, DisplayList, OpaqueNode, ScrollOffsetMap};
|
use gfx::display_list::{DisplayItemMetadata, DisplayList, OpaqueNode, ScrollOffsetMap};
|
||||||
use gfx_traits::ScrollRootId;
|
|
||||||
use inline::LAST_FRAGMENT_OF_ELEMENT;
|
use inline::LAST_FRAGMENT_OF_ELEMENT;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
|
use msg::constellation_msg::PipelineId;
|
||||||
use opaque_node::OpaqueNodeMethods;
|
use opaque_node::OpaqueNodeMethods;
|
||||||
use script_layout_interface::PendingImage;
|
use script_layout_interface::PendingImage;
|
||||||
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse};
|
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse};
|
||||||
|
@ -41,6 +41,7 @@ use style::selector_parser::PseudoElement;
|
||||||
use style::stylist::Stylist;
|
use style::stylist::Stylist;
|
||||||
use style_traits::ToCss;
|
use style_traits::ToCss;
|
||||||
use style_traits::cursor::Cursor;
|
use style_traits::cursor::Cursor;
|
||||||
|
use webrender_traits::ClipId;
|
||||||
use wrapper::{LayoutNodeHelpers, LayoutNodeLayoutData};
|
use wrapper::{LayoutNodeHelpers, LayoutNodeLayoutData};
|
||||||
|
|
||||||
/// Mutable data belonging to the LayoutThread.
|
/// Mutable data belonging to the LayoutThread.
|
||||||
|
@ -69,7 +70,7 @@ pub struct LayoutThreadData {
|
||||||
pub hit_test_response: (Option<DisplayItemMetadata>, bool),
|
pub hit_test_response: (Option<DisplayItemMetadata>, bool),
|
||||||
|
|
||||||
/// A queued response for the scroll root id for a given node.
|
/// A queued response for the scroll root id for a given node.
|
||||||
pub scroll_root_id_response: Option<ScrollRootId>,
|
pub scroll_root_id_response: Option<ClipId>,
|
||||||
|
|
||||||
/// A pair of overflow property in x and y
|
/// A pair of overflow property in x and y
|
||||||
pub overflow_response: NodeOverflowResponse,
|
pub overflow_response: NodeOverflowResponse,
|
||||||
|
@ -650,9 +651,11 @@ pub fn process_node_geometry_request<N: LayoutNode>(requested_node: N, layout_ro
|
||||||
iterator.client_rect
|
iterator.client_rect
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_node_scroll_root_id_request<N: LayoutNode>(requested_node: N) -> ScrollRootId {
|
pub fn process_node_scroll_root_id_request<N: LayoutNode>(id: PipelineId,
|
||||||
|
requested_node: N)
|
||||||
|
-> ClipId {
|
||||||
let layout_node = requested_node.to_threadsafe();
|
let layout_node = requested_node.to_threadsafe();
|
||||||
layout_node.scroll_root_id()
|
layout_node.generate_scroll_root_id(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_node_scroll_area_request< N: LayoutNode>(requested_node: N, layout_root: &mut Flow)
|
pub fn process_node_scroll_area_request< N: LayoutNode>(requested_node: N, layout_root: &mut Flow)
|
||||||
|
|
|
@ -242,7 +242,7 @@ impl<'a> BuildDisplayList<'a> {
|
||||||
self.state.current_stacking_context_id = flow::base(flow).stacking_context_id;
|
self.state.current_stacking_context_id = flow::base(flow).stacking_context_id;
|
||||||
|
|
||||||
let parent_scroll_root_id = self.state.current_scroll_root_id;
|
let parent_scroll_root_id = self.state.current_scroll_root_id;
|
||||||
self.state.current_scroll_root_id = flow::base(flow).scroll_root_id;
|
self.state.current_scroll_root_id = flow.scroll_root_id(self.state.layout_context.id);
|
||||||
|
|
||||||
if self.should_process() {
|
if self.should_process() {
|
||||||
flow.build_display_list(&mut self.state);
|
flow.build_display_list(&mut self.state);
|
||||||
|
|
|
@ -11,7 +11,6 @@ use app_units::Au;
|
||||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||||
use gfx::display_list::{BorderDetails, BorderRadii, BoxShadowClipMode, ClippingRegion};
|
use gfx::display_list::{BorderDetails, BorderRadii, BoxShadowClipMode, ClippingRegion};
|
||||||
use gfx::display_list::{DisplayItem, DisplayList, DisplayListTraversal, StackingContextType};
|
use gfx::display_list::{DisplayItem, DisplayList, DisplayListTraversal, StackingContextType};
|
||||||
use gfx_traits::ScrollRootId;
|
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use style::computed_values::{image_rendering, mix_blend_mode};
|
use style::computed_values::{image_rendering, mix_blend_mode};
|
||||||
use style::computed_values::filter::{self, Filter};
|
use style::computed_values::filter::{self, Filter};
|
||||||
|
@ -25,7 +24,7 @@ pub trait WebRenderDisplayListConverter {
|
||||||
trait WebRenderDisplayItemConverter {
|
trait WebRenderDisplayItemConverter {
|
||||||
fn convert_to_webrender(&self,
|
fn convert_to_webrender(&self,
|
||||||
builder: &mut DisplayListBuilder,
|
builder: &mut DisplayListBuilder,
|
||||||
current_scroll_root_id: &mut ScrollRootId);
|
current_scroll_root_id: &mut ClipId);
|
||||||
}
|
}
|
||||||
|
|
||||||
trait ToBorderStyle {
|
trait ToBorderStyle {
|
||||||
|
@ -217,8 +216,8 @@ impl WebRenderDisplayListConverter for DisplayList {
|
||||||
let webrender_pipeline_id = pipeline_id.to_webrender();
|
let webrender_pipeline_id = pipeline_id.to_webrender();
|
||||||
let mut builder = DisplayListBuilder::new(webrender_pipeline_id);
|
let mut builder = DisplayListBuilder::new(webrender_pipeline_id);
|
||||||
|
|
||||||
let mut current_scroll_root_id = ScrollRootId::root();
|
let mut current_scroll_root_id = ClipId::root_scroll_node(webrender_pipeline_id);
|
||||||
builder.push_clip_id(current_scroll_root_id.convert_to_webrender(webrender_pipeline_id));
|
builder.push_clip_id(current_scroll_root_id);
|
||||||
|
|
||||||
for item in traversal {
|
for item in traversal {
|
||||||
item.convert_to_webrender(&mut builder, &mut current_scroll_root_id);
|
item.convert_to_webrender(&mut builder, &mut current_scroll_root_id);
|
||||||
|
@ -230,12 +229,11 @@ impl WebRenderDisplayListConverter for DisplayList {
|
||||||
impl WebRenderDisplayItemConverter for DisplayItem {
|
impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
fn convert_to_webrender(&self,
|
fn convert_to_webrender(&self,
|
||||||
builder: &mut DisplayListBuilder,
|
builder: &mut DisplayListBuilder,
|
||||||
current_scroll_root_id: &mut ScrollRootId) {
|
current_scroll_root_id: &mut ClipId) {
|
||||||
let scroll_root_id = self.base().scroll_root_id;
|
let scroll_root_id = self.base().scroll_root_id;
|
||||||
if scroll_root_id != *current_scroll_root_id {
|
if scroll_root_id != *current_scroll_root_id {
|
||||||
let pipeline_id = builder.pipeline_id;
|
|
||||||
builder.pop_clip_id();
|
builder.pop_clip_id();
|
||||||
builder.push_clip_id(scroll_root_id.convert_to_webrender(pipeline_id));
|
builder.push_clip_id(scroll_root_id);
|
||||||
*current_scroll_root_id = scroll_root_id;
|
*current_scroll_root_id = scroll_root_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,10 +423,9 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
}
|
}
|
||||||
DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(),
|
DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(),
|
||||||
DisplayItem::PushScrollRoot(ref item) => {
|
DisplayItem::PushScrollRoot(ref item) => {
|
||||||
let pipeline_id = builder.pipeline_id;
|
builder.push_clip_id(item.scroll_root.parent_id);
|
||||||
builder.push_clip_id(item.scroll_root.parent_id.convert_to_webrender(pipeline_id));
|
|
||||||
|
|
||||||
let our_id = item.scroll_root.id.convert_to_webrender(pipeline_id);
|
let our_id = item.scroll_root.id;
|
||||||
let clip = item.scroll_root.clip.to_clip_region(builder);
|
let clip = item.scroll_root.clip.to_clip_region(builder);
|
||||||
let content_rect = item.scroll_root.content_rect.to_rectf();
|
let content_rect = item.scroll_root.content_rect.to_rectf();
|
||||||
let webrender_id = builder.define_clip(content_rect, clip, Some(our_id));
|
let webrender_id = builder.define_clip(content_rect, clip, Some(our_id));
|
||||||
|
@ -440,16 +437,3 @@ impl WebRenderDisplayItemConverter for DisplayItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trait WebRenderScrollRootIdConverter {
|
|
||||||
fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ClipId;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WebRenderScrollRootIdConverter for ScrollRootId {
|
|
||||||
fn convert_to_webrender(&self, pipeline_id: webrender_traits::PipelineId) -> ClipId {
|
|
||||||
if *self == ScrollRootId::root() {
|
|
||||||
ClipId::root_scroll_node(pipeline_id)
|
|
||||||
} else {
|
|
||||||
ClipId::new(self.0 as u64, pipeline_id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ use gfx::display_list::{OpaqueNode, WebRenderImageInfo};
|
||||||
use gfx::font;
|
use gfx::font;
|
||||||
use gfx::font_cache_thread::FontCacheThread;
|
use gfx::font_cache_thread::FontCacheThread;
|
||||||
use gfx::font_context;
|
use gfx::font_context;
|
||||||
use gfx_traits::{Epoch, FragmentType, ScrollRootId};
|
use gfx_traits::{Epoch, node_id_from_clip_id};
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
|
@ -514,6 +514,7 @@ impl LayoutThread {
|
||||||
ThreadLocalStyleContextCreationInfo::new(self.new_animations_sender.clone());
|
ThreadLocalStyleContextCreationInfo::new(self.new_animations_sender.clone());
|
||||||
|
|
||||||
LayoutContext {
|
LayoutContext {
|
||||||
|
id: self.id,
|
||||||
style_context: SharedStyleContext {
|
style_context: SharedStyleContext {
|
||||||
stylist: rw_data.stylist.clone(),
|
stylist: rw_data.stylist.clone(),
|
||||||
options: StyleSystemOptions::default(),
|
options: StyleSystemOptions::default(),
|
||||||
|
@ -1282,7 +1283,8 @@ impl LayoutThread {
|
||||||
},
|
},
|
||||||
ReflowQueryType::NodeScrollRootIdQuery(node) => {
|
ReflowQueryType::NodeScrollRootIdQuery(node) => {
|
||||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||||
rw_data.scroll_root_id_response = Some(process_node_scroll_root_id_request(node));
|
rw_data.scroll_root_id_response = Some(process_node_scroll_root_id_request(self.id,
|
||||||
|
node));
|
||||||
},
|
},
|
||||||
ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => {
|
ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => {
|
||||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||||
|
@ -1339,12 +1341,12 @@ impl LayoutThread {
|
||||||
let offset = new_scroll_state.scroll_offset;
|
let offset = new_scroll_state.scroll_offset;
|
||||||
layout_scroll_states.insert(new_scroll_state.scroll_root_id, offset);
|
layout_scroll_states.insert(new_scroll_state.scroll_root_id, offset);
|
||||||
|
|
||||||
if new_scroll_state.scroll_root_id == ScrollRootId::root() {
|
if new_scroll_state.scroll_root_id.is_root_scroll_node() {
|
||||||
script_scroll_states.push((UntrustedNodeAddress::from_id(0), offset))
|
script_scroll_states.push((UntrustedNodeAddress::from_id(0), offset))
|
||||||
} else if !new_scroll_state.scroll_root_id.is_special() &&
|
} else if let Some(id) = new_scroll_state.scroll_root_id.external_id() {
|
||||||
new_scroll_state.scroll_root_id.fragment_type() == FragmentType::FragmentBody {
|
if let Some(node_id) = node_id_from_clip_id(id as usize) {
|
||||||
let id = new_scroll_state.scroll_root_id.id();
|
script_scroll_states.push((UntrustedNodeAddress::from_id(node_id), offset))
|
||||||
script_scroll_states.push((UntrustedNodeAddress::from_id(id), offset))
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _ = self.script_chan
|
let _ = self.script_chan
|
||||||
|
|
|
@ -244,6 +244,10 @@ impl PipelineId {
|
||||||
let PipelineIndex(index) = self.index;
|
let PipelineIndex(index) = self.index;
|
||||||
webrender_traits::PipelineId(namespace_id, index)
|
webrender_traits::PipelineId(namespace_id, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn root_scroll_node(&self) -> webrender_traits::ClipId {
|
||||||
|
webrender_traits::ClipId::root_scroll_node(self.to_webrender())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for PipelineId {
|
impl fmt::Display for PipelineId {
|
||||||
|
|
|
@ -93,7 +93,6 @@ use dom_struct::dom_struct;
|
||||||
use encoding::EncodingRef;
|
use encoding::EncodingRef;
|
||||||
use encoding::all::UTF_8;
|
use encoding::all::UTF_8;
|
||||||
use euclid::point::Point2D;
|
use euclid::point::Point2D;
|
||||||
use gfx_traits::ScrollRootId;
|
|
||||||
use html5ever_atoms::{LocalName, QualName};
|
use html5ever_atoms::{LocalName, QualName};
|
||||||
use hyper::header::{Header, SetCookie};
|
use hyper::header::{Header, SetCookie};
|
||||||
use hyper_serde::Serde;
|
use hyper_serde::Serde;
|
||||||
|
@ -143,6 +142,7 @@ use time;
|
||||||
use timers::OneshotTimerCallback;
|
use timers::OneshotTimerCallback;
|
||||||
use url::Host;
|
use url::Host;
|
||||||
use url::percent_encoding::percent_decode;
|
use url::percent_encoding::percent_decode;
|
||||||
|
use webrender_traits::ClipId;
|
||||||
|
|
||||||
/// The number of times we are allowed to see spurious `requestAnimationFrame()` calls before
|
/// The number of times we are allowed to see spurious `requestAnimationFrame()` calls before
|
||||||
/// falling back to fake ones.
|
/// falling back to fake ones.
|
||||||
|
@ -699,9 +699,11 @@ impl Document {
|
||||||
|
|
||||||
if let Some((x, y)) = point {
|
if let Some((x, y)) = point {
|
||||||
// Step 3
|
// Step 3
|
||||||
|
let global_scope = self.window.upcast::<GlobalScope>();
|
||||||
|
let webrender_pipeline_id = global_scope.pipeline_id().to_webrender();
|
||||||
self.window.perform_a_scroll(x,
|
self.window.perform_a_scroll(x,
|
||||||
y,
|
y,
|
||||||
ScrollRootId::root(),
|
ClipId::root_scroll_node(webrender_pipeline_id),
|
||||||
ScrollBehavior::Instant,
|
ScrollBehavior::Instant,
|
||||||
target.r());
|
target.r());
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ use dom::testrunner::TestRunner;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::{Point2D, Rect, Size2D};
|
use euclid::{Point2D, Rect, Size2D};
|
||||||
use fetch;
|
use fetch;
|
||||||
use gfx_traits::ScrollRootId;
|
|
||||||
use ipc_channel::ipc::{self, IpcSender};
|
use ipc_channel::ipc::{self, IpcSender};
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use js::jsapi::{HandleObject, HandleValue, JSAutoCompartment, JSContext};
|
use js::jsapi::{HandleObject, HandleValue, JSAutoCompartment, JSContext};
|
||||||
|
@ -122,6 +121,7 @@ use timers::{IsInterval, TimerCallback};
|
||||||
use tinyfiledialogs::{self, MessageBoxIcon};
|
use tinyfiledialogs::{self, MessageBoxIcon};
|
||||||
use url::Position;
|
use url::Position;
|
||||||
use webdriver_handlers::jsval_to_webdriver;
|
use webdriver_handlers::jsval_to_webdriver;
|
||||||
|
use webrender_traits::ClipId;
|
||||||
use webvr_traits::WebVRMsg;
|
use webvr_traits::WebVRMsg;
|
||||||
|
|
||||||
/// Current state of the window object
|
/// Current state of the window object
|
||||||
|
@ -1077,9 +1077,10 @@ impl Window {
|
||||||
//TODO Step 11
|
//TODO Step 11
|
||||||
//let document = self.Document();
|
//let document = self.Document();
|
||||||
// Step 12
|
// Step 12
|
||||||
|
let global_scope = self.upcast::<GlobalScope>();
|
||||||
self.perform_a_scroll(x.to_f32().unwrap_or(0.0f32),
|
self.perform_a_scroll(x.to_f32().unwrap_or(0.0f32),
|
||||||
y.to_f32().unwrap_or(0.0f32),
|
y.to_f32().unwrap_or(0.0f32),
|
||||||
ScrollRootId::root(),
|
global_scope.pipeline_id().root_scroll_node(),
|
||||||
behavior,
|
behavior,
|
||||||
None);
|
None);
|
||||||
}
|
}
|
||||||
|
@ -1088,7 +1089,7 @@ impl Window {
|
||||||
pub fn perform_a_scroll(&self,
|
pub fn perform_a_scroll(&self,
|
||||||
x: f32,
|
x: f32,
|
||||||
y: f32,
|
y: f32,
|
||||||
scroll_root_id: ScrollRootId,
|
scroll_root_id: ClipId,
|
||||||
behavior: ScrollBehavior,
|
behavior: ScrollBehavior,
|
||||||
element: Option<&Element>) {
|
element: Option<&Element>) {
|
||||||
//TODO Step 1
|
//TODO Step 1
|
||||||
|
@ -1108,8 +1109,7 @@ impl Window {
|
||||||
self.update_viewport_for_scroll(x, y);
|
self.update_viewport_for_scroll(x, y);
|
||||||
|
|
||||||
let global_scope = self.upcast::<GlobalScope>();
|
let global_scope = self.upcast::<GlobalScope>();
|
||||||
let message = ConstellationMsg::ScrollFragmentPoint(
|
let message = ConstellationMsg::ScrollFragmentPoint(scroll_root_id, point, smooth);
|
||||||
global_scope.pipeline_id(), scroll_root_id, point, smooth);
|
|
||||||
global_scope.constellation_chan().send(message).unwrap();
|
global_scope.constellation_chan().send(message).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,3 +30,4 @@ script_traits = {path = "../script_traits"}
|
||||||
selectors = { path = "../selectors" }
|
selectors = { path = "../selectors" }
|
||||||
servo_url = {path = "../url"}
|
servo_url = {path = "../url"}
|
||||||
style = {path = "../style"}
|
style = {path = "../style"}
|
||||||
|
webrender_traits = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||||
|
|
|
@ -32,6 +32,7 @@ extern crate script_traits;
|
||||||
extern crate selectors;
|
extern crate selectors;
|
||||||
extern crate servo_url;
|
extern crate servo_url;
|
||||||
extern crate style;
|
extern crate style;
|
||||||
|
extern crate webrender_traits;
|
||||||
|
|
||||||
pub mod message;
|
pub mod message;
|
||||||
pub mod reporter;
|
pub mod reporter;
|
||||||
|
|
|
@ -6,9 +6,9 @@ use PendingImage;
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use euclid::point::Point2D;
|
use euclid::point::Point2D;
|
||||||
use euclid::rect::Rect;
|
use euclid::rect::Rect;
|
||||||
use gfx_traits::ScrollRootId;
|
|
||||||
use script_traits::UntrustedNodeAddress;
|
use script_traits::UntrustedNodeAddress;
|
||||||
use style::properties::longhands::{margin_top, margin_right, margin_bottom, margin_left, overflow_x};
|
use style::properties::longhands::{margin_top, margin_right, margin_bottom, margin_left, overflow_x};
|
||||||
|
use webrender_traits::ClipId;
|
||||||
|
|
||||||
/// Synchronous messages that script can send to layout.
|
/// Synchronous messages that script can send to layout.
|
||||||
///
|
///
|
||||||
|
@ -56,7 +56,7 @@ pub struct NodeGeometryResponse {
|
||||||
|
|
||||||
pub struct NodeOverflowResponse(pub Option<Point2D<overflow_x::computed_value::T>>);
|
pub struct NodeOverflowResponse(pub Option<Point2D<overflow_x::computed_value::T>>);
|
||||||
|
|
||||||
pub struct NodeScrollRootIdResponse(pub ScrollRootId);
|
pub struct NodeScrollRootIdResponse(pub ClipId);
|
||||||
|
|
||||||
pub struct HitTestResponse {
|
pub struct HitTestResponse {
|
||||||
pub node_address: Option<UntrustedNodeAddress>,
|
pub node_address: Option<UntrustedNodeAddress>,
|
||||||
|
|
|
@ -9,7 +9,7 @@ use LayoutNodeType;
|
||||||
use OpaqueStyleAndLayoutData;
|
use OpaqueStyleAndLayoutData;
|
||||||
use SVGSVGData;
|
use SVGSVGData;
|
||||||
use atomic_refcell::AtomicRefCell;
|
use atomic_refcell::AtomicRefCell;
|
||||||
use gfx_traits::{ByteIndex, FragmentType, ScrollRootId};
|
use gfx_traits::{ByteIndex, FragmentType, combine_id_with_fragment_type};
|
||||||
use html5ever_atoms::{Namespace, LocalName};
|
use html5ever_atoms::{Namespace, LocalName};
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use range::Range;
|
use range::Range;
|
||||||
|
@ -24,6 +24,7 @@ use style::dom::OpaqueNode;
|
||||||
use style::font_metrics::ServoMetricsProvider;
|
use style::font_metrics::ServoMetricsProvider;
|
||||||
use style::properties::{CascadeFlags, ServoComputedValues};
|
use style::properties::{CascadeFlags, ServoComputedValues};
|
||||||
use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl};
|
use style::selector_parser::{PseudoElement, PseudoElementCascadeType, SelectorImpl};
|
||||||
|
use webrender_traits::ClipId;
|
||||||
|
|
||||||
#[derive(Copy, PartialEq, Clone, Debug)]
|
#[derive(Copy, PartialEq, Clone, Debug)]
|
||||||
pub enum PseudoElementType<T> {
|
pub enum PseudoElementType<T> {
|
||||||
|
@ -288,8 +289,9 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scroll_root_id(&self) -> ScrollRootId {
|
fn generate_scroll_root_id(&self, pipeline_id: PipelineId) -> ClipId {
|
||||||
ScrollRootId::new_of_type(self.opaque().id() as usize, self.fragment_type())
|
let id = combine_id_with_fragment_type(self.opaque().id(), self.fragment_type());
|
||||||
|
ClipId::new(id as u64, pipeline_id.to_webrender())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,4 +34,5 @@ servo_url = {path = "../url"}
|
||||||
style_traits = {path = "../style_traits", features = ["servo"]}
|
style_traits = {path = "../style_traits", features = ["servo"]}
|
||||||
time = "0.1.12"
|
time = "0.1.12"
|
||||||
url = {version = "1.2", features = ["heap_size"]}
|
url = {version = "1.2", features = ["heap_size"]}
|
||||||
|
webrender_traits = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||||
webvr_traits = {path = "../webvr_traits"}
|
webvr_traits = {path = "../webvr_traits"}
|
||||||
|
|
|
@ -33,6 +33,7 @@ extern crate serde_derive;
|
||||||
extern crate servo_url;
|
extern crate servo_url;
|
||||||
extern crate style_traits;
|
extern crate style_traits;
|
||||||
extern crate time;
|
extern crate time;
|
||||||
|
extern crate webrender_traits;
|
||||||
extern crate webvr_traits;
|
extern crate webvr_traits;
|
||||||
|
|
||||||
mod script_msg;
|
mod script_msg;
|
||||||
|
@ -47,7 +48,6 @@ use euclid::rect::Rect;
|
||||||
use euclid::scale_factor::ScaleFactor;
|
use euclid::scale_factor::ScaleFactor;
|
||||||
use euclid::size::TypedSize2D;
|
use euclid::size::TypedSize2D;
|
||||||
use gfx_traits::Epoch;
|
use gfx_traits::Epoch;
|
||||||
use gfx_traits::ScrollRootId;
|
|
||||||
use heapsize::HeapSizeOf;
|
use heapsize::HeapSizeOf;
|
||||||
use hyper::header::Headers;
|
use hyper::header::Headers;
|
||||||
use hyper::method::Method;
|
use hyper::method::Method;
|
||||||
|
@ -71,6 +71,7 @@ use std::sync::Arc;
|
||||||
use std::sync::mpsc::{Receiver, Sender};
|
use std::sync::mpsc::{Receiver, Sender};
|
||||||
use style_traits::{CSSPixel, UnsafeNode};
|
use style_traits::{CSSPixel, UnsafeNode};
|
||||||
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
|
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
|
||||||
|
use webrender_traits::ClipId;
|
||||||
use webvr_traits::{WebVREvent, WebVRMsg};
|
use webvr_traits::{WebVREvent, WebVRMsg};
|
||||||
|
|
||||||
pub use script_msg::{LayoutMsg, ScriptMsg, EventResult, LogEntry};
|
pub use script_msg::{LayoutMsg, ScriptMsg, EventResult, LogEntry};
|
||||||
|
@ -662,7 +663,7 @@ pub enum AnimationTickType {
|
||||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct StackingContextScrollState {
|
pub struct StackingContextScrollState {
|
||||||
/// The ID of the scroll root.
|
/// The ID of the scroll root.
|
||||||
pub scroll_root_id: ScrollRootId,
|
pub scroll_root_id: ClipId,
|
||||||
/// The scrolling offset of this stacking context.
|
/// The scrolling offset of this stacking context.
|
||||||
pub scroll_offset: Point2D<f32>,
|
pub scroll_offset: Point2D<f32>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ use canvas_traits::CanvasMsg;
|
||||||
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
||||||
use euclid::point::Point2D;
|
use euclid::point::Point2D;
|
||||||
use euclid::size::{Size2D, TypedSize2D};
|
use euclid::size::{Size2D, TypedSize2D};
|
||||||
use gfx_traits::ScrollRootId;
|
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use msg::constellation_msg::{FrameId, FrameType, PipelineId, TraversalDirection};
|
use msg::constellation_msg::{FrameId, FrameType, PipelineId, TraversalDirection};
|
||||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
||||||
|
@ -28,6 +27,7 @@ use servo_url::ServoUrl;
|
||||||
use style_traits::CSSPixel;
|
use style_traits::CSSPixel;
|
||||||
use style_traits::cursor::Cursor;
|
use style_traits::cursor::Cursor;
|
||||||
use style_traits::viewport::ViewportConstraints;
|
use style_traits::viewport::ViewportConstraints;
|
||||||
|
use webrender_traits::ClipId;
|
||||||
|
|
||||||
/// Messages from the layout to the constellation.
|
/// Messages from the layout to the constellation.
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
|
@ -133,7 +133,7 @@ pub enum ScriptMsg {
|
||||||
/// Check if an alert dialog box should be presented
|
/// Check if an alert dialog box should be presented
|
||||||
Alert(PipelineId, String, IpcSender<bool>),
|
Alert(PipelineId, String, IpcSender<bool>),
|
||||||
/// Scroll a page in a window
|
/// Scroll a page in a window
|
||||||
ScrollFragmentPoint(PipelineId, ScrollRootId, Point2D<f32>, bool),
|
ScrollFragmentPoint(ClipId, Point2D<f32>, bool),
|
||||||
/// Set title of current page
|
/// Set title of current page
|
||||||
/// https://html.spec.whatwg.org/multipage/#document.title
|
/// https://html.spec.whatwg.org/multipage/#document.title
|
||||||
SetTitle(PipelineId, Option<String>),
|
SetTitle(PipelineId, Option<String>),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue