Changeset 291260 in webkit


Ignore:
Timestamp:
Mar 14, 2022 6:48:15 PM (4 months ago)
Author:
Oriol Brufau
Message:

[css-cascade] Fix 'revert' on low-priority properties
https://bugs.webkit.org/show_bug.cgi?id=236272

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Add one test and expect an existing one to pass.

  • web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt:
  • web-platform-tests/css/css-cascade/all-prop-revert-noop-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt.
  • web-platform-tests/css/css-cascade/all-prop-revert-noop.html: Added.

Source/WebCore:

Some CSS properties are low-priority (a.k.a deferred or applied in parse
order). The logic for the 'revert' keyword was not taking these into
account, so it just behaved as 'unset'.
That made elements like <del>, <ins>, <s> and <u> lose the line-through
or underline thet they get in UA origin, when styled with 'all: revert'
or 'text-decoration: revert'.

This patch takes these properties into account so that 'revert' works.

Tests: imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html

imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop.html

  • style/PropertyCascade.cpp:

(WebCore::Style::PropertyCascade::setDeferred):

  • style/PropertyCascade.h:

(WebCore::Style::PropertyCascade::hasDeferredProperty const):
(WebCore::Style::PropertyCascade::deferredProperty const):

  • style/StyleBuilder.cpp:

(WebCore::Style::Builder::applyProperty):

Location:
trunk
Files:
1 added
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r291228 r291260  
     12022-03-14  Oriol Brufau  <obrufau@igalia.com>
     2
     3        [css-cascade] Fix 'revert' on low-priority properties
     4        https://bugs.webkit.org/show_bug.cgi?id=236272
     5
     6        Reviewed by Darin Adler.
     7
     8        Add one test and expect an existing one to pass.
     9
     10        * web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt:
     11        * web-platform-tests/css/css-cascade/all-prop-revert-noop-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt.
     12        * web-platform-tests/css/css-cascade/all-prop-revert-noop.html: Added.
     13
    1142022-03-14  Antoine Quint  <graouts@webkit.org>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop-expected.txt

    r290864 r291260  
    2424PASS datalist
    2525PASS dd
    26 FAIL del assert_equals: text-decoration expected "line-through" but got "none"
     26PASS del
    2727PASS details
    2828PASS dfn
     
    5252PASS img
    5353PASS input
    54 FAIL ins assert_equals: text-decoration expected "underline" but got "none"
     54PASS ins
    5555PASS kbd
    5656PASS label
     
    8080PASS rt
    8181PASS ruby
    82 FAIL s assert_equals: text-decoration expected "line-through" but got "none"
     82PASS s
    8383PASS samp
    8484PASS script
     
    107107PASS tr
    108108PASS track
    109 FAIL u assert_equals: text-decoration expected "underline" but got "none"
     109PASS u
    110110PASS ul
    111111PASS var
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop-expected.txt

    r291259 r291260  
    2424PASS datalist
    2525PASS dd
    26 FAIL del assert_equals: text-decoration expected "line-through" but got "none"
     26PASS del
    2727PASS details
    2828PASS dfn
     
    5252PASS img
    5353PASS input
    54 FAIL ins assert_equals: text-decoration expected "underline" but got "none"
     54PASS ins
    5555PASS kbd
    5656PASS label
     
    8080PASS rt
    8181PASS ruby
    82 FAIL s assert_equals: text-decoration expected "line-through" but got "none"
     82PASS s
    8383PASS samp
    8484PASS script
     
    107107PASS tr
    108108PASS track
    109 FAIL u assert_equals: text-decoration expected "underline" but got "none"
     109PASS u
    110110PASS ul
    111111PASS var
  • trunk/Source/WebCore/ChangeLog

    r291259 r291260  
     12022-03-14  Oriol Brufau  <obrufau@igalia.com>
     2
     3        [css-cascade] Fix 'revert' on low-priority properties
     4        https://bugs.webkit.org/show_bug.cgi?id=236272
     5
     6        Reviewed by Darin Adler.
     7
     8        Some CSS properties are low-priority (a.k.a deferred or applied in parse
     9        order). The logic for the 'revert' keyword was not taking these into
     10        account, so it just behaved as 'unset'.
     11        That made elements like <del>, <ins>, <s> and <u> lose the line-through
     12        or underline thet they get in UA origin, when styled with 'all: revert'
     13        or 'text-decoration: revert'.
     14
     15        This patch takes these properties into account so that 'revert' works.
     16
     17        Tests: imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-noop.html
     18               imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-noop.html
     19
     20        * style/PropertyCascade.cpp:
     21        (WebCore::Style::PropertyCascade::setDeferred):
     22        * style/PropertyCascade.h:
     23        (WebCore::Style::PropertyCascade::hasDeferredProperty const):
     24        (WebCore::Style::PropertyCascade::deferredProperty const):
     25        * style/StyleBuilder.cpp:
     26        (WebCore::Style::Builder::applyProperty):
     27
    1282022-03-14  Eric Carlson  <eric.carlson@apple.com>
    229
  • trunk/Source/WebCore/style/PropertyCascade.cpp

    r287018 r291260  
    174174    memset(property.cssValue, 0, sizeof(property.cssValue));
    175175    setPropertyInternal(property, id, cssValue, matchedProperties, cascadeLevel);
     176    m_deferredPropertiesIndices.set(id, m_deferredProperties.size());
    176177    m_deferredProperties.append(property);
    177178}
  • trunk/Source/WebCore/style/PropertyCascade.h

    r287018 r291260  
    6363    const Property& property(CSSPropertyID) const;
    6464
     65    bool hasDeferredProperty(CSSPropertyID) const;
     66    const Property& deferredProperty(CSSPropertyID) const;
     67
    6568    bool hasCustomProperty(const String&) const;
    6669    Property customProperty(const String&) const;
     
    9497
    9598    Vector<Property, 8> m_deferredProperties;
     99    HashMap<CSSPropertyID, unsigned> m_deferredPropertiesIndices;
     100
    96101    HashMap<AtomString, Property> m_customProperties;
    97102};
     
    108113}
    109114
     115inline bool PropertyCascade::hasDeferredProperty(CSSPropertyID id) const
     116{
     117    return m_deferredPropertiesIndices.contains(id);
     118}
     119
     120inline const PropertyCascade::Property& PropertyCascade::deferredProperty(CSSPropertyID id) const
     121{
     122    ASSERT(hasDeferredProperty(id));
     123    unsigned index = m_deferredPropertiesIndices.get(id);
     124    ASSERT(index < m_deferredProperties.size());
     125    return m_deferredProperties[index];
     126}
     127
    110128inline bool PropertyCascade::hasCustomProperty(const String& name) const
    111129{
  • trunk/Source/WebCore/style/StyleBuilder.cpp

    r290864 r291260  
    321321                applyRollbackCascadeProperty(property, linkMatchMask);
    322322                return;
     323            } else if (rollbackCascade->hasDeferredProperty(id)) {
     324                auto& property = rollbackCascade->deferredProperty(id);
     325                applyRollbackCascadeProperty(property, linkMatchMask);
     326                return;
    323327            }
    324328        }
Note: See TracChangeset for help on using the changeset viewer.