Skip to content

Support for non-stacking-context scrolling areas - #517

Merged
bors-servo merged 1 commit into
servo:masterfrom
mrobinson:scroll_root
Nov 4, 2016
Merged

bors-servo merged 1 commit into
servo:masterfrom
mrobinson:scroll_root

Conversation

@mrobinson

@mrobinson mrobinson commented Nov 3, 2016 •

Copy link
Copy Markdown
Member

When we encounter a stacking context which scrolls its contents, we
treat it as a special non-stacking-context scrolling area. All
scrolling areas with the same servo scroll root id will be scrolled in
tandem. Later changes will give these fake stacking contexts their own
display item.


This change is Reviewable

@mrobinson

Copy link
Copy Markdown
Member Author

@glennw r?

Comment thread webrender/src/frame.rs
}
let scroll_root_id = match scroll_layer_id.info {
ScrollLayerInfo::Scrollable(_, scroll_root_id) => scroll_root_id,
ScrollLayerInfo::Fixed => unreachable!("Tried to scroll a fixed position layer."),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should it do return false instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think in this case, get_scroll_layer is guaranteed to never return a position: fixed layer, so the unreachable!() is probably correct here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep, @glennw is correct here.

Comment thread webrender/src/frame.rs
if overscroll_amount.width != 0.0 {
delta.x /= overscroll_amount.width.abs()
let mut scrolled_a_layer = false;
for (layer_id, layer) in self.layers.iter_mut() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can be rewritten as let scrolled_layer = match self.layers.find_mut(...) { Some(layer) => layer, None => return false };, followed by the code currently sitting in the for body. That would leave some code unchanged.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hrm. The issue here is that I want to scroll all layers that have the same scroll root id, instead of just the first one. Otherwise, perhaps I am misunderstanding your suggestion?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's fine as is - we'll land this as is, but feel free to file a follow up @kvark if we're misunderstanding what you mean.

@glennw glennw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good - just the one remaining comment / question from kvark then r=me.

Comment thread webrender/src/frame.rs
}
let scroll_root_id = match scroll_layer_id.info {
ScrollLayerInfo::Scrollable(_, scroll_root_id) => scroll_root_id,
ScrollLayerInfo::Fixed => unreachable!("Tried to scroll a fixed position layer."),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think in this case, get_scroll_layer is guaranteed to never return a position: fixed layer, so the unreachable!() is probably correct here.

Comment thread webrender/src/frame.rs
// their origin in the parent context.
let (transform, overflow) = if stacking_context.scroll_layer_id.is_none() {
(parent_info.layer_relative_transform.pre_translated(stacking_context.bounds.origin.x,
stacking_context.bounds.origin.y,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: indentation

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Okay. Will fix this one.

When we encounter a stacking context which scrolls its contents, we
treat it as a special non-stacking-context scrolling area. All
scrolling areas with the same servo scroll root id will be scrolled in
tandem. Later changes will give these fake stacking contexts their own
display item.
@glennw

glennw commented Nov 4, 2016

Copy link
Copy Markdown
Member

@mrobinson r=me - feel free to land when it suits you. Thanks!

@mrobinson

Copy link
Copy Markdown
Member Author

@bors-servo r=glennw

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit d1c2258 has been approved by glennw

@bors-servo

Copy link
Copy Markdown
Contributor

⚡ Test exempted - status

@bors-servo
bors-servo merged commit d1c2258 into servo:master Nov 4, 2016
bors-servo pushed a commit that referenced this pull request Nov 4, 2016
Support for non-stacking-context scrolling areas

When we encounter a stacking context which scrolls its contents, we
treat it as a special non-stacking-context scrolling area. All
scrolling areas with the same servo scroll root id will be scrolled in
tandem. Later changes will give these fake stacking contexts their own
display item.

<!-- 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/517)
<!-- Reviewable:end -->
@kvark

kvark commented Nov 4, 2016

Copy link
Copy Markdown
Member

This PR breaks some tests:

FAIL [expected PASS] /_mozilla/css/block_formatting_context_negative_margins_a.html
FAIL [expected PASS] /_mozilla/css/overflow_auto.html
FAIL [expected PASS] /_mozilla/css/overflow_scroll.html
FAIL [expected PASS] /_mozilla/css/textarea_space_calculation.html
FAIL [expected PASS] /_mozilla/css/transform_scroll_layer.html

wpt.log.zip

@mrobinson

Copy link
Copy Markdown
Member Author

The Servo half of this PR hasn't landed yet. It's currently at https://github.com/mrobinson/servo/tree/scroll_root_2. I'm doing some final testing and should have the PR posted today.

@mrobinson
mrobinson deleted the scroll_root branch November 5, 2016 09:01
@gterzian gterzian mentioned this pull request Nov 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants