<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[193321] branches/safari-601-branch/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/193321">193321</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2015-12-03 11:10:26 -0800 (Thu, 03 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/192551">r192551</a>. rdar://problem/23221163</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601branchSourceWebInspectorUIChangeLog">branches/safari-601-branch/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceControllersBreakpointPopoverControllerjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceViewsBreakpointPopoverControllercss">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/BreakpointPopoverController.css</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationTextEditorcss">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.css</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceViewsCodeMirrorOverridescss">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CodeMirrorOverrides.css</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601branchSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/ChangeLog (193320 => 193321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/ChangeLog        2015-12-03 19:10:20 UTC (rev 193320)
+++ branches/safari-601-branch/Source/WebInspectorUI/ChangeLog        2015-12-03 19:10:26 UTC (rev 193321)
</span><span class="lines">@@ -1,5 +1,50 @@
</span><span class="cx"> 2015-12-03 Timothy Hatcher <timothy@apple.com>
</span><span class="cx">
</span><ins>+ Merge r192551. rdar://problem/23221163
+
+ 2015-11-17 Matt Baker <mattbaker@apple.com>
+
+ Web Inspector: Breakpoint condition field should use CodeMirror
+ https://bugs.webkit.org/show_bug.cgi?id=151333
+
+ Reviewed by Joseph Pecoraro.
+
+ Updated breakpoint popover's condition field to use CodeMirror.
+
+ * UserInterface/Controllers/BreakpointPopoverController.js:
+ Removed keyboard shortcuts. Now handled by CodeMirror.
+ (WebInspector.BreakpointPopoverController.prototype.completionControllerShouldAllowEscapeCompletion):
+ Prevent handling of escape to allow tabbing to next element.
+ (WebInspector.BreakpointPopoverController.prototype._createPopoverContent):
+ Create CodeMirror instance.
+ (WebInspector.BreakpointPopoverController.prototype._conditionCodeMirrorChanged):
+ (WebInspector.BreakpointPopoverController.prototype._conditionCodeMirrorBeforeChange):
+ Enforce single-line editor.
+ (WebInspector.BreakpointPopoverController.prototype._conditionCodeMirrorEscapeOrEnterKey):
+ (WebInspector.BreakpointPopoverController): Deleted.
+ (WebInspector.BreakpointPopoverController.prototype.appendContextMenuItems.editBreakpoint):
+ Removed condition element select. CodeMirror sets focus when popover content is created.
+ (WebInspector.BreakpointPopoverController.prototype._popoverConditionInputChanged): Deleted.
+ Replaced by BreakpointPopoverController.prototype._conditionCodeMirrorChanged.
+ (WebInspector.BreakpointPopoverController.prototype._popoverConditionInputKeyDown): Deleted.
+ Replaced by BreakpointPopoverController.prototype._conditionCodeMirrorEscapeOrEnterKey.
+
+ * UserInterface/Views/BreakpointPopoverController.css:
+ (.edit-breakpoint-popover-condition):
+ (.edit-breakpoint-popover-condition > .CodeMirror):
+ (#edit-breakpoint-popover-condition): Deleted.
+ Replace selector id with class, styled CodeMirror element to match original input element.
+
+ * UserInterface/Views/CSSStyleDeclarationTextEditor.css:
+ (.css-style-text-editor > .CodeMirror .CodeMirror-placeholder): Deleted.
+ Moved common CodeMirror placeholder text style to CodeMirrorOverrides.css.
+
+ * UserInterface/Views/CodeMirrorOverrides.css:
+ (.CodeMirror .CodeMirror-placeholder):
+ Add placeholder style.
+
+2015-12-03 Timothy Hatcher <timothy@apple.com>
+
</ins><span class="cx"> Merge r192408. rdar://problem/23221163
</span><span class="cx">
</span><span class="cx"> 2015-11-12 Matt Baker <mattbaker@apple.com>
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceControllersBreakpointPopoverControllerjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js (193320 => 193321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js        2015-12-03 19:10:20 UTC (rev 193320)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js        2015-12-03 19:10:26 UTC (rev 193321)
</span><span class="lines">@@ -32,8 +32,6 @@
</span><span class="cx"> this._breakpoint = null;
</span><span class="cx"> this._popover = null;
</span><span class="cx"> this._popoverContentElement = null;
</span><del>- this._keyboardShortcutEsc = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape);
- this._keyboardShortcutEnter = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Enter);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="lines">@@ -55,8 +53,6 @@
</span><span class="cx"> var bounds = WebInspector.Rect.rectFromClientRect(breakpointDisplayElement.getBoundingClientRect());
</span><span class="cx"> bounds.origin.x -= 1; // Move the anchor left one pixel so it looks more centered.
</span><span class="cx"> this._popover.present(bounds.pad(2), [WebInspector.RectEdge.MAX_Y]);
</span><del>-
- document.getElementById(WebInspector.BreakpointPopoverController.PopoverConditionInputId).select();
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function removeBreakpoint()
</span><span class="lines">@@ -104,6 +100,13 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // CodeMirrorCompletionController delegate
+
+ completionControllerShouldAllowEscapeCompletion()
+ {
+ return false;
+ }
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _createPopoverContent(breakpoint)
</span><span class="lines">@@ -132,16 +135,42 @@
</span><span class="cx"> var conditionHeader = conditionRow.appendChild(document.createElement("th"));
</span><span class="cx"> var conditionData = conditionRow.appendChild(document.createElement("td"));
</span><span class="cx"> var conditionLabel = conditionHeader.appendChild(document.createElement("label"));
</span><del>- var conditionInput = conditionData.appendChild(document.createElement("input"));
- conditionInput.id = WebInspector.BreakpointPopoverController.PopoverConditionInputId;
- conditionInput.value = this._breakpoint.condition || "";
- conditionInput.spellcheck = false;
- conditionInput.addEventListener("change", this._popoverConditionInputChanged.bind(this));
- conditionInput.addEventListener("keydown", this._popoverConditionInputKeyDown.bind(this));
- conditionInput.placeholder = WebInspector.UIString("Conditional expression");
- conditionLabel.setAttribute("for", conditionInput.id);
</del><span class="cx"> conditionLabel.textContent = WebInspector.UIString("Condition");
</span><ins>+ var conditionEditorElement = conditionData.appendChild(document.createElement("div"));
+ conditionEditorElement.classList.add("edit-breakpoint-popover-condition", WebInspector.SyntaxHighlightedStyleClassName);
</ins><span class="cx">
</span><ins>+ this._conditionCodeMirror = CodeMirror(conditionEditorElement, {
+ extraKeys: {Tab: false},
+ lineWrapping: false,
+ mode: "text/javascript",
+ matchBrackets: true,
+ placeholder: WebInspector.UIString("Conditional expression"),
+ scrollbarStyle: null,
+ value: this._breakpoint.condition || "",
+ });
+
+ var conditionCodeMirrorInputField = this._conditionCodeMirror.getInputField();
+ conditionCodeMirrorInputField.id = "codemirror-condition-input-field";
+ conditionLabel.setAttribute("for", conditionCodeMirrorInputField.id);
+
+ this._conditionCodeMirrorEscapeOrEnterKeyHandler = this._conditionCodeMirrorEscapeOrEnterKey.bind(this);
+ this._conditionCodeMirror.addKeyMap({
+ "Esc": this._conditionCodeMirrorEscapeOrEnterKeyHandler,
+ "Enter": this._conditionCodeMirrorEscapeOrEnterKeyHandler,
+ });
+
+ this._conditionCodeMirror.on("change", this._conditionCodeMirrorChanged.bind(this));
+ this._conditionCodeMirror.on("beforeChange", this._conditionCodeMirrorBeforeChange.bind(this));
+
+ var completionController = new WebInspector.CodeMirrorCompletionController(this._conditionCodeMirror, this);
+ completionController.addExtendedCompletionProvider("javascript", WebInspector.javaScriptRuntimeCompletionProvider);
+
+ // CodeMirror needs a refresh after the popover displays, to layout, otherwise it doesn't appear.
+ setTimeout(function() {
+ this._conditionCodeMirror.refresh();
+ this._conditionCodeMirror.focus();
+ }.bind(this), 0);
+
</ins><span class="cx"> // COMPATIBILITY (iOS 7): Debugger.setBreakpoint did not support options.
</span><span class="cx"> if (DebuggerAgent.setBreakpoint.supports("options")) {
</span><span class="cx"> // COMPATIBILITY (iOS 9): Legacy backends don't support breakpoint ignore count. Since support
</span><span class="lines">@@ -207,11 +236,23 @@
</span><span class="cx"> this._breakpoint.disabled = !event.target.checked;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- _popoverConditionInputChanged(event)
</del><ins>+ _conditionCodeMirrorChanged(codeMirror, change)
</ins><span class="cx"> {
</span><del>- this._breakpoint.condition = event.target.value;
</del><ins>+ this._breakpoint.condition = (codeMirror.getValue() || "").trim();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ _conditionCodeMirrorBeforeChange(codeMirror, change)
+ {
+ var newText = change.text.join("").replace(/\n/g, "");
+ change.update(change.from, change.to, [newText]);
+ return true;
+ }
+
+ _conditionCodeMirrorEscapeOrEnterKey()
+ {
+ this._popover.dismiss();
+ }
+
</ins><span class="cx"> _popoverIgnoreInputChanged(event)
</span><span class="cx"> {
</span><span class="cx"> var ignoreCount = 0;
</span><span class="lines">@@ -230,15 +271,6 @@
</span><span class="cx"> this._breakpoint.autoContinue = event.target.checked;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- _popoverConditionInputKeyDown(event)
- {
- if (this._keyboardShortcutEsc.matchesEvent(event) || this._keyboardShortcutEnter.matchesEvent(event)) {
- this._popover.dismiss();
- event.stopPropagation();
- event.preventDefault();
- }
- }
-
</del><span class="cx"> _popoverActionsCreateAddActionButton()
</span><span class="cx"> {
</span><span class="cx"> this._popoverContentElement.classList.remove(WebInspector.BreakpointPopoverController.WidePopoverClassName);
</span><span class="lines">@@ -335,5 +367,4 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.BreakpointPopoverController.WidePopoverClassName = "wide";
</span><del>-WebInspector.BreakpointPopoverController.PopoverConditionInputId = "edit-breakpoint-popover-condition";
</del><span class="cx"> WebInspector.BreakpointPopoverController.HiddenStyleClassName = "hidden";
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceViewsBreakpointPopoverControllercss"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/BreakpointPopoverController.css (193320 => 193321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/BreakpointPopoverController.css        2015-12-03 19:10:20 UTC (rev 193320)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/BreakpointPopoverController.css        2015-12-03 19:10:26 UTC (rev 193321)
</span><span class="lines">@@ -56,10 +56,19 @@
</span><span class="cx"> padding-left: 5px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#edit-breakpoint-popover-condition {
</del><ins>+.edit-breakpoint-popover-condition {
</ins><span class="cx"> width: 100%;
</span><ins>+ padding: 4px 0 2px 0;
+ -webkit-appearance: textfield;
+ border: 1px solid hsl(0, 0%, 78%);
+ background: white;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+.edit-breakpoint-popover-condition > .CodeMirror {
+ width: 320px; /* NOTE: Fixed value, manually tuned to .edit-breakpoint-popover-content width. */
+ height: auto;
+}
+
</ins><span class="cx"> #edit-breakpoint-popover-ignore {
</span><span class="cx"> width: 40px;
</span><span class="cx"> margin-right: 4px;
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationTextEditorcss"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.css (193320 => 193321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.css        2015-12-03 19:10:20 UTC (rev 193320)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.css        2015-12-03 19:10:26 UTC (rev 193321)
</span><span class="lines">@@ -37,10 +37,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .css-style-text-editor > .CodeMirror .CodeMirror-placeholder {
</span><del>- font-family: -apple-system, sans-serif;
- color: hsl(0, 0%, 65%);
</del><span class="cx"> padding: 0 5px 0 25px;
</span><del>- text-indent: 0;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .css-style-text-editor > .CodeMirror pre {
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceViewsCodeMirrorOverridescss"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CodeMirrorOverrides.css (193320 => 193321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CodeMirrorOverrides.css        2015-12-03 19:10:20 UTC (rev 193320)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CodeMirrorOverrides.css        2015-12-03 19:10:26 UTC (rev 193321)
</span><span class="lines">@@ -83,3 +83,9 @@
</span><span class="cx"> .CodeMirror-linewidget {
</span><span class="cx"> -webkit-user-select: text;
</span><span class="cx"> }
</span><ins>+
+.CodeMirror .CodeMirror-placeholder {
+ font-family: -apple-system, sans-serif;
+ color: hsl(0, 0%, 65%);
+ text-indent: 0;
+}
</ins></span></pre>
</div>
</div>
</body>
</html>