Skip to content

Commit 2e451c7

Browse files
author
bors-servo
authored
Auto merge of #467 - mrobinson:scroll_id, r=glennw
Replace ServoStackingContextId with ServoScrollRootId <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/467) <!-- Reviewable:end -->
2 parents 3b62d14 + a27cf24 commit 2e451c7

File tree

7 files changed

+22
-34
lines changed

7 files changed

+22
-34
lines changed

webrender/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "webrender"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
authors = ["Glenn Watson <gw@intuitionlibrary.com>"]
55
license = "MPL-2.0"
66
repository = "https://github.com/servo/webrender"

webrender/src/frame.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ impl Frame {
269269
let mut result = vec![];
270270
for (scroll_layer_id, scroll_layer) in &self.layers {
271271
match scroll_layer_id.info {
272-
ScrollLayerInfo::Scrollable(_) => {
272+
ScrollLayerInfo::Scrollable(_, servo_scroll_root_id) => {
273273
result.push(ScrollLayerState {
274274
pipeline_id: scroll_layer.pipeline_id,
275-
stacking_context_id: scroll_layer.stacking_context_id,
275+
scroll_root_id: servo_scroll_root_id,
276276
scroll_offset: scroll_layer.scrolling.offset,
277277
})
278278
}
@@ -394,16 +394,14 @@ impl Frame {
394394
Layer::new(&root_viewport,
395395
root_stacking_context.stacking_context.overflow.size,
396396
&Matrix4D::identity(),
397-
root_pipeline_id,
398-
root_stacking_context.stacking_context.servo_id));
397+
root_pipeline_id));
399398

400399
self.layers.insert(
401400
root_scroll_layer_id,
402401
Layer::new(&root_viewport,
403402
root_stacking_context.stacking_context.overflow.size,
404403
&Matrix4D::identity(),
405-
root_pipeline_id,
406-
root_stacking_context.stacking_context.servo_id));
404+
root_pipeline_id));
407405

408406
// Work around borrow check on resource cache
409407
{
@@ -636,8 +634,7 @@ impl Frame {
636634
let layer = Layer::new(&inner_stacking_context.bounds,
637635
inner_stacking_context.overflow.size,
638636
&transform,
639-
parent_info.pipeline_id,
640-
inner_stacking_context.servo_id);
637+
parent_info.pipeline_id);
641638

642639
debug_assert!(parent_info.current_scroll_layer_id != inner_scroll_layer_id);
643640
self.layers
@@ -696,8 +693,7 @@ impl Frame {
696693
Layer::new(&iframe_rect,
697694
iframe_stacking_context.overflow.size,
698695
&transform,
699-
pipeline.pipeline_id,
700-
iframe_stacking_context.servo_id));
696+
pipeline.pipeline_id));
701697

702698
let iframe_scroll_layer_id = iframe_stacking_context.scroll_layer_id.unwrap();
703699

@@ -706,8 +702,7 @@ impl Frame {
706702
Layer::new(&iframe_rect,
707703
iframe_stacking_context.overflow.size,
708704
&transform,
709-
pipeline.pipeline_id,
710-
iframe_stacking_context.servo_id));
705+
pipeline.pipeline_id));
711706

712707
self.layers
713708
.get_mut(&scroll_layer_id)

webrender/src/layer.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use euclid::{Matrix4D, Point2D, Rect, Size2D};
66
use spring::{DAMPING, STIFFNESS, Spring};
7-
use webrender_traits::{PipelineId, ScrollLayerId, ServoStackingContextId};
7+
use webrender_traits::{PipelineId, ScrollLayerId};
88

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

34-
// Accounting information for mapping to servo stacking contexts.
35-
// TODO(gw): Can we remove this somehow?
36-
pub stacking_context_id: ServoStackingContextId,
37-
3834
// Child layers
3935
pub children: Vec<ScrollLayerId>,
4036
}
@@ -43,8 +39,7 @@ impl Layer {
4339
pub fn new(local_viewport_rect: &Rect<f32>,
4440
content_size: Size2D<f32>,
4541
local_transform: &Matrix4D<f32>,
46-
pipeline_id: PipelineId,
47-
stacking_context_id: ServoStackingContextId)
42+
pipeline_id: PipelineId)
4843
-> Layer {
4944
Layer {
5045
scrolling: ScrollingState::new(),
@@ -56,7 +51,6 @@ impl Layer {
5651
local_transform: *local_transform,
5752
children: Vec::new(),
5853
pipeline_id: pipeline_id,
59-
stacking_context_id: stacking_context_id,
6054
}
6155
}
6256

webrender_traits/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "webrender_traits"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
authors = ["Glenn Watson <gw@intuitionlibrary.com>"]
55
license = "MPL-2.0"
66
repository = "https://github.com/servo/webrender"

webrender_traits/src/display_item.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use display_list::AuxiliaryListsBuilder;
66
use euclid::{Rect, Size2D};
77
use {BorderRadius, BorderDisplayItem, ClipRegion, ColorF, ComplexClipRegion};
8-
use {FontKey, ImageKey, PipelineId, ScrollLayerId, ScrollLayerInfo};
8+
use {FontKey, ImageKey, PipelineId, ScrollLayerId, ScrollLayerInfo, ServoScrollRootId};
99

1010
impl BorderDisplayItem {
1111
pub fn top_left_inner_radius(&self) -> Size2D<f32> {
@@ -103,10 +103,13 @@ impl ImageKey {
103103
}
104104

105105
impl ScrollLayerId {
106-
pub fn new(pipeline_id: PipelineId, index: usize) -> ScrollLayerId {
106+
pub fn new(pipeline_id: PipelineId,
107+
index: usize,
108+
scroll_root_id: ServoScrollRootId)
109+
-> ScrollLayerId {
107110
ScrollLayerId {
108111
pipeline_id: pipeline_id,
109-
info: ScrollLayerInfo::Scrollable(index),
112+
info: ScrollLayerInfo::Scrollable(index, scroll_root_id),
110113
}
111114
}
112115

webrender_traits/src/stacking_context.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44

55
use display_list::AuxiliaryListsBuilder;
66
use euclid::{Matrix4D, Rect};
7-
use {FilterOp, MixBlendMode, ScrollLayerId, ScrollPolicy};
8-
use {ServoStackingContextId, StackingContext};
7+
use {FilterOp, MixBlendMode, ScrollLayerId, ScrollPolicy, StackingContext};
98

109
impl StackingContext {
11-
pub fn new(servo_id: ServoStackingContextId,
12-
scroll_layer_id: Option<ScrollLayerId>,
10+
pub fn new(scroll_layer_id: Option<ScrollLayerId>,
1311
scroll_policy: ScrollPolicy,
1412
bounds: Rect<f32>,
1513
overflow: Rect<f32>,
@@ -22,7 +20,6 @@ impl StackingContext {
2220
auxiliary_lists_builder: &mut AuxiliaryListsBuilder)
2321
-> StackingContext {
2422
StackingContext {
25-
servo_id: servo_id,
2623
scroll_layer_id: scroll_layer_id,
2724
scroll_policy: scroll_policy,
2825
bounds: bounds,

webrender_traits/src/types.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,13 @@ pub struct ScrollLayerId {
397397
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
398398
pub enum ScrollLayerInfo {
399399
Fixed,
400-
Scrollable(usize)
400+
Scrollable(usize, ServoScrollRootId)
401401
}
402402

403403
#[derive(Clone, Deserialize, Serialize)]
404404
pub struct ScrollLayerState {
405405
pub pipeline_id: PipelineId,
406-
pub stacking_context_id: ServoStackingContextId,
406+
pub scroll_root_id: ServoScrollRootId,
407407
pub scroll_offset: Point2D<f32>,
408408
}
409409

@@ -414,7 +414,7 @@ pub enum ScrollPolicy {
414414
}
415415

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

419419
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
420420
pub enum SpecificDisplayItem {
@@ -436,7 +436,6 @@ pub enum SpecificDisplayListItem {
436436

437437
#[derive(Clone, Deserialize, Serialize)]
438438
pub struct StackingContext {
439-
pub servo_id: ServoStackingContextId,
440439
pub scroll_layer_id: Option<ScrollLayerId>,
441440
pub scroll_policy: ScrollPolicy,
442441
pub bounds: Rect<f32>,

0 commit comments

Comments
 (0)