Web Inspector: add checkbox for continuous painting to the inspector's settings
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 09:03:59 +0000 (09:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 09:03:59 +0000 (09:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107352

Patch by Eberhard Graether <egraether@google.com> on 2013-01-25
Reviewed by Pavel Feldman.

This change adds a checkbox to activate continuous painting to the WebInspector's
rendering settings and plumbs the setting to Chromium's WebLayerTreeView. The
setting is visible if InspectorClient::canContinuouslyPaint() returns true.

Source/Platform:

* chromium/public/WebLayerTreeView.h:
(WebLayerTreeView):
(WebKit::WebLayerTreeView::setContinuousPaintingEnabled):

Source/WebCore:

No new tests.

* English.lproj/localizedStrings.js:
* inspector/Inspector.json:
* inspector/InspectorClient.h:
(WebCore::InspectorClient::canContinuouslyPaint):
(WebCore::InspectorClient::setContinuousPaintingEnabled):
(InspectorClient):
* inspector/InspectorPageAgent.cpp:
(PageAgentState):
(WebCore::InspectorPageAgent::restore):
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::canContinuouslyPaint):
(WebCore):
(WebCore::InspectorPageAgent::setContinuousPaintingEnabled):
* inspector/InspectorPageAgent.h:
* inspector/front-end/Settings.js:
* inspector/front-end/SettingsScreen.js:
(WebInspector.GenericSettingsTab):
(WebInspector.GenericSettingsTab.prototype.get _continuousPaintingChanged):
* inspector/front-end/inspector.js:
(WebInspector.doLoadedDone):

Source/WebKit/chromium:

* public/WebView.h:
(WebView):
* src/InspectorClientImpl.cpp:
(WebKit::InspectorClientImpl::canContinuouslyPaint):
(WebKit):
(WebKit::InspectorClientImpl::setContinuousPaintingEnabled):
* src/InspectorClientImpl.h:
(InspectorClientImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::setContinuousPaintingEnabled):
(WebKit):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
* src/WebViewImpl.h:

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

17 files changed:
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebLayerTreeView.h
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/Inspector.json
Source/WebCore/inspector/InspectorClient.h
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.h
Source/WebCore/inspector/front-end/Settings.js
Source/WebCore/inspector/front-end/SettingsScreen.js
Source/WebCore/inspector/front-end/inspector.js
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebView.h
Source/WebKit/chromium/src/InspectorClientImpl.cpp
Source/WebKit/chromium/src/InspectorClientImpl.h
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h

index c732587bce4a99d26bb12779380360f15d68c630..bb7d5aa3144c3eef3707c2ae40f6224c5991251a 100644 (file)
@@ -1,3 +1,18 @@
+2013-01-25  Eberhard Graether  <egraether@google.com>
+
+        Web Inspector: add checkbox for continuous painting to the inspector's settings
+        https://bugs.webkit.org/show_bug.cgi?id=107352
+
+        Reviewed by Pavel Feldman.
+
+        This change adds a checkbox to activate continuous painting to the WebInspector's
+        rendering settings and plumbs the setting to Chromium's WebLayerTreeView. The
+        setting is visible if InspectorClient::canContinuouslyPaint() returns true.
+
+        * chromium/public/WebLayerTreeView.h:
+        (WebLayerTreeView):
+        (WebKit::WebLayerTreeView::setContinuousPaintingEnabled):
+
 2013-01-22  Nat Duca  <nduca@chromium.org>
 
         [chromium] Add WebDiscardableMemory to platform
index 3f82b0bd0a27e29dd5b83de3c6ddb17a163851db..6354702f128a7d14e066885685e404f559db372b 100644 (file)
@@ -183,6 +183,9 @@ public:
     // Toggles the paint rects in the HUD layer
     virtual void setShowPaintRects(bool) { }
 
+    // Toggles continuous painting
+    virtual void setContinuousPaintingEnabled(bool) { }
+
     // FIXME: Remove this.
     virtual void loseCompositorContext(int numTimes) { }
 };
index 05074d4f509a2e7c9ebe8356973de4281560ebb3..d566d9c4c04e8cf0d6a99f28a6df38d4128d4424 100644 (file)
@@ -1,3 +1,37 @@
+2013-01-25  Eberhard Graether  <egraether@google.com>
+
+        Web Inspector: add checkbox for continuous painting to the inspector's settings
+        https://bugs.webkit.org/show_bug.cgi?id=107352
+
+        Reviewed by Pavel Feldman.
+
+        This change adds a checkbox to activate continuous painting to the WebInspector's
+        rendering settings and plumbs the setting to Chromium's WebLayerTreeView. The
+        setting is visible if InspectorClient::canContinuouslyPaint() returns true.
+
+        No new tests.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/Inspector.json:
+        * inspector/InspectorClient.h:
+        (WebCore::InspectorClient::canContinuouslyPaint):
+        (WebCore::InspectorClient::setContinuousPaintingEnabled):
+        (InspectorClient):
+        * inspector/InspectorPageAgent.cpp:
+        (PageAgentState):
+        (WebCore::InspectorPageAgent::restore):
+        (WebCore::InspectorPageAgent::disable):
+        (WebCore::InspectorPageAgent::canContinuouslyPaint):
+        (WebCore):
+        (WebCore::InspectorPageAgent::setContinuousPaintingEnabled):
+        * inspector/InspectorPageAgent.h:
+        * inspector/front-end/Settings.js:
+        * inspector/front-end/SettingsScreen.js:
+        (WebInspector.GenericSettingsTab):
+        (WebInspector.GenericSettingsTab.prototype.get _continuousPaintingChanged):
+        * inspector/front-end/inspector.js:
+        (WebInspector.doLoadedDone):
+
 2013-01-25  Dominic Mazzoni  <dmazzoni@google.com>
 
         REGRESSION (r140658): Multiple accessibility failures on GTK
index 5652d3a3f853226166781f907d592322d2249fd0..2bbc422f653888a8c58ab1a26d3eae9c3d237259 100644 (file)
@@ -180,6 +180,7 @@ localizedStrings["Emulate CSS media"] = "Emulate CSS media";
 localizedStrings["Emulate touch events"] = "Emulate touch events";
 localizedStrings["Enable Breakpoint"] = "Enable Breakpoint";
 localizedStrings["Enable breakpoint"] = "Enable breakpoint";
+localizedStrings["Enable continuous page repainting"] = "Enable continuous page repainting";
 localizedStrings["Enable Debugging"] = "Enable Debugging";
 localizedStrings["Enable Profiling"] = "Enable Profiling";
 localizedStrings["Enabling debugging will make scripts run slower."] = "Enabling debugging will make scripts run slower.";
index 61fadd451dc58a17c4bb892c34a3f3654c21792c..d9a2bbc51f3b4fdbbee9dec7069b3d5a85ebda68 100644 (file)
                 ],
                 "hidden": true
             },
+            {
+                "name": "canContinuouslyPaint",
+                "description": "Tells if backend supports continuous painting",
+                "returns": [
+                    { "name": "value", "type": "boolean", "description": "True if continuous painting is available" }
+                ],
+                "hidden": true
+            },
+            {
+                "name": "setContinuousPaintingEnabled",
+                "description": "Requests that backend enables continuous painting",
+                "parameters": [
+                    { "name": "enabled", "type": "boolean", "description": "True for enabling cointinuous painting" }
+                ],
+                "hidden": true
+            },
             {
                 "name": "getScriptExecutionStatus",
                 "description": "Determines if scripts can be executed in the page.",
index 948df028cb769a3431a6121ebb983073c0b05b97..0f28ebc9255996eabf9513d5e2273bdd4c8a0cfe 100644 (file)
@@ -76,6 +76,9 @@ public:
     virtual bool canShowFPSCounter() { return false; }
     virtual void setShowFPSCounter(bool) { }
 
+    virtual bool canContinuouslyPaint() { return false; }
+    virtual void setContinuousPaintingEnabled(bool) { }
+
     virtual bool supportsFrameInstrumentation() { return false; }
 
     virtual void getAllocatedObjects(HashSet<const void*>&) { }
index c47b5e2c5b641dc7a7940fbdbd40c4536b77e67d..ef33951fe124b6edab3e4d5aae7d3909ce9c66a0 100644 (file)
@@ -93,6 +93,7 @@ static const char pageAgentScreenHeightOverride[] = "pageAgentScreenHeightOverri
 static const char pageAgentFontScaleFactorOverride[] = "pageAgentFontScaleFactorOverride";
 static const char pageAgentFitWindow[] = "pageAgentFitWindow";
 static const char pageAgentShowFPSCounter[] = "pageAgentShowFPSCounter";
+static const char pageAgentContinuousPaintingEnabled[] = "pageAgentContinuousPaintingEnabled";
 static const char pageAgentShowPaintRects[] = "pageAgentShowPaintRects";
 #if ENABLE(TOUCH_EVENTS)
 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
@@ -366,6 +367,8 @@ void InspectorPageAgent::restore()
         setShowFPSCounter(0, showFPSCounter);
         String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedMedia);
         setEmulatedMedia(0, emulatedMedia);
+        bool continuousPaintingEnabled = m_state->getBoolean(PageAgentState::pageAgentContinuousPaintingEnabled);
+        setContinuousPaintingEnabled(0, continuousPaintingEnabled);
 
         int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
         int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
@@ -401,6 +404,7 @@ void InspectorPageAgent::disable(ErrorString*)
     setShowPaintRects(0, false);
     setShowFPSCounter(0, false);
     setEmulatedMedia(0, "");
+    setContinuousPaintingEnabled(0, false);
 
     // When disabling the agent, reset the override values.
     m_state->setLong(PageAgentState::pageAgentScreenWidthOverride, 0);
@@ -749,6 +753,20 @@ void InspectorPageAgent::setShowFPSCounter(ErrorString*, bool show)
         mainFrame()->view()->invalidate();
 }
 
+void InspectorPageAgent::canContinuouslyPaint(ErrorString*, bool* outParam)
+{
+    *outParam = m_client->canContinuouslyPaint();
+}
+
+void InspectorPageAgent::setContinuousPaintingEnabled(ErrorString*, bool enabled)
+{
+    m_state->setBoolean(PageAgentState::pageAgentContinuousPaintingEnabled, enabled);
+    m_client->setContinuousPaintingEnabled(enabled);
+
+    if (!enabled && mainFrame() && mainFrame()->view())
+        mainFrame()->view()->invalidate();
+}
+
 void InspectorPageAgent::getScriptExecutionStatus(ErrorString*, PageCommandHandler::Result::Enum* status)
 {
     bool disabledByScriptController = false;
index 973e15c2af6a76168e7e529c53e6cd7d0414f8e5..d27ea146c843927d508d4dced6f30b98cbb4528c 100644 (file)
@@ -111,6 +111,8 @@ public:
     virtual void setShowPaintRects(ErrorString*, bool show);
     virtual void canShowFPSCounter(ErrorString*, bool*);
     virtual void setShowFPSCounter(ErrorString*, bool show);
+    virtual void canContinuouslyPaint(ErrorString*, bool*);
+    virtual void setContinuousPaintingEnabled(ErrorString*, bool enabled);
     virtual void getScriptExecutionStatus(ErrorString*, PageCommandHandler::Result::Enum*);
     virtual void setScriptExecutionDisabled(ErrorString*, bool);
     virtual void setGeolocationOverride(ErrorString*, const double*, const double*, const double*);
index b8b6807fe14ce75459386bb667593eaba4f2b580..a9a80cb608bacae67ae18fbe07da8399e032653a 100644 (file)
@@ -60,7 +60,8 @@ var Capabilities = {
     timelineCanMonitorMainThread: false,
     canOverrideGeolocation: false,
     canOverrideDeviceOrientation: false,
-    canShowFPSCounter: false
+    canShowFPSCounter: false,
+    canContinuouslyPaint: false
 }
 
 /**
@@ -99,6 +100,7 @@ WebInspector.Settings = function()
     this.showScriptFolders = this.createSetting("showScriptFolders", true);
     this.emulateTouchEvents = this.createSetting("emulateTouchEvents", false);
     this.showPaintRects = this.createSetting("showPaintRects", false);
+    this.continuousPainting = this.createSetting("continuousPainting", false);
     this.showFPSCounter = this.createSetting("showFPSCounter", false);
     this.showShadowDOM = this.createSetting("showShadowDOM", false);
     this.zoomLevel = this.createSetting("zoomLevel", 0);
index c658928fe67e4fd5407691d2fd67a159e08d3057..c8342fcb02fc4c33954ed078e65f09b57537e2fa 100644 (file)
@@ -296,6 +296,10 @@ WebInspector.GenericSettingsTab = function()
         p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show FPS meter"), WebInspector.settings.showFPSCounter));
         WebInspector.settings.showFPSCounter.addChangeListener(this._showFPSCounterChanged, this);
     }
+    if (Capabilities.canContinuouslyPaint) {
+        p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Enable continuous page repainting"), WebInspector.settings.continuousPainting));
+        WebInspector.settings.continuousPainting.addChangeListener(this._continuousPaintingChanged, this);
+    }
 
     p = this._appendSection(WebInspector.UIString("Sources"));
     p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show folders"), WebInspector.settings.showScriptFolders));
@@ -344,6 +348,11 @@ WebInspector.GenericSettingsTab.prototype = {
         PageAgent.setShowFPSCounter(WebInspector.settings.showFPSCounter.get());
     },
 
+    _continuousPaintingChanged: function()
+    {
+        PageAgent.setContinuousPaintingEnabled(WebInspector.settings.continuousPainting.get());
+    },
+
     _updateScriptDisabledCheckbox: function()
     {
         function executionStatusCallback(error, status)
index 73d3ece5f828001c9167b2d4f7f3e10ed15bbdb6..b8835fe3604ee28c645b9b9888ea16e32d4c70d0 100644 (file)
@@ -372,6 +372,7 @@ WebInspector.doLoadedDone = function()
     TimelineAgent.supportsFrameInstrumentation(WebInspector._initializeCapability.bind(WebInspector, "timelineSupportsFrameInstrumentation", null));
     TimelineAgent.canMonitorMainThread(WebInspector._initializeCapability.bind(WebInspector, "timelineCanMonitorMainThread", null));
     PageAgent.canShowFPSCounter(WebInspector._initializeCapability.bind(WebInspector, "canShowFPSCounter", null));
+    PageAgent.canContinuouslyPaint(WebInspector._initializeCapability.bind(WebInspector, "canContinuouslyPaint", null));
     PageAgent.canOverrideDeviceMetrics(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceMetrics", null));
     PageAgent.canOverrideGeolocation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideGeolocation", null));
     PageAgent.canOverrideDeviceOrientation(WebInspector._initializeCapability.bind(WebInspector, "canOverrideDeviceOrientation", WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector)));
@@ -491,6 +492,9 @@ WebInspector._doLoadedDoneWithCapabilities = function()
     if (WebInspector.settings.showPaintRects.get())
         PageAgent.setShowPaintRects(true);
 
+    if (WebInspector.settings.continuousPainting.get())
+        PageAgent.setContinuousPaintingEnabled(true);
+
     if (WebInspector.settings.javaScriptDisabled.get())
         PageAgent.setScriptExecutionDisabled(true);
 
index bab448c854692e3de3f53c14cf6ad21f9a068616..894b51f594c37790a7af0f081b9efff01335e63c 100644 (file)
@@ -1,3 +1,28 @@
+2013-01-25  Eberhard Graether  <egraether@google.com>
+
+        Web Inspector: add checkbox for continuous painting to the inspector's settings
+        https://bugs.webkit.org/show_bug.cgi?id=107352
+
+        Reviewed by Pavel Feldman.
+
+        This change adds a checkbox to activate continuous painting to the WebInspector's
+        rendering settings and plumbs the setting to Chromium's WebLayerTreeView. The
+        setting is visible if InspectorClient::canContinuouslyPaint() returns true.
+
+        * public/WebView.h:
+        (WebView):
+        * src/InspectorClientImpl.cpp:
+        (WebKit::InspectorClientImpl::canContinuouslyPaint):
+        (WebKit):
+        (WebKit::InspectorClientImpl::setContinuousPaintingEnabled):
+        * src/InspectorClientImpl.h:
+        (InspectorClientImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::setContinuousPaintingEnabled):
+        (WebKit):
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        * src/WebViewImpl.h:
+
 2013-01-24  Keishi Hattori  <keishi@webkit.org>
 
         Adjust design of the Calendar Picker
index 002b2186cb36209868859cd4aca3957cd2a11f23..dc10bf5cba7afbeb5805ea4080eea8988c09e7e3 100644 (file)
@@ -472,6 +472,7 @@ public:
 
     virtual void setShowPaintRects(bool) = 0;
     virtual void setShowFPSCounter(bool) = 0;
+    virtual void setContinuousPaintingEnabled(bool) = 0;
 
     // Benchmarking support -------------------------------------------------
 
index bab5816bfd6908efa0f8c169f0c801a24c879246..ecf5ceccfc189728b07eb2ace0a403a42503c213 100644 (file)
@@ -172,6 +172,16 @@ void InspectorClientImpl::setShowFPSCounter(bool show)
     m_inspectedWebView->setShowFPSCounter(show);
 }
 
+bool InspectorClientImpl::canContinuouslyPaint()
+{
+    return true;
+}
+
+void InspectorClientImpl::setContinuousPaintingEnabled(bool enabled)
+{
+    m_inspectedWebView->setContinuousPaintingEnabled(enabled);
+}
+
 bool InspectorClientImpl::supportsFrameInstrumentation()
 {
     return true;
index f8e6b8f1e47619812c1dffa9894e4ccceb285e73..87119e39385af0ad2c3fd06093d19bd84dc30998 100644 (file)
@@ -79,6 +79,9 @@ public:
     virtual bool canShowFPSCounter();
     virtual void setShowFPSCounter(bool);
 
+    virtual bool canContinuouslyPaint();
+    virtual void setContinuousPaintingEnabled(bool);
+
     virtual bool supportsFrameInstrumentation();
 
     virtual void getAllocatedObjects(HashSet<const void*>&);
index 2c030e8253e062beeebde116c89dec11e92f4608..221a1d6bd956ed894a51673ade5f0019ed9f0cf8 100644 (file)
@@ -873,6 +873,15 @@ void WebViewImpl::setShowPaintRects(bool show)
     m_showPaintRects = show;
 }
 
+void WebViewImpl::setContinuousPaintingEnabled(bool enabled)
+{
+    if (isAcceleratedCompositingActive()) {
+        TRACE_EVENT0("webkit", "WebViewImpl::setContinuousPaintingEnabled");
+        m_layerTreeView->setContinuousPaintingEnabled(enabled);
+    }
+    m_continuousPaintingEnabled = enabled;
+}
+
 bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event)
 {
     ASSERT((event.type == WebInputEvent::RawKeyDown)
@@ -4069,6 +4078,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
                 m_pageOverlays->update();
             m_layerTreeView->setShowFPSCounter(m_showFPSCounter);
             m_layerTreeView->setShowPaintRects(m_showPaintRects);
+            m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnabled);
         } else {
             m_nonCompositedContentHost.clear();
             m_isAcceleratedCompositingActive = false;
index 9467f8404ffcf6de3f67733d82778955f3a01178..eabea36c1b7f9ca507e67471b1e79d6b0aa34256 100644 (file)
@@ -311,6 +311,7 @@ public:
     virtual WebViewBenchmarkSupport* benchmarkSupport();
     virtual void setShowPaintRects(bool);
     virtual void setShowFPSCounter(bool);
+    virtual void setContinuousPaintingEnabled(bool);
 
     // WebLayerTreeViewClient
     virtual void willBeginFrame();