[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

apavlov at chromium.org apavlov at chromium.org
Sun Feb 20 23:15:31 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 42fc43f10bd21e07bf57adc967492cd31d38c7da
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 19 13:24:59 2011 +0000

    2011-01-19  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: Employ TextPrompt for CSS property name/value autocompletion
            https://bugs.webkit.org/show_bug.cgi?id=52212
    
            WebInspector.CSSKeywordCompletions contains a hand-written list of accepted CSS property value keywords
            for each property. WebInspector.TextPrompt is used to suggest both the name and value keywords while
            editing styles, in place of the old custom suggestion code.
    
            WebCore:
            * inspector/front-end/CSSCompletions.js:
            (WebInspector.CSSCompletions.prototype.startsWith): Fix array-out-of-bounds error.
            * inspector/front-end/CSSKeywordCompletions.js: Added.
            (WebInspector.CSSKeywordCompletions.forProperty):
            * inspector/front-end/StylesSidebarPane.js:
            (WebInspector.StylePropertyTreeElement.prototype.updateTitle):
            (WebInspector.StylePropertyTreeElement.prototype):
            ():
            * inspector/front-end/TextPrompt.js:
            (WebInspector.TextPrompt):
            (WebInspector.TextPrompt.prototype.removeFromElement):
            (WebInspector.TextPrompt.prototype._onKeyDown):
            (WebInspector.TextPrompt.prototype.tabKeyPressed):
            (WebInspector.TextPrompt.prototype.upKeyPressed):
            (WebInspector.TextPrompt.prototype.downKeyPressed):
            (WebInspector.TextPrompt.prototype._moveBackInHistory):
            (WebInspector.TextPrompt.prototype._moveForwardInHistory):
            * inspector/front-end/inspector.css:
            (.auto-complete-text, .editing .auto-complete-text):
            * inspector/front-end/inspector.html:
    
            LayoutTests:
            * inspector/styles-add-blank-property.html: Follow the altered event handling.
            * inspector/styles-url-linkify.html: Eliminate flakiness.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76116 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index aaf952f..c68a6fb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-19  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: Employ TextPrompt for CSS property name/value autocompletion
+        https://bugs.webkit.org/show_bug.cgi?id=52212
+
+        * inspector/styles-add-blank-property.html: Follow the altered event handling.
+        * inspector/styles-url-linkify.html: Eliminate flakiness.
+
 2011-01-19  Dai Mikurube  <dmikurube at google.com>
 
         Reviewed by Kent Tamura.
diff --git a/LayoutTests/inspector/styles-add-blank-property.html b/LayoutTests/inspector/styles-add-blank-property.html
index f496b51..496892d 100644
--- a/LayoutTests/inspector/styles-add-blank-property.html
+++ b/LayoutTests/inspector/styles-add-blank-property.html
@@ -36,7 +36,6 @@ function frontend_dumpInspectedStyle(testController)
     section.expand();
     var treeElement = section.addNewBlankProperty();
     var enterKeyDown = frontend_createKeyEvent("Enter");
-    var incrementKeyDown = frontend_createKeyEvent("Up");
 
     function removeEmpty()
     {
@@ -48,12 +47,11 @@ function frontend_dumpInspectedStyle(testController)
     {
         treeElement.valueElement.dispatchEvent(enterKeyDown);
         testController.runAfterPendingDispatches(removeEmpty.bind(this));
-        frontend_dumpResults(testController);
     }
 
     function incrementAgain()
     {
-        treeElement.valueElement.dispatchEvent(incrementKeyDown);
+        treeElement.valueElement.dispatchEvent(frontend_createKeyEvent("Up"));
         testController.runAfterPendingDispatches(commit.bind(this));
     }
 
@@ -62,7 +60,7 @@ function frontend_dumpInspectedStyle(testController)
     treeElement.nameElement.dispatchEvent(enterKeyDown);
     treeElement.valueElement.textContent = "1px";
     treeElement.valueElement.firstChild.select();
-    treeElement.valueElement.dispatchEvent(incrementKeyDown);
+    treeElement.valueElement.dispatchEvent(frontend_createKeyEvent("Up"));
     testController.runAfterPendingDispatches(incrementAgain.bind(this));
 }
 
diff --git a/LayoutTests/inspector/styles-url-linkify.html b/LayoutTests/inspector/styles-url-linkify.html
index af7ad6d..3bc7acd 100755
--- a/LayoutTests/inspector/styles-url-linkify.html
+++ b/LayoutTests/inspector/styles-url-linkify.html
@@ -22,7 +22,18 @@ function test()
 {
     function dumpHref()
     {
-        var href = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2].propertiesTreeOutline.children[0].valueElement.childNodes[2].href;
+        var href;
+        var valueChildNodes = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2].propertiesTreeOutline.children[0].valueElement.childNodes;
+        for (var i = 0; i < valueChildNodes.length; ++i) {
+            if (valueChildNodes[i].href) {
+                href = valueChildNodes[i].href;
+                break;
+            }
+        }
+        if (!href) {
+            InspectorTest.addResult("href property not found");
+            return;
+        }
         var segments = href.split("/");
         var output = [];
         for (var i = segments.length - 1, minSegment = i - 3; i >= 0 && i >= minSegment; --i)
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index ae2f29e..078ec99 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2011-01-19  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: Employ TextPrompt for CSS property name/value autocompletion
+        https://bugs.webkit.org/show_bug.cgi?id=52212
+
+        WebInspector.CSSKeywordCompletions contains a hand-written list of accepted CSS property value keywords
+        for each property. WebInspector.TextPrompt is used to suggest both the name and value keywords while
+        editing styles, in place of the old custom suggestion code.
+
+        * inspector/front-end/CSSCompletions.js:
+        (WebInspector.CSSCompletions.prototype.startsWith): Fix array-out-of-bounds error.
+        * inspector/front-end/CSSKeywordCompletions.js: Added.
+        (WebInspector.CSSKeywordCompletions.forProperty):
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylePropertyTreeElement.prototype.updateTitle):
+        (WebInspector.StylePropertyTreeElement.prototype):
+        ():
+        * inspector/front-end/TextPrompt.js:
+        (WebInspector.TextPrompt):
+        (WebInspector.TextPrompt.prototype.removeFromElement):
+        (WebInspector.TextPrompt.prototype._onKeyDown):
+        (WebInspector.TextPrompt.prototype.tabKeyPressed):
+        (WebInspector.TextPrompt.prototype.upKeyPressed):
+        (WebInspector.TextPrompt.prototype.downKeyPressed):
+        (WebInspector.TextPrompt.prototype._moveBackInHistory):
+        (WebInspector.TextPrompt.prototype._moveForwardInHistory):
+        * inspector/front-end/inspector.css:
+        (.auto-complete-text, .editing .auto-complete-text):
+        * inspector/front-end/inspector.html:
+
 2011-01-19  Dai Mikurube  <dmikurube at google.com>
 
         Reviewed by Kent Tamura.
diff --git a/Source/WebCore/inspector/front-end/CSSCompletions.js b/Source/WebCore/inspector/front-end/CSSCompletions.js
index e8d7556..f60c297 100644
--- a/Source/WebCore/inspector/front-end/CSSCompletions.js
+++ b/Source/WebCore/inspector/front-end/CSSCompletions.js
@@ -44,7 +44,7 @@ WebInspector.CSSCompletions.prototype = {
             return [];
 
         var results = [];
-        while (this._values[firstIndex].indexOf(prefix) === 0)
+        while (firstIndex < this._values.length && this._values[firstIndex].indexOf(prefix) === 0)
             results.push(this._values[firstIndex++]);
         return results;
     },
diff --git a/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js b/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js
new file mode 100755
index 0000000..ac62aff
--- /dev/null
+++ b/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js
@@ -0,0 +1,438 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.CSSKeywordCompletions = {
+    forProperty: function(propertyName)
+    {
+        var acceptedKeywords = ["initial"];
+        if (propertyName in this._propertyKeywordMap)
+            acceptedKeywords = acceptedKeywords.concat(this._propertyKeywordMap[propertyName]);
+        if (propertyName in this._colorAwareProperties)
+            acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);
+        if (propertyName in WebInspector.StylesSidebarPane.InheritedProperties)
+            acceptedKeywords.push("inherit");
+        return new WebInspector.CSSCompletions(acceptedKeywords);
+    }
+};
+
+WebInspector.CSSKeywordCompletions._colors = [
+    "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red",
+    "silver", "teal", "white", "yellow", "transparent", "currentcolor", "grey", "aliceblue", "antiquewhite",
+    "aquamarine", "azure", "beige", "bisque", "blanchedalmond", "blueviolet", "brown", "burlywood", "cadetblue",
+    "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan",
+    "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange",
+    "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey",
+    "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick",
+    "floralwhite", "forestgreen", "gainsboro", "ghostwhite", "gold", "goldenrod", "greenyellow", "honeydew", "hotpink",
+    "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue",
+    "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink",
+    "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow",
+    "limegreen", "linen", "magenta", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen",
+    "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream",
+    "mistyrose", "moccasin", "navajowhite", "oldlace", "olivedrab", "orangered", "orchid", "palegoldenrod", "palegreen",
+    "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "rosybrown",
+    "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "skyblue", "slateblue",
+    "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "thistle", "tomato", "turquoise", "violet",
+    "wheat", "whitesmoke", "yellowgreen"
+],
+
+WebInspector.CSSKeywordCompletions._colorAwareProperties = [
+    "background", "background-color", "border", "border-color", "border-top", "border-right", "border-bottom",
+    "border-left", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", "color",
+    "outline", "outline-color", "text-line-through", "text-line-through-color", "text-overline", "text-overline-color",
+    "text-shadow", "text-underline", "text-underline-color", "-webkit-text-emphasis", "-webkit-text-emphasis-color"
+].keySet();
+
+WebInspector.CSSKeywordCompletions._propertyKeywordMap = {
+    "table-layout": [
+        "auto", "fixed"
+    ],
+    "visibility": [
+        "hidden", "visible", "collapse"
+    ],
+    "background-repeat": [
+        "repeat", "repeat-x", "repeat-y", "no-repeat", "space", "round"
+    ],
+    "text-underline": [
+        "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
+    ],
+    "content": [
+        "list-item", "close-quote", "no-close-quote", "no-open-quote", "open-quote"
+    ],
+    "list-style-image": [
+        "none"
+    ],
+    "clear": [
+        "none", "left", "right", "both"
+    ],
+    "text-underline-mode": [
+        "continuous", "skip-white-space"
+    ],
+    "overflow-x": [
+        "hidden", "auto", "visible", "overlay", "scroll"
+    ],
+    "stroke-linejoin": [
+        "round", "miter", "bevel"
+    ],
+    "baseline-shift": [
+        "baseline", "sub", "super"
+    ],
+    "border-bottom-width": [
+        "medium", "thick", "thin"
+    ],
+    "marquee-speed": [
+        "normal", "slow", "fast"
+    ],
+    "margin-top-collapse": [
+        "collapse", "separate", "discard"
+    ],
+    "max-height": [
+        "none"
+    ],
+    "box-orient": [
+        "horizontal", "vertical", "inline-axis", "block-axis"
+    ],
+    "font-stretch": [
+        "normal", "wider", "narrower", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed",
+        "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"
+    ],
+    "-webkit-color-correction": [
+        "default", "srgb"
+    ],
+    "text-underline-style": [
+        "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
+    ],
+    "text-overline-mode": [
+        "continuous", "skip-white-space"
+    ],
+    "-webkit-background-composite": [
+        "highlight", "clear", "copy", "source-over", "source-in", "source-out", "source-atop", "destination-over",
+        "destination-in", "destination-out", "destination-atop", "xor", "plus-darker", "plus-lighter"
+    ],
+    "border-left-width": [
+        "medium", "thick", "thin"
+    ],
+    "-webkit-writing-mode": [
+        "lr", "rl", "tb", "lr-tb", "rl-tb", "tb-rl", "horizontal-tb", "vertical-rl", "vertical-lr", "horizontal-bt"
+    ],
+    "text-line-through-mode": [
+        "continuous", "skip-white-space"
+    ],
+    "border-collapse": [
+        "collapse", "separate"
+    ],
+    "page-break-inside": [
+        "auto", "avoid"
+    ],
+    "border-top-width": [
+        "medium", "thick", "thin"
+    ],
+    "outline-color": [
+        "invert"
+    ],
+    "text-line-through-style": [
+        "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
+    ],
+    "outline-style": [
+        "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
+    ],
+    "cursor": [
+        "none", "copy", "auto", "crosshair", "default", "pointer", "move", "vertical-text", "cell", "context-menu",
+        "alias", "progress", "no-drop", "not-allowed", "-webkit-zoom-in", "-webkit-zoom-out", "e-resize", "ne-resize",
+        "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "ew-resize", "ns-resize",
+        "nesw-resize", "nwse-resize", "col-resize", "row-resize", "text", "wait", "help", "all-scroll", "-webkit-grab",
+        "-webkit-grabbing"
+    ],
+    "border-width": [
+        "medium", "thick", "thin"
+    ],
+    "size": [
+        "a3", "a4", "a5", "b4", "b5", "landscape", "ledger", "legal", "letter", "portrait"
+    ],
+    "background-size": [
+        "contain", "cover"
+    ],
+    "direction": [
+        "ltr", "rtl"
+    ],
+    "marquee-direction": [
+        "left", "right", "auto", "reverse", "forwards", "backwards", "ahead", "up", "down"
+    ],
+    "enable-background": [
+        "accumulate", "new"
+    ],
+    "float": [
+        "none", "left", "right"
+    ],
+    "overflow-y": [
+        "hidden", "auto", "visible", "overlay", "scroll"
+    ],
+    "margin-bottom-collapse": [
+        "collapse",  "separate", "discard"
+    ],
+    "box-reflect": [
+        "left", "right", "above", "below"
+    ],
+    "overflow": [
+        "hidden", "auto", "visible", "overlay", "scroll"
+    ],
+    "text-rendering": [
+        "auto", "optimizespeed", "optimizelegibility", "geometricprecision"
+    ],
+    "text-align": [
+        "-webkit-auto", "left", "right", "center", "justify", "-webkit-left", "-webkit-right", "-webkit-center"
+    ],
+    "list-style-position": [
+        "outside", "inside"
+    ],
+    "margin-bottom": [
+        "auto"
+    ],
+    "color-interpolation": [
+        "linearrgb"
+    ],
+    "background-origin": [
+        "border-box", "content-box", "padding-box"
+    ],
+    "word-wrap": [
+        "normal", "break-word"
+    ],
+    "font-weight": [
+        "normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"
+    ],
+    "margin-before-collapse": [
+        "collapse", "separate", "discard"
+    ],
+    "text-overline-width": [
+        "normal", "medium", "auto", "thick", "thin"
+    ],
+    "text-transform": [
+        "none", "capitalize", "uppercase", "lowercase"
+    ],
+    "border-right-style": [
+        "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
+    ],
+    "border-left-style": [
+        "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
+    ],
+    "-webkit-text-emphasis": [
+        "circle", "filled", "open", "dot", "double-circle", "triangle", "sesame"
+    ],
+    "font-style": [
+        "italic", "oblique", "normal"
+    ],
+    "speak": [
+        "none", "normal", "spell-out", "digits", "literal-punctuation", "no-punctuation"
+    ],
+    "text-line-through": [
+        "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave", "continuous",
+        "skip-white-space"
+    ],
+    "color-rendering": [
+        "auto", "optimizespeed", "optimizequality"
+    ],
+    "list-style-type": [
+        "none", "disc", "circle", "square", "decimal", "decimal-leading-zero", "arabic-indic", "binary", "bengali",
+        "cambodian", "khmer", "devanagari", "gujarati", "gurmukhi", "kannada", "lower-hexadecimal", "lao", "malayalam",
+        "mongolian", "myanmar", "octal", "oriya", "persian", "urdu", "telugu", "tibetan", "thai", "upper-hexadecimal",
+        "lower-roman", "upper-roman", "lower-greek", "lower-alpha", "lower-latin", "upper-alpha", "upper-latin", "afar",
+        "ethiopic-halehame-aa-et", "ethiopic-halehame-aa-er", "amharic", "ethiopic-halehame-am-et", "amharic-abegede",
+        "ethiopic-abegede-am-et", "cjk-earthly-branch", "cjk-heavenly-stem", "ethiopic", "ethiopic-halehame-gez",
+        "ethiopic-abegede", "ethiopic-abegede-gez", "hangul-consonant", "hangul", "lower-norwegian", "oromo",
+        "ethiopic-halehame-om-et", "sidama", "ethiopic-halehame-sid-et", "somali", "ethiopic-halehame-so-et", "tigre",
+        "ethiopic-halehame-tig", "tigrinya-er", "ethiopic-halehame-ti-er", "tigrinya-er-abegede",
+        "ethiopic-abegede-ti-er", "tigrinya-et", "ethiopic-halehame-ti-et", "tigrinya-et-abegede",
+        "ethiopic-abegede-ti-et", "upper-greek", "upper-norwegian", "asterisks", "footnotes", "hebrew", "armenian",
+        "lower-armenian", "upper-armenian", "georgian", "cjk-ideographic", "hiragana", "katakana", "hiragana-iroha",
+        "katakana-iroha"
+    ],
+    "-webkit-text-combine": [
+        "none", "horizontal"
+    ],
+    "outline": [
+        "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
+    ],
+    "font": [
+        "caption", "icon", "menu", "message-box", "small-caption", "-webkit-mini-control", "-webkit-small-control",
+        "-webkit-control", "status-bar", "italic", "oblique", "small-caps", "normal", "bold", "bolder", "lighter",
+        "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium",
+        "large", "x-large", "xx-large", "-webkit-xxx-large", "smaller", "larger", "serif", "sans-serif", "cursive",
+        "fantasy", "monospace", "-webkit-body"
+    ],
+    "dominant-baseline": [
+        "middle", "auto", "central", "text-before-edge", "text-after-edge", "ideographic", "alphabetic", "hanging",
+        "mathematical", "use-script", "no-change", "reset-size"
+    ],
+    "display": [
+        "none", "inline", "block", "list-item", "run-in", "compact", "inline-block", "table", "inline-table",
+        "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group",
+        "table-column", "table-cell", "table-caption", "-webkit-box", "-webkit-inline-box", "-wap-marquee"
+    ],
+    "-webkit-text-emphasis-position": [
+        "over", "under"
+    ],
+    "image-rendering": [
+        "auto", "optimizespeed", "optimizequality"
+    ],
+    "alignment-baseline": [
+        "baseline", "middle", "auto", "before-edge", "after-edge", "central", "text-before-edge", "text-after-edge",
+        "ideographic", "alphabetic", "hanging", "mathematical"
+    ],
+    "outline-width": [
+        "medium", "thick", "thin"
+    ],
+    "text-line-through-width": [
+        "normal", "medium", "auto", "thick", "thin"
+    ],
+    "box-align": [
+        "baseline", "center", "stretch", "start", "end"
+    ],
+    "border-right-width": [
+        "medium", "thick", "thin"
+    ],
+    "border-top-style": [
+        "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
+    ],
+    "line-height": [
+        "normal"
+    ],
+    "text-overflow": [
+        "clip", "ellipsis"
+    ],
+    "box-direction": [
+        "normal", "reverse"
+    ],
+    "margin-after-collapse": [
+        "collapse", "separate", "discard"
+    ],
+    "page-break-before": [
+        "left", "right", "auto", "always", "avoid"
+    ],
+    "-webkit-hyphens": [
+        "none", "auto", "manual"
+    ],
+    "border-image": [
+        "repeat", "stretch"
+    ],
+    "text-decoration": [
+        "blink", "line-through", "overline", "underline"
+    ],
+    "position": [
+        "absolute", "fixed", "relative", "static"
+    ],
+    "font-family": [
+        "serif", "sans-serif", "cursive", "fantasy", "monospace", "-webkit-body"
+    ],
+    "text-overflow-mode": [
+        "clip", "ellipsis"
+    ],
+    "border-bottom-style": [
+        "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
+    ],
+    "unicode-bidi": [
+        "normal", "bidi-override", "embed"
+    ],
+    "clip-rule": [
+        "nonzero", "evenodd"
+    ],
+    "margin-left": [
+        "auto"
+    ],
+    "margin-top": [
+        "auto"
+    ],
+    "zoom": [
+        "document", "reset"
+    ],
+    "text-overline-style": [
+        "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
+    ],
+    "max-width": [
+        "none"
+    ],
+    "empty-cells": [
+        "hide", "show"
+    ],
+    "pointer-events": [
+        "none", "all", "auto", "visible", "visiblepainted", "visiblefill", "visiblestroke", "painted", "fill", "stroke"
+    ],
+    "letter-spacing": [
+        "normal"
+    ],
+    "background-clip": [
+        "border-box", "content-box", "padding-box"
+    ],
+    "-webkit-font-smoothing": [
+        "none", "auto", "antialiased", "subpixel-antialiased"
+    ],
+    "border": [
+        "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
+    ],
+    "font-size": [
+        "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "-webkit-xxx-large", "smaller",
+        "larger"
+    ],
+    "font-variant": [
+        "small-caps", "normal"
+    ],
+    "vertical-align": [
+        "baseline", "middle", "sub", "super", "text-top", "text-bottom", "top", "bottom", "-webkit-baseline-middle"
+    ],
+    "marquee-style": [
+        "none", "scroll", "slide", "alternate"
+    ],
+    "white-space": [
+        "normal", "nowrap", "pre", "pre-line", "pre-wrap"
+    ],
+    "text-underline-width": [
+        "normal", "medium", "auto", "thick", "thin"
+    ],
+    "box-lines": [
+        "single", "multiple"
+    ],
+    "page-break-after": [
+        "left", "right", "auto", "always", "avoid"
+    ],
+    "clip-path": [
+        "none"
+    ],
+    "margin": [
+        "auto"
+    ],
+    "marquee-repetition": [
+        "infinite"
+    ],
+    "margin-right": [
+        "auto"
+    ],
+    "-webkit-text-emphasis-style": [
+        "circle", "filled", "open", "dot", "double-circle", "triangle", "sesame"
+    ]
+}
diff --git a/Source/WebCore/inspector/front-end/StylesSidebarPane.js b/Source/WebCore/inspector/front-end/StylesSidebarPane.js
index d646829..7c8a925 100644
--- a/Source/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -81,6 +81,8 @@ WebInspector.StylesSidebarPane = function(computedStylePane)
     this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
 }
 
+WebInspector.StylesSidebarPane.StyleValueDelimiters = " \t\n\"':;,/()";
+
 // Taken from http://www.w3.org/TR/CSS21/propidx.html.
 WebInspector.StylesSidebarPane.InheritedProperties = [
     "azimuth", "border-collapse", "border-spacing", "caption-side", "color", "cursor", "direction", "elevation",
@@ -1379,6 +1381,8 @@ WebInspector.StylePropertyTreeElement.prototype = {
         }
 
         this.listItemElement.removeChildren();
+        nameElement.normalize();
+        valueElement.normalize();
 
         if (!this.treeOutline)
             return;
@@ -1529,16 +1533,15 @@ WebInspector.StylePropertyTreeElement.prototype = {
         var context = {
             expanded: this.expanded,
             hasChildren: this.hasChildren,
-            keyDownListener: isEditingName ? this.editingNameKeyDown.bind(this) : this.editingValueKeyDown.bind(this),
-            keyPressListener: isEditingName ? this.editingNameKeyPress.bind(this) : this.editingValueKeyPress.bind(this),
+            keyDownListener: isEditingName ? null : this.editingValueKeyDown.bind(this),
             isEditingName: isEditingName,
         };
 
         // Lie about our children to prevent expanding on double click and to collapse shorthands.
         this.hasChildren = false;
 
-        selectElement.addEventListener("keydown", context.keyDownListener, false);
-        selectElement.addEventListener("keypress", context.keyPressListener, false);
+        if (!isEditingName)
+            selectElement.addEventListener("keydown", context.keyDownListener, false);
         if (selectElement.parentElement)
             selectElement.parentElement.addStyleClass("child-editing");
         selectElement.textContent = selectElement.textContent; // remove color swatch and the like
@@ -1613,76 +1616,15 @@ WebInspector.StylePropertyTreeElement.prototype = {
             customFinishHandler: nameValueFinishHandler.bind(this, context, isEditingName),
             pasteHandler: isEditingName ? pasteHandler.bind(this, context) : null
         });
-        window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1);
-    },
-
-    editingNameKeyPress: function(event)
-    {
-        // Complete property names.
-        var character = event.data.toLowerCase();
-        if (character && /[a-z-]/.test(character)) {
-            var selection = window.getSelection();
-            var prefix = selection.anchorNode.textContent.substring(0, selection.anchorOffset);
-            var property = WebInspector.cssNameCompletions.firstStartsWith(prefix + character);
 
-            if (!selection.isCollapsed)
-                selection.deleteFromDocument();
-
-            this.restoreNameElement();
-
-            if (property) {
-                if (property !== this.nameElement.textContent)
-                    this.nameElement.textContent = property;
-                this.nameElement.firstChild.select(prefix.length + 1);
-                event.preventDefault();
-            }
-        }
-    },
-
-    editingValueKeyPress: function(event)
-    {
-        // FIXME: This should complete property values.
-    },
-
-    editingNameKeyDown: function(event)
-    {
-        var showNext;
-        if (event.keyIdentifier === "Up")
-            showNext = false;
-        else if (event.keyIdentifier === "Down")
-            showNext = true;
-        else
-            return;
-
-        var selection = window.getSelection();
-        if (!selection.rangeCount)
-            return;
-
-        var selectionRange = selection.getRangeAt(0);
-        if (selectionRange.commonAncestorContainer !== this.nameElement && !selectionRange.commonAncestorContainer.isDescendant(this.nameElement))
-            return;
-
-        const styleValueDelimeters = " \t\n\"':;,/()";
-        var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, styleValueDelimeters, this.nameElement);
-        var wordString = wordRange.toString();
-        var cursorPosition = selectionRange.startOffset != selectionRange.endOffset ? selectionRange.startOffset : 0;
-        var prefix = selectionRange.startContainer.textContent.substring(0, cursorPosition);
-        var property;
-
-        if (showNext)
-            property = WebInspector.cssNameCompletions.next(wordString, prefix);
-        else
-            property = WebInspector.cssNameCompletions.previous(wordString, prefix);
-
-        if (property) {
-            this.nameElement.textContent = property;
-            this.nameElement.firstChild.select(cursorPosition);
-        }
-        event.preventDefault();
+        this._prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(selectElement, isEditingName ? WebInspector.cssNameCompletions : WebInspector.CSSKeywordCompletions.forProperty(this.nameElement.textContent));
+        window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1);
     },
 
     editingValueKeyDown: function(event)
     {
+        if (event.handled)
+            return;
         var arrowKeyPressed = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down");
         var pageKeyPressed = (event.keyIdentifier === "PageUp" || event.keyIdentifier === "PageDown");
         if (!arrowKeyPressed && !pageKeyPressed)
@@ -1696,8 +1638,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
         if (selectionRange.commonAncestorContainer !== this.valueElement && !selectionRange.commonAncestorContainer.isDescendant(this.valueElement))
             return;
 
-        const styleValueDelimeters = " \t\n\"':;,/()";
-        var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, styleValueDelimeters, this.valueElement);
+        var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, WebInspector.StylesSidebarPane.StyleValueDelimiters, this.valueElement);
         var wordString = wordRange.toString();
         var replacementString = wordString;
 
@@ -1739,42 +1680,45 @@ WebInspector.StylePropertyTreeElement.prototype = {
             }
 
             replacementString = prefix + number + suffix;
-        } else {
-            // FIXME: this should cycle through known keywords for the current property value.
-        }
 
-        var replacementTextNode = document.createTextNode(replacementString);
+            var replacementTextNode = document.createTextNode(replacementString);
 
-        wordRange.deleteContents();
-        wordRange.insertNode(replacementTextNode);
+            wordRange.deleteContents();
+            wordRange.insertNode(replacementTextNode);
 
-        var finalSelectionRange = document.createRange();
-        finalSelectionRange.setStart(replacementTextNode, 0);
-        finalSelectionRange.setEnd(replacementTextNode, replacementString.length);
+            var finalSelectionRange = document.createRange();
+            finalSelectionRange.setStart(replacementTextNode, 0);
+            finalSelectionRange.setEnd(replacementTextNode, replacementString.length);
 
-        selection.removeAllRanges();
-        selection.addRange(finalSelectionRange);
+            selection.removeAllRanges();
+            selection.addRange(finalSelectionRange);
 
-        event.preventDefault();
+            event.handled = true;
+            event.preventDefault();
 
-        if (!("originalPropertyText" in this)) {
-            // Remember the rule's original CSS text on [Page](Up|Down), so it can be restored
-            // if the editing is canceled.
-            this.originalPropertyText = this.property.propertyText;
-        }
+            if (!("originalPropertyText" in this)) {
+                // Remember the rule's original CSS text on [Page](Up|Down), so it can be restored
+                // if the editing is canceled.
+                this.originalPropertyText = this.property.propertyText;
+            }
 
-        // Synthesize property text disregarding any comments, custom whitespace etc.
-        this.applyStyleText(this.nameElement.textContent + ": " + this.valueElement.textContent);
+            // Synthesize property text disregarding any comments, custom whitespace etc.
+            this.applyStyleText(this.nameElement.textContent + ": " + this.valueElement.textContent);
+        }
     },
 
     editingEnded: function(context)
     {
+        if (this._prompt) {
+            this._prompt.removeFromElement();
+            delete this._prompt;
+        }
         this.hasChildren = context.hasChildren;
         if (context.expanded)
             this.expand();
         var editedElement = context.isEditingName ? this.nameElement : this.valueElement;
-        editedElement.removeEventListener("keydown", context.keyDownListener, false);
-        editedElement.removeEventListener("keypress", context.keyPressListener, false);
+        if (!context.isEditingName)
+            editedElement.removeEventListener("keydown", context.keyDownListener, false);
         if (editedElement.parentElement)
             editedElement.parentElement.removeStyleClass("child-editing");
 
@@ -1783,6 +1727,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
 
     editingCancelled: function(element, context)
     {
+        this.editingEnded(context);
         if ("originalPropertyText" in this)
             this.applyStyleText(this.originalPropertyText, true);
         else {
@@ -1791,7 +1736,6 @@ WebInspector.StylePropertyTreeElement.prototype = {
             else
                 this.updateTitle();
         }
-        this.editingEnded(context);
     },
 
     editingCommitted: function(element, userInput, previousContent, context, moveDirection)
@@ -1948,3 +1892,57 @@ WebInspector.StylePropertyTreeElement.prototype = {
 }
 
 WebInspector.StylePropertyTreeElement.prototype.__proto__ = TreeElement.prototype;
+
+WebInspector.StylesSidebarPane.CSSPropertyPrompt = function(element, cssCompletions)
+{
+    WebInspector.TextPrompt.call(this, element, this._buildPropertyCompletions.bind(this), WebInspector.StylesSidebarPane.StyleValueDelimiters, true);
+    this._cssCompletions = cssCompletions;
+}
+
+WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype = {
+    upKeyPressed: function(event)
+    {
+        this._handleNameOrValueUpDown(event);
+    },
+
+    downKeyPressed: function(event)
+    {
+        this._handleNameOrValueUpDown(event);
+    },
+
+    tabKeyPressed: function(event)
+    {
+        this.acceptAutoComplete();
+    },
+
+    _handleNameOrValueUpDown: function(event)
+    {
+        var reverse = event.keyIdentifier === "Up";
+        if (this.autoCompleteElement)
+            this.complete(false, reverse); // Accept the current suggestion, if any.
+        this.complete(false, reverse); // Actually increment/decrement the suggestion.
+        event.handled = true;
+    },
+
+    _buildPropertyCompletions: function(wordRange, bestMatchOnly, completionsReadyCallback)
+    {
+        var prefix = wordRange.toString().toLowerCase();
+        if (!prefix.length)
+            return;
+
+        var results;
+        if (bestMatchOnly) {
+            results = [];
+            var firstMatch = this._cssCompletions.firstStartsWith(prefix);
+            if (firstMatch)
+                results.push(firstMatch);
+            return completionsReadyCallback(results);
+        }
+
+        results = this._cssCompletions.startsWith(prefix);
+        if (results)
+            completionsReadyCallback(results);
+    }
+}
+
+WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspector.TextPrompt.prototype;
diff --git a/Source/WebCore/inspector/front-end/TextPrompt.js b/Source/WebCore/inspector/front-end/TextPrompt.js
index 21a5bde..ac54d8c 100644
--- a/Source/WebCore/inspector/front-end/TextPrompt.js
+++ b/Source/WebCore/inspector/front-end/TextPrompt.js
@@ -26,15 +26,18 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TextPrompt = function(element, completions, stopCharacters)
+WebInspector.TextPrompt = function(element, completions, stopCharacters, omitHistory)
 {
     this.element = element;
     this.element.addStyleClass("text-prompt");
     this.completions = completions;
     this.completionStopCharacters = stopCharacters;
-    this.history = [];
-    this.historyOffset = 0;
-    this.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
+    if (!omitHistory) {
+        this.history = [];
+        this.historyOffset = 0;
+    }
+    this._boundOnKeyDown = this._onKeyDown.bind(this);
+    this.element.addEventListener("keydown", this._boundOnKeyDown, true);
 }
 
 WebInspector.TextPrompt.prototype = {
@@ -55,6 +58,12 @@ WebInspector.TextPrompt.prototype = {
         this.moveCaretToEndOfPrompt();
     },
 
+    removeFromElement: function()
+    {
+        this.clearAutoComplete(true);
+        this.element.removeEventListener("keydown", this._boundOnKeyDown, true);
+    },
+
     _onKeyDown: function(event)
     {
         function defaultAction()
@@ -63,16 +72,20 @@ WebInspector.TextPrompt.prototype = {
             this.autoCompleteSoon();
         }
 
+        if (event.handled)
+            return;
+
         var handled = false;
+
         switch (event.keyIdentifier) {
             case "Up":
-                this._upKeyPressed(event);
+                this.upKeyPressed(event);
                 break;
             case "Down":
-                this._downKeyPressed(event);
+                this.downKeyPressed(event);
                 break;
             case "U+0009": // Tab
-                this._tabKeyPressed(event);
+                this.tabKeyPressed(event);
                 break;
             case "Right":
             case "End":
@@ -85,7 +98,7 @@ WebInspector.TextPrompt.prototype = {
             case "Control":
                 break;
             case "U+0050": // Ctrl+P = Previous
-                if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
+                if (this.history && WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
                     handled = true;
                     this._moveBackInHistory();
                     break;
@@ -93,7 +106,7 @@ WebInspector.TextPrompt.prototype = {
                 defaultAction.call(this);
                 break;
             case "U+004E": // Ctrl+N = Next
-                if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
+                if (this.history && WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
                     handled = true;
                     this._moveForwardInHistory();
                     break;
@@ -105,7 +118,9 @@ WebInspector.TextPrompt.prototype = {
                 break;
         }
 
+        handled |= event.handled;
         if (handled) {
+            event.handled = true;
             event.preventDefault();
             event.stopPropagation();
         }
@@ -376,39 +391,33 @@ WebInspector.TextPrompt.prototype = {
         selection.addRange(selectionRange);
     },
 
-    _tabKeyPressed: function(event)
+    tabKeyPressed: function(event)
     {
-        event.preventDefault();
-        event.stopPropagation();
-
+        event.handled = true;
         this.complete(false, event.shiftKey);
     },
 
-    _upKeyPressed: function(event)
+    upKeyPressed: function(event)
     {
         if (!this.isCaretOnFirstLine())
             return;
 
-        event.preventDefault();
-        event.stopPropagation();
-
+        event.handled = true;
         this._moveBackInHistory();
     },
 
-    _downKeyPressed: function(event)
+    downKeyPressed: function(event)
     {
         if (!this.isCaretOnLastLine())
             return;
 
-        event.preventDefault();
-        event.stopPropagation();
-
+        event.handled = true;
         this._moveForwardInHistory();
     },
 
     _moveBackInHistory: function()
     {
-        if (this.historyOffset == this.history.length)
+        if (!this.history || this.historyOffset == this.history.length)
             return;
 
         this.clearAutoComplete(true);
@@ -437,7 +446,7 @@ WebInspector.TextPrompt.prototype = {
 
     _moveForwardInHistory: function()
     {
-        if (this.historyOffset === 0)
+        if (!this.history || this.historyOffset === 0)
             return;
 
         this.clearAutoComplete(true);
diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css
index c908427..f629d12 100644
--- a/Source/WebCore/inspector/front-end/inspector.css
+++ b/Source/WebCore/inspector/front-end/inspector.css
@@ -778,8 +778,8 @@ body.platform-linux .monospace, body.platform-linux .source-code {
     color: red;
 }
 
-.auto-complete-text {
-    color: rgb(128, 128, 128);
+.auto-complete-text, .editing .auto-complete-text {
+    color: rgb(128, 128, 128) !important;
     -webkit-user-select: none;
     -webkit-user-modify: read-only;
 }
diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html
index ca6d412..0e0b9e9 100644
--- a/Source/WebCore/inspector/front-end/inspector.html
+++ b/Source/WebCore/inspector/front-end/inspector.html
@@ -92,6 +92,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="EventListenersSidebarPane.js"></script>
     <script type="text/javascript" src="Color.js"></script>
     <script type="text/javascript" src="CSSCompletions.js"></script>
+    <script type="text/javascript" src="CSSKeywordCompletions.js"></script>
     <script type="text/javascript" src="StylesSidebarPane.js"></script>
     <script type="text/javascript" src="PanelEnablerView.js"></script>
     <script type="text/javascript" src="WelcomeView.js"></script>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list