Title: [184815] trunk/Source/WebInspectorUI
- Revision
- 184815
- Author
- [email protected]
- Date
- 2015-05-22 19:12:50 -0700 (Fri, 22 May 2015)
Log Message
Web Inspector: DOMTree Keyboard Shortcut 'H' to toggle element visibility is not working
https://bugs.webkit.org/show_bug.cgi?id=145331
Patch by Joseph Pecoraro <[email protected]> on 2015-05-22
Reviewed by Brian Burg.
We no longer have CSSProperty.value setters. Instead of attempting
to toggle and clobber inline style values on the element we:
1. inject a <style> on the page like ".WebInspectorHide { visibility:hidden }"
2. toggle the WebInspectorHide class on the selected element
This approach is inspired by the original WebKit change in the
old inspector frontend: <https://webkit.org/b/110641>.
The old approach toggled a few properties (opacity and pointer events)
while the new approach uses visibility, matching other browsers.
* UserInterface/Views/DOMTreeOutline.js:
(WebInspector.DOMTreeOutline.prototype._hideElement.resolvedNode.injectStyleAndToggleClass):
(WebInspector.DOMTreeOutline.prototype._hideElement.resolvedNode):
(WebInspector.DOMTreeOutline.prototype._hideElement):
(WebInspector.DOMTreeOutline.prototype._hideElement.toggleProperties): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (184814 => 184815)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-05-23 02:11:57 UTC (rev 184814)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-05-23 02:12:50 UTC (rev 184815)
@@ -1,3 +1,28 @@
+2015-05-22 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: DOMTree Keyboard Shortcut 'H' to toggle element visibility is not working
+ https://bugs.webkit.org/show_bug.cgi?id=145331
+
+ Reviewed by Brian Burg.
+
+ We no longer have CSSProperty.value setters. Instead of attempting
+ to toggle and clobber inline style values on the element we:
+
+ 1. inject a <style> on the page like ".WebInspectorHide { visibility:hidden }"
+ 2. toggle the WebInspectorHide class on the selected element
+
+ This approach is inspired by the original WebKit change in the
+ old inspector frontend: <https://webkit.org/b/110641>.
+
+ The old approach toggled a few properties (opacity and pointer events)
+ while the new approach uses visibility, matching other browsers.
+
+ * UserInterface/Views/DOMTreeOutline.js:
+ (WebInspector.DOMTreeOutline.prototype._hideElement.resolvedNode.injectStyleAndToggleClass):
+ (WebInspector.DOMTreeOutline.prototype._hideElement.resolvedNode):
+ (WebInspector.DOMTreeOutline.prototype._hideElement):
+ (WebInspector.DOMTreeOutline.prototype._hideElement.toggleProperties): Deleted.
+
2015-05-21 Joseph Pecoraro <[email protected]>
Web Inspector: Give Toolbar buttons an active style
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js (184814 => 184815)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js 2015-05-23 02:11:57 UTC (rev 184814)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js 2015-05-23 02:12:50 UTC (rev 184815)
@@ -556,39 +556,30 @@
if (selectedNode.nodeType() !== Node.ELEMENT_NODE)
return;
- if (this._togglePending)
- return;
- this._togglePending = true;
-
- function toggleProperties()
+ function resolvedNode(object)
{
- nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, toggleProperties, this);
+ if (!object)
+ return;
- var opacityProperty = nodeStyles.inlineStyle.propertyForName("opacity");
- opacityProperty.value = "0";
- opacityProperty.important = true;
+ function injectStyleAndToggleClass()
+ {
+ var hideElementStyleSheetIdOrClassName = "__WebInspectorHideElement__";
+ var styleElement = document.getElementById(hideElementStyleSheetIdOrClassName);
+ if (!styleElement) {
+ styleElement = document.createElement("style");
+ styleElement.id = hideElementStyleSheetIdOrClassName;
+ styleElement.textContent = "." + hideElementStyleSheetIdOrClassName + " { visibility: hidden !important; }";
+ document.head.appendChild(styleElement);
+ }
- var pointerEventsProperty = nodeStyles.inlineStyle.propertyForName("pointer-events");
- pointerEventsProperty.value = "none";
- pointerEventsProperty.important = true;
-
- if (opacityProperty.enabled && pointerEventsProperty.enabled) {
- opacityProperty.remove();
- pointerEventsProperty.remove();
- } else {
- opacityProperty.add();
- pointerEventsProperty.add();
+ this.classList.toggle(hideElementStyleSheetIdOrClassName);
}
- delete this._togglePending;
+ object.callFunction(injectStyleAndToggleClass, undefined, false, function(){});
+ object.release();
}
- var nodeStyles = WebInspector.cssStyleManager.stylesForNode(selectedNode);
- if (nodeStyles.needsRefresh) {
- nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed, toggleProperties, this);
- nodeStyles.refresh();
- } else
- toggleProperties.call(this);
+ WebInspector.RemoteObject.resolveNode(selectedNode, "", resolvedNode);
}
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes