Title: [251828] trunk
Revision
251828
Author
simon.fra...@apple.com
Date
2019-10-30 19:16:27 -0700 (Wed, 30 Oct 2019)

Log Message

Opacity should always serialize as a number
https://bugs.webkit.org/show_bug.cgi?id=203601

Reviewed by Dean Jackson.
LayoutTests/imported/w3c:

* web-platform-tests/css/css-color/parsing/opacity-valid-expected.txt:

Source/WebCore:

opacity should always serialize as a number, even if it was specified as a percentage.

Tests: imported/w3c/web-platform-tests/css/css-color/parsing/opacity-valid

* css/StyleProperties.cpp:
(WebCore::StyleProperties::getPropertyValue const):

LayoutTests:

Fix the tests and results.

* fast/css/parsing-opacity-expected.txt:
* fast/css/parsing-opacity.html:
* fast/svg/parsing-fill-opacity-expected.txt:
* fast/svg/parsing-fill-opacity.html:
* fast/svg/parsing-flood-opacity-expected.txt:
* fast/svg/parsing-flood-opacity.html:
* fast/svg/parsing-stop-opacity-expected.txt:
* fast/svg/parsing-stop-opacity.html:
* fast/svg/parsing-stroke-opacity-expected.txt:
* fast/svg/parsing-stroke-opacity.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (251827 => 251828)


--- trunk/LayoutTests/ChangeLog	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/ChangeLog	2019-10-31 02:16:27 UTC (rev 251828)
@@ -1,3 +1,23 @@
+2019-10-30  Simon Fraser  <simon.fra...@apple.com>
+
+        Opacity should always serialize as a number
+        https://bugs.webkit.org/show_bug.cgi?id=203601
+
+        Reviewed by Dean Jackson.
+
+        Fix the tests and results.
+
+        * fast/css/parsing-opacity-expected.txt:
+        * fast/css/parsing-opacity.html:
+        * fast/svg/parsing-fill-opacity-expected.txt:
+        * fast/svg/parsing-fill-opacity.html:
+        * fast/svg/parsing-flood-opacity-expected.txt:
+        * fast/svg/parsing-flood-opacity.html:
+        * fast/svg/parsing-stop-opacity-expected.txt:
+        * fast/svg/parsing-stop-opacity.html:
+        * fast/svg/parsing-stroke-opacity-expected.txt:
+        * fast/svg/parsing-stroke-opacity.html:
+
 2019-10-30  Chris Dumez  <cdu...@apple.com>
 
         GPUCanvasContext should not prevent entering the back/forward cache

Modified: trunk/LayoutTests/fast/css/parsing-opacity-expected.txt (251827 => 251828)


--- trunk/LayoutTests/fast/css/parsing-opacity-expected.txt	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/css/parsing-opacity-expected.txt	2019-10-31 02:16:27 UTC (rev 251828)
@@ -8,12 +8,12 @@
 PASS innerStyle("opacity", "1") is "1"
 PASS innerStyle("opacity", "1000") is "1000"
 PASS innerStyle("opacity", "-400") is "-400"
-PASS innerStyle("opacity", "20%") is "20%"
-PASS innerStyle("opacity", "-600%") is "-600%"
-PASS innerStyle("opacity", "700%") is "700%"
+PASS innerStyle("opacity", "20%") is "0.2"
+PASS innerStyle("opacity", "-600%") is "-6"
+PASS innerStyle("opacity", "700%") is "7"
 PASS innerStyle("opacity", "2.5e-1") is "0.25"
-PASS innerStyle("opacity", "2.5e1%") is "25%"
-PASS innerStyle("opacity", "100.25%") is "100.25%"
+PASS innerStyle("opacity", "2.5e1%") is "0.25"
+PASS innerStyle("opacity", "100.25%") is "1.0025"
 PASS computedStyle("opacity", "0") is "0"
 PASS computedStyle("opacity", "0.5") is "0.5"
 PASS computedStyle("opacity", "1") is "1"

Modified: trunk/LayoutTests/fast/css/parsing-opacity.html (251827 => 251828)


--- trunk/LayoutTests/fast/css/parsing-opacity.html	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/css/parsing-opacity.html	2019-10-31 02:16:27 UTC (rev 251828)
@@ -45,12 +45,12 @@
 testInner("opacity", "1", "1");
 testInner("opacity", "1000", "1000");
 testInner("opacity", "-400", "-400");
-testInner("opacity", "20%", "20%");
-testInner("opacity", "-600%", "-600%");
-testInner("opacity", "700%", "700%");
+testInner("opacity", "20%", "0.2");
+testInner("opacity", "-600%", "-6");
+testInner("opacity", "700%", "7");
 testInner("opacity", "2.5e-1", "0.25");
-testInner("opacity", "2.5e1%", "25%");
-testInner("opacity", "100.25%", "100.25%");
+testInner("opacity", "2.5e1%", "0.25");
+testInner("opacity", "100.25%", "1.0025");
 testComputed("opacity", "0", "0");
 testComputed("opacity", "0.5", "0.5");
 testComputed("opacity", "1", "1");

Modified: trunk/LayoutTests/fast/svg/parsing-fill-opacity-expected.txt (251827 => 251828)


--- trunk/LayoutTests/fast/svg/parsing-fill-opacity-expected.txt	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/svg/parsing-fill-opacity-expected.txt	2019-10-31 02:16:27 UTC (rev 251828)
@@ -8,12 +8,12 @@
 PASS innerStyle("fill-opacity", "1") is "1"
 PASS innerStyle("fill-opacity", "1000") is "1000"
 PASS innerStyle("fill-opacity", "-400") is "-400"
-PASS innerStyle("fill-opacity", "20%") is "20%"
-PASS innerStyle("fill-opacity", "-600%") is "-600%"
-PASS innerStyle("fill-opacity", "700%") is "700%"
+PASS innerStyle("fill-opacity", "20%") is "0.2"
+PASS innerStyle("fill-opacity", "-600%") is "-6"
+PASS innerStyle("fill-opacity", "700%") is "7"
 PASS innerStyle("fill-opacity", "2.5e-1") is "0.25"
-PASS innerStyle("fill-opacity", "2.5e1%") is "25%"
-PASS innerStyle("fill-opacity", "100.25%") is "100.25%"
+PASS innerStyle("fill-opacity", "2.5e1%") is "0.25"
+PASS innerStyle("fill-opacity", "100.25%") is "1.0025"
 PASS computedStyle("fill-opacity", "0") is "0"
 PASS computedStyle("fill-opacity", "0.5") is "0.5"
 PASS computedStyle("fill-opacity", "1") is "1"

Modified: trunk/LayoutTests/fast/svg/parsing-fill-opacity.html (251827 => 251828)


--- trunk/LayoutTests/fast/svg/parsing-fill-opacity.html	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/svg/parsing-fill-opacity.html	2019-10-31 02:16:27 UTC (rev 251828)
@@ -45,12 +45,12 @@
 testInner("fill-opacity", "1", "1");
 testInner("fill-opacity", "1000", "1000");
 testInner("fill-opacity", "-400", "-400");
-testInner("fill-opacity", "20%", "20%");
-testInner("fill-opacity", "-600%", "-600%");
-testInner("fill-opacity", "700%", "700%");
+testInner("fill-opacity", "20%", "0.2");
+testInner("fill-opacity", "-600%", "-6");
+testInner("fill-opacity", "700%", "7");
 testInner("fill-opacity", "2.5e-1", "0.25");
-testInner("fill-opacity", "2.5e1%", "25%");
-testInner("fill-opacity", "100.25%", "100.25%");
+testInner("fill-opacity", "2.5e1%", "0.25");
+testInner("fill-opacity", "100.25%", "1.0025");
 testComputed("fill-opacity", "0", "0");
 testComputed("fill-opacity", "0.5", "0.5");
 testComputed("fill-opacity", "1", "1");

Modified: trunk/LayoutTests/fast/svg/parsing-flood-opacity-expected.txt (251827 => 251828)


--- trunk/LayoutTests/fast/svg/parsing-flood-opacity-expected.txt	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/svg/parsing-flood-opacity-expected.txt	2019-10-31 02:16:27 UTC (rev 251828)
@@ -8,12 +8,12 @@
 PASS innerStyle("flood-opacity", "1") is "1"
 PASS innerStyle("flood-opacity", "1000") is "1000"
 PASS innerStyle("flood-opacity", "-400") is "-400"
-PASS innerStyle("flood-opacity", "20%") is "20%"
-PASS innerStyle("flood-opacity", "-600%") is "-600%"
-PASS innerStyle("flood-opacity", "700%") is "700%"
+PASS innerStyle("flood-opacity", "20%") is "0.2"
+PASS innerStyle("flood-opacity", "-600%") is "-6"
+PASS innerStyle("flood-opacity", "700%") is "7"
 PASS innerStyle("flood-opacity", "2.5e-1") is "0.25"
-PASS innerStyle("flood-opacity", "2.5e1%") is "25%"
-PASS innerStyle("flood-opacity", "100.25%") is "100.25%"
+PASS innerStyle("flood-opacity", "2.5e1%") is "0.25"
+PASS innerStyle("flood-opacity", "100.25%") is "1.0025"
 PASS computedStyle("flood-opacity", "0") is "0"
 PASS computedStyle("flood-opacity", "0.5") is "0.5"
 PASS computedStyle("flood-opacity", "1") is "1"

Modified: trunk/LayoutTests/fast/svg/parsing-flood-opacity.html (251827 => 251828)


--- trunk/LayoutTests/fast/svg/parsing-flood-opacity.html	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/svg/parsing-flood-opacity.html	2019-10-31 02:16:27 UTC (rev 251828)
@@ -45,12 +45,12 @@
 testInner("flood-opacity", "1", "1");
 testInner("flood-opacity", "1000", "1000");
 testInner("flood-opacity", "-400", "-400");
-testInner("flood-opacity", "20%", "20%");
-testInner("flood-opacity", "-600%", "-600%");
-testInner("flood-opacity", "700%", "700%");
+testInner("flood-opacity", "20%", "0.2");
+testInner("flood-opacity", "-600%", "-6");
+testInner("flood-opacity", "700%", "7");
 testInner("flood-opacity", "2.5e-1", "0.25");
-testInner("flood-opacity", "2.5e1%", "25%");
-testInner("flood-opacity", "100.25%", "100.25%");
+testInner("flood-opacity", "2.5e1%", "0.25");
+testInner("flood-opacity", "100.25%", "1.0025");
 testComputed("flood-opacity", "0", "0");
 testComputed("flood-opacity", "0.5", "0.5");
 testComputed("flood-opacity", "1", "1");

Modified: trunk/LayoutTests/fast/svg/parsing-stop-opacity-expected.txt (251827 => 251828)


--- trunk/LayoutTests/fast/svg/parsing-stop-opacity-expected.txt	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/svg/parsing-stop-opacity-expected.txt	2019-10-31 02:16:27 UTC (rev 251828)
@@ -8,12 +8,12 @@
 PASS innerStyle("stop-opacity", "1") is "1"
 PASS innerStyle("stop-opacity", "1000") is "1000"
 PASS innerStyle("stop-opacity", "-400") is "-400"
-PASS innerStyle("stop-opacity", "20%") is "20%"
-PASS innerStyle("stop-opacity", "-600%") is "-600%"
-PASS innerStyle("stop-opacity", "700%") is "700%"
+PASS innerStyle("stop-opacity", "20%") is "0.2"
+PASS innerStyle("stop-opacity", "-600%") is "-6"
+PASS innerStyle("stop-opacity", "700%") is "7"
 PASS innerStyle("stop-opacity", "2.5e-1") is "0.25"
-PASS innerStyle("stop-opacity", "2.5e1%") is "25%"
-PASS innerStyle("stop-opacity", "100.25%") is "100.25%"
+PASS innerStyle("stop-opacity", "2.5e1%") is "0.25"
+PASS innerStyle("stop-opacity", "100.25%") is "1.0025"
 PASS computedStyle("stop-opacity", "0") is "0"
 PASS computedStyle("stop-opacity", "0.5") is "0.5"
 PASS computedStyle("stop-opacity", "1") is "1"

Modified: trunk/LayoutTests/fast/svg/parsing-stop-opacity.html (251827 => 251828)


--- trunk/LayoutTests/fast/svg/parsing-stop-opacity.html	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/svg/parsing-stop-opacity.html	2019-10-31 02:16:27 UTC (rev 251828)
@@ -45,12 +45,12 @@
 testInner("stop-opacity", "1", "1");
 testInner("stop-opacity", "1000", "1000");
 testInner("stop-opacity", "-400", "-400");
-testInner("stop-opacity", "20%", "20%");
-testInner("stop-opacity", "-600%", "-600%");
-testInner("stop-opacity", "700%", "700%");
+testInner("stop-opacity", "20%", "0.2");
+testInner("stop-opacity", "-600%", "-6");
+testInner("stop-opacity", "700%", "7");
 testInner("stop-opacity", "2.5e-1", "0.25");
-testInner("stop-opacity", "2.5e1%", "25%");
-testInner("stop-opacity", "100.25%", "100.25%");
+testInner("stop-opacity", "2.5e1%", "0.25");
+testInner("stop-opacity", "100.25%", "1.0025");
 testComputed("stop-opacity", "0", "0");
 testComputed("stop-opacity", "0.5", "0.5");
 testComputed("stop-opacity", "1", "1");

Modified: trunk/LayoutTests/fast/svg/parsing-stroke-opacity-expected.txt (251827 => 251828)


--- trunk/LayoutTests/fast/svg/parsing-stroke-opacity-expected.txt	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/svg/parsing-stroke-opacity-expected.txt	2019-10-31 02:16:27 UTC (rev 251828)
@@ -8,12 +8,12 @@
 PASS innerStyle("stroke-opacity", "1") is "1"
 PASS innerStyle("stroke-opacity", "1000") is "1000"
 PASS innerStyle("stroke-opacity", "-400") is "-400"
-PASS innerStyle("stroke-opacity", "20%") is "20%"
-PASS innerStyle("stroke-opacity", "-600%") is "-600%"
-PASS innerStyle("stroke-opacity", "700%") is "700%"
+PASS innerStyle("stroke-opacity", "20%") is "0.2"
+PASS innerStyle("stroke-opacity", "-600%") is "-6"
+PASS innerStyle("stroke-opacity", "700%") is "7"
 PASS innerStyle("stroke-opacity", "2.5e-1") is "0.25"
-PASS innerStyle("stroke-opacity", "2.5e1%") is "25%"
-PASS innerStyle("stroke-opacity", "100.25%") is "100.25%"
+PASS innerStyle("stroke-opacity", "2.5e1%") is "0.25"
+PASS innerStyle("stroke-opacity", "100.25%") is "1.0025"
 PASS computedStyle("stroke-opacity", "0") is "0"
 PASS computedStyle("stroke-opacity", "0.5") is "0.5"
 PASS computedStyle("stroke-opacity", "1") is "1"

Modified: trunk/LayoutTests/fast/svg/parsing-stroke-opacity.html (251827 => 251828)


--- trunk/LayoutTests/fast/svg/parsing-stroke-opacity.html	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/fast/svg/parsing-stroke-opacity.html	2019-10-31 02:16:27 UTC (rev 251828)
@@ -45,12 +45,12 @@
 testInner("stroke-opacity", "1", "1");
 testInner("stroke-opacity", "1000", "1000");
 testInner("stroke-opacity", "-400", "-400");
-testInner("stroke-opacity", "20%", "20%");
-testInner("stroke-opacity", "-600%", "-600%");
-testInner("stroke-opacity", "700%", "700%");
+testInner("stroke-opacity", "20%", "0.2");
+testInner("stroke-opacity", "-600%", "-6");
+testInner("stroke-opacity", "700%", "7");
 testInner("stroke-opacity", "2.5e-1", "0.25");
-testInner("stroke-opacity", "2.5e1%", "25%");
-testInner("stroke-opacity", "100.25%", "100.25%");
+testInner("stroke-opacity", "2.5e1%", "0.25");
+testInner("stroke-opacity", "100.25%", "1.0025");
 testComputed("stroke-opacity", "0", "0");
 testComputed("stroke-opacity", "0.5", "0.5");
 testComputed("stroke-opacity", "1", "1");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (251827 => 251828)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-10-31 02:16:27 UTC (rev 251828)
@@ -1,3 +1,12 @@
+2019-10-30  Simon Fraser  <simon.fra...@apple.com>
+
+        Opacity should always serialize as a number
+        https://bugs.webkit.org/show_bug.cgi?id=203601
+
+        Reviewed by Dean Jackson.
+
+        * web-platform-tests/css/css-color/parsing/opacity-valid-expected.txt:
+
 2019-10-30  Antti Koivisto  <an...@apple.com>
 
         Update css/css-display web platform tests

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/opacity-valid-expected.txt (251827 => 251828)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/opacity-valid-expected.txt	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/opacity-valid-expected.txt	2019-10-31 02:16:27 UTC (rev 251828)
@@ -4,7 +4,7 @@
 PASS e.style['opacity'] = "0" should set the property value 
 PASS e.style['opacity'] = "-2" should set the property value 
 PASS e.style['opacity'] = "3" should set the property value 
-FAIL e.style['opacity'] = "-100%" should set the property value assert_equals: serialization should be canonical expected "-1" but got "-100%"
-FAIL e.style['opacity'] = "50%" should set the property value assert_equals: serialization should be canonical expected "0.5" but got "50%"
-FAIL e.style['opacity'] = "300%" should set the property value assert_equals: serialization should be canonical expected "3" but got "300%"
+PASS e.style['opacity'] = "-100%" should set the property value 
+PASS e.style['opacity'] = "50%" should set the property value 
+PASS e.style['opacity'] = "300%" should set the property value 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/svg/painting/parsing/fill-opacity-valid-expected.txt (251827 => 251828)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/svg/painting/parsing/fill-opacity-valid-expected.txt	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/svg/painting/parsing/fill-opacity-valid-expected.txt	2019-10-31 02:16:27 UTC (rev 251828)
@@ -2,7 +2,7 @@
 PASS e.style['fill-opacity'] = "-1" should set the property value 
 PASS e.style['fill-opacity'] = "0.5" should set the property value 
 PASS e.style['fill-opacity'] = "3" should set the property value 
-FAIL e.style['fill-opacity'] = "-100%" should set the property value assert_equals: serialization should be canonical expected "-1" but got "-100%"
-FAIL e.style['fill-opacity'] = "50%" should set the property value assert_equals: serialization should be canonical expected "0.5" but got "50%"
-FAIL e.style['fill-opacity'] = "300%" should set the property value assert_equals: serialization should be canonical expected "3" but got "300%"
+PASS e.style['fill-opacity'] = "-100%" should set the property value 
+PASS e.style['fill-opacity'] = "50%" should set the property value 
+PASS e.style['fill-opacity'] = "300%" should set the property value 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/svg/painting/parsing/stroke-opacity-valid-expected.txt (251827 => 251828)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/svg/painting/parsing/stroke-opacity-valid-expected.txt	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/svg/painting/parsing/stroke-opacity-valid-expected.txt	2019-10-31 02:16:27 UTC (rev 251828)
@@ -2,7 +2,7 @@
 PASS e.style['stroke-opacity'] = "-1" should set the property value 
 PASS e.style['stroke-opacity'] = "0.5" should set the property value 
 PASS e.style['stroke-opacity'] = "3" should set the property value 
-FAIL e.style['stroke-opacity'] = "-100%" should set the property value assert_equals: serialization should be canonical expected "-1" but got "-100%"
-FAIL e.style['stroke-opacity'] = "50%" should set the property value assert_equals: serialization should be canonical expected "0.5" but got "50%"
-FAIL e.style['stroke-opacity'] = "300%" should set the property value assert_equals: serialization should be canonical expected "3" but got "300%"
+PASS e.style['stroke-opacity'] = "-100%" should set the property value 
+PASS e.style['stroke-opacity'] = "50%" should set the property value 
+PASS e.style['stroke-opacity'] = "300%" should set the property value 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/svg/pservers/parsing/stop-opacity-valid-expected.txt (251827 => 251828)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/svg/pservers/parsing/stop-opacity-valid-expected.txt	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/svg/pservers/parsing/stop-opacity-valid-expected.txt	2019-10-31 02:16:27 UTC (rev 251828)
@@ -2,7 +2,7 @@
 PASS e.style['stop-opacity'] = "-1" should set the property value 
 PASS e.style['stop-opacity'] = "0.5" should set the property value 
 PASS e.style['stop-opacity'] = "3" should set the property value 
-FAIL e.style['stop-opacity'] = "-100%" should set the property value assert_equals: serialization should be canonical expected "-1" but got "-100%"
-FAIL e.style['stop-opacity'] = "50%" should set the property value assert_equals: serialization should be canonical expected "0.5" but got "50%"
-FAIL e.style['stop-opacity'] = "300%" should set the property value assert_equals: serialization should be canonical expected "3" but got "300%"
+PASS e.style['stop-opacity'] = "-100%" should set the property value 
+PASS e.style['stop-opacity'] = "50%" should set the property value 
+PASS e.style['stop-opacity'] = "300%" should set the property value 
 

Modified: trunk/Source/WebCore/ChangeLog (251827 => 251828)


--- trunk/Source/WebCore/ChangeLog	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/Source/WebCore/ChangeLog	2019-10-31 02:16:27 UTC (rev 251828)
@@ -25,6 +25,20 @@
         * loader/archive/mhtml/MHTMLArchive.cpp:
         (WebCore::MHTMLArchive::generateMHTMLData):
 
+2019-10-30  Simon Fraser  <simon.fra...@apple.com>
+
+        Opacity should always serialize as a number
+        https://bugs.webkit.org/show_bug.cgi?id=203601
+
+        Reviewed by Dean Jackson.
+        
+        opacity should always serialize as a number, even if it was specified as a percentage.
+
+        Tests: imported/w3c/web-platform-tests/css/css-color/parsing/opacity-valid
+
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::getPropertyValue const):
+
 2019-10-30  Chris Dumez  <cdu...@apple.com>
 
         GPUCanvasContext should not prevent entering the back/forward cache

Modified: trunk/Source/WebCore/css/StyleProperties.cpp (251827 => 251828)


--- trunk/Source/WebCore/css/StyleProperties.cpp	2019-10-31 01:41:11 UTC (rev 251827)
+++ trunk/Source/WebCore/css/StyleProperties.cpp	2019-10-31 02:16:27 UTC (rev 251828)
@@ -123,8 +123,23 @@
 String StyleProperties::getPropertyValue(CSSPropertyID propertyID) const
 {
     RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
-    if (value)
-        return value->cssText();
+    if (value) {
+        switch (propertyID) {
+        case CSSPropertyFillOpacity:
+        case CSSPropertyFloodOpacity:
+        case CSSPropertyOpacity:
+        case CSSPropertyStopOpacity:
+        case CSSPropertyStrokeOpacity:
+            // Opacity values always serializes as a number.
+            if (value->isPrimitiveValue() && downcast<CSSPrimitiveValue>(value.get())->isPercentage()) {
+                auto doubleValue = downcast<CSSPrimitiveValue>(value.get())->doubleValue();
+                return makeString(doubleValue / 100.0);
+            }
+            FALLTHROUGH;
+        default:
+            return value->cssText();
+        }
+    }
 
     const StylePropertyShorthand& shorthand = shorthandForProperty(propertyID);
     if (shorthand.length()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to