Summary: | [HTML5][Forms] Support for :in-range and :out-of-range CSS selectors | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Kent Tamura <tkent> | ||||||
Component: | Forms | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | abarth, adele, commit-queue, darin, eric, hyatt, michelangelo, pkasting, webkit.review.bot, yael | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
URL: | http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#selector-in-range | ||||||||
Bug Depends on: | 28868, 29069 | ||||||||
Bug Blocks: | 27450 | ||||||||
Attachments: |
|
Description
Kent Tamura
2009-09-08 23:14:44 PDT
*** Bug 27450 has been marked as a duplicate of this bug. *** Created attachment 77592 [details]
Patch.
Add support for :in-range and :out-of-range. They simply check InputType::rangeOverflow() and InputType::rangeUnderflow() to make a decision.
Note that WebKit clamps the value of input[type=range], so it will never be :out-of-range. It will also never be :invalid.
Comment on attachment 77592 [details] Patch. View in context: https://bugs.webkit.org/attachment.cgi?id=77592&action=review Thank you for working on this! > WebCore/css/CSSStyleSelector.cpp:2678 > + case CSSSelector::PseudoInRange: > + return e && e->isInRange(); > + case CSSSelector::PseudoOutOfRange: > + return e && e->isOutOfRange(); Please add document()->setContainsValidaityStyleRules() like PseudoValid and PseudoInvalid, and update CSSStyleSelector::canShareStyleWithElement(). > WebCore/html/InputType.h:93 > virtual bool supportsRequired() const; > + virtual bool supportsRangeLimitation() const; > virtual bool valueMissing(const String&) const; nit: supportsRangeLimitation() should be put just before rangeUnderflow(). > WebCore/html/NumberInputType.h:65 > + virtual bool supportsRangeLimitation() const { return true; } nit: We have no reason to have the body of a virtual function in a header file. > WebCore/html/RangeInputType.h:62 > + virtual bool supportsRangeLimitation() const { return true; } ditto. > LayoutTests/ChangeLog:16 > + * fast/forms/controls-in-range-expected.txt: Added. > + * fast/forms/controls-in-range.html: Added. > + * fast/forms/controls-invalid-value-in-range-expected.txt: Added. > + * fast/forms/controls-invalid-value-in-range.html: Added. > + * fast/forms/controls-out-of-range-expected.txt: Added. > + * fast/forms/controls-out-of-range.html: Added. > + * fast/forms/script-tests/controls-in-range.js: Added. > + * fast/forms/script-tests/controls-invalid-value-in-range.js: Added. > + * fast/forms/script-tests/controls-out-of-range.js: Added. These tests should be named as fast/css/pseudo-*.html Created attachment 77614 [details]
Patch.
Thank you for the review. I updated the patch based on your comments.
Comment on attachment 77614 [details]
Patch.
Looks good!
Thank you for the review! Committed r74744. <http://trac.webkit.org/changeset/74744> http://trac.webkit.org/changeset/74744 might have broken GTK Linux 64-bit Debug (In reply to comment #8) > http://trac.webkit.org/changeset/74744 might have broken GTK Linux 64-bit Debug Not likely. The test editing/selection/extend-by-character-005.html has been failing intermittently for a while now. |