⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269384 in webkit


Ignore:
Timestamp:
Nov 4, 2020, 2:04:58 PM (6 years ago)
Author:
Antti Koivisto
Message:

REGRESSION (r257839): Miscomputed style due to computed 'rem' value in matched declaration cache
https://bugs.webkit.org/show_bug.cgi?id=218561
<rdar://problem/70074191>

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/dom/focus-rem-style-update.html

Call to focus() causes computed style update for the element’s ancestor chain before the the document
has otherwise been styled (using the shortcut mechanism introduced in r257839). This style, which uses ‘rem’
unit and so depends on root element font size, gets cached in MatchedDeclarationsCache. The root font size
then changes but during the resulting style update we use this cached value, failing to re-resolve ‘rem’.

  • style/StyleTreeResolver.cpp:

(WebCore::Style::TreeResolver::resolveElement):

Invalidate matched declarations cache also when there is no existing document element style.

LayoutTests:

  • fast/dom/focus-rem-style-update-expected.html: Added.
  • fast/dom/focus-rem-style-update.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269383 r269384  
     12020-11-04  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r257839): Miscomputed style due to computed 'rem' value in matched declaration cache
     4        https://bugs.webkit.org/show_bug.cgi?id=218561
     5        <rdar://problem/70074191>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        * fast/dom/focus-rem-style-update-expected.html: Added.
     10        * fast/dom/focus-rem-style-update.html: Added.
     11
    1122020-11-04  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r269383 r269384  
     12020-11-04  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r257839): Miscomputed style due to computed 'rem' value in matched declaration cache
     4        https://bugs.webkit.org/show_bug.cgi?id=218561
     5        <rdar://problem/70074191>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Test: fast/dom/focus-rem-style-update.html
     10
     11        Call to focus() causes computed style update for the element’s ancestor chain before the the document
     12        has otherwise been styled (using the shortcut mechanism introduced in r257839). This style, which uses ‘rem’
     13        unit and so depends on root element font size, gets cached in MatchedDeclarationsCache. The root font size
     14        then changes but during the resulting style update we use this cached value, failing to re-resolve ‘rem’.
     15
     16        * style/StyleTreeResolver.cpp:
     17        (WebCore::Style::TreeResolver::resolveElement):
     18
     19        Invalidate matched declarations cache also when there is no existing document element style.
     20
    1212020-11-04  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/style/StyleTreeResolver.cpp

    r268932 r269384  
    225225        scope().resolver.setOverrideDocumentElementStyle(m_documentElementStyle.get());
    226226
    227         if (update.change != Change::None && existingStyle && existingStyle->computedFontPixelSize() != update.style->computedFontPixelSize()) {
     227        if (!existingStyle || existingStyle->computedFontPixelSize() != update.style->computedFontPixelSize()) {
    228228            // "rem" units are relative to the document element's font size so we need to recompute everything.
    229             // In practice this is rare.
    230229            scope().resolver.invalidateMatchedDeclarationsCache();
    231230            descendantsToResolve = DescendantsToResolve::All;
Note: See TracChangeset for help on using the changeset viewer.