Changeset 52495 in webkit
- Timestamp:
- Dec 22, 2009 12:09:42 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r52494 r52495 1 2009-12-22 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: simplify highlighter definition. 6 7 https://bugs.webkit.org/show_bug.cgi?id=32869 8 9 * inspector/syntax-highlight-css-expected.txt: 10 * inspector/syntax-highlight-javascript-expected.txt: 11 * inspector/syntax-highlight.js: 12 (frontend_dumpSyntaxHighlight): 13 1 14 2009-12-21 Darin Adler <darin@apple.com> 2 15 -
trunk/LayoutTests/inspector/syntax-highlight-css-expected.txt
r50664 r52495 1 1 Tests that CSSSourceSyntaxHighlighter detects the tokens. 2 2 3 webkit-css-selector4 webkit-css-selector,*,webkit-css-selector5 webkit-css-at-rule,*,webkit-css-url,*6 webkit-css-at-rule,*,webkit-css-url,*,webkit-css-keyword,*,webkit-css-keyword,*7 webkit-css-at-rule,*,webkit-css-keyword,*,webkit-css-selector,*,webkit-css-property,*,webkit-css-keyword,*8 webkit-css-at-rule,*,webkit-css-property,*9 webkit-css-selector,*,webkit-css-property,*,webkit-css-keyword,*10 webkit-css-selector,*,webkit-css-property,*,webkit-css-number,*,webkit-css-important,*3 a[href='/']: webkit-css-selector 4 #content > a:hover: webkit-css-selector,*,webkit-css-selector 5 @import url(style.css);: webkit-css-at-rule,*,webkit-css-url,* 6 @import url("style.css") projection, tv;: webkit-css-at-rule,*,webkit-css-url,*,webkit-css-keyword,*,webkit-css-keyword,* 7 @media screen { body { color: red; } }: webkit-css-at-rule,*,webkit-css-keyword,*,webkit-css-selector,*,webkit-css-property,*,webkit-css-keyword,* 8 @font-face { font-family: MyHelvetica; }: webkit-css-at-rule,*,webkit-css-property,* 9 p { color: color; red: red; }: webkit-css-selector,*,webkit-css-property,*,webkit-css-keyword,* 10 p { margin: -10px !important; }: webkit-css-selector,*,webkit-css-property,*,webkit-css-number,*,webkit-css-important,* 11 11 -
trunk/LayoutTests/inspector/syntax-highlight-javascript-expected.txt
r50582 r52495 1 1 Tests that JavaScriptSourceSyntaxHighlighter detects the tokens. 2 2 3 webkit-javascript-keyword,webkit-javascript-string,*4 webkit-javascript-regexp5 webkit-javascript-comment6 webkit-javascript-number,*,webkit-javascript-number,*,webkit-javascript-regexp,*,webkit-javascript-ident,*,webkit-javascript-string,*7 webkit-javascript-string,*,webkit-javascript-ident,*,webkit-javascript-number8 webkit-javascript-keyword,*,webkit-javascript-ident,*,webkit-javascript-number,webkit-javascript-comment,*,webkit-javascript-number9 webkit-javascript-comment,webkit-javascript-regexp,*,webkit-javascript-ident,*,webkit-javascript-string,*10 webkit-javascript-string,*11 webkit-javascript-string,*12 webkit-javascript-string,*13 webkit-javascript-ident,webkit-javascript-comment,webkit-javascript-ident3 return'foo';: webkit-javascript-keyword,webkit-javascript-string,* 4 /\//g: webkit-javascript-regexp 5 //ig';: webkit-javascript-comment 6 1 / 2 + /a/.test('a');: webkit-javascript-number,*,webkit-javascript-number,*,webkit-javascript-regexp,*,webkit-javascript-ident,*,webkit-javascript-string,* 7 "\"/".length / 2: webkit-javascript-string,*,webkit-javascript-ident,*,webkit-javascript-number 8 var foo = 1/*/***//2: webkit-javascript-keyword,*,webkit-javascript-ident,*,webkit-javascript-number,webkit-javascript-comment,*,webkit-javascript-number 9 /*comment*//.*/.test('a'): webkit-javascript-comment,webkit-javascript-regexp,*,webkit-javascript-ident,*,webkit-javascript-string,* 10 'f\ oo';: webkit-javascript-string,* 11 '\f\b\t';: webkit-javascript-string,* 12 '/\ /';: webkit-javascript-string,* 13 foo/** / */foo: webkit-javascript-ident,webkit-javascript-comment,webkit-javascript-ident 14 14 -
trunk/LayoutTests/inspector/syntax-highlight.js
r50582 r52495 28 28 } 29 29 } 30 return node_parts.join(",");30 return str + ": " + node_parts.join(","); 31 31 } -
trunk/WebCore/ChangeLog
r52494 r52495 1 2009-12-22 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: simplify highlighter definition. 6 7 https://bugs.webkit.org/show_bug.cgi?id=32869 8 9 * inspector/front-end/CSSSourceSyntaxHighlighter.js: 10 (WebInspector.CSSSourceSyntaxHighlighter): 11 * inspector/front-end/JavaScriptSourceSyntaxHighlighter.js: 12 (WebInspector.JavaScriptSourceSyntaxHighlighter.): 13 (WebInspector.JavaScriptSourceSyntaxHighlighter): 14 * inspector/front-end/SourceSyntaxHighlighter.js: 15 (WebInspector.SourceSyntaxHighlighter.prototype.lex): 16 * inspector/front-end/utilities.js: 17 (): 18 1 19 2009-12-21 Darin Adler <darin@apple.com> 2 20 -
trunk/WebCore/inspector/front-end/CSSSourceSyntaxHighlighter.js
r52439 r52495 54 54 const startBlockPattern = /^{/i; 55 55 const endBlockPattern = /^}/i; 56 57 const propertyKeywords = [ 58 "background", "background-attachment", "background-clip", "background-color", "background-image", 59 "background-origin", "background-position", "background-position-x", "background-position-y", 60 "background-repeat", "background-repeat-x", "background-repeat-y", "background-size", "border", 61 "border-bottom", "border-bottom-color", "border-bottom-left-radius", "border-bottom-right-radius", 62 "border-bottom-style", "border-bottom-width", "border-collapse", "border-color", "border-left", 63 "border-left-color", "border-left-style", "border-left-width", "border-radius", "border-right", 64 "border-right-color", "border-right-style", "border-right-width", "border-spacing", "border-style", 65 "border-top", "border-top-color", "border-top-left-radius", "border-top-right-radius", "border-top-style", 66 "border-top-width", "border-width", "bottom", "caption-side", "clear", "clip", "color", "content", 67 "counter-increment", "counter-reset", "cursor", "direction", "display", "empty-cells", "float", 68 "font", "font-family", "font-size", "font-stretch", "font-style", "font-variant", "font-weight", 69 "height", "left", "letter-spacing", "line-height", "list-style", "list-style-image", "list-style-position", 70 "list-style-type", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "max-height", 71 "max-width", "min-height", "min-width", "opacity", "orphans", "outline", "outline-color", "outline-offset", 72 "outline-style", "outline-width", "overflow", "overflow-x", "overflow-y", "padding", "padding-bottom", 73 "padding-left", "padding-right", "padding-top", "page", "page-break-after", "page-break-before", 74 "page-break-inside", "pointer-events", "position", "quotes", "resize", "right", "size", "src", 75 "table-layout", "text-align", "text-decoration", "text-indent", "text-line-through", "text-line-through-color", 76 "text-line-through-mode", "text-line-through-style", "text-line-through-width", "text-overflow", "text-overline", 77 "text-overline-color", "text-overline-mode", "text-overline-style", "text-overline-width", "text-rendering", 78 "text-shadow", "text-transform", "text-underline", "text-underline-color", "text-underline-mode", 79 "text-underline-style", "text-underline-width", "top", "unicode-bidi", "unicode-range", "vertical-align", 80 "visibility", "white-space", "widows", "width", "word-break", "word-spacing", "word-wrap", "z-index", "zoom", 81 "-webkit-animation", "-webkit-animation-delay", "-webkit-animation-direction", "-webkit-animation-duration", 82 "-webkit-animation-iteration-count", "-webkit-animation-name", "-webkit-animation-play-state", 83 "-webkit-animation-timing-function", "-webkit-appearance", "-webkit-backface-visibility", 84 "-webkit-background-clip", "-webkit-background-composite", "-webkit-background-origin", "-webkit-background-size", 85 "-webkit-binding", "-webkit-border-fit", "-webkit-border-horizontal-spacing", "-webkit-border-image", 86 "-webkit-border-radius", "-webkit-border-vertical-spacing", "-webkit-box-align", "-webkit-box-direction", 87 "-webkit-box-flex", "-webkit-box-flex-group", "-webkit-box-lines", "-webkit-box-ordinal-group", 88 "-webkit-box-orient", "-webkit-box-pack", "-webkit-box-reflect", "-webkit-box-shadow", "-webkit-box-sizing", 89 "-webkit-column-break-after", "-webkit-column-break-before", "-webkit-column-break-inside", "-webkit-column-count", 90 "-webkit-column-gap", "-webkit-column-rule", "-webkit-column-rule-color", "-webkit-column-rule-style", 91 "-webkit-column-rule-width", "-webkit-column-width", "-webkit-columns", "-webkit-font-size-delta", 92 "-webkit-font-smoothing", "-webkit-highlight", "-webkit-line-break", "-webkit-line-clamp", 93 "-webkit-margin-bottom-collapse", "-webkit-margin-collapse", "-webkit-margin-start", "-webkit-margin-top-collapse", 94 "-webkit-marquee", "-webkit-marquee-direction", "-webkit-marquee-increment", "-webkit-marquee-repetition", 95 "-webkit-marquee-speed", "-webkit-marquee-style", "-webkit-mask", "-webkit-mask-attachment", 96 "-webkit-mask-box-image", "-webkit-mask-clip", "-webkit-mask-composite", "-webkit-mask-image", 97 "-webkit-mask-origin", "-webkit-mask-position", "-webkit-mask-position-x", "-webkit-mask-position-y", 98 "-webkit-mask-repeat", "-webkit-mask-repeat-x", "-webkit-mask-repeat-y", "-webkit-mask-size", 99 "-webkit-match-nearest-mail-blockquote-color", "-webkit-nbsp-mode", "-webkit-padding-start", 100 "-webkit-perspective", "-webkit-perspective-origin", "-webkit-perspective-origin-x", "-webkit-perspective-origin-y", 101 "-webkit-rtl-ordering", "-webkit-text-decorations-in-effect", "-webkit-text-fill-color", "-webkit-text-security", 102 "-webkit-text-size-adjust", "-webkit-text-stroke", "-webkit-text-stroke-color", "-webkit-text-stroke-width", 103 "-webkit-transform", "-webkit-transform-origin", "-webkit-transform-origin-x", "-webkit-transform-origin-y", 104 "-webkit-transform-origin-z", "-webkit-transform-style", "-webkit-transition", "-webkit-transition-delay", 105 "-webkit-transition-duration", "-webkit-transition-property", "-webkit-transition-timing-function", 106 "-webkit-user-drag", "-webkit-user-modify", "-webkit-user-select", "-webkit-variable-declaration-block" 107 ].keySet(); 108 109 const valueKeywords = [ 110 "inherit", "initial", "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", 111 "solid", "double", "caption", "icon", "menu", "message-box", "small-caption", "-webkit-mini-control", 112 "-webkit-small-control", "-webkit-control", "status-bar", "italic", "oblique", "all", "small-caps", 113 "normal", "bold", "bolder", "lighter", "xx-small", "x-small", "small", "medium", "large", "x-large", 114 "xx-large", "-webkit-xxx-large", "smaller", "larger", "wider", "narrower", "ultra-condensed", 115 "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", 116 "ultra-expanded", "serif", "sans-serif", "cursive", "fantasy", "monospace", "-webkit-body", "aqua", 117 "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", 118 "red", "silver", "teal", "white", "yellow", "transparent", "-webkit-link", "-webkit-activelink", 119 "activeborder", "activecaption", "appworkspace", "background", "buttonface", "buttonhighlight", 120 "buttonshadow", "buttontext", "captiontext", "graytext", "highlight", "highlighttext", "inactiveborder", 121 "inactivecaption", "inactivecaptiontext", "infobackground", "infotext", "match", "menutext", "scrollbar", 122 "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "window", 123 "windowframe", "windowtext", "-webkit-focus-ring-color", "currentcolor", "grey", "-webkit-text", "repeat", 124 "repeat-x", "repeat-y", "no-repeat", "clear", "copy", "source-over", "source-in", "source-out", 125 "source-atop", "destination-over", "destination-in", "destination-out", "destination-atop", "xor", 126 "plus-darker", "plus-lighter", "baseline", "middle", "sub", "super", "text-top", "text-bottom", "top", 127 "bottom", "-webkit-baseline-middle", "-webkit-auto", "left", "right", "center", "justify", "-webkit-left", 128 "-webkit-right", "-webkit-center", "outside", "inside", "disc", "circle", "square", "decimal", 129 "decimal-leading-zero", "lower-roman", "upper-roman", "lower-greek", "lower-alpha", "lower-latin", 130 "upper-alpha", "upper-latin", "hebrew", "armenian", "georgian", "cjk-ideographic", "hiragana", "katakana", 131 "hiragana-iroha", "katakana-iroha", "inline", "block", "list-item", "run-in", "compact", "inline-block", 132 "table", "inline-table", "table-row-group", "table-header-group", "table-footer-group", "table-row", 133 "table-column-group", "table-column", "table-cell", "table-caption", "-webkit-box", "-webkit-inline-box", 134 "-wap-marquee", "auto", "crosshair", "default", "pointer", "move", "vertical-text", "cell", "context-menu", 135 "alias", "progress", "no-drop", "not-allowed", "-webkit-zoom-in", "-webkit-zoom-out", "e-resize", "ne-resize", 136 "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "ew-resize", "ns-resize", "nesw-resize", 137 "nwse-resize", "col-resize", "row-resize", "text", "wait", "help", "all-scroll", "-webkit-grab", "-webkit-grabbing", 138 "ltr", "rtl", "capitalize", "uppercase", "lowercase", "visible", "collapse", "above", "absolute", "always", 139 "avoid", "below", "bidi-override", "blink", "both", "close-quote", "crop", "cross", "embed", "fixed", "hand", 140 "hide", "higher", "invert", "landscape", "level", "line-through", "local", "loud", "lower", "-webkit-marquee", 141 "mix", "no-close-quote", "no-open-quote", "nowrap", "open-quote", "overlay", "overline", "portrait", "pre", 142 "pre-line", "pre-wrap", "relative", "scroll", "separate", "show", "static", "thick", "thin", "underline", 143 "-webkit-nowrap", "stretch", "start", "end", "reverse", "horizontal", "vertical", "inline-axis", "block-axis", 144 "single", "multiple", "forwards", "backwards", "ahead", "up", "down", "slow", "fast", "infinite", "slide", 145 "alternate", "read-only", "read-write", "read-write-plaintext-only", "element", "ignore", "intrinsic", 146 "min-intrinsic", "clip", "ellipsis", "discard", "dot-dash", "dot-dot-dash", "wave", "continuous", 147 "skip-white-space", "break-all", "break-word", "space", "after-white-space", "checkbox", "radio", "push-button", 148 "square-button", "button", "button-bevel", "default-button", "list-button", "listbox", "listitem", 149 "media-fullscreen-button", "media-mute-button", "media-play-button", "media-seek-back-button", 150 "media-seek-forward-button", "media-rewind-button", "media-return-to-realtime-button", "media-slider", 151 "media-sliderthumb", "media-volume-slider-container", "media-volume-slider", "media-volume-sliderthumb", 152 "media-controls-background", "media-current-time-display", "media-time-remaining-display", "menulist", 153 "menulist-button", "menulist-text", "menulist-textfield", "slider-horizontal", "slider-vertical", 154 "sliderthumb-horizontal", "sliderthumb-vertical", "caret", "searchfield", "searchfield-decoration", 155 "searchfield-results-decoration", "searchfield-results-button", "searchfield-cancel-button", "textfield", 156 "textarea", "caps-lock-indicator", "round", "border", "border-box", "content", "content-box", "padding", 157 "padding-box", "contain", "cover", "logical", "visual", "lines", "running", "paused", "flat", "preserve-3d", 158 "ease", "linear", "ease-in", "ease-out", "ease-in-out", "document", "reset", "visiblePainted", "visibleFill", 159 "visibleStroke", "painted", "fill", "stroke", "antialiased", "subpixel-antialiased", "optimizeSpeed", 160 "optimizeLegibility", "geometricPrecision" 161 ].keySet(); 162 163 const mediaTypes = ["all", "aural", "braille", "embossed", "handheld", "print", "projection", "screen", "tty", "tv"].keySet(); 164 56 165 this.rules = [{ 166 name: "commentAction", 57 167 pattern: /^\/\*[^\*]*\*+([^\/*][^*]*\*+)*\//i, 58 action: commentAction 59 }, { 168 style: "webkit-css-comment" 169 }, { 170 name: "commentStartAction", 60 171 pattern: /^(?:\/\*(?:[^\*]|\*[^\/])*)/i, 61 action: commentStartAction 62 }, { 172 style: "webkit-css-comment", 173 postContinueState: this.ContinueState.Comment 174 }, { 175 name: "commentEndAction", 63 176 pattern: /^(?:(?:[^\*]|\*[^\/])*\*+\/)/i, 64 action: commentEndAction, 65 continueStateCondition: this.ContinueState.Comment 66 }, { 177 style: "webkit-css-comment", 178 preContinueState: this.ContinueState.Comment, 179 postContinueState: this.ContinueState.None 180 }, { 181 name: "commentMiddleAction", 67 182 pattern: /^.*/i, 68 action: commentMiddleAction, 69 continueStateCondition: this.ContinueState.Comment 70 }, { 183 style: "webkit-css-comment", 184 preContinueState: this.ContinueState.Comment 185 }, { 186 name: "selectorAction", 71 187 pattern: /^(?:(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\*)(?:#-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\.-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\[\s*-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\s*(?:(?:=|~=|\|=)\s*(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*'))\s*)?\]|:(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\(\s*(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\s*)?\)))*|(?:#-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\.-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|\[\s*-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\s*(?:(?:=|~=|\|=)\s*(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*'))\s*)?\]|:(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*|-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\(\s*(?:-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*\s*)?\)))+)/i, 72 action: selectorAction, 73 lexStateCondition: this.LexState.Initial 74 }, { 188 style: "webkit-css-selector", 189 preLexState: this.LexState.Initial 190 }, { 191 name: "startRulesetBlockAction", 75 192 pattern: startBlockPattern, 76 action: startRulesetBlockAction,77 lexStateCondition: this.LexState.Initial,78 dontAppendNonToken: true79 }, {193 preLexState: this.LexState.Initial, 194 postLexState: this.LexState.DeclarationProperty 195 }, { 196 name: "propertyAction", 80 197 pattern: identPattern, 81 action: propertyAction, 82 lexStateCondition: this.LexState.DeclarationProperty, 83 dontAppendNonToken: true 84 }, { 198 style: "webkit-css-property", 199 keywords: propertyKeywords, 200 preLexState: this.LexState.DeclarationProperty, 201 }, { 202 name: "declarationColonAction", 85 203 pattern: /^:/i, 86 action: declarationColonAction,87 lexStateCondition: this.LexState.DeclarationProperty,88 dontAppendNonToken: true89 }, {204 preLexState: this.LexState.DeclarationProperty, 205 postLexState: this.LexState.DeclarationValue 206 }, { 207 name: "colorAction", 90 208 pattern: /^(?:#(?:[\da-f]{6}|[\da-f]{3})|rgba\(\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*\)|hsla\(\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*\)|rgb\(\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*\)|hsl\(\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*,\s*(?:\d+|\d*\.\d+)%?\s*\))/i, 91 action: colorAction, 92 lexStateCondition: this.LexState.DeclarationValue 93 }, { 209 style: "webkit-css-color", 210 preLexState: this.LexState.DeclarationValue 211 }, { 212 name: "numvalueAction", 94 213 pattern: /^(?:-?(?:\d+|\d*\.\d+)(?:em|rem|__qem|ex|px|cm|mm|in|pt|pc|deg|rad|grad|turn|ms|s|Hz|kHz|%)?)/i, 95 action: numvalueAction, 96 lexStateCondition: this.LexState.DeclarationValue 97 }, { 214 style: "webkit-css-number", 215 preLexState: this.LexState.DeclarationValue 216 }, { 217 name: "urlAction", 98 218 pattern: urlPattern, 99 action: urlAction, 100 lexStateCondition: this.LexState.DeclarationValue 101 }, { 219 style: "webkit-css-url", 220 preLexState: this.LexState.DeclarationValue 221 }, { 222 name: "stringAction", 102 223 pattern: stringPattern, 103 action: stringAction, 104 lexStateCondition: this.LexState.DeclarationValue 105 }, { 224 style: "webkit-css-string", 225 preLexState: this.LexState.DeclarationValue 226 }, { 227 name: "importantAction", 106 228 pattern: /^!\s*important/i, 107 action: importantAction, 108 lexStateCondition: this.LexState.DeclarationValue 109 }, { 229 style: "webkit-css-important", 230 preLexState: this.LexState.DeclarationValue 231 }, { 232 name: "valueIdentAction", 110 233 pattern: identPattern, 111 action: valueIdentAction, 112 lexStateCondition: this.LexState.DeclarationValue, 113 dontAppendNonToken: true 114 }, { 234 keywords: valueKeywords, 235 style: "webkit-css-keyword", 236 preLexState: this.LexState.DeclarationValue 237 }, { 238 name: "declarationSemicolonAction", 115 239 pattern: /^;/i, 116 action: declarationSemicolonAction,117 lexStateCondition: this.LexState.DeclarationValue,118 dontAppendNonToken: true119 }, {240 preLexState: this.LexState.DeclarationValue, 241 postLexState: this.LexState.DeclarationProperty 242 }, { 243 name: "endRulesetBlockAction", 120 244 pattern: endBlockPattern, 121 action: endRulesetBlockAction, 122 lexStateCondition: this.LexState.DeclarationProperty, 123 dontAppendNonToken: true 124 }, { 125 pattern: endBlockPattern, 126 action: endRulesetBlockAction, 127 lexStateCondition: this.LexState.DeclarationValue, 128 dontAppendNonToken: true 129 }, { 245 preLexState: this.LexState.DeclarationProperty, 246 postLexState: this.LexState.Initial 247 }, { 248 name: "atMediaAction", 130 249 pattern: /^@media/i, 131 action: atMediaAction, 132 lexStateCondition: this.LexState.Initial 133 }, { 250 style: "webkit-css-at-rule", 251 preLexState: this.LexState.Initial, 252 postLexState: this.LexState.AtMedia 253 }, { 254 name: "startAtMediaBlockAction", 134 255 pattern: startBlockPattern, 135 action: startAtMediaBlockAction,136 lexStateCondition: this.LexState.AtMedia,137 dontAppendNonToken: true138 }, {256 preLexState: this.LexState.AtMedia, 257 postLexState: this.LexState.Initial 258 }, { 259 name: "atKeyframesAction", 139 260 pattern: /^@-webkit-keyframes/i, 140 action: atKeyframesAction, 141 lexStateCondition: this.LexState.Initial 142 }, { 261 style: "webkit-css-at-rule", 262 preLexState: this.LexState.Initial, 263 postLexState: this.LexState.AtKeyframes 264 }, { 265 name: "startAtKeyframesBlockAction", 143 266 pattern: startBlockPattern, 144 action: startAtMediaBlockAction, 145 lexStateCondition: this.LexState.AtKeyframes, 146 dontAppendNonToken: true 147 }, { 267 preLexState: this.LexState.AtKeyframes, 268 postLexState: this.LexState.Initial 269 }, { 270 name: "atRuleAction", 271 style: "webkit-css-at-rule", 148 272 pattern: /^@-?(?:\w|(?:\\[\da-f]{1,6}\s?|\.))(?:[-\w]|(?:\\[\da-f]{1,6}\s?|\.))*/i, 149 action: atRuleAction, 150 lexStateCondition: this.LexState.Initial 151 }, { 273 preLexState: this.LexState.Initial, 274 postLexState: this.LexState.AtRule 275 }, { 276 name: "endAtRuleAction", 152 277 pattern: /^;/i, 153 action: endAtRuleAction, 154 lexStateCondition: this.LexState.AtRule 155 }, { 278 preLexState: this.LexState.AtRule, 279 postLexState: this.LexState.Initial 280 }, { 281 name: "urlAction", 156 282 pattern: urlPattern, 157 action: urlAction, 158 lexStateCondition: this.LexState.AtRule 159 }, { 283 style: "webkit-css-url", 284 preLexState: this.LexState.AtRule 285 }, { 286 name: "stringAction", 160 287 pattern: stringPattern, 161 action: stringAction, 162 lexStateCondition: this.LexState.AtRule 163 }, { 288 style: "webkit-css-string", 289 preLexState: this.LexState.AtRule 290 }, { 291 name: "stringAction", 164 292 pattern: stringPattern, 165 action: stringAction, 166 lexStateCondition: this.LexState.AtKeyframes 167 }, { 293 style: "webkit-css-string", 294 preLexState: this.LexState.AtKeyframes 295 }, { 296 name: "atRuleIdentAction", 168 297 pattern: identPattern, 169 action: atRuleIdentAction, 170 lexStateCondition: this.LexState.AtRule, 171 dontAppendNonToken: true 172 }, { 298 keywords: mediaTypes, 299 style: "webkit-css-keyword", 300 preLexState: this.LexState.AtRule 301 }, { 302 name: "atRuleIdentAction", 173 303 pattern: identPattern, 174 action: atRuleIdentAction, 175 lexStateCondition: this.LexState.AtMedia, 176 dontAppendNonToken: true 177 }, { 304 keywords: mediaTypes, 305 style: "webkit-css-keyword", 306 preLexState: this.LexState.AtMedia, 307 }, { 308 name: "startAtRuleBlockAction", 178 309 pattern: startBlockPattern, 179 action: startAtRuleBlockAction, 180 lexStateCondition: this.LexState.AtRule, 181 dontAppendNonToken: true 310 preLexState: this.LexState.AtRule, 311 postLexState: this.LexState.DeclarationProperty 182 312 }]; 183 184 function commentAction(token)185 {186 this.cursor += token.length;187 this.newLine.appendChild(this.createSpan(token, "webkit-css-comment"));188 }189 190 function commentStartAction(token)191 {192 this.cursor += token.length;193 this.newLine.appendChild(this.createSpan(token, "webkit-css-comment"));194 this.continueState = this.ContinueState.Comment;195 }196 197 function commentEndAction(token)198 {199 this.cursor += token.length;200 this.newLine.appendChild(this.createSpan(token, "webkit-css-comment"));201 this.continueState = this.ContinueState.None;202 }203 204 function commentMiddleAction(token)205 {206 this.cursor += token.length;207 this.newLine.appendChild(this.createSpan(token, "webkit-css-comment"));208 }209 210 function selectorAction(token)211 {212 this.cursor += token.length;213 this.newLine.appendChild(this.createSpan(token, "webkit-css-selector"));214 }215 216 function startRulesetBlockAction(token)217 {218 this.cursor += token.length;219 this.nonToken += token;220 this.lexState = this.LexState.DeclarationProperty;221 }222 223 function endRulesetBlockAction(token)224 {225 this.cursor += token.length;226 this.nonToken += token;227 this.lexState = this.LexState.Initial;228 }229 230 const propertyKeywords = {231 "background": true,232 "background-attachment": true,233 "background-clip": true,234 "background-color": true,235 "background-image": true,236 "background-origin": true,237 "background-position": true,238 "background-position-x": true,239 "background-position-y": true,240 "background-repeat": true,241 "background-repeat-x": true,242 "background-repeat-y": true,243 "background-size": true,244 "border": true,245 "border-bottom": true,246 "border-bottom-color": true,247 "border-bottom-left-radius": true,248 "border-bottom-right-radius": true,249 "border-bottom-style": true,250 "border-bottom-width": true,251 "border-collapse": true,252 "border-color": true,253 "border-left": true,254 "border-left-color": true,255 "border-left-style": true,256 "border-left-width": true,257 "border-radius": true,258 "border-right": true,259 "border-right-color": true,260 "border-right-style": true,261 "border-right-width": true,262 "border-spacing": true,263 "border-style": true,264 "border-top": true,265 "border-top-color": true,266 "border-top-left-radius": true,267 "border-top-right-radius": true,268 "border-top-style": true,269 "border-top-width": true,270 "border-width": true,271 "bottom": true,272 "caption-side": true,273 "clear": true,274 "clip": true,275 "color": true,276 "content": true,277 "counter-increment": true,278 "counter-reset": true,279 "cursor": true,280 "direction": true,281 "display": true,282 "empty-cells": true,283 "float": true,284 "font": true,285 "font-family": true,286 "font-size": true,287 "font-stretch": true,288 "font-style": true,289 "font-variant": true,290 "font-weight": true,291 "height": true,292 "left": true,293 "letter-spacing": true,294 "line-height": true,295 "list-style": true,296 "list-style-image": true,297 "list-style-position": true,298 "list-style-type": true,299 "margin": true,300 "margin-bottom": true,301 "margin-left": true,302 "margin-right": true,303 "margin-top": true,304 "max-height": true,305 "max-width": true,306 "min-height": true,307 "min-width": true,308 "opacity": true,309 "orphans": true,310 "outline": true,311 "outline-color": true,312 "outline-offset": true,313 "outline-style": true,314 "outline-width": true,315 "overflow": true,316 "overflow-x": true,317 "overflow-y": true,318 "padding": true,319 "padding-bottom": true,320 "padding-left": true,321 "padding-right": true,322 "padding-top": true,323 "page": true,324 "page-break-after": true,325 "page-break-before": true,326 "page-break-inside": true,327 "pointer-events": true,328 "position": true,329 "quotes": true,330 "resize": true,331 "right": true,332 "size": true,333 "src": true,334 "table-layout": true,335 "text-align": true,336 "text-decoration": true,337 "text-indent": true,338 "text-line-through": true,339 "text-line-through-color": true,340 "text-line-through-mode": true,341 "text-line-through-style": true,342 "text-line-through-width": true,343 "text-overflow": true,344 "text-overline": true,345 "text-overline-color": true,346 "text-overline-mode": true,347 "text-overline-style": true,348 "text-overline-width": true,349 "text-rendering": true,350 "text-shadow": true,351 "text-transform": true,352 "text-underline": true,353 "text-underline-color": true,354 "text-underline-mode": true,355 "text-underline-style": true,356 "text-underline-width": true,357 "top": true,358 "unicode-bidi": true,359 "unicode-range": true,360 "vertical-align": true,361 "visibility": true,362 "white-space": true,363 "widows": true,364 "width": true,365 "word-break": true,366 "word-spacing": true,367 "word-wrap": true,368 "z-index": true,369 "zoom": true,370 "-webkit-animation": true,371 "-webkit-animation-delay": true,372 "-webkit-animation-direction": true,373 "-webkit-animation-duration": true,374 "-webkit-animation-iteration-count": true,375 "-webkit-animation-name": true,376 "-webkit-animation-play-state": true,377 "-webkit-animation-timing-function": true,378 "-webkit-appearance": true,379 "-webkit-backface-visibility": true,380 "-webkit-background-clip": true,381 "-webkit-background-composite": true,382 "-webkit-background-origin": true,383 "-webkit-background-size": true,384 "-webkit-binding": true,385 "-webkit-border-fit": true,386 "-webkit-border-horizontal-spacing": true,387 "-webkit-border-image": true,388 "-webkit-border-radius": true,389 "-webkit-border-vertical-spacing": true,390 "-webkit-box-align": true,391 "-webkit-box-direction": true,392 "-webkit-box-flex": true,393 "-webkit-box-flex-group": true,394 "-webkit-box-lines": true,395 "-webkit-box-ordinal-group": true,396 "-webkit-box-orient": true,397 "-webkit-box-pack": true,398 "-webkit-box-reflect": true,399 "-webkit-box-shadow": true,400 "-webkit-box-sizing": true,401 "-webkit-column-break-after": true,402 "-webkit-column-break-before": true,403 "-webkit-column-break-inside": true,404 "-webkit-column-count": true,405 "-webkit-column-gap": true,406 "-webkit-column-rule": true,407 "-webkit-column-rule-color": true,408 "-webkit-column-rule-style": true,409 "-webkit-column-rule-width": true,410 "-webkit-column-width": true,411 "-webkit-columns": true,412 "-webkit-font-size-delta": true,413 "-webkit-font-smoothing": true,414 "-webkit-highlight": true,415 "-webkit-line-break": true,416 "-webkit-line-clamp": true,417 "-webkit-margin-bottom-collapse": true,418 "-webkit-margin-collapse": true,419 "-webkit-margin-start": true,420 "-webkit-margin-top-collapse": true,421 "-webkit-marquee": true,422 "-webkit-marquee-direction": true,423 "-webkit-marquee-increment": true,424 "-webkit-marquee-repetition": true,425 "-webkit-marquee-speed": true,426 "-webkit-marquee-style": true,427 "-webkit-mask": true,428 "-webkit-mask-attachment": true,429 "-webkit-mask-box-image": true,430 "-webkit-mask-clip": true,431 "-webkit-mask-composite": true,432 "-webkit-mask-image": true,433 "-webkit-mask-origin": true,434 "-webkit-mask-position": true,435 "-webkit-mask-position-x": true,436 "-webkit-mask-position-y": true,437 "-webkit-mask-repeat": true,438 "-webkit-mask-repeat-x": true,439 "-webkit-mask-repeat-y": true,440 "-webkit-mask-size": true,441 "-webkit-match-nearest-mail-blockquote-color": true,442 "-webkit-nbsp-mode": true,443 "-webkit-padding-start": true,444 "-webkit-perspective": true,445 "-webkit-perspective-origin": true,446 "-webkit-perspective-origin-x": true,447 "-webkit-perspective-origin-y": true,448 "-webkit-rtl-ordering": true,449 "-webkit-text-decorations-in-effect": true,450 "-webkit-text-fill-color": true,451 "-webkit-text-security": true,452 "-webkit-text-size-adjust": true,453 "-webkit-text-stroke": true,454 "-webkit-text-stroke-color": true,455 "-webkit-text-stroke-width": true,456 "-webkit-transform": true,457 "-webkit-transform-origin": true,458 "-webkit-transform-origin-x": true,459 "-webkit-transform-origin-y": true,460 "-webkit-transform-origin-z": true,461 "-webkit-transform-style": true,462 "-webkit-transition": true,463 "-webkit-transition-delay": true,464 "-webkit-transition-duration": true,465 "-webkit-transition-property": true,466 "-webkit-transition-timing-function": true,467 "-webkit-user-drag": true,468 "-webkit-user-modify": true,469 "-webkit-user-select": true,470 "-webkit-variable-declaration-block": true471 };472 function propertyAction(token)473 {474 this.cursor += token.length;475 if (token in propertyKeywords) {476 this.appendNonToken.call(this);477 this.newLine.appendChild(this.createSpan(token, "webkit-css-property"));478 } else479 this.nonToken += token;480 }481 482 function declarationColonAction(token)483 {484 this.cursor += token.length;485 this.nonToken += token;486 this.lexState = this.LexState.DeclarationValue;487 }488 489 const valueKeywords = {490 "inherit": true,491 "initial": true,492 "none": true,493 "hidden": true,494 "inset": true,495 "groove": true,496 "ridge": true,497 "outset": true,498 "dotted": true,499 "dashed": true,500 "solid": true,501 "double": true,502 "caption": true,503 "icon": true,504 "menu": true,505 "message-box": true,506 "small-caption": true,507 "-webkit-mini-control": true,508 "-webkit-small-control": true,509 "-webkit-control": true,510 "status-bar": true,511 "italic": true,512 "oblique": true,513 "all": true,514 "small-caps": true,515 "normal": true,516 "bold": true,517 "bolder": true,518 "lighter": true,519 "xx-small": true,520 "x-small": true,521 "small": true,522 "medium": true,523 "large": true,524 "x-large": true,525 "xx-large": true,526 "-webkit-xxx-large": true,527 "smaller": true,528 "larger": true,529 "wider": true,530 "narrower": true,531 "ultra-condensed": true,532 "extra-condensed": true,533 "condensed": true,534 "semi-condensed": true,535 "semi-expanded": true,536 "expanded": true,537 "extra-expanded": true,538 "ultra-expanded": true,539 "serif": true,540 "sans-serif": true,541 "cursive": true,542 "fantasy": true,543 "monospace": true,544 "-webkit-body": true,545 "aqua": true,546 "black": true,547 "blue": true,548 "fuchsia": true,549 "gray": true,550 "green": true,551 "lime": true,552 "maroon": true,553 "navy": true,554 "olive": true,555 "orange": true,556 "purple": true,557 "red": true,558 "silver": true,559 "teal": true,560 "white": true,561 "yellow": true,562 "transparent": true,563 "-webkit-link": true,564 "-webkit-activelink": true,565 "activeborder": true,566 "activecaption": true,567 "appworkspace": true,568 "background": true,569 "buttonface": true,570 "buttonhighlight": true,571 "buttonshadow": true,572 "buttontext": true,573 "captiontext": true,574 "graytext": true,575 "highlight": true,576 "highlighttext": true,577 "inactiveborder": true,578 "inactivecaption": true,579 "inactivecaptiontext": true,580 "infobackground": true,581 "infotext": true,582 "match": true,583 "menutext": true,584 "scrollbar": true,585 "threeddarkshadow": true,586 "threedface": true,587 "threedhighlight": true,588 "threedlightshadow": true,589 "threedshadow": true,590 "window": true,591 "windowframe": true,592 "windowtext": true,593 "-webkit-focus-ring-color": true,594 "currentcolor": true,595 "grey": true,596 "-webkit-text": true,597 "repeat": true,598 "repeat-x": true,599 "repeat-y": true,600 "no-repeat": true,601 "clear": true,602 "copy": true,603 "source-over": true,604 "source-in": true,605 "source-out": true,606 "source-atop": true,607 "destination-over": true,608 "destination-in": true,609 "destination-out": true,610 "destination-atop": true,611 "xor": true,612 "plus-darker": true,613 "plus-lighter": true,614 "baseline": true,615 "middle": true,616 "sub": true,617 "super": true,618 "text-top": true,619 "text-bottom": true,620 "top": true,621 "bottom": true,622 "-webkit-baseline-middle": true,623 "-webkit-auto": true,624 "left": true,625 "right": true,626 "center": true,627 "justify": true,628 "-webkit-left": true,629 "-webkit-right": true,630 "-webkit-center": true,631 "outside": true,632 "inside": true,633 "disc": true,634 "circle": true,635 "square": true,636 "decimal": true,637 "decimal-leading-zero": true,638 "lower-roman": true,639 "upper-roman": true,640 "lower-greek": true,641 "lower-alpha": true,642 "lower-latin": true,643 "upper-alpha": true,644 "upper-latin": true,645 "hebrew": true,646 "armenian": true,647 "georgian": true,648 "cjk-ideographic": true,649 "hiragana": true,650 "katakana": true,651 "hiragana-iroha": true,652 "katakana-iroha": true,653 "inline": true,654 "block": true,655 "list-item": true,656 "run-in": true,657 "compact": true,658 "inline-block": true,659 "table": true,660 "inline-table": true,661 "table-row-group": true,662 "table-header-group": true,663 "table-footer-group": true,664 "table-row": true,665 "table-column-group": true,666 "table-column": true,667 "table-cell": true,668 "table-caption": true,669 "-webkit-box": true,670 "-webkit-inline-box": true,671 "-wap-marquee": true,672 "auto": true,673 "crosshair": true,674 "default": true,675 "pointer": true,676 "move": true,677 "vertical-text": true,678 "cell": true,679 "context-menu": true,680 "alias": true,681 "progress": true,682 "no-drop": true,683 "not-allowed": true,684 "-webkit-zoom-in": true,685 "-webkit-zoom-out": true,686 "e-resize": true,687 "ne-resize": true,688 "nw-resize": true,689 "n-resize": true,690 "se-resize": true,691 "sw-resize": true,692 "s-resize": true,693 "w-resize": true,694 "ew-resize": true,695 "ns-resize": true,696 "nesw-resize": true,697 "nwse-resize": true,698 "col-resize": true,699 "row-resize": true,700 "text": true,701 "wait": true,702 "help": true,703 "all-scroll": true,704 "-webkit-grab": true,705 "-webkit-grabbing": true,706 "ltr": true,707 "rtl": true,708 "capitalize": true,709 "uppercase": true,710 "lowercase": true,711 "visible": true,712 "collapse": true,713 "above": true,714 "absolute": true,715 "always": true,716 "avoid": true,717 "below": true,718 "bidi-override": true,719 "blink": true,720 "both": true,721 "close-quote": true,722 "crop": true,723 "cross": true,724 "embed": true,725 "fixed": true,726 "hand": true,727 "hide": true,728 "higher": true,729 "invert": true,730 "landscape": true,731 "level": true,732 "line-through": true,733 "local": true,734 "loud": true,735 "lower": true,736 "-webkit-marquee": true,737 "mix": true,738 "no-close-quote": true,739 "no-open-quote": true,740 "nowrap": true,741 "open-quote": true,742 "overlay": true,743 "overline": true,744 "portrait": true,745 "pre": true,746 "pre-line": true,747 "pre-wrap": true,748 "relative": true,749 "scroll": true,750 "separate": true,751 "show": true,752 "static": true,753 "thick": true,754 "thin": true,755 "underline": true,756 "-webkit-nowrap": true,757 "stretch": true,758 "start": true,759 "end": true,760 "reverse": true,761 "horizontal": true,762 "vertical": true,763 "inline-axis": true,764 "block-axis": true,765 "single": true,766 "multiple": true,767 "forwards": true,768 "backwards": true,769 "ahead": true,770 "up": true,771 "down": true,772 "slow": true,773 "fast": true,774 "infinite": true,775 "slide": true,776 "alternate": true,777 "read-only": true,778 "read-write": true,779 "read-write-plaintext-only": true,780 "element": true,781 "ignore": true,782 "intrinsic": true,783 "min-intrinsic": true,784 "clip": true,785 "ellipsis": true,786 "discard": true,787 "dot-dash": true,788 "dot-dot-dash": true,789 "wave": true,790 "continuous": true,791 "skip-white-space": true,792 "break-all": true,793 "break-word": true,794 "space": true,795 "after-white-space": true,796 "checkbox": true,797 "radio": true,798 "push-button": true,799 "square-button": true,800 "button": true,801 "button-bevel": true,802 "default-button": true,803 "list-button": true,804 "listbox": true,805 "listitem": true,806 "media-fullscreen-button": true,807 "media-mute-button": true,808 "media-play-button": true,809 "media-seek-back-button": true,810 "media-seek-forward-button": true,811 "media-rewind-button": true,812 "media-return-to-realtime-button": true,813 "media-slider": true,814 "media-sliderthumb": true,815 "media-volume-slider-container": true,816 "media-volume-slider": true,817 "media-volume-sliderthumb": true,818 "media-controls-background": true,819 "media-current-time-display": true,820 "media-time-remaining-display": true,821 "menulist": true,822 "menulist-button": true,823 "menulist-text": true,824 "menulist-textfield": true,825 "slider-horizontal": true,826 "slider-vertical": true,827 "sliderthumb-horizontal": true,828 "sliderthumb-vertical": true,829 "caret": true,830 "searchfield": true,831 "searchfield-decoration": true,832 "searchfield-results-decoration": true,833 "searchfield-results-button": true,834 "searchfield-cancel-button": true,835 "textfield": true,836 "textarea": true,837 "caps-lock-indicator": true,838 "round": true,839 "border": true,840 "border-box": true,841 "content": true,842 "content-box": true,843 "padding": true,844 "padding-box": true,845 "contain": true,846 "cover": true,847 "logical": true,848 "visual": true,849 "lines": true,850 "running": true,851 "paused": true,852 "flat": true,853 "preserve-3d": true,854 "ease": true,855 "linear": true,856 "ease-in": true,857 "ease-out": true,858 "ease-in-out": true,859 "document": true,860 "reset": true,861 "visiblePainted": true,862 "visibleFill": true,863 "visibleStroke": true,864 "painted": true,865 "fill": true,866 "stroke": true,867 "antialiased": true,868 "subpixel-antialiased": true,869 "optimizeSpeed": true,870 "optimizeLegibility": true,871 "geometricPrecision": true872 };873 function valueIdentAction(token) {874 this.cursor += token.length;875 if (token in valueKeywords) {876 this.appendNonToken.call(this);877 this.newLine.appendChild(this.createSpan(token, "webkit-css-keyword"));878 } else879 this.nonToken += token;880 }881 882 function numvalueAction(token)883 {884 this.cursor += token.length;885 this.newLine.appendChild(this.createSpan(token, "webkit-css-number"));886 }887 888 function declarationSemicolonAction(token)889 {890 this.cursor += token.length;891 this.nonToken += token;892 this.lexState = this.LexState.DeclarationProperty;893 }894 895 function urlAction(token)896 {897 this.cursor += token.length;898 this.newLine.appendChild(this.createSpan(token, "webkit-css-url"));899 }900 901 function stringAction(token)902 {903 this.cursor += token.length;904 this.newLine.appendChild(this.createSpan(token, "webkit-css-string"));905 }906 907 function colorAction(token)908 {909 this.cursor += token.length;910 this.newLine.appendChild(this.createSpan(token, "webkit-css-color"));911 }912 913 function importantAction(token)914 {915 this.cursor += token.length;916 this.newLine.appendChild(this.createSpan(token, "webkit-css-important"));917 }918 919 function atMediaAction(token)920 {921 this.cursor += token.length;922 this.newLine.appendChild(this.createSpan(token, "webkit-css-at-rule"));923 this.lexState = this.LexState.AtMedia;924 }925 926 function startAtMediaBlockAction(token)927 {928 this.cursor += token.length;929 this.nonToken += token;930 this.lexState = this.LexState.Initial;931 }932 933 function atKeyframesAction(token)934 {935 this.cursor += token.length;936 this.newLine.appendChild(this.createSpan(token, "webkit-css-at-rule"));937 this.lexState = this.LexState.AtKeyframes;938 }939 940 function startAtKeyframesBlockAction(token)941 {942 this.cursor += token.length;943 this.nonToken += token;944 this.lexState = this.LexState.Initial;945 }946 947 function atRuleAction(token) {948 this.cursor += token.length;949 this.newLine.appendChild(this.createSpan(token, "webkit-css-at-rule"));950 this.lexState = this.LexState.AtRule;951 }952 953 function endAtRuleAction(token) {954 this.cursor += token.length;955 this.nonToken += token;956 this.lexState = this.LexState.Initial;957 }958 959 function startAtRuleBlockAction(token)960 {961 this.cursor += token.length;962 this.nonToken += token;963 this.lexState = this.LexState.DeclarationProperty;964 }965 966 const mediaTypes = ["all", "aural", "braille", "embossed", "handheld", "print", "projection", "screen", "tty", "tv"];967 function atRuleIdentAction(token) {968 this.cursor += token.length;969 if (mediaTypes.indexOf(token) === -1)970 this.nonToken += token;971 else {972 this.appendNonToken.call(this);973 this.newLine.appendChild(this.createSpan(token, "webkit-css-keyword"));974 }975 }976 313 } 977 314 -
trunk/WebCore/inspector/front-end/JavaScriptSourceSyntaxHighlighter.js
r52439 r52495 47 47 this.lexState = this.LexState.Initial; 48 48 this.continueState = this.ContinueState.None; 49 49 50 const keywords = [ 51 "null", "true", "false", "break", "case", "catch", "const", "default", "finally", "for", 52 "instanceof", "new", "var", "continue", "function", "return", "void", "delete", "if", 53 "this", "do", "while", "else", "in", "switch", "throw", "try", "typeof", "debugger", 54 "class", "enum", "export", "extends", "import", "super", "get", "set" 55 ].keySet(); 56 50 57 this.rules = [{ 58 name: "singleLineCommentAction", 51 59 pattern: /^(?:\/\/.*)/, 52 action: singleLineCommentAction 53 }, { 60 style: "webkit-javascript-comment" 61 }, { 62 name: "multiLineSingleLineCommentAction", 54 63 pattern: /^(?:\/\*(?:[^\*]|\*[^\/])*\*+\/)/, 55 action: multiLineSingleLineCommentAction 56 }, { 64 style: "webkit-javascript-comment" 65 }, { 66 name: "multiLineCommentStartAction", 57 67 pattern: /^(?:\/\*(?:[^\*]|\*[^\/])*)/, 58 action: multiLineCommentStartAction 59 }, { 68 style: "webkit-javascript-comment", 69 postContinueState: this.ContinueState.Comment 70 }, { 71 name: "multiLineCommentEndAction", 60 72 pattern: /^(?:(?:[^\*]|\*[^\/])*\*+\/)/, 61 action: multiLineCommentEndAction, 62 continueStateCondition: this.ContinueState.Comment 63 }, { 73 style: "webkit-javascript-comment", 74 preContinueState: this.ContinueState.Comment, 75 postContinueState: this.ContinueState.None 76 }, { 77 name: "multiLineCommentMiddleAction", 64 78 pattern: /^.*/, 65 action: multiLineCommentMiddleAction, 66 continueStateCondition: this.ContinueState.Comment 67 }, { 79 style: "webkit-javascript-comment", 80 preContinueState: this.ContinueState.Comment 81 }, { 82 name: "numericLiteralAction", 68 83 pattern: /^(?:(?:0|[1-9]\d*)\.\d+?(?:[eE](?:\d+|\+\d+|-\d+))?|\.\d+(?:[eE](?:\d+|\+\d+|-\d+))?|(?:0|[1-9]\d*)(?:[eE](?:\d+|\+\d+|-\d+))?|0x[0-9a-fA-F]+|0X[0-9a-fA-F]+)/, 69 action: numericLiteralAction 70 }, { 84 style: "webkit-javascript-number", 85 postLexState: this.LexState.DivisionAllowed 86 }, { 87 name: "stringLiteralAction", 71 88 pattern: /^(?:"(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*"|'(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*')/, 72 action: stringLiteralAction 73 }, { 89 style: "webkit-javascript-string", 90 postLexState: this.LexState.Initial 91 }, { 92 name: "singleQuoteStringStartAction", 74 93 pattern: /^(?:'(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/, 75 action: singleQuoteStringStartAction 76 }, { 94 style: "webkit-javascript-string", 95 postContinueState: this.ContinueState.SingleQuoteString 96 }, { 97 name: "singleQuoteStringEndAction", 77 98 pattern: /^(?:(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*')/, 78 action: singleQuoteStringEndAction, 79 continueStateCondition: this.ContinueState.SingleQuoteString 80 }, { 99 style: "webkit-javascript-string", 100 preContinueState: this.ContinueState.SingleQuoteString, 101 postContinueState: this.ContinueState.None 102 }, { 103 name: "singleQuoteStringMiddleAction", 81 104 pattern: /^(?:(?:[^'\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/, 82 action: singleQuoteStringMiddleAction, 83 continueStateCondition: this.ContinueState.SingleQuoteString 84 }, { 105 style: "webkit-javascript-string", 106 preContinueState: this.ContinueState.SingleQuoteString 107 }, { 108 name: "doubleQuoteStringStartAction", 85 109 pattern: /^(?:"(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/, 86 action: doubleQuoteStringStartAction 87 }, { 110 style: "webkit-javascript-string", 111 postContinueState: this.ContinueState.DoubleQuoteString 112 }, { 113 name: "doubleQuoteStringEndAction", 88 114 pattern: /^(?:(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*")/, 89 action: doubleQuoteStringEndAction, 90 continueStateCondition: this.ContinueState.DoubleQuoteString 91 }, { 115 style: "webkit-javascript-string", 116 preContinueState: this.ContinueState.DoubleQuoteString, 117 postContinueState: this.ContinueState.None 118 }, { 119 name: "doubleQuoteStringMiddleAction", 92 120 pattern: /^(?:(?:[^"\\]|\\(?:['"\bfnrtv]|[^'"\bfnrtv0-9xu]|0|x[0-9a-fA-F][0-9a-fA-F]|(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])))*)\\$/, 93 action: doubleQuoteStringMiddleAction, 94 continueStateCondition: this.ContinueState.DoubleQuoteString 95 }, { 121 style: "webkit-javascript-string", 122 preContinueState: this.ContinueState.DoubleQuoteString 123 }, { 124 name: "keywordAction", 96 125 pattern: /^(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/, 97 action: identOrKeywordAction 98 }, { 126 keywords: keywords, 127 style: "webkit-javascript-keyword", 128 postLexState: this.LexState.Initial 129 }, { 130 name: "identAction", 131 pattern: /^(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/, 132 style: "webkit-javascript-ident", 133 callback: function(identElement) { identElement.addEventListener("mouseover", showDatatip, false); }, 134 postLexState: this.LexState.DivisionAllowed 135 }, { 136 name: "rightParenAction", 99 137 pattern: /^\)/, 100 action: rightParenAction,101 dontAppendNonToken: true102 }, {138 postLexState: this.LexState.DivisionAllowed 139 }, { 140 name: "punctuatorAction", 103 141 pattern: /^(?:<=|>=|===|==|!=|!==|\+\+|\-\-|<<|>>|>>>|&&|\|\||\+=|\-=|\*=|%=|<<=|>>=|>>>=|&=|\|=|^=|[{}\(\[\]\.;,<>\+\-\*%&\|\^!~\?:=])/, 104 action: punctuatorAction,105 dontAppendNonToken: true106 }, {142 postLexState: this.LexState.Initial 143 }, { 144 name: "divPunctuatorAction", 107 145 pattern: /^(?:\/=?)/, 108 action: divPunctuatorAction,109 lexStateCondition: this.LexState.DivisionAllowed,110 dontAppendNonToken: true111 }, {146 preLexState: this.LexState.DivisionAllowed, 147 postLexState: this.LexState.Initial 148 }, { 149 name: "regExpLiteralAction", 112 150 pattern: /^(?:\/(?:(?:\\.)|[^\\*\/])(?:(?:\\.)|[^\\/])*\/(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/, 113 action: regExpLiteralAction 114 }, { 151 style: "webkit-javascript-regexp", 152 postLexState: this.LexState.Initial 153 }, { 154 name: "regExpStartAction", 115 155 pattern: /^(?:\/(?:(?:\\.)|[^\\*\/])(?:(?:\\.)|[^\\/])*)\\$/, 116 action: regExpStartAction 117 }, { 156 style: "webkit-javascript-regexp", 157 postContinueState: this.ContinueState.RegExp 158 }, { 159 name: "regExpEndAction", 118 160 pattern: /^(?:(?:(?:\\.)|[^\\/])*\/(?:(?:[a-zA-Z]|[$_]|\\(?:u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))|[0-9])*)/, 119 action: regExpEndAction, 120 continueStateCondition: this.ContinueState.RegExp 121 }, { 161 style: "webkit-javascript-regexp", 162 preContinueState: this.ContinueState.RegExp, 163 postContinueState: this.ContinueState.None 164 }, { 165 name: "regExpMiddleAction", 122 166 pattern: /^(?:(?:(?:\\.)|[^\\/])*)\\$/, 123 action: regExpMiddleAction,124 continueStateCondition: this.ContinueState.RegExp167 style: "webkit-javascript-regexp", 168 preContinueState: this.ContinueState.RegExp 125 169 }]; 126 127 function singleLineCommentAction(token) 128 { 129 this.cursor += token.length; 130 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment")); 131 } 132 133 function multiLineSingleLineCommentAction(token) 134 { 135 this.cursor += token.length; 136 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment")); 137 } 138 139 function multiLineCommentStartAction(token) 140 { 141 this.cursor += token.length; 142 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment")); 143 this.continueState = this.ContinueState.Comment; 144 } 145 146 function multiLineCommentEndAction(token) 147 { 148 this.cursor += token.length; 149 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment")); 150 this.continueState = this.ContinueState.None; 151 } 152 153 function multiLineCommentMiddleAction(token) 154 { 155 this.cursor += token.length; 156 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-comment")); 157 } 158 159 function numericLiteralAction(token) 160 { 161 this.cursor += token.length; 162 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-number")); 163 this.lexState = this.LexState.DivisionAllowed; 164 } 165 166 function stringLiteralAction(token) 167 { 168 this.cursor += token.length; 169 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string")); 170 this.lexState = this.LexState.Initial; 171 } 172 173 function singleQuoteStringStartAction(token) 174 { 175 this.cursor += token.length; 176 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string")); 177 this.continueState = this.ContinueState.SingleQuoteString; 178 } 179 180 function singleQuoteStringEndAction(token) 181 { 182 this.cursor += token.length; 183 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string")); 184 this.continueState = this.ContinueState.None; 185 } 186 187 function singleQuoteStringMiddleAction(token) 188 { 189 this.cursor += token.length; 190 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string")); 191 } 192 193 function doubleQuoteStringStartAction(token) 194 { 195 this.cursor += token.length; 196 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string")); 197 this.continueState = this.ContinueState.DoubleQuoteString; 198 } 199 200 function doubleQuoteStringEndAction(token) 201 { 202 this.cursor += token.length; 203 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string")); 204 this.continueState = this.ContinueState.None; 205 } 206 207 function doubleQuoteStringMiddleAction(token) 208 { 209 this.cursor += token.length; 210 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-string")); 211 } 212 213 function regExpLiteralAction(token) 214 { 215 this.cursor += token.length; 216 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-regexp")); 217 this.lexState = this.LexState.Initial; 218 } 219 220 function regExpStartAction(token) 221 { 222 this.cursor += token.length; 223 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-regexp")); 224 this.continueState = this.ContinueState.RegExp; 225 } 226 227 function regExpEndAction(token) 228 { 229 this.cursor += token.length; 230 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-regexp")); 231 this.continueState = this.ContinueState.None; 232 } 233 234 function regExpMiddleAction(token) 235 { 236 this.cursor += token.length; 237 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-regexp")); 238 } 239 240 const keywords = { 241 "null": true, 242 "true": true, 243 "false": true, 244 "break": true, 245 "case": true, 246 "catch": true, 247 "const": true, 248 "default": true, 249 "finally": true, 250 "for": true, 251 "instanceof": true, 252 "new": true, 253 "var": true, 254 "continue": true, 255 "function": true, 256 "return": true, 257 "void": true, 258 "delete": true, 259 "if": true, 260 "this": true, 261 "do": true, 262 "while": true, 263 "else": true, 264 "in": true, 265 "switch": true, 266 "throw": true, 267 "try": true, 268 "typeof": true, 269 "debugger": true, 270 "class": true, 271 "enum": true, 272 "export": true, 273 "extends": true, 274 "import": true, 275 "super": true, 276 "get": true, 277 "set": true 278 }; 279 function identOrKeywordAction(token) 280 { 281 this.cursor += token.length; 282 283 if (token in keywords) { 284 this.newLine.appendChild(this.createSpan(token, "webkit-javascript-keyword")); 285 this.lexState = this.LexState.Initial; 286 } else { 287 var identElement = this.createSpan(token, "webkit-javascript-ident"); 288 identElement.addEventListener("mouseover", showDatatip, false); 289 this.newLine.appendChild(identElement); 290 this.lexState = this.LexState.DivisionAllowed; 291 } 292 } 293 170 294 171 function showDatatip(event) { 295 172 if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused) … … 322 199 } 323 200 } 324 325 function divPunctuatorAction(token)326 {327 this.cursor += token.length;328 this.nonToken += token;329 this.lexState = this.LexState.Initial;330 }331 332 function rightParenAction(token)333 {334 this.cursor += token.length;335 this.nonToken += token;336 this.lexState = this.LexState.DivisionAllowed;337 }338 339 function punctuatorAction(token)340 {341 this.cursor += token.length;342 this.nonToken += token;343 this.lexState = this.LexState.Initial;344 }345 201 } 346 202 -
trunk/WebCore/inspector/front-end/SourceSyntaxHighlighter.js
r52439 r52495 120 120 for (var i = 0; i < this.rules.length; i++) { 121 121 var rule = this.rules[i]; 122 var ruleContinueStateCondition = typeof rule.continueStateCondition === "undefined" ? this.ContinueState.None : rule.continueStateCondition; 123 if (this.continueState === ruleContinueStateCondition) { 124 if (typeof rule.lexStateCondition !== "undefined" && this.lexState !== rule.lexStateCondition) 125 continue; 126 var match = rule.pattern.exec(codeFragment); 127 if (match) { 128 token = match[0]; 129 if (token) { 130 if (!rule.dontAppendNonToken) 131 this.appendNonToken(); 132 return rule.action.call(this, token); 133 } 122 var ruleContinueStateCondition = ("preContinueState" in rule) ? rule.preContinueState : this.ContinueState.None; 123 if (this.continueState !== ruleContinueStateCondition) 124 continue; 125 if (("preLexState" in rule) && this.lexState !== rule.preLexState) 126 continue; 127 128 var match = rule.pattern.exec(codeFragment); 129 if (match) { 130 token = match[0]; 131 if (token && (!rule.keywords || (token in rule.keywords))) { 132 this.cursor += token.length; 133 if (rule.style) { 134 this.appendNonToken(); 135 var elem = this.createSpan(token, rule.style); 136 this.newLine.appendChild(elem); 137 if (rule.callback) 138 rule.callback.call(this, elem); 139 } else 140 this.nonToken += token; 141 142 if ("postLexState" in rule) 143 this.lexState = rule.postLexState; 144 if ("postContinueState" in rule) 145 this.continueState = rule.postContinueState; 146 return; 134 147 } 135 148 } -
trunk/WebCore/inspector/front-end/utilities.js
r52099 r52495 629 629 } 630 630 631 Array.prototype.keySet = function() 632 { 633 var keys = {}; 634 for (var i = 0; i < this.length; ++i) 635 keys[this[i]] = true; 636 return keys; 637 } 638 631 639 function insertionIndexForObjectInListSortedByFunction(anObject, aList, aFunction) 632 640 {
Note: See TracChangeset
for help on using the changeset viewer.