Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Issue 147903002: CSS rem units should properly resolve on <body> (Closed)

Created:
6 years, 11 months ago by esprehn
Modified:
6 years, 10 months ago
Reviewers:
pdr., ojan, eseidel
CC:
blink-reviews, dglazkov+blink, sof, eae+blinkwatch, adamk+blink_chromium.org, Inactive
Visibility:
Public.

Description

CSS 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -8 lines) Patch
A LayoutTests/fast/css/rem-units-body.html View 1 chunk +29 lines, -0 lines 0 comments Download
A LayoutTests/fast/css/rem-units-body-expected.txt View 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/dom/Document.cpp View 1 chunk +12 lines, -0 lines 0 comments Download
M Source/core/dom/Element.cpp View 1 chunk +0 lines, -8 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
esprehn
6 years, 11 months ago (2014-01-26 12:59:46 UTC) #1
pdr.
On 2014/01/26 12:59:46, esprehn wrote: LGTM, nice change.
6 years, 10 months ago (2014-01-27 03:03:07 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/esprehn@chromium.org/147903002/1
6 years, 10 months ago (2014-01-27 03:36:32 UTC) #3
commit-bot: I haz the power
6 years, 10 months ago (2014-01-27 04:51:23 UTC) #4
Message was sent while issue was closed.
Change committed as 165831

Powered by Google App Engine
This is Rietveld 408576698