Commit 8dbc7b8e authored by joepeck@webkit.org's avatar joepeck@webkit.org

Web Inspector: Breakpoint Actions

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

Reviewed by Timothy Hatcher.

* UserInterface/Breakpoint.js:
(WebInspector.Breakpoint):
(WebInspector.Breakpoint.prototype.get actions):
(WebInspector.Breakpoint.prototype.get options):
(WebInspector.Breakpoint.prototype.get info):
(WebInspector.Breakpoint.prototype._serializableActions):
Saving, restoring, and serialization.

(WebInspector.Breakpoint.prototype.createAction):
(WebInspector.Breakpoint.prototype.recreateAction):
(WebInspector.Breakpoint.prototype.removeAction):
(WebInspector.Breakpoint.prototype.breakpointActionDidChange):
Modifying _actions ivar.

(WebInspector.Breakpoint.prototype._editBreakpointPopoverContentElement):
(WebInspector.Breakpoint.prototype._popoverActionsCreateAddActionButton):
(WebInspector.Breakpoint.prototype._popoverActionsAddActionButtonClicked):
(WebInspector.Breakpoint.prototype._popoverActionsInsertBreakpointActionView):
(WebInspector.Breakpoint.prototype.breakpointActionViewAppendActionView):
(WebInspector.Breakpoint.prototype.breakpointActionViewRemoveActionView):
(WebInspector.Breakpoint.prototype.breakpointActionViewResized):
Popover UI containing breakpoint action views and converting to and from
having no actions.

(WebInspector.Breakpoint.prototype.willDismissPopover):
Cleanup some ivars when the popover dismisses.

* UserInterface/Breakpoint.css:
(.popover .edit-breakpoint-popover-content.wide):
Wider setting when there are actions in the popover.

(.popover .edit-breakpoint-popover-content > table > tr > th):
Keep the title labels at the top of their section.

* UserInterface/BreakpointAction.js:
(WebInspector.BreakpointAction):
(WebInspector.BreakpointAction.prototype.get breakpoint):
(WebInspector.BreakpointAction.prototype.get type):
(WebInspector.BreakpointAction.prototype.get data):
(WebInspector.BreakpointAction.prototype.set data):
(WebInspector.BreakpointAction.prototype.get info):
Very basic BreakpointAction class. Notifies Breakpoint on data changes.
Type changes are not allowed, instead just create a new BreakpointAction.

* UserInterface/BreakpointActionView.css: Added.
(.breakpoint-action-block-header):
(.breakpoint-action-remove-button):
(.breakpoint-action-remove-button:active):
(.breakpoint-action-append-button):
(.breakpoint-action-block-body):
(.breakpoint-action-block-body > input):
(.breakpoint-action-eval-editor):
(.breakpoint-action-eval-editor > .CodeMirror):
(.breakpoint-action-eval-editor > .CodeMirror-scroll):
* UserInterface/BreakpointActionView.js: Added.
(WebInspector.BreakpointActionView):
(WebInspector.BreakpointActionView.displayStringForType):
(WebInspector.BreakpointActionView.prototype.get action):
(WebInspector.BreakpointActionView.prototype.get element):
(WebInspector.BreakpointActionView.prototype._pickerChanged):
(WebInspector.BreakpointActionView.prototype._appendActionButtonClicked):
(WebInspector.BreakpointActionView.prototype._removeActionButtonClicked):
(WebInspector.BreakpointActionView.prototype._updateBody.switch.break):
(WebInspector.BreakpointActionView.prototype._logInputChanged):
(WebInspector.BreakpointActionView.prototype._codeMirrorBlurred):
(WebInspector.BreakpointActionView.prototype._codeMirrorViewportChanged):
UI and form controls for individual breakpoint actions. The view
wraps a single BreakpointAction, and for any actions that could affect
other views the delegate is notified.

* UserInterface/DebuggerManager.js:
(WebInspector.DebuggerManager):
(WebInspector.DebuggerManager.prototype._debuggerBreakpointActionType):
When sending to the backend, make sure to send protocol enums.

* UserInterface/Popover.js:
(WebInspector.Popover.prototype.update):
Update the popover when content changes.

* UserInterface/Images/BreakpointActionAdd.svg: Added.
* UserInterface/Images/BreakpointActionRemove.svg: Added.
* UserInterface/InspectorBackendCommands.js:
* UserInterface/Main.html:
* Localizations/en.lproj/localizedStrings.js:
Misc. New strings, images, includes.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155133 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3178be9c
2013-09-05 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: Breakpoint Actions
https://bugs.webkit.org/show_bug.cgi?id=120576
Reviewed by Timothy Hatcher.
* UserInterface/Breakpoint.js:
(WebInspector.Breakpoint):
(WebInspector.Breakpoint.prototype.get actions):
(WebInspector.Breakpoint.prototype.get options):
(WebInspector.Breakpoint.prototype.get info):
(WebInspector.Breakpoint.prototype._serializableActions):
Saving, restoring, and serialization.
(WebInspector.Breakpoint.prototype.createAction):
(WebInspector.Breakpoint.prototype.recreateAction):
(WebInspector.Breakpoint.prototype.removeAction):
(WebInspector.Breakpoint.prototype.breakpointActionDidChange):
Modifying _actions ivar.
(WebInspector.Breakpoint.prototype._editBreakpointPopoverContentElement):
(WebInspector.Breakpoint.prototype._popoverActionsCreateAddActionButton):
(WebInspector.Breakpoint.prototype._popoverActionsAddActionButtonClicked):
(WebInspector.Breakpoint.prototype._popoverActionsInsertBreakpointActionView):
(WebInspector.Breakpoint.prototype.breakpointActionViewAppendActionView):
(WebInspector.Breakpoint.prototype.breakpointActionViewRemoveActionView):
(WebInspector.Breakpoint.prototype.breakpointActionViewResized):
Popover UI containing breakpoint action views and converting to and from
having no actions.
(WebInspector.Breakpoint.prototype.willDismissPopover):
Cleanup some ivars when the popover dismisses.
* UserInterface/Breakpoint.css:
(.popover .edit-breakpoint-popover-content.wide):
Wider setting when there are actions in the popover.
(.popover .edit-breakpoint-popover-content > table > tr > th):
Keep the title labels at the top of their section.
* UserInterface/BreakpointAction.js:
(WebInspector.BreakpointAction):
(WebInspector.BreakpointAction.prototype.get breakpoint):
(WebInspector.BreakpointAction.prototype.get type):
(WebInspector.BreakpointAction.prototype.get data):
(WebInspector.BreakpointAction.prototype.set data):
(WebInspector.BreakpointAction.prototype.get info):
Very basic BreakpointAction class. Notifies Breakpoint on data changes.
Type changes are not allowed, instead just create a new BreakpointAction.
* UserInterface/BreakpointActionView.css: Added.
(.breakpoint-action-block-header):
(.breakpoint-action-remove-button):
(.breakpoint-action-remove-button:active):
(.breakpoint-action-append-button):
(.breakpoint-action-block-body):
(.breakpoint-action-block-body > input):
(.breakpoint-action-eval-editor):
(.breakpoint-action-eval-editor > .CodeMirror):
(.breakpoint-action-eval-editor > .CodeMirror-scroll):
* UserInterface/BreakpointActionView.js: Added.
(WebInspector.BreakpointActionView):
(WebInspector.BreakpointActionView.displayStringForType):
(WebInspector.BreakpointActionView.prototype.get action):
(WebInspector.BreakpointActionView.prototype.get element):
(WebInspector.BreakpointActionView.prototype._pickerChanged):
(WebInspector.BreakpointActionView.prototype._appendActionButtonClicked):
(WebInspector.BreakpointActionView.prototype._removeActionButtonClicked):
(WebInspector.BreakpointActionView.prototype._updateBody.switch.break):
(WebInspector.BreakpointActionView.prototype._logInputChanged):
(WebInspector.BreakpointActionView.prototype._codeMirrorBlurred):
(WebInspector.BreakpointActionView.prototype._codeMirrorViewportChanged):
UI and form controls for individual breakpoint actions. The view
wraps a single BreakpointAction, and for any actions that could affect
other views the delegate is notified.
* UserInterface/DebuggerManager.js:
(WebInspector.DebuggerManager):
(WebInspector.DebuggerManager.prototype._debuggerBreakpointActionType):
When sending to the backend, make sure to send protocol enums.
* UserInterface/Popover.js:
(WebInspector.Popover.prototype.update):
Update the popover when content changes.
* UserInterface/Images/BreakpointActionAdd.svg: Added.
* UserInterface/Images/BreakpointActionRemove.svg: Added.
* UserInterface/InspectorBackendCommands.js:
* UserInterface/Main.html:
* Localizations/en.lproj/localizedStrings.js:
Misc. New strings, images, includes.
2013-09-03 Antoine Quint <graouts@apple.com>
Web Inspector: exceptions triggered from console evaluation do not pause the debugger
......
......@@ -31,6 +31,10 @@
font-size: 11px;
}
.popover .edit-breakpoint-popover-content.wide {
width: 460px;
}
.popover .edit-breakpoint-popover-content > label.toggle {
color: black;
font-weight: bold;
......@@ -47,6 +51,8 @@
font-weight: bold;
text-align: right;
width: 1px; /* Shrink to fit. */
vertical-align: top;
line-height: 23px;
}
.popover .edit-breakpoint-popover-content > table > tr > td {
......
......@@ -38,6 +38,9 @@ WebInspector.Breakpoint = function(sourceCodeLocationOrInfo, disabled, condition
var columnNumber = sourceCodeLocationOrInfo.columnNumber || 0;
var location = new WebInspector.SourceCodeLocation(null, lineNumber, columnNumber);
var autoContinue = sourceCodeLocationOrInfo.autoContinue || false;
var actions = sourceCodeLocationOrInfo.actions || [];
for (var i = 0; i < actions.length; ++i)
actions[i] = new WebInspector.BreakpointAction(this, actions[i]);
disabled = sourceCodeLocationOrInfo.disabled;
condition = sourceCodeLocationOrInfo.condition;
} else
......@@ -49,6 +52,7 @@ WebInspector.Breakpoint = function(sourceCodeLocationOrInfo, disabled, condition
this._disabled = disabled || false;
this._condition = condition || "";
this._autoContinue = autoContinue || false;
this._actions = actions || [];
this._resolved = false;
this._sourceCodeLocation = location;
......@@ -59,13 +63,17 @@ WebInspector.Breakpoint = function(sourceCodeLocationOrInfo, disabled, condition
WebInspector.Object.addConstructorFunctions(WebInspector.Breakpoint);
WebInspector.Breakpoint.PopoverClassName = "edit-breakpoint-popover-content";
WebInspector.Breakpoint.WidePopoverClassName = "wide";
WebInspector.Breakpoint.PopoverConditionInputId = "edit-breakpoint-popover-condition";
WebInspector.Breakpoint.PopoverOptionsAutoContinueInputId = "edit-breakpoint-popoover-auto-continue";
WebInspector.Breakpoint.DefaultBreakpointActionType = WebInspector.BreakpointAction.Type.Log;
WebInspector.Breakpoint.Event = {
DisabledStateDidChange: "breakpoint-disabled-state-did-change",
ResolvedStateDidChange: "breakpoint-resolved-state-did-change",
ConditionDidChange: "breakpoint-condition-did-change",
ActionsDidChange: "breakpoint-actions-did-change",
AutoContinueDidChange: "breakpoint-auto-continue-did-change",
LocationDidChange: "breakpoint-location-did-change",
DisplayLocationDidChange: "breakpoint-display-location-did-change",
......@@ -161,11 +169,16 @@ WebInspector.Breakpoint.prototype = {
this.dispatchEventToListeners(WebInspector.Breakpoint.Event.AutoContinueDidChange);
},
get actions()
{
return this._actions;
},
get options()
{
return {
condition: this._condition,
actions: [], // FIXME: Implement Breakpoint Actions.
actions: this._serializableActions(),
autoContinue: this._autoContinue
};
},
......@@ -179,6 +192,7 @@ WebInspector.Breakpoint.prototype = {
columnNumber: this._sourceCodeLocation.columnNumber,
disabled: this._disabled,
condition: this._condition,
actions: this._serializableActions(),
autoContinue: this._autoContinue
};
},
......@@ -224,8 +238,76 @@ WebInspector.Breakpoint.prototype = {
}
},
createAction: function(type, precedingAction)
{
var newAction = new WebInspector.BreakpointAction(this, type, null);
if (!precedingAction)
this._actions.push(newAction);
else {
var index = this._actions.indexOf(precedingAction);
console.assert(index !== -1);
if (index === -1)
this._actions.push(newAction);
else
this._actions.splice(index + 1, 0, newAction);
}
this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
return newAction;
},
recreateAction: function(type, actionToReplace)
{
var newAction = new WebInspector.BreakpointAction(this, type, null);
var index = this._actions.indexOf(actionToReplace);
console.assert(index !== -1);
if (index === -1)
return null;
this._actions[index] = newAction;
this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
return newAction;
},
removeAction: function(action)
{
var index = this._actions.indexOf(action);
console.assert(index !== -1);
if (index === -1)
return;
this._actions.splice(index, 1);
this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
},
// Protected (Called by BreakpointAction)
breakpointActionDidChange: function(action)
{
var index = this._actions.indexOf(action);
console.assert(index !== -1);
if (index === -1)
return;
this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);
},
// Private
_serializableActions: function()
{
var actions = [];
for (var i = 0; i < this._actions.length; ++i)
actions.push(this._actions[i].info);
return actions;
},
_popoverToggleEnabledCheckboxChanged: function(event)
{
this.disabled = !event.target.checked;
......@@ -252,7 +334,7 @@ WebInspector.Breakpoint.prototype = {
_editBreakpointPopoverContentElement: function()
{
var content = document.createElement("div");
var content = this._popoverContentElement = document.createElement("div");
content.className = WebInspector.Breakpoint.PopoverClassName;
var checkboxElement = document.createElement("input");
......@@ -282,6 +364,22 @@ WebInspector.Breakpoint.prototype = {
conditionLabel.textContent = WebInspector.UIString("Condition");
if (DebuggerAgent.setBreakpoint.supports("options")) {
var actionRow = table.appendChild(document.createElement("tr"));
var actionHeader = actionRow.appendChild(document.createElement("th"));
var actionData = this._actionsContainer = actionRow.appendChild(document.createElement("td"));
var actionLabel = actionHeader.appendChild(document.createElement("label"));
actionLabel.textContent = WebInspector.UIString("Action");
if (!this._actions.length)
this._popoverActionsCreateAddActionButton();
else {
this._popoverContentElement.classList.add(WebInspector.Breakpoint.WidePopoverClassName);
for (var i = 0; i < this._actions.length; ++i) {
var breakpointActionView = new WebInspector.BreakpointActionView(this._actions[i], this, true);
this._popoverActionsInsertBreakpointActionView(breakpointActionView, i);
}
}
var optionsRow = table.appendChild(document.createElement("tr"));
var optionsHeader = optionsRow.appendChild(document.createElement("th"));
var optionsData = optionsRow.appendChild(document.createElement("td"));
......@@ -303,6 +401,79 @@ WebInspector.Breakpoint.prototype = {
return content;
},
_popoverActionsCreateAddActionButton: function()
{
this._popoverContentElement.classList.remove(WebInspector.Breakpoint.WidePopoverClassName);
this._actionsContainer.removeChildren();
var addActionButton = this._actionsContainer.appendChild(document.createElement("button"));
addActionButton.textContent = WebInspector.UIString("Add Action");
addActionButton.addEventListener("click", this._popoverActionsAddActionButtonClicked.bind(this));
},
_popoverActionsAddActionButtonClicked: function(event)
{
this._popoverContentElement.classList.add(WebInspector.Breakpoint.WidePopoverClassName);
this._actionsContainer.removeChildren();
var newAction = this.createAction(WebInspector.Breakpoint.DefaultBreakpointActionType);
var newBreakpointActionView = new WebInspector.BreakpointActionView(newAction, this);
this._popoverActionsInsertBreakpointActionView(newBreakpointActionView, -1);
this._popover.update();
},
_popoverActionsInsertBreakpointActionView: function(breakpointActionView, index)
{
if (index === -1)
this._actionsContainer.appendChild(breakpointActionView.element)
else {
var nextElement = this._actionsContainer.children[index + 1] || null;
this._actionsContainer.insertBefore(breakpointActionView.element, nextElement);
}
},
breakpointActionViewAppendActionView: function(breakpointActionView, newAction)
{
var newBreakpointActionView = new WebInspector.BreakpointActionView(newAction, this);
var index = 0;
var children = this._actionsContainer.children;
for (var i = 0; children.length; ++i) {
if (children[i] === breakpointActionView.element) {
index = i;
break;
}
}
this._popoverActionsInsertBreakpointActionView(newBreakpointActionView, index);
this._popover.update();
},
breakpointActionViewRemoveActionView: function(breakpointActionView)
{
breakpointActionView.element.remove();
if (!this._actionsContainer.children.length)
this._popoverActionsCreateAddActionButton();
this._popover.update();
},
breakpointActionViewResized: function(breakpointActionView)
{
this._popover.update();
},
willDismissPopover: function(popover)
{
console.assert(this._popover === popover);
delete this._popoverContentElement;
delete this._actionsContainer;
delete this._popover;
},
_showEditBreakpointPopover: function(element)
{
const padding = 2;
......@@ -310,8 +481,8 @@ WebInspector.Breakpoint.prototype = {
bounds.origin.x -= 1; // Move the anchor left one pixel so it looks more centered.
bounds.origin.x -= padding;
bounds.origin.y -= padding;
bounds.size.width += padding * 2;
bounds.size.height += padding * 2;
bounds.size.width += padding * 2;
bounds.size.height += padding * 2;
this._popover = this._popover || new WebInspector.Popover(this);
this._popover.content = this._editBreakpointPopoverContentElement();
......
/*
* Copyright (C) 2013 Apple 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:
* 1. Redistributions of source code must retain the above copyright
* 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.BreakpointAction = function(breakpoint, typeOrInfo, data)
{
WebInspector.Object.call(this);
console.assert(breakpoint);
console.assert(typeOrInfo);
this._breakpoint = breakpoint;
if (typeof typeOrInfo === "string") {
this._type = typeOrInfo;
this._data = data || null;
} else if (typeof typeOrInfo === "object") {
this._type = typeOrInfo.type;
this._data = typeOrInfo.data || null;
} else
console.error("Unexpected type passed to WebInspector.BreakpointAction");
console.assert(typeof this._type === "string");
};
WebInspector.BreakpointAction.Type = {
Log: "log",
Evaluate: "evaluate",
Sound: "sound"
}
WebInspector.BreakpointAction.prototype = {
constructor: WebInspector.BreakpointAction,
// Public
get breakpoint()
{
return this._breakpoint;
},
get type()
{
return this._type;
},
get data()
{
return this._data;
},
set data(data)
{
if (this._data === data)
return;
this._data = data;
this._breakpoint.breakpointActionDidChange(this);
},
get info()
{
var obj = {type: this._type};
if (this._data)
obj.data = this._data;
return obj;
}
};
WebInspector.BreakpointAction.prototype.__proto__ = WebInspector.Object.prototype;
/*
* Copyright (C) 2013 Apple 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:
* 1. Redistributions of source code must retain the above copyright
* 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
*/
.breakpoint-action-block-header {
margin-bottom: 3px;
}
.breakpoint-action-append-button,
.breakpoint-action-remove-button {
border: 1px solid rgb(170, 170, 170);
border-radius: 10px;
background-size: 16px 16px;
background-origin: border-box;
width: 16px;
height: 16px;
float: right;
margin-left: 2px;
margin-top: 2px;
}
.breakpoint-action-append-button:active,
.breakpoint-action-remove-button:active {
-webkit-filter: brightness(50%);
}
.breakpoint-action-append-button {
background-image: url(Images/BreakpointActionAdd.svg), -webkit-linear-gradient(top, rgb(250, 250, 250), rgb(200, 200, 200));
}
.breakpoint-action-remove-button {
background-image: url(Images/BreakpointActionRemove.svg), -webkit-linear-gradient(top, rgb(250, 250, 250), rgb(200, 200, 200));
}
.breakpoint-action-block-body {
margin: 1px 2px 6px 2px;
padding: 8px;
width: 100%;
border-radius: 4px;
border: 1px solid rgb(190, 190, 190);
background-color: rgba(222, 222, 222, 0.95);
-webkit-box-shadow: inset 0 0 2px rgb(200, 200, 200);
}
.breakpoint-action-block-body > input {
width: 100%;
}
.breakpoint-action-eval-editor {
padding: 4px 0 2px 0;
-webkit-appearance: textfield;
border: 1px solid rgb(200, 200, 200);
background: white;
}
.breakpoint-action-eval-editor > .CodeMirror {
width: 100%;
height: auto;
}
.breakpoint-action-eval-editor > .CodeMirror-scroll {
width: 100%;
overflow: hidden;
}
/*
* Copyright (C) 2013 Apple 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:
* 1. Redistributions of source code must retain the above copyright
* 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.BreakpointActionView = function(action, delegate, omitFocus)
{
WebInspector.Object.call(this);
console.assert(action);
console.assert(delegate);
console.assert(DebuggerAgent.BreakpointActionType);
this._action = action;
this._delegate = delegate;
this._element = document.createElement("div");
this._element.className = "breakpoint-action-block";
var header = this._element.appendChild(document.createElement("div"));
header.className = "breakpoint-action-block-header";
var picker = header.appendChild(document.createElement("select"));
picker.addEventListener("change", this._pickerChanged.bind(this));
for (var key in WebInspector.BreakpointAction.Type) {
var type = WebInspector.BreakpointAction.Type[key];
var option = document.createElement("option");
option.textContent = WebInspector.BreakpointActionView.displayStringForType(type);
option.selected = this._action.type === type;
option.value = type;
picker.add(option);
}
var appendActionButton = header.appendChild(document.createElement("button"));
appendActionButton.className = "breakpoint-action-append-button";