Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b14fa1947cf562889d71ed3581fa184c27ab6536
      
https://github.com/WebKit/WebKit/commit/b14fa1947cf562889d71ed3581fa184c27ab6536
  Author: Chris Dumez <[email protected]>
  Date:   2026-03-28 (Sat, 28 Mar 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-time-reversed-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-time-reversed.html
    M Source/WebCore/html/InputType.cpp

  Log Message:
  -----------
  :in-range and :out-of-range pseudo-classes are wrong for time inputs with 
reversed ranges
https://bugs.webkit.org/show_bug.cgi?id=310976

Reviewed by Anne van Kesteren.

InputType::isInRange() and InputType::isOutOfRange() did not account for
reversed ranges. For <input type="time">, the range can wrap around midnight
(e.g. min="21:00" max="03:00"), making valid values those >= min OR <= max.
The existing code only handled the non-reversed case (value >= min AND
value <= max), causing both functions to return incorrect results for any
time input with min > max.

rangeUnderflow() and rangeOverflow() already handled this correctly via
StepRange::isReversible(), but isInRange() and isOutOfRange() were missing
the equivalent check.

Also fixed a misleading comment on isOutOfRange() that said "both" where
the logic checks "either".

Test: 
imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-time-reversed.html

* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-time-reversed-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-time-reversed.html:
 Added.
* Source/WebCore/html/InputType.cpp:
(WebCore::InputType::isInRange const):
(WebCore::InputType::isOutOfRange const):

Canonical link: https://commits.webkit.org/310156@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to