Title: [224434] trunk/Source/WebInspectorUI
Revision
224434
Author
ross.kirsl...@sony.com
Date
2017-11-03 14:53:42 -0700 (Fri, 03 Nov 2017)

Log Message

Web Inspector: Move Show Compositing Borders/Paint Flashing buttons from Elements tab to Layers tab
https://bugs.webkit.org/show_bug.cgi?id=179211

Reviewed by Joseph Pecoraro.

* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView.prototype.get navigationItems):
(WI.DOMTreeContentView.prototype._updateCompositingBordersButtonToMatchPageSettings):
Guard old buttons with experimental flag.

* UserInterface/Views/Layers3DContentView.js:
(WI.Layers3DContentView):
(WI.Layers3DContentView.prototype.get navigationItems):
(WI.Layers3DContentView.prototype.shown):
(WI.Layers3DContentView.prototype.closed):
(WI.Layers3DContentView.prototype._showPaintRectsSettingChanged):
(WI.Layers3DContentView.prototype._togglePaintFlashing):
(WI.Layers3DContentView.prototype._updateCompositingBordersButtonState):
(WI.Layers3DContentView.prototype._toggleCompositingBorders):
Add buttons to new home.
No need to guard for get/setCompositingBordersVisible anymore, as these were introduced in iOS 7.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (224433 => 224434)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-11-03 21:43:32 UTC (rev 224433)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-11-03 21:53:42 UTC (rev 224434)
@@ -1,3 +1,27 @@
+2017-11-03  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        Web Inspector: Move Show Compositing Borders/Paint Flashing buttons from Elements tab to Layers tab
+        https://bugs.webkit.org/show_bug.cgi?id=179211
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WI.DOMTreeContentView.prototype.get navigationItems):
+        (WI.DOMTreeContentView.prototype._updateCompositingBordersButtonToMatchPageSettings):
+        Guard old buttons with experimental flag.
+
+        * UserInterface/Views/Layers3DContentView.js:
+        (WI.Layers3DContentView):
+        (WI.Layers3DContentView.prototype.get navigationItems):
+        (WI.Layers3DContentView.prototype.shown):
+        (WI.Layers3DContentView.prototype.closed):
+        (WI.Layers3DContentView.prototype._showPaintRectsSettingChanged):
+        (WI.Layers3DContentView.prototype._togglePaintFlashing):
+        (WI.Layers3DContentView.prototype._updateCompositingBordersButtonState):
+        (WI.Layers3DContentView.prototype._toggleCompositingBorders):
+        Add buttons to new home.
+        No need to guard for get/setCompositingBordersVisible anymore, as these were introduced in iOS 7.
+
 2017-11-03  Devin Rousso  <web...@devinrousso.com>
 
         Web Inspector: move top-level namespace functions in ImageUtilities to static class

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js (224433 => 224434)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2017-11-03 21:43:32 UTC (rev 224433)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2017-11-03 21:53:42 UTC (rev 224434)
@@ -93,7 +93,11 @@
 
     get navigationItems()
     {
-        return [this._showPrintStylesButtonNavigationItem, this._showsShadowDOMButtonNavigationItem, this._compositingBordersButtonNavigationItem, this._paintFlashingButtonNavigationItem];
+        let items = [this._showPrintStylesButtonNavigationItem, this._showsShadowDOMButtonNavigationItem];
+        if (!WI.settings.experimentalEnableLayersTab.value)
+            items.push(this._compositingBordersButtonNavigationItem, this._paintFlashingButtonNavigationItem);
+
+        return items;
     }
 
     get domTreeOutline()
@@ -516,6 +520,9 @@
 
     _updateCompositingBordersButtonToMatchPageSettings()
     {
+        if (WI.settings.experimentalEnableLayersTab.value)
+            return;
+
         var button = this._compositingBordersButtonNavigationItem;
 
         // We need to sync with the page settings since these can be controlled

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js (224433 => 224434)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js	2017-11-03 21:43:32 UTC (rev 224433)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js	2017-11-03 21:53:42 UTC (rev 224434)
@@ -31,6 +31,17 @@
 
         this.element.classList.add("layers-3d");
 
+        this._compositingBordersButtonNavigationItem = new WI.ActivateButtonNavigationItem("layer-borders", WI.UIString("Show compositing borders"), WI.UIString("Hide compositing borders"), "Images/LayerBorders.svg", 13, 13);
+        this._compositingBordersButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleCompositingBorders, this);
+        this._compositingBordersButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
+
+        WI.showPaintRectsSetting.addEventListener(WI.Setting.Event.Changed, this._showPaintRectsSettingChanged, this);
+        this._paintFlashingButtonNavigationItem = new WI.ActivateButtonNavigationItem("paint-flashing", WI.UIString("Enable paint flashing"), WI.UIString("Disable paint flashing"), "Images/Paint.svg", 16, 16);
+        this._paintFlashingButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._togglePaintFlashing, this);
+        this._paintFlashingButtonNavigationItem.enabled = !!PageAgent.setShowPaintRects;
+        this._paintFlashingButtonNavigationItem.activated = PageAgent.setShowPaintRects && WI.showPaintRectsSetting.value;
+        this._paintFlashingButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
+
         WI.layerTreeManager.addEventListener(WI.LayerTreeManager.Event.LayerTreeDidChange, this._layerTreeDidChange, this);
 
         this._layers = [];
@@ -51,6 +62,11 @@
 
     // Public
 
+    get navigationItems()
+    {
+        return [this._compositingBordersButtonNavigationItem, this._paintFlashingButtonNavigationItem];
+    }
+
     get supplementalRepresentedObjects()
     {
         return this._layers;
@@ -60,6 +76,8 @@
     {
         super.shown();
 
+        this._updateCompositingBordersButtonState();
+
         if (this._layersChangedWhileHidden) {
             this._layersChangedWhileHidden = false;
 
@@ -79,6 +97,7 @@
 
     closed()
     {
+        WI.showPaintRectsSetting.removeEventListener(WI.Setting.Event.Changed, this._showPaintRectsSettingChanged, this);
         WI.layerTreeManager.removeEventListener(WI.LayerTreeManager.Event.LayerTreeDidChange, this._layerTreeDidChange, this);
 
         super.closed();
@@ -324,6 +343,35 @@
         this._controls.target.add(delta);
         this._camera.position.add(delta);
     }
+
+    _showPaintRectsSettingChanged(event)
+    {
+        console.assert(PageAgent.setShowPaintRects);
+
+        this._paintFlashingButtonNavigationItem.activated = WI.showPaintRectsSetting.value;
+        PageAgent.setShowPaintRects(this._paintFlashingButtonNavigationItem.activated);
+    }
+
+    _togglePaintFlashing(event)
+    {
+        WI.showPaintRectsSetting.value = !WI.showPaintRectsSetting.value;
+    }
+
+    _updateCompositingBordersButtonState()
+    {
+        // This value can be changed outside of Web Inspector.
+        // FIXME: Have PageAgent dispatch a change event instead?
+        PageAgent.getCompositingBordersVisible((error, compositingBordersVisible) => {
+            this._compositingBordersButtonNavigationItem.activated = error ? false : compositingBordersVisible;
+            this._compositingBordersButtonNavigationItem.enabled = error !== "unsupported";
+        });
+    }
+
+    _toggleCompositingBorders(event)
+    {
+        this._compositingBordersButtonNavigationItem.activated = !this._compositingBordersButtonNavigationItem.activated;
+        PageAgent.setCompositingBordersVisible(this._compositingBordersButtonNavigationItem.activated);
+    }
 };
 
 WI.Layers3DContentView._zPadding = 3000;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to