Title: [293333] trunk
Revision
293333
Author
an...@apple.com
Date
2022-04-25 11:25:03 -0700 (Mon, 25 Apr 2022)

Log Message

[CSS Typed OM] Fix AttributeStyleMap.get for list values
https://bugs.webkit.org/show_bug.cgi?id=239716

Reviewed by Alan Bujtas.

Source/WebCore:

Test: css-typedom/typed-om-perspective-value.html

* css/typedom/CSSStyleValueFactory.cpp:
(WebCore::CSSStyleValueFactory::reifyValue):

The list here hasn't been deep copied. Don't move away a member.

* css/typedom/CSSStyleValueFactory.h:

Passing Ref<>&& instead of Ref<> here is a bug-prone over-optimization.

LayoutTests:

* css-typedom/typed-om-perspective-value-expected.txt: Added.
* css-typedom/typed-om-perspective-value.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (293332 => 293333)


--- trunk/LayoutTests/ChangeLog	2022-04-25 18:19:48 UTC (rev 293332)
+++ trunk/LayoutTests/ChangeLog	2022-04-25 18:25:03 UTC (rev 293333)
@@ -1,3 +1,13 @@
+2022-04-25  Antti Koivisto  <an...@apple.com>
+
+        [CSS Typed OM] Fix AttributeStyleMap.get for list values
+        https://bugs.webkit.org/show_bug.cgi?id=239716
+
+        Reviewed by Alan Bujtas.
+
+        * css-typedom/typed-om-perspective-value-expected.txt: Added.
+        * css-typedom/typed-om-perspective-value.html: Added.
+
 2022-04-25  Ziran Sun  <z...@igalia.com>
 
         UA stylesheet should include table { text-indent: initial } to conform with HTML standard

Added: trunk/LayoutTests/css-typedom/typed-om-perspective-value-expected.txt (0 => 293333)


--- trunk/LayoutTests/css-typedom/typed-om-perspective-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css-typedom/typed-om-perspective-value-expected.txt	2022-04-25 18:25:03 UTC (rev 293333)
@@ -0,0 +1 @@
+perspective(1px)

Added: trunk/LayoutTests/css-typedom/typed-om-perspective-value.html (0 => 293333)


--- trunk/LayoutTests/css-typedom/typed-om-perspective-value.html	                        (rev 0)
+++ trunk/LayoutTests/css-typedom/typed-om-perspective-value.html	2022-04-25 18:25:03 UTC (rev 293333)
@@ -0,0 +1,7 @@
+<div id="testElement"></div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+testElement.style.transform = 'perspective(1px)';
+testElement.textContent = testElement.attributeStyleMap.get('transform');
+</script>

Modified: trunk/Source/WebCore/ChangeLog (293332 => 293333)


--- trunk/Source/WebCore/ChangeLog	2022-04-25 18:19:48 UTC (rev 293332)
+++ trunk/Source/WebCore/ChangeLog	2022-04-25 18:25:03 UTC (rev 293333)
@@ -1,3 +1,21 @@
+2022-04-25  Antti Koivisto  <an...@apple.com>
+
+        [CSS Typed OM] Fix AttributeStyleMap.get for list values
+        https://bugs.webkit.org/show_bug.cgi?id=239716
+
+        Reviewed by Alan Bujtas.
+
+        Test: css-typedom/typed-om-perspective-value.html
+
+        * css/typedom/CSSStyleValueFactory.cpp:
+        (WebCore::CSSStyleValueFactory::reifyValue):
+
+        The list here hasn't been deep copied. Don't move away a member.
+
+        * css/typedom/CSSStyleValueFactory.h:
+
+        Passing Ref<>&& instead of Ref<> here is a bug-prone over-optimization.
+
 2022-04-25  Tim Nguyen  <n...@apple.com>
 
         Unprefix modern-media-controls CSS properties

Modified: trunk/Source/WebCore/css/typedom/CSSStyleValueFactory.cpp (293332 => 293333)


--- trunk/Source/WebCore/css/typedom/CSSStyleValueFactory.cpp	2022-04-25 18:19:48 UTC (rev 293332)
+++ trunk/Source/WebCore/css/typedom/CSSStyleValueFactory.cpp	2022-04-25 18:25:03 UTC (rev 293333)
@@ -151,7 +151,7 @@
     return results;
 }
 
-ExceptionOr<Ref<CSSStyleValue>> CSSStyleValueFactory::reifyValue(Ref<CSSValue>&& cssValue, Document* document)
+ExceptionOr<Ref<CSSStyleValue>> CSSStyleValueFactory::reifyValue(Ref<CSSValue> cssValue, Document* document)
 {
     if (is<CSSPrimitiveValue>(cssValue)) {
         auto primitiveValue = downcast<CSSPrimitiveValue>(cssValue.ptr());
@@ -254,7 +254,7 @@
         return WTF::switchOn(downcast<CSSCustomPropertyValue>(cssValue.get()).value(), [&](const std::monostate&) {
             return ExceptionOr<Ref<CSSStyleValue>> { CSSStyleValue::create(WTFMove(cssValue)) };
         }, [&](const Ref<CSSVariableReferenceValue>& value) {
-            return reifyValue(value.copyRef(), document);
+            return reifyValue(value, document);
         }, [&](Ref<CSSVariableData>& value) {
             return reifyValue(CSSVariableReferenceValue::create(WTFMove(value)));
         }, [&](const CSSValueID&) {
@@ -271,7 +271,7 @@
         if (!valueList->length())
             return Exception { TypeError, "The CSSValueList should not be empty."_s };
         
-        return reifyValue(WTFMove(*valueList->begin()), document);
+        return reifyValue(*valueList->begin(), document);
     }
     
     return CSSStyleValue::create(WTFMove(cssValue));

Modified: trunk/Source/WebCore/css/typedom/CSSStyleValueFactory.h (293332 => 293333)


--- trunk/Source/WebCore/css/typedom/CSSStyleValueFactory.h	2022-04-25 18:19:48 UTC (rev 293332)
+++ trunk/Source/WebCore/css/typedom/CSSStyleValueFactory.h	2022-04-25 18:25:03 UTC (rev 293333)
@@ -45,7 +45,7 @@
 class CSSStyleValueFactory {
 public:
     
-    static ExceptionOr<Ref<CSSStyleValue>> reifyValue(Ref<CSSValue>&&, Document* = nullptr);
+    static ExceptionOr<Ref<CSSStyleValue>> reifyValue(Ref<CSSValue>, Document* = nullptr);
     
     static ExceptionOr<void> extractCSSValues(Vector<Ref<CSSValue>>&, const CSSPropertyID&, const String&);
     static ExceptionOr<void> extractShorthandCSSValues(Vector<Ref<CSSValue>>&, const CSSPropertyID&, const String&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to