Title: [135881] trunk/Source
Revision
135881
Author
commit-qu...@webkit.org
Date
2012-11-27 10:52:30 -0800 (Tue, 27 Nov 2012)

Log Message

Plumbing showPaintRects out of InspectorPageAgent to use a different drawing implementation if available.
https://bugs.webkit.org/show_bug.cgi?id=102452

Patch by Eberhard Graether <egraet...@google.com> on 2012-11-27
Reviewed by Pavel Feldman.

This change makes the showPaintRects setting in the Web Inspector's settings notify InspectorClient
when changed. And the default paint rects drawing is not used if an alternative is available.
This allows Chromium to draw the paint rects in the compositor's HUDLayer.

Source/Platform:

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

Source/WebCore:

No new tests.

* inspector/InspectorClient.h:
(WebCore::InspectorClient::overridesShowPaintRects):
(WebCore::InspectorClient::setShowPaintRects):
(InspectorClient):
* inspector/InspectorPageAgent.cpp:
(PageAgentState):
(WebCore::InspectorPageAgent::restore):
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::setShowPaintRects):
(WebCore::InspectorPageAgent::didPaint):

Source/WebKit/chromium:

* public/WebView.h:
(WebView):
* src/InspectorClientImpl.cpp:
(WebKit::InspectorClientImpl::overridesShowPaintRects):
(WebKit):
(WebKit::InspectorClientImpl::setShowPaintRects):
* src/InspectorClientImpl.h:
(InspectorClientImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::setShowPaintRects):
(WebKit):
* src/WebViewImpl.h:
(WebViewImpl):

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (135880 => 135881)


--- trunk/Source/Platform/ChangeLog	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/Platform/ChangeLog	2012-11-27 18:52:30 UTC (rev 135881)
@@ -1,3 +1,18 @@
+2012-11-27  Eberhard Graether  <egraet...@google.com>
+
+        Plumbing showPaintRects out of InspectorPageAgent to use a different drawing implementation if available.
+        https://bugs.webkit.org/show_bug.cgi?id=102452
+
+        Reviewed by Pavel Feldman.
+
+        This change makes the showPaintRects setting in the Web Inspector's settings notify InspectorClient
+        when changed. And the default paint rects drawing is not used if an alternative is available.
+        This allows Chromium to draw the paint rects in the compositor's HUDLayer.
+
+        * chromium/public/WebLayerTreeView.h:
+        (WebLayerTreeView):
+        (WebKit::WebLayerTreeView::setShowPaintRects):
+
 2012-11-27  Keishi Hattori  <kei...@webkit.org>
 
         Add WebLocalizedString for validation type badinput

Modified: trunk/Source/Platform/chromium/public/WebLayerTreeView.h (135880 => 135881)


--- trunk/Source/Platform/chromium/public/WebLayerTreeView.h	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/Platform/chromium/public/WebLayerTreeView.h	2012-11-27 18:52:30 UTC (rev 135881)
@@ -182,6 +182,9 @@
     // Toggles the FPS counter in the HUD layer
     virtual void setShowFPSCounter(bool) { }
 
+    // Toggles the paint rects in the HUD layer
+    virtual void setShowPaintRects(bool) { }
+
     // Provides a font atlas to use for debug visualizations. The atlas must be a bitmap containing glyph data, a table of
     // ASCII character values to a subrectangle of the atlas representing the corresponding glyph, and the glyph height.
     virtual void setFontAtlas(WebRect asciiToRectTable[128], const SkBitmap&, int fontHeight) { }

Modified: trunk/Source/WebCore/ChangeLog (135880 => 135881)


--- trunk/Source/WebCore/ChangeLog	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/WebCore/ChangeLog	2012-11-27 18:52:30 UTC (rev 135881)
@@ -1,3 +1,27 @@
+2012-11-27  Eberhard Graether  <egraet...@google.com>
+
+        Plumbing showPaintRects out of InspectorPageAgent to use a different drawing implementation if available.
+        https://bugs.webkit.org/show_bug.cgi?id=102452
+
+        Reviewed by Pavel Feldman.
+
+        This change makes the showPaintRects setting in the Web Inspector's settings notify InspectorClient
+        when changed. And the default paint rects drawing is not used if an alternative is available.
+        This allows Chromium to draw the paint rects in the compositor's HUDLayer.
+
+        No new tests.
+
+        * inspector/InspectorClient.h:
+        (WebCore::InspectorClient::overridesShowPaintRects):
+        (WebCore::InspectorClient::setShowPaintRects):
+        (InspectorClient):
+        * inspector/InspectorPageAgent.cpp:
+        (PageAgentState):
+        (WebCore::InspectorPageAgent::restore):
+        (WebCore::InspectorPageAgent::disable):
+        (WebCore::InspectorPageAgent::setShowPaintRects):
+        (WebCore::InspectorPageAgent::didPaint):
+
 2012-11-27  Allan Sandfeld Jensen  <allan.jen...@digia.com>
 
         Unreviewed cleanup.

Modified: trunk/Source/WebCore/inspector/InspectorClient.h (135880 => 135881)


--- trunk/Source/WebCore/inspector/InspectorClient.h	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/WebCore/inspector/InspectorClient.h	2012-11-27 18:52:30 UTC (rev 135881)
@@ -72,6 +72,9 @@
         // FIXME: Platforms may want to implement this (see https://bugs.webkit.org/show_bug.cgi?id=82886).
     }
 
+    virtual bool overridesShowPaintRects() { return false; }
+    virtual void setShowPaintRects(bool) { }
+
     virtual bool canShowFPSCounter() { return false; }
     virtual void setShowFPSCounter(bool) { }
 

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (135880 => 135881)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-11-27 18:52:30 UTC (rev 135881)
@@ -93,7 +93,7 @@
 static const char pageAgentFontScaleFactorOverride[] = "pageAgentFontScaleFactorOverride";
 static const char pageAgentFitWindow[] = "pageAgentFitWindow";
 static const char pageAgentShowFPSCounter[] = "pageAgentShowFPSCounter";
-static const char showPaintRects[] = "showPaintRects";
+static const char pageAgentShowPaintRects[] = "pageAgentShowPaintRects";
 #if ENABLE(TOUCH_EVENTS)
 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
 #endif
@@ -359,6 +359,8 @@
         enable(&error);
         bool scriptExecutionDisabled = m_state->getBoolean(PageAgentState::pageAgentScriptExecutionDisabled);
         setScriptExecutionDisabled(0, scriptExecutionDisabled);
+        bool showPaintRects = m_state->getBoolean(PageAgentState::pageAgentShowPaintRects);
+        setShowPaintRects(0, showPaintRects);
         bool showFPSCounter = m_state->getBoolean(PageAgentState::pageAgentShowFPSCounter);
         setShowFPSCounter(0, showFPSCounter);
 
@@ -393,6 +395,7 @@
     m_instrumentingAgents->setInspectorPageAgent(0);
 
     setScriptExecutionDisabled(0, false);
+    setShowPaintRects(0, false);
     setShowFPSCounter(0, false);
 
     // When disabling the agent, reset the override values.
@@ -725,9 +728,11 @@
 
 void InspectorPageAgent::setShowPaintRects(ErrorString*, bool show)
 {
-    m_state->setBoolean(PageAgentState::showPaintRects, show);
-    if (!show)
-        m_page->mainFrame()->view()->invalidate();
+    m_state->setBoolean(PageAgentState::pageAgentShowPaintRects, show);
+    m_client->setShowPaintRects(show);
+
+    if (!show && mainFrame() && mainFrame()->view())
+        mainFrame()->view()->invalidate();
 }
 
 void InspectorPageAgent::canShowFPSCounter(ErrorString*, bool* outParam)
@@ -909,7 +914,7 @@
 
 void InspectorPageAgent::didPaint(GraphicsContext* context, const LayoutRect& rect)
 {
-    if (!m_enabled || !m_state->getBoolean(PageAgentState::showPaintRects))
+    if (!m_enabled || m_client->overridesShowPaintRects() || !m_state->getBoolean(PageAgentState::pageAgentShowPaintRects))
         return;
 
     static int colorSelector = 0;

Modified: trunk/Source/WebKit/chromium/ChangeLog (135880 => 135881)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-11-27 18:52:30 UTC (rev 135881)
@@ -1,3 +1,28 @@
+2012-11-27  Eberhard Graether  <egraet...@google.com>
+
+        Plumbing showPaintRects out of InspectorPageAgent to use a different drawing implementation if available.
+        https://bugs.webkit.org/show_bug.cgi?id=102452
+
+        Reviewed by Pavel Feldman.
+
+        This change makes the showPaintRects setting in the Web Inspector's settings notify InspectorClient
+        when changed. And the default paint rects drawing is not used if an alternative is available.
+        This allows Chromium to draw the paint rects in the compositor's HUDLayer.
+
+        * public/WebView.h:
+        (WebView):
+        * src/InspectorClientImpl.cpp:
+        (WebKit::InspectorClientImpl::overridesShowPaintRects):
+        (WebKit):
+        (WebKit::InspectorClientImpl::setShowPaintRects):
+        * src/InspectorClientImpl.h:
+        (InspectorClientImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::setShowPaintRects):
+        (WebKit):
+        * src/WebViewImpl.h:
+        (WebViewImpl):
+
 2012-11-27  Tony Chang  <t...@chromium.org>
 
         [chromium] Unreviewed build fix on Linux clang.

Modified: trunk/Source/WebKit/chromium/public/WebView.h (135880 => 135881)


--- trunk/Source/WebKit/chromium/public/WebView.h	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/WebKit/chromium/public/WebView.h	2012-11-27 18:52:30 UTC (rev 135881)
@@ -471,6 +471,7 @@
 
     virtual bool isSelectionEditable() const = 0;
 
+    virtual void setShowPaintRects(bool) = 0;
     virtual void setShowFPSCounter(bool) = 0;
 
     // Benchmarking support -------------------------------------------------

Modified: trunk/Source/WebKit/chromium/src/InspectorClientImpl.cpp (135880 => 135881)


--- trunk/Source/WebKit/chromium/src/InspectorClientImpl.cpp	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/WebKit/chromium/src/InspectorClientImpl.cpp	2012-11-27 18:52:30 UTC (rev 135881)
@@ -163,6 +163,16 @@
         agent->autoZoomPageToFitWidth();
 }
 
+bool InspectorClientImpl::overridesShowPaintRects()
+{
+    return m_inspectedWebView->isAcceleratedCompositingActive();
+}
+
+void InspectorClientImpl::setShowPaintRects(bool show)
+{
+    m_inspectedWebView->setShowPaintRects(show);
+}
+
 bool InspectorClientImpl::canShowFPSCounter()
 {
     return true;

Modified: trunk/Source/WebKit/chromium/src/InspectorClientImpl.h (135880 => 135881)


--- trunk/Source/WebKit/chromium/src/InspectorClientImpl.h	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/WebKit/chromium/src/InspectorClientImpl.h	2012-11-27 18:52:30 UTC (rev 135881)
@@ -77,6 +77,9 @@
     virtual void overrideDeviceMetrics(int, int, float, bool);
     virtual void autoZoomPageToFitWidth();
 
+    virtual bool overridesShowPaintRects();
+    virtual void setShowPaintRects(bool);
+
     virtual bool canShowFPSCounter();
     virtual void setShowFPSCounter(bool);
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (135880 => 135881)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-11-27 18:52:30 UTC (rev 135881)
@@ -848,6 +848,15 @@
     settingsImpl()->setShowFPSCounter(show);
 }
 
+void WebViewImpl::setShowPaintRects(bool show)
+{
+    if (isAcceleratedCompositingActive()) {
+        TRACE_EVENT0("webkit", "WebViewImpl::setShowPaintRects");
+        m_layerTreeView->setShowPaintRects(show);
+    }
+    settingsImpl()->setShowPaintRects(show);
+}
+
 bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event)
 {
     ASSERT((event.type == WebInputEvent::RawKeyDown)

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (135880 => 135881)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-11-27 18:45:43 UTC (rev 135880)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-11-27 18:52:30 UTC (rev 135881)
@@ -309,6 +309,7 @@
 #endif
     virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&);
     virtual WebViewBenchmarkSupport* benchmarkSupport();
+    virtual void setShowPaintRects(bool);
     virtual void setShowFPSCounter(bool);
 
     // WebLayerTreeViewClient
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to