<!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>[242602] 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/242602">242602</a></dd>
<dt>Author</dt> <dd>drousso@apple.com</dd>
<dt>Date</dt> <dd>2019-03-07 11:11:52 -0800 (Thu, 07 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: CSS: there should be a way to inline-replace a variable with it's value
https://bugs.webkit.org/show_bug.cgi?id=195335

Reviewed by Joseph Pecoraro.

* UserInterface/Views/InlineSwatch.js:
(WI.InlineSwatch):
(WI.InlineSwatch.prototype.didDismissPopover):
(WI.InlineSwatch.prototype._swatchElementClicked):
(WI.InlineSwatch.prototype._swatchElementClicked.optionsForType): Added.
Shift-clicking a variable swatch replaces the text with the variable's value.
Drive-by: try to create a readonly swatch for the variable's value (e.g. a color indicator).

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype._createInlineSwatch):
If the value of a variable swatch changes, re-render the value.

* UserInterface/Views/CodeMirrorTextMarkers.js:
(createCodeMirrorTextMarkers):
(createCodeMirrorColorTextMarkers):
(createCodeMirrorGradientTextMarkers):
(createCodeMirrorBezierTextMarkers):
(createCodeMirrorSpringTextMarkers):
Refactor function parameters for more flexibility.

* Localizations/en.lproj/localizedStrings.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCodeMirrorTextMarkersjs">trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorTextMarkers.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsInlineSwatchjs">trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetStylePropertyjs">trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (242601 => 242602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog    2019-03-07 18:03:41 UTC (rev 242601)
+++ trunk/Source/WebInspectorUI/ChangeLog       2019-03-07 19:11:52 UTC (rev 242602)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2019-03-07  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: CSS: there should be a way to inline-replace a variable with it's value
+        https://bugs.webkit.org/show_bug.cgi?id=195335
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/InlineSwatch.js:
+        (WI.InlineSwatch):
+        (WI.InlineSwatch.prototype.didDismissPopover):
+        (WI.InlineSwatch.prototype._swatchElementClicked):
+        (WI.InlineSwatch.prototype._swatchElementClicked.optionsForType): Added.
+        Shift-clicking a variable swatch replaces the text with the variable's value.
+        Drive-by: try to create a readonly swatch for the variable's value (e.g. a color indicator).
+
+        * UserInterface/Views/SpreadsheetStyleProperty.js:
+        (WI.SpreadsheetStyleProperty.prototype._createInlineSwatch):
+        If the value of a variable swatch changes, re-render the value.
+
+        * UserInterface/Views/CodeMirrorTextMarkers.js:
+        (createCodeMirrorTextMarkers):
+        (createCodeMirrorColorTextMarkers):
+        (createCodeMirrorGradientTextMarkers):
+        (createCodeMirrorBezierTextMarkers):
+        (createCodeMirrorSpringTextMarkers):
+        Refactor function parameters for more flexibility.
+
+        * Localizations/en.lproj/localizedStrings.js:
+
</ins><span class="cx"> 2019-03-06  Devin Rousso  <drousso@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Elements: highlight the node when hovering event listeners sorted by node
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (242601 => 242602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js   2019-03-07 18:03:41 UTC (rev 242601)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js      2019-03-07 19:11:52 UTC (rev 242602)
</span><span class="lines">@@ -223,7 +223,8 @@
</span><span class="cx"> localizedStrings["Clear watch expressions"] = "Clear watch expressions";
</span><span class="cx"> localizedStrings["Click Listener"] = "Click Listener";
</span><span class="cx"> localizedStrings["Click to close this tab"] = "Click to close this tab";
</span><del>-localizedStrings["Click to select a color. Shift-click to switch color formats."] = "Click to select a color. Shift-click to switch color formats.";
</del><ins>+localizedStrings["Click to select a color\nShift-click to switch color formats"] = "Click to select a color\nShift-click to switch color formats";
+localizedStrings["Click to view variable value\nShift-click to replace variable with value"] = "Click to view variable value\nShift-click to replace variable with value";
</ins><span class="cx"> localizedStrings["Clickable"] = "Clickable";
</span><span class="cx"> localizedStrings["Close"] = "Close";
</span><span class="cx"> localizedStrings["Close %s timeline view"] = "Close %s timeline view";
</span><span class="lines">@@ -1100,7 +1101,6 @@
</span><span class="cx"> localizedStrings["View Image"] = "View Image";
</span><span class="cx"> localizedStrings["View Recording"] = "View Recording";
</span><span class="cx"> localizedStrings["View Shader"] = "View Shader";
</span><del>-localizedStrings["View variable value"] = "View variable value";
</del><span class="cx"> localizedStrings["Visible"] = "Visible";
</span><span class="cx"> localizedStrings["Waiting"] = "Waiting";
</span><span class="cx"> localizedStrings["Waiting for canvas contexts created by script or CSS."] = "Waiting for canvas contexts created by script or CSS.";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCodeMirrorTextMarkersjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorTextMarkers.js (242601 => 242602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorTextMarkers.js 2019-03-07 18:03:41 UTC (rev 242601)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorTextMarkers.js    2019-03-07 19:11:52 UTC (rev 242602)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-function createCodeMirrorTextMarkers(type, pattern, matchFunction, codeMirror, range, callback)
</del><ins>+function createCodeMirrorTextMarkers({codeMirror, range, type, pattern, matchFunction, allowedTokens, callback})
</ins><span class="cx"> {
</span><span class="cx">     var createdMarkers = [];
</span><span class="cx">     var start = range instanceof WI.TextRange ? range.startLine : 0;
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> 
</span><span class="cx">             // We're not interested if the value is not inside a keyword.
</span><span class="cx">             var tokenType = codeMirror.getTokenTypeAt(from);
</span><del>-            if (tokenType && !tokenType.includes("keyword")) {
</del><ins>+            if (tokenType && !tokenType.includes("keyword") && (!allowedTokens || !allowedTokens.test(tokenType))) {
</ins><span class="cx">                 match = pattern.exec(lineContent);
</span><span class="cx">                 continue;
</span><span class="cx">             }
</span><span class="lines">@@ -82,10 +82,10 @@
</span><span class="cx">     return createdMarkers;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function createCodeMirrorColorTextMarkers(codeMirror, range, callback)
</del><ins>+function createCodeMirrorColorTextMarkers(codeMirror, range, options = {})
</ins><span class="cx"> {
</span><span class="cx">     // Matches rgba(0, 0, 0, 0.5), rgb(0, 0, 0), hsl(), hsla(), #fff, #ffff, #ffffff, #ffffffff, white
</span><del>-    let colorRegex = /((?:rgb|hsl)a?\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b\w+\b(?![-.]))/g;
</del><ins>+    const pattern = /((?:rgb|hsl)a?\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b\w+\b(?![-.]))/g;
</ins><span class="cx">     function matchFunction(lineContent, match) {
</span><span class="cx">         if (!lineContent || !lineContent.length)
</span><span class="cx">             return false;
</span><span class="lines">@@ -118,10 +118,10 @@
</span><span class="cx">         return !(match.index > 0 && /[-.\"\']/.test(lineContent[match.index - 1]));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return createCodeMirrorTextMarkers("Color", colorRegex, matchFunction, codeMirror, range, callback);
</del><ins>+    return createCodeMirrorTextMarkers({codeMirror, range, type: "Color", pattern, matchFunction, ...options});
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-function createCodeMirrorGradientTextMarkers(codeMirror, range, callback)
</del><ins>+function createCodeMirrorGradientTextMarkers(codeMirror, range, options = {})
</ins><span class="cx"> {
</span><span class="cx">     var createdMarkers = [];
</span><span class="cx"> 
</span><span class="lines">@@ -181,7 +181,7 @@
</span><span class="cx">             createdMarkers.push(marker);
</span><span class="cx"> 
</span><span class="cx">             if (typeof callback === "function")
</span><del>-                callback(marker, gradient, gradientString);
</del><ins>+                options.callback(marker, gradient, gradientString);
</ins><span class="cx"> 
</span><span class="cx">             match = gradientRegex.exec(lineContent);
</span><span class="cx">         }
</span><span class="lines">@@ -190,14 +190,14 @@
</span><span class="cx">     return createdMarkers;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function createCodeMirrorCubicBezierTextMarkers(codeMirror, range, callback)
</del><ins>+function createCodeMirrorCubicBezierTextMarkers(codeMirror, range, options = {})
</ins><span class="cx"> {
</span><del>-    var cubicBezierRegex = /(cubic-bezier\([^)]+\)|\b\w+\b(?:-\b\w+\b){0,2})/g;
-    return createCodeMirrorTextMarkers("CubicBezier", cubicBezierRegex, null, codeMirror, range, callback);
</del><ins>+    const pattern = /(cubic-bezier\([^)]+\)|\b\w+\b(?:-\b\w+\b){0,2})/g;
+    return createCodeMirrorTextMarkers({codeMirror, range, type: "CubicBezier", pattern, ...options});
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-function createCodeMirrorSpringTextMarkers(codeMirror, range, callback)
</del><ins>+function createCodeMirrorSpringTextMarkers(codeMirror, range, options = {})
</ins><span class="cx"> {
</span><del>-    const springRegex = /(spring\([^)]+\))/g;
-    return createCodeMirrorTextMarkers("Spring", springRegex, null, codeMirror, range, callback);
</del><ins>+    const pattern = /(spring\([^)]+\))/g;
+    return createCodeMirrorTextMarkers({codeMirror, range, type: "Spring", pattern, ...options});
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsInlineSwatchjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js (242601 => 242602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js  2019-03-07 18:03:41 UTC (rev 242601)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js     2019-03-07 19:11:52 UTC (rev 242602)
</span><span class="lines">@@ -41,14 +41,12 @@
</span><span class="cx"> 
</span><span class="cx">         this._swatchElement.classList.add("inline-swatch", this._type.split("-").lastValue);
</span><span class="cx"> 
</span><del>-        this._boundSwatchElementClicked = null;
-
</del><span class="cx">         if (readOnly)
</span><span class="cx">             this._swatchElement.classList.add("read-only");
</span><span class="cx">         else {
</span><span class="cx">             switch (this._type) {
</span><span class="cx">             case WI.InlineSwatch.Type.Color:
</span><del>-                this._swatchElement.title = WI.UIString("Click to select a color. Shift-click to switch color formats.");
</del><ins>+                this._swatchElement.title = WI.UIString("Click to select a color\nShift-click to switch color formats");
</ins><span class="cx">                 break;
</span><span class="cx">             case WI.InlineSwatch.Type.Gradient:
</span><span class="cx">                 this._swatchElement.title = WI.UIString("Edit custom gradient");
</span><span class="lines">@@ -60,7 +58,7 @@
</span><span class="cx">                 this._swatchElement.title = WI.UIString("Edit \u201Cspring\u201D function");
</span><span class="cx">                 break;
</span><span class="cx">             case WI.InlineSwatch.Type.Variable:
</span><del>-                this._swatchElement.title = WI.UIString("View variable value");
</del><ins>+                this._swatchElement.title = WI.UIString("Click to view variable value\nShift-click to replace variable with value");
</ins><span class="cx">                 break;
</span><span class="cx">             case WI.InlineSwatch.Type.Image:
</span><span class="cx">                 this._swatchElement.title = WI.UIString("View Image");
</span><span class="lines">@@ -70,8 +68,7 @@
</span><span class="cx">                 break;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            this._boundSwatchElementClicked = this._swatchElementClicked.bind(this);
-            this._swatchElement.addEventListener("click", this._boundSwatchElementClicked);
</del><ins>+            this._swatchElement.addEventListener("click", this._swatchElementClicked.bind(this));
</ins><span class="cx">             if (this._type === WI.InlineSwatch.Type.Color)
</span><span class="cx">                 this._swatchElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this));
</span><span class="cx">         }
</span><span class="lines">@@ -109,12 +106,14 @@
</span><span class="cx">         if (!this._valueEditor)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        if (typeof this._valueEditor.removeListeners === "function")
</del><ins>+        if (this._valueEditor.removeListeners)
</ins><span class="cx">             this._valueEditor.removeListeners();
</span><span class="cx"> 
</span><del>-        if (this._boundSwatchElementClicked)
-            this._swatchElement.addEventListener("click", this._boundSwatchElementClicked);
</del><ins>+        if (this._valueEditor instanceof WI.Object)
+            this._valueEditor.removeEventListener(null, null, this);
</ins><span class="cx"> 
</span><ins>+        this._valueEditor = null;
+
</ins><span class="cx">         this.dispatchEventToListeners(WI.InlineSwatch.Event.Deactivated);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -149,19 +148,30 @@
</span><span class="cx"> 
</span><span class="cx">     _swatchElementClicked(event)
</span><span class="cx">     {
</span><del>-        this.dispatchEventToListeners(WI.InlineSwatch.Event.BeforeClicked);
</del><ins>+        event.stop();
</ins><span class="cx"> 
</span><del>-        if (this._type === WI.InlineSwatch.Type.Color && event.shiftKey && this._value) {
-            let nextFormat = this._value.nextFormat();
-            console.assert(nextFormat);
-            if (!nextFormat)
</del><ins>+        if (event.shiftKey && this._value) {
+            if (this._type === WI.InlineSwatch.Type.Color) {
+                let nextFormat = this._value.nextFormat();
+                console.assert(nextFormat);
+                if (nextFormat) {
+                    this._value.format = nextFormat;
+                    this._updateSwatch();
+                }
</ins><span class="cx">                 return;
</span><ins>+            }
</ins><span class="cx"> 
</span><del>-            this._value.format = nextFormat;
-            this._updateSwatch();
-            return;
</del><ins>+            if (this._type === WI.InlineSwatch.Type.Variable) {
+                // Force the swatch to replace the displayed text with the variable's value.
+                this._swatchElement.remove();
+                this._updateSwatch();
+                return;
+            }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        if (this._valueEditor)
+            return;
+
</ins><span class="cx">         let bounds = WI.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());
</span><span class="cx">         let popover = new WI.Popover(this);
</span><span class="cx"> 
</span><span class="lines">@@ -225,9 +235,6 @@
</span><span class="cx">         popover.content = this._valueEditor.element;
</span><span class="cx">         popover.present(bounds.pad(2), [WI.RectEdge.MIN_X]);
</span><span class="cx"> 
</span><del>-        if (this._boundSwatchElementClicked)
-            this._swatchElement.removeEventListener("click", this._boundSwatchElementClicked);
-
</del><span class="cx">         this.dispatchEventToListeners(WI.InlineSwatch.Event.Activated);
</span><span class="cx"> 
</span><span class="cx">         let value = this._value || this._fallbackValue();
</span><span class="lines">@@ -248,10 +255,27 @@
</span><span class="cx">             this._valueEditor.spring = value;
</span><span class="cx">             break;
</span><span class="cx"> 
</span><del>-        case WI.InlineSwatch.Type.Variable:
-            this._valueEditor.codeMirror.setValue(value);
</del><ins>+        case WI.InlineSwatch.Type.Variable: {
+            let codeMirror = this._valueEditor.codeMirror;
+            codeMirror.setValue(value);
+
+            const range = null;
+            function optionsForType(type) {
+                return {
+                    allowedTokens: /\btag\b/,
+                    callback(marker, valueObject, valueString) {
+                        let swatch = new WI.InlineSwatch(type, valueObject, true);
+                        codeMirror.setUniqueBookmark({line: 0, ch: 0}, swatch.element);
+                    }
+                };
+            }
+            createCodeMirrorColorTextMarkers(codeMirror, range, optionsForType(WI.InlineSwatch.Type.Color));
+            createCodeMirrorGradientTextMarkers(codeMirror, range, optionsForType(WI.InlineSwatch.Type.Gradient));
+            createCodeMirrorCubicBezierTextMarkers(codeMirror, range, optionsForType(WI.InlineSwatch.Type.Bezier));
+            createCodeMirrorSpringTextMarkers(codeMirror, range, optionsForType(WI.InlineSwatch.Type.Spring));
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><ins>+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     _valueEditorValueDidChange(event)
</span><span class="lines">@@ -378,7 +402,6 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WI.InlineSwatch.Event = {
</span><del>-    BeforeClicked: "inline-swatch-before-clicked",
</del><span class="cx">     ValueChanged: "inline-swatch-value-changed",
</span><span class="cx">     Activated: "inline-swatch-activated",
</span><span class="cx">     Deactivated: "inline-swatch-deactivated",
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetStylePropertyjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (242601 => 242602)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js      2019-03-07 18:03:41 UTC (rev 242601)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2019-03-07 19:11:52 UTC (rev 242602)
</span><span class="lines">@@ -500,11 +500,13 @@
</span><span class="cx"> 
</span><span class="cx">             innerElement.textContent = value;
</span><span class="cx">             this._handleValueChange();
</span><ins>+
+            if (type === WI.InlineSwatch.Type.Variable)
+                this._renderValue(this._property.rawValue);
</ins><span class="cx">         }, this);
</span><span class="cx"> 
</span><span class="cx">         if (this._delegate && typeof this._delegate.stylePropertyInlineSwatchActivated === "function") {
</span><span class="cx">             swatch.addEventListener(WI.InlineSwatch.Event.Activated, () => {
</span><del>-                this._swatchActive = true;
</del><span class="cx">                 this._delegate.stylePropertyInlineSwatchActivated();
</span><span class="cx">             });
</span><span class="cx">         }
</span><span class="lines">@@ -511,7 +513,6 @@
</span><span class="cx"> 
</span><span class="cx">         if (this._delegate && typeof this._delegate.stylePropertyInlineSwatchDeactivated === "function") {
</span><span class="cx">             swatch.addEventListener(WI.InlineSwatch.Event.Deactivated, () => {
</span><del>-                this._swatchActive = false;
</del><span class="cx">                 this._delegate.stylePropertyInlineSwatchDeactivated();
</span><span class="cx">             });
</span><span class="cx">         }
</span><span class="lines">@@ -518,12 +519,6 @@
</span><span class="cx"> 
</span><span class="cx">         tokenElement.append(swatch.element, innerElement);
</span><span class="cx"> 
</span><del>-        // Prevent the value from editing when clicking on the swatch.
-        swatch.element.addEventListener("click", (event) => {
-            if (this._swatchActive || event.shiftKey)
-                event.stop();
-        });
-
</del><span class="cx">         return tokenElement;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>