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

Inline pseudo elements layout#12367 #12669

Merged
merged 4 commits into from Aug 11, 2016

Conversation

@splav
Copy link
Contributor

splav commented Jul 31, 2016

This PR fixes ignored paddings and margins for inline pseudo elements.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #12367 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@splav
Copy link
Contributor Author

splav commented Jul 31, 2016

This is a first version, another part is missing - in the following case the green zone is calculated incorrectly and a line is broken:

<!DOCTYPE html>
<html><head><style type="text/css">
  span:before {
    content:"a";
    margin-right:5em;
  }
  span:after {
    content:"c";
    margin-left:5em;
  }
  span {
    margin-left:4em;
    margin-right:4em;
  }
</style></head>
<body><div style="position: absolute; top: 20px;"><span>b</span></div></body>
</html>
@wafflespeanut
Copy link
Member

wafflespeanut commented Jul 31, 2016

r? @mbrubeck or someone else

@highfive highfive assigned mbrubeck and unassigned wafflespeanut Jul 31, 2016
@jdm
Copy link
Member

jdm commented Jul 31, 2016

Want to review this, @notriddle?

@notriddle
Copy link
Contributor

notriddle commented Jul 31, 2016

Yeah, that sounds like something I could help with.

@KiChjang
Copy link
Member

KiChjang commented Jul 31, 2016

@bors-servo delegate=notriddle

r? @notriddle

@bors-servo
Copy link
Contributor

bors-servo commented Jul 31, 2016

✌️ @notriddle can now approve this pull request

@highfive highfive assigned notriddle and unassigned mbrubeck Jul 31, 2016
@splav
Copy link
Contributor Author

splav commented Jul 31, 2016

@notriddle may be change to something like this:

<style type="text/css">
  span:before { content:"a"; margin-right:5em; }
  span:after { content:"c"; margin-left:5em; }
  #first { margin-left:4em; margin-right:4em; }
  #second:before { margin-left:4em; }
  #second:after { margin-right:4em; }
</style>
<body>
    |<span id=first>b</span>|<br>
    |<span id=second>b</span>|
</body>

and

<style type="text/css">
  span:before { content:"a"; padding-right:5em; }
  span:after { content:"c"; padding-left:5em; }
  #first { padding-left:4em; padding-right:4em; }
  #second:before { padding-left:4em; }
  #second:after { padding-right:4em; }
</style>

<body>
    |<span id=first>b</span>|<br>
    |<span id=second>b</span>|
</body>

Could you please comment if the main idea of the fix is correct? I'm not very sure that both style-fixing functions can be just skipped for pseudo elements. I've read the specs and couldn't imagine the appropriate cases, but I didn't have much experience with CSS and could miss something.

@notriddle
Copy link
Contributor

notriddle commented Jul 31, 2016

The modified version of the test looks good.

The big problem that the modify function tries to solve is that the style of the base element is copied verbatim to the pseudo-element. I think that was actually fixed in the style code awhile back. Let's try it.

@bors-servo try

@bors-servo
Copy link
Contributor

bors-servo commented Jul 31, 2016

Trying commit 8c8f5dd with merge 718cbfd...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 31, 2016

💔 Test failed - mac-rel-css

@highfive
Copy link

highfive commented Jul 31, 2016

  ▶ FAIL [expected PASS] /css21_dev/html4/insert-inline-in-blocks-n-inlines-begin-003.htm
  └   → /css21_dev/html4/insert-inline-in-blocks-n-inlines-begin-003.htm daa5c6726760140eb39cfd0ef842bc0a337bd0d6
/css21_dev/html4/reference/insert-inline-in-blocks-n-inlines-begin-003-ref.htm 11aaba585e29d82ac7512d6f646fa3a6962167f8
Testing daa5c6726760140eb39cfd0ef842bc0a337bd0d6 == 11aaba585e29d82ac7512d6f646fa3a6962167f8

  ▶ FAIL [expected PASS] /css21_dev/html4/insert-inline-in-blocks-n-inlines-middle-003.htm
  └   → /css21_dev/html4/insert-inline-in-blocks-n-inlines-middle-003.htm 84814dc899e920095373d52c0a0cca063929bce7
/css21_dev/html4/reference/insert-inline-in-blocks-n-inlines-middle-003-ref.htm 021252e76c13ae9d890</span><span class="stdout">677f08d3b957f46be4c3f
Testing 84814dc899e920095373d52c0a0cca063929bce7 == 021252e76c13ae9d890677f08d3b957f46be4c3f

  ▶ Unexpected subtest result in /css-transitions-1_dev/html/pseudo-elements-001.htm:
  └ PASS [expected FAIL] transition padding-left on :before, changing content / values

  ▶ Unexpected subtest result in /css-transitions-1_dev/html/pseudo-elements-001.htm:
  └ PASS [expected FAIL] transition padding-left on :after, changing content / values

  ▶ Unexpected subtest result in /css21_dev/html4/pseudo-elements-001.htm:
  └ PASS [expected FAIL] transition padding-left on :before, changing content / values

  ▶ Unexpected subtest result in /css21_dev/html4/pseudo-elements-001.htm:
  └ PASS [expected FAIL] transition padding-left on :after, changing content / values
@notriddle
Copy link
Contributor

notriddle commented Aug 1, 2016

The passes look good, since they're part of your PR. I'm not sure about the failures, because there aren't any pseudo elements in either of those tests to trigger your code changes.

@notriddle
Copy link
Contributor

notriddle commented Aug 1, 2016

Reverting c1243fe, the one that prevents text fragments from being merged, fixes the test failures. Reverting f787f3a, the one that stops pseudo-element styles from being reset, does not. (I ran the failing tests on my box to check them.)

So turning off the style reset didn't cause any tests to fail, and it makes sense that we need to store the style of the pseudo-elements somewhere, since they're not going to get their own flows, so let's put it in the fragments.

@splav
Copy link
Contributor Author

splav commented Aug 1, 2016

@notriddle OK, thank you. I'll investigate what's going on in failed tests. And also in the case with absolutely positioned div, I've posted before.

@notriddle
Copy link
Contributor

notriddle commented Aug 9, 2016

@bors-servo retry

Let's see how #12760 affected the test results.

@bors-servo
Copy link
Contributor

bors-servo commented Aug 9, 2016

Trying commit 8c8f5dd with merge 68096b8...

bors-servo added a commit that referenced this pull request Aug 9, 2016
…try>

Inline pseudo elements layout#12367

<!-- Please describe your changes on the following line: -->
This PR fixes ignored paddings and margins for inline pseudo elements.
---
<!-- 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 #12367 (github issue number if applicable).

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

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

bors-servo commented Aug 9, 2016

💔 Test failed - mac-rel-css

@splav splav force-pushed the splav:inline_pseudo_elements_layout#12367 branch from 8c8f5dd to d3ccbc5 Aug 9, 2016
@highfive highfive removed the S-tests-failed label Aug 9, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Aug 10, 2016

Testing commit d3ccbc5 with merge 4ca4c7c...

bors-servo added a commit that referenced this pull request Aug 10, 2016
…otriddle

Inline pseudo elements layout#12367

<!-- Please describe your changes on the following line: -->
This PR fixes ignored paddings and margins for inline pseudo elements.

---
<!-- 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 #12367 (github issue number if applicable).

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

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

bors-servo commented Aug 10, 2016

💔 Test failed - linux-rel

@highfive
Copy link

highfive commented Aug 10, 2016

  ▶ FAIL [expected PASS] /css-transforms-1_dev/html/transform-table-007.htm
  └   → /css-transforms-1_dev/html/transform-table-007.htm a5c014b20ef1363bea6f24eda28c7efb7c45698a
/css-transforms-1_dev/html/reference/transform-blank-ref.htm fa6407b1acbbfea27e27061e7d1bdeca98e4a728
Testing a5c014b20ef1363bea6f24eda28c7efb7c45698a == fa6407b1acbbfea27e27061e7d1bdeca98e4a728
@bors-servo
Copy link
Contributor

bors-servo commented Aug 11, 2016

The latest upstream changes (presumably #12757) made this pull request unmergeable. Please resolve the merge conflicts.

@splav splav force-pushed the splav:inline_pseudo_elements_layout#12367 branch from d3ccbc5 to a9c1817 Aug 11, 2016
@splav
Copy link
Contributor Author

splav commented Aug 11, 2016

@jdm rebased to current master.

@notriddle
Copy link
Contributor

notriddle commented Aug 11, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Aug 11, 2016

📌 Commit a9c1817 has been approved by notriddle

@bors-servo
Copy link
Contributor

bors-servo commented Aug 11, 2016

Testing commit a9c1817 with merge 9ffda4c...

bors-servo added a commit that referenced this pull request Aug 11, 2016
…otriddle

Inline pseudo elements layout#12367

<!-- Please describe your changes on the following line: -->
This PR fixes ignored paddings and margins for inline pseudo elements.

---
<!-- 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 #12367 (github issue number if applicable).

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

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

bors-servo commented Aug 11, 2016

@bors-servo bors-servo merged commit a9c1817 into servo:master Aug 11, 2016
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
@splav splav deleted the splav:inline_pseudo_elements_layout#12367 branch Aug 11, 2016
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.

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