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

Changeset 276661 in webkit


Ignore:
Timestamp:
Apr 27, 2021, 2:07:04 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r274170. rdar://problem/77194450

REGRESSION (r273003): Animated style may lose original display property value
​https://bugs.webkit.org/show_bug.cgi?id=222979
rdar://75056684

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/animation/animation-display-style-adjustment.html

The original (non-blockified) display property value is saved in the beginning of Style::Adjuster::adjust.
It is needed to implement absolute positioning correctly in some situations. However with animations
the style adjustment code may run twice on the same style and the second run will clobber the saved original value.

  • rendering/RenderTheme.cpp: (WebCore::RenderTheme::adjustStyle):
  • rendering/style/RenderStyle.h: (WebCore::RenderStyle::setDisplay):

Always save the original value when setting the property normally.

(WebCore::RenderStyle::setEffectiveDisplay):
(WebCore::RenderStyle::setOriginalDisplay): Deleted.

Add setEffectiveDisplay that doesn't affect the original value for adjuster use.

  • style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjust const):

Remove the saving of the original value.
Use setEffectiveDisplay in all adjuster code, preserving the original value.

(WebCore::Style::Adjuster::adjustDisplayContentsStyle const):
(WebCore::Style::Adjuster::adjustSVGElementStyle):
(WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const):

LayoutTests:

  • fast/animation/animation-display-style-adjustment-expected.html: Added.
  • fast/animation/animation-display-style-adjustment.html: Added.

git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@274170 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-611-branch
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-611-branch/LayoutTests/ChangeLog

    r276402 r276661  
     12021-04-27  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r274170. rdar://problem/77194450
     4
     5    REGRESSION (r273003): Animated style may lose original display property value
     6    https://bugs.webkit.org/show_bug.cgi?id=222979
     7    rdar://75056684
     8   
     9    Reviewed by Zalan Bujtas.
     10   
     11    Source/WebCore:
     12   
     13    Test: fast/animation/animation-display-style-adjustment.html
     14   
     15    The original (non-blockified) display property value is saved in the beginning of Style::Adjuster::adjust.
     16    It is needed to implement absolute positioning correctly in some situations. However with animations
     17    the style adjustment code may run twice on the same style and the second run will clobber the saved original value.
     18   
     19    * rendering/RenderTheme.cpp:
     20    (WebCore::RenderTheme::adjustStyle):
     21    * rendering/style/RenderStyle.h:
     22    (WebCore::RenderStyle::setDisplay):
     23   
     24    Always save the original value when setting the property normally.
     25   
     26    (WebCore::RenderStyle::setEffectiveDisplay):
     27    (WebCore::RenderStyle::setOriginalDisplay): Deleted.
     28   
     29    Add setEffectiveDisplay that doesn't affect the original value for adjuster use.
     30   
     31    * style/StyleAdjuster.cpp:
     32    (WebCore::Style::Adjuster::adjust const):
     33   
     34    Remove the saving of the original value.
     35    Use setEffectiveDisplay in all adjuster code, preserving the original value.
     36   
     37    (WebCore::Style::Adjuster::adjustDisplayContentsStyle const):
     38    (WebCore::Style::Adjuster::adjustSVGElementStyle):
     39    (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const):
     40   
     41    LayoutTests:
     42   
     43    * fast/animation/animation-display-style-adjustment-expected.html: Added.
     44    * fast/animation/animation-display-style-adjustment.html: Added.
     45   
     46   
     47    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     48
     49    2021-03-09  Antti Koivisto  <antti@apple.com>
     50
     51            REGRESSION (r273003): Animated style may lose original display property value
     52            https://bugs.webkit.org/show_bug.cgi?id=222979
     53            rdar://75056684
     54
     55            Reviewed by Zalan Bujtas.
     56
     57            * fast/animation/animation-display-style-adjustment-expected.html: Added.
     58            * fast/animation/animation-display-style-adjustment.html: Added.
     59
    1602021-04-21  Ruben Turcios  <rubent_22@apple.com>
    261
  • branches/safari-611-branch/Source/WebCore/ChangeLog

    r276404 r276661  
     12021-04-27  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r274170. rdar://problem/77194450
     4
     5    REGRESSION (r273003): Animated style may lose original display property value
     6    https://bugs.webkit.org/show_bug.cgi?id=222979
     7    rdar://75056684
     8   
     9    Reviewed by Zalan Bujtas.
     10   
     11    Source/WebCore:
     12   
     13    Test: fast/animation/animation-display-style-adjustment.html
     14   
     15    The original (non-blockified) display property value is saved in the beginning of Style::Adjuster::adjust.
     16    It is needed to implement absolute positioning correctly in some situations. However with animations
     17    the style adjustment code may run twice on the same style and the second run will clobber the saved original value.
     18   
     19    * rendering/RenderTheme.cpp:
     20    (WebCore::RenderTheme::adjustStyle):
     21    * rendering/style/RenderStyle.h:
     22    (WebCore::RenderStyle::setDisplay):
     23   
     24    Always save the original value when setting the property normally.
     25   
     26    (WebCore::RenderStyle::setEffectiveDisplay):
     27    (WebCore::RenderStyle::setOriginalDisplay): Deleted.
     28   
     29    Add setEffectiveDisplay that doesn't affect the original value for adjuster use.
     30   
     31    * style/StyleAdjuster.cpp:
     32    (WebCore::Style::Adjuster::adjust const):
     33   
     34    Remove the saving of the original value.
     35    Use setEffectiveDisplay in all adjuster code, preserving the original value.
     36   
     37    (WebCore::Style::Adjuster::adjustDisplayContentsStyle const):
     38    (WebCore::Style::Adjuster::adjustSVGElementStyle):
     39    (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const):
     40   
     41    LayoutTests:
     42   
     43    * fast/animation/animation-display-style-adjustment-expected.html: Added.
     44    * fast/animation/animation-display-style-adjustment.html: Added.
     45   
     46   
     47    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274170 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     48
     49    2021-03-09  Antti Koivisto  <antti@apple.com>
     50
     51            REGRESSION (r273003): Animated style may lose original display property value
     52            https://bugs.webkit.org/show_bug.cgi?id=222979
     53            rdar://75056684
     54
     55            Reviewed by Zalan Bujtas.
     56
     57            Test: fast/animation/animation-display-style-adjustment.html
     58
     59            The original (non-blockified) display property value is saved in the beginning of Style::Adjuster::adjust.
     60            It is needed to implement absolute positioning correctly in some situations. However with animations
     61            the style adjustment code may run twice on the same style and the second run will clobber the saved original value.
     62
     63            * rendering/RenderTheme.cpp:
     64            (WebCore::RenderTheme::adjustStyle):
     65            * rendering/style/RenderStyle.h:
     66            (WebCore::RenderStyle::setDisplay):
     67
     68            Always save the original value when setting the property normally.
     69
     70            (WebCore::RenderStyle::setEffectiveDisplay):
     71            (WebCore::RenderStyle::setOriginalDisplay): Deleted.
     72
     73            Add setEffectiveDisplay that doesn't affect the original value for adjuster use.
     74
     75            * style/StyleAdjuster.cpp:
     76            (WebCore::Style::Adjuster::adjust const):
     77
     78            Remove the saving of the original value.
     79            Use setEffectiveDisplay in all adjuster code, preserving the original value.
     80
     81            (WebCore::Style::Adjuster::adjustDisplayContentsStyle const):
     82            (WebCore::Style::Adjuster::adjustSVGElementStyle):
     83            (WebCore::Style::Adjuster::adjustForSiteSpecificQuirks const):
     84
    1852021-04-21  Ruben Turcios  <rubent_22@apple.com>
    286
  • branches/safari-611-branch/Source/WebCore/rendering/RenderTheme.cpp

    r271021 r276661  
    8484        || style.display() == DisplayType::TableRow || style.display() == DisplayType::TableColumnGroup || style.display() == DisplayType::TableColumn
    8585        || style.display() == DisplayType::TableCell || style.display() == DisplayType::TableCaption)
    86         style.setDisplay(DisplayType::InlineBlock);
     86        style.setEffectiveDisplay(DisplayType::InlineBlock);
    8787    else if (style.display() == DisplayType::ListItem || style.display() == DisplayType::Table)
    88         style.setDisplay(DisplayType::Block);
     88        style.setEffectiveDisplay(DisplayType::Block);
    8989
    9090    if (userAgentAppearanceStyle && isControlStyled(style, *userAgentAppearanceStyle)) {
  • branches/safari-611-branch/Source/WebCore/rendering/style/RenderStyle.h

    r271200 r276661  
    836836// attribute setter methods
    837837
    838     void setDisplay(DisplayType v) { m_nonInheritedFlags.effectiveDisplay = static_cast<unsigned>(v); }
    839     void setOriginalDisplay(DisplayType v) { m_nonInheritedFlags.originalDisplay = static_cast<unsigned>(v); }
     838    void setDisplay(DisplayType value)
     839    {
     840        m_nonInheritedFlags.originalDisplay = static_cast<unsigned>(value);
     841        m_nonInheritedFlags.effectiveDisplay = m_nonInheritedFlags.originalDisplay;
     842    }
     843    void setEffectiveDisplay(DisplayType v) { m_nonInheritedFlags.effectiveDisplay = static_cast<unsigned>(v); }
    840844    void setPosition(PositionType v) { m_nonInheritedFlags.position = static_cast<unsigned>(v); }
    841845    void setFloating(Float v) { m_nonInheritedFlags.floating = static_cast<unsigned>(v); }
  • branches/safari-611-branch/Source/WebCore/style/StyleAdjuster.cpp

    r273458 r276661  
    244244void Adjuster::adjust(RenderStyle& style, const RenderStyle* userAgentAppearanceStyle) const
    245245{
    246     // Cache our original display.
    247     style.setOriginalDisplay(style.display());
    248 
    249246    if (style.display() == DisplayType::Contents)
    250247        adjustDisplayContentsStyle(style);
    … …  
    258255            if (m_document.inQuirksMode()) {
    259256                if (m_element->hasTagName(tdTag)) {
    260                     style.setDisplay(DisplayType::TableCell);
     257                    style.setEffectiveDisplay(DisplayType::TableCell);
    261258                    style.setFloating(Float::No);
    262259                } else if (is<HTMLTableElement>(*m_element))
    263                     style.setDisplay(style.isDisplayInlineType() ? DisplayType::InlineTable : DisplayType::Table);
     260                    style.setEffectiveDisplay(style.isDisplayInlineType() ? DisplayType::InlineTable : DisplayType::Table);
    264261            }
    265262
    … …  
    284281            if (m_element->hasTagName(frameTag) || m_element->hasTagName(framesetTag)) {
    285282                style.setPosition(PositionType::Static);
    286                 style.setDisplay(DisplayType::Block);
     283                style.setEffectiveDisplay(DisplayType::Block);
    287284            }
    288285
    … …  
    301298
    302299            if (m_element->hasTagName(legendTag))
    303                 style.setDisplay(DisplayType::Block);
     300                style.setEffectiveDisplay(DisplayType::Block);
    304301        }
    305302
    306303        // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display.
    307304        if (style.hasOutOfFlowPosition() || style.isFloating() || (m_element && m_document.documentElement() == m_element))
    308             style.setDisplay(equivalentBlockDisplay(style, m_document));
     305            style.setEffectiveDisplay(equivalentBlockDisplay(style, m_document));
    309306
    310307        // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely
    311308        // clear how that should work.
    312309        if (style.display() == DisplayType::Inline && style.styleType() == PseudoId::None && style.writingMode() != m_parentStyle.writingMode())
    313             style.setDisplay(DisplayType::InlineBlock);
     310            style.setEffectiveDisplay(DisplayType::InlineBlock);
    314311
    315312        // After performing the display mutation, check table rows. We do not honor position:relative or position:sticky on
    … …  
    338335        if (m_parentBoxStyle.isDisplayFlexibleOrGridBox()) {
    339336            style.setFloating(Float::No);
    340             style.setDisplay(equivalentBlockDisplay(style, m_document));
     337            style.setEffectiveDisplay(equivalentBlockDisplay(style, m_document));
    341338        }
    342339    }
    … …  
    545542    if (!m_element) {
    546543        if (style.styleType() != PseudoId::Before && style.styleType() != PseudoId::After)
    547             style.setDisplay(DisplayType::None);
     544            style.setEffectiveDisplay(DisplayType::None);
    548545        return;
    549546    }
    550547
    551548    if (m_document.documentElement() == m_element) {
    552         style.setDisplay(DisplayType::Block);
     549        style.setEffectiveDisplay(DisplayType::Block);
    553550        return;
    554551    }
    555552
    556553    if (hasEffectiveDisplayNoneForDisplayContents(*m_element))
    557         style.setDisplay(DisplayType::None);
     554        style.setEffectiveDisplay(DisplayType::None);
    558555}
    559556
    … …  
    572569    // SVG text layout code expects us to be a block-level style element.
    573570    if ((svgElement.hasTagName(SVGNames::foreignObjectTag) || svgElement.hasTagName(SVGNames::textTag)) && style.isDisplayInlineType())
    574         style.setDisplay(DisplayType::Block);
     571        style.setEffectiveDisplay(DisplayType::Block);
    575572}
    576573
    … …  
    631628                auto* video = div.treeScope().getElementById(videoElementID);
    632629                if (is<HTMLVideoElement>(video) && downcast<HTMLVideoElement>(*video).isFullscreen())
    633                     style.setDisplay(DisplayType::Block);
     630                    style.setEffectiveDisplay(DisplayType::Block);
    634631            }
    635632        }
Note: See TracChangeset for help on using the changeset viewer.