<!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>[184977] 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/184977">184977</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-28 21:47:39 -0700 (Thu, 28 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Jump from a computed style to the rule it came from
https://bugs.webkit.org/show_bug.cgi?id=120640
Patch by Devin Rousso <drousso@apple.com> on 2015-05-28
Reviewed by Timothy Hatcher.
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded):
If the delegate of CSSStyleDeclarationTextEditor has cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows set to true, add a goToArrow to all CSS property entries.
(WebInspector.CSSStyleDeclarationTextEditor.prototype.highlightProperty.propertiesMatch):
(WebInspector.CSSStyleDeclarationTextEditor.prototype.highlightProperty.hasMatchingLonghandProperty):
(WebInspector.CSSStyleDeclarationTextEditor.prototype.highlightProperty):
Determines if a given CSS property is in the CSS style section and if so, select that CSS property, focus on the section containing that CSS property, and return true.
* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection.prototype.highlightProperty):
Searches through the properties of the section for a given property and scrolls to it if found.
* UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
(WebInspector.CSSStyleDetailsSidebarPanel.prototype.computedStyleDetailsPanelShowProperty):
Switches to the rulesStyleDetailsPanel and scrolls to and hightlights a given property in that panel.
(WebInspector.CSSStyleDetailsSidebarPanel.prototype._navigationItemSelected):
(WebInspector.CSSStyleDetailsSidebarPanel.prototype._switchPanels):
Moved this function out of _navigationItemSelected for better reusablity.
* UserInterface/Views/ComputedStyleDetailsPanel.js:
(WebInspector.ComputedStyleDetailsPanel.prototype.cssStyleDeclarationTextEditorShowProperty):
Function that calls the delegate (which should be CSSStyleDetailsSidebarPanel) function computedStyleDetailsPanelShowProperty.
* UserInterface/Views/RulesStyleDetailsPanel.js:
(WebInspector.RulesStyleDetailsPanel):
(WebInspector.RulesStyleDetailsPanel.prototype.refresh):
(WebInspector.RulesStyleDetailsPanel.prototype.scrollToSectionAndHighlightProperty):
Searches through all the sections of the RulesStyleDetailsPanel for a given CSS property.
(WebInspector.RulesStyleDetailsPanel.prototype.shown):
(WebInspector.RulesStyleDetailsPanel.prototype.hidden):
(WebInspector.RulesStyleDetailsPanel.prototype.nodeStylesRefreshed):
Added a flag to this function that will highlight and scroll to a given property (_propertyToSelectAndHighlight) if set on load.
* UserInterface/Views/StyleDetailsPanel.js:
(WebInspector.StyleDetailsPanel.prototype.markAsNeedsRefresh):
(WebInspector.StyleDetailsPanel.prototype.nodeStylesRefreshed):
Made into protected function to allow it to be overridden.
(WebInspector.StyleDetailsPanel.prototype._nodeStylesRefreshed): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectionjs">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationTextEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDetailsSidebarPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsComputedStyleDetailsPanelcss">trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsComputedStyleDetailsPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsRulesStyleDetailsPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsStyleDetailsPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (184976 => 184977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-05-29 04:30:09 UTC (rev 184976)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-05-29 04:47:39 UTC (rev 184977)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2015-05-28 Devin Rousso <drousso@apple.com>
+
+ Web Inspector: Jump from a computed style to the rule it came from
+ https://bugs.webkit.org/show_bug.cgi?id=120640
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded):
+ If the delegate of CSSStyleDeclarationTextEditor has cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows set to true, add a goToArrow to all CSS property entries.
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype.highlightProperty.propertiesMatch):
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype.highlightProperty.hasMatchingLonghandProperty):
+ (WebInspector.CSSStyleDeclarationTextEditor.prototype.highlightProperty):
+ Determines if a given CSS property is in the CSS style section and if so, select that CSS property, focus on the section containing that CSS property, and return true.
+ * UserInterface/Views/CSSStyleDeclarationSection.js:
+ (WebInspector.CSSStyleDeclarationSection.prototype.highlightProperty):
+ Searches through the properties of the section for a given property and scrolls to it if found.
+ * UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
+ (WebInspector.CSSStyleDetailsSidebarPanel.prototype.computedStyleDetailsPanelShowProperty):
+ Switches to the rulesStyleDetailsPanel and scrolls to and hightlights a given property in that panel.
+ (WebInspector.CSSStyleDetailsSidebarPanel.prototype._navigationItemSelected):
+ (WebInspector.CSSStyleDetailsSidebarPanel.prototype._switchPanels):
+ Moved this function out of _navigationItemSelected for better reusablity.
+ * UserInterface/Views/ComputedStyleDetailsPanel.js:
+ (WebInspector.ComputedStyleDetailsPanel.prototype.cssStyleDeclarationTextEditorShowProperty):
+ Function that calls the delegate (which should be CSSStyleDetailsSidebarPanel) function computedStyleDetailsPanelShowProperty.
+ * UserInterface/Views/RulesStyleDetailsPanel.js:
+ (WebInspector.RulesStyleDetailsPanel):
+ (WebInspector.RulesStyleDetailsPanel.prototype.refresh):
+ (WebInspector.RulesStyleDetailsPanel.prototype.scrollToSectionAndHighlightProperty):
+ Searches through all the sections of the RulesStyleDetailsPanel for a given CSS property.
+ (WebInspector.RulesStyleDetailsPanel.prototype.shown):
+ (WebInspector.RulesStyleDetailsPanel.prototype.hidden):
+ (WebInspector.RulesStyleDetailsPanel.prototype.nodeStylesRefreshed):
+ Added a flag to this function that will highlight and scroll to a given property (_propertyToSelectAndHighlight) if set on load.
+ * UserInterface/Views/StyleDetailsPanel.js:
+ (WebInspector.StyleDetailsPanel.prototype.markAsNeedsRefresh):
+ (WebInspector.StyleDetailsPanel.prototype.nodeStylesRefreshed):
+ Made into protected function to allow it to be overridden.
+ (WebInspector.StyleDetailsPanel.prototype._nodeStylesRefreshed): Deleted.
+
</ins><span class="cx"> 2015-05-28 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Should have a keyboard shortcut to switch between inspector tabs
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectionjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (184976 => 184977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js        2015-05-29 04:30:09 UTC (rev 184976)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js        2015-05-29 04:47:39 UTC (rev 184977)
</span><span class="lines">@@ -260,6 +260,16 @@
</span><span class="cx"> }
</span><span class="cx"> },
</span><span class="cx">
</span><ins>+ highlightProperty: function(property)
+ {
+ if (this._propertiesTextEditor.highlightProperty(property)) {
+ this._element.scrollIntoView();
+ return true;
+ }
+
+ return false;
+ },
+
</ins><span class="cx"> updateLayout: function()
</span><span class="cx"> {
</span><span class="cx"> this._propertiesTextEditor.updateLayout();
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationTextEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (184976 => 184977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js        2015-05-29 04:30:09 UTC (rev 184976)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js        2015-05-29 04:47:39 UTC (rev 184977)
</span><span class="lines">@@ -181,6 +181,46 @@
</span><span class="cx"> this._codeMirror.refresh();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ highlightProperty(property)
+ {
+ function propertiesMatch(cssProperty)
+ {
+ if (cssProperty.enabled && !cssProperty.overridden) {
+ if (cssProperty.canonicalName === property.canonicalName || hasMatchingLonghandProperty(cssProperty))
+ return true;
+ }
+
+ return false;
+ }
+
+ function hasMatchingLonghandProperty(cssProperty)
+ {
+ var cssProperties = cssProperty.relatedLonghandProperties;
+
+ if (!cssProperties.length)
+ return false;
+
+ for (var property of cssProperties) {
+ if (propertiesMatch(property))
+ return true;
+ }
+
+ return false;
+ }
+
+ for (var cssProperty of this.style.properties) {
+ if (propertiesMatch(cssProperty)) {
+ var selection = cssProperty.__propertyTextMarker.find();
+ this._codeMirror.setSelection(selection.from, selection.to);
+ this.focus();
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
</ins><span class="cx"> // Protected
</span><span class="cx">
</span><span class="cx"> didDismissPopover(popover)
</span><span class="lines">@@ -437,6 +477,17 @@
</span><span class="cx">
</span><span class="cx"> var checkboxMarker = this._codeMirror.setUniqueBookmark(from, checkboxElement);
</span><span class="cx"> checkboxMarker.__propertyCheckbox = true;
</span><ins>+ } else if (this._delegate.cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows
+ && !property.implicit && typeof this._delegate.cssStyleDeclarationTextEditorShowProperty === "function") {
+
+ var arrowElement = WebInspector.createGoToArrowButton();
+
+ var delegate = this._delegate;
+ arrowElement.addEventListener("click", function() {
+ delegate.cssStyleDeclarationTextEditorShowProperty(property);
+ });
+
+ this._codeMirror.setUniqueBookmark(to, arrowElement);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> var classNames = ["css-style-declaration-property"];
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDetailsSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js (184976 => 184977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js        2015-05-29 04:30:09 UTC (rev 184976)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js        2015-05-29 04:47:39 UTC (rev 184977)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx"> this.contentElement.appendChild(this._forcedPseudoClassContainer);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- this._computedStyleDetailsPanel = new WebInspector.ComputedStyleDetailsPanel;
</del><ins>+ this._computedStyleDetailsPanel = new WebInspector.ComputedStyleDetailsPanel(this);
</ins><span class="cx"> this._rulesStyleDetailsPanel = new WebInspector.RulesStyleDetailsPanel;
</span><span class="cx"> this._metricsStyleDetailsPanel = new WebInspector.MetricsStyleDetailsPanel;
</span><span class="cx">
</span><span class="lines">@@ -137,6 +137,14 @@
</span><span class="cx"> this._selectedPanel.widthDidChange();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ computedStyleDetailsPanelShowProperty(property)
+ {
+ this._rulesStyleDetailsPanel.scrollToSectionAndHighlightProperty(property);
+ this._switchPanels(this._rulesStyleDetailsPanel);
+
+ this._navigationBar.selectedNavigationItem = this._lastSelectedSectionSetting.value;
+ }
+
</ins><span class="cx"> // Protected
</span><span class="cx">
</span><span class="cx"> addEventListeners()
</span><span class="lines">@@ -180,6 +188,11 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ this._switchPanels(selectedPanel);
+ }
+
+ _switchPanels(selectedPanel)
+ {
</ins><span class="cx"> console.assert(selectedPanel);
</span><span class="cx">
</span><span class="cx"> if (this._selectedPanel) {
</span><span class="lines">@@ -201,7 +214,7 @@
</span><span class="cx"> this._selectedPanel.shown();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- this._lastSelectedSectionSetting.value = selectedNavigationItem.identifier;
</del><ins>+ this._lastSelectedSectionSetting.value = selectedPanel.navigationItem.identifier;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> _forcedPseudoClassCheckboxChanged(pseudoClass, event)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsComputedStyleDetailsPanelcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.css (184976 => 184977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.css        2015-05-29 04:30:09 UTC (rev 184976)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.css        2015-05-29 04:47:39 UTC (rev 184977)
</span><span class="lines">@@ -35,3 +35,15 @@
</span><span class="cx"> {
</span><span class="cx"> vertical-align: top;
</span><span class="cx"> }
</span><ins>+
+.details-section > .content > .group > .row .CodeMirror-code pre .go-to-arrow {
+ display: none;
+ position: absolute;
+ width: 12px;
+ height: 10px;
+ vertical-align: text-bottom;
+}
+
+.details-section > .content > .group > .row .CodeMirror-code pre:hover .go-to-arrow {
+ display: initial;
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsComputedStyleDetailsPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js (184976 => 184977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js        2015-05-29 04:30:09 UTC (rev 184976)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js        2015-05-29 04:47:39 UTC (rev 184977)
</span><span class="lines">@@ -25,10 +25,12 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.ComputedStyleDetailsPanel = class ComputedStyleDetailsPanel extends WebInspector.StyleDetailsPanel
</span><span class="cx"> {
</span><del>- constructor()
</del><ins>+ constructor(delegate)
</ins><span class="cx"> {
</span><span class="cx"> super(WebInspector.ComputedStyleDetailsPanel.StyleClassName, "computed", WebInspector.UIString("Computed"));
</span><span class="cx">
</span><ins>+ this._delegate = delegate || null;
+
</ins><span class="cx"> this._computedStyleShowAllSetting = new WebInspector.Setting("computed-style-show-all", false);
</span><span class="cx">
</span><span class="cx"> var computedStyleShowAllLabel = document.createElement("label");
</span><span class="lines">@@ -88,6 +90,8 @@
</span><span class="cx"> this.element.appendChild(this._containerRegionsFlowSection.element);
</span><span class="cx">
</span><span class="cx"> this._resetFlowDetails();
</span><ins>+
+ this.cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows = true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="lines">@@ -139,6 +143,12 @@
</span><span class="cx"> this._containerRegionsFlowSection.element.classList.remove("hidden");
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ cssStyleDeclarationTextEditorShowProperty(property)
+ {
+ if (typeof this._delegate.computedStyleDetailsPanelShowProperty === "function")
+ this._delegate.computedStyleDetailsPanelShowProperty(property);
+ }
+
</ins><span class="cx"> refresh()
</span><span class="cx"> {
</span><span class="cx"> this._propertiesTextEditor.style = this.nodeStyles.computedStyle;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsRulesStyleDetailsPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js (184976 => 184977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js        2015-05-29 04:30:09 UTC (rev 184976)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js        2015-05-29 04:47:39 UTC (rev 184977)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> super("rules", "rules", WebInspector.UIString("Rules"));
</span><span class="cx">
</span><span class="cx"> this._sections = [];
</span><ins>+ this._propertyToSelectAndHighlight = null;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="lines">@@ -241,11 +242,26 @@
</span><span class="cx"> previousFocusedSection.focus();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ scrollToSectionAndHighlightProperty(property)
+ {
+ if (!this._visible) {
+ this._propertyToSelectAndHighlight = property;
+ return false;
+ }
+
+ for (var section of this._sections) {
+ if (section.highlightProperty(property))
+ return true;
+ }
+
+ return false;
+ }
+
</ins><span class="cx"> // Protected
</span><span class="cx">
</span><span class="cx"> shown()
</span><span class="cx"> {
</span><del>- WebInspector.StyleDetailsPanel.prototype.shown.call(this);
</del><ins>+ super.shown();
</ins><span class="cx">
</span><span class="cx"> // Associate the style and section objects so they can be reused.
</span><span class="cx"> // Also update the layout in case we changed widths while hidden.
</span><span class="lines">@@ -258,7 +274,7 @@
</span><span class="cx">
</span><span class="cx"> hidden()
</span><span class="cx"> {
</span><del>- WebInspector.StyleDetailsPanel.prototype.hidden.call(this);
</del><ins>+ super.hidden();
</ins><span class="cx">
</span><span class="cx"> // Disconnect the style and section objects so they have a chance
</span><span class="cx"> // to release their objects when this panel is not visible.
</span><span class="lines">@@ -272,6 +288,16 @@
</span><span class="cx"> this._sections[i].updateLayout();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ nodeStylesRefreshed(event)
+ {
+ super.nodeStylesRefreshed(event);
+
+ if (this._propertyToSelectAndHighlight) {
+ this.scrollToSectionAndHighlightProperty(this._propertyToSelectAndHighlight);
+ this._propertyToSelectAndHighlight = null;
+ }
+ }
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _newRuleClicked(event)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsStyleDetailsPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js (184976 => 184977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js        2015-05-29 04:30:09 UTC (rev 184976)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js        2015-05-29 04:47:39 UTC (rev 184977)
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx">
</span><span class="cx"> if (!this._nodeStyles || this._nodeStyles.node !== domNode) {
</span><span class="cx"> if (this._nodeStyles) {
</span><del>- this._nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, this._nodeStylesRefreshed, this);
</del><ins>+ this._nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, this.nodeStylesRefreshed, this);
</ins><span class="cx"> this._nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.NeedsRefresh, this._nodeStylesNeedsRefreshed, this);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx"> if (!this._nodeStyles)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- this._nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, this._nodeStylesRefreshed, this);
</del><ins>+ this._nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, this.nodeStylesRefreshed, this);
</ins><span class="cx"> this._nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.NeedsRefresh, this._nodeStylesNeedsRefreshed, this);
</span><span class="cx">
</span><span class="cx"> this._forceSignificantChange = true;
</span><span class="lines">@@ -111,6 +111,14 @@
</span><span class="cx"> // Implemented by subclasses.
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // Protected
+
+ nodeStylesRefreshed(event)
+ {
+ if (this._visible)
+ this._refreshPreservingScrollPosition(event.data.significantChange);
+ }
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> get _initialScrollOffset()
</span><span class="lines">@@ -146,12 +154,6 @@
</span><span class="cx"> this.element.parentNode.scrollTop = previousScrollTop;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- _nodeStylesRefreshed(event)
- {
- if (this._visible)
- this._refreshPreservingScrollPosition(event.data.significantChange);
- }
-
</del><span class="cx"> _nodeStylesNeedsRefreshed(event)
</span><span class="cx"> {
</span><span class="cx"> if (this._visible)
</span></span></pre>
</div>
</div>
</body>
</html>