Bug 50308 - Reject named colors, accept only #rrggbb in <input type=color />
Summary: Reject named colors, accept only #rrggbb in <input type=color />
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-30 21:25 PST by Dai Mikurube
Modified: 2010-12-02 09:11 PST (History)
1 user (show)

See Also:


Attachments
Patch (4.67 KB, patch)
2010-11-30 21:40 PST, Dai Mikurube
no flags Details | Formatted Diff | Diff
Patch (4.72 KB, patch)
2010-11-30 21:50 PST, Dai Mikurube
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.