-
Notifications
You must be signed in to change notification settings - Fork 279
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
Flatten the display list in the API #552
Conversation
@glennw r? |
The Servo part of this patch is here, which can be ready to go soon after this lands: https://github.com/mrobinson/servo/tree/display-list |
☔ The latest upstream changes (presumably #549) made this pull request unmergeable. Please resolve the merge conflicts. |
9263903
to
ccda8c1
Compare
@mrobinson Wow, this is awesome! Will review today :) |
@mrobinson I think you'll need to update the lockfiles, and potentially the callers in the other crates I guess, Travis is complaining :( |
@mrobinson I've had a reasonable look over this - it looks great! I ran all the WPT tests on it locally, and I get the failures below. Once those are fixed up we'll try to finish up the review and get it merged before it bitrots too badly.
|
@glennw Ack! Thanks for taking a look. I'll try to get the ref tests sorted today. Sorry for letting those slip by. |
ccda8c1
to
dadb5c0
Compare
@glennw Okay. Sorry for the failures. Things should be working now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about this area of WR, but the change looks good to me!
for item in &display_list.items { | ||
result.push(item.clone()); | ||
} | ||
match first_item.item { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could combine these matches into one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm. I was hoping to keep the nesting level a bit shallower to make it easier to read. Is there a way to do that while taking your suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really minor and doesn't need to be fixed! Could be done in a single match (like I specified in another comment), in nested matches, or even with and_then
construct:
self.first().and_then(|item| match item.item {...})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's a lot nicer! The latest version of the branch takes this suggestion.
@@ -190,6 +154,57 @@ impl StackingContextHelpers for StackingContext { | |||
} | |||
} | |||
|
|||
pub struct DisplayListTraversal<'a> { | |||
pub display_list: &'a Vec<DisplayItem>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these have to be public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a uber-nit: this can probably be &'a [DisplayItem]
to save an extra level of indirection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay!
|
||
pub fn current_stacking_context_empty(&self) -> bool { | ||
match self.peek() { | ||
Some(item) if item.item == SpecificDisplayItem::PopStackingContext => true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could do Some(item) => item.item == SpecificDisplayItem::PopStackingContext,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice. Done.
|
||
let iframe_scroll_layer_id = iframe_stacking_context.scroll_layer_id.unwrap(); | ||
self.layers.insert(iframe_scroll_layer_id, | ||
Layer::new(&iframe_rect, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: looks like the same layer as above, could clone()
it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I've made Layer derive from Clone and done this. It made things quite a bit simpler.
|
||
impl DisplayListHelpers for Vec<DisplayItem> { | ||
fn starting_stacking_context<'a>(&'a self) -> Option<&'a StackingContext> { | ||
let first_item = match self.first() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: same as the other implementation, could combine the two matches into one:
Some(SomethingSomething { item: SpecificDisplayItem::PushStackingContext(ref item), .. }) => ...
ffaa571
to
619f185
Compare
This changes brings the WebRender API more into line with the Servo display list and also the frames generated inside WebRender itself. Most intermediate display list representations are removed as well as their place on the resource cache. Perhaps most notably, stacking contexts are started via a PushStackingContext display item and ended via a PopStackingContext item. Additionally, the flatten pass has been significantly simplified to account for these changes.
619f185
to
3b139d2
Compare
@mrobinson r=me. I haven't merged this yet to minimize the amount of time that we have this merged in WR without the corresponding Servo PR. But feel free to merge this when the Servo PR is ready to go! |
@bors-servo r=glennw |
📌 Commit 3b139d2 has been approved by |
Flatten the display list in the API This changes brings the WebRender API more into line with the Servo display list and also the frames generated inside WebRender itself. Most intermediate display list representations are removed as well as their place on the resource cache. Perhaps most notably, stacking contexts are started via a PushStackingContext display item and ended via a PopStackingContext item. Additionally, the flatten pass has been significantly simplified to account for these changes. <!-- 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/552) <!-- Reviewable:end -->
@glennw Thanks. I'll get the Servo bit up ASAP. |
☀️ Test successful - status-travis |
This changes brings the WebRender API more into line with the Servo
display list and also the frames generated inside WebRender itself.
Most intermediate display list representations are removed as well as
their place on the resource cache. Perhaps most notably, stacking
contexts are started via a PushStackingContext display item and ended
via a PopStackingContext item. Additionally, the flatten pass has been
significantly simplified to account for these changes.
This change is