Commit 49ae4a16 authored by eric@webkit.org's avatar eric@webkit.org

2009-08-12 Joseph Pecoraro <joepeck02@gmail.com>

        "Double-click to add" new style button does not always show up [quick fix]
        https://bugs.webkit.org/show_bug.cgi?id=28187

        * inspector/front-end/StylesSidebarPane.js:
        (WebInspector.StylePropertyTreeElement.prototype.updateTitle):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent dbf8a2a6
2009-08-12 Joseph Pecoraro <joepeck02@gmail.com>
"Double-click to add" new style button does not always show up [quick fix]
https://bugs.webkit.org/show_bug.cgi?id=28187
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylePropertyTreeElement.prototype.updateTitle):
2009-08-12 Crystal Zhang <crystal.zhang@torchmobile.com>
Reviewed by George Staikos.
......@@ -896,63 +896,70 @@ WebInspector.StylePropertyTreeElement.prototype = {
// Simple: rgb -> hsl -> nickname? -> shorthex? -> hex -> ...
// Advanced: rgba -> hsla -> nickname? -> ...
if (colors && colors.length === 1) {
var color = new WebInspector.Color(htmlValue);
swatch.addEventListener("click", changeColorDisplay, false);
swatch.addEventListener("dblclick", function(event) {
event.stopPropagation();
}, false);
var mode = color.mode;
var valueElement = this.valueElement;
function changeColorDisplay(event) {
function changeTo(newMode, content) {
mode = newMode;
valueElement.textContent = content;
}
try {
var color = new WebInspector.Color(htmlValue);
} catch(e) {
var color = null;
}
switch (mode) {
case "rgb":
changeTo("hsl", color.toHsl());
break;
if (color) {
swatch.addEventListener("click", changeColorDisplay, false);
swatch.addEventListener("dblclick", function(event) {
event.stopPropagation();
}, false);
case "shorthex":
changeTo("hex", color.toHex());
break;
var mode = color.mode;
var valueElement = this.valueElement;
function changeColorDisplay(event) {
case "hex":
changeTo("rgb", color.toRgb());
break;
function changeTo(newMode, content) {
mode = newMode;
valueElement.textContent = content;
}
case "nickname":
if (color.simple) {
if (color.hasShortHex())
switch (mode) {
case "rgb":
changeTo("hsl", color.toHsl());
break;
case "shorthex":
changeTo("hex", color.toHex());
break;
case "hex":
changeTo("rgb", color.toRgb());
break;
case "nickname":
if (color.simple) {
if (color.hasShortHex())
changeTo("shorthex", color.toShortHex());
else
changeTo("hex", color.toHex());
} else
changeTo("rgba", color.toRgba());
break;
case "hsl":
if (color.nickname)
changeTo("nickname", color.toNickname());
else if (color.hasShortHex())
changeTo("shorthex", color.toShortHex());
else
changeTo("hex", color.toHex());
} else
changeTo("rgba", color.toRgba());
break;
case "hsl":
if (color.nickname)
changeTo("nickname", color.toNickname());
else if (color.hasShortHex())
changeTo("shorthex", color.toShortHex());
else
changeTo("hex", color.toHex());
break;
case "rgba":
changeTo("hsla", color.toHsla());
break;
case "hsla":
if (color.nickname)
changeTo("nickname", color.toNickname());
else
changeTo("rgba", color.toRgba());
break;
break;
case "rgba":
changeTo("hsla", color.toHsla());
break;
case "hsla":
if (color.nickname)
changeTo("nickname", color.toNickname());
else
changeTo("rgba", color.toRgba());
break;
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment