Skip to content

Don't create empty stacking contexts in display lists - #26758

Merged
bors-servo merged 3 commits into
servo:masterfrom
jdm:stacking-context-transform-zero
Jun 9, 2020
Merged

bors-servo merged 3 commits into
servo:masterfrom
jdm:stacking-context-transform-zero

Conversation

@jdm

@jdm jdm commented Jun 2, 2020

Copy link
Copy Markdown
Member

A recent change to euclid exposed that our display lists can contain Rects that contain NaN values. These NaNs originate from creating stacking contexts with transforms that scale the horizontal or vertical dimensions to 0. WebRender isn't prepared to handle these, so we need to not produce these empty stacking contexts when building the display list.


@highfive

highfive commented Jun 2, 2020

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @emilio: components/layout/display_list/items.rs, components/layout/fragment.rs, components/layout/traversal.rs, components/layout/display_list/builder.rs, components/layout/inline.rs and 1 more

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 2, 2020
@jdm jdm changed the title Stacking context transform zero Don't create empty stacking contexts in display lists Jun 2, 2020
@jdm

jdm commented Jun 2, 2020

Copy link
Copy Markdown
Member Author

r? @mrobinson

@highfive highfive assigned mrobinson and unassigned ferjm Jun 2, 2020
@jdm

jdm commented Jun 2, 2020

Copy link
Copy Markdown
Member Author

@bors-servo try=wpt

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit cebfeaa with merge b3af7ac...

bors-servo added a commit that referenced this pull request Jun 2, 2020
Don't create empty stacking contexts in display lists

A recent change to euclid exposed that our display lists can contain Rects that contain NaN values. These NaNs originate from creating stacking contexts with transforms that scale the horizontal or vertical dimensions to 0. WebRender isn't prepared to handle these, so we need to not produce these empty stacking contexts when building the display list.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26592 and fix #26590
- [x] There are tests for these changes
@jdm

jdm commented Jun 2, 2020

Copy link
Copy Markdown
Member Author

@bors-servo retry try=wpt-2020

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit cebfeaa with merge bad44af...

bors-servo added a commit that referenced this pull request Jun 2, 2020
Don't create empty stacking contexts in display lists

A recent change to euclid exposed that our display lists can contain Rects that contain NaN values. These NaNs originate from creating stacking contexts with transforms that scale the horizontal or vertical dimensions to 0. WebRender isn't prepared to handle these, so we need to not produce these empty stacking contexts when building the display list.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26592 and fix #26590
- [x] There are tests for these changes
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - status-taskcluster

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-tests-failed The changes caused existing tests to fail. labels Jun 2, 2020
@jdm

jdm commented Jun 2, 2020

Copy link
Copy Markdown
Member Author

@bors-servo try=wpt-2020

bors-servo added a commit that referenced this pull request Jun 2, 2020
Don't create empty stacking contexts in display lists

A recent change to euclid exposed that our display lists can contain Rects that contain NaN values. These NaNs originate from creating stacking contexts with transforms that scale the horizontal or vertical dimensions to 0. WebRender isn't prepared to handle these, so we need to not produce these empty stacking contexts when building the display list.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26592 and fix #26590
- [x] There are tests for these changes
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 634d969 with merge 5693d3e...

@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - status-taskcluster

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Jun 2, 2020
@jdm
jdm force-pushed the stacking-context-transform-zero branch from 634d969 to bbfdf7e Compare June 2, 2020 22:44
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Jun 2, 2020
@jdm

jdm commented Jun 2, 2020

Copy link
Copy Markdown
Member Author

@bors-servo try=wpt-2020

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit bbfdf7e with merge c92251d...

bors-servo added a commit that referenced this pull request Jun 2, 2020
Don't create empty stacking contexts in display lists

A recent change to euclid exposed that our display lists can contain Rects that contain NaN values. These NaNs originate from creating stacking contexts with transforms that scale the horizontal or vertical dimensions to 0. WebRender isn't prepared to handle these, so we need to not produce these empty stacking contexts when building the display list.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26592 and fix #26590
- [x] There are tests for these changes
@jdm

jdm commented Jun 2, 2020

Copy link
Copy Markdown
Member Author

No need to review this yet. A lot of tests are failing that I need to investigate.

@jdm jdm changed the title Don't create empty stacking contexts in display lists [WIP] Don't create empty stacking contexts in display lists Jun 2, 2020
@jdm

jdm commented Jun 2, 2020

Copy link
Copy Markdown
Member Author

@bors-servo try=wpt

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit a18e04d with merge 9727003...

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 92bc291 with merge c9e5731...

@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - status-taskcluster
State: approved= try=True

@jdm
jdm force-pushed the stacking-context-transform-zero branch from 92bc291 to c7b91b8 Compare June 8, 2020 19:25
@jdm jdm changed the title [WIP] Don't create empty stacking contexts in display lists Don't create empty stacking contexts in display lists Jun 8, 2020
@jdm

jdm commented Jun 8, 2020

Copy link
Copy Markdown
Member Author

@mrobinson This PR is now ready for review.

@jdm
jdm force-pushed the stacking-context-transform-zero branch from c7b91b8 to a83cd7d Compare June 8, 2020 19:30

@mrobinson mrobinson 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.

Nice! I think there is one check that is redudant, but otherwise this looks correct.

Comment thread components/layout/fragment.rs Outdated
Comment on lines +2735 to +2738
let transform = self
.transform_matrix(&Rect::default())
.unwrap_or(LayoutTransform::identity());
!transform.is_invertible()

@mrobinson mrobinson Jun 9, 2020 •

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.

This could potentially be:

self.transform_matrix(&Rect::default())
    .map(|matrix| transform.is_invertible())
    .unwrap_or_else(false)

That would avoid creating an extra transformation matrix. Testing for invertability is sometimes expensive.

}

/// Returns true if the given style contains a transform that is not invertible.
pub(crate) fn has_non_invertible_transform(

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.

If you made this a method that took &self then I think you could avoid passing the style here.

}

fn build(&mut self, builder: &mut DisplayListBuilder) {
// If this box fragment has a transform applied that makes it take up no space,

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 you can omit this check here, since you will not be adding this fragment to the StackingContextTree.

@jdm
jdm force-pushed the stacking-context-transform-zero branch from a83cd7d to 93306ec Compare June 9, 2020 15:27
@jdm
jdm force-pushed the stacking-context-transform-zero branch from 93306ec to 2a83b80 Compare June 9, 2020 15:30
@jdm

jdm commented Jun 9, 2020

Copy link
Copy Markdown
Member Author

@bors-servo r=mrobinson

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 2a83b80 has been approved by mrobinson

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 9, 2020
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 2a83b80 with merge 45947f7...

bors-servo added a commit that referenced this pull request Jun 9, 2020
Don't create empty stacking contexts in display lists

A recent change to euclid exposed that our display lists can contain Rects that contain NaN values. These NaNs originate from creating stacking contexts with transforms that scale the horizontal or vertical dimensions to 0. WebRender isn't prepared to handle these, so we need to not produce these empty stacking contexts when building the display list.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26592 and fix #26590
- [x] There are tests for these changes
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - status-taskcluster

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jun 9, 2020
@jdm

jdm commented Jun 9, 2020

Copy link
Copy Markdown
Member Author

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 2a83b80 with merge cb4e3cb...

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Jun 9, 2020
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - status-taskcluster
Approved by: mrobinson
Pushing cb4e3cb to master...

@bors-servo
bors-servo merged commit cb4e3cb into servo:master Jun 9, 2020
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants