Summary: | Apply :invalid CSS class to <input type=number> with an unacceptable value | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Kent Tamura <tkent> | ||||
Component: | Forms | Assignee: | Kent Tamura <tkent> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | abarth, adele, aestes, darin, dglazkov, eric, webkit.review.bot | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Bug Depends on: | 43973 | ||||||
Bug Blocks: | |||||||
Attachments: |
|
Description
Kent Tamura
2010-09-08 02:31:28 PDT
Created attachment 66861 [details]
Patch (EWS failure expected)
Comment on attachment 66861 [details] Patch (EWS failure expected) View in context: https://bugs.webkit.org/attachment.cgi?id=66861&action=prettypatch Ok. > WebCore/dom/Element.h:284 > + virtual bool hasUnacceptableValue() const { return false; } Darin Adler taught me it would be better to have bodies of virtuals in the cpp files, even inlines. But for consistency with the other methods, I don't think it makes sense to ask you to redo this. > WebCore/html/HTMLInputElement.cpp:831 > + if (inputType() == NUMBER) { One day we will rework HTMLInputElement to eliminate all this inputType() == FOO cruft. But not today. > WebCore/rendering/RenderTextControlSingleLine.cpp:178 > + static_cast<HTMLInputElement*>(input)->setNeedsStyleRecalc(); And we'll remove this cruft too :) (In reply to comment #2) > > WebCore/html/HTMLInputElement.cpp:831 > > + if (inputType() == NUMBER) { > One day we will rework HTMLInputElement to eliminate all this inputType() == FOO cruft. But not today. If we can afford one additional memory allocation per input element, and I think we can, all we need to do is to create a class for the input type and replace all the switch and if statements with virtual function calls on that object. Should be simple refactoring! (In reply to comment #3) > > > + if (inputType() == NUMBER) { > > One day we will rework HTMLInputElement to eliminate all this inputType() == FOO cruft. But not today. > > If we can afford one additional memory allocation per input element, and I think we can, all we need to do is to create a class for the input type and replace all the switch and if statements with virtual function calls on that object. Should be simple refactoring! I agree! I have wanted to do so since I started to work on Forms. I guess virtual method call is not slower than switch-case, and the object size would be smaller. Comment on attachment 66861 [details] Patch (EWS failure expected) Clearing flags on attachment: 66861 Committed r67166: <http://trac.webkit.org/changeset/67166> All reviewed patches have been landed. Closing bug. http://trac.webkit.org/changeset/67166 might have broken Qt Linux Release minimal It looks like this fix caused a regression related to input elements with placeholder text. See <https://bugs.webkit.org/show_bug.cgi?id=45940> for details. |