Bug 92502 - Fix removing invalid values from color input suggestions
Summary: Fix removing invalid values from color input suggestions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keishi Hattori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-27 06:39 PDT by Keishi Hattori
Modified: 2012-07-29 22:49 PDT (History)
4 users (show)

See Also:


Attachments
Patch (1.63 KB, patch)
2012-07-27 06:41 PDT, Keishi Hattori
no flags Details | Formatted Diff | Diff
Patch (4.82 KB, patch)
2012-07-27 07:28 PDT, Keishi Hattori
no flags Details | Formatted Diff | Diff
Patch (2.25 KB, patch)
2012-07-29 21:20 PDT, Keishi Hattori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keishi Hattori 2012-07-27 06:39:18 PDT
Removing invalid values from color input suggestions is broken.
Comment 1 Keishi Hattori 2012-07-27 06:41:44 PDT
Created attachment 154931 [details]
Patch
Comment 2 Kent Tamura 2012-07-27 06:49:23 PDT
Comment on attachment 154931 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=154931&action=review

> Source/WebCore/html/ColorInputType.cpp:229
> -            if (!element()->isValidValue(option->value()))
> +            if (!isValidColorString(option->value()))

I think we should fix HTMLInputElement::isValidValue() in this case.  isValidValue() exists for this purpose.
Comment 3 Keishi Hattori 2012-07-27 07:01:37 PDT
I shouldn't be returning true for typeMismatch etc., so do I need to add a method to InputType and  check that in HTMLInputElement::isValidValue()?
Comment 4 Keishi Hattori 2012-07-27 07:28:59 PDT
Created attachment 154943 [details]
Patch
Comment 5 Build Bot 2012-07-27 07:35:32 PDT
Comment on attachment 154943 [details]
Patch

Attachment 154943 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13367530
Comment 6 WebKit Review Bot 2012-07-27 08:41:12 PDT
Comment on attachment 154943 [details]
Patch

Attachment 154943 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13372493
Comment 7 Early Warning System Bot 2012-07-27 09:56:12 PDT
Comment on attachment 154943 [details]
Patch

Attachment 154943 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/13371564
Comment 8 Early Warning System Bot 2012-07-27 10:14:49 PDT
Comment on attachment 154943 [details]
Patch

Attachment 154943 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/13371566
Comment 9 Gyuyoung Kim 2012-07-27 10:47:04 PDT
Comment on attachment 154943 [details]
Patch

Attachment 154943 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13376570
Comment 10 Darin Adler 2012-07-27 11:26:26 PDT
Comment on attachment 154943 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=154943&action=review

> Source/WebCore/html/InputType.h:310
> +    virtual bool isUsefulValue(const String& value) const;

What does “useful value” mean in this context? How is “useful” different from “valid”? I find this terminology unclear.
Comment 11 Eric Seidel (no email) 2012-07-29 15:22:15 PDT
Comment on attachment 154943 [details]
Patch

The EWS bots are unhappy.
Comment 12 Kent Tamura 2012-07-29 18:34:14 PDT
Comment on attachment 154943 [details]
Patch

What you need to do is just to implement ColorInputType::typeMismatchFor(const String&).

As you know, <input type=color> never cause typeMismatch validation failure because of the aggressive value sanitization.  However implementing typeMismatch() is helpful for HTMLInputElement::isValidValue() because isValidValue() doesn't sanitize the specified string.  NumberInputType does the same thing.

If you feel implementing typeMismatchFor() is hacky, you had better update HTMLInputElement::isValidValue() so that it handles value sanitization correctly.
Comment 13 Keishi Hattori 2012-07-29 21:20:26 PDT
Created attachment 155204 [details]
Patch
Comment 14 Keishi Hattori 2012-07-29 21:21:52 PDT
(In reply to comment #12)
> (From update of attachment 154943 [details])
> What you need to do is just to implement ColorInputType::typeMismatchFor(const String&).
> 
> As you know, <input type=color> never cause typeMismatch validation failure because of the aggressive value sanitization.  However implementing typeMismatch() is helpful for HTMLInputElement::isValidValue() because isValidValue() doesn't sanitize the specified string.  NumberInputType does the same thing.
> 
> If you feel implementing typeMismatchFor() is hacky, you had better update HTMLInputElement::isValidValue() so that it handles value sanitization correctly.

Ok, I implemented typeMismatchFor()
Comment 15 Kent Tamura 2012-07-29 21:30:19 PDT
Comment on attachment 155204 [details]
Patch

ok
Comment 16 WebKit Review Bot 2012-07-29 22:49:46 PDT
Comment on attachment 155204 [details]
Patch

Clearing flags on attachment: 155204

Committed r123997: <http://trac.webkit.org/changeset/123997>
Comment 17 WebKit Review Bot 2012-07-29 22:49:50 PDT
All reviewed patches have been landed.  Closing bug.