<!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>[197371] trunk/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/197371">197371</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-02-29 15:06:58 -0800 (Mon, 29 Feb 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Add direct number inputs to Bezier editor
https://bugs.webkit.org/show_bug.cgi?id=154809
<rdar://problem/24881465>
Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2016-02-29
Reviewed by Timothy Hatcher.
* UserInterface/Base/Main.js:
(WebInspector._updateWindowKeydownListener):
Now only adds the shared event listener when the first keydown listener
is added via WebInspector.addWindowKeydownListener
* UserInterface/Controllers/CodeMirrorBezierEditingController.js:
(WebInspector.CodeMirrorBezierEditingController.prototype.popoverDidDismiss):
* UserInterface/Controllers/CodeMirrorEditingController.js:
(WebInspector.CodeMirrorEditingController.prototype.popoverDidDismiss):
(WebInspector.CodeMirrorEditingController.prototype.didDismissPopover):
Added function that is called when the popover is dismissed so that
removing event listeners is possible.
* UserInterface/Views/BezierEditor.css:
(.bezier-editor):
(.bezier-editor > .number-input-container):
(.bezier-editor > .number-input-container > input):
* UserInterface/Views/BezierEditor.js:
(WebInspector.BezierEditor.createControl):
(WebInspector.BezierEditor.createBezierInput):
(WebInspector.BezierEditor):
Added usage of Element.prototype.createChild for ease of readability.
Also added input elements for manually changing the values of each bezier
point's x and y values.
(WebInspector.BezierEditor.prototype.set bezier):
(WebInspector.BezierEditor.prototype.removeListeners):
(WebInspector.BezierEditor.prototype._handleMousedown):
(WebInspector.BezierEditor.prototype._updateBezier):
(WebInspector.BezierEditor.prototype._updateBezierPreview):
(WebInspector.BezierEditor.prototype._triggerPreviewAnimation):
(WebInspector.BezierEditor.prototype._handleNumberInputInput):
(WebInspector.BezierEditor.prototype._handleNumberInputKeydown):
(WebInspector.BezierEditor.prototype._changeBezierForInput):
Refactored code to make it more reusable, as well as adding event listeners
to the newly created inputs, including value chaning from the arrow keys.
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype.didDismissPopover): Deleted.
Removed unused code.
* UserInterface/Views/InlineSwatch.js:
(WebInspector.InlineSwatch):
(WebInspector.InlineSwatch.prototype.didDismissPopover):
Removes any global event listeners added by the current editor if able.
(WebInspector.InlineSwatch.prototype._swatchElementClicked):
Now saves the current editor object as a member variable.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseMainjs">trunk/Source/WebInspectorUI/UserInterface/Base/Main.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersCodeMirrorBezierEditingControllerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorBezierEditingController.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersCodeMirrorEditingControllerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorEditingController.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsBezierEditorcss">trunk/Source/WebInspectorUI/UserInterface/Views/BezierEditor.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsBezierEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationTextEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsInlineSwatchjs">trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (197370 => 197371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-02-29 22:45:16 UTC (rev 197370)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-02-29 23:06:58 UTC (rev 197371)
</span><span class="lines">@@ -1,3 +1,62 @@
</span><ins>+2016-02-29 Devin Rousso <dcrousso+webkit@gmail.com>
+
+ Web Inspector: Add direct number inputs to Bezier editor
+ https://bugs.webkit.org/show_bug.cgi?id=154809
+ <rdar://problem/24881465>
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/Main.js:
+ (WebInspector._updateWindowKeydownListener):
+ Now only adds the shared event listener when the first keydown listener
+ is added via WebInspector.addWindowKeydownListener
+
+ * UserInterface/Controllers/CodeMirrorBezierEditingController.js:
+ (WebInspector.CodeMirrorBezierEditingController.prototype.popoverDidDismiss):
+
+ * UserInterface/Controllers/CodeMirrorEditingController.js:
+ (WebInspector.CodeMirrorEditingController.prototype.popoverDidDismiss):
+ (WebInspector.CodeMirrorEditingController.prototype.didDismissPopover):
+ Added function that is called when the popover is dismissed so that
+ removing event listeners is possible.
+
+ * UserInterface/Views/BezierEditor.css:
+ (.bezier-editor):
+ (.bezier-editor > .number-input-container):
+ (.bezier-editor > .number-input-container > input):
+
+ * UserInterface/Views/BezierEditor.js:
+ (WebInspector.BezierEditor.createControl):
+ (WebInspector.BezierEditor.createBezierInput):
+ (WebInspector.BezierEditor):
+ Added usage of Element.prototype.createChild for ease of readability.
+ Also added input elements for manually changing the values of each bezier
+ point's x and y values.
+
+ (WebInspector.BezierEditor.prototype.set bezier):
+ (WebInspector.BezierEditor.prototype.removeListeners):
+ (WebInspector.BezierEditor.prototype._handleMousedown):
+ (WebInspector.BezierEditor.prototype._updateBezier):
+ (WebInspector.BezierEditor.prototype._updateBezierPreview):
+ (WebInspector.BezierEditor.prototype._triggerPreviewAnimation):
+ (WebInspector.BezierEditor.prototype._handleNumberInputInput):
+ (WebInspector.BezierEditor.prototype._handleNumberInputKeydown):
+ (WebInspector.BezierEditor.prototype._changeBezierForInput):
+ Refactored code to make it more reusable, as well as adding event listeners
+ to the newly created inputs, including value chaning from the arrow keys.
+
+ * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype.didDismissPopover): Deleted.
+ Removed unused code.
+
+ * UserInterface/Views/InlineSwatch.js:
+ (WebInspector.InlineSwatch):
+ (WebInspector.InlineSwatch.prototype.didDismissPopover):
+ Removes any global event listeners added by the current editor if able.
+
+ (WebInspector.InlineSwatch.prototype._swatchElementClicked):
+ Now saves the current editor object as a member variable.
+
</ins><span class="cx"> 2016-02-28 Nikita Vasilyev <nvasilyev@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: DataGrid's resizers aren't horizontally centered
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (197370 => 197371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-02-29 22:45:16 UTC (rev 197370)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-02-29 23:06:58 UTC (rev 197371)
</span><span class="lines">@@ -2379,9 +2379,9 @@
</span><span class="cx">
</span><span class="cx"> WebInspector._updateWindowKeydownListener = function()
</span><span class="cx"> {
</span><del>- if (this._windowKeydownListeners.length > 0)
</del><ins>+ if (this._windowKeydownListeners.length === 1)
</ins><span class="cx"> window.addEventListener("keydown", WebInspector._sharedWindowKeydownListener, true);
</span><del>- else
</del><ins>+ else if (!this._windowKeydownListeners.length)
</ins><span class="cx"> window.removeEventListener("keydown", WebInspector._sharedWindowKeydownListener, true);
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersCodeMirrorBezierEditingControllerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorBezierEditingController.js (197370 => 197371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorBezierEditingController.js        2016-02-29 22:45:16 UTC (rev 197370)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorBezierEditingController.js        2016-02-29 23:06:58 UTC (rev 197371)
</span><span class="lines">@@ -54,6 +54,11 @@
</span><span class="cx"> this._bezierEditor.bezier = this.value;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ popoverDidDismiss(popover)
+ {
+ this._bezierEditor.removeListeners();
+ }
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _bezierEditorBezierChanged(event)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersCodeMirrorEditingControllerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorEditingController.js (197370 => 197371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorEditingController.js        2016-02-29 22:45:16 UTC (rev 197370)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorEditingController.js        2016-02-29 23:06:58 UTC (rev 197371)
</span><span class="lines">@@ -145,6 +145,11 @@
</span><span class="cx"> // Implemented by subclasses.
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ popoverDidDismiss(popover)
+ {
+ // Implemented by subclasses.
+ }
+
</ins><span class="cx"> // Protected
</span><span class="cx">
</span><span class="cx"> handleKeydownEvent(event)
</span><span class="lines">@@ -181,6 +186,7 @@
</span><span class="cx"> delete this._originalValue;
</span><span class="cx">
</span><span class="cx"> WebInspector.removeWindowKeydownListener(this);
</span><ins>+ this.popoverDidDismiss();
</ins><span class="cx">
</span><span class="cx"> if (this._delegate && typeof this._delegate.editingControllerDidFinishEditing === "function")
</span><span class="cx"> this._delegate.editingControllerDidFinishEditing(this);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsBezierEditorcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BezierEditor.css (197370 => 197371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/BezierEditor.css        2016-02-29 22:45:16 UTC (rev 197370)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BezierEditor.css        2016-02-29 23:06:58 UTC (rev 197371)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">
</span><span class="cx"> .bezier-editor {
</span><span class="cx"> width: 200px;
</span><del>- height: 225px;
</del><ins>+ height: 260px;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .bezier-editor > .bezier-preview {
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> border-top: 4px solid black;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.bezier-editor > .bezier-preview.animate > div,
</ins><span class="cx"> .bezier-editor > .bezier-preview-timing.animate {
</span><span class="cx"> animation: bezierPreview 2.5s linear 250ms infinite;
</span><span class="cx"> }
</span><span class="lines">@@ -95,3 +96,24 @@
</span><span class="cx"> .bezier-editor > .bezier-container .control-handle.selected {
</span><span class="cx"> r: 7px;
</span><span class="cx"> }
</span><ins>+
+.bezier-editor > .number-input-container {
+ display: flex;
+ width: calc(100% - 10px);
+ margin: 0 5px;
+ padding-top: 7px;
+ border-top: 1px solid lightgrey;
+}
+
+.bezier-editor > .number-input-container > input {
+ width: 100%;
+ margin: 0 5px;
+ padding: 1px 2px 1px 1px;
+ text-align: right;
+ font-size: 13px;
+ background-color: white;
+ border: 1px solid hsl(0, 0%, 60%);
+ border-radius: 4px;
+ box-shadow: inset 0 0 1px 1px hsl(0, 0%, 89%);
+ outline: none;
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsBezierEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js (197370 => 197371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js        2016-02-29 22:45:16 UTC (rev 197370)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js        2016-02-29 23:06:58 UTC (rev 197371)
</span><span class="lines">@@ -38,56 +38,47 @@
</span><span class="cx"> this._controlHandleRadius = 7;
</span><span class="cx"> this._bezierWidth = editorWidth - (this._controlHandleRadius * 2);
</span><span class="cx"> this._bezierHeight = editorHeight - (this._controlHandleRadius * 2) - (this._padding * 2);
</span><del>- this._bezierPreviewAnimationStyleText = "bezierPreview 2.5s 250ms infinite ";
</del><span class="cx">
</span><del>- var bezierPreviewContainer = document.createElement("div");
- bezierPreviewContainer.id = "bezierPreview";
- bezierPreviewContainer.classList.add("bezier-preview");
- bezierPreviewContainer.title = WebInspector.UIString("Click to restart the animation");
- bezierPreviewContainer.addEventListener("mousedown", this._resetPreviewAnimation.bind(this));
</del><ins>+ this._bezierPreviewContainer = this._element.createChild("div", "bezier-preview");
+ this._bezierPreviewContainer.title = WebInspector.UIString("Click to restart the animation");
+ this._bezierPreviewContainer.addEventListener("mousedown", this._resetPreviewAnimation.bind(this));
</ins><span class="cx">
</span><del>- this._bezierPreview = document.createElement("div");
- bezierPreviewContainer.appendChild(this._bezierPreview);
</del><ins>+ this._bezierPreview = this._bezierPreviewContainer.createChild("div");
</ins><span class="cx">
</span><del>- this._element.appendChild(bezierPreviewContainer);
</del><ins>+ this._bezierPreviewTiming = this._element.createChild("div", "bezier-preview-timing");
</ins><span class="cx">
</span><del>- this._bezierContainer = createSVGElement("svg");
- this._bezierContainer.id = "bezierContainer";
</del><ins>+ this._bezierContainer = this._element.appendChild(createSVGElement("svg"));
</ins><span class="cx"> this._bezierContainer.setAttribute("width", editorWidth);
</span><span class="cx"> this._bezierContainer.setAttribute("height", editorHeight);
</span><span class="cx"> this._bezierContainer.classList.add("bezier-container");
</span><span class="cx">
</span><del>- var svgGroup = createSVGElement("g");
</del><ins>+ let svgGroup = this._bezierContainer.appendChild(createSVGElement("g"));
</ins><span class="cx"> svgGroup.setAttribute("transform", "translate(0, " + this._padding + ")");
</span><span class="cx">
</span><del>- var linearCurve = createSVGElement("line");
</del><ins>+ let linearCurve = svgGroup.appendChild(createSVGElement("line"));
</ins><span class="cx"> linearCurve.classList.add("linear-curve");
</span><span class="cx"> linearCurve.setAttribute("x1", this._controlHandleRadius);
</span><span class="cx"> linearCurve.setAttribute("y1", this._bezierHeight + this._controlHandleRadius);
</span><span class="cx"> linearCurve.setAttribute("x2", this._bezierWidth + this._controlHandleRadius);
</span><span class="cx"> linearCurve.setAttribute("y2", this._controlHandleRadius);
</span><del>- svgGroup.appendChild(linearCurve);
</del><span class="cx">
</span><del>- this._bezierCurve = createSVGElement("path");
</del><ins>+ this._bezierCurve = svgGroup.appendChild(createSVGElement("path"));
</ins><span class="cx"> this._bezierCurve.classList.add("bezier-curve");
</span><del>- svgGroup.appendChild(this._bezierCurve);
</del><span class="cx">
</span><span class="cx"> function createControl(x1, y1)
</span><span class="cx"> {
</span><span class="cx"> x1 += this._controlHandleRadius;
</span><span class="cx"> y1 += this._controlHandleRadius;
</span><span class="cx">
</span><del>- var line = createSVGElement("line");
</del><ins>+ let line = svgGroup.appendChild(createSVGElement("line"));
</ins><span class="cx"> line.classList.add("control-line");
</span><span class="cx"> line.setAttribute("x1", x1);
</span><span class="cx"> line.setAttribute("y1", y1);
</span><span class="cx"> line.setAttribute("x2", x1);
</span><span class="cx"> line.setAttribute("y2", y1);
</span><del>- svgGroup.appendChild(line);
</del><span class="cx">
</span><del>- var handle = createSVGElement("circle");
</del><ins>+ let handle = svgGroup.appendChild(createSVGElement("circle"));
</ins><span class="cx"> handle.classList.add("control-handle");
</span><del>- svgGroup.appendChild(handle);
</del><span class="cx">
</span><span class="cx"> return {point: null, line, handle};
</span><span class="cx"> }
</span><span class="lines">@@ -95,13 +86,21 @@
</span><span class="cx"> this._inControl = createControl.call(this, 0, this._bezierHeight);
</span><span class="cx"> this._outControl = createControl.call(this, this._bezierWidth, 0);
</span><span class="cx">
</span><del>- this._bezierContainer.appendChild(svgGroup);
- this._element.appendChild(this._bezierContainer);
</del><ins>+ this._numberInputContainer = this._element.createChild("div", "number-input-container");
</ins><span class="cx">
</span><del>- this._bezierPreviewTiming = document.createElement("div");
- this._bezierPreviewTiming.classList.add("bezier-preview-timing");
- this._element.appendChild(this._bezierPreviewTiming);
</del><ins>+ function createBezierInput(id, className)
+ {
+ let key = "_bezier" + id + "Input";
+ this[key] = this._numberInputContainer.createChild("input", className);
+ this[key].addEventListener("input", this._handleNumberInputInput.debounce(250, this));
+ this[key].addEventListener("keydown", this._handleNumberInputKeydown.bind(this));
+ }
</ins><span class="cx">
</span><ins>+ createBezierInput.call(this, "InX", "in-x");
+ createBezierInput.call(this, "InY", "in-y");
+ createBezierInput.call(this, "OutX", "out-x");
+ createBezierInput.call(this, "OutY", "out-y");
+
</ins><span class="cx"> this._selectedControl = null;
</span><span class="cx"> this._mouseDownPosition = null;
</span><span class="cx"> this._bezierContainer.addEventListener("mousedown", this);
</span><span class="lines">@@ -127,11 +126,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> this._bezier = bezier;
</span><del>- this._inControl.point = new WebInspector.Point(this._bezier.inPoint.x * this._bezierWidth, (1 - this._bezier.inPoint.y) * this._bezierHeight);
- this._outControl.point = new WebInspector.Point(this._bezier.outPoint.x * this._bezierWidth, (1 - this._bezier.outPoint.y) * this._bezierHeight);
-
- this._updateBezier();
- this._triggerPreviewAnimation();
</del><ins>+ this._updateBezierPreview();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get bezier()
</span><span class="lines">@@ -139,6 +134,11 @@
</span><span class="cx"> return this._bezier;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ removeListeners()
+ {
+ WebInspector.removeWindowKeydownListener(this);
+ }
+
</ins><span class="cx"> // Protected
</span><span class="cx">
</span><span class="cx"> handleEvent(event)
</span><span class="lines">@@ -161,7 +161,6 @@
</span><span class="cx"> if (!this._selectedControl || !this._element.parentNode)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>-
</del><span class="cx"> let horizontal = 0;
</span><span class="cx"> let vertical = 0;
</span><span class="cx"> switch (event.keyCode) {
</span><span class="lines">@@ -207,7 +206,7 @@
</span><span class="cx"> window.addEventListener("mousemove", this, true);
</span><span class="cx"> window.addEventListener("mouseup", this, true);
</span><span class="cx">
</span><del>- this._bezierPreview.style.animation = null;
</del><ins>+ this._bezierPreviewContainer.classList.remove("animate");
</ins><span class="cx"> this._bezierPreviewTiming.classList.remove("animate");
</span><span class="cx">
</span><span class="cx"> this._updateControlPointsForMouseEvent(event, true);
</span><span class="lines">@@ -285,6 +284,11 @@
</span><span class="cx"> this._bezierCurve.setAttribute("d", path);
</span><span class="cx"> this._updateControl(this._inControl);
</span><span class="cx"> this._updateControl(this._outControl);
</span><ins>+
+ this._bezierInXInput.value = this._bezier.inPoint.x;
+ this._bezierInYInput.value = this._bezier.inPoint.y;
+ this._bezierOutXInput.value = this._bezier.outPoint.x;
+ this._bezierOutYInput.value = this._bezier.outPoint.y;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> _updateControl(control)
</span><span class="lines">@@ -296,9 +300,19 @@
</span><span class="cx"> control.line.setAttribute("y2", control.point.y + this._controlHandleRadius);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ _updateBezierPreview()
+ {
+ this._inControl.point = new WebInspector.Point(this._bezier.inPoint.x * this._bezierWidth, (1 - this._bezier.inPoint.y) * this._bezierHeight);
+ this._outControl.point = new WebInspector.Point(this._bezier.outPoint.x * this._bezierWidth, (1 - this._bezier.outPoint.y) * this._bezierHeight);
+
+ this._updateBezier();
+ this._triggerPreviewAnimation();
+ }
+
</ins><span class="cx"> _triggerPreviewAnimation()
</span><span class="cx"> {
</span><del>- this._bezierPreview.style.animation = this._bezierPreviewAnimationStyleText + this._bezier.toString();
</del><ins>+ this._bezierPreview.style.animationTimingFunction = this._bezier.toString();
+ this._bezierPreviewContainer.classList.add("animate");
</ins><span class="cx"> this._bezierPreviewTiming.classList.add("animate");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -311,6 +325,55 @@
</span><span class="cx"> this._element.removeChild(this._bezierPreviewTiming);
</span><span class="cx"> this._element.appendChild(this._bezierPreviewTiming);
</span><span class="cx"> }
</span><ins>+
+ _handleNumberInputInput(event)
+ {
+ this._changeBezierForInput(event.target, event.target.value);
+ }
+
+ _handleNumberInputKeydown(event)
+ {
+ let shift = 0;
+ if (event.keyIdentifier === "Up")
+ shift = 0.01;
+ else if (event.keyIdentifier === "Down")
+ shift = -0.01;
+
+ if (!shift)
+ return;
+
+ if (event.shiftKey)
+ shift *= 10;
+
+ event.preventDefault();
+ this._changeBezierForInput(event.target, parseFloat(event.target.value) + shift);
+ }
+
+ _changeBezierForInput(target, value)
+ {
+ value = Math.round(value * 100) / 100;
+
+ switch (target) {
+ case this._bezierInXInput:
+ this._bezier.inPoint.x = Number.constrain(value, 0, 1);
+ break;
+ case this._bezierInYInput:
+ this._bezier.inPoint.y = value;
+ break;
+ case this._bezierOutXInput:
+ this._bezier.outPoint.x = Number.constrain(value, 0, 1);
+ break;
+ case this._bezierOutYInput:
+ this._bezier.outPoint.y = value;
+ break;
+ default:
+ return;
+ }
+
+ this._updateBezierPreview();
+
+ this.dispatchEventToListeners(WebInspector.BezierEditor.Event.BezierChanged, {bezier: this._bezier});
+ }
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.BezierEditor.Event = {
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationTextEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (197370 => 197371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js        2016-02-29 22:45:16 UTC (rev 197370)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js        2016-02-29 23:06:58 UTC (rev 197371)
</span><span class="lines">@@ -386,12 +386,6 @@
</span><span class="cx">
</span><span class="cx"> // Protected
</span><span class="cx">
</span><del>- didDismissPopover(popover)
- {
- if (popover === this._cubicBezierEditorPopover)
- this._cubicBezierEditorPopover = null;
- }
-
</del><span class="cx"> completionControllerCompletionsHidden(completionController)
</span><span class="cx"> {
</span><span class="cx"> var styleText = this._style.text;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsInlineSwatchjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js (197370 => 197371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js        2016-02-29 22:45:16 UTC (rev 197370)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js        2016-02-29 23:06:58 UTC (rev 197371)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx"> this._swatchInnerElement = this._swatchElement.createChild("span");
</span><span class="cx">
</span><span class="cx"> this._value = value || this._fallbackValue();
</span><ins>+ this._valueEditor = null;
</ins><span class="cx">
</span><span class="cx"> this._updateSwatch();
</span><span class="cx"> }
</span><span class="lines">@@ -79,6 +80,17 @@
</span><span class="cx"> this._updateSwatch(true);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // Protected
+
+ didDismissPopover(popover)
+ {
+ if (!this._valueEditor)
+ return;
+
+ if (typeof this._valueEditor.removeListeners === "function")
+ this._valueEditor.removeListeners();
+ }
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _fallbackValue()
</span><span class="lines">@@ -122,29 +134,29 @@
</span><span class="cx"> let bounds = WebInspector.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());
</span><span class="cx"> let popover = new WebInspector.Popover(this);
</span><span class="cx">
</span><del>- let valueEditor = null;
</del><ins>+ this._valueEditor = null;
</ins><span class="cx"> if (this._type === WebInspector.InlineSwatch.Type.Bezier) {
</span><del>- valueEditor = new WebInspector.BezierEditor;
- valueEditor.addEventListener(WebInspector.BezierEditor.Event.BezierChanged, this._valueEditorValueDidChange, this);
</del><ins>+ this._valueEditor = new WebInspector.BezierEditor;
+ this._valueEditor.addEventListener(WebInspector.BezierEditor.Event.BezierChanged, this._valueEditorValueDidChange, this);
</ins><span class="cx"> } else if (this._type === WebInspector.InlineSwatch.Type.Gradient) {
</span><del>- valueEditor = new WebInspector.GradientEditor;
- valueEditor.addEventListener(WebInspector.GradientEditor.Event.GradientChanged, this._valueEditorValueDidChange, this);
- valueEditor.addEventListener(WebInspector.GradientEditor.Event.ColorPickerToggled, (event) => popover.update());
</del><ins>+ this._valueEditor = new WebInspector.GradientEditor;
+ this._valueEditor.addEventListener(WebInspector.GradientEditor.Event.GradientChanged, this._valueEditorValueDidChange, this);
+ this._valueEditor.addEventListener(WebInspector.GradientEditor.Event.ColorPickerToggled, (event) => popover.update());
</ins><span class="cx"> } else {
</span><del>- valueEditor = new WebInspector.ColorPicker;
- valueEditor.addEventListener(WebInspector.ColorPicker.Event.ColorChanged, this._valueEditorValueDidChange, this);
</del><ins>+ this._valueEditor = new WebInspector.ColorPicker;
+ this._valueEditor.addEventListener(WebInspector.ColorPicker.Event.ColorChanged, this._valueEditorValueDidChange, this);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- popover.content = valueEditor.element;
</del><ins>+ popover.content = this._valueEditor.element;
</ins><span class="cx"> popover.present(bounds.pad(2), [WebInspector.RectEdge.MIN_X]);
</span><span class="cx">
</span><span class="cx"> let value = this._value || this._fallbackValue();
</span><span class="cx"> if (this._type === WebInspector.InlineSwatch.Type.Bezier)
</span><del>- valueEditor.bezier = value;
</del><ins>+ this._valueEditor.bezier = value;
</ins><span class="cx"> else if (this._type === WebInspector.InlineSwatch.Type.Gradient)
</span><del>- valueEditor.gradient = value;
</del><ins>+ this._valueEditor.gradient = value;
</ins><span class="cx"> else
</span><del>- valueEditor.color = value;
</del><ins>+ this._valueEditor.color = value;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> _valueEditorValueDidChange(event)
</span></span></pre>
</div>
</div>
</body>
</html>