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

Issue 1038193002: Clear baseLayoutStyle when the font selector version has increased. (Closed)

Created:
5 years, 9 months ago by rune
Modified:
5 years, 9 months ago
Reviewers:
dstockwell, esprehn, eae
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-animation_chromium.org, blink-reviews-css, blink-reviews-style_chromium.org, Rik, danakj, dglazkov+blink, Dominik Röttsches, dshwang, krit, ed+blinkwatch_opera.com, Eric Willigers, f(malita), jbroman, Justin Novosad, Mike Lawther (Google), pdr+graphicswatchlist_chromium.org, rjwright, rwlbuis, Stephen Chennney, shans, Steve Block, Timothy Loh
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Clear baseLayoutStyle when the font selector version has increased. FontFaceCache has a version() member which is increased when we add fonts to the cache. It is used to detect if new fonts have been added to the cache after a LayoutStyle was calculated. Different version() numbers will make Font comparison fail and trigger relayout with new font data. When the font added to the cache is new to the style system, it is accompanied by a full document recalc. If we add a stylesheet with an @font-face rule, the @font-face will cause an addition to the font cache, and a document style recalc. So, if we have a "font-family:webfont,serif" where "webfont" does not match anything, we lay out with the serif "font". If we then add a stylesheet with an @font-face for "webfont", we need to re-layout with that new font even if the computed style for font-family doesn't change. That is triggered by the version number incremented by the addition of "webfont". This is all well until we add or remove a stylesheet which causes an analyzed stylesheet update where we get a Reconstruct. The StyleResolver will be recreated and font faces will be re-added, hence increasing the version number of the font cache. The analyzed stylesheet update is smart enough to avoid a full document recalc if it figures out that we did not really add or remove any @font-face rules, just re-adding the ones we had. We will then end up with a computed Font that was created for a different font cache version, but we figured out we didn't need to recompute the style or relayout since the font cache didn't really change with the increased version. If we are animating an element while such a reconstruct happen, we end up having a baseLayoutStyle for the animation which is based on an old font cache version. The LayoutStyle comparison ASSERT for baseLayoutStyle in ElementAnimations will trigger because the Font comparison will fail, since the version number for a newly created LayoutStyle Font will be different. To avoid that, we throw away the baseLayoutStyle after such a reconstruct happens, in which case the stored version in the FontFallbackList will not be in sync with the one stored in the FontFaceCache. The real bug here is that the version tagging/increment here is imprecise and not correlated with needsStyleRecalc. Removing an empty stylesheet like in the added test-case will cause any element to be re-layout the next time some other computed style change happen on that element as we detect that the version number is out of sync. I have reported crbug.com/471079 for that. There is a generation() in FontCache which is similar to version(), but increasing that will always trigger a full document recalc in StyleEngine::fontsNeedUpdate. R=esprehn@chromium.org,dstockwell@chromium.org,eae@chromium.org BUG=470458 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=192669

Patch Set 1 #

Total comments: 6

Patch Set 2 : Addressed review issues #

Unified diffs Side-by-side diffs Delta from patch set Stats (+72 lines, -5 lines) Patch
A LayoutTests/animations/base-render-style-font-selector-version-assert.html View 1 chunk +37 lines, -0 lines 0 comments Download
A LayoutTests/animations/base-render-style-font-selector-version-assert-expected.html View 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/animation/ElementAnimations.h View 1 1 chunk +1 line, -1 line 0 comments Download
M Source/core/animation/ElementAnimations.cpp View 1 1 chunk +11 lines, -0 lines 0 comments Download
M Source/platform/fonts/Font.h View 1 1 chunk +2 lines, -4 lines 0 comments Download
M Source/platform/fonts/Font.cpp View 1 1 chunk +10 lines, -0 lines 0 comments Download
M Source/platform/fonts/FontFallbackList.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M Source/platform/fonts/FontFallbackList.cpp View 1 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (2 generated)
rune
5 years, 9 months ago (2015-03-26 23:20:34 UTC) #1
eae
LGTM! This is great, love the detailed CL description and test!
5 years, 9 months ago (2015-03-26 23:26:32 UTC) #2
esprehn
Good find! https://codereview.chromium.org/1038193002/diff/1/Source/core/animation/ElementAnimations.cpp File Source/core/animation/ElementAnimations.cpp (right): https://codereview.chromium.org/1038193002/diff/1/Source/core/animation/ElementAnimations.cpp#newcode99 Source/core/animation/ElementAnimations.cpp:99: setAnimationStyleChange(false); This bit may be read in ...
5 years, 9 months ago (2015-03-26 23:28:16 UTC) #3
rune
https://codereview.chromium.org/1038193002/diff/1/Source/core/animation/ElementAnimations.cpp File Source/core/animation/ElementAnimations.cpp (right): https://codereview.chromium.org/1038193002/diff/1/Source/core/animation/ElementAnimations.cpp#newcode99 Source/core/animation/ElementAnimations.cpp:99: setAnimationStyleChange(false); On 2015/03/26 23:28:15, esprehn wrote: > This bit ...
5 years, 9 months ago (2015-03-27 07:14:22 UTC) #4
dstockwell
On 2015/03/27 at 07:14:22, rune wrote: > https://codereview.chromium.org/1038193002/diff/1/Source/core/animation/ElementAnimations.cpp > File Source/core/animation/ElementAnimations.cpp (right): > > https://codereview.chromium.org/1038193002/diff/1/Source/core/animation/ElementAnimations.cpp#newcode99 ...
5 years, 9 months ago (2015-03-27 07:36:11 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1038193002/20001
5 years, 9 months ago (2015-03-27 07:58:14 UTC) #8
commit-bot: I haz the power
5 years, 9 months ago (2015-03-27 11:26:43 UTC) #9
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=192669

Powered by Google App Engine
This is Rietveld 408576698