Skip to content
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

Mix stacking contexts into the positioned content list #8266

Merged
merged 1 commit into from Nov 4, 2015

Conversation

@mrobinson
Copy link
Member

mrobinson commented Oct 30, 2015

Sometimes positioned content needs to be layered on top of stacking
contexts. The layer synthesis code can do this, but the current design
prevents it because stacking contexts are stored in a separate struct
member. In order to preserve tree order, mix stacking contexts into the
positioned content list, by adding a new StackingContextClass
DisplayItem. Such items do not have a base DisplayItem.

In some ways this simplifies the code, because we no longer have to
have a separate code path in the StackingContextLayerCreator.

Review on Reviewable

@mrobinson
Copy link
Member Author

mrobinson commented Oct 30, 2015

@pcwalton r?

This is the main prerequisite for eliminating LAYERS_NEEDED_FOR_DESCENDANTS.

@mrobinson mrobinson force-pushed the mrobinson:stacking-context-mix branch 2 times, most recently from 88b6ca2 to 5c63287 Nov 2, 2015
@mrobinson mrobinson force-pushed the mrobinson:stacking-context-mix branch from 5c63287 to 90a16a4 Nov 2, 2015
@@ -206,23 +204,31 @@ impl DisplayList {
/// inefficient and should only be used for debugging.
pub fn all_display_items(&self) -> Vec<DisplayItem> {
let mut result = Vec::new();
fn add_all_display_items_for_item(result: &mut Vec<DisplayItem>, item: &DisplayItem) {

This comment has been minimized.

Copy link
@pcwalton

pcwalton Nov 2, 2015

Contributor

Maybe just call this flatten? That's the terminology WR uses for a similar operation.


fn has_negative_z_index(&self) -> bool {
if let &DisplayItem::StackingContextClass(ref stacking_context) = self {
return stacking_context.z_index < 0

This comment has been minimized.

Copy link
@pcwalton

pcwalton Nov 2, 2015

Contributor

nit: No need for return

match paint_context.transient_clip {
Some(ref transient_clip) if transient_clip == this_clip => {}
Some(_) | None => paint_context.push_transient_clip((*this_clip).clone()),
fn draw_into_context(&self, transform: &Matrix4, paint_context: &mut PaintContext) {

This comment has been minimized.

Copy link
@pcwalton

pcwalton Nov 2, 2015

Contributor

Can you explain why transform is needed here now?

This comment has been minimized.

Copy link
@mrobinson

mrobinson Nov 2, 2015

Author Member

Sure. transform is necessary to properly draw StackingContexts, because it is used to calculate a new transform based on the StackingContexts bounds (display items are positioned relative to stacking contexts). Before StackingContexts were drawn outside of DisplayItem::draw_into_context (in DisplayList::draw_into_context). Now that StackingContexts can be DisplayItems it is moved here and the transform must be included in the case that this item is a StackingContext item.

@mrobinson mrobinson force-pushed the mrobinson:stacking-context-mix branch from 90a16a4 to a2acb2a Nov 2, 2015
@mrobinson
Copy link
Member Author

mrobinson commented Nov 2, 2015

@pcwalton Thanks, as always, for the review comments. I think I've made all the changes you suggested in the latest version of the branch. Do you see any other issues here?

gilles-leblanc referenced this pull request in gilles-leblanc/servo Nov 3, 2015
Adding overflow:hidden to an absolute positioned div will change it's
stacking order.

referencing servo#8122
@paulrouget
Copy link
Contributor

paulrouget commented Nov 3, 2015

Not sure if you want to address this issue in this PR or not, but for the record: #8310

@mrobinson mrobinson force-pushed the mrobinson:stacking-context-mix branch from a2acb2a to 5b3e953 Nov 3, 2015
@mrobinson
Copy link
Member Author

mrobinson commented Nov 3, 2015

@paulrouget Thanks for finding that issue! I've fixed it in the latest version. I had omitted some code that was removed.

@pcwalton
Copy link
Contributor

pcwalton commented Nov 3, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Nov 3, 2015

📌 Commit 5b3e953 has been approved by pcwalton

@pcwalton
Copy link
Contributor

pcwalton commented Nov 3, 2015

@bors-servo: r-

@mrobinson wants to add a test

@pcwalton
Copy link
Contributor

pcwalton commented Nov 3, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Nov 3, 2015

📌 Commit 5b3e953 has been approved by pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Nov 3, 2015

Testing commit 5b3e953 with merge 61ef78e...

bors-servo added a commit that referenced this pull request Nov 3, 2015
Mix stacking contexts into the positioned content list

Sometimes positioned content needs to be layered on top of stacking
contexts. The layer synthesis code can do this, but the current design
prevents it because stacking contexts are stored in a separate struct
member. In order to preserve tree order, mix stacking contexts into the
positioned content list, by adding a new StackingContextClass
DisplayItem. Such items do not have a base DisplayItem.

In some ways this simplifies the code, because we no longer have to
have a separate code path in the StackingContextLayerCreator.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8266)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 3, 2015

💔 Test failed - linux-rel

@mrobinson
Copy link
Member Author

mrobinson commented Nov 4, 2015

Looks like some tests are now passing with this change. I'll update the branch and reupload.

Sometimes positioned content needs to be layered on top of stacking
contexts. The layer synthesis code can do this, but the current design
prevents it because stacking contexts are stored in a separate struct
member. In order to preserve tree order, mix stacking contexts into the
positioned content list, by adding a new StackingContextClass
DisplayItem. Such items do not have a base DisplayItem.

In some ways this simplifies the code, because we no longer have to
have a separate code path in the StackingContextLayerCreator.

Fixes #7779.
Fixes #7983.
Fixes #8122.
Fixes #8310.
@mrobinson mrobinson force-pushed the mrobinson:stacking-context-mix branch from 5b3e953 to c1a38e2 Nov 4, 2015
@mrobinson
Copy link
Member Author

mrobinson commented Nov 4, 2015

@bors-servo: r=pcwalton

I confirmed with @pcwalton via IRC that he was okay with trying to land this again.

@bors-servo
Copy link
Contributor

bors-servo commented Nov 4, 2015

📌 Commit c1a38e2 has been approved by pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Nov 4, 2015

Testing commit c1a38e2 with merge 86e3add...

bors-servo added a commit that referenced this pull request Nov 4, 2015
Mix stacking contexts into the positioned content list

Sometimes positioned content needs to be layered on top of stacking
contexts. The layer synthesis code can do this, but the current design
prevents it because stacking contexts are stored in a separate struct
member. In order to preserve tree order, mix stacking contexts into the
positioned content list, by adding a new StackingContextClass
DisplayItem. Such items do not have a base DisplayItem.

In some ways this simplifies the code, because we no longer have to
have a separate code path in the StackingContextLayerCreator.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8266)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 4, 2015

@bors-servo bors-servo merged commit c1a38e2 into servo:master Nov 4, 2015
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@mrobinson mrobinson deleted the mrobinson:stacking-context-mix branch Nov 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.