mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
style: Container units should prevent us from sharing style by rule node
At least when the containers are different. For now check that by doing a somewhat simplified test (checking sibling-ness). The new flag can be useful to optimize container query restyles on resizes too, in the future. Differential Revision: https://phabricator.services.mozilla.com/D179268
This commit is contained in:
parent
07d6ec5d4b
commit
50d7f882dd
3 changed files with 21 additions and 2 deletions
|
@ -877,10 +877,21 @@ impl<E: TElement> StyleSharingCache<E> {
|
|||
// NOTE(emilio): We only need to check name / namespace because we
|
||||
// do name-dependent style adjustments, like the display: contents
|
||||
// to display: none adjustment.
|
||||
if target.namespace() != candidate.element.namespace() {
|
||||
if target.namespace() != candidate.element.namespace() ||
|
||||
target.local_name() != candidate.element.local_name()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
if target.local_name() != candidate.element.local_name() {
|
||||
// When using container units, inherited style + rules matched aren't enough to
|
||||
// determine whether the style is the same. We could actually do a full container
|
||||
// lookup but for now we just check that our actual traversal parent matches.
|
||||
if data
|
||||
.styles
|
||||
.primary()
|
||||
.flags
|
||||
.intersects(ComputedValueFlags::USES_CONTAINER_UNITS) &&
|
||||
candidate.element.traversal_parent() != target.traversal_parent()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
// Rule nodes and styles are computed independent of the element's actual visitedness,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue