Web Inspector: Reduce QuickConsole DidResize events if it did not change
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2015 00:29:11 +0000 (00:29 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Jun 2015 00:29:11 +0000 (00:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146258

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-06-23
Reviewed by Timothy Hatcher.

* UserInterface/Views/QuickConsole.js:
(WebInspector.QuickConsole.prototype.consoleLogVisibilityChanged):
Do not trigger the event unless there was a change in visibility.

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/QuickConsole.js

index 786bfec..4ecdbed 100644 (file)
@@ -1,5 +1,16 @@
 2015-06-23  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Reduce QuickConsole DidResize events if it did not change
+        https://bugs.webkit.org/show_bug.cgi?id=146258
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/QuickConsole.js:
+        (WebInspector.QuickConsole.prototype.consoleLogVisibilityChanged):
+        Do not trigger the event unless there was a change in visibility.
+
+2015-06-23  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: TextEditor scroll position not correctly restored when switching tabs
         https://bugs.webkit.org/show_bug.cgi?id=146254
 
index 99090ef..304039d 100644 (file)
@@ -105,10 +105,10 @@ WebInspector.QuickConsole = class QuickConsole extends WebInspector.Object
 
     consoleLogVisibilityChanged(visible)
     {
-        if (visible)
-            this.element.classList.add(WebInspector.QuickConsole.ShowingLogClassName);
-        else
-            this.element.classList.remove(WebInspector.QuickConsole.ShowingLogClassName);
+        if (visible === this.element.classList.contains(WebInspector.QuickConsole.ShowingLogClassName))
+            return;
+
+        this.element.classList.toggle(WebInspector.QuickConsole.ShowingLogClassName, visible);
 
         this.dispatchEventToListeners(WebInspector.QuickConsole.Event.DidResize);
     }