Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1275)

Unified Diff: Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js

Issue 354833004: DevTools: [CodeMirror] roll CodeMirror to version @e20d175 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/cm/xml.js ('k') | Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js
diff --git a/Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js b/Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js
index d278ecb7eb5e7ba57e9f42c08174fffa19f21bb9..bcb5b9a3acf2be7c989aa96d0a523fbc0f05ff80 100644
--- a/Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js
+++ b/Source/devtools/front_end/script_formatter_worker/ScriptFormatterWorker.js
@@ -279,7 +279,7 @@ FormatterWorker.parseCSS = function(params)
}
break;
case FormatterWorker.CSSParserStates.PropertyName:
- if (tokenValue === ":" && tokenType["operator"]) {
+ if (tokenValue === ":" && tokenType === UndefTokenType) {
property.name = property.name.trim();
state = FormatterWorker.CSSParserStates.PropertyValue;
} else if (tokenType["property"]) {
@@ -389,28 +389,41 @@ FormatterWorker.HTMLFormatter.prototype = {
var scriptOpened = false;
var styleOpened = false;
var tokenizer = FormatterWorker.createTokenizer("text/html");
+ var accumulatedTokenValue = "";
+ var accumulatedTokenStart = 0;
/**
* @this {FormatterWorker.HTMLFormatter}
*/
function processToken(tokenValue, tokenType, tokenStart, tokenEnd) {
- if (tokenType !== "tag")
+ if (!tokenType)
return;
- if (tokenValue.toLowerCase() === "<script") {
+ var oldType = tokenType;
+ tokenType = tokenType.split(" ").keySet();
+ if (!tokenType["tag"])
+ return;
+ if (tokenType["bracket"] && (tokenValue === "<" || tokenValue === "</")) {
+ accumulatedTokenValue = tokenValue;
+ accumulatedTokenStart = tokenStart;
+ return;
+ }
+ accumulatedTokenValue = accumulatedTokenValue + tokenValue.toLowerCase();
+ if (accumulatedTokenValue === "<script") {
scriptOpened = true;
} else if (scriptOpened && tokenValue === ">") {
scriptOpened = false;
this._scriptStarted(tokenEnd);
- } else if (tokenValue.toLowerCase() === "</script") {
- this._scriptEnded(tokenStart);
- } else if (tokenValue.toLowerCase() === "<style") {
+ } else if (accumulatedTokenValue === "</script") {
+ this._scriptEnded(accumulatedTokenStart);
+ } else if (accumulatedTokenValue === "<style") {
styleOpened = true;
} else if (styleOpened && tokenValue === ">") {
styleOpened = false;
this._styleStarted(tokenEnd);
- } else if (tokenValue.toLowerCase() === "</style") {
- this._styleEnded(tokenStart);
+ } else if (accumulatedTokenValue === "</style") {
+ this._styleEnded(accumulatedTokenStart);
}
+ accumulatedTokenValue = "";
}
tokenizer(content, processToken.bind(this));
« no previous file with comments | « Source/devtools/front_end/cm/xml.js ('k') | Source/devtools/front_end/source_frame/CodeMirrorTextEditor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698