Summary: | :in-range & :out-of-range CSS pseudo-classes shouldn't match inputs without range limitations | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Chris Rebert <webkit> | ||||||||||||
Component: | CSS | Assignee: | Benjamin Poulain <benjamin> | ||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||
Severity: | Normal | CC: | benjamin, commit-queue, dino, koivisto, rniwa | ||||||||||||
Priority: | P2 | Keywords: | HasReduction, W3CTest | ||||||||||||
Version: | WebKit Nightly Build | ||||||||||||||
Hardware: | All | ||||||||||||||
OS: | All | ||||||||||||||
URL: | http://w3c-test.org/html/semantics/selectors/pseudo-classes/inrange-outofrange.html | ||||||||||||||
Attachments: |
|
Description
Chris Rebert
2016-04-13 15:09:39 PDT
Created attachment 276362 [details]
Screenshot of testcase on iOS
Created attachment 281406 [details]
Patch
Created attachment 281423 [details]
Patch
Comment on attachment 281423 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=281423&action=review > Source/WebCore/html/InputType.cpp:343 > + return false; Shouldn't this return true? If the input has no range limitations, aren't you aways in-range? > Source/WebCore/html/NumberInputType.cpp:170 > + const AtomicString& minAttribute = element.fastGetAttribute(minAttr); > + Decimal minimumFromAttribute = parseToNumberOrNaN(minAttribute); > + if (minimumFromAttribute.isFinite()) { > + hasRangeLimitations = true; > + minimum = minimumFromAttribute; > + } I think this could go into a separate function or lambda and be shared. > Source/WebCore/html/StepRange.h:74 > + StepRange(const Decimal& stepBase, bool hasRangeLimitations, const Decimal& minimum, const Decimal& maximum, const Decimal& step, const StepDescription&); Please make an enum for hasRangeLimitations. The call sites are unreadable with this change. (In reply to comment #4) > View in context: > https://bugs.webkit.org/attachment.cgi?id=281423&action=review > > > Source/WebCore/html/InputType.cpp:343 > > + return false; > > Shouldn't this return true? If the input has no range limitations, aren't > you aways in-range? The way the spec defines it, you are only in range if there is a valid range to begin with. In this case, since you have no range or and invalid range, you are not in-range. Created attachment 281480 [details]
Patch for landing
Comment on attachment 281480 [details] Patch for landing Clearing flags on attachment: 281480 Committed r202143: <http://trac.webkit.org/changeset/202143> All reviewed patches have been landed. Closing bug. Wonderful! I look forward to the next Tech Preview release so that I can update http://caniuse.com/#feat=css-in-out-of-range to reflect this fix. (In reply to comment #9) > Wonderful! I look forward to the next Tech Preview release so that I can > update http://caniuse.com/#feat=css-in-out-of-range to reflect this fix. Your bug report was really high quality. Thanks a lot for taking the time to write a test case and highlight the relevant spec. |