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

Elements with transformations are not considered containing blocks for absolute position elements #18091

Closed
mrobinson opened this issue Aug 15, 2017 · 2 comments · Fixed by #18123
Assignees

Comments

@mrobinson
Copy link
Member

mrobinson commented Aug 15, 2017

Consider the following test case:

<style>
  div {
    height: 200px;
    width: 200px;
  }
</style>
<div style="position: relative; background: red;">
  <div style="transform: translateX(-100px);">
    <div style="position: absolute; right: -100px; background: green;">
    </div>
  </div>
</div>

The transformed div should be the containing block for the innermost absolutely positioned element, but it isn't. This leads to a mispositioning of the green div -8 pixels on the x axis. The -8 pixels is the amount that would normally move the div relative to the viewport, but instead it should be relative to the transformed div and have no offset at all on the x axis.

@mrobinson mrobinson self-assigned this Aug 15, 2017
@mrobinson
Copy link
Member Author

cc @pcwalton @kvark

@mrobinson mrobinson changed the title Elements with transformations are not considered containing blocks for absolute and fixed position elements Elements with transformations are not considered containing blocks for absolute position elements Aug 17, 2017
@mrobinson
Copy link
Member Author

I split out the issue with fixed position elements to #18122, because it will require a more extensive and completely different fix than for absolute blocks.

mrobinson added a commit to mrobinson/servo that referenced this issue Aug 17, 2017
Instead of only promoting flows with positioned fragments to containing
blocks, also do this for flows which have the transform, perspective or
filter properties set. This is what the spec requires and also fixes
some failing tests. It will allow us to stop creating stacking contexts
for overflow:hidden and overflow:scroll flows.

Fixes servo#18091.
mrobinson added a commit to mrobinson/servo that referenced this issue Aug 17, 2017
Instead of only promoting flows with positioned fragments to containing
blocks, also do this for flows which have the transform, perspective or
filter properties set. This is what the spec requires and also fixes
some failing tests. It will allow us to stop creating stacking contexts
for overflow:hidden and overflow:scroll flows.

Fixes servo#18091.
mrobinson added a commit to mrobinson/servo that referenced this issue Aug 17, 2017
Instead of only promoting flows with positioned fragments to containing
blocks, also do this for flows which have the transform, perspective or
filter properties set. This is what the spec requires and also fixes
some failing tests. It will allow us to stop creating stacking contexts
for overflow:hidden and overflow:scroll flows.

Fixes servo#18091.
bors-servo pushed a commit that referenced this issue Aug 18, 2017
Improve containing block creation for position:absolute flows

Instead of only promoting flows with positioned fragments to containing
blocks, also do this for flows which have the transform, perspective or
filter properties set. This is what the spec requires and also fixes
some failing tests. It will allow us to stop creating stacking contexts
for overflow:hidden and overflow:scroll flows.

Fixes #18091.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #18091  (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18123)
<!-- Reviewable:end -->
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 a pull request may close this issue.

1 participant