Changeset 289209 in webkit


Ignore:
Timestamp:
Feb 7, 2022 5:51:03 AM (5 months ago)
Author:
Ziran Sun
Message:

[Forms] Use min as default value when min > max for input type="range"
https://bugs.webkit.org/show_bug.cgi?id=236223

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Update the sub test expectation that is now passing.

  • web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt:

Source/WebCore:

As per spec https://html.spec.whatwg.org/multipage/input.html#concept-input-value-default-range,
in the case of "the maximum is less than the minimum, in which case the default value is the minimum".

  • html/RangeInputType.cpp:

(WebCore::ensureMaximum):
(WebCore::RangeInputType::createStepRange const):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r289194 r289209  
     12022-02-07  Ziran Sun  <zsun@igalia.com>
     2
     3        [Forms] Use min as default value when min > max for input type="range"
     4        https://bugs.webkit.org/show_bug.cgi?id=236223
     5
     6        Reviewed by Darin Adler.
     7
     8        Update the sub test expectation that is now passing.
     9        * web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt:
     10
    1112022-02-06  Sam Weinig  <weinig@apple.com>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/range-expected.txt

    r289075 r289209  
    1515PASS default value when min and max attributes are given (= min plus half the difference between min and max)
    1616PASS default value with step control when both min and max attributes are given
    17 FAIL default value when both min and max attributes are given, while min > max assert_equals: expected "2" but got "51"
     17PASS default value when both min and max attributes are given, while min > max
    1818PASS The default step scale factor is 1, unless min attribute has non-integer value
    1919PASS Step scale factor behavior when min attribute has integer value but max attribute is non-integer
  • trunk/Source/WebCore/ChangeLog

    r289208 r289209  
     12022-02-07  Ziran Sun  <zsun@igalia.com>
     2
     3        [Forms] Use min as default value when min > max for input type="range"
     4        https://bugs.webkit.org/show_bug.cgi?id=236223
     5
     6        Reviewed by Darin Adler.
     7
     8        As per spec https://html.spec.whatwg.org/multipage/input.html#concept-input-value-default-range,
     9        in the case of "the maximum is less than the minimum, in which case the default value is the minimum".
     10
     11        * html/RangeInputType.cpp:
     12        (WebCore::ensureMaximum):
     13        (WebCore::RangeInputType::createStepRange const):
     14
    1152022-02-07  Joonghun Park  <jh718.park@samsung.com>
    216
  • trunk/Source/WebCore/html/RangeInputType.cpp

    r284972 r289209  
    7676static const StepRange::StepDescription rangeStepDescription { rangeDefaultStep, rangeDefaultStepBase, rangeStepScaleFactor };
    7777
    78 static Decimal ensureMaximum(const Decimal& proposedValue, const Decimal& minimum, const Decimal& fallbackValue)
    79 {
    80     return proposedValue >= minimum ? proposedValue : std::max(minimum, fallbackValue);
     78static Decimal ensureMaximum(const Decimal& proposedValue, const Decimal& minimum)
     79{
     80    return proposedValue >= minimum ? proposedValue : minimum;
    8181}
    8282
     
    119119    ASSERT(element());
    120120    const Decimal minimum = parseToNumber(element()->attributeWithoutSynchronization(minAttr), rangeDefaultMinimum);
    121     const Decimal maximum = ensureMaximum(parseToNumber(element()->attributeWithoutSynchronization(maxAttr), rangeDefaultMaximum), minimum, rangeDefaultMaximum);
     121    const Decimal maximum = ensureMaximum(parseToNumber(element()->attributeWithoutSynchronization(maxAttr), rangeDefaultMaximum), minimum);
    122122
    123123    const AtomString& precisionValue = element()->attributeWithoutSynchronization(precisionAttr);
Note: See TracChangeset for help on using the changeset viewer.