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

Make perspective and transform Option types #945

Merged
merged 1 commit into from Mar 2, 2017

Conversation

@mrobinson
Copy link
Member

mrobinson commented Mar 1, 2017

CSS makes a distinction between an identity transform and an empty
transform. For instance, stacking contexts with identity
transformations still create what we call reference frames, which means
they serve as coordinates spaces for fixed position elements. This will
also help us to properly assign ScrollLayerIds during display list
construction if we want.


This change is Reviewable

stacking_context.perspective != LayoutTransform::identity() {
if stacking_context.transform.is_some() || stacking_context.perspective.is_some() {
let transform =
context.scene.properties.resolve_layout_transform(&stacking_context.transform);

This comment has been minimized.

@emilio

emilio Mar 1, 2017

Member

nit: I think usually Option<&T> is preferred, given it saves an indirection and gets optimized as a null pointer for the None case (you'd need to do stacking_context.transform.as_ref() here). That being said, I don't think it matters a lot here.

This comment has been minimized.

@mrobinson

mrobinson Mar 1, 2017

Author Member

@emilio Thanks for the tip. I think your suggestion makes a lot of sense.

@mrobinson mrobinson force-pushed the mrobinson:optional-transform-perspective branch from 63d4bc4 to a7ec6ce Mar 1, 2017
CSS makes a distinction between an identity transform and an empty
transform. For instance, stacking contexts with identity
transformations still create what we call reference frames, which means
they serve as coordinates spaces for fixed position elements. This will
also help us to properly assign ScrollLayerIds during display list
construction if we want.
@mrobinson mrobinson force-pushed the mrobinson:optional-transform-perspective branch from a7ec6ce to 9b703d9 Mar 1, 2017
@glennw
Copy link
Member

glennw commented Mar 1, 2017

@bors-servo r+

Nice! That was a much simpler change than I expected :)

@bors-servo
Copy link
Contributor

bors-servo commented Mar 1, 2017

📌 Commit 9b703d9 has been approved by glennw

@bors-servo
Copy link
Contributor

bors-servo commented Mar 2, 2017

Testing commit 9b703d9 with merge 1a52378...

bors-servo added a commit that referenced this pull request Mar 2, 2017
Make perspective and transform Option types

CSS makes a distinction between an identity transform and an empty
transform. For instance, stacking contexts with identity
transformations still create what we call reference frames, which means
they serve as coordinates spaces for fixed position elements. This will
also help us to properly assign ScrollLayerIds during display list
construction if we want.

<!-- 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/945)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 2, 2017

☀️ Test successful - status-travis
Approved by: glennw
Pushing 1a52378 to master...

@bors-servo bors-servo merged commit 9b703d9 into servo:master Mar 2, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@mrobinson mrobinson deleted the mrobinson:optional-transform-perspective branch Mar 2, 2017
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

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