2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 WebInspector.CSSKeywordCompletions = {}
33 WebInspector.CSSKeywordCompletions.forProperty = function(propertyName)
35 var acceptedKeywords = ["initial"];
36 if (propertyName in WebInspector.CSSKeywordCompletions._propertyKeywordMap)
37 acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName]);
38 if (propertyName in WebInspector.CSSKeywordCompletions._colorAwareProperties)
39 acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);
40 if (propertyName in WebInspector.CSSKeywordCompletions.InheritedProperties)
41 acceptedKeywords.push("inherit");
42 return new WebInspector.CSSCompletions(acceptedKeywords, true);
45 WebInspector.CSSKeywordCompletions.isColorAwareProperty = function(propertyName)
47 return WebInspector.CSSKeywordCompletions._colorAwareProperties[propertyName] === true;
50 // Taken from http://www.w3.org/TR/CSS21/propidx.html.
51 WebInspector.CSSKeywordCompletions.InheritedProperties = [
52 "azimuth", "border-collapse", "border-spacing", "caption-side", "color", "cursor", "direction", "elevation",
53 "empty-cells", "font-family", "font-size", "font-style", "font-variant", "font-weight", "font", "letter-spacing",
54 "line-height", "list-style-image", "list-style-position", "list-style-type", "list-style", "orphans", "pitch-range",
55 "pitch", "quotes", "richness", "speak-header", "speak-numeral", "speak-punctuation", "speak", "speech-rate", "stress",
56 "text-align", "text-indent", "text-transform", "text-shadow", "visibility", "voice-family", "volume", "white-space", "widows", "word-spacing"
59 WebInspector.CSSKeywordCompletions._colors = [
60 "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red",
61 "silver", "teal", "white", "yellow", "transparent", "currentcolor", "grey", "aliceblue", "antiquewhite",
62 "aquamarine", "azure", "beige", "bisque", "blanchedalmond", "blueviolet", "brown", "burlywood", "cadetblue",
63 "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan",
64 "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange",
65 "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey",
66 "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick",
67 "floralwhite", "forestgreen", "gainsboro", "ghostwhite", "gold", "goldenrod", "greenyellow", "honeydew", "hotpink",
68 "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue",
69 "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink",
70 "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow",
71 "limegreen", "linen", "magenta", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen",
72 "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream",
73 "mistyrose", "moccasin", "navajowhite", "oldlace", "olivedrab", "orangered", "orchid", "palegoldenrod", "palegreen",
74 "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "rosybrown",
75 "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "skyblue", "slateblue",
76 "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "thistle", "tomato", "turquoise", "violet",
77 "wheat", "whitesmoke", "yellowgreen"
80 WebInspector.CSSKeywordCompletions._colorAwareProperties = [
81 "background", "background-color", "background-image", "border", "border-color", "border-top", "border-right", "border-bottom",
82 "border-left", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", "color",
83 "outline", "outline-color", "text-line-through", "text-line-through-color", "text-overline", "text-overline-color",
84 "text-shadow", "text-underline", "text-underline-color", "-webkit-text-emphasis", "-webkit-text-emphasis-color"
87 WebInspector.CSSKeywordCompletions._propertyKeywordMap = {
92 "hidden", "visible", "collapse"
94 "background-repeat": [
95 "repeat", "repeat-x", "repeat-y", "no-repeat", "space", "round"
98 "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
101 "list-item", "close-quote", "no-close-quote", "no-open-quote", "open-quote"
103 "list-style-image": [
107 "none", "left", "right", "both"
109 "text-underline-mode": [
110 "continuous", "skip-white-space"
113 "hidden", "auto", "visible", "overlay", "scroll"
116 "round", "miter", "bevel"
119 "baseline", "sub", "super"
121 "border-bottom-width": [
122 "medium", "thick", "thin"
125 "normal", "slow", "fast"
127 "margin-top-collapse": [
128 "collapse", "separate", "discard"
134 "horizontal", "vertical", "inline-axis", "block-axis"
137 "normal", "wider", "narrower", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed",
138 "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"
140 "-webkit-color-correction": [
143 "text-underline-style": [
144 "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
146 "text-overline-mode": [
147 "continuous", "skip-white-space"
149 "-webkit-background-composite": [
150 "highlight", "clear", "copy", "source-over", "source-in", "source-out", "source-atop", "destination-over",
151 "destination-in", "destination-out", "destination-atop", "xor", "plus-darker", "plus-lighter"
153 "border-left-width": [
154 "medium", "thick", "thin"
156 "-webkit-writing-mode": [
157 "lr", "rl", "tb", "lr-tb", "rl-tb", "tb-rl", "horizontal-tb", "vertical-rl", "vertical-lr", "horizontal-bt"
159 "text-line-through-mode": [
160 "continuous", "skip-white-space"
163 "collapse", "separate"
165 "page-break-inside": [
168 "border-top-width": [
169 "medium", "thick", "thin"
174 "text-line-through-style": [
175 "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
178 "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
181 "none", "copy", "auto", "crosshair", "default", "pointer", "move", "vertical-text", "cell", "context-menu",
182 "alias", "progress", "no-drop", "not-allowed", "-webkit-zoom-in", "-webkit-zoom-out", "e-resize", "ne-resize",
183 "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "ew-resize", "ns-resize",
184 "nesw-resize", "nwse-resize", "col-resize", "row-resize", "text", "wait", "help", "all-scroll", "-webkit-grab",
188 "medium", "thick", "thin"
191 "a3", "a4", "a5", "b4", "b5", "landscape", "ledger", "legal", "letter", "portrait"
199 "marquee-direction": [
200 "left", "right", "auto", "reverse", "forwards", "backwards", "ahead", "up", "down"
202 "enable-background": [
206 "none", "left", "right"
209 "hidden", "auto", "visible", "overlay", "scroll"
211 "margin-bottom-collapse": [
212 "collapse", "separate", "discard"
215 "left", "right", "above", "below"
218 "hidden", "auto", "visible", "overlay", "scroll"
221 "auto", "optimizespeed", "optimizelegibility", "geometricprecision"
224 "-webkit-auto", "left", "right", "center", "justify", "-webkit-left", "-webkit-right", "-webkit-center"
226 "list-style-position": [
232 "color-interpolation": [
235 "background-origin": [
236 "border-box", "content-box", "padding-box"
239 "normal", "break-word"
242 "normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"
244 "margin-before-collapse": [
245 "collapse", "separate", "discard"
247 "text-overline-width": [
248 "normal", "medium", "auto", "thick", "thin"
251 "none", "capitalize", "uppercase", "lowercase"
253 "border-right-style": [
254 "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
256 "border-left-style": [
257 "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
259 "-webkit-text-emphasis": [
260 "circle", "filled", "open", "dot", "double-circle", "triangle", "sesame"
263 "italic", "oblique", "normal"
266 "none", "normal", "spell-out", "digits", "literal-punctuation", "no-punctuation"
268 "text-line-through": [
269 "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave", "continuous",
273 "auto", "optimizespeed", "optimizequality"
276 "none", "disc", "circle", "square", "decimal", "decimal-leading-zero", "arabic-indic", "binary", "bengali",
277 "cambodian", "khmer", "devanagari", "gujarati", "gurmukhi", "kannada", "lower-hexadecimal", "lao", "malayalam",
278 "mongolian", "myanmar", "octal", "oriya", "persian", "urdu", "telugu", "tibetan", "thai", "upper-hexadecimal",
279 "lower-roman", "upper-roman", "lower-greek", "lower-alpha", "lower-latin", "upper-alpha", "upper-latin", "afar",
280 "ethiopic-halehame-aa-et", "ethiopic-halehame-aa-er", "amharic", "ethiopic-halehame-am-et", "amharic-abegede",
281 "ethiopic-abegede-am-et", "cjk-earthly-branch", "cjk-heavenly-stem", "ethiopic", "ethiopic-halehame-gez",
282 "ethiopic-abegede", "ethiopic-abegede-gez", "hangul-consonant", "hangul", "lower-norwegian", "oromo",
283 "ethiopic-halehame-om-et", "sidama", "ethiopic-halehame-sid-et", "somali", "ethiopic-halehame-so-et", "tigre",
284 "ethiopic-halehame-tig", "tigrinya-er", "ethiopic-halehame-ti-er", "tigrinya-er-abegede",
285 "ethiopic-abegede-ti-er", "tigrinya-et", "ethiopic-halehame-ti-et", "tigrinya-et-abegede",
286 "ethiopic-abegede-ti-et", "upper-greek", "upper-norwegian", "asterisks", "footnotes", "hebrew", "armenian",
287 "lower-armenian", "upper-armenian", "georgian", "cjk-ideographic", "hiragana", "katakana", "hiragana-iroha",
290 "-webkit-text-combine": [
294 "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
297 "caption", "icon", "menu", "message-box", "small-caption", "-webkit-mini-control", "-webkit-small-control",
298 "-webkit-control", "status-bar", "italic", "oblique", "small-caps", "normal", "bold", "bolder", "lighter",
299 "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium",
300 "large", "x-large", "xx-large", "-webkit-xxx-large", "smaller", "larger", "serif", "sans-serif", "cursive",
301 "fantasy", "monospace", "-webkit-body", "-webkit-pictograph"
303 "dominant-baseline": [
304 "middle", "auto", "central", "text-before-edge", "text-after-edge", "ideographic", "alphabetic", "hanging",
305 "mathematical", "use-script", "no-change", "reset-size"
308 "none", "inline", "block", "list-item", "run-in", "compact", "inline-block", "table", "inline-table",
309 "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group",
310 "table-column", "table-cell", "table-caption", "-webkit-box", "-webkit-inline-box", "-wap-marquee"
312 "-webkit-text-emphasis-position": [
316 "auto", "optimizespeed", "optimizequality"
318 "alignment-baseline": [
319 "baseline", "middle", "auto", "before-edge", "after-edge", "central", "text-before-edge", "text-after-edge",
320 "ideographic", "alphabetic", "hanging", "mathematical"
323 "medium", "thick", "thin"
325 "text-line-through-width": [
326 "normal", "medium", "auto", "thick", "thin"
329 "baseline", "center", "stretch", "start", "end"
331 "border-right-width": [
332 "medium", "thick", "thin"
334 "border-top-style": [
335 "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
346 "margin-after-collapse": [
347 "collapse", "separate", "discard"
349 "page-break-before": [
350 "left", "right", "auto", "always", "avoid"
353 "none", "auto", "manual"
359 "blink", "line-through", "overline", "underline"
362 "absolute", "fixed", "relative", "static"
365 "serif", "sans-serif", "cursive", "fantasy", "monospace", "-webkit-body", "-webkit-pictograph"
367 "text-overflow-mode": [
370 "border-bottom-style": [
371 "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
374 "normal", "bidi-override", "embed"
388 "text-overline-style": [
389 "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
398 "none", "all", "auto", "visible", "visiblepainted", "visiblefill", "visiblestroke", "painted", "fill", "stroke"
404 "border-box", "content-box", "padding-box"
406 "-webkit-font-smoothing": [
407 "none", "auto", "antialiased", "subpixel-antialiased"
410 "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
413 "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "-webkit-xxx-large", "smaller",
417 "small-caps", "normal"
420 "baseline", "middle", "sub", "super", "text-top", "text-bottom", "top", "bottom", "-webkit-baseline-middle"
423 "none", "scroll", "slide", "alternate"
426 "normal", "nowrap", "pre", "pre-line", "pre-wrap"
428 "text-underline-width": [
429 "normal", "medium", "auto", "thick", "thin"
434 "page-break-after": [
435 "left", "right", "auto", "always", "avoid"
443 "marquee-repetition": [
449 "-webkit-text-emphasis-style": [
450 "circle", "filled", "open", "dot", "double-circle", "triangle", "sesame"