Skip to content

Replace ServoStackingContextId with ServoScrollRootId #467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webrender/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "webrender"
version = "0.7.0"
version = "0.8.0"
authors = ["Glenn Watson <gw@intuitionlibrary.com>"]
license = "MPL-2.0"
repository = "https://github.com/servo/webrender"
Expand Down
19 changes: 7 additions & 12 deletions webrender/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ impl Frame {
let mut result = vec![];
for (scroll_layer_id, scroll_layer) in &self.layers {
match scroll_layer_id.info {
ScrollLayerInfo::Scrollable(_) => {
ScrollLayerInfo::Scrollable(_, servo_scroll_root_id) => {
result.push(ScrollLayerState {
pipeline_id: scroll_layer.pipeline_id,
stacking_context_id: scroll_layer.stacking_context_id,
scroll_root_id: servo_scroll_root_id,
scroll_offset: scroll_layer.scrolling.offset,
})
}
Expand Down Expand Up @@ -397,16 +397,14 @@ impl Frame {
Layer::new(&root_viewport,
root_stacking_context.stacking_context.overflow.size,
&Matrix4D::identity(),
root_pipeline_id,
root_stacking_context.stacking_context.servo_id));
root_pipeline_id));

self.layers.insert(
root_scroll_layer_id,
Layer::new(&root_viewport,
root_stacking_context.stacking_context.overflow.size,
&Matrix4D::identity(),
root_pipeline_id,
root_stacking_context.stacking_context.servo_id));
root_pipeline_id));

// Work around borrow check on resource cache
{
Expand Down Expand Up @@ -657,8 +655,7 @@ impl Frame {
let layer = Layer::new(&inner_stacking_context.bounds,
inner_stacking_context.overflow.size,
&transform,
parent_info.pipeline_id,
inner_stacking_context.servo_id);
parent_info.pipeline_id);

debug_assert!(parent_info.current_scroll_layer_id != inner_scroll_layer_id);
self.layers
Expand Down Expand Up @@ -717,8 +714,7 @@ impl Frame {
Layer::new(&iframe_rect,
iframe_stacking_context.overflow.size,
&transform,
pipeline.pipeline_id,
iframe_stacking_context.servo_id));
pipeline.pipeline_id));

let iframe_scroll_layer_id = iframe_stacking_context.scroll_layer_id.unwrap();

Expand All @@ -727,8 +723,7 @@ impl Frame {
Layer::new(&iframe_rect,
iframe_stacking_context.overflow.size,
&transform,
pipeline.pipeline_id,
iframe_stacking_context.servo_id));
pipeline.pipeline_id));

self.layers
.get_mut(&scroll_layer_id)
Expand Down
10 changes: 2 additions & 8 deletions webrender/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use euclid::{Matrix4D, Point2D, Rect, Size2D};
use spring::{DAMPING, STIFFNESS, Spring};
use webrender_traits::{PipelineId, ScrollLayerId, ServoStackingContextId};
use webrender_traits::{PipelineId, ScrollLayerId};

pub struct Layer {
// Manages scrolling offset, overscroll state etc.
Expand All @@ -31,10 +31,6 @@ pub struct Layer {
// Pipeline that this layer belongs to
pub pipeline_id: PipelineId,

// Accounting information for mapping to servo stacking contexts.
// TODO(gw): Can we remove this somehow?
pub stacking_context_id: ServoStackingContextId,

// Child layers
pub children: Vec<ScrollLayerId>,
}
Expand All @@ -43,8 +39,7 @@ impl Layer {
pub fn new(local_viewport_rect: &Rect<f32>,
content_size: Size2D<f32>,
local_transform: &Matrix4D<f32>,
pipeline_id: PipelineId,
stacking_context_id: ServoStackingContextId)
pipeline_id: PipelineId)
-> Layer {
Layer {
scrolling: ScrollingState::new(),
Expand All @@ -56,7 +51,6 @@ impl Layer {
local_transform: *local_transform,
children: Vec::new(),
pipeline_id: pipeline_id,
stacking_context_id: stacking_context_id,
}
}

Expand Down
2 changes: 1 addition & 1 deletion webrender_traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "webrender_traits"
version = "0.7.0"
version = "0.8.0"
authors = ["Glenn Watson <gw@intuitionlibrary.com>"]
license = "MPL-2.0"
repository = "https://github.com/servo/webrender"
Expand Down
9 changes: 6 additions & 3 deletions webrender_traits/src/display_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use display_list::AuxiliaryListsBuilder;
use euclid::{Rect, Size2D};
use {BorderRadius, BorderDisplayItem, ClipRegion, ColorF, ComplexClipRegion};
use {FontKey, ImageKey, PipelineId, ScrollLayerId, ScrollLayerInfo};
use {FontKey, ImageKey, PipelineId, ScrollLayerId, ScrollLayerInfo, ServoScrollRootId};
use {ImageMask};

impl BorderDisplayItem {
Expand Down Expand Up @@ -106,10 +106,13 @@ impl ImageKey {
}

impl ScrollLayerId {
pub fn new(pipeline_id: PipelineId, index: usize) -> ScrollLayerId {
pub fn new(pipeline_id: PipelineId,
index: usize,
scroll_root_id: ServoScrollRootId)
-> ScrollLayerId {
ScrollLayerId {
pipeline_id: pipeline_id,
info: ScrollLayerInfo::Scrollable(index),
info: ScrollLayerInfo::Scrollable(index, scroll_root_id),
}
}

Expand Down
7 changes: 2 additions & 5 deletions webrender_traits/src/stacking_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

use display_list::AuxiliaryListsBuilder;
use euclid::{Matrix4D, Rect};
use {FilterOp, MixBlendMode, ScrollLayerId, ScrollPolicy};
use {ServoStackingContextId, StackingContext};
use {FilterOp, MixBlendMode, ScrollLayerId, ScrollPolicy, StackingContext};

impl StackingContext {
pub fn new(servo_id: ServoStackingContextId,
scroll_layer_id: Option<ScrollLayerId>,
pub fn new(scroll_layer_id: Option<ScrollLayerId>,
scroll_policy: ScrollPolicy,
bounds: Rect<f32>,
overflow: Rect<f32>,
Expand All @@ -22,7 +20,6 @@ impl StackingContext {
auxiliary_lists_builder: &mut AuxiliaryListsBuilder)
-> StackingContext {
StackingContext {
servo_id: servo_id,
scroll_layer_id: scroll_layer_id,
scroll_policy: scroll_policy,
bounds: bounds,
Expand Down
7 changes: 3 additions & 4 deletions webrender_traits/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,13 @@ pub struct ScrollLayerId {
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub enum ScrollLayerInfo {
Fixed,
Scrollable(usize)
Scrollable(usize, ServoScrollRootId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just call this ScrollRootId instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm. I'm not sure. I kept the same naming scheme as ServoStackingContextId in the off-chance that WebRender also grew an understanding (and an id) for ScrollRoots. I guess we can land this PR and then investigate later once my first round of work is complete.

}

#[derive(Clone, Deserialize, Serialize)]
pub struct ScrollLayerState {
pub pipeline_id: PipelineId,
pub stacking_context_id: ServoStackingContextId,
pub scroll_root_id: ServoScrollRootId,
pub scroll_offset: Point2D<f32>,
}

Expand All @@ -422,7 +422,7 @@ pub enum ScrollPolicy {
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct ServoStackingContextId(pub FragmentType, pub usize);
pub struct ServoScrollRootId(pub usize);

#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub enum SpecificDisplayItem {
Expand All @@ -444,7 +444,6 @@ pub enum SpecificDisplayListItem {

#[derive(Clone, Deserialize, Serialize)]
pub struct StackingContext {
pub servo_id: ServoStackingContextId,
pub scroll_layer_id: Option<ScrollLayerId>,
pub scroll_policy: ScrollPolicy,
pub bounds: Rect<f32>,
Expand Down