DescriptionCSS rem units should properly resolve on <body>
When we introduced Document::inheritHtmlAndBodyElementStyles in r157174
we made recalcStyle start calling into StyleResolver::styleForElement
on the body while the documentElement may have needed to reattach. This
would add the body's style to the matched property cache with rem units
resolved against a stale documentElement style (or the root style) and
then later inside Element::recalcOwnStyle we'd get the wrong value for
the <body>'s style since we'd pull the bad value back out of the cache.
This could manifest even before r157174 if you changed the font size of
the <html> element through script and also its display at the same time.
In that case we'd go down the attach path and never get to the font size
checks for the documentElement that were inside Element::recalcOwnStyle.
This patch moves the font size checks into inheritHtmlAndBodyElementStyles
and adds a case for when reattaching the documentElement. This is not
optimal since changing the display of the <html> element when using rem
units shouldn't need to clear the whole matched properties cache, but
reattaching the <html> element is also very rare so this is probably fine.
In the future we could track which elements are affected by rem units and
invalidate only those elements and clear only those cache entries like
we do for viewport units to improve upon this.
BUG=319623
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=165831
Patch Set 1 #
Messages
Total messages: 4 (0 generated)
|