[Webkit-unassigned] [Bug 254761] input type=range not using [value] for step base

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 1 15:56:04 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=254761

--- Comment #4 from Ahmad Saleem <ahmad.saleem792 at gmail.com> ---
Adding following function definition in InputType.h:

Decimal findStepBase(const Decimal&) const;

and then following in InputType.cpp:

Decimal InputType::findStepBase(const Decimal& defaultValue) const
{
    Decimal stepBase = parseToNumberOrNaN(element()->attributeWithoutSynchronization(minAttr));
    if (!stepBase.isFinite())
        stepBase = parseToNumber(element()->attributeWithoutSynchronization(valueAttr), defaultValue);
    return stepBase;
}

and then merging first Blink patch from linked bug fixes this bug:

Below: https://src.chromium.org/viewvc/blink?view=revision&revision=166367

NOTE: There is assertion issue later in 'StepRange' so fixing it in one go: https://chromium.googlesource.com/chromium/src.git/+/807ab32fd2e5accda8c5cef2678e0e0af23158b0

____

Changes from Blink patch:

> StepRange.cpp (in function: clampValue())

// Rounds inRangeValue to stepBase + N * step.
    const Decimal roundedValue = roundByStep(inRangeValue, m_stepBase);
    const Decimal clampedValue = roundedValue > m_maximum ? roundedValue - m_step : (roundedValue < m_minimum ? roundedValue + m_step : roundedValue);

and ASSERT fix:

// clampedValue can be outside of [m_minimum, m_maximum] if m_step is huge.
    if (clampedValue < m_minimum || clampedValue > m_maximum)
        return inRangeValue;

and then:

> RangeInputType.cpp (in function: supportsRequired())

const Decimal stepBase = findStepBase(rangeDefaultStepBase);

and updating return:

return StepRange(stepBase, RangeLimitations::Valid, minimum, maximum, step, rangeStepDescription);

____

Still working locally to merge other Blink commit as well to fix this in one go but still wanted to write down progress.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230901/c88860fc/attachment-0001.htm>


More information about the webkit-unassigned mailing list