<!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>[188457] releases/WebKitGTK/webkit-2.10/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/188457">188457</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-08-14 03:46:33 -0700 (Fri, 14 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/188429">r188429</a> - Web Inspector: Flash DOM node attribute on change
https://bugs.webkit.org/show_bug.cgi?id=147973
Reviewed by Timothy Hatcher.
Whenever an attribute on a DOM node changes, flash the attribute value.
If that value doesn't exist, flash the attribute name instead.
* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement):
(WebInspector.DOMTreeElement.prototype.nodeChanged):
(WebInspector.DOMTreeElement.prototype._buildAttributeDOM):
If the node has been marked with a general change, mark the attribute element for animation.
(WebInspector.DOMTreeElement.prototype._markNodeChanged.animationEnd):
(WebInspector.DOMTreeElement.prototype._markNodeChanged):
Adds a class to the given element that applies a simple background flash animation.
(WebInspector.DOMTreeElement.prototype._fireDidChange):
Add the animation class once all building of the represented DOM object for that node is done.
* UserInterface/Views/DOMTreeOutline.css:
(@keyframes node-state-changed):
Applies a semi-transparent background that fades to default.
(.node-state-changed):
* UserInterface/Views/DOMTreeUpdater.js:
(WebInspector.DOMTreeUpdater.prototype._attributesUpdated):
Now passes along the name of the modified attribute.
(WebInspector.DOMTreeUpdater.prototype._updateModifiedNodes):
If the modified node object has an attribute member, mark the node as being generally changed.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210SourceWebInspectorUIChangeLog">releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebInspectorUIUserInterfaceViewsDOMTreeElementjs">releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebInspectorUIUserInterfaceViewsDOMTreeOutlinecss">releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebInspectorUIUserInterfaceViewsDOMTreeUpdaterjs">releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeUpdater.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit210SourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/ChangeLog (188456 => 188457)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/ChangeLog        2015-08-14 10:44:13 UTC (rev 188456)
+++ releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/ChangeLog        2015-08-14 10:46:33 UTC (rev 188457)
</span><span class="lines">@@ -1,5 +1,37 @@
</span><span class="cx"> 2015-08-13 Devin Rousso <drousso@apple.com>
</span><span class="cx">
</span><ins>+ Web Inspector: Flash DOM node attribute on change
+ https://bugs.webkit.org/show_bug.cgi?id=147973
+
+ Reviewed by Timothy Hatcher.
+
+ Whenever an attribute on a DOM node changes, flash the attribute value.
+ If that value doesn't exist, flash the attribute name instead.
+
+ * UserInterface/Views/DOMTreeElement.js:
+ (WebInspector.DOMTreeElement):
+ (WebInspector.DOMTreeElement.prototype.nodeChanged):
+ (WebInspector.DOMTreeElement.prototype._buildAttributeDOM):
+ If the node has been marked with a general change, mark the attribute element for animation.
+ (WebInspector.DOMTreeElement.prototype._markNodeChanged.animationEnd):
+ (WebInspector.DOMTreeElement.prototype._markNodeChanged):
+ Adds a class to the given element that applies a simple background flash animation.
+ (WebInspector.DOMTreeElement.prototype._fireDidChange):
+ Add the animation class once all building of the represented DOM object for that node is done.
+
+ * UserInterface/Views/DOMTreeOutline.css:
+ (@keyframes node-state-changed):
+ Applies a semi-transparent background that fades to default.
+ (.node-state-changed):
+
+ * UserInterface/Views/DOMTreeUpdater.js:
+ (WebInspector.DOMTreeUpdater.prototype._attributesUpdated):
+ Now passes along the name of the modified attribute.
+ (WebInspector.DOMTreeUpdater.prototype._updateModifiedNodes):
+ If the modified node object has an attribute member, mark the node as being generally changed.
+
+2015-08-13 Devin Rousso <drousso@apple.com>
+
</ins><span class="cx"> REGRESSION (r184000): Web Inspector: Stripped whitespace after editing CSS in Styles sidebar
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=145679
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebInspectorUIUserInterfaceViewsDOMTreeElementjs"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js (188456 => 188457)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js        2015-08-14 10:44:13 UTC (rev 188456)
+++ releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js        2015-08-14 10:46:33 UTC (rev 188457)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> this._canAddAttributes = true;
</span><span class="cx"> this._searchQuery = null;
</span><span class="cx"> this._expandedChildrenLimit = WebInspector.DOMTreeElement.InitialChildrenLimit;
</span><ins>+ this._nodeStateChanges = [];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> isCloseTag()
</span><span class="lines">@@ -192,6 +193,14 @@
</span><span class="cx"> return count;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ nodeStateChanged(change)
+ {
+ if (!change)
+ return;
+
+ this._nodeStateChanges.push(change);
+ }
+
</ins><span class="cx"> showChildNode(node)
</span><span class="cx"> {
</span><span class="cx"> console.assert(!this._elementCloseTag);
</span><span class="lines">@@ -1070,41 +1079,43 @@
</span><span class="cx">
</span><span class="cx"> _buildAttributeDOM(parentElement, name, value, node)
</span><span class="cx"> {
</span><del>- var hasText = (value.length > 0);
- var attrSpanElement = parentElement.createChild("span", "html-attribute");
- var attrNameElement = attrSpanElement.createChild("span", "html-attribute-name");
</del><ins>+ let hasText = (value.length > 0);
+ let attrSpanElement = parentElement.createChild("span", "html-attribute");
+ let attrNameElement = attrSpanElement.createChild("span", "html-attribute-name");
</ins><span class="cx"> attrNameElement.textContent = name;
</span><del>-
</del><ins>+ let attrValueElement = null;
</ins><span class="cx"> if (hasText)
</span><span class="cx"> attrSpanElement.append("=\u200B\"");
</span><span class="cx">
</span><span class="cx"> if (name === "src" || name === "href") {
</span><del>- var baseURL = node.ownerDocument ? node.ownerDocument.documentURL : null;
- var rewrittenURL = absoluteURL(value, baseURL);
-
</del><ins>+ let baseURL = node.ownerDocument ? node.ownerDocument.documentURL : null;
+ let rewrittenURL = absoluteURL(value, baseURL);
</ins><span class="cx"> value = value.insertWordBreakCharacters();
</span><del>-
</del><span class="cx"> if (!rewrittenURL) {
</span><del>- var attrValueElement = attrSpanElement.createChild("span", "html-attribute-value");
</del><ins>+ attrValueElement = attrSpanElement.createChild("span", "html-attribute-value");
</ins><span class="cx"> attrValueElement.textContent = value;
</span><span class="cx"> } else {
</span><span class="cx"> if (value.startsWith("data:"))
</span><span class="cx"> value = value.trimMiddle(60);
</span><span class="cx">
</span><del>- var linkElement = document.createElement("a");
- linkElement.href = rewrittenURL;
- linkElement.textContent = value;
-
- attrSpanElement.appendChild(linkElement);
</del><ins>+ attrValueElement = document.createElement("a");
+ attrValueElement.href = rewrittenURL;
+ attrValueElement.textContent = value;
+ attrSpanElement.appendChild(attrValueElement);
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> value = value.insertWordBreakCharacters();
</span><del>- var attrValueElement = attrSpanElement.createChild("span", "html-attribute-value");
</del><ins>+ attrValueElement = attrSpanElement.createChild("span", "html-attribute-value");
</ins><span class="cx"> attrValueElement.textContent = value;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (hasText)
</span><span class="cx"> attrSpanElement.append("\"");
</span><ins>+
+ for (let change of this._nodeStateChanges) {
+ if (change.type === WebInspector.DOMTreeElement.ChangeType.Attribute && change.attribute === name)
+ change.element = hasText ? attrValueElement : attrNameElement;
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> _buildTagDOM(parentElement, tagName, isClosingTag, isDistinctTreeElement)
</span><span class="lines">@@ -1449,6 +1460,34 @@
</span><span class="cx"> WebInspector.highlightRangesWithStyleClass(this.title, matchRanges, WebInspector.DOMTreeElement.SearchHighlightStyleClassName, this._highlightResult);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ _markNodeChanged()
+ {
+ function animationEnd() {
+ this.classList.remove("node-state-changed");
+ this.removeEventListener("animationEnd", animationEnd);
+ }
+
+ for (let change of this._nodeStateChanges) {
+ let element = change.element;
+ if (!element)
+ continue;
+
+ element.classList.remove("node-state-changed");
+ element.addEventListener("animationEnd", animationEnd);
+ element.classList.add("node-state-changed");
+ }
+
+ this._nodeStateChanges = [];
+ }
+
+ _fireDidChange()
+ {
+ super._fireDidChange();
+
+ if (this._nodeStateChanges)
+ this._markNodeChanged();
+ }
+
</ins><span class="cx"> handleEvent(event)
</span><span class="cx"> {
</span><span class="cx"> if (event.type === "dragstart" && this._editing)
</span><span class="lines">@@ -1472,5 +1511,9 @@
</span><span class="cx"> "html", "head", "body"
</span><span class="cx"> ].keySet();
</span><span class="cx">
</span><ins>+WebInspector.DOMTreeElement.ChangeType = {
+ Attribute: "dom-tree-element-change-type-attribute"
+};
+
</ins><span class="cx"> WebInspector.DOMTreeElement.SearchHighlightStyleClassName = "search-highlight";
</span><span class="cx"> WebInspector.DOMTreeElement.BouncyHighlightStyleClassName = "bouncy-highlight";
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebInspectorUIUserInterfaceViewsDOMTreeOutlinecss"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css (188456 => 188457)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css        2015-08-14 10:44:13 UTC (rev 188456)
+++ releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css        2015-08-14 10:46:33 UTC (rev 188457)
</span><span class="lines">@@ -165,3 +165,12 @@
</span><span class="cx"> background-color: hsla(53, 83%, 53%, 0.2);
</span><span class="cx"> border-bottom: 1px solid hsl(47, 82%, 60%);
</span><span class="cx"> }
</span><ins>+
+@keyframes node-state-changed {
+ from { background-color: hsla(212, 92%, 54%, 0.5); }
+}
+
+.node-state-changed {
+ animation: node-state-changed 1s cubic-bezier(0, 0, 0.25, 1);
+ border-radius: 3px;
+}
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebInspectorUIUserInterfaceViewsDOMTreeUpdaterjs"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeUpdater.js (188456 => 188457)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeUpdater.js        2015-08-14 10:44:13 UTC (rev 188456)
+++ releases/WebKitGTK/webkit-2.10/Source/WebInspectorUI/UserInterface/Views/DOMTreeUpdater.js        2015-08-14 10:46:33 UTC (rev 188457)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">
</span><span class="cx"> _attributesUpdated: function(event)
</span><span class="cx"> {
</span><del>- this._recentlyModifiedNodes.push({node: event.data.node, updated: true});
</del><ins>+ this._recentlyModifiedNodes.push({node: event.data.node, updated: true, attribute: event.data.name});
</ins><span class="cx"> if (this._treeOutline._visible)
</span><span class="cx"> this._updateModifiedNodesSoon();
</span><span class="cx"> },
</span><span class="lines">@@ -99,26 +99,32 @@
</span><span class="cx"> {
</span><span class="cx"> if (this._updateModifiedNodesTimeout) {
</span><span class="cx"> clearTimeout(this._updateModifiedNodesTimeout);
</span><del>- delete this._updateModifiedNodesTimeout;
</del><ins>+ this._updateModifiedNodesTimeout = null;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- var updatedParentTreeElements = [];
</del><ins>+ let updatedParentTreeElements = [];
+ for (let recentlyModifiedNode of this._recentlyModifiedNodes) {
+ let parent = recentlyModifiedNode.parent;
+ let node = recentlyModifiedNode.node;
+ let changeInfo = null;
+ if (recentlyModifiedNode.attribute)
+ changeInfo = {type: WebInspector.DOMTreeElement.ChangeType.Attribute, attribute: recentlyModifiedNode.attribute};
</ins><span class="cx">
</span><del>- for (var i = 0; i < this._recentlyModifiedNodes.length; ++i) {
- var parent = this._recentlyModifiedNodes[i].parent;
- var node = this._recentlyModifiedNodes[i].node;
</del><ins>+ if (recentlyModifiedNode.updated) {
+ let nodeTreeElement = this._treeOutline.findTreeElement(node);
+ if (!nodeTreeElement)
+ continue;
</ins><span class="cx">
</span><del>- if (this._recentlyModifiedNodes[i].updated) {
- var nodeItem = this._treeOutline.findTreeElement(node);
- if (nodeItem)
- nodeItem.updateTitle();
- continue;
</del><ins>+ if (changeInfo)
+ nodeTreeElement.nodeStateChanged(changeInfo);
+
+ nodeTreeElement.updateTitle();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!parent)
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- var parentNodeItem = this._treeOutline.findTreeElement(parent);
</del><ins>+ let parentNodeItem = this._treeOutline.findTreeElement(parent);
</ins><span class="cx"> if (parentNodeItem && !parentNodeItem.alreadyUpdatedChildren) {
</span><span class="cx"> parentNodeItem.updateTitle();
</span><span class="cx"> parentNodeItem.updateChildren();
</span><span class="lines">@@ -127,8 +133,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- for (var i = 0; i < updatedParentTreeElements.length; ++i)
- delete updatedParentTreeElements[i].alreadyUpdatedChildren;
</del><ins>+ for (let i = 0; i < updatedParentTreeElements.length; ++i)
+ updatedParentTreeElements[i].alreadyUpdatedChildren = null;
</ins><span class="cx">
</span><span class="cx"> this._recentlyModifiedNodes = [];
</span><span class="cx"> },
</span></span></pre>
</div>
</div>
</body>
</html>