Title: [193243] branches/safari-601-branch/Source/WebInspectorUI

Diff

Modified: branches/safari-601-branch/Source/WebInspectorUI/ChangeLog (193242 => 193243)


--- branches/safari-601-branch/Source/WebInspectorUI/ChangeLog	2015-12-03 19:01:13 UTC (rev 193242)
+++ branches/safari-601-branch/Source/WebInspectorUI/ChangeLog	2015-12-03 19:01:18 UTC (rev 193243)
@@ -1,5 +1,32 @@
 2015-12-02  Timothy Hatcher  <[email protected]>
 
+        Merge r190521. rdar://problem/23221163
+
+    2015-10-02  Devin Rousso  <[email protected]>
+
+            Web Inspector: Option-Click on a property name in the Computed view should jump to resource view
+            https://bugs.webkit.org/show_bug.cgi?id=149521
+
+            Reviewed by Timothy Hatcher.
+
+            * UserInterface/Models/DOMNodeStyles.js:
+            (WebInspector.DOMNodeStyles.prototype.effectivePropertyForName):
+            Now tries to search for a non-canonical property before falling back to
+            the canonical version.
+
+            * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+            (WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded):
+            If the user option-clicks the goto arrow, it shows the source for the
+            property instead.
+
+            * UserInterface/Views/ComputedStyleDetailsPanel.js:
+            (WebInspector.ComputedStyleDetailsPanel.prototype.cssStyleDeclarationTextEditorShowProperty.delegateShowProperty):
+            (WebInspector.ComputedStyleDetailsPanel.prototype.cssStyleDeclarationTextEditorShowProperty):
+            Attempts to show the source of the given property. Will fallback to
+            highlighting the property in the rules panel.
+
+2015-12-02  Timothy Hatcher  <[email protected]>
+
         Merge r190506. rdar://problem/23221163
 
     2015-10-02  Nikita Vasilyev  <[email protected]>

Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (193242 => 193243)


--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js	2015-12-03 19:01:13 UTC (rev 193242)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js	2015-12-03 19:01:18 UTC (rev 193243)
@@ -306,6 +306,10 @@
 
     effectivePropertyForName(name)
     {
+        var property = this._propertyNameToEffectivePropertyMap[name];
+        if (property)
+            return property;
+
         var canonicalName = WebInspector.cssStyleManager.canonicalNameForPropertyName(name);
         return this._propertyNameToEffectivePropertyMap[canonicalName] || null;
     }

Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (193242 => 193243)


--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-12-03 19:01:13 UTC (rev 193242)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-12-03 19:01:18 UTC (rev 193243)
@@ -967,10 +967,11 @@
                 && !property.implicit && typeof this._delegate.cssStyleDeclarationTextEditorShowProperty === "function") {
 
             var arrowElement = WebInspector.createGoToArrowButton();
+            arrowElement.title = "Option-click to show source";
 
             var delegate = this._delegate;
-            arrowElement.addEventListener("click", function() {
-                delegate.cssStyleDeclarationTextEditorShowProperty(property);
+            arrowElement.addEventListener("click", function(event) {
+                delegate.cssStyleDeclarationTextEditorShowProperty(property, event.altKey);
             });
 
             this._codeMirror.setUniqueBookmark(to, arrowElement);

Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js (193242 => 193243)


--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js	2015-12-03 19:01:13 UTC (rev 193242)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js	2015-12-03 19:01:18 UTC (rev 193243)
@@ -148,10 +148,37 @@
         this._containerRegionsFlowSection.element.classList.remove("hidden");
     }
 
-    cssStyleDeclarationTextEditorShowProperty(property)
+    cssStyleDeclarationTextEditorShowProperty(property, showSource)
     {
-        if (typeof this._delegate.computedStyleDetailsPanelShowProperty === "function")
-            this._delegate.computedStyleDetailsPanelShowProperty(property);
+        function delegateShowProperty() {
+            if (typeof this._delegate.computedStyleDetailsPanelShowProperty === "function")
+                this._delegate.computedStyleDetailsPanelShowProperty(property);
+        }
+
+        if (!showSource) {
+            delegateShowProperty.call(this);
+            return;
+        }
+
+        var effectiveProperty = this._nodeStyles.effectivePropertyForName(property.name);
+        if (!effectiveProperty || !effectiveProperty.styleSheetTextRange) {
+            if (!effectiveProperty.relatedShorthandProperty) {
+                delegateShowProperty.call(this);
+                return;
+            }
+            effectiveProperty = effectiveProperty.relatedShorthandProperty;
+        }
+
+        var ownerRule = effectiveProperty.ownerStyle.ownerRule;
+        if (!ownerRule) {
+            delegateShowProperty.call(this);
+            return;
+        }
+
+        var sourceCode = ownerRule.sourceCodeLocation.sourceCode;
+        var {startLine, startColumn} = effectiveProperty.styleSheetTextRange;
+        var sourceCodeLocation = sourceCode.createSourceCodeLocation(startLine, startColumn);
+        WebInspector.showSourceCodeLocation(sourceCodeLocation);
     }
 
     refresh(significantChange)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to