[webkit-reviews] review granted: [Bug 216090] [macOS] Support stepping using keyboard in date inputs : [Attachment 407795] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Sep 2 21:13:36 PDT 2020
Darin Adler <darin at apple.com> has granted Aditya Keerthi <akeerthi at apple.com>'s
request for review:
Bug 216090: [macOS] Support stepping using keyboard in date inputs
https://bugs.webkit.org/show_bug.cgi?id=216090
Attachment 407795: Patch
https://bugs.webkit.org/attachment.cgi?id=407795&action=review
--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 407795
--> https://bugs.webkit.org/attachment.cgi?id=407795
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=407795&action=review
> Source/WebCore/html/shadow/DateTimeFieldElement.cpp:102
> + if (key == "Up") {
> + keyboardEvent.setDefaultHandled();
> + stepUp();
> + return;
> + }
> +
> + if (key == "Down") {
> + keyboardEvent.setDefaultHandled();
> + stepDown();
> + return;
> + }
Code above calls setDefaultHandled after handling. This code and the code below
calls it before handling. I suggest we consider a consistent pattern of doing
setDefaultHandled last.
> Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp:102
> + m_typeAheadBuffer.clear();
> + setValueAsInteger(newValue, DispatchInputAndChangeEvents);
Would be nice to share this between up and down. I know it’s just two lines of
code.
> Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp:82
> + int newValue = hasValue() ? m_selectedIndex - 1 : m_symbols.size() - 1;
> + if (newValue < 0)
> + newValue = m_symbols.size() - 1;
Can m_symbols be empty?
> Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp:89
> + if (newValue == static_cast<int>(m_symbols.size()))
Nicer to use >=
More information about the webkit-reviews
mailing list