RESOLVED FIXED 29358
<input type=color> UI
https://bugs.webkit.org/show_bug.cgi?id=29358
Summary <input type=color> UI
Kent Tamura
Reported 2009-09-17 21:00:53 PDT
Add dedicated UI for <input type=color>.
Attachments
Color picker (32.19 KB, image/png)
2011-02-10 17:50 PST, Aaron
no flags
Patch (47.79 KB, patch)
2011-05-23 05:11 PDT, Keishi Hattori
keishi: review-
implements UI appearance (56.77 KB, patch)
2011-05-23 05:27 PDT, Keishi Hattori
keishi: review-
Alfred Morgan
Comment 1 2010-04-17 10:48:39 PDT
I would like to help implement this feature if I can. I just don't know where/how to start.
Hajime Morrita
Comment 2 2010-04-17 10:52:43 PDT
(In reply to comment #1) > I would like to help implement this feature if I can. I just don't know > where/how to start. Searching ChangeLog for similar implementation will be a good starting point. To find out what to search, Bug 19264 will be helpful.
Kent Tamura
Comment 3 2010-04-20 03:39:14 PDT
(In reply to comment #1) > I would like to help implement this feature if I can. I just don't know > where/how to start. The process would be: 1. Define new value for -webkit-appearance See CSSStyleSelector::SelectorChecker::checkOneSelector() 2. Implement the appearance (rendering/RenderTheme*) 3. Assign the appearance for input[type=color] (css/html.css) 4. Implement UI behavior - Add a new function to page/Chrome and page/ChromeClient to open a color picker (See runOpenPanel() - Implement it for various platforms - Add a click handling to html/HTMLInputElement.cpp defaultEventHandler()
Alfred Morgan
Comment 4 2010-04-20 09:50:24 PDT
Thank you Kent. This is great. > - Implement it for various platforms I'm going to need help doing this task. I can do the generics and the Mac platform.
Keishi Hattori
Comment 5 2010-10-15 00:50:05 PDT
I was interested in this for Bug 25032, so I've started working on this. As a first step, I am trying to draw a NSColorWell and I have a couple of questions. 1. https://docs.google.com/View?id=dch3zh37_0cf8kc8c4 proposes implementing it like this. input[type="color"]::-webkit-input-color-button { -webkit-appearance: color-button; } But do I need to create -webkit-input-color-button pseudo element? Why can't I do this? input[type="color"] { -webkit-appearance: color-button; } 2. NSColorWell does not have NSCell. How should I paint it?
Kent Tamura
Comment 6 2010-10-15 02:05:21 PDT
(In reply to comment #5) > I was interested in this for Bug 25032, so I've started working on this. As a first step, I am trying to draw a NSColorWell and I have a couple of questions. > > 1. https://docs.google.com/View?id=dch3zh37_0cf8kc8c4 proposes implementing it like this. > > input[type="color"]::-webkit-input-color-button { > -webkit-appearance: color-button; > } > > But do I need to create -webkit-input-color-button pseudo element? Why can't I do this? > > input[type="color"] { > -webkit-appearance: color-button; > } It's ok to omit ::-webkit-input-color-button if the 'color-button' appearance supports all of states such as :disabled :active. I guess it can support. > 2. NSColorWell does not have NSCell. How should I paint it? I think NSColorWell appearance is just a square button + a filled rectangle. So we can use NSButtonCell.
Alfred Morgan
Comment 7 2010-10-15 17:00:39 PDT
> 2. NSColorWell does not have NSCell. How should I paint it? I would like to see it drawn like this: http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGControls/XHIGControls.html%23//apple_ref/doc/uid/TP30000359-TPXREF213 That Google proposal you mentioned looks more like how a <select> is drawn, all the way down to the mini popup. I would rather like to see the color well be clean like in the HIG. It would be nice if your color well element coulb be used as the Color Swatch in the Web Inspector (a small color square with a thin gray border).
Peter Kasting
Comment 8 2010-10-15 17:58:33 PDT
(In reply to comment #7) > I would like to see it drawn like this: > http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGControls/XHIGControls.html%23//apple_ref/doc/uid/TP30000359-TPXREF213 > > That Google proposal you mentioned looks more like how a <select> is drawn, all the way down to the mini popup. This may be an area where different platforms would prefer different styles. The proposal on Google Docs is basically the Windows native UI. The Mac-style color well looks out of place on Windows in the same way that the reverse is true. I don't know whether that causes problems for web developers looking to style the controls.
Keishi Hattori
Comment 9 2010-10-15 18:02:51 PDT
(In reply to comment #6) > > 2. NSColorWell does not have NSCell. How should I paint it? > > I think NSColorWell appearance is just a square button + a filled rectangle. So we can use NSButtonCell. Thanks Kent! I'm busy next week but I'll have my patch ready the week after.
Keishi Hattori
Comment 10 2010-10-15 18:26:41 PDT
(In reply to comment #7) > I would like to see it drawn like this: > http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGControls/XHIGControls.html%23//apple_ref/doc/uid/TP30000359-TPXREF213 Yes. That is all I'm trying to do for my first patch. However I think the mac might also need the popup UI to support the "list" attribute. Maybe something like http://i56.tinypic.com/e6zujn.png in the Interface Builder.
Alfred Morgan
Comment 11 2010-10-15 19:00:54 PDT
> like in the Interface Builder. Oh wow! That's exactly how to do it. I like how clicking on the left half brings the color well right away and can be used as a drop target. And the right half acts as a dropdown with the possibility of text. The popup then contains recently used colors at top, and the @list following that, and then Other… at the bottom. It's perfect.
Aaron
Comment 12 2010-11-30 03:38:35 PST
Eager to see this implemented into the browser as well as Web Inspector. This will be a huge improvement for both.
Joseph Pecoraro
Comment 13 2011-01-18 11:01:57 PST
> I'm busy next week but I'll have my patch ready the week after. Keishi, how did progress go on this?
Aaron
Comment 14 2011-02-10 17:50:33 PST
Created attachment 82080 [details] Color picker
Aaron
Comment 15 2011-02-10 17:50:44 PST
Anyone ever get a chance to add this? I'd like to see something like this for the Inspector. Something simple I found that uses jQuery to build cross-browser compatible HTML5 forms.
Aaron
Comment 16 2011-02-10 17:51:23 PST
Comment on attachment 82080 [details] Color picker Anyone ever get a chance to add this? I'd like to see something like this for the Inspector. Something simple I found that uses jQuery to build cross-browser compatible HTML5 forms.
Kent Tamura
Comment 17 2011-03-09 22:42:26 PST
(In reply to comment #6) > > 2. NSColorWell does not have NSCell. How should I paint it? > > I think NSColorWell appearance is just a square button + a filled rectangle. So we can use NSButtonCell. Probably, having a shadow tree like the following would be enough. <button style="-webkit-appearance: square-button; padding:2px;"><div style="display:inline-block;background-color:yellow;width:16px;height:10px;border:1px black solid"></div></button>
Keishi Hattori
Comment 18 2011-05-23 05:11:11 PDT
Keishi Hattori
Comment 19 2011-05-23 05:16:14 PDT
(In reply to comment #18) > Created an attachment (id=94401) [details] > Patch This first patch does the following - disables the current input type=color implementation - adds ENABLE_INPUT_COLOR feature flag - replace typemismatch with value sanitization
Kent Tamura
Comment 20 2011-05-23 05:21:50 PDT
(In reply to comment #19) > (In reply to comment #18) > > Created an attachment (id=94401) [details] [details] > > Patch > This first patch does the following > - disables the current input type=color implementation > - adds ENABLE_INPUT_COLOR feature flag > - replace typemismatch with value sanitization The code change looks ok. I'll review the patch tomorrow. Anyway, please post an announcement of the new feature flag to webkit-dev. This flag change the existing behavior and will require browser-side implementation, won't it?
Kent Tamura
Comment 21 2011-05-23 05:22:51 PDT
Also, I prefer one patch per one bug.
Keishi Hattori
Comment 22 2011-05-23 05:27:16 PDT
Created attachment 94402 [details] implements UI appearance
Keishi Hattori
Comment 23 2011-05-23 05:29:20 PDT
(In reply to comment #21) > Also, I prefer one patch per one bug. Okay, I'll make separate bugs.
Keishi Hattori
Comment 24 2011-05-23 05:46:47 PDT
(In reply to comment #23) > Okay, I'll make separate bugs. Moved first patch to Bug 61273 Moved second patch to Bug 61275
Hyerim Bae
Comment 25 2011-06-24 23:06:47 PDT
I'm also interested this color input feature. Do you think this feature also can be useful on mobile environment which has small screen with no accurate mouse pointer? I think user can input color value only though keypad via input field. Somebody may want to select color on color picker with mobile environment.
Jon Lee
Comment 26 2011-09-06 13:29:44 PDT
john stalcup
Comment 27 2011-12-12 13:29:25 PST
i want this functionality as well :-/
Jon Lee
Comment 28 2012-01-31 16:33:37 PST
What exactly is the state of the completion of this feature at this point?
Kent Tamura
Comment 29 2013-03-28 01:30:01 PDT
Finished platform-independent part.
Note You need to log in before you can comment on or make changes to this bug.