Bug 28889 - Inspector toggled colors should remember their state across sessions
Summary: Inspector toggled colors should remember their state across sessions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Timothy Hatcher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-01 14:08 PDT by mitch kramer
Modified: 2009-09-06 13:45 PDT (History)
3 users (show)

See Also:


Attachments
Screen Shot (35.36 KB, image/png)
2009-09-06 11:38 PDT, Timothy Hatcher
no flags Details
Proposed Patch (19.54 KB, patch)
2009-09-06 11:47 PDT, Timothy Hatcher
mitz: review+
Details | Formatted Diff | Diff

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