Web Inspector: Paint Flashing button does not match page state after reload
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Oct 2014 04:43:53 +0000 (04:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Oct 2014 04:43:53 +0000 (04:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137680

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-10-13
Reviewed by Timothy Hatcher.

* UserInterface/Base/Main.js:
(WebInspector.loaded):
Make paint flashing a frontend setting. Enable it when the inspector
is opened if it was previously enabled.

* UserInterface/Views/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView):
(WebInspector.DOMTreeContentView.prototype._togglePaintFlashing):
(WebInspector.DOMTreeContentView.prototype._showPaintRectsSettingChanged):
Have the paint flashing button always match the global setting.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174670 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js

index 5cb6aae..69366b6 100644 (file)
@@ -1,5 +1,23 @@
 2014-10-13  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Paint Flashing button does not match page state after reload
+        https://bugs.webkit.org/show_bug.cgi?id=137680
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.loaded):
+        Make paint flashing a frontend setting. Enable it when the inspector
+        is opened if it was previously enabled.
+
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WebInspector.DOMTreeContentView):
+        (WebInspector.DOMTreeContentView.prototype._togglePaintFlashing):
+        (WebInspector.DOMTreeContentView.prototype._showPaintRectsSettingChanged):
+        Have the paint flashing button always match the global setting.
+
+2014-10-13  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: Improve appearance of alpha color swatches
         https://bugs.webkit.org/show_bug.cgi?id=137627
 
index eb8f551..011f377 100644 (file)
@@ -163,9 +163,13 @@ WebInspector.loaded = function()
     this.showReplayInterfaceSetting = new WebInspector.Setting("show-web-replay", false);
 
     this.showJavaScriptTypeInformationSetting = new WebInspector.Setting("show-javascript-type-information", false);
-    if (this.showJavaScriptTypeInformationSetting.value)
+    if (this.showJavaScriptTypeInformationSetting.value && RuntimeAgent && RuntimeAgent.enableTypeProfiler)
         RuntimeAgent.enableTypeProfiler();
 
+    this.showPaintRectsSetting = new WebInspector.Setting("show-paint-rects", false);
+    if (this.showPaintRectsSetting.value && PageAgent && PageAgent.setShowPaintRects)
+        PageAgent.setShowPaintRects(true);
+
     this.mouseCoords = {
         x: 0,
         y: 0
index 828c2b8..3bd3072 100644 (file)
@@ -42,9 +42,11 @@ WebInspector.DOMTreeContentView = function(representedObject)
     this._compositingBordersButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleCompositingBorders, this);
     this._compositingBordersButtonNavigationItem.enabled = !!PageAgent.getCompositingBordersVisible;
 
+    WebInspector.showPaintRectsSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showPaintRectsSettingChanged, this);
     this._paintFlashingButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("paint-flashing", WebInspector.UIString("Enable paint flashing"), WebInspector.UIString("Disable paint flashing"), "Images/PaintFlashing.svg", 16, 16);
     this._paintFlashingButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._togglePaintFlashing, this);
-    this._paintFlashingButtonNavigationItem.enabled = true;
+    this._paintFlashingButtonNavigationItem.enabled = !!PageAgent.setShowPaintRects;
+    this._paintFlashingButtonNavigationItem.activated = PageAgent.setShowPaintRects && WebInspector.showPaintRectsSetting.value;
 
     WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed, this._showShadowDOMSettingChanged, this);
     this._showsShadowDOMButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("shows-shadow-DOM", WebInspector.UIString("Show shadow DOM nodes"), WebInspector.UIString("Hide shadow DOM nodes"), shadowDOMImage.src, shadowDOMImage.width, shadowDOMImage.height);
@@ -430,11 +432,7 @@ WebInspector.DOMTreeContentView.prototype = {
 
     _togglePaintFlashing: function(event)
     {
-        console.assert(PageAgent.setShowPaintRects);
-
-        var activated = !this._paintFlashingButtonNavigationItem.activated;
-        this._paintFlashingButtonNavigationItem.activated = activated;
-        PageAgent.setShowPaintRects(activated);
+        WebInspector.showPaintRectsSetting.value = !WebInspector.showPaintRectsSetting.value;
     },
 
     _updateCompositingBordersButtonToMatchPageSettings: function()
@@ -451,6 +449,15 @@ WebInspector.DOMTreeContentView.prototype = {
         });
     },
 
+    _showPaintRectsSettingChanged: function(event)
+    {
+        console.assert(PageAgent.setShowPaintRects);
+
+        this._paintFlashingButtonNavigationItem.activated = WebInspector.showPaintRectsSetting.value;
+
+        PageAgent.setShowPaintRects(this._paintFlashingButtonNavigationItem.activated);
+    },
+
     _showShadowDOMSettingChanged: function(event)
     {
         this._showsShadowDOMButtonNavigationItem.activated = WebInspector.showShadowDOMSetting.value;