diff options
Diffstat (limited to 'WebCore/inspector')
-rw-r--r-- | WebCore/inspector/InspectorBackend.cpp | 4 | ||||
-rw-r--r-- | WebCore/inspector/InspectorBackend.h | 2 | ||||
-rw-r--r-- | WebCore/inspector/InspectorBackend.idl | 2 | ||||
-rw-r--r-- | WebCore/inspector/InspectorController.cpp | 49 | ||||
-rw-r--r-- | WebCore/inspector/InspectorController.h | 3 | ||||
-rw-r--r-- | WebCore/inspector/InspectorFrontend.cpp | 10 | ||||
-rw-r--r-- | WebCore/inspector/InspectorFrontend.h | 2 | ||||
-rw-r--r-- | WebCore/inspector/front-end/BreakpointManager.js | 65 | ||||
-rw-r--r-- | WebCore/inspector/front-end/ElementsPanel.js | 3 | ||||
-rw-r--r-- | WebCore/inspector/front-end/InjectedScript.js | 29 | ||||
-rw-r--r-- | WebCore/inspector/front-end/InspectorBackendStub.js | 3 | ||||
-rw-r--r-- | WebCore/inspector/front-end/Object.js | 14 | ||||
-rw-r--r-- | WebCore/inspector/front-end/ScriptView.js | 2 | ||||
-rw-r--r-- | WebCore/inspector/front-end/ScriptsPanel.js | 7 | ||||
-rw-r--r-- | WebCore/inspector/front-end/SourceFrame.js | 12 | ||||
-rw-r--r-- | WebCore/inspector/front-end/SourceView.js | 4 | ||||
-rw-r--r-- | WebCore/inspector/front-end/TextViewer.js | 26 |
17 files changed, 144 insertions, 93 deletions
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp index 8e9e330..e8866c2 100644 --- a/WebCore/inspector/InspectorBackend.cpp +++ b/WebCore/inspector/InspectorBackend.cpp @@ -178,10 +178,10 @@ void InspectorBackend::disableDebugger(bool always) m_inspectorController->disableDebugger(always); } -void InspectorBackend::setBreakpoint(const String& sourceID, unsigned lineNumber, bool enabled, const String& condition) +void InspectorBackend::setBreakpoint(long callId, const String& sourceID, unsigned lineNumber, bool enabled, const String& condition) { if (m_inspectorController) - m_inspectorController->setBreakpoint(sourceID, lineNumber, enabled, condition); + m_inspectorController->setBreakpoint(callId, sourceID, lineNumber, enabled, condition); } void InspectorBackend::removeBreakpoint(const String& sourceID, unsigned lineNumber) diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h index ce5dd99..035abf6 100644 --- a/WebCore/inspector/InspectorBackend.h +++ b/WebCore/inspector/InspectorBackend.h @@ -80,7 +80,7 @@ public: void enableDebugger(bool always); void disableDebugger(bool always); - void setBreakpoint(const String& sourceID, unsigned lineNumber, bool enabled, const String& condition); + void setBreakpoint(long callId, const String& sourceID, unsigned lineNumber, bool enabled, const String& condition); void removeBreakpoint(const String& sourceID, unsigned lineNumber); void activateBreakpoints(); void deactivateBreakpoints(); diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl index eaacaf0..b4a68cf 100644 --- a/WebCore/inspector/InspectorBackend.idl +++ b/WebCore/inspector/InspectorBackend.idl @@ -55,7 +55,7 @@ module core { void enableDebugger(in boolean always); void disableDebugger(in boolean always); - void setBreakpoint(in DOMString sourceID, in unsigned long lineNumber, in boolean enabled, in DOMString condition); + void setBreakpoint(in long callId, in DOMString sourceID, in unsigned long lineNumber, in boolean enabled, in DOMString condition); void removeBreakpoint(in DOMString sourceID, in unsigned long lineNumber); void activateBreakpoints(); void deactivateBreakpoints(); diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index 5020634..2256041 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -24,7 +24,7 @@ * 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. + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" @@ -163,6 +163,11 @@ String md5Base16(const String& string) return String(result.data(), result.size()); } +String formatBreakpointId(const String& sourceID, unsigned lineNumber) +{ + return String::format("%s:%d", sourceID.utf8().data(), lineNumber); +} + } InspectorController::InspectorController(Page* page, InspectorClient* client) @@ -712,6 +717,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) m_sourceIDToURL.clear(); m_scriptIDToContent.clear(); m_stickyBreakpoints.clear(); + m_breakpointsMapping.clear(); m_breakpointsLoaded = false; #endif #if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) @@ -1735,19 +1741,27 @@ PassRefPtr<SerializedScriptValue> InspectorController::currentCallFrames() return injectedScript.callFrames(); } -void InspectorController::setBreakpoint(const String& sourceID, unsigned lineNumber, bool enabled, const String& condition) +void InspectorController::setBreakpoint(long callId, const String& sourceID, unsigned lineNumber, bool enabled, const String& condition) { ScriptBreakpoint breakpoint(enabled, condition); - ScriptDebugServer::shared().setBreakpoint(sourceID, lineNumber, breakpoint); + unsigned actualLineNumber = 0; + bool success = ScriptDebugServer::shared().setBreakpoint(sourceID, breakpoint, lineNumber, &actualLineNumber); + m_frontend->didSetBreakpoint(callId, success, actualLineNumber); + if (!success) + return; + String url = m_sourceIDToURL.get(sourceID); if (url.isEmpty()) return; + String breakpointId = formatBreakpointId(sourceID, actualLineNumber); + m_breakpointsMapping.set(breakpointId, actualLineNumber); + String key = md5Base16(url); HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(key); if (it == m_stickyBreakpoints.end()) it = m_stickyBreakpoints.set(key, SourceBreakpoints()).first; - it->second.set(lineNumber, breakpoint); + it->second.set(actualLineNumber, breakpoint); saveBreakpoints(); } @@ -1759,9 +1773,18 @@ void InspectorController::removeBreakpoint(const String& sourceID, unsigned line if (url.isEmpty()) return; + String breakpointId = formatBreakpointId(sourceID, lineNumber); + HashMap<String, unsigned>::iterator mappingIt = m_breakpointsMapping.find(breakpointId); + if (mappingIt == m_breakpointsMapping.end()) + return; + unsigned stickyLine = mappingIt->second; + m_breakpointsMapping.remove(mappingIt); + HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(md5Base16(url)); - if (it != m_stickyBreakpoints.end()) - it->second.remove(lineNumber); + if (it == m_stickyBreakpoints.end()) + return; + + it->second.remove(stickyLine); saveBreakpoints(); } @@ -1781,10 +1804,16 @@ void InspectorController::didParseSource(const String& sourceID, const String& u HashMap<String, SourceBreakpoints>::iterator it = m_stickyBreakpoints.find(md5Base16(url)); if (it != m_stickyBreakpoints.end()) { for (SourceBreakpoints::iterator breakpointIt = it->second.begin(); breakpointIt != it->second.end(); ++breakpointIt) { - if (firstLine <= breakpointIt->first) { - ScriptDebugServer::shared().setBreakpoint(sourceID, breakpointIt->first, breakpointIt->second); - m_frontend->restoredBreakpoint(sourceID, url, breakpointIt->first, breakpointIt->second.enabled, breakpointIt->second.condition); - } + int lineNumber = breakpointIt->first; + if (firstLine > lineNumber) + continue; + unsigned actualLineNumber = 0; + bool success = ScriptDebugServer::shared().setBreakpoint(sourceID, breakpointIt->second, lineNumber, &actualLineNumber); + if (!success) + continue; + m_frontend->restoredBreakpoint(sourceID, url, actualLineNumber, breakpointIt->second.enabled, breakpointIt->second.condition); + String breakpointId = formatBreakpointId(sourceID, actualLineNumber); + m_breakpointsMapping.set(breakpointId, lineNumber); } } m_sourceIDToURL.set(sourceID, url); diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index b2d1d5a..4c94d6d 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -289,7 +289,7 @@ private: void deleteCookie(const String& cookieName, const String& domain); #if ENABLE(JAVASCRIPT_DEBUGGER) - void setBreakpoint(const String& sourceID, unsigned lineNumber, bool enabled, const String& condition); + void setBreakpoint(long callId, const String& sourceID, unsigned lineNumber, bool enabled, const String& condition); void removeBreakpoint(const String& sourceID, unsigned lineNumber); typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap; @@ -384,6 +384,7 @@ private: HashMap<String, String> m_sourceIDToURL; HashMap<String, String> m_scriptIDToContent; HashMap<String, SourceBreakpoints> m_stickyBreakpoints; + HashMap<String, unsigned> m_breakpointsMapping; bool m_breakpointsLoaded; bool m_profilerEnabled; diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp index cde5a70..fee4630 100644 --- a/WebCore/inspector/InspectorFrontend.cpp +++ b/WebCore/inspector/InspectorFrontend.cpp @@ -321,6 +321,16 @@ void InspectorFrontend::debuggerWasDisabled() callSimpleFunction("debuggerWasDisabled"); } +void InspectorFrontend::didSetBreakpoint(long callId, bool success, unsigned line) +{ + ScriptFunctionCall function(m_webInspector, "dispatch"); + function.appendArgument("didSetBreakpoint"); + function.appendArgument(callId); + function.appendArgument(success); + function.appendArgument(line); + function.call(); +} + void InspectorFrontend::parsedScriptSource(const String& sourceID, const String& url, const String& data, int firstLine, int scriptWorldType) { ScriptFunctionCall function(m_webInspector, "dispatch"); diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h index 0b19983..e02b661 100644 --- a/WebCore/inspector/InspectorFrontend.h +++ b/WebCore/inspector/InspectorFrontend.h @@ -101,6 +101,8 @@ namespace WebCore { void debuggerWasEnabled(); void debuggerWasDisabled(); + void didSetBreakpoint(long callId, bool success, unsigned line); + void parsedScriptSource(const String& sourceID, const String& url, const String& data, int firstLine, int scriptWorldType); void restoredBreakpoint(const String& sourceID, const String& url, int line, bool enabled, const String& condition); void failedToParseScriptSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage); diff --git a/WebCore/inspector/front-end/BreakpointManager.js b/WebCore/inspector/front-end/BreakpointManager.js index 4f6965a..709a9c2 100644 --- a/WebCore/inspector/front-end/BreakpointManager.js +++ b/WebCore/inspector/front-end/BreakpointManager.js @@ -36,39 +36,36 @@ WebInspector.BreakpointManager.prototype = { if (this._breakpoints[breakpoint.id]) return; if (this._oneTimeBreakpoint) - this._removeBreakpointFromBackend(this._oneTimeBreakpoint); + InspectorBackend.removeBreakpoint(this._oneTimeBreakpoint.sourceID, this._oneTimeBreakpoint.line); this._oneTimeBreakpoint = breakpoint; // FIXME(40669): one time breakpoint will be persisted in inspector settings if not hit. - this._saveBreakpointOnBackend(breakpoint); + this._setBreakpointOnBackend(breakpoint, true); }, removeOneTimeBreakpoint: function() { if (this._oneTimeBreakpoint) { - this._removeBreakpointFromBackend(this._oneTimeBreakpoint); + InspectorBackend.removeBreakpoint(this._oneTimeBreakpoint.sourceID, this._oneTimeBreakpoint.line); delete this._oneTimeBreakpoint; } }, - addBreakpoint: function(sourceID, sourceURL, line, enabled, condition) + setBreakpoint: function(sourceID, sourceURL, line, enabled, condition) { - var breakpoint = this._addBreakpoint(sourceID, sourceURL, line, enabled, condition); + var breakpoint = this._setBreakpoint(sourceID, sourceURL, line, enabled, condition); if (breakpoint) - this._saveBreakpointOnBackend(breakpoint); + this._setBreakpointOnBackend(breakpoint); }, restoredBreakpoint: function(sourceID, sourceURL, line, enabled, condition) { - this._addBreakpoint(sourceID, sourceURL, line, enabled, condition); + this._setBreakpoint(sourceID, sourceURL, line, enabled, condition); }, removeBreakpoint: function(breakpoint) { - if (!(breakpoint.id in this._breakpoints)) - return; - delete this._breakpoints[breakpoint.id]; - this._removeBreakpointFromBackend(breakpoint); - this.dispatchEventToListeners("breakpoint-removed", breakpoint); + if (this._removeBreakpoint(breakpoint)) + InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line); }, breakpointsForSourceID: function(sourceID) @@ -97,7 +94,7 @@ WebInspector.BreakpointManager.prototype = { delete this._oneTimeBreakpoint; }, - _addBreakpoint: function(sourceID, sourceURL, line, enabled, condition) + _setBreakpoint: function(sourceID, sourceURL, line, enabled, condition) { var breakpoint = new WebInspector.Breakpoint(this, sourceID, sourceURL, line, enabled, condition); if (this._breakpoints[breakpoint.id]) @@ -109,14 +106,36 @@ WebInspector.BreakpointManager.prototype = { return breakpoint; }, - _saveBreakpointOnBackend: function(breakpoint) - { - InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition); - }, - - _removeBreakpointFromBackend: function(breakpoint) + _removeBreakpoint: function(breakpoint) { - InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line); + if (!(breakpoint.id in this._breakpoints)) + return false; + breakpoint.removeAllListeners(); + delete breakpoint._breakpointManager; + delete this._breakpoints[breakpoint.id]; + this.dispatchEventToListeners("breakpoint-removed", breakpoint); + return true; + }, + + _setBreakpointOnBackend: function(breakpoint, isOneTime) + { + function didSetBreakpoint(success, line) + { + if (success && line == breakpoint.line) + return; + if (isOneTime) { + if (success) + this._oneTimeBreakpoint.line = line; + else + delete this._oneTimeBreakpoint; + } else { + this._removeBreakpoint(breakpoint); + if (success) + this._setBreakpoint(breakpoint.sourceID, breakpoint.sourceURL, line, breakpoint.enabled, breakpoint.condition); + } + } + var callbackId = WebInspector.Callback.wrap(didSetBreakpoint.bind(this)); + InspectorBackend.setBreakpoint(callbackId, breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition); } } @@ -145,7 +164,7 @@ WebInspector.Breakpoint.prototype = { return; this._enabled = x; - this._breakpointManager._saveBreakpointOnBackend(this); + this._breakpointManager._setBreakpointOnBackend(this); if (this._enabled) this.dispatchEventToListeners("enabled"); else @@ -187,9 +206,11 @@ WebInspector.Breakpoint.prototype = { this._condition = c; if (this.enabled) - this._breakpointManager._saveBreakpointOnBackend(this); + this._breakpointManager._setBreakpointOnBackend(this); this.dispatchEventToListeners("condition-changed"); } } WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype; + +WebInspector.didSetBreakpoint = WebInspector.Callback.processCallback; diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index c8eb3dd..e176112 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -1028,7 +1028,8 @@ WebInspector.ElementsPanel.prototype = { updateStyles: function(forceUpdate) { var stylesSidebarPane = this.sidebarPanes.styles; - if (!stylesSidebarPane.expanded || !stylesSidebarPane.needsUpdate) + var computedStylePane = this.sidebarPanes.computedStyle; + if ((!stylesSidebarPane.expanded && !computedStylePane.expanded) || !stylesSidebarPane.needsUpdate) return; stylesSidebarPane.update(this.focusedDOMNode, null, forceUpdate); diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index 26495e8..5d9d065 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -121,27 +121,6 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbre if (!ignoreHasOwnProperty && object.__proto__) propertyNames.push("__proto__"); - if (jsEngine === "v8") { - // Check if the object is a scope. - if (InjectedScript._isScopeProxy(objectProxy)) { - propertyNames = []; - for (var name in object) - propertyNames.push(name); - } else { - // FIXME(http://crbug.com/41243): Object.getOwnPropertyNames may return duplicated names. - var a = []; - propertyNames.sort(); - var prev; - for (var i = 0; i < propertyNames.length; i++) { - var n = propertyNames[i]; - if (n != prev) - a.push(n); - prev = n; - } - propertyNames = a; - } - } - // Go over properties, prepare results. for (var i = 0; i < propertyNames.length; ++i) { var propertyName = propertyNames[i]; @@ -171,12 +150,6 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbre return properties; } -InjectedScript._isScopeProxy = function(objectProxy) -{ - var objectId = objectProxy.objectId; - return typeof objectId === "object" && !objectId.thisObject; -} - InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression) { var object = InjectedScript._resolveObject(objectProxy); @@ -217,7 +190,7 @@ InjectedScript._populatePropertyNames = function(object, resultSet) try { var names = Object.getOwnPropertyNames(o); for (var i = 0; i < names.length; ++i) - resultSet[names[i] + ""] = true; + resultSet[names[i]] = true; } catch (e) { } } diff --git a/WebCore/inspector/front-end/InspectorBackendStub.js b/WebCore/inspector/front-end/InspectorBackendStub.js index 1ae32b5..761e876 100644 --- a/WebCore/inspector/front-end/InspectorBackendStub.js +++ b/WebCore/inspector/front-end/InspectorBackendStub.js @@ -165,8 +165,9 @@ WebInspector.InspectorBackendStub.prototype = { WebInspector.debuggerWasDisabled(); }, - setBreakpoint: function(sourceID, line, enabled, condition) + setBreakpoint: function(callId, sourceID, line, enabled, condition) { + WebInspector.didSetBreakpoint(callId, true, line); }, removeBreakpoint: function(sourceID, line) diff --git a/WebCore/inspector/front-end/Object.js b/WebCore/inspector/front-end/Object.js index 27e2144..5872b8b 100644 --- a/WebCore/inspector/front-end/Object.js +++ b/WebCore/inspector/front-end/Object.js @@ -27,7 +27,8 @@ WebInspector.Object = function() { } WebInspector.Object.prototype = { - addEventListener: function(eventType, listener, thisObject) { + addEventListener: function(eventType, listener, thisObject) + { if (!("_listeners" in this)) this._listeners = {}; if (!(eventType in this._listeners)) @@ -35,7 +36,8 @@ WebInspector.Object.prototype = { this._listeners[eventType].push({ thisObject: thisObject, listener: listener }); }, - removeEventListener: function(eventType, listener, thisObject) { + removeEventListener: function(eventType, listener, thisObject) + { if (!("_listeners" in this) || !(eventType in this._listeners)) return; var listeners = this._listeners[eventType]; @@ -50,7 +52,13 @@ WebInspector.Object.prototype = { delete this._listeners[eventType]; }, - dispatchEventToListeners: function(eventType, eventData) { + removeAllListeners: function() + { + delete this._listeners; + }, + + dispatchEventToListeners: function(eventType, eventData) + { if (!("_listeners" in this) || !(eventType in this._listeners)) return; diff --git a/WebCore/inspector/front-end/ScriptView.js b/WebCore/inspector/front-end/ScriptView.js index 1883fb3..c576510 100644 --- a/WebCore/inspector/front-end/ScriptView.js +++ b/WebCore/inspector/front-end/ScriptView.js @@ -96,7 +96,7 @@ WebInspector.ScriptView.prototype = { _addBreakpoint: function(line) { - WebInspector.breakpointManager.addBreakpoint(this.script.sourceID, this.script.sourceURL, line, true, ""); + WebInspector.breakpointManager.setBreakpoint(this.script.sourceID, this.script.sourceURL, line, true, ""); }, _editLineComplete: function(newBody) diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index c23db14..5563b93 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -224,9 +224,9 @@ WebInspector.ScriptsPanel.prototype = { hide: function() { - WebInspector.Panel.prototype.hide.call(this); if (this.visibleView) this.visibleView.hide(); + WebInspector.Panel.prototype.hide.call(this); }, get searchableViews() @@ -364,9 +364,10 @@ WebInspector.ScriptsPanel.prototype = { } for (var i = 0; i < breakpoints.length; ++i) { var breakpoint = breakpoints[i]; + var newLine = breakpoint.line; if (success && breakpoint.line >= line) - breakpoint.line += linesCountToShift; - WebInspector.breakpointManager.addBreakpoint(breakpoint); + newLine += linesCountToShift; + WebInspector.breakpointManager.setBreakpoint(sourceID, breakpoint.url, newLine, breakpoint.enabled, breakpoint.condition); } }; var callbackId = WebInspector.Callback.wrap(mycallback.bind(this)) diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js index f221086..73c3e2a 100644 --- a/WebCore/inspector/front-end/SourceFrame.js +++ b/WebCore/inspector/front-end/SourceFrame.js @@ -56,10 +56,18 @@ WebInspector.SourceFrame.prototype = { this._visible = visible; this._createViewerIfNeeded(); - if (!visible) { + if (visible) { + if (this._textViewer && this._scrollTop) + this._textViewer.element.scrollTop = this._scrollTop; + if (this._textViewer && this._scrollLeft) + this._textViewer.element.scrollLeft = this._scrollLeft; + } else { this._hidePopup(); - if (this._textViewer) + if (this._textViewer) { + this._scrollTop = this._textViewer.element.scrollTop; + this._scrollLeft = this._textViewer.element.scrollLeft; this._textViewer.freeCachedElements(); + } } }, diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js index e4d7fed..1bf8194 100644 --- a/WebCore/inspector/front-end/SourceView.js +++ b/WebCore/inspector/front-end/SourceView.js @@ -58,8 +58,8 @@ WebInspector.SourceView.prototype = { hide: function() { - WebInspector.View.prototype.hide.call(this); this.sourceFrame.visible = false; + WebInspector.View.prototype.hide.call(this); if (this.localSourceFrame) this.localSourceFrame.visible = false; this._currentSearchResultIndex = -1; @@ -127,7 +127,7 @@ WebInspector.SourceView.prototype = { _addBreakpoint: function(line) { var sourceID = this._sourceIDForLine(line); - WebInspector.breakpointManager.addBreakpoint(sourceID, this.resource.url, line, true, ""); + WebInspector.breakpointManager.setBreakpoint(sourceID, this.resource.url, line, true, ""); }, _removeBreakpoint: function(breakpoint) diff --git a/WebCore/inspector/front-end/TextViewer.js b/WebCore/inspector/front-end/TextViewer.js index 4709a59..13b2836 100644 --- a/WebCore/inspector/front-end/TextViewer.js +++ b/WebCore/inspector/front-end/TextViewer.js @@ -551,28 +551,24 @@ WebInspector.TextViewer.prototype = { return { line: lineNumber, column: this._textModel.lineLength(lineNumber) }; var column = 0; - if (lineRow.chunk) { - // This is chunk. - var text = lineRow.lastChild.textContent; + var node = lineRow.lastChild.traverseNextTextNode(lineRow.lastChild); + while (node && node !== container) { + column += node.textContent.length; + node = node.traverseNextTextNode(lineRow.lastChild); + } + + // This may be chunk and chunks may contain \n. + if (node === container && offset) { + var text = node.textContent; for (var i = 0; i < offset; ++i) { if (text.charAt(i) === "\n") { lineNumber++; column = 0; } else - column++; + column++; } - return { line: lineNumber, column: column }; - } - - // This is individul line. - var column = 0; - var node = lineRow.lastChild.traverseNextTextNode(lineRow.lastChild); - while (node && node !== container) { - column += node.textContent.length; - node = node.traverseNextTextNode(lineRow.lastChild); } - column += offset; - return { line: lineRow.lineNumber, column: column }; + return { line: lineNumber, column: column }; }, _appendSpan: function(element, content, className) |