Detect body elements during layout#29699
Conversation
|
@bors-servo try=wpt |
Detect body elements during layout During layout it is often useful, for various specification reasons, to know if an element is the `<body>` element of an `<html>` element root. There are a couple places where a brittle heuristic is used to detect `<body>` elements. This information is going to be even more important to properly handle `<html>` elements that inherit their overflow property from their `<body>` children. Implementing this properly requires updating the DOM wrapper interface. This check does reach up to the parent of thread-safe nodes, but this is essentially the same kind of operation that `parent_style()` does, so is ostensibly safe. This change should not change any behavior and is just a preparation step for properly handle `<body>` overflow. <!-- 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 do not require tests because it does not change behavior. <!-- 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. -->
|
Test results for linux-wpt-layout-2013 from try job (#4858424004): Flaky unexpected result (16)
Stable unexpected results that are known to be intermittent (10)
Stable unexpected results (1)
|
|
💔 Test failed - checks-github |
5bafedd to
88d29a8
Compare
| } | ||
| } | ||
|
|
||
| impl<'dom, Node> Into<BaseFragmentInfo> for &NodeAndStyleInfo<Node> |
There was a problem hiding this comment.
The std doc recommends implementing From over Into. Just curious if we have made a deliberate choice to implement Into here.
There was a problem hiding this comment.
Great point I've converted this and the other Into implementation into From.
|
|
||
| impl Tag { | ||
| /// Create a new Tag for a non-pseudo element. This is mainly used for | ||
| /// matching existing tags, since it does not accept an `info` argument. |
There was a problem hiding this comment.
nit: Additional space at the beginning can be removed.
| } | ||
|
|
||
| /// Create a new Tag for a pseudo element. This is mainly used for | ||
| /// matching existing tags, since it does not accept an `info` argument. |
There was a problem hiding this comment.
nit: Additional space at the beginning can be removed.
During layout it is often useful, for various specification reasons, to know if an element is the `<body>` element of an `<html>` element root. There are a couple places where a brittle heuristic is used to detect `<body>` elements. This information is going to be even more important to properly handle `<html>` elements that inherit their overflow property from their `<body>` children. Implementing this properly requires updating the DOM wrapper interface. This check does reach up to the parent of thread-safe nodes, but this is essentially the same kind of operation that `parent_style()` does, so is ostensibly safe. This change should not change any behavior and is just a preparation step for properly handle `<body>` overflow.
88d29a8 to
72302e2
Compare
|
@bors-servo r+ |
|
📌 Commit 72302e2 has been approved by |
|
Test results for linux-wpt-layout-2013 from try job (#4881254848): Flaky unexpected result (19)
Stable unexpected results that are known to be intermittent (9)
|
|
☀️ Test successful - checks-github |
|
Test results for linux-wpt-layout-2020 from try job (#4885422084): Flaky unexpected result (1)
Stable unexpected results that are known to be intermittent (7)
Stable unexpected results (51)
|
|
Test results for linux-wpt-layout-2020 from try job (#4885767073): Flaky unexpected result (1)
Stable unexpected results that are known to be intermittent (7)
Stable unexpected results (51)
|
|
Test results for linux-wpt-layout-2020 from try job (#4890001583): Flaky unexpected result (2)Stable unexpected results that are known to be intermittent (7)
Stable unexpected results (51)
|
These structs used to be different when they were added in servo#29699: `BaseFragment` had a `debug_id` field, while `BaseFragmentInfo` didn't. But this field was later removed in servo#35001, so the structs became identical. Therefore, this just unified them. I'm picking `BaseFragmentInfo` as the name, since it was the most frequently used of the two. Signed-off-by: Oriol Brufau <[email protected]>
These structs used to be different when they were added in servo#29699: `BaseFragment` had a `debug_id` field, while `BaseFragmentInfo` didn't. But this field was later removed in servo#35001, so the structs became identical. Therefore, this just unified them. I'm picking `BaseFragmentInfo` as the name, since it was the most frequently used of the two. Signed-off-by: Oriol Brufau <[email protected]>
These structs used to be different when they were added in #29699: `BaseFragment` had a `debug_id` field, while `BaseFragmentInfo` didn't. But this field was later removed in #35001, so the structs became identical. Therefore, this patch just unifies them. I'm picking `BaseFragmentInfo` as the name, since it was the most frequently used of the two. Testing: Not needed, no change in behavior Signed-off-by: Oriol Brufau <[email protected]>
During layout it is often useful, for various specification reasons, to know if an element is the
<body>element of an<html>element root. There are a couple places where a brittle heuristic is used to detect<body>elements. This information is going to be even more important to properly handle<html>elements that inherit their overflow property from their<body>children.Implementing this properly requires updating the DOM wrapper interface. This check does reach up to the parent of thread-safe nodes, but this is essentially the same kind of operation that
parent_style()does, so is ostensibly safe.This change should not change any behavior and is just a preparation step for properly handle
<body>overflow../mach build -ddoes not report any errors./mach test-tidydoes not report any errors