Commit d345fed8 authored by rik@webkit.org's avatar rik@webkit.org

Implement conditional breakpoints in the Web Inspector frontend.

https://bugs.webkit.org/show_bug.cgi?id=28908

Patch by Alexander Pavlov <apavlov@chromium.org> on 2009-09-15
Reviewed by Timothy Hatcher.

* English.lproj/localizedStrings.js:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/front-end/Breakpoint.js:
(WebInspector.Breakpoint.prototype.set condition):
* inspector/front-end/Popup.js: Added.
(WebInspector.Popup):
(WebInspector.Popup.prototype.show):
(WebInspector.Popup.prototype.hide):
(WebInspector.Popup.prototype.get visible):
(WebInspector.Popup.prototype.set element):
(WebInspector.Popup.prototype.get element):
(WebInspector.Popup.prototype.positionElement):
(WebInspector.Popup.prototype.set anchor):
(WebInspector.Popup.prototype.get anchor):
(WebInspector.Popup.prototype.set autoHide):
(WebInspector.Popup.prototype._checkNotVisible):
(WebInspector.Popup.prototype._keyEventHandler):
(WebInspector.Popup.prototype._mouseDownEventHandler):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame.prototype.revealLine):
(WebInspector.SourceFrame.prototype._loaded):
(WebInspector.SourceFrame.prototype._documentContextMenu):
(WebInspector.SourceFrame.prototype._documentMouseDown):
(WebInspector.SourceFrame.prototype._editBreakpointCondition.committed):
(WebInspector.SourceFrame.prototype._editBreakpointCondition.dismissed):
(WebInspector.SourceFrame.prototype._editBreakpointCondition):
(WebInspector.SourceFrame.prototype._showBreakpointConditionPopup):
(WebInspector.SourceFrame.prototype._createPopupElement):
(WebInspector.SourceFrame.prototype._addBreakpointToSource):
(WebInspector.SourceFrame.prototype._removeBreakpointFromSource):
(WebInspector.SourceFrame.prototype._drawBreakpointImagesIfNeeded.drawBreakpoint):
(WebInspector.SourceFrame.prototype._drawBreakpointImagesIfNeeded):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.html:
* inspector/front-end/inspector.js:
(WebInspector.set currentFocusElement):
(WebInspector.set currentPanel):
(WebInspector.loaded):
(WebInspector.contextMenu):
(WebInspector.elementDragStart):
(WebInspector.updateResource):
(WebInspector.drawLoadingPieChart):
(WebInspector.linkifyURLAsNode):
(WebInspector.startEditing.getContent):
(WebInspector.startEditing.editingCancelled):
(WebInspector.startEditing.editingCommitted):
* inspector/front-end/utilities.js:
(Element.prototype.positionAt):
(Element.prototype.offsetRelativeToWindow):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 36819cd9
2009-09-15 Alexander Pavlov <apavlov@chromium.org>
Reviewed by Timothy Hatcher.
Implement conditional breakpoints in the Web Inspector frontend.
https://bugs.webkit.org/show_bug.cgi?id=28908
* English.lproj/localizedStrings.js:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/front-end/Breakpoint.js:
(WebInspector.Breakpoint.prototype.set condition):
* inspector/front-end/Popup.js: Added.
(WebInspector.Popup):
(WebInspector.Popup.prototype.show):
(WebInspector.Popup.prototype.hide):
(WebInspector.Popup.prototype.get visible):
(WebInspector.Popup.prototype.set element):
(WebInspector.Popup.prototype.get element):
(WebInspector.Popup.prototype.positionElement):
(WebInspector.Popup.prototype.set anchor):
(WebInspector.Popup.prototype.get anchor):
(WebInspector.Popup.prototype.set autoHide):
(WebInspector.Popup.prototype._checkNotVisible):
(WebInspector.Popup.prototype._keyEventHandler):
(WebInspector.Popup.prototype._mouseDownEventHandler):
* inspector/front-end/SourceFrame.js:
(WebInspector.SourceFrame.prototype.revealLine):
(WebInspector.SourceFrame.prototype._loaded):
(WebInspector.SourceFrame.prototype._documentContextMenu):
(WebInspector.SourceFrame.prototype._documentMouseDown):
(WebInspector.SourceFrame.prototype._editBreakpointCondition.committed):
(WebInspector.SourceFrame.prototype._editBreakpointCondition.dismissed):
(WebInspector.SourceFrame.prototype._editBreakpointCondition):
(WebInspector.SourceFrame.prototype._showBreakpointConditionPopup):
(WebInspector.SourceFrame.prototype._createPopupElement):
(WebInspector.SourceFrame.prototype._addBreakpointToSource):
(WebInspector.SourceFrame.prototype._removeBreakpointFromSource):
(WebInspector.SourceFrame.prototype._drawBreakpointImagesIfNeeded.drawBreakpoint):
(WebInspector.SourceFrame.prototype._drawBreakpointImagesIfNeeded):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.html:
* inspector/front-end/inspector.js:
(WebInspector.set currentFocusElement):
(WebInspector.set currentPanel):
(WebInspector.loaded):
(WebInspector.contextMenu):
(WebInspector.elementDragStart):
(WebInspector.updateResource):
(WebInspector.drawLoadingPieChart):
(WebInspector.linkifyURLAsNode):
(WebInspector.startEditing.getContent):
(WebInspector.startEditing.editingCancelled):
(WebInspector.startEditing.editingCommitted):
* inspector/front-end/utilities.js:
(Element.prototype.positionAt):
(Element.prototype.offsetRelativeToWindow):
2009-09-14 Brady Eidson <beidson@apple.com>
Reviewed by Darin Adler.
Bvar localizedStrings = new Object;
......
......@@ -3490,6 +3490,7 @@
'inspector/front-end/Panel.js',
'inspector/front-end/PanelEnablerView.js',
'inspector/front-end/Placard.js',
'inspector/front-end/Popup.js',
'inspector/front-end/ProfileDataGridTree.js',
'inspector/front-end/ProfilesPanel.js',
'inspector/front-end/ProfileView.js',
......
......@@ -31530,6 +31530,10 @@
RelativePath="..\inspector\front-end\Placard.js"
>
</File>
<File
RelativePath="..\inspector\front-end\Popup.js"
>
</File>
<File
RelativePath="..\inspector\front-end\ProfileDataGridTree.js"
>
......
......@@ -88,7 +88,8 @@ WebInspector.Breakpoint.prototype = {
this._condition = c;
this.dispatchEventToListeners("condition-changed");
InspectorController.updateBreakpoint(this.sourceID, this.line, c);
if (this.enabled)
InspectorController.updateBreakpoint(this.sourceID, this.line, c);
}
}
......
/*
* 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.
*/
/**
* This class provides a popup that can be shown relative to an anchor element
* or at an arbitrary absolute position.
* Points are Objects: {x: xValue, y: yValue}.
* Rectangles are Objects: {x: xValue, y: yValue, width: widthValue, height: heightValue}.
*
* element is an optional unparented visible element (style.display != "none" AND style.visibility != "hidden").
* If the element is absent/undefined, it must have been set with the element(x) setter before the show() method invocation.
*/
WebInspector.Popup = function(element)
{
if (element)
this.element = element;
this._keyHandler = this._keyEventHandler.bind(this);
this._mouseDownHandler = this._mouseDownEventHandler.bind(this);
this._visible = false;
this._autoHide = true;
}
WebInspector.Popup.prototype = {
show: function()
{
if (this.visible)
return;
var ownerDocument = this._contentElement.ownerDocument;
if (!ownerDocument)
return;
this._glasspaneElement = ownerDocument.createElement("div");
this._glasspaneElement.className = "popup-glasspane";
ownerDocument.body.appendChild(this._glasspaneElement);
this._contentElement.positionAt(0, 0);
this._contentElement.removeStyleClass("hidden");
ownerDocument.body.appendChild(this._contentElement);
this.positionElement();
this._visible = true;
ownerDocument.addEventListener("keydown", this._keyHandler, false);
ownerDocument.addEventListener("mousedown", this._mouseDownHandler, false);
},
hide: function()
{
if (this.visible) {
this._visible = false;
this._contentElement.ownerDocument.removeEventListener("keydown", this._keyHandler, false);
this._contentElement.ownerDocument.removeEventListener("mousedown", this._mouseDownHandler, false);
this._glasspaneElement.parentElement.removeChild(this._glasspaneElement);
this._contentElement.parentElement.removeChild(this._contentElement);
}
},
get visible()
{
return this._visible;
},
set element(x)
{
this._checkNotVisible();
this._contentElement = x;
this._contentElement.addStyleClass("hidden");
},
get element()
{
return this._contentElement;
},
positionElement: function()
{
var element = this._contentElement;
var anchorElement = this._anchorElement;
var targetDocument = element.ownerDocument;
var targetDocumentBody = targetDocument.body;
var targetDocumentElement = targetDocument.documentElement;
var clippingBox = {x: 0, y: 0, width: targetDocumentElement.clientWidth, height: targetDocumentElement.clientHeight};
var parentElement = element.offsetParent || element.parentElement;
var anchorPosition = {x: anchorElement.totalOffsetLeft, y: anchorElement.totalOffsetTop};
// FIXME(apavlov@chromium.org): Translate anchorPosition to the element.ownerDocument frame when https://bugs.webkit.org/show_bug.cgi?id=28913 is fixed.
var anchorBox = {x: anchorPosition.x, y: anchorPosition.y, width: anchorElement.offsetWidth, height: anchorElement.offsetHeight};
var elementBox = {x: element.totalOffsetLeft, y: element.totalOffsetTop, width: element.offsetWidth, height: element.offsetHeight};
var newElementPosition = {x: 0, y: 0};
if (anchorBox.y - elementBox.height >= clippingBox.y)
newElementPosition.y = anchorBox.y - elementBox.height;
else
newElementPosition.y = Math.min(anchorBox.y + anchorBox.height, Math.max(clippingBox.y, clippingBox.y + clippingBox.height - elementBox.height));
if (anchorBox.x + elementBox.height <= clippingBox.x + clippingBox.height)
newElementPosition.x = anchorBox.x;
else
newElementPosition.x = Math.max(clippingBox.x, clippingBox.x + clippingBox.height - elementBox.height);
element.positionAt(newElementPosition.x, newElementPosition.y);
},
set anchor(x)
{
this._checkNotVisible();
this._anchorElement = x;
},
get anchor()
{
return this._anchorElement;
},
set autoHide(x)
{
this._autoHide = x;
},
_checkNotVisible: function()
{
if (this.visible)
throw new Error("The popup must not be visible.");
},
_keyEventHandler: function(event)
{
// Escape hides the popup.
if (event.keyIdentifier == "U+001B") {
this.hide();
event.preventDefault();
event.handled = true;
}
},
_mouseDownEventHandler: function(event)
{
if (this._autoHide && event.originalTarget === this._glasspaneElement)
this.hide();
}
}
......@@ -115,7 +115,7 @@ WebInspector.SourceFrame.prototype = {
this._lineNumberToReveal = lineNumber;
return;
}
var row = this.sourceRow(lineNumber);
if (row)
row.scrollIntoViewIfNeeded(true);
......@@ -199,6 +199,7 @@ WebInspector.SourceFrame.prototype = {
_loaded: function()
{
WebInspector.addMainEventListeners(this.element.contentDocument);
this.element.contentDocument.addEventListener("contextmenu", this._documentContextMenu.bind(this), true);
this.element.contentDocument.addEventListener("mousedown", this._documentMouseDown.bind(this), true);
this.element.contentDocument.addEventListener("keydown", this._documentKeyDown.bind(this), true);
this.element.contentDocument.addEventListener("keyup", WebInspector.documentKeyUp.bind(WebInspector), true);
......@@ -222,11 +223,18 @@ WebInspector.SourceFrame.prototype = {
// Add these style rules here since they are specific to the Inspector. They also behave oddly and not
// all properties apply if added to view-source.css (becuase it is a user agent sheet.)
var styleText = ".webkit-line-number { background-repeat: no-repeat; background-position: right 1px; }\n";
styleText += ".webkit-execution-line .webkit-line-number { color: transparent; background-image: -webkit-canvas(program-counter); }\n";
styleText += ".webkit-breakpoint .webkit-line-number { color: white; background-image: -webkit-canvas(breakpoint); }\n";
styleText += ".webkit-breakpoint-disabled .webkit-line-number { color: white; background-image: -webkit-canvas(breakpoint-disabled); }\n";
styleText += ".webkit-execution-line .webkit-line-number { color: transparent; background-image: -webkit-canvas(program-counter); }\n";
styleText += ".webkit-breakpoint.webkit-execution-line .webkit-line-number { color: transparent; background-image: -webkit-canvas(breakpoint-program-counter); }\n";
styleText += ".webkit-breakpoint-disabled.webkit-execution-line .webkit-line-number { color: transparent; background-image: -webkit-canvas(breakpoint-disabled-program-counter); }\n";
styleText += ".webkit-breakpoint.webkit-breakpoint-conditional .webkit-line-number { color: white; background-image: -webkit-canvas(breakpoint-conditional); }\n";
styleText += ".webkit-breakpoint-disabled.webkit-breakpoint-conditional .webkit-line-number { color: white; background-image: -webkit-canvas(breakpoint-disabled-conditional); }\n";
styleText += ".webkit-breakpoint.webkit-breakpoint-conditional.webkit-execution-line .webkit-line-number { color: transparent; background-image: -webkit-canvas(breakpoint-conditional-program-counter); }\n";
styleText += ".webkit-breakpoint-disabled.webkit-breakpoint-conditional.webkit-execution-line .webkit-line-number { color: transparent; background-image: -webkit-canvas(breakpoint-disabled-conditional-program-counter); }\n";
styleText += ".webkit-execution-line .webkit-line-content { background-color: rgb(171, 191, 254); outline: 1px solid rgb(64, 115, 244); }\n";
styleText += ".webkit-height-sized-to-fit { overflow-y: hidden }\n";
styleText += ".webkit-line-content { background-color: white; }\n";
......@@ -237,6 +245,15 @@ WebInspector.SourceFrame.prototype = {
styleText += ".webkit-javascript-number { color: rgb(28, 0, 207); }\n";
styleText += ".webkit-javascript-string, .webkit-javascript-regexp { color: rgb(196, 26, 22); }\n";
// TODO: Move these styles into inspector.css once https://bugs.webkit.org/show_bug.cgi?id=28913 is fixed and popup moved into the top frame.
styleText += ".popup-content { position: absolute; z-index: 10000; padding: 4px; background-color: rgb(203, 226, 255); -webkit-border-radius: 7px; border: 2px solid rgb(169, 172, 203); }";
styleText += ".popup-glasspane { position: absolute; top: 0; left: 0; height: 100%; width: 100%; opacity: 0; z-index: 9900; }";
styleText += ".popup-message { background-color: transparent; font-family: Lucida Grande, sans-serif; font-weight: normal; font-size: 11px; text-align: left; text-shadow: none; color: rgb(85, 85, 85); cursor: default; margin: 0 0 2px 0; }";
styleText += ".popup-content.breakpoint-condition { width: 90%; }";
styleText += ".popup-content input#bp-condition { font-family: monospace; margin: 0; border: 1px inset rgb(190, 190, 190) !important; width: 100%; box-shadow: none !important; outline: none !important; -webkit-user-modify: read-write; }";
// This class is already in inspector.css
styleText += ".hidden { display: none !important; }";
styleElement.textContent = styleText;
this._needsProgramCounterImage = true;
......@@ -244,8 +261,12 @@ WebInspector.SourceFrame.prototype = {
this.element.contentWindow.Element.prototype.addStyleClass = Element.prototype.addStyleClass;
this.element.contentWindow.Element.prototype.removeStyleClass = Element.prototype.removeStyleClass;
this.element.contentWindow.Element.prototype.positionAt = Element.prototype.positionAt;
this.element.contentWindow.Element.prototype.removeMatchingStyleClasses = Element.prototype.removeMatchingStyleClasses;
this.element.contentWindow.Element.prototype.hasStyleClass = Element.prototype.hasStyleClass;
this.element.contentWindow.Element.prototype.pageOffsetRelativeToWindow = Element.prototype.pageOffsetRelativeToWindow;
this.element.contentWindow.Element.prototype.__defineGetter__("totalOffsetLeft", Element.prototype.__lookupGetter__("totalOffsetLeft"));
this.element.contentWindow.Element.prototype.__defineGetter__("totalOffsetTop", Element.prototype.__lookupGetter__("totalOffsetTop"));
this.element.contentWindow.Node.prototype.enclosingNodeOrSelfWithNodeName = Node.prototype.enclosingNodeOrSelfWithNodeName;
this.element.contentWindow.Node.prototype.enclosingNodeOrSelfWithNodeNameInArray = Node.prototype.enclosingNodeOrSelfWithNodeNameInArray;
......@@ -257,20 +278,20 @@ WebInspector.SourceFrame.prototype = {
if (this.autoSizesToFitContentHeight)
this.sizeToFitContentHeight();
if (this._lineNumberToReveal) {
this.revealLine(this._lineNumberToReveal);
delete this._lineNumberToReveal;
}
if (this._lineNumberToHighlight) {
this.highlightLine(this._lineNumberToHighlight);
delete this._lineNumberToHighlight;
}
this.dispatchEventToListeners("content loaded");
},
_isContentLoaded: function() {
var doc = this.element.contentDocument;
return doc && doc.getElementsByTagName("table")[0];
......@@ -283,20 +304,102 @@ WebInspector.SourceFrame.prototype = {
this.sizeToFitContentHeight();
},
_documentMouseDown: function(event)
_documentContextMenu: function(event)
{
if (!event.target.hasStyleClass("webkit-line-number"))
return;
var sourceRow = event.target.enclosingNodeOrSelfWithNodeName("tr");
if (!sourceRow._breakpointObject && this.addBreakpointDelegate)
this.addBreakpointDelegate(this.lineNumberForSourceRow(sourceRow));
var breakpoint = sourceRow._breakpointObject;
if (!breakpoint)
return;
this._editBreakpointCondition(event.target, sourceRow, breakpoint);
event.preventDefault();
},
_documentMouseDown: function(event)
{
if (!event.target.hasStyleClass("webkit-line-number"))
return;
if (event.button != 0 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
return;
var sourceRow = event.target.enclosingNodeOrSelfWithNodeName("tr");
if (sourceRow._breakpointObject && sourceRow._breakpointObject.enabled)
sourceRow._breakpointObject.enabled = false;
else if (sourceRow._breakpointObject)
else if (sourceRow._breakpointObject)
WebInspector.panels.scripts.removeBreakpoint(sourceRow._breakpointObject);
else if (this.addBreakpointDelegate)
this.addBreakpointDelegate(this.lineNumberForSourceRow(sourceRow));
},
_editBreakpointCondition: function(eventTarget, sourceRow, breakpoint)
{
// TODO: Migrate the popup to the top-level document and remove the blur listener from conditionElement once https://bugs.webkit.org/show_bug.cgi?id=28913 is fixed.
var popupDocument = this.element.contentDocument;
this._showBreakpointConditionPopup(eventTarget, breakpoint.line, popupDocument);
function committed(element, newText)
{
breakpoint.condition = newText;
if (breakpoint.condition)
sourceRow.addStyleClass("webkit-breakpoint-conditional");
else
sourceRow.removeStyleClass("webkit-breakpoint-conditional");
dismissed.call(this);
}
function dismissed()
{
this._popup.hide();
delete this._conditionEditorElement;
}
var dismissedHandler = dismissed.bind(this);
this._conditionEditorElement.addEventListener("blur", dismissedHandler, false);
WebInspector.startEditing(this._conditionEditorElement, committed.bind(this), dismissedHandler);
this._conditionEditorElement.value = breakpoint.condition;
this._conditionEditorElement.select();
},
_showBreakpointConditionPopup: function(clickedElement, lineNumber, popupDocument)
{
var popupContentElement = this._createPopupElement(lineNumber, popupDocument);
var lineElement = clickedElement.enclosingNodeOrSelfWithNodeName("td").nextSibling;
if (this._popup) {
this._popup.hide();
this._popup.element = popupContentElement;
} else {
this._popup = new WebInspector.Popup(popupContentElement);
this._popup.autoHide = true;
}
this._popup.anchor = lineElement;
this._popup.show();
},
_createPopupElement: function(lineNumber, popupDocument)
{
var popupContentElement = popupDocument.createElement("div");
popupContentElement.className = "popup-content breakpoint-condition";
var labelElement = document.createElement("label");
labelElement.className = "popup-message";
labelElement.htmlFor = "bp-condition";
labelElement.appendChild(document.createTextNode(WebInspector.UIString("The breakpoint on line %d will stop only if this expression is true:", lineNumber)));
popupContentElement.appendChild(labelElement);
var editorElement = document.createElement("input");
editorElement.id = "bp-condition";
editorElement.type = "text"
popupContentElement.appendChild(editorElement);
this._conditionEditorElement = editorElement;
return popupContentElement;
},
_documentKeyDown: function(event)
{
var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
......@@ -382,6 +485,8 @@ WebInspector.SourceFrame.prototype = {
sourceRow.addStyleClass("webkit-breakpoint");
if (!breakpoint.enabled)
sourceRow.addStyleClass("webkit-breakpoint-disabled");
if (breakpoint.condition)
sourceRow.addStyleClass("webkit-breakpoint-conditional");
},
_removeBreakpointFromSource: function(breakpoint)
......@@ -394,8 +499,9 @@ WebInspector.SourceFrame.prototype = {
sourceRow.removeStyleClass("webkit-breakpoint");
sourceRow.removeStyleClass("webkit-breakpoint-disabled");
sourceRow.removeStyleClass("webkit-breakpoint-conditional");
},
_incrementMessageRepeatCount: function(msg, repeatDelta)
{
if (!msg._resourceMessageLineElement)
......@@ -520,12 +626,12 @@ WebInspector.SourceFrame.prototype = {
delete this._needsProgramCounterImage;
},
_drawBreakpointImagesIfNeeded: function()
_drawBreakpointImagesIfNeeded: function(conditional)
{
if (!this._needsBreakpointImages || !this.element.contentDocument)
return;
function drawBreakpoint(ctx, disabled)
function drawBreakpoint(ctx, disabled, conditional)
{
ctx.beginPath();
ctx.moveTo(0, 2);
......@@ -536,8 +642,8 @@ WebInspector.SourceFrame.prototype = {
ctx.lineTo(2, 11);
ctx.lineTo(0, 9);
ctx.closePath();
ctx.fillStyle = "rgb(1, 142, 217)";
ctx.strokeStyle = "rgb(0, 103, 205)";
ctx.fillStyle = conditional ? "rgb(217, 142, 1)" : "rgb(1, 142, 217)";
ctx.strokeStyle = conditional ? "rgb(205, 103, 0)" : "rgb(0, 103, 205)";
ctx.lineWidth = 3;
ctx.fill();
ctx.save();
......@@ -555,6 +661,9 @@ WebInspector.SourceFrame.prototype = {
ctx.restore();
}
// Unconditional breakpoints.
var ctx = this.element.contentDocument.getCSSCanvasContext("2d", "breakpoint", 26, 11);
ctx.clearRect(0, 0, 26, 11);
drawBreakpoint(ctx);
......@@ -575,6 +684,29 @@ WebInspector.SourceFrame.prototype = {
ctx.clearRect(20, 0, 6, 11);
this._drawProgramCounterInContext(ctx, true);
// Conditional breakpoints.
var ctx = this.element.contentDocument.getCSSCanvasContext("2d", "breakpoint-conditional", 26, 11);
ctx.clearRect(0, 0, 26, 11);
drawBreakpoint(ctx, false, true);
var ctx = this.element.contentDocument.getCSSCanvasContext("2d", "breakpoint-conditional-program-counter", 26, 11);
ctx.clearRect(0, 0, 26, 11);
drawBreakpoint(ctx, false, true);
ctx.clearRect(20, 0, 6, 11);
this._drawProgramCounterInContext(ctx, true);
var ctx = this.element.contentDocument.getCSSCanvasContext("2d", "breakpoint-disabled-conditional", 26, 11);
ctx.clearRect(0, 0, 26, 11);
drawBreakpoint(ctx, true, true);
var ctx = this.element.contentDocument.getCSSCanvasContext("2d", "breakpoint-disabled-conditional-program-counter", 26, 11);
ctx.clearRect(0, 0, 26, 11);
drawBreakpoint(ctx, true, true);
ctx.clearRect(20, 0, 6, 11);
this._drawProgramCounterInContext(ctx, true);
delete this._needsBreakpointImages;
},
......@@ -771,3 +903,4 @@ WebInspector.SourceFrame.prototype = {
}
WebInspector.SourceFrame.prototype.__proto__ = WebInspector.Object.prototype;
......@@ -34,6 +34,7 @@
<file>Panel.js</file>
<file>PanelEnablerView.js</file>
<file>Placard.js</file>
<file>Popup.js</file>
<file>ProfileDataGridTree.js</file>
<file>ProfilesPanel.js</file>
<file>ProfileView.js</file>
......
......@@ -6,13 +6,13 @@ modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
notice, this list of conditions and the following disclaimer.
2. 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.
documentation and/or other materials provided with the distribution.
3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
......@@ -36,6 +36,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<script type="text/javascript" src="Object.js"></script>
<script type="text/javascript" src="KeyboardShortcut.js"></script>
<script type="text/javascript" src="TextPrompt.js"></script>
<script type="text/javascript" src="Popup.js"></script>
<script type="text/javascript" src="Placard.js"></script>
<script type="text/javascript" src="View.js"></script>
<script type="text/javascript" src="Callback.js"></script>
......
......@@ -8,13 +8,13 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
......@@ -73,7 +73,7 @@ var WebInspector = {
// there isn't already a caret selection inside.
var selection = window.getSelection();
if (selection.isCollapsed && !this._currentFocusElement.isInsertionCaretInside()) {
var selectionRange = document.createRange();
var selectionRange = this._currentFocusElement.ownerDocument.createRange();
selectionRange.setStart(this._currentFocusElement, 0);
selectionRange.setEnd(this._currentFocusElement, 0);
......@@ -122,13 +122,13 @@ var WebInspector = {
}
}
}
for (var panelName in WebInspector.panels) {
if (WebInspector.panels[panelName] == x)
InspectorController.storeLastActivePanel(panelName);
}
},
_createPanels: function()
{