Bug 50308

Summary: Reject named colors, accept only #rrggbb in <input type=color />
Product: WebKit Reporter: Dai Mikurube <dmikurube>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description Dai Mikurube 2010-11-30 21:25:50 PST
Due to HTML5 "4.10.7.1.15 Color state," <input type=color /> accepts only "simple colors" in the style of #xxxxxx.
> http://www.whatwg.org/specs/web-apps/current-work/multipage/number-state.html#color-state
Comment 1 Dai Mikurube 2010-11-30 21:40:08 PST
Created attachment 75247 [details]
Patch
Comment 2 Kent Tamura 2010-11-30 21:43:17 PST
Comment on attachment 75247 [details]
Patch

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

> WebCore/html/ColorInputType.cpp:53
>      }
> -    // This accepts named colors such as "white".
> -    // FIXME: Reject named colors, accept only #rrggbb.
> -    Color color(value);
> -    return color.isValid() && !color.hasAlpha();
> +    return false;
>  }

We prefer early exit.  So this should be

if (value[0] != '#')
    return false;
// We don't accept #rgb .....
Comment 3 Dai Mikurube 2010-11-30 21:50:20 PST
Created attachment 75249 [details]
Patch
Comment 4 Kent Tamura 2010-11-30 21:51:46 PST
Comment on attachment 75249 [details]
Patch

ok
Comment 5 WebKit Commit Bot 2010-12-02 09:11:28 PST
Comment on attachment 75249 [details]
Patch

Clearing flags on attachment: 75249

Committed r73139: <http://trac.webkit.org/changeset/73139>
Comment 6 WebKit Commit Bot 2010-12-02 09:11:33 PST
All reviewed patches have been landed.  Closing bug.