incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmue...@apache.org
Subject [24/51] [partial] Apache-ization, port to node.js
Date Wed, 15 Feb 2012 17:42:37 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceFrame.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceFrame.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceFrame.js
new file mode 100644
index 0000000..6b4b3b3
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceFrame.js
@@ -0,0 +1,935 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.SourceFrame = function(contentProvider, url, isScript)
+{
+    WebInspector.View.call(this);
+
+    this.element.addStyleClass("script-view");
+
+    this._contentProvider = contentProvider;
+    this._url = url;
+    this._isScript = isScript;
+
+    this._textModel = new WebInspector.TextEditorModel();
+    this._textModel.replaceTabsWithSpaces = true;
+
+    this._currentSearchResultIndex = -1;
+    this._searchResults = [];
+
+    this._messages = [];
+    this._rowMessages = {};
+    this._messageBubbles = {};
+
+    this._popoverObjectGroup = "popover";
+}
+
+WebInspector.SourceFrame.prototype = {
+
+    show: function(parentElement)
+    {
+        WebInspector.View.prototype.show.call(this, parentElement);
+
+        if (!this._contentRequested) {
+            this._contentRequested = true;
+            this._contentProvider.requestContent(this._createTextViewer.bind(this));
+        }
+
+        if (this._textViewer) {
+            if (this._scrollTop)
+                this._textViewer.scrollTop = this._scrollTop;
+            if (this._scrollLeft)
+                this._textViewer.scrollLeft = this._scrollLeft;
+            this._textViewer.resize();
+        }
+    },
+
+    hide: function()
+    {
+        if (this._textViewer) {
+            this._scrollTop = this._textViewer.scrollTop;
+            this._scrollLeft = this._textViewer.scrollLeft;
+            this._textViewer.freeCachedElements();
+        }
+
+        WebInspector.View.prototype.hide.call(this);
+
+        this._hidePopup();
+        this._clearLineHighlight();
+    },
+
+    hasContent: function()
+    {
+        return true;
+    },
+
+    markDiff: function(diffData)
+    {
+        if (this._diffLines && this._textViewer)
+            this._removeDiffDecorations();
+
+        this._diffLines = diffData;
+        if (this._textViewer)
+            this._updateDiffDecorations();
+    },
+
+    revealLine: function(lineNumber)
+    {
+        if (this._textViewer)
+            this._textViewer.revealLine(lineNumber - 1, 0);
+        else
+            this._lineNumberToReveal = lineNumber;
+    },
+
+    addMessage: function(msg)
+    {
+        // Don't add the message if there is no message or valid line or if the msg isn't an error or warning.
+        if (!msg.message || msg.line <= 0 || !msg.isErrorOrWarning())
+            return;
+        this._messages.push(msg);
+        if (this._textViewer)
+            this._addMessageToSource(msg);
+    },
+
+    clearMessages: function()
+    {
+        for (var line in this._messageBubbles) {
+            var bubble = this._messageBubbles[line];
+            bubble.parentNode.removeChild(bubble);
+        }
+
+        this._messages = [];
+        this._rowMessages = {};
+        this._messageBubbles = {};
+        if (this._textViewer)
+            this._textViewer.resize();
+    },
+
+    sizeToFitContentHeight: function()
+    {
+        if (this._textViewer)
+            this._textViewer.revalidateDecorationsAndPaint();
+    },
+
+    get textModel()
+    {
+        return this._textModel;
+    },
+
+    get scrollTop()
+    {
+        return this._textViewer ? this._textViewer.scrollTop : this._scrollTop;
+    },
+
+    set scrollTop(scrollTop)
+    {
+        this._scrollTop = scrollTop;
+        if (this._textViewer)
+            this._textViewer.scrollTop = scrollTop;
+    },
+
+    highlightLine: function(line)
+    {
+        if (this._textViewer)
+            this._textViewer.highlightLine(line - 1);
+        else
+            this._lineToHighlight = line;
+    },
+
+    _clearLineHighlight: function()
+    {
+        if (this._textViewer)
+            this._textViewer.clearLineHighlight();
+        else
+            delete this._lineToHighlight;
+    },
+
+    _createTextViewer: function(mimeType, content)
+    {
+        this._content = content;
+        this._textModel.setText(null, content.text);
+
+        this._textViewer = new WebInspector.TextViewer(this._textModel, WebInspector.platform, this._url);
+        var element = this._textViewer.element;
+        element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
+        element.addEventListener("mousedown", this._mouseDown.bind(this), true);
+        element.addEventListener("mousemove", this._mouseMove.bind(this), true);
+        element.addEventListener("scroll", this._scroll.bind(this), true);
+        element.addEventListener("dblclick", this._doubleClick.bind(this), true);
+        this.element.appendChild(element);
+
+        this._textViewer.beginUpdates();
+
+        this._textViewer.mimeType = mimeType;
+        this._setTextViewerDecorations();
+
+        if (this._lineNumberToReveal) {
+            this.revealLine(this._lineNumberToReveal);
+            delete this._lineNumberToReveal;
+        }
+
+        if (this._lineToHighlight) {
+            this.highlightLine(this._lineToHighlight);
+            delete this._lineToHighlight;
+        }
+
+        if (this._delayedFindSearchMatches) {
+            this._delayedFindSearchMatches();
+            delete this._delayedFindSearchMatches;
+        }
+
+        this._textViewer.endUpdates();
+
+        WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, this._breakpointAdded, this);
+        WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointRemoved, this._breakpointRemoved, this);
+        WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved, this._breakpointResolved, this);
+    },
+
+    _setTextViewerDecorations: function()
+    {
+        this._rowMessages = {};
+        this._messageBubbles = {};
+
+        this._textViewer.beginUpdates();
+
+        this._addExistingMessagesToSource();
+        this._updateDiffDecorations();
+
+        if (this._executionLocation)
+            this._setExecutionLocation();
+
+        this._breakpointIdToTextViewerLineNumber = {};
+        this._textViewerLineNumberToBreakpointId = {};
+        var breakpoints = WebInspector.debuggerModel.breakpoints;
+        for (var id in breakpoints)
+            this._breakpointAdded({ data: breakpoints[id] });
+
+        this._textViewer.resize();
+
+        this._textViewer.endUpdates();
+    },
+
+    _shouldDisplayBreakpoint: function(breakpoint)
+    {
+        if (this._url)
+            return this._url === breakpoint.url;
+        var scripts = this._content.scriptRanges;
+        for (var i = 0; i < scripts.length; ++i) {
+            if (breakpoint.sourceID === scripts[i].sourceID)
+                return true;
+        }
+        return false;
+    },
+
+    performSearch: function(query, callback)
+    {
+        // Call searchCanceled since it will reset everything we need before doing a new search.
+        this.searchCanceled();
+
+        function doFindSearchMatches(query)
+        {
+            this._currentSearchResultIndex = -1;
+            this._searchResults = [];
+
+            // First do case-insensitive search.
+            var regexObject = createSearchRegex(query);
+            this._collectRegexMatches(regexObject, this._searchResults);
+
+            // Then try regex search if user knows the / / hint.
+            try {
+                if (/^\/.*\/$/.test(query))
+                    this._collectRegexMatches(new RegExp(query.substring(1, query.length - 1)), this._searchResults);
+            } catch (e) {
+                // Silent catch.
+            }
+
+            callback(this, this._searchResults.length);
+        }
+
+        if (this._textViewer)
+            doFindSearchMatches.call(this, query);
+        else
+            this._delayedFindSearchMatches = doFindSearchMatches.bind(this, query);
+
+    },
+
+    searchCanceled: function()
+    {
+        delete this._delayedFindSearchMatches;
+        if (!this._textViewer)
+            return;
+
+        this._currentSearchResultIndex = -1;
+        this._searchResults = [];
+        this._textViewer.markAndRevealRange(null);
+    },
+
+    jumpToFirstSearchResult: function()
+    {
+        this._jumpToSearchResult(0);
+    },
+
+    jumpToLastSearchResult: function()
+    {
+        this._jumpToSearchResult(this._searchResults.length - 1);
+    },
+
+    jumpToNextSearchResult: function()
+    {
+        this._jumpToSearchResult(this._currentSearchResultIndex + 1);
+    },
+
+    jumpToPreviousSearchResult: function()
+    {
+        this._jumpToSearchResult(this._currentSearchResultIndex - 1);
+    },
+
+    showingFirstSearchResult: function()
+    {
+        return this._searchResults.length &&  this._currentSearchResultIndex === 0;
+    },
+
+    showingLastSearchResult: function()
+    {
+        return this._searchResults.length && this._currentSearchResultIndex === (this._searchResults.length - 1);
+    },
+
+    _jumpToSearchResult: function(index)
+    {
+        if (!this._textViewer || !this._searchResults.length)
+            return;
+        this._currentSearchResultIndex = (index + this._searchResults.length) % this._searchResults.length;
+        this._textViewer.markAndRevealRange(this._searchResults[this._currentSearchResultIndex]);
+    },
+
+    _collectRegexMatches: function(regexObject, ranges)
+    {
+        for (var i = 0; i < this._textModel.linesCount; ++i) {
+            var line = this._textModel.line(i);
+            var offset = 0;
+            do {
+                var match = regexObject.exec(line);
+                if (match) {
+                    ranges.push(new WebInspector.TextRange(i, offset + match.index, i, offset + match.index + match[0].length));
+                    offset += match.index + 1;
+                    line = line.substring(match.index + 1);
+                }
+            } while (match)
+        }
+        return ranges;
+    },
+
+    _incrementMessageRepeatCount: function(msg, repeatDelta)
+    {
+        if (!msg._resourceMessageLineElement)
+            return;
+
+        if (!msg._resourceMessageRepeatCountElement) {
+            var repeatedElement = document.createElement("span");
+            msg._resourceMessageLineElement.appendChild(repeatedElement);
+            msg._resourceMessageRepeatCountElement = repeatedElement;
+        }
+
+        msg.repeatCount += repeatDelta;
+        msg._resourceMessageRepeatCountElement.textContent = WebInspector.UIString(" (repeated %d times)", msg.repeatCount);
+    },
+
+    setExecutionLocation: function(lineNumber, columnNumber)
+    {
+        this._executionLocation = { lineNumber: lineNumber, columnNumber: columnNumber };
+        if (this._textViewer)
+            this._setExecutionLocation();
+    },
+
+    clearExecutionLocation: function()
+    {
+        if (this._textViewer) {
+            var textViewerLineNumber = this._content.actualLocationToSourceFrameLineNumber(this._executionLocation.lineNumber, this._executionLocation.columnNumber);
+            this._textViewer.removeDecoration(textViewerLineNumber, "webkit-execution-line");
+        }
+        delete this._executionLocation;
+    },
+
+    _setExecutionLocation: function()
+    {
+        var textViewerLineNumber = this._content.actualLocationToSourceFrameLineNumber(this._executionLocation.lineNumber, this._executionLocation.columnNumber);
+        this._textViewer.addDecoration(textViewerLineNumber, "webkit-execution-line");
+    },
+
+    _updateDiffDecorations: function()
+    {
+        if (!this._diffLines)
+            return;
+
+        function addDecorations(textViewer, lines, className)
+        {
+            for (var i = 0; i < lines.length; ++i)
+                textViewer.addDecoration(lines[i], className);
+        }
+        addDecorations(this._textViewer, this._diffLines.added, "webkit-added-line");
+        addDecorations(this._textViewer, this._diffLines.removed, "webkit-removed-line");
+        addDecorations(this._textViewer, this._diffLines.changed, "webkit-changed-line");
+    },
+
+    _removeDiffDecorations: function()
+    {
+        function removeDecorations(textViewer, lines, className)
+        {
+            for (var i = 0; i < lines.length; ++i)
+                textViewer.removeDecoration(lines[i], className);
+        }
+        removeDecorations(this._textViewer, this._diffLines.added, "webkit-added-line");
+        removeDecorations(this._textViewer, this._diffLines.removed, "webkit-removed-line");
+        removeDecorations(this._textViewer, this._diffLines.changed, "webkit-changed-line");
+    },
+
+    _addExistingMessagesToSource: function()
+    {
+        var length = this._messages.length;
+        for (var i = 0; i < length; ++i)
+            this._addMessageToSource(this._messages[i]);
+    },
+
+    _addMessageToSource: function(msg)
+    {
+        if (msg.line > this._textModel.linesCount)
+            return;
+
+        var messageBubbleElement = this._messageBubbles[msg.line];
+        if (!messageBubbleElement || messageBubbleElement.nodeType !== Node.ELEMENT_NODE || !messageBubbleElement.hasStyleClass("webkit-html-message-bubble")) {
+            messageBubbleElement = document.createElement("div");
+            messageBubbleElement.className = "webkit-html-message-bubble";
+            this._messageBubbles[msg.line] = messageBubbleElement;
+            this._textViewer.addDecoration(msg.line - 1, messageBubbleElement);
+        }
+
+        var rowMessages = this._rowMessages[msg.line];
+        if (!rowMessages) {
+            rowMessages = [];
+            this._rowMessages[msg.line] = rowMessages;
+        }
+
+        for (var i = 0; i < rowMessages.length; ++i) {
+            if (rowMessages[i].isEqual(msg)) {
+                this._incrementMessageRepeatCount(rowMessages[i], msg.repeatDelta);
+                return;
+            }
+        }
+
+        rowMessages.push(msg);
+
+        var imageURL;
+        switch (msg.level) {
+            case WebInspector.ConsoleMessage.MessageLevel.Error:
+                messageBubbleElement.addStyleClass("webkit-html-error-message");
+                imageURL = "Images/errorIcon.png";
+                break;
+            case WebInspector.ConsoleMessage.MessageLevel.Warning:
+                messageBubbleElement.addStyleClass("webkit-html-warning-message");
+                imageURL = "Images/warningIcon.png";
+                break;
+        }
+
+        var messageLineElement = document.createElement("div");
+        messageLineElement.className = "webkit-html-message-line";
+        messageBubbleElement.appendChild(messageLineElement);
+
+        // Create the image element in the Inspector's document so we can use relative image URLs.
+        var image = document.createElement("img");
+        image.src = imageURL;
+        image.className = "webkit-html-message-icon";
+        messageLineElement.appendChild(image);
+        messageLineElement.appendChild(document.createTextNode(msg.message));
+
+        msg._resourceMessageLineElement = messageLineElement;
+    },
+
+    _breakpointAdded: function(event)
+    {
+        var breakpoint = event.data;
+
+        if (!this._shouldDisplayBreakpoint(breakpoint))
+            return;
+
+        var resolved = breakpoint.locations.length;
+        var location = resolved ? breakpoint.locations[0] : breakpoint;
+
+        var textViewerLineNumber = this._content.actualLocationToSourceFrameLineNumber(location.lineNumber, location.columnNumber);
+        if (textViewerLineNumber >= this._textModel.linesCount)
+            return;
+
+        var existingBreakpointId = this._textViewerLineNumberToBreakpointId[textViewerLineNumber];
+        if (existingBreakpointId) {
+            WebInspector.debuggerModel.removeBreakpoint(breakpoint.id);
+            return;
+        }
+
+        this._breakpointIdToTextViewerLineNumber[breakpoint.id] = textViewerLineNumber;
+        this._textViewerLineNumberToBreakpointId[textViewerLineNumber] = breakpoint.id;
+        this._setBreakpointDecoration(textViewerLineNumber, resolved, breakpoint.enabled, !!breakpoint.condition);
+    },
+
+    _breakpointRemoved: function(event)
+    {
+        var breakpointId = event.data;
+
+        var textViewerLineNumber = this._breakpointIdToTextViewerLineNumber[breakpointId];
+        if (textViewerLineNumber === undefined)
+            return;
+
+        delete this._breakpointIdToTextViewerLineNumber[breakpointId];
+        delete this._textViewerLineNumberToBreakpointId[textViewerLineNumber];
+        this._removeBreakpointDecoration(textViewerLineNumber);
+    },
+
+    _breakpointResolved: function(event)
+    {
+        var breakpoint = event.data;
+        this._breakpointRemoved({ data: breakpoint.id });
+        this._breakpointAdded({ data: breakpoint });
+    },
+
+    _setBreakpointDecoration: function(lineNumber, resolved, enabled, hasCondition)
+    {
+        this._textViewer.beginUpdates();
+        this._textViewer.addDecoration(lineNumber, "webkit-breakpoint");
+        if (!enabled)
+            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
+        if (hasCondition)
+            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
+        this._textViewer.endUpdates();
+    },
+
+    _removeBreakpointDecoration: function(lineNumber)
+    {
+        this._textViewer.beginUpdates();
+        this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint");
+        this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
+        this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-conditional");
+        this._textViewer.endUpdates();
+    },
+
+    _contextMenu: function(event)
+    {
+        if (!WebInspector.panels.scripts)
+            return;
+
+        var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number");
+        if (!target)
+            return;
+        var textViewerLineNumber = target.lineNumber;
+
+        var contextMenu = new WebInspector.ContextMenu();
+
+        contextMenu.appendItem(WebInspector.UIString("Continue to Here"), this._continueToLine.bind(this, textViewerLineNumber));
+
+        var breakpoint = this._findBreakpoint(textViewerLineNumber);
+        if (!breakpoint) {
+            // This row doesn't have a breakpoint: We want to show Add Breakpoint and Add and Edit Breakpoint.
+            contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._setBreakpoint.bind(this, textViewerLineNumber, "", true));
+
+            function addConditionalBreakpoint()
+            {
+                this._setBreakpointDecoration(textViewerLineNumber, true, true, true);
+                function didEditBreakpointCondition(committed, condition)
+                {
+                    this._removeBreakpointDecoration(textViewerLineNumber);
+                    if (committed)
+                        this._setBreakpoint(textViewerLineNumber, condition, true);
+                }
+                this._editBreakpointCondition(textViewerLineNumber, "", didEditBreakpointCondition.bind(this));
+            }
+            contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint…"), addConditionalBreakpoint.bind(this));
+        } else {
+            // This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable.
+            function removeBreakpoint()
+            {
+                WebInspector.debuggerModel.removeBreakpoint(breakpoint.id);
+            }
+            contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), removeBreakpoint);
+            function editBreakpointCondition()
+            {
+                function didEditBreakpointCondition(committed, condition)
+                {
+                    if (committed)
+                        WebInspector.debuggerModel.updateBreakpoint(breakpoint.id, condition, breakpoint.enabled);
+                }
+                this._editBreakpointCondition(textViewerLineNumber, breakpoint.condition, didEditBreakpointCondition.bind(this));
+            }
+            contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), editBreakpointCondition.bind(this));
+            function setBreakpointEnabled(enabled)
+            {
+                WebInspector.debuggerModel.updateBreakpoint(breakpoint.id, breakpoint.condition, enabled);
+            }
+            if (breakpoint.enabled)
+                contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), setBreakpointEnabled.bind(this, false));
+            else
+                contextMenu.appendItem(WebInspector.UIString("Enable Breakpoint"), setBreakpointEnabled.bind(this, true));
+        }
+        contextMenu.show(event);
+    },
+
+    _scroll: function(event)
+    {
+        this._hidePopup();
+    },
+
+    _mouseDown: function(event)
+    {
+        this._resetHoverTimer();
+        this._hidePopup();
+        if (event.button != 0 || event.altKey || event.ctrlKey || event.metaKey)
+            return;
+        var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number");
+        if (!target)
+            return;
+        var textViewerLineNumber = target.lineNumber;
+
+        var breakpoint = this._findBreakpoint(textViewerLineNumber);
+        if (breakpoint) {
+            if (event.shiftKey)
+                WebInspector.debuggerModel.updateBreakpoint(breakpoint.id, breakpoint.condition, !breakpoint.enabled);
+            else
+                WebInspector.debuggerModel.removeBreakpoint(breakpoint.id);
+        } else
+            this._setBreakpoint(textViewerLineNumber, "", true);
+        event.preventDefault();
+    },
+
+    _mouseMove: function(event)
+    {
+        // Pretend that nothing has happened.
+        if (this._hoverElement === event.target || event.target.hasStyleClass("source-frame-eval-expression"))
+            return;
+
+        this._resetHoverTimer();
+        // User has 500ms to reach the popup.
+        if (this._popup) {
+            var self = this;
+            function doHide()
+            {
+                self._hidePopup();
+                delete self._hidePopupTimer;
+            }
+            if (!("_hidePopupTimer" in this))
+                this._hidePopupTimer = setTimeout(doHide, 500);
+        }
+
+        this._hoverElement = event.target;
+
+        // Now that cleanup routines are set up above, leave this in case we are not on a break.
+        if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
+            return;
+
+        // We are interested in identifiers and "this" keyword.
+        if (this._hoverElement.hasStyleClass("webkit-javascript-keyword")) {
+            if (this._hoverElement.textContent !== "this")
+                return;
+        } else if (!this._hoverElement.hasStyleClass("webkit-javascript-ident"))
+            return;
+
+        const toolTipDelay = this._popup ? 600 : 1000;
+        this._hoverTimer = setTimeout(this._mouseHover.bind(this, this._hoverElement), toolTipDelay);
+    },
+
+    _resetHoverTimer: function()
+    {
+        if (this._hoverTimer) {
+            clearTimeout(this._hoverTimer);
+            delete this._hoverTimer;
+        }
+    },
+
+    _hidePopup: function()
+    {
+        if (!this._popup)
+            return;
+
+        // Replace higlight element with its contents inplace.
+        var parentElement = this._popup.highlightElement.parentElement;
+        var child = this._popup.highlightElement.firstChild;
+        while (child) {
+            var nextSibling = child.nextSibling;
+            parentElement.insertBefore(child, this._popup.highlightElement);
+            child = nextSibling;
+        }
+        parentElement.removeChild(this._popup.highlightElement);
+
+        this._popup.hide();
+        delete this._popup;
+        InspectorBackend.releaseWrapperObjectGroup(0, this._popoverObjectGroup);
+    },
+
+    _mouseHover: function(element)
+    {
+        delete this._hoverTimer;
+
+        if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
+            return;
+
+        var lineRow = element.enclosingNodeOrSelfWithClass("webkit-line-content");
+        if (!lineRow)
+            return;
+
+        // Collect tokens belonging to evaluated exression.
+        var tokens = [ element ];
+        var token = element.previousSibling;
+        while (token && (token.className === "webkit-javascript-ident" || token.className === "webkit-javascript-keyword" || token.textContent.trim() === ".")) {
+            tokens.push(token);
+            token = token.previousSibling;
+        }
+        tokens.reverse();
+
+        // Wrap them with highlight element.
+        var parentElement = element.parentElement;
+        var nextElement = element.nextSibling;
+        var container = document.createElement("span");
+        for (var i = 0; i < tokens.length; ++i)
+            container.appendChild(tokens[i]);
+        parentElement.insertBefore(container, nextElement);
+        this._showPopup(container);
+    },
+
+    _showPopup: function(element)
+    {
+        function killHidePopupTimer()
+        {
+            if (this._hidePopupTimer) {
+                clearTimeout(this._hidePopupTimer);
+                delete this._hidePopupTimer;
+
+                // We know that we reached the popup, but we might have moved over other elements.
+                // Discard pending command.
+                this._resetHoverTimer();
+            }
+        }
+
+        function showObjectPopup(result)
+        {
+            if (!WebInspector.panels.scripts.paused)
+                return;
+
+            var popupContentElement = null;
+            if (result.type !== "object" && result.type !== "node" && result.type !== "array") {
+                popupContentElement = document.createElement("span");
+                popupContentElement.className = "monospace console-formatted-" + result.type;
+                popupContentElement.style.whiteSpace = "pre";
+                popupContentElement.textContent = result.description;
+                if (result.type === "string")
+                    popupContentElement.textContent = "\"" + popupContentElement.textContent + "\"";
+                this._popup = new WebInspector.Popover(popupContentElement);
+                this._popup.show(element);
+            } else {
+                var popupContentElement = document.createElement("div");
+
+                var titleElement = document.createElement("div");
+                titleElement.className = "source-frame-popover-title monospace";
+                titleElement.textContent = result.description;
+                popupContentElement.appendChild(titleElement);
+
+                var section = new WebInspector.ObjectPropertiesSection(result, "", null, false);
+                section.expanded = true;
+                section.element.addStyleClass("source-frame-popover-tree");
+                section.headerElement.addStyleClass("hidden");
+                popupContentElement.appendChild(section.element);
+
+                this._popup = new WebInspector.Popover(popupContentElement);
+                const popupWidth = 300;
+                const popupHeight = 250;
+                this._popup.show(element, popupWidth, popupHeight);
+            }
+            this._popup.highlightElement = element;
+            this._popup.highlightElement.addStyleClass("source-frame-eval-expression");
+            popupContentElement.addEventListener("mousemove", killHidePopupTimer.bind(this), true);
+        }
+
+        function evaluateCallback(result)
+        {
+            if (result.isError())
+                return;
+            if (!WebInspector.panels.scripts.paused)
+                return;
+            showObjectPopup.call(this, result);
+        }
+        WebInspector.panels.scripts.evaluateInSelectedCallFrame(element.textContent, false, this._popoverObjectGroup, false, evaluateCallback.bind(this));
+    },
+
+    _editBreakpointCondition: function(lineNumber, condition, callback)
+    {
+        this._conditionElement = this._createConditionElement(lineNumber);
+        this._textViewer.addDecoration(lineNumber, this._conditionElement);
+
+        function finishEditing(committed, element, newText)
+        {
+            this._textViewer.removeDecoration(lineNumber, this._conditionElement);
+            delete this._conditionEditorElement;
+            delete this._conditionElement;
+            callback(committed, newText);
+        }
+
+        WebInspector.startEditing(this._conditionEditorElement, {
+            context: null,
+            commitHandler: finishEditing.bind(this, true),
+            cancelHandler: finishEditing.bind(this, false)
+        });
+        this._conditionEditorElement.value = condition;
+        this._conditionEditorElement.select();
+    },
+
+    _createConditionElement: function(lineNumber)
+    {
+        var conditionElement = document.createElement("div");
+        conditionElement.className = "source-frame-breakpoint-condition";
+
+        var labelElement = document.createElement("label");
+        labelElement.className = "source-frame-breakpoint-message";
+        labelElement.htmlFor = "source-frame-breakpoint-condition";
+        labelElement.appendChild(document.createTextNode(WebInspector.UIString("The breakpoint on line %d will stop only if this expression is true:", lineNumber)));
+        conditionElement.appendChild(labelElement);
+
+        var editorElement = document.createElement("input");
+        editorElement.id = "source-frame-breakpoint-condition";
+        editorElement.className = "monospace";
+        editorElement.type = "text";
+        conditionElement.appendChild(editorElement);
+        this._conditionEditorElement = editorElement;
+
+        return conditionElement;
+    },
+
+    _evalSelectionInCallFrame: function(event)
+    {
+        if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
+            return;
+
+        var selection = this.element.contentWindow.getSelection();
+        if (!selection.rangeCount)
+            return;
+
+        var expression = selection.getRangeAt(0).toString().trim();
+        WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result) {
+            WebInspector.showConsole();
+            var commandMessage = new WebInspector.ConsoleCommand(expression);
+            WebInspector.console.addMessage(commandMessage);
+            WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));
+        });
+    },
+
+    resize: function()
+    {
+        if (this._textViewer)
+            this._textViewer.resize();
+    },
+
+    formatSource: function()
+    {
+        if (!this._content)
+            return;
+
+        function didFormat(formattedContent)
+        {
+            this._content = formattedContent;
+            this._textModel.setText(null, formattedContent.text);
+            this._setTextViewerDecorations();
+        }
+        var formatter = new WebInspector.ScriptFormatter();
+        formatter.formatContent(this._content, didFormat.bind(this))
+    },
+
+    _continueToLine: function(lineNumber)
+    {
+        var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber);
+        if (location.sourceID)
+            WebInspector.debuggerModel.continueToLocation(location.sourceID, location.lineNumber, location.columnNumber);
+    },
+
+    _doubleClick: function(event)
+    {
+        if (!Preferences.canEditScriptSource || !this._isScript)
+            return;
+
+        var lineRow = event.target.enclosingNodeOrSelfWithClass("webkit-line-content");
+        if (!lineRow)
+            return;  // Do not trigger editing from line numbers.
+
+        var lineNumber = lineRow.lineNumber;
+        var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber);
+        if (!location.sourceID)
+            return;
+
+        function didEditLine(newContent)
+        {
+            var lines = [];
+            var oldLines = this._content.text.split('\n');
+            for (var i = 0; i < oldLines.length; ++i) {
+                if (i === lineNumber)
+                    lines.push(newContent);
+                else
+                    lines.push(oldLines[i]);
+            }
+            WebInspector.debuggerModel.editScriptSource(location.sourceID, lines.join("\n"));
+        }
+        this._textViewer.editLine(lineRow, didEditLine.bind(this));
+    },
+
+    _setBreakpoint: function(lineNumber, condition, enabled)
+    {
+        var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber);
+        if (this._url)
+            WebInspector.debuggerModel.setBreakpoint(this._url, location.lineNumber, location.columnNumber, condition, enabled);
+        else if (location.sourceID)
+            WebInspector.debuggerModel.setBreakpointBySourceId(location.sourceID, location.lineNumber, location.columnNumber, condition, enabled);
+        else
+            return;
+
+        if (!WebInspector.panels.scripts.breakpointsActivated)
+            WebInspector.panels.scripts.toggleBreakpointsClicked();
+    },
+
+    _findBreakpoint: function(textViewerLineNumber)
+    {
+        var breakpointId = this._textViewerLineNumberToBreakpointId[textViewerLineNumber];
+        return WebInspector.debuggerModel.breakpointForId(breakpointId);
+    }
+}
+
+WebInspector.SourceFrame.prototype.__proto__ = WebInspector.View.prototype;
+
+
+WebInspector.SourceFrameContentProvider = function()
+{
+}
+
+WebInspector.SourceFrameContentProvider.prototype = {
+    requestContent: function(callback)
+    {
+        // Should be implemented by subclasses.
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceFrameContent.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceFrameContent.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceFrameContent.js
new file mode 100644
index 0000000..91b397b
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceFrameContent.js
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.SourceFrameContent = function(text, mapping, scriptRanges)
+{
+    this._text = text;
+    this._mapping = mapping;
+    this._scriptRanges = scriptRanges;
+}
+
+WebInspector.SourceFrameContent.prototype = {
+    get text()
+    {
+        return this._text;
+    },
+
+    get scriptRanges()
+    {
+        return this._scriptRanges;
+    },
+
+    sourceFrameLineNumberToActualLocation: function(lineNumber)
+    {
+        // Script content may start right after <script> tag without new line (e.g. "<script>function f()...").
+        // In that case, column number should be equal to script column offset.
+        var columnNumber = 0;
+        for (var i = 0; i < this._scriptRanges.length; ++i) {
+            var scriptRange = this._scriptRanges[i];
+            if (scriptRange.start.lineNumber < lineNumber)
+                continue;
+            if (scriptRange.start.lineNumber === lineNumber)
+                columnNumber = scriptRange.start.columnNumber;
+            break;
+        }
+        var location = this._mapping.sourceLocationToActualLocation(lineNumber, columnNumber);
+        location.sourceID = this._sourceIDForSourceFrameLineNumber(lineNumber);
+        return location;
+    },
+
+    actualLocationToSourceFrameLineNumber: function(lineNumber, columnNumber)
+    {
+        return this._mapping.actualLocationToSourceLocation(lineNumber, columnNumber).lineNumber;
+    },
+
+    _sourceIDForSourceFrameLineNumber: function(lineNumber)
+    {
+        for (var i = 0; i < this._scriptRanges.length; ++i) {
+            var scriptRange = this._scriptRanges[i];
+            if (lineNumber < scriptRange.start.lineNumber)
+                return;
+            if (lineNumber > scriptRange.end.lineNumber)
+                continue;
+            if (lineNumber === scriptRange.end.lineNumber && !scriptRange.end.columnNumber)
+                continue;
+            return scriptRange.sourceID;
+        }
+    }
+}
+
+
+WebInspector.SourceMapping = function()
+{
+}
+
+WebInspector.SourceMapping.prototype = {
+    actualLocationToSourceLocation: function(lineNumber, columnNumber)
+    {
+        // Should be implemented by subclasses.
+    },
+
+    sourceLocationToActualLocation: function(lineNumber, columnNumber)
+    {
+        // Should be implemented by subclasses.
+    }
+}
+
+
+WebInspector.IdenticalSourceMapping = function()
+{
+    WebInspector.SourceMapping.call(this);
+}
+
+WebInspector.IdenticalSourceMapping.prototype = {
+    actualLocationToSourceLocation: function(lineNumber, columnNumber)
+    {
+        return { lineNumber: lineNumber, columnNumber: columnNumber};
+    },
+
+    sourceLocationToActualLocation: function(lineNumber, columnNumber)
+    {
+        return { lineNumber: lineNumber, columnNumber: columnNumber};
+    }
+}
+
+WebInspector.IdenticalSourceMapping.prototype.__proto__ = WebInspector.SourceMapping.prototype;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.js
new file mode 100644
index 0000000..48c5bd4
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceHTMLTokenizer.js
@@ -0,0 +1,780 @@
+/* Generated by re2c 0.13.5 on Fri Jan 28 18:32:27 2011 */
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Generate js file as follows:
+//
+// re2c -isc WebCore/inspector/front-end/SourceHTMLTokenizer.re2js \
+// | sed 's|^yy\([^:]*\)*\:|case \1:|' \
+// | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \
+// | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \
+// | sed 's|[*]cursor|this._charAt(cursor)|' \
+// | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \
+// | sed 's|{ gotoCase = \([^; continue; };]*\)|{ gotoCase = \1; continue; }|' \
+// | sed 's|unsigned\ int|var|' \
+// | sed 's|var\ yych|case 1: case 1: var yych|'
+
+WebInspector.SourceHTMLTokenizer = function()
+{
+    WebInspector.SourceTokenizer.call(this);
+
+    // The order is determined by the generated code.
+    this._lexConditions = {
+        INITIAL: 0,
+        COMMENT: 1,
+        DOCTYPE: 2,
+        TAG: 3,
+        DSTRING: 4,
+        SSTRING: 5
+    };
+    this.case_INITIAL = 1000;
+    this.case_COMMENT = 1001;
+    this.case_DOCTYPE = 1002;
+    this.case_TAG = 1003;
+    this.case_DSTRING = 1004;
+    this.case_SSTRING = 1005;
+
+    this._parseConditions = {
+        INITIAL: 0,
+        ATTRIBUTE: 1,
+        ATTRIBUTE_VALUE: 2,
+        LINKIFY: 4,
+        A_NODE: 8,
+        SCRIPT: 16,
+        STYLE: 32
+    };
+
+    this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
+    this.condition = this.initialCondition;
+}
+
+WebInspector.SourceHTMLTokenizer.prototype = {
+    set line(line) {
+        if (this._internalJavaScriptTokenizer) {
+            var match = /<\/script/i.exec(line);
+            if (match) {
+                this._internalJavaScriptTokenizer.line = line.substring(0, match.index);
+            } else
+                this._internalJavaScriptTokenizer.line = line;
+        } else if (this._internalCSSTokenizer) {
+            var match = /<\/style/i.exec(line);
+            if (match) {
+                this._internalCSSTokenizer.line = line.substring(0, match.index);
+            } else
+                this._internalCSSTokenizer.line = line;
+        }
+        this._line = line;
+    },
+
+    _isExpectingAttribute: function()
+    {
+        return this._condition.parseCondition & this._parseConditions.ATTRIBUTE;
+    },
+
+    _isExpectingAttributeValue: function()
+    {
+        return this._condition.parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
+    },
+
+    _setExpectingAttribute: function()
+    {
+        if (this._isExpectingAttributeValue())
+            this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
+        this._condition.parseCondition |= this._parseConditions.ATTRIBUTE;
+    },
+
+    _setExpectingAttributeValue: function()
+    {
+        if (this._isExpectingAttribute())
+            this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE;
+        this._condition.parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
+    },
+
+    _stringToken: function(cursor, stringEnds)
+    {
+        if (!this._isExpectingAttributeValue()) {
+            this.tokenType = null;
+            return cursor;
+        }
+        this.tokenType = this._attrValueTokenType();
+        if (stringEnds)
+            this._setExpectingAttribute();
+        return cursor;
+    },
+
+    _attrValueTokenType: function()
+    {
+        if (this._condition.parseCondition & this._parseConditions.LINKIFY) {
+            if (this._condition.parseCondition & this._parseConditions.A_NODE)
+                return "html-external-link";
+            return "html-resource-link";
+        }
+        return "html-attribute-value";
+    },
+
+    nextToken: function(cursor)
+    {
+        if (this._internalJavaScriptTokenizer) {
+            // Re-set line to force </script> detection first.
+            this.line = this._line;
+            if (cursor !== this._internalJavaScriptTokenizer._line.length) {
+                // Tokenizer is stateless, so restore its condition before tokenizing and save it after.
+                this._internalJavaScriptTokenizer.condition = this._condition.internalJavaScriptTokenizerCondition;
+                var result = this._internalJavaScriptTokenizer.nextToken(cursor);
+                this.tokenType = this._internalJavaScriptTokenizer.tokenType;
+                this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.condition;
+                return result;
+            } else if (cursor !== this._line.length)
+                delete this._internalJavaScriptTokenizer;
+        } else if (this._internalCSSTokenizer) {
+            // Re-set line to force </style> detection first.
+            this.line = this._line;
+            if (cursor !== this._internalCSSTokenizer._line.length) {
+                // Tokenizer is stateless, so restore its condition before tokenizing and save it after.
+                this._internalCSSTokenizer.condition = this._condition.internalCSSTokenizerCondition;
+                var result = this._internalCSSTokenizer.nextToken(cursor);
+                this.tokenType = this._internalCSSTokenizer.tokenType;
+                this._condition.internalCSSTokenizerCondition = this._internalCSSTokenizer.condition;
+                return result;
+            } else if (cursor !== this._line.length)
+                delete this._internalCSSTokenizer;
+        }
+
+        var cursorOnEnter = cursor;
+        var gotoCase = 1;
+        while (1) {
+            switch (gotoCase)
+            // Following comment is replaced with generated state machine.
+            
+        {
+            case 1: var yych;
+            var yyaccept = 0;
+            if (this.getLexCondition() < 3) {
+                if (this.getLexCondition() < 1) {
+                    { gotoCase = this.case_INITIAL; continue; };
+                } else {
+                    if (this.getLexCondition() < 2) {
+                        { gotoCase = this.case_COMMENT; continue; };
+                    } else {
+                        { gotoCase = this.case_DOCTYPE; continue; };
+                    }
+                }
+            } else {
+                if (this.getLexCondition() < 4) {
+                    { gotoCase = this.case_TAG; continue; };
+                } else {
+                    if (this.getLexCondition() < 5) {
+                        { gotoCase = this.case_DSTRING; continue; };
+                    } else {
+                        { gotoCase = this.case_SSTRING; continue; };
+                    }
+                }
+            }
+/* *********************************** */
+case this.case_COMMENT:
+
+            yych = this._charAt(cursor);
+            if (yych <= '\f') {
+                if (yych == '\n') { gotoCase = 4; continue; };
+                { gotoCase = 3; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 4; continue; };
+                if (yych == '-') { gotoCase = 6; continue; };
+                { gotoCase = 3; continue; };
+            }
+case 2:
+            { this.tokenType = "html-comment"; return cursor; }
+case 3:
+            yyaccept = 0;
+            yych = this._charAt(YYMARKER = ++cursor);
+            { gotoCase = 9; continue; };
+case 4:
+            ++cursor;
+case 5:
+            { this.tokenType = null; return cursor; }
+case 6:
+            yyaccept = 1;
+            yych = this._charAt(YYMARKER = ++cursor);
+            if (yych != '-') { gotoCase = 5; continue; };
+case 7:
+            ++cursor;
+            yych = this._charAt(cursor);
+            if (yych == '>') { gotoCase = 10; continue; };
+case 8:
+            yyaccept = 0;
+            YYMARKER = ++cursor;
+            yych = this._charAt(cursor);
+case 9:
+            if (yych <= '\f') {
+                if (yych == '\n') { gotoCase = 2; continue; };
+                { gotoCase = 8; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 2; continue; };
+                if (yych == '-') { gotoCase = 12; continue; };
+                { gotoCase = 8; continue; };
+            }
+case 10:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.INITIAL);
+            { this.tokenType = "html-comment"; return cursor; }
+case 12:
+            ++cursor;
+            yych = this._charAt(cursor);
+            if (yych == '-') { gotoCase = 7; continue; };
+            cursor = YYMARKER;
+            if (yyaccept <= 0) {
+                { gotoCase = 2; continue; };
+            } else {
+                { gotoCase = 5; continue; };
+            }
+/* *********************************** */
+case this.case_DOCTYPE:
+            yych = this._charAt(cursor);
+            if (yych <= '\f') {
+                if (yych == '\n') { gotoCase = 18; continue; };
+                { gotoCase = 17; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 18; continue; };
+                if (yych == '>') { gotoCase = 20; continue; };
+                { gotoCase = 17; continue; };
+            }
+case 16:
+            { this.tokenType = "html-doctype"; return cursor; }
+case 17:
+            yych = this._charAt(++cursor);
+            { gotoCase = 23; continue; };
+case 18:
+            ++cursor;
+            { this.tokenType = null; return cursor; }
+case 20:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.INITIAL);
+            { this.tokenType = "html-doctype"; return cursor; }
+case 22:
+            ++cursor;
+            yych = this._charAt(cursor);
+case 23:
+            if (yych <= '\f') {
+                if (yych == '\n') { gotoCase = 16; continue; };
+                { gotoCase = 22; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 16; continue; };
+                if (yych == '>') { gotoCase = 16; continue; };
+                { gotoCase = 22; continue; };
+            }
+/* *********************************** */
+case this.case_DSTRING:
+            yych = this._charAt(cursor);
+            if (yych <= '\f') {
+                if (yych == '\n') { gotoCase = 28; continue; };
+                { gotoCase = 27; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 28; continue; };
+                if (yych == '"') { gotoCase = 30; continue; };
+                { gotoCase = 27; continue; };
+            }
+case 26:
+            { return this._stringToken(cursor); }
+case 27:
+            yych = this._charAt(++cursor);
+            { gotoCase = 34; continue; };
+case 28:
+            ++cursor;
+            { this.tokenType = null; return cursor; }
+case 30:
+            ++cursor;
+case 31:
+            this.setLexCondition(this._lexConditions.TAG);
+            { return this._stringToken(cursor, true); }
+case 32:
+            yych = this._charAt(++cursor);
+            { gotoCase = 31; continue; };
+case 33:
+            ++cursor;
+            yych = this._charAt(cursor);
+case 34:
+            if (yych <= '\f') {
+                if (yych == '\n') { gotoCase = 26; continue; };
+                { gotoCase = 33; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 26; continue; };
+                if (yych == '"') { gotoCase = 32; continue; };
+                { gotoCase = 33; continue; };
+            }
+/* *********************************** */
+case this.case_INITIAL:
+            yych = this._charAt(cursor);
+            if (yych == '<') { gotoCase = 39; continue; };
+            ++cursor;
+            { this.tokenType = null; return cursor; }
+case 39:
+            yyaccept = 0;
+            yych = this._charAt(YYMARKER = ++cursor);
+            if (yych <= '/') {
+                if (yych == '!') { gotoCase = 44; continue; };
+                if (yych >= '/') { gotoCase = 41; continue; };
+            } else {
+                if (yych <= 'S') {
+                    if (yych >= 'S') { gotoCase = 42; continue; };
+                } else {
+                    if (yych == 's') { gotoCase = 42; continue; };
+                }
+            }
+case 40:
+            this.setLexCondition(this._lexConditions.TAG);
+            {
+                    if (this._condition.parseCondition & (this._parseConditions.SCRIPT | this._parseConditions.STYLE)) {
+                        // Do not tokenize script and style tag contents, keep lexer state, even though processing "<".
+                        this.setLexCondition(this._lexConditions.INITIAL);
+                        this.tokenType = null;
+                        return cursor;
+                    }
+
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
+                    this.tokenType = "html-tag";
+                    return cursor;
+                }
+case 41:
+            yyaccept = 0;
+            yych = this._charAt(YYMARKER = ++cursor);
+            if (yych == 'S') { gotoCase = 73; continue; };
+            if (yych == 's') { gotoCase = 73; continue; };
+            { gotoCase = 40; continue; };
+case 42:
+            yych = this._charAt(++cursor);
+            if (yych <= 'T') {
+                if (yych == 'C') { gotoCase = 62; continue; };
+                if (yych >= 'T') { gotoCase = 63; continue; };
+            } else {
+                if (yych <= 'c') {
+                    if (yych >= 'c') { gotoCase = 62; continue; };
+                } else {
+                    if (yych == 't') { gotoCase = 63; continue; };
+                }
+            }
+case 43:
+            cursor = YYMARKER;
+            { gotoCase = 40; continue; };
+case 44:
+            yych = this._charAt(++cursor);
+            if (yych <= 'C') {
+                if (yych != '-') { gotoCase = 43; continue; };
+            } else {
+                if (yych <= 'D') { gotoCase = 46; continue; };
+                if (yych == 'd') { gotoCase = 46; continue; };
+                { gotoCase = 43; continue; };
+            }
+            yych = this._charAt(++cursor);
+            if (yych == '-') { gotoCase = 54; continue; };
+            { gotoCase = 43; continue; };
+case 46:
+            yych = this._charAt(++cursor);
+            if (yych == 'O') { gotoCase = 47; continue; };
+            if (yych != 'o') { gotoCase = 43; continue; };
+case 47:
+            yych = this._charAt(++cursor);
+            if (yych == 'C') { gotoCase = 48; continue; };
+            if (yych != 'c') { gotoCase = 43; continue; };
+case 48:
+            yych = this._charAt(++cursor);
+            if (yych == 'T') { gotoCase = 49; continue; };
+            if (yych != 't') { gotoCase = 43; continue; };
+case 49:
+            yych = this._charAt(++cursor);
+            if (yych == 'Y') { gotoCase = 50; continue; };
+            if (yych != 'y') { gotoCase = 43; continue; };
+case 50:
+            yych = this._charAt(++cursor);
+            if (yych == 'P') { gotoCase = 51; continue; };
+            if (yych != 'p') { gotoCase = 43; continue; };
+case 51:
+            yych = this._charAt(++cursor);
+            if (yych == 'E') { gotoCase = 52; continue; };
+            if (yych != 'e') { gotoCase = 43; continue; };
+case 52:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.DOCTYPE);
+            { this.tokenType = "html-doctype"; return cursor; }
+case 54:
+            ++cursor;
+            yych = this._charAt(cursor);
+            if (yych <= '\f') {
+                if (yych == '\n') { gotoCase = 57; continue; };
+                { gotoCase = 54; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 57; continue; };
+                if (yych != '-') { gotoCase = 54; continue; };
+            }
+            ++cursor;
+            yych = this._charAt(cursor);
+            if (yych == '-') { gotoCase = 59; continue; };
+            { gotoCase = 43; continue; };
+case 57:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.COMMENT);
+            { this.tokenType = "html-comment"; return cursor; }
+case 59:
+            ++cursor;
+            yych = this._charAt(cursor);
+            if (yych != '>') { gotoCase = 54; continue; };
+            ++cursor;
+            { this.tokenType = "html-comment"; return cursor; }
+case 62:
+            yych = this._charAt(++cursor);
+            if (yych == 'R') { gotoCase = 68; continue; };
+            if (yych == 'r') { gotoCase = 68; continue; };
+            { gotoCase = 43; continue; };
+case 63:
+            yych = this._charAt(++cursor);
+            if (yych == 'Y') { gotoCase = 64; continue; };
+            if (yych != 'y') { gotoCase = 43; continue; };
+case 64:
+            yych = this._charAt(++cursor);
+            if (yych == 'L') { gotoCase = 65; continue; };
+            if (yych != 'l') { gotoCase = 43; continue; };
+case 65:
+            yych = this._charAt(++cursor);
+            if (yych == 'E') { gotoCase = 66; continue; };
+            if (yych != 'e') { gotoCase = 43; continue; };
+case 66:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.TAG);
+            {
+                    if (this._condition.parseCondition & this._parseConditions.STYLE) {
+                        // Do not tokenize style tag contents, keep lexer state, even though processing "<".
+                        this.setLexCondition(this._lexConditions.INITIAL);
+                        this.tokenType = null;
+                        return cursor;
+                    }
+                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.STYLE;
+                    this._setExpectingAttribute();
+                    return cursor;
+                }
+case 68:
+            yych = this._charAt(++cursor);
+            if (yych == 'I') { gotoCase = 69; continue; };
+            if (yych != 'i') { gotoCase = 43; continue; };
+case 69:
+            yych = this._charAt(++cursor);
+            if (yych == 'P') { gotoCase = 70; continue; };
+            if (yych != 'p') { gotoCase = 43; continue; };
+case 70:
+            yych = this._charAt(++cursor);
+            if (yych == 'T') { gotoCase = 71; continue; };
+            if (yych != 't') { gotoCase = 43; continue; };
+case 71:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.TAG);
+            {
+                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
+                        // Do not tokenize script tag contents, keep lexer state, even though processing "<".
+                        this.setLexCondition(this._lexConditions.INITIAL);
+                        this.tokenType = null;
+                        return cursor;
+                    }
+                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.SCRIPT;
+                    this._setExpectingAttribute();
+                    return cursor;
+                }
+case 73:
+            yych = this._charAt(++cursor);
+            if (yych <= 'T') {
+                if (yych == 'C') { gotoCase = 75; continue; };
+                if (yych <= 'S') { gotoCase = 43; continue; };
+            } else {
+                if (yych <= 'c') {
+                    if (yych <= 'b') { gotoCase = 43; continue; };
+                    { gotoCase = 75; continue; };
+                } else {
+                    if (yych != 't') { gotoCase = 43; continue; };
+                }
+            }
+            yych = this._charAt(++cursor);
+            if (yych == 'Y') { gotoCase = 81; continue; };
+            if (yych == 'y') { gotoCase = 81; continue; };
+            { gotoCase = 43; continue; };
+case 75:
+            yych = this._charAt(++cursor);
+            if (yych == 'R') { gotoCase = 76; continue; };
+            if (yych != 'r') { gotoCase = 43; continue; };
+case 76:
+            yych = this._charAt(++cursor);
+            if (yych == 'I') { gotoCase = 77; continue; };
+            if (yych != 'i') { gotoCase = 43; continue; };
+case 77:
+            yych = this._charAt(++cursor);
+            if (yych == 'P') { gotoCase = 78; continue; };
+            if (yych != 'p') { gotoCase = 43; continue; };
+case 78:
+            yych = this._charAt(++cursor);
+            if (yych == 'T') { gotoCase = 79; continue; };
+            if (yych != 't') { gotoCase = 43; continue; };
+case 79:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.TAG);
+            {
+                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
+                    return cursor;
+                }
+case 81:
+            yych = this._charAt(++cursor);
+            if (yych == 'L') { gotoCase = 82; continue; };
+            if (yych != 'l') { gotoCase = 43; continue; };
+case 82:
+            yych = this._charAt(++cursor);
+            if (yych == 'E') { gotoCase = 83; continue; };
+            if (yych != 'e') { gotoCase = 43; continue; };
+case 83:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.TAG);
+            {
+                    this.tokenType = "html-tag";
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
+                    return cursor;
+                }
+/* *********************************** */
+case this.case_SSTRING:
+            yych = this._charAt(cursor);
+            if (yych <= '\f') {
+                if (yych == '\n') { gotoCase = 89; continue; };
+                { gotoCase = 88; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 89; continue; };
+                if (yych == '\'') { gotoCase = 91; continue; };
+                { gotoCase = 88; continue; };
+            }
+case 87:
+            { return this._stringToken(cursor); }
+case 88:
+            yych = this._charAt(++cursor);
+            { gotoCase = 95; continue; };
+case 89:
+            ++cursor;
+            { this.tokenType = null; return cursor; }
+case 91:
+            ++cursor;
+case 92:
+            this.setLexCondition(this._lexConditions.TAG);
+            { return this._stringToken(cursor, true); }
+case 93:
+            yych = this._charAt(++cursor);
+            { gotoCase = 92; continue; };
+case 94:
+            ++cursor;
+            yych = this._charAt(cursor);
+case 95:
+            if (yych <= '\f') {
+                if (yych == '\n') { gotoCase = 87; continue; };
+                { gotoCase = 94; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 87; continue; };
+                if (yych == '\'') { gotoCase = 93; continue; };
+                { gotoCase = 94; continue; };
+            }
+/* *********************************** */
+case this.case_TAG:
+            yych = this._charAt(cursor);
+            if (yych <= '&') {
+                if (yych <= '\r') {
+                    if (yych == '\n') { gotoCase = 100; continue; };
+                    if (yych >= '\r') { gotoCase = 100; continue; };
+                } else {
+                    if (yych <= ' ') {
+                        if (yych >= ' ') { gotoCase = 100; continue; };
+                    } else {
+                        if (yych == '"') { gotoCase = 102; continue; };
+                    }
+                }
+            } else {
+                if (yych <= '>') {
+                    if (yych <= ';') {
+                        if (yych <= '\'') { gotoCase = 103; continue; };
+                    } else {
+                        if (yych <= '<') { gotoCase = 100; continue; };
+                        if (yych <= '=') { gotoCase = 104; continue; };
+                        { gotoCase = 106; continue; };
+                    }
+                } else {
+                    if (yych <= '[') {
+                        if (yych >= '[') { gotoCase = 100; continue; };
+                    } else {
+                        if (yych == ']') { gotoCase = 100; continue; };
+                    }
+                }
+            }
+            ++cursor;
+            yych = this._charAt(cursor);
+            { gotoCase = 119; continue; };
+case 99:
+            {
+                    if (this._condition.parseCondition === this._parseConditions.SCRIPT || this._condition.parseCondition === this._parseConditions.STYLE) {
+                        // Fall through if expecting attributes.
+                        this.tokenType = null;
+                        return cursor;
+                    }
+
+                    if (this._condition.parseCondition === this._parseConditions.INITIAL) {
+                        this.tokenType = "html-tag";
+                        this._setExpectingAttribute();
+                        var token = this._line.substring(cursorOnEnter, cursor);
+                        if (token === "a")
+                            this._condition.parseCondition |= this._parseConditions.A_NODE;
+                        else if (this._condition.parseCondition & this._parseConditions.A_NODE)
+                            this._condition.parseCondition ^= this._parseConditions.A_NODE;
+                    } else if (this._isExpectingAttribute()) {
+                        var token = this._line.substring(cursorOnEnter, cursor);
+                        if (token === "href" || token === "src")
+                            this._condition.parseCondition |= this._parseConditions.LINKIFY;
+                        else if (this._condition.parseCondition |= this._parseConditions.LINKIFY)
+                            this._condition.parseCondition ^= this._parseConditions.LINKIFY;
+                        this.tokenType = "html-attribute-name";
+                    } else if (this._isExpectingAttributeValue())
+                        this.tokenType = this._attrValueTokenType();
+                    else
+                        this.tokenType = null;
+                    return cursor;
+                }
+case 100:
+            ++cursor;
+            { this.tokenType = null; return cursor; }
+case 102:
+            yyaccept = 0;
+            yych = this._charAt(YYMARKER = ++cursor);
+            { gotoCase = 115; continue; };
+case 103:
+            yyaccept = 0;
+            yych = this._charAt(YYMARKER = ++cursor);
+            { gotoCase = 109; continue; };
+case 104:
+            ++cursor;
+            {
+                    if (this._isExpectingAttribute())
+                        this._setExpectingAttributeValue();
+                    this.tokenType = null;
+                    return cursor;
+                }
+case 106:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.INITIAL);
+            {
+                    this.tokenType = "html-tag";
+                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
+                        if (!this._internalJavaScriptTokenizer) {
+                            this._internalJavaScriptTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript");
+                            this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.initialCondition;
+                        }
+                        // Do not tokenize script tag contents.
+                        return cursor;
+                    }
+
+                    if (this._condition.parseCondition & this._parseConditions.STYLE) {
+                        if (!this._internalCSSTokenizer) {
+                            this._internalCSSTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/css");
+                            this._condition.internalCSSTokenizerCondition = this._internalCSSTokenizer.initialCondition;
+                        }
+                        // Do not tokenize style tag contents.
+                        return cursor;
+                    }
+
+                    this._condition.parseCondition = this._parseConditions.INITIAL;
+                    return cursor;
+                }
+case 108:
+            ++cursor;
+            yych = this._charAt(cursor);
+case 109:
+            if (yych <= '\f') {
+                if (yych != '\n') { gotoCase = 108; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 110; continue; };
+                if (yych == '\'') { gotoCase = 112; continue; };
+                { gotoCase = 108; continue; };
+            }
+case 110:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.SSTRING);
+            { return this._stringToken(cursor); }
+case 112:
+            ++cursor;
+            { return this._stringToken(cursor, true); }
+case 114:
+            ++cursor;
+            yych = this._charAt(cursor);
+case 115:
+            if (yych <= '\f') {
+                if (yych != '\n') { gotoCase = 114; continue; };
+            } else {
+                if (yych <= '\r') { gotoCase = 116; continue; };
+                if (yych == '"') { gotoCase = 112; continue; };
+                { gotoCase = 114; continue; };
+            }
+case 116:
+            ++cursor;
+            this.setLexCondition(this._lexConditions.DSTRING);
+            { return this._stringToken(cursor); }
+case 118:
+            ++cursor;
+            yych = this._charAt(cursor);
+case 119:
+            if (yych <= '"') {
+                if (yych <= '\r') {
+                    if (yych == '\n') { gotoCase = 99; continue; };
+                    if (yych <= '\f') { gotoCase = 118; continue; };
+                    { gotoCase = 99; continue; };
+                } else {
+                    if (yych == ' ') { gotoCase = 99; continue; };
+                    if (yych <= '!') { gotoCase = 118; continue; };
+                    { gotoCase = 99; continue; };
+                }
+            } else {
+                if (yych <= '>') {
+                    if (yych == '\'') { gotoCase = 99; continue; };
+                    if (yych <= ';') { gotoCase = 118; continue; };
+                    { gotoCase = 99; continue; };
+                } else {
+                    if (yych <= '[') {
+                        if (yych <= 'Z') { gotoCase = 118; continue; };
+                        { gotoCase = 99; continue; };
+                    } else {
+                        if (yych == ']') { gotoCase = 99; continue; };
+                        { gotoCase = 118; continue; };
+                    }
+                }
+            }
+        }
+
+        }
+    }
+}
+
+WebInspector.SourceHTMLTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype;


Mime
View raw message