Bug 29071 - [HTML5][Forms] Support for :in-range and :out-of-range CSS selectors
Summary: [HTML5][Forms] Support for :in-range and :out-of-range CSS selectors
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://www.whatwg.org/specs/web-apps/...
Keywords:
: 27450 (view as bug list)
Depends on: 28868 29069
Blocks: 27450
  Show dependency treegraph
 
Reported: 2009-09-08 23:14 PDT by Kent Tamura
Modified: 2010-12-29 10:30 PST (History)
10 users (show)

See Also:


Attachments
Patch. (18.38 KB, patch)
2010-12-28 17:23 PST, Yael
tkent: review-
Details | Formatted Diff | Diff
Patch. (21.06 KB, patch)
2010-12-29 06:11 PST, Yael
tkent: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2009-09-08 23:14:44 PDT
Implement :in-range and :out-of-range selectors.  They should reflect ValidityState.rangeOverflow and .rangeUnderflow lively.
Comment 1 Peter Kasting 2010-04-29 16:48:13 PDT
*** Bug 27450 has been marked as a duplicate of this bug. ***
Comment 2 Yael 2010-12-28 17:23:25 PST
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 3 Kent Tamura 2010-12-29 04:29:54 PST
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
Comment 4 Yael 2010-12-29 06:11:24 PST
Created attachment 77614 [details]
Patch.

Thank you for the review. I updated the patch based on your comments.
Comment 5 Kent Tamura 2010-12-29 06:22:24 PST
Comment on attachment 77614 [details]
Patch.

Looks good!
Comment 6 Yael 2010-12-29 06:27:33 PST
Thank you for the review!
Comment 7 Yael 2010-12-29 08:02:37 PST
Committed r74744. <http://trac.webkit.org/changeset/74744>
Comment 8 WebKit Review Bot 2010-12-29 10:26:11 PST
http://trac.webkit.org/changeset/74744 might have broken GTK Linux 64-bit Debug
Comment 9 Yael 2010-12-29 10:30:22 PST
(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.