Title: [190521] trunk/Source/WebInspectorUI
- Revision
- 190521
- Author
- [email protected]
- Date
- 2015-10-02 14:11:47 -0700 (Fri, 02 Oct 2015)
Log Message
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
Patch by Devin Rousso <[email protected]> on 2015-10-02
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.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (190520 => 190521)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-10-02 20:40:47 UTC (rev 190520)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-10-02 21:11:47 UTC (rev 190521)
@@ -1,3 +1,26 @@
+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-10-02 Joseph Pecoraro <[email protected]>
Web Inspector: Include Garbage Collection Event in Timeline
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (190520 => 190521)
--- trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2015-10-02 20:40:47 UTC (rev 190520)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js 2015-10-02 21:11:47 UTC (rev 190521)
@@ -306,7 +306,11 @@
effectivePropertyForName(name)
{
- var canonicalName = WebInspector.cssStyleManager.canonicalNameForPropertyName(name);
+ let property = this._propertyNameToEffectivePropertyMap[name];
+ if (property)
+ return property;
+
+ let canonicalName = WebInspector.cssStyleManager.canonicalNameForPropertyName(name);
return this._propertyNameToEffectivePropertyMap[canonicalName] || null;
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (190520 => 190521)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-10-02 20:40:47 UTC (rev 190520)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js 2015-10-02 21:11:47 UTC (rev 190521)
@@ -966,11 +966,12 @@
} else if (this._delegate.cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows
&& !property.implicit && typeof this._delegate.cssStyleDeclarationTextEditorShowProperty === "function") {
- var arrowElement = WebInspector.createGoToArrowButton();
+ let arrowElement = WebInspector.createGoToArrowButton();
+ arrowElement.title = "Option-click to show source";
- var delegate = this._delegate;
- arrowElement.addEventListener("click", function() {
- delegate.cssStyleDeclarationTextEditorShowProperty(property);
+ let delegate = this._delegate;
+ arrowElement.addEventListener("click", function(event) {
+ delegate.cssStyleDeclarationTextEditorShowProperty(property, event.altKey);
});
this._codeMirror.setUniqueBookmark(to, arrowElement);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js (190520 => 190521)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js 2015-10-02 20:40:47 UTC (rev 190520)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ComputedStyleDetailsPanel.js 2015-10-02 21:11:47 UTC (rev 190521)
@@ -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;
+ }
+
+ let effectiveProperty = this._nodeStyles.effectivePropertyForName(property.name);
+ if (!effectiveProperty || !effectiveProperty.styleSheetTextRange) {
+ if (!effectiveProperty.relatedShorthandProperty) {
+ delegateShowProperty.call(this);
+ return;
+ }
+ effectiveProperty = effectiveProperty.relatedShorthandProperty;
+ }
+
+ let ownerRule = effectiveProperty.ownerStyle.ownerRule;
+ if (!ownerRule) {
+ delegateShowProperty.call(this);
+ return;
+ }
+
+ let sourceCode = ownerRule.sourceCodeLocation.sourceCode;
+ let {startLine, startColumn} = effectiveProperty.styleSheetTextRange;
+ let sourceCodeLocation = sourceCode.createSourceCodeLocation(startLine, startColumn);
+ WebInspector.showSourceCodeLocation(sourceCodeLocation);
}
refresh(significantChange)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes