Title: [216188] trunk
Revision
216188
Author
hy...@apple.com
Date
2017-05-04 08:41:13 -0700 (Thu, 04 May 2017)

Log Message

REGRESSION(STP): rgb() with calc() containing variables doesn't work
https://bugs.webkit.org/show_bug.cgi?id=169939

Reviewed by Zalan Bujtas.

Source/WebCore:

Added new test in fast/css/variables.

* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcExpressionNodeParser::parseValue):
Treat floats in calcs as integers when we can.

LayoutTests:

* fast/css/variables/calc-float-to-int-expected.html: Added.
* fast/css/variables/calc-float-to-int.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (216187 => 216188)


--- trunk/LayoutTests/ChangeLog	2017-05-04 15:33:41 UTC (rev 216187)
+++ trunk/LayoutTests/ChangeLog	2017-05-04 15:41:13 UTC (rev 216188)
@@ -1,3 +1,13 @@
+2017-05-04  Dave Hyatt  <hy...@apple.com>
+
+        REGRESSION(STP): rgb() with calc() containing variables doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=169939
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/css/variables/calc-float-to-int-expected.html: Added.
+        * fast/css/variables/calc-float-to-int.html: Added.
+
 2017-05-04  Carlos Garcia Campos  <cgar...@igalia.com>
 
         Unreviewed gardening. Update main expectations of http/tests/inspector/network/resource-request-headers.html.

Added: trunk/LayoutTests/fast/css/variables/calc-float-to-int-expected.html (0 => 216188)


--- trunk/LayoutTests/fast/css/variables/calc-float-to-int-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/variables/calc-float-to-int-expected.html	2017-05-04 15:41:13 UTC (rev 216188)
@@ -0,0 +1,13 @@
+<html>
+    <head>
+        <style>
+body {
+background: rgb(0, 255, 0);
+height: 100vh;
+margin: 0;
+}
+</style>
+</head>
+<body>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/variables/calc-float-to-int.html (0 => 216188)


--- trunk/LayoutTests/fast/css/variables/calc-float-to-int.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/variables/calc-float-to-int.html	2017-05-04 15:41:13 UTC (rev 216188)
@@ -0,0 +1,19 @@
+<html>
+<head>
+<style>
+html {
+background: red;
+}
+
+body {
+--color: 1.0;
+background: red;
+background: rgb(0, calc(255 * var(--color)), 0);
+height: 100vh;
+margin: 0;
+}
+</style>
+</head>
+<body>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (216187 => 216188)


--- trunk/Source/WebCore/ChangeLog	2017-05-04 15:33:41 UTC (rev 216187)
+++ trunk/Source/WebCore/ChangeLog	2017-05-04 15:41:13 UTC (rev 216188)
@@ -1,3 +1,16 @@
+2017-05-04  Dave Hyatt  <hy...@apple.com>
+
+        REGRESSION(STP): rgb() with calc() containing variables doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=169939
+
+        Reviewed by Zalan Bujtas.
+
+        Added new test in fast/css/variables.
+
+        * css/CSSCalculationValue.cpp:
+        (WebCore::CSSCalcExpressionNodeParser::parseValue):
+        Treat floats in calcs as integers when we can.
+
 2017-05-04  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r216172.

Modified: trunk/Source/WebCore/css/CSSCalculationValue.cpp (216187 => 216188)


--- trunk/Source/WebCore/css/CSSCalculationValue.cpp	2017-05-04 15:33:41 UTC (rev 216187)
+++ trunk/Source/WebCore/css/CSSCalculationValue.cpp	2017-05-04 15:41:13 UTC (rev 216188)
@@ -598,7 +598,8 @@
         if (unitCategory(type) == CalcOther)
             return false;
         
-        result->value = CSSCalcPrimitiveValue::create(CSSPrimitiveValue::create(token.numericValue(), type), token.numericValueType() == IntegerValueType);
+        bool isInteger = token.numericValueType() == IntegerValueType || (token.numericValueType() == NumberValueType && token.numericValue() == trunc(token.numericValue()));
+        result->value = CSSCalcPrimitiveValue::create(CSSPrimitiveValue::create(token.numericValue(), type), isInteger);
         
         return true;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to