Title: [283568] trunk
Revision
283568
Author
[email protected]
Date
2021-10-05 13:12:56 -0700 (Tue, 05 Oct 2021)

Log Message

Incorrect Length constructor used after blending negative Length
https://bugs.webkit.org/show_bug.cgi?id=230873

Patch by Gabriel Nava Marino <[email protected]> on 2021-10-05
Reviewed by Antoine Quint.

Source/WebCore:

Test: fast/borders/border-radius-cubic-bezier-timing-function-negative-value.html

* platform/Length.cpp:
(WebCore::blend):

Only call current Length constructor for the non-LengthType::Calculated types when the value is negative, otherwise use behavior before r273603.

* style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertToRadiusLength):

Clamp BuilderConverter::convertToRadiusLength Lengths to values >= 0

LayoutTests:

* fast/borders/border-radius-cubic-bezier-timing-function-negative-value-expected.txt: Added.
* fast/borders/border-radius-cubic-bezier-timing-function-negative-value.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283567 => 283568)


--- trunk/LayoutTests/ChangeLog	2021-10-05 19:20:28 UTC (rev 283567)
+++ trunk/LayoutTests/ChangeLog	2021-10-05 20:12:56 UTC (rev 283568)
@@ -1,3 +1,13 @@
+2021-10-05  Gabriel Nava Marino  <[email protected]>
+
+        Incorrect Length constructor used after blending negative Length
+        https://bugs.webkit.org/show_bug.cgi?id=230873
+
+        Reviewed by Antoine Quint.
+
+        * fast/borders/border-radius-cubic-bezier-timing-function-negative-value-expected.txt: Added.
+        * fast/borders/border-radius-cubic-bezier-timing-function-negative-value.html: Added.
+
 2021-10-05  Chris Dumez  <[email protected]>
 
         Authorization header lost on 30x redirects

Added: trunk/LayoutTests/fast/borders/border-radius-cubic-bezier-timing-function-negative-value-expected.txt (0 => 283568)


--- trunk/LayoutTests/fast/borders/border-radius-cubic-bezier-timing-function-negative-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/border-radius-cubic-bezier-timing-function-negative-value-expected.txt	2021-10-05 20:12:56 UTC (rev 283568)
@@ -0,0 +1,2 @@
+PASS
+

Added: trunk/LayoutTests/fast/borders/border-radius-cubic-bezier-timing-function-negative-value.html (0 => 283568)


--- trunk/LayoutTests/fast/borders/border-radius-cubic-bezier-timing-function-negative-value.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/border-radius-cubic-bezier-timing-function-negative-value.html	2021-10-05 20:12:56 UTC (rev 283568)
@@ -0,0 +1,26 @@
+<style>
+  html {
+    transition-timing-function: cubic-bezier(1, -100, 1, 1);
+  }
+  html, div {
+    transition-duration: 10ms;
+  }
+  div {
+    border-radius: 1%;
+    transition-timing-function: steps(1, jump-start);
+  }
+</style>
+<script>
+  _onload_ = () => {
+    document.documentElement.style.zoom = '2';
+    let div0 = document.createElement('div');
+    document.body.appendChild(div0);
+    document.body.offsetTop;
+    div0.style.borderTopLeftRadius = '1px';
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+    }
+  };
+
+</script>
+PASS

Modified: trunk/Source/WebCore/ChangeLog (283567 => 283568)


--- trunk/Source/WebCore/ChangeLog	2021-10-05 19:20:28 UTC (rev 283567)
+++ trunk/Source/WebCore/ChangeLog	2021-10-05 20:12:56 UTC (rev 283568)
@@ -1,3 +1,22 @@
+2021-10-05  Gabriel Nava Marino  <[email protected]>
+
+        Incorrect Length constructor used after blending negative Length
+        https://bugs.webkit.org/show_bug.cgi?id=230873
+
+        Reviewed by Antoine Quint.
+
+        Test: fast/borders/border-radius-cubic-bezier-timing-function-negative-value.html
+
+        * platform/Length.cpp:
+        (WebCore::blend):
+
+        Only call current Length constructor for the non-LengthType::Calculated types when the value is negative, otherwise use behavior before r273603.
+
+        * style/StyleBuilderConverter.h:
+        (WebCore::Style::BuilderConverter::convertToRadiusLength):
+
+        Clamp BuilderConverter::convertToRadiusLength Lengths to values >= 0
+
 2021-10-05  Kate Cheney  <[email protected]>
 
         CSP: unsafe-eval tests timing out or failing

Modified: trunk/Source/WebCore/platform/Length.cpp (283567 => 283568)


--- trunk/Source/WebCore/platform/Length.cpp	2021-10-05 19:20:28 UTC (rev 283567)
+++ trunk/Source/WebCore/platform/Length.cpp	2021-10-05 20:12:56 UTC (rev 283568)
@@ -341,8 +341,12 @@
 Length blend(const Length& from, const Length& to, const BlendingContext& context, ValueRange valueRange)
 {
     auto blended = blend(from, to, context);
-    if (valueRange == ValueRange::NonNegative && blended.isNegative())
-        return { 0, from.isZero () ? to.type() : from.type() };
+    if (valueRange == ValueRange::NonNegative && blended.isNegative()) {
+        auto type = from.isZero() ? to.type() : from.type();
+        if (type != LengthType::Calculated)
+            return { 0, type };
+        return { 0, LengthType::Fixed };
+    }
     return blended;
 }
 

Modified: trunk/Source/WebCore/style/StyleBuilderConverter.h (283567 => 283568)


--- trunk/Source/WebCore/style/StyleBuilderConverter.h	2021-10-05 19:20:28 UTC (rev 283567)
+++ trunk/Source/WebCore/style/StyleBuilderConverter.h	2021-10-05 20:12:56 UTC (rev 283568)
@@ -320,7 +320,10 @@
         return Length(value.doubleValue(), LengthType::Percent);
     if (value.isCalculatedPercentageWithLength())
         return Length(value.cssCalcValue()->createCalculationValue(conversionData));
-    return value.computeLength<Length>(conversionData);
+    auto length = value.computeLength<Length>(conversionData);
+    if (length.isNegative())
+        return { 0, LengthType::Fixed };
+    return length;
 }
 
 inline LengthSize BuilderConverter::convertRadius(BuilderState& builderState, const CSSValue& value)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to