Ignore:
Timestamp:
Apr 1, 2022, 1:29:51 AM (3 years ago)
Author:
Carlos Garcia Campos
Message:

Add support for element.computedStyleMap()
https://bugs.webkit.org/show_bug.cgi?id=238375

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Update test expectations.

  • web-platform-tests/css/css-color/system-color-compute-expected.txt:
  • web-platform-tests/css/css-properties-values-api/at-property-typedom-expected.txt:
  • web-platform-tests/css/css-properties-values-api/property-cascade-expected.txt:
  • web-platform-tests/css/css-properties-values-api/typedom-expected.txt:
  • web-platform-tests/css/css-transforms/animation/transform-interpolation-computed-value-expected.txt:
  • web-platform-tests/css/css-typed-om/idlharness-expected.txt:
  • web-platform-tests/css/css-typed-om/stylevalue-serialization/cssStyleValue-cssom-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/computed.tentative-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/get-auto-min-size-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/get-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/get-invalid-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/get-position-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/get-shorthand-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/getAll-shorthand-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/getAll.tentative-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/has.tentative-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/computed/iterable.tentative-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/inline/getAll-shorthand-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/inline/getAll.tentative-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/inline/has.tentative-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/inline/iterable.tentative-expected.txt:
  • web-platform-tests/css/css-typed-om/the-stylepropertymap/properties/transform-interpolated-expected.txt:

Source/WebCore:

Covered by existing w3c tests.

  • CMakeLists.txt:
  • Sources.txt:
  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::ComputedStyleExtractor::propertyValue): Add PropertyValueType parameter to get either the computed or
resolved value.

  • css/CSSComputedStyleDeclaration.h:
  • css/typedom/CSSStyleValueFactory.cpp:

(WebCore::CSSStyleValueFactory::reifyValue): Handle more cases of custom property.

  • css/typedom/ComputedStylePropertyMapReadOnly.cpp: Added.

(WebCore::ComputedStylePropertyMapReadOnly::create):
(WebCore::ComputedStylePropertyMapReadOnly::ComputedStylePropertyMapReadOnly):
(WebCore::ComputedStylePropertyMapReadOnly::get const):
(WebCore::ComputedStylePropertyMapReadOnly::getAll const):
(WebCore::ComputedStylePropertyMapReadOnly::has const):
(WebCore::ComputedStylePropertyMapReadOnly::size const):
(WebCore::ComputedStylePropertyMapReadOnly::entries const):

  • css/typedom/ComputedStylePropertyMapReadOnly.h: Added.
  • css/typedom/StylePropertyMapReadOnly.cpp:

(WebCore::StylePropertyMapReadOnly::reifyValueToVector): Returns a Vector so in case of CSSValueList, every
value is added to the vector.
(WebCore::StylePropertyMapReadOnly::Iterator::Iterator): Add iterator implementation, since this is now iterable.
(WebCore::StylePropertyMapReadOnly::Iterator::next): Ditto.

  • css/typedom/StylePropertyMapReadOnly.h:

(WebCore::StylePropertyMapReadOnly::createIterator):

  • css/typedom/StylePropertyMapReadOnly.idl:
  • dom/Element+ComputedStyleMap.idl: Added.
  • dom/Element.cpp:

(WebCore::Element::computedStyleMap): Get or create the computed style map.

  • dom/Element.h:
  • dom/ElementRareData.cpp:
  • dom/ElementRareData.h:

(WebCore::ElementRareData::computedStyleMap):
(WebCore::ElementRareData::setComputedStyleMap):
(WebCore::ElementRareData::useTypes const):

  • dom/NodeRareData.h:
  • dom/StyledElement.cpp:
  • html/CustomPaintImage.cpp:

LayoutTests:

Update test expectations.

  • platform/glib/imported/w3c/web-platform-tests/css/css-color/system-color-compute-expected.txt:
  • platform/glib/imported/w3c/web-platform-tests/css/css-transforms/animation/transform-interpolation-computed-value-expected.txt: Removed.
  • platform/ios/imported/w3c/web-platform-tests/css/css-color/system-color-compute-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r291956 r292210  
    28482848}
    28492849
    2850 RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout)
     2850RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout, PropertyValueType valueType)
    28512851{
    28522852    auto* styledElement = m_element.get();
     
    28812881        return nullptr;
    28822882
    2883     return valueForPropertyInStyle(*style, propertyID, styledRenderer());
     2883    return valueForPropertyInStyle(*style, propertyID, valueType == PropertyValueType::Resolved ? styledRenderer() : nullptr);
    28842884}
    28852885
Note: See TracChangeset for help on using the changeset viewer.