Style invalidation doesn't work for content: attr() when set from a custom property |
||||||
Issue descriptionWhat steps will reproduce the problem? (1) Load the attached test-case. What is the expected result? Should see `Foo` and `Bar` cycling on the screen each second. What happens instead? Only Foo appears, and style is never updated again. This is for the way invalidations are collected for attr() blocks during parsing. This works on Gecko, by making the generated content listen to attribute changes, not relying on the style invalidation machinery (see http://searchfox.org/mozilla-central/rev/8efd128b48cdae3a6c6862795ce618aa1ca1c0b4/dom/base/nsTextNode.cpp#31).
,
Oct 9 2017
,
Oct 9 2017
Hi, this is broken on Stable without lazy parsing turned on. To confirm, lazy parsing isn't causing a regression here right?
,
Oct 9 2017
Without having actually checked, I'm pretty sure lazy-parsing is not the issue here.
,
Oct 9 2017
So we need to actually cascade and resolve variables to know which attributes need a LocalStyleChange due to content: attr(). LocalStyleChange is normally not a heavy operation. The presence of attr() in a custom property and. On a second thought, we can do the whole attribute for content invalidation differently, and potentially more targeted as well. The only time we need to invalidate for attribute changes in that case is when all these are true: 1. We already have generated ::before or ::after content on a given element. 2. Some of the ::before or ::after content was generated by attr(). 3. An attribute referenced by attr() was changed on the element generating ::before or ::after. Currently we set invalidates-self on the attribute invalidation set. That means we'll get LocalStyleChange on every element where that attribute is changed, even if that element does not generate ::before/:after. Instead, we could simply always do LocalStyleChange on an element which has an attribute change when 1 and 2 above is true. Actually, it should be enough to have a LocalStyleChange on the ::before and ::after elements (I don't remember exactly how that works today with LocalStyleChange on the generating element). If it wasn't clear in the section above this suggests that we don't update attribute invalidation sets from attr() values.
,
Oct 9 2017
Reading through this and came across a potentially unfinished sentence: "The presence of attr() in a custom property and.<insert missing text?>"
,
Oct 9 2017
Oops. Something like: The presence of attr() in a custom property and a custom property reference in a content declaration may cause the need for a LocalStyleChange when an attr changes. We'd need to potentially inherit custom properties down the tree to know which attribute change may cause the need for invalidation. Doing this properly looks complicated.
,
Oct 30 2017
,
Oct 31 2017
,
Dec 6 2017
,
Aug 21
,
Aug 21
An alternative solution is to mark pseudo elements which generate content from attr() functions with a flag and do a kLocalStyleChange for the pseudo element for any attribute changes on the originating element. Currently, we would do a kLocalStyleChange on the originating element on "attr" changes on any element if at least one used style rule has a content:attr(attr). |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by emilio@chromium.org
, Oct 6 2017