[Webkit-unassigned] [Bug 120559] [Forms:color] ColorInputType::didChooseColor should set sanitize value in element.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 4 09:55:42 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=120559





--- Comment #6 from Santosh Mahto <santosh.ma at samsung.com>  2013-09-04 09:55:00 PST ---
(In reply to comment #5)
> So <input type=color> does not support colors with alpha values, and the solution here is to turn colors with alpha into solid black by "sanitizing" the value?
You are Right...

> That seems counter-intuitive. Since colors with alpha values are not allowed by the API, it would be better if they could not be selected at all. If that's not possible due to platform color picker restrictions, I think we should just always force the alpha component to 1.0.

But its not about only alpha value, its about invalid color selecting e.g "RED". and also lowercase translation,
 ie if we set value = '#RRGGBB' by javascript the value set will be sanitized to lowercase so value set will  be value = '#rrggbb' in string format.
input-value-sanitization-color.html:  shouldBe('input.value = "#DEF012"; input.value', '"#def012"');

But if we set '#RRGGBB' by color selector it will be same as '#RRGGBB' without sanitize.


Valid/Invalid color decision is done(and appropriate) in ColorInputType.cpp and is right place to to adjustment for wrong value.I feel we should not let other part of code to modify color based on what [Input type=Color] accepts.

JavaScript call can try to set any color value, but we do sanitize before adding in DOM node in HTMLInputElement::setValue().

Sanitizing Color convert any invalid color to fallback color(#) as input-value-sanitization-color.html test case specify.
//
// Invalid values
shouldBe('input.value = "000000"; input.value', fallbackValue);
shouldBe('input.value = "#FFF"; input.value', fallbackValue);
shouldBe('input.value = " #ffffff"; input.value', fallbackValue);
shouldBe('input.value = "#ffffff "; input.value', fallbackValue);
shouldBe('input.value = "#00112233"; input.value', fallbackValue);
shouldBe('input.value = "rgb(0,0,0)"; input.value', fallbackValue);

I think I should have returned if color is invalid, otherwise it will update the current color with fallback value(solid black color).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list