Title: [286444] trunk
Revision
286444
Author
[email protected]
Date
2021-12-02 12:09:02 -0800 (Thu, 02 Dec 2021)

Log Message

html/semantics/forms/constraints/input-number-validity-dynamic-value-no-change.html WPT test is failing
https://bugs.webkit.org/show_bug.cgi?id=233765

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline WPT test that is now passing.

* web-platform-tests/html/semantics/forms/constraints/input-number-validity-dynamic-value-no-change-expected.txt:

Source/WebCore:

Per https://html.spec.whatwg.org/#concept-input-min-zero, step base needs to be computed based on
the 'min' attribute, then fallback to the 'value' attribute and finally fallback to the default
step base. WebKit was missing the "fallback to the 'value' attribute logic.

No new tests, rebaselined existing test.

* html/NumberInputType.cpp:
(WebCore::NumberInputType::createStepRange const):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286443 => 286444)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-02 19:54:16 UTC (rev 286443)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-02 20:09:02 UTC (rev 286444)
@@ -1,3 +1,14 @@
+2021-12-02  Chris Dumez  <[email protected]>
+
+        html/semantics/forms/constraints/input-number-validity-dynamic-value-no-change.html WPT test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=233765
+
+        Reviewed by Darin Adler.
+
+        Rebaseline WPT test that is now passing.
+
+        * web-platform-tests/html/semantics/forms/constraints/input-number-validity-dynamic-value-no-change-expected.txt:
+
 2021-12-02  Antti Koivisto  <[email protected]>
 
         [:has() pseudo-class] Invalidation in non-subject position

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/input-number-validity-dynamic-value-no-change-expected.txt (286443 => 286444)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/input-number-validity-dynamic-value-no-change-expected.txt	2021-12-02 19:54:16 UTC (rev 286443)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/input-number-validity-dynamic-value-no-change-expected.txt	2021-12-02 20:09:02 UTC (rev 286444)
@@ -1,4 +1,4 @@
 
 
-FAIL number input number validation is updated correctly after value attribute change which doesn't change input value assert_true: Input should be valid because step base is @value expected true got false
+PASS number input number validation is updated correctly after value attribute change which doesn't change input value
 

Modified: trunk/Source/WebCore/ChangeLog (286443 => 286444)


--- trunk/Source/WebCore/ChangeLog	2021-12-02 19:54:16 UTC (rev 286443)
+++ trunk/Source/WebCore/ChangeLog	2021-12-02 20:09:02 UTC (rev 286444)
@@ -1,3 +1,19 @@
+2021-12-02  Chris Dumez  <[email protected]>
+
+        html/semantics/forms/constraints/input-number-validity-dynamic-value-no-change.html WPT test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=233765
+
+        Reviewed by Darin Adler.
+
+        Per https://html.spec.whatwg.org/#concept-input-min-zero, step base needs to be computed based on
+        the 'min' attribute, then fallback to the 'value' attribute and finally fallback to the default
+        step base. WebKit was missing the "fallback to the 'value' attribute logic.
+
+        No new tests, rebaselined existing test.
+
+        * html/NumberInputType.cpp:
+        (WebCore::NumberInputType::createStepRange const):
+
 2021-12-02  Tim Nguyen  <[email protected]>
 
         Fix crash in GraphicsContextCG::endTransparencyLayer

Modified: trunk/Source/WebCore/html/NumberInputType.cpp (286443 => 286444)


--- trunk/Source/WebCore/html/NumberInputType.cpp	2021-12-02 19:54:16 UTC (rev 286443)
+++ trunk/Source/WebCore/html/NumberInputType.cpp	2021-12-02 20:09:02 UTC (rev 286444)
@@ -147,7 +147,10 @@
     static NeverDestroyed<const StepRange::StepDescription> stepDescription(numberDefaultStep, numberDefaultStepBase, numberStepScaleFactor);
 
     ASSERT(element());
-    const Decimal stepBase = parseToDecimalForNumberType(element()->attributeWithoutSynchronization(minAttr), numberDefaultStepBase);
+    Decimal stepBase = parseToDecimalForNumberType(element()->attributeWithoutSynchronization(minAttr), Decimal::nan());
+    if (stepBase.isNaN())
+        stepBase = parseToDecimalForNumberType(element()->attributeWithoutSynchronization(valueAttr), numberDefaultStepBase);
+
     // FIXME: We should use numeric_limits<double>::max for number input type.
     const Decimal floatMax = Decimal::fromDouble(std::numeric_limits<float>::max());
     const Element& element = *this->element();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to