RESOLVED FIXED 27357
Support :valid/:invalid CSS selectors
https://bugs.webkit.org/show_bug.cgi?id=27357
Summary Support :valid/:invalid CSS selectors
Michelangelo De Simone
Reported 2009-07-16 16:18:04 PDT
Support for new CSS pseudoclasses from HTML5 specs should be added. Among them, ":valid" and ":invalid" have priority.
Attachments
Patch v1 (27.57 KB, patch)
2009-08-16 18:21 PDT, Michelangelo De Simone
no flags
Same as v1: revised changelog (27.59 KB, patch)
2009-08-18 05:59 PDT, Michelangelo De Simone
no flags
Correction (1.39 KB, patch)
2009-08-19 10:35 PDT, Michelangelo De Simone
darin: review+
Peter Kasting
Comment 1 2009-07-16 16:32:56 PDT
Can you list all the selectors that need to be added? This bug is kind of vague.
Michelangelo De Simone
Comment 2 2009-07-16 16:48:55 PDT
(In reply to comment #1) > Can you list all the selectors that need to be added? This bug is kind of > vague. :out-of-range :in-range :valid :invalid :default (:required and :optional are waiting for review). As far as I can say it's not extremely ctitical at this time but for :valid and :invalid it's possibile to rely on validity.valid and willvalidate.
Peter Kasting
Comment 3 2009-07-20 11:43:08 PDT
:required and :optional have now landed on bug 25551. :in-range and :out-of-range are covered by bug 27450.
Peter Kasting
Comment 4 2009-07-20 12:33:02 PDT
Bug 27458 now covers :default. Narrowing the scope of this to just cover the selectors not covered elsewhere. :valid/:invalid should be pretty easy to support given the existing validity machinery.
Michelangelo De Simone
Comment 5 2009-08-16 18:21:34 PDT
Created attachment 34943 [details] Patch v1
Michelangelo De Simone
Comment 6 2009-08-16 18:26:04 PDT
A note worth to be mentioned is that "willValidate" is missing from official Object's idl, Hixie and I discussed about it in #webkit and it's gonna be added soon.
Adele Peterson
Comment 7 2009-08-17 18:17:46 PDT
Comment on attachment 34943 [details] Patch v1 r=me. A few comments about the log. > diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog > index da90953..e7dbea2 100644 > --- a/WebCore/ChangeLog > +++ b/WebCore/ChangeLog > @@ -1,3 +1,44 @@ > +2009-08-16 Michelangelo De Simone <micdesim@gmail.com> > + > + Reviewed by NOBODY (OOPS!). > + > + https://bugs.webkit.org/show_bug.cgi?id=27357 > + Support for :valid and :invalid CSS selectors, from HTML5 specs. > + http://www.whatwg.org/specs/web-apps/current-work/#selector-valid > + > + Tests: fast/css/pseudo-invalid-001.html > + fast/css/pseudo-invalid-002.html > + fast/css/pseudo-valid-001.html > + fast/css/pseudo-valid-002.html > + fast/css/pseudo-valid-003.html > + fast/css/pseudo-valid-004.html > + fast/css/pseudo-valid-005.html > + fast/css/pseudo-valid-006.html > + fast/css/pseudo-valid-007.html > + > + * css/CSSSelector.cpp: > + (WebCore::CSSSelector::extractPseudoType): extracts new pseudos should say "pseudo-classes" instead of "pseudos" throughout the log > + * css/CSSSelector.h: > + (WebCore::CSSSelector::): > + * css/CSSStyleSelector.cpp: > + (WebCore::CSSStyleSelector::canShareStyleWithElement): style sharing > + mechanism rests for valid/invalid form control elements I think you want to say something like "Make sure we don't share style between form controls that have different validity states" > + (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): applies > + style associated to new pseudos > + * dom/Element.h: > + (WebCore::Element::willValidate): pushed up in hiearchy typo. > + (WebCore::Element::isValidFormControlElement): checks for valid form > + control elements (wraps ValidityState::valid()) > + * html/HTMLFormControlElement.cpp: > + (WebCore::HTMLFormControlElement::willValidate): minor clean up > + (WebCore::HTMLFormControlElement::isValidFormControlElement): ditto > + * html/HTMLFormControlElement.h: > + * html/HTMLKeygenElement.h: > + (WebCore::HTMLKeygenElement::willValidate): added > + * html/HTMLObjectElement.h: > + (WebCore::HTMLObjectElement::willValidate): added > + * html/HTMLObjectElement.idl: > + > 2009-08-16 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> > > Reviewed by George Staikos.
Michelangelo De Simone
Comment 8 2009-08-18 05:59:36 PDT
Created attachment 35039 [details] Same as v1: revised changelog
Peter Kasting
Comment 9 2009-08-18 12:49:41 PDT
Comment on attachment 35039 [details] Same as v1: revised changelog Because adele r+ed the original patch with a couple of comments, I'm going to land this patch, since it only differs from that one in terms of addressing those comments.
Peter Kasting
Comment 10 2009-08-18 12:50:17 PDT
Fixed in r47444.
Darin Adler
Comment 11 2009-08-18 23:44:23 PDT
Why did you add willValidate overrides to HTMLKeygenElement and HTMLObjectElement that always return false, just like the willValidate function in the Element base class? These have no effect and just clutter up the code.
Peter Kasting
Comment 12 2009-08-19 09:50:59 PDT
Reopening until Darin's comment is addressed. I can write a quick patch to rip these two out when I get in today.
Michelangelo De Simone
Comment 13 2009-08-19 10:09:53 PDT
(In reply to comment #11) > Why did you add willValidate overrides to HTMLKeygenElement and > HTMLObjectElement that always return false, just like the willValidate function > in the Element base class? These have no effect and just clutter up the code. A correction is underway.
Darin Adler
Comment 14 2009-08-19 10:17:07 PDT
(In reply to comment #13) > A correction is underway. Great! Note that it may not be just those two classes.
Michelangelo De Simone
Comment 15 2009-08-19 10:25:14 PDT
(In reply to comment #14) > Great! Note that it may not be just those two classes. Uhmmm, as far as I can see the unnecessary overridden methods are just those two; willValidate() should be true only when FormControlElements are validable and most of the stuff was already there (I addressed it in #20101 last year). Adding those two method has been a mistake due to rush.:) It'll be solved in minutes, just the time to double check layouttests.
Michelangelo De Simone
Comment 16 2009-08-19 10:35:29 PDT
Created attachment 35129 [details] Correction
Peter Kasting
Comment 17 2009-08-19 10:58:35 PDT
Fixed in r47514.
Note You need to log in before you can comment on or make changes to this bug.