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

Fragments aren't generated for inline elements containing no non-whitespace characters. #13982

Open
Permutatrix opened this issue Oct 29, 2016 · 7 comments · May be fixed by #18780
Open

Fragments aren't generated for inline elements containing no non-whitespace characters. #13982

Permutatrix opened this issue Oct 29, 2016 · 7 comments · May be fixed by #18780

Comments

@Permutatrix
Copy link
Contributor

@Permutatrix Permutatrix commented Oct 29, 2016

I ran into this problem while working on #12939, since process_offset_parent_query needs to find at least one fragment corresponding to an element in order to produce results. This can also have an effect on rendering, e.g.:

<span style="border: 1px solid black; padding: 12px; background-color: red;"></span>

In most browsers, that element looks like this:

a red box with a black border

In Servo, it isn't rendered and doesn't affect the layout.

I've got a fix for this already, though it introduces a couple more rendering bugs which I suppose I should fix as well before submitting a pull request.

@jdm jdm added the A-layout/inline label Oct 29, 2016
@Permutatrix
Copy link
Contributor Author

@Permutatrix Permutatrix commented Oct 29, 2016

@Permutatrix
Copy link
Contributor Author

@Permutatrix Permutatrix commented Nov 1, 2016

Alright, I'm only breaking two reftests now, and I don't think they're any of my business. I'm going to rebase and write one or more new tests, then I'll submit a pull request.

@Permutatrix
Copy link
Contributor Author

@Permutatrix Permutatrix commented Nov 1, 2016

Actually, I forgot to run test-css. Still breaking a bunch of reftests. It's late, so I'll look into it tomorrow.

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Jan 4, 2017

@Permutatrix Permutatrix mentioned this issue Jan 4, 2017
4 of 4 tasks complete
bors-servo added a commit that referenced this issue Jan 4, 2017
Make offset parent queries less buggy.

<!-- Please describe your changes on the following line: -->
Offset parent queries, which are used in the getters for HTMLElement's `offsetParent`, `offsetTop`, `offsetLeft`, `offsetWidth`, and `offsetHeight`, are pretty busted. The most egregious bug is that, as reported in #12939, inline elements are treated as if they're not present in the document. This PR fixes that and all of the other bugs I could trace directly to the offset parent query code, but `offsetTop` and `offsetLeft` are still terribly unreliable for reasons I haven't looked into (#13708). Inline elements with no content are still treated as not present due to #13982, so #13944 isn't fixed with this PR, either.

---
<!-- 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 #12939, #12595

<!-- Either: -->
- [X] There are tests for these changes

<!-- 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/14839)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jan 5, 2017
Make offset parent queries less buggy.

<!-- Please describe your changes on the following line: -->
Offset parent queries, which are used in the getters for HTMLElement's `offsetParent`, `offsetTop`, `offsetLeft`, `offsetWidth`, and `offsetHeight`, are pretty busted. The most egregious bug is that, as reported in #12939, inline elements are treated as if they're not present in the document. This PR fixes that and all of the other bugs I could trace directly to the offset parent query code, but `offsetTop` and `offsetLeft` are still terribly unreliable for reasons I haven't looked into (#13708). Inline elements with no content are still treated as not present due to #13982, so #13944 isn't fixed with this PR, either.

---
<!-- 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 #12939, #12595

<!-- Either: -->
- [X] There are tests for these changes

<!-- 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/14839)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jan 18, 2017
Make offset parent queries less buggy.

<!-- Please describe your changes on the following line: -->
Offset parent queries, which are used in the getters for HTMLElement's `offsetParent`, `offsetTop`, `offsetLeft`, `offsetWidth`, and `offsetHeight`, are pretty busted. The most egregious bug is that, as reported in #12939, inline elements are treated as if they're not present in the document. This PR fixes that and all of the other bugs I could trace directly to the offset parent query code, but `offsetTop` and `offsetLeft` are still unreliable in certain circumstances for reasons I haven't looked into (#13708). Inline elements with no content are still treated as not present due to #13982, so #13944 isn't fixed with this PR, either.

---
<!-- 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 #12939 and fix #12595

<!-- Either: -->
- [X] There are tests for these changes

<!-- 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/14839)
<!-- Reviewable:end -->
Permutatrix added a commit to Permutatrix/servo that referenced this issue Jun 3, 2017
@nox
Copy link
Member

@nox nox commented Oct 6, 2017

This still happens.

@Permutatrix
Copy link
Contributor Author

@Permutatrix Permutatrix commented Oct 6, 2017

I've still got that branch with a fix, but it's still breaking tests. I always mean to keep working on it. :P

Should I open a PR with [WIP], perhaps?

@nox
Copy link
Member

@nox nox commented Oct 7, 2017

@Permutatrix If you open a PR, people can help you fix the breaking tests. But it's up to you either way!

Permutatrix added a commit to Permutatrix/servo that referenced this issue Oct 7, 2017
@Permutatrix Permutatrix linked a pull request that will close this issue Oct 7, 2017
1 of 4 tasks complete
bors-servo added a commit that referenced this issue Oct 8, 2017
[WIP] Ensure every inline flow starts and ends with a text fragment.

<!-- Please describe your changes on the following line: -->
Not every inline flow begins or ends with actual text—they may begin or end with replaced elements, for instance, or they may contain nothing at all.

But for purposes of both rendering (e.g. rendering the inline-start and inline-end borders of an element) and queries (from scripts), it's sometimes important to know where an inline node begins and ends. The only way this can currently be determined in Servo's layout code is by finding the fragments with `InlineFragmentNodeInfo`s that correspond to said node and have the `FIRST_FRAGMENT_OF_ELEMENT` and `LAST_FRAGMENT_OF_ELEMENT` flags set. It's therefore important that fragments with these flags be generated.

This PR ensures that these fragments are generated. Unfortunately, the layout code currently depends on the _absence_ of these fragments for correctness in a number of cases, so making this change broke a lot of tests. I've fixed some of them, but there are still 20 or so that are broken. This PR is thus a work in progress and shouldn't be merged yet. It could also probably use some more comments in some places.

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

<!-- Either: -->
- [x] There are tests for these changes

<!-- 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/18780)
<!-- Reviewable:end -->
Permutatrix added a commit to Permutatrix/servo that referenced this issue Oct 12, 2017
Permutatrix added a commit to Permutatrix/servo that referenced this issue Oct 13, 2017
Permutatrix added a commit to Permutatrix/servo that referenced this issue Oct 18, 2017
Permutatrix added a commit to Permutatrix/servo that referenced this issue Dec 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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