Bug 28889

Summary: Inspector toggled colors should remember their state across sessions
Product: WebKit Reporter: mitch kramer <boards>
Component: Web Inspector (Deprecated)Assignee: Timothy Hatcher <timothy>
Status: RESOLVED FIXED    
Severity: Normal CC: aroben, joepeck, timothy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Screen Shot
none
Proposed Patch mitz: review+

Description mitch kramer 2009-09-01 14:08:48 PDT
In the web inspector in the nightly builds, you can now click on the color swatch to toggle through the various versions of that color. This is great, however, it should remember what state it was left in and all color references should obey that preference when using the inspector in the future.
Comment 1 Timothy Hatcher 2009-09-06 10:38:35 PDT
I have a patch for this coming up.
Comment 2 Timothy Hatcher 2009-09-06 10:40:44 PDT
The design I went with lets you toggle individual colors freely wit hno persistence, but there is now a global setting to pick the default format — Hex, RGB or HSL.
Comment 3 Timothy Hatcher 2009-09-06 11:38:40 PDT
Created attachment 39123 [details]
Screen Shot
Comment 4 Timothy Hatcher 2009-09-06 11:47:29 PDT
Created attachment 39124 [details]
Proposed Patch
Comment 5 mitz 2009-09-06 11:56:34 PDT
Comment on attachment 39124 [details]
Proposed Patch

> +                swatchElement.title = WebInspector.UIString("Click to change color format.");

The new style for tool tips is without a trailing period!

> +                if (Preferences.colorFormat === "rgb") {
> +                    if (Preferences.showColorNicknames && color.nickname)
> +                        format = "nickname";
> +                    else
> +                        format = (color.simple ? "rgb" : "rgba");
> +                } else if (Preferences.colorFormat === "hsl") {
> +                    if (Preferences.showColorNicknames && color.nickname)
> +                        format = "nickname";
> +                    else
> +                        format = (color.simple ? "hsl" : "hsla");
> +                } else {
> +                    if (Preferences.showColorNicknames && color.nickname)
> +                        format = "nickname";
> +                    else if (color.simple)
> +                        format = (color.hasShortHex() ? "shorthex" : "hex");
> +                    else
> +                        format = "rgba";
> +                }

You can test for the (Preferences.showColorNicknames && color.nickname) condition first instead of repeating it three times.
Comment 6 Timothy Hatcher 2009-09-06 13:45:16 PDT
Committed r48102: <http://trac.webkit.org/changeset/48102>