Home | History | Annotate | Download | only in front-end
      1 /*
      2  * Copyright (C) 2011 Google Inc. All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions are
      6  * met:
      7  *
      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
     13  * distribution.
     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.
     17  *
     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.
     29  */
     30 
     31 WebInspector.CSSKeywordCompletions = {
     32     forProperty: function(propertyName)
     33     {
     34         var acceptedKeywords = ["initial"];
     35         if (propertyName in this._propertyKeywordMap)
     36             acceptedKeywords = acceptedKeywords.concat(this._propertyKeywordMap[propertyName]);
     37         if (propertyName in this._colorAwareProperties)
     38             acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);
     39         if (propertyName in WebInspector.StylesSidebarPane.InheritedProperties)
     40             acceptedKeywords.push("inherit");
     41         return new WebInspector.CSSCompletions(acceptedKeywords, true);
     42     }
     43 };
     44 
     45 WebInspector.CSSKeywordCompletions._colors = [
     46     "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red",
     47     "silver", "teal", "white", "yellow", "transparent", "currentcolor", "grey", "aliceblue", "antiquewhite",
     48     "aquamarine", "azure", "beige", "bisque", "blanchedalmond", "blueviolet", "brown", "burlywood", "cadetblue",
     49     "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan",
     50     "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange",
     51     "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey",
     52     "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick",
     53     "floralwhite", "forestgreen", "gainsboro", "ghostwhite", "gold", "goldenrod", "greenyellow", "honeydew", "hotpink",
     54     "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue",
     55     "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink",
     56     "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow",
     57     "limegreen", "linen", "magenta", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen",
     58     "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream",
     59     "mistyrose", "moccasin", "navajowhite", "oldlace", "olivedrab", "orangered", "orchid", "palegoldenrod", "palegreen",
     60     "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "rosybrown",
     61     "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "skyblue", "slateblue",
     62     "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "thistle", "tomato", "turquoise", "violet",
     63     "wheat", "whitesmoke", "yellowgreen"
     64 ],
     65 
     66 WebInspector.CSSKeywordCompletions._colorAwareProperties = [
     67     "background", "background-color", "border", "border-color", "border-top", "border-right", "border-bottom",
     68     "border-left", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", "color",
     69     "outline", "outline-color", "text-line-through", "text-line-through-color", "text-overline", "text-overline-color",
     70     "text-shadow", "text-underline", "text-underline-color", "-webkit-text-emphasis", "-webkit-text-emphasis-color"
     71 ].keySet();
     72 
     73 WebInspector.CSSKeywordCompletions._propertyKeywordMap = {
     74     "table-layout": [
     75         "auto", "fixed"
     76     ],
     77     "visibility": [
     78         "hidden", "visible", "collapse"
     79     ],
     80     "background-repeat": [
     81         "repeat", "repeat-x", "repeat-y", "no-repeat", "space", "round"
     82     ],
     83     "text-underline": [
     84         "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
     85     ],
     86     "content": [
     87         "list-item", "close-quote", "no-close-quote", "no-open-quote", "open-quote"
     88     ],
     89     "list-style-image": [
     90         "none"
     91     ],
     92     "clear": [
     93         "none", "left", "right", "both"
     94     ],
     95     "text-underline-mode": [
     96         "continuous", "skip-white-space"
     97     ],
     98     "overflow-x": [
     99         "hidden", "auto", "visible", "overlay", "scroll"
    100     ],
    101     "stroke-linejoin": [
    102         "round", "miter", "bevel"
    103     ],
    104     "baseline-shift": [
    105         "baseline", "sub", "super"
    106     ],
    107     "border-bottom-width": [
    108         "medium", "thick", "thin"
    109     ],
    110     "marquee-speed": [
    111         "normal", "slow", "fast"
    112     ],
    113     "margin-top-collapse": [
    114         "collapse", "separate", "discard"
    115     ],
    116     "max-height": [
    117         "none"
    118     ],
    119     "box-orient": [
    120         "horizontal", "vertical", "inline-axis", "block-axis"
    121     ],
    122     "font-stretch": [
    123         "normal", "wider", "narrower", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed",
    124         "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"
    125     ],
    126     "-webkit-color-correction": [
    127         "default", "srgb"
    128     ],
    129     "text-underline-style": [
    130         "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
    131     ],
    132     "text-overline-mode": [
    133         "continuous", "skip-white-space"
    134     ],
    135     "-webkit-background-composite": [
    136         "highlight", "clear", "copy", "source-over", "source-in", "source-out", "source-atop", "destination-over",
    137         "destination-in", "destination-out", "destination-atop", "xor", "plus-darker", "plus-lighter"
    138     ],
    139     "border-left-width": [
    140         "medium", "thick", "thin"
    141     ],
    142     "-webkit-writing-mode": [
    143         "lr", "rl", "tb", "lr-tb", "rl-tb", "tb-rl", "horizontal-tb", "vertical-rl", "vertical-lr", "horizontal-bt"
    144     ],
    145     "text-line-through-mode": [
    146         "continuous", "skip-white-space"
    147     ],
    148     "border-collapse": [
    149         "collapse", "separate"
    150     ],
    151     "page-break-inside": [
    152         "auto", "avoid"
    153     ],
    154     "border-top-width": [
    155         "medium", "thick", "thin"
    156     ],
    157     "outline-color": [
    158         "invert"
    159     ],
    160     "text-line-through-style": [
    161         "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
    162     ],
    163     "outline-style": [
    164         "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
    165     ],
    166     "cursor": [
    167         "none", "copy", "auto", "crosshair", "default", "pointer", "move", "vertical-text", "cell", "context-menu",
    168         "alias", "progress", "no-drop", "not-allowed", "-webkit-zoom-in", "-webkit-zoom-out", "e-resize", "ne-resize",
    169         "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "ew-resize", "ns-resize",
    170         "nesw-resize", "nwse-resize", "col-resize", "row-resize", "text", "wait", "help", "all-scroll", "-webkit-grab",
    171         "-webkit-grabbing"
    172     ],
    173     "border-width": [
    174         "medium", "thick", "thin"
    175     ],
    176     "size": [
    177         "a3", "a4", "a5", "b4", "b5", "landscape", "ledger", "legal", "letter", "portrait"
    178     ],
    179     "background-size": [
    180         "contain", "cover"
    181     ],
    182     "direction": [
    183         "ltr", "rtl"
    184     ],
    185     "marquee-direction": [
    186         "left", "right", "auto", "reverse", "forwards", "backwards", "ahead", "up", "down"
    187     ],
    188     "enable-background": [
    189         "accumulate", "new"
    190     ],
    191     "float": [
    192         "none", "left", "right"
    193     ],
    194     "overflow-y": [
    195         "hidden", "auto", "visible", "overlay", "scroll"
    196     ],
    197     "margin-bottom-collapse": [
    198         "collapse",  "separate", "discard"
    199     ],
    200     "box-reflect": [
    201         "left", "right", "above", "below"
    202     ],
    203     "overflow": [
    204         "hidden", "auto", "visible", "overlay", "scroll"
    205     ],
    206     "text-rendering": [
    207         "auto", "optimizespeed", "optimizelegibility", "geometricprecision"
    208     ],
    209     "text-align": [
    210         "-webkit-auto", "left", "right", "center", "justify", "-webkit-left", "-webkit-right", "-webkit-center"
    211     ],
    212     "list-style-position": [
    213         "outside", "inside"
    214     ],
    215     "margin-bottom": [
    216         "auto"
    217     ],
    218     "color-interpolation": [
    219         "linearrgb"
    220     ],
    221     "background-origin": [
    222         "border-box", "content-box", "padding-box"
    223     ],
    224     "word-wrap": [
    225         "normal", "break-word"
    226     ],
    227     "font-weight": [
    228         "normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900"
    229     ],
    230     "margin-before-collapse": [
    231         "collapse", "separate", "discard"
    232     ],
    233     "text-overline-width": [
    234         "normal", "medium", "auto", "thick", "thin"
    235     ],
    236     "text-transform": [
    237         "none", "capitalize", "uppercase", "lowercase"
    238     ],
    239     "border-right-style": [
    240         "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
    241     ],
    242     "border-left-style": [
    243         "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
    244     ],
    245     "-webkit-text-emphasis": [
    246         "circle", "filled", "open", "dot", "double-circle", "triangle", "sesame"
    247     ],
    248     "font-style": [
    249         "italic", "oblique", "normal"
    250     ],
    251     "speak": [
    252         "none", "normal", "spell-out", "digits", "literal-punctuation", "no-punctuation"
    253     ],
    254     "text-line-through": [
    255         "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave", "continuous",
    256         "skip-white-space"
    257     ],
    258     "color-rendering": [
    259         "auto", "optimizespeed", "optimizequality"
    260     ],
    261     "list-style-type": [
    262         "none", "disc", "circle", "square", "decimal", "decimal-leading-zero", "arabic-indic", "binary", "bengali",
    263         "cambodian", "khmer", "devanagari", "gujarati", "gurmukhi", "kannada", "lower-hexadecimal", "lao", "malayalam",
    264         "mongolian", "myanmar", "octal", "oriya", "persian", "urdu", "telugu", "tibetan", "thai", "upper-hexadecimal",
    265         "lower-roman", "upper-roman", "lower-greek", "lower-alpha", "lower-latin", "upper-alpha", "upper-latin", "afar",
    266         "ethiopic-halehame-aa-et", "ethiopic-halehame-aa-er", "amharic", "ethiopic-halehame-am-et", "amharic-abegede",
    267         "ethiopic-abegede-am-et", "cjk-earthly-branch", "cjk-heavenly-stem", "ethiopic", "ethiopic-halehame-gez",
    268         "ethiopic-abegede", "ethiopic-abegede-gez", "hangul-consonant", "hangul", "lower-norwegian", "oromo",
    269         "ethiopic-halehame-om-et", "sidama", "ethiopic-halehame-sid-et", "somali", "ethiopic-halehame-so-et", "tigre",
    270         "ethiopic-halehame-tig", "tigrinya-er", "ethiopic-halehame-ti-er", "tigrinya-er-abegede",
    271         "ethiopic-abegede-ti-er", "tigrinya-et", "ethiopic-halehame-ti-et", "tigrinya-et-abegede",
    272         "ethiopic-abegede-ti-et", "upper-greek", "upper-norwegian", "asterisks", "footnotes", "hebrew", "armenian",
    273         "lower-armenian", "upper-armenian", "georgian", "cjk-ideographic", "hiragana", "katakana", "hiragana-iroha",
    274         "katakana-iroha"
    275     ],
    276     "-webkit-text-combine": [
    277         "none", "horizontal"
    278     ],
    279     "outline": [
    280         "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
    281     ],
    282     "font": [
    283         "caption", "icon", "menu", "message-box", "small-caption", "-webkit-mini-control", "-webkit-small-control",
    284         "-webkit-control", "status-bar", "italic", "oblique", "small-caps", "normal", "bold", "bolder", "lighter",
    285         "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium",
    286         "large", "x-large", "xx-large", "-webkit-xxx-large", "smaller", "larger", "serif", "sans-serif", "cursive",
    287         "fantasy", "monospace", "-webkit-body"
    288     ],
    289     "dominant-baseline": [
    290         "middle", "auto", "central", "text-before-edge", "text-after-edge", "ideographic", "alphabetic", "hanging",
    291         "mathematical", "use-script", "no-change", "reset-size"
    292     ],
    293     "display": [
    294         "none", "inline", "block", "list-item", "run-in", "compact", "inline-block", "table", "inline-table",
    295         "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group",
    296         "table-column", "table-cell", "table-caption", "-webkit-box", "-webkit-inline-box", "-wap-marquee"
    297     ],
    298     "-webkit-text-emphasis-position": [
    299         "over", "under"
    300     ],
    301     "image-rendering": [
    302         "auto", "optimizespeed", "optimizequality"
    303     ],
    304     "alignment-baseline": [
    305         "baseline", "middle", "auto", "before-edge", "after-edge", "central", "text-before-edge", "text-after-edge",
    306         "ideographic", "alphabetic", "hanging", "mathematical"
    307     ],
    308     "outline-width": [
    309         "medium", "thick", "thin"
    310     ],
    311     "text-line-through-width": [
    312         "normal", "medium", "auto", "thick", "thin"
    313     ],
    314     "box-align": [
    315         "baseline", "center", "stretch", "start", "end"
    316     ],
    317     "border-right-width": [
    318         "medium", "thick", "thin"
    319     ],
    320     "border-top-style": [
    321         "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
    322     ],
    323     "line-height": [
    324         "normal"
    325     ],
    326     "text-overflow": [
    327         "clip", "ellipsis"
    328     ],
    329     "box-direction": [
    330         "normal", "reverse"
    331     ],
    332     "margin-after-collapse": [
    333         "collapse", "separate", "discard"
    334     ],
    335     "page-break-before": [
    336         "left", "right", "auto", "always", "avoid"
    337     ],
    338     "-webkit-hyphens": [
    339         "none", "auto", "manual"
    340     ],
    341     "border-image": [
    342         "repeat", "stretch"
    343     ],
    344     "text-decoration": [
    345         "blink", "line-through", "overline", "underline"
    346     ],
    347     "position": [
    348         "absolute", "fixed", "relative", "static"
    349     ],
    350     "font-family": [
    351         "serif", "sans-serif", "cursive", "fantasy", "monospace", "-webkit-body"
    352     ],
    353     "text-overflow-mode": [
    354         "clip", "ellipsis"
    355     ],
    356     "border-bottom-style": [
    357         "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
    358     ],
    359     "unicode-bidi": [
    360         "normal", "bidi-override", "embed"
    361     ],
    362     "clip-rule": [
    363         "nonzero", "evenodd"
    364     ],
    365     "margin-left": [
    366         "auto"
    367     ],
    368     "margin-top": [
    369         "auto"
    370     ],
    371     "zoom": [
    372         "document", "reset"
    373     ],
    374     "text-overline-style": [
    375         "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave"
    376     ],
    377     "max-width": [
    378         "none"
    379     ],
    380     "empty-cells": [
    381         "hide", "show"
    382     ],
    383     "pointer-events": [
    384         "none", "all", "auto", "visible", "visiblepainted", "visiblefill", "visiblestroke", "painted", "fill", "stroke"
    385     ],
    386     "letter-spacing": [
    387         "normal"
    388     ],
    389     "background-clip": [
    390         "border-box", "content-box", "padding-box"
    391     ],
    392     "-webkit-font-smoothing": [
    393         "none", "auto", "antialiased", "subpixel-antialiased"
    394     ],
    395     "border": [
    396         "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double"
    397     ],
    398     "font-size": [
    399         "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "-webkit-xxx-large", "smaller",
    400         "larger"
    401     ],
    402     "font-variant": [
    403         "small-caps", "normal"
    404     ],
    405     "vertical-align": [
    406         "baseline", "middle", "sub", "super", "text-top", "text-bottom", "top", "bottom", "-webkit-baseline-middle"
    407     ],
    408     "marquee-style": [
    409         "none", "scroll", "slide", "alternate"
    410     ],
    411     "white-space": [
    412         "normal", "nowrap", "pre", "pre-line", "pre-wrap"
    413     ],
    414     "text-underline-width": [
    415         "normal", "medium", "auto", "thick", "thin"
    416     ],
    417     "box-lines": [
    418         "single", "multiple"
    419     ],
    420     "page-break-after": [
    421         "left", "right", "auto", "always", "avoid"
    422     ],
    423     "clip-path": [
    424         "none"
    425     ],
    426     "margin": [
    427         "auto"
    428     ],
    429     "marquee-repetition": [
    430         "infinite"
    431     ],
    432     "margin-right": [
    433         "auto"
    434     ],
    435     "-webkit-text-emphasis-style": [
    436         "circle", "filled", "open", "dot", "double-circle", "triangle", "sesame"
    437     ]
    438 }
    439