Web Inspector: Add settings checkbox for composited layer borders
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 17:55:17 +0000 (17:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 17:55:17 +0000 (17:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109096

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

This change adds a checkbox to show composited layer borders to the WebInspector's
rendering settings and plumbs the setting to Chromium's WebLayerTreeView. The setting
is visible if InspectorClient::canShowDebugBorders() returns true.

Source/Platform:

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

Source/WebCore:

No new tests.

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

Source/WebKit/chromium:

* src/InspectorClientImpl.cpp:
(WebKit::InspectorClientImpl::canShowDebugBorders):
(WebKit):
(WebKit::InspectorClientImpl::setShowDebugBorders):
* src/InspectorClientImpl.h:
(InspectorClientImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):
(WebKit::WebViewImpl::setShowDebugBorders):
(WebKit):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
* src/WebViewImpl.h:

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

16 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/src/InspectorClientImpl.cpp
Source/WebKit/chromium/src/InspectorClientImpl.h
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h

index 73ab8810cfb7251fafe0b01d7afa1eae611f98be..34a43e64154806fc8a03890bd6c8e565d56d6247 100644 (file)
@@ -1,3 +1,18 @@
+2013-02-07  Eberhard Graether  <egraether@google.com>
+
+        Web Inspector: Add settings checkbox for composited layer borders
+        https://bugs.webkit.org/show_bug.cgi?id=109096
+
+        Reviewed by Pavel Feldman.
+
+        This change adds a checkbox to show composited layer borders to the WebInspector's
+        rendering settings and plumbs the setting to Chromium's WebLayerTreeView. The setting
+        is visible if InspectorClient::canShowDebugBorders() returns true.
+
+        * chromium/public/WebLayerTreeView.h:
+        (WebLayerTreeView):
+        (WebKit::WebLayerTreeView::setShowDebugBorders):
+
 2013-02-06  Tommy Widenflycht  <tommyw@google.com>
 
         MediaStream API: Implement DTMF support in RTCPeerConnection
index f35abb261e142be00aa58e3896142b0c797d0168..03896045d6c092f50346031ff102c55b804be97d 100644 (file)
@@ -184,6 +184,9 @@ public:
     // Toggles the paint rects in the HUD layer
     virtual void setShowPaintRects(bool) { }
 
+    // Toggles the debug borders on layers
+    virtual void setShowDebugBorders(bool) { }
+
     // Toggles continuous painting
     virtual void setContinuousPaintingEnabled(bool) { }
 
index 306deb8f61b4af35f74878b623f048c4b6170dcc..78a6328fb6f2a62526f0513c669ced2148617bb7 100644 (file)
@@ -1,3 +1,37 @@
+2013-02-07  Eberhard Graether  <egraether@google.com>
+
+        Web Inspector: Add settings checkbox for composited layer borders
+        https://bugs.webkit.org/show_bug.cgi?id=109096
+
+        Reviewed by Pavel Feldman.
+
+        This change adds a checkbox to show composited layer borders to the WebInspector's
+        rendering settings and plumbs the setting to Chromium's WebLayerTreeView. The setting
+        is visible if InspectorClient::canShowDebugBorders() returns true.
+
+        No new tests.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/Inspector.json:
+        * inspector/InspectorClient.h:
+        (WebCore::InspectorClient::canShowDebugBorders):
+        (WebCore::InspectorClient::setShowDebugBorders):
+        (InspectorClient):
+        * inspector/InspectorPageAgent.cpp:
+        (PageAgentState):
+        (WebCore::InspectorPageAgent::restore):
+        (WebCore::InspectorPageAgent::disable):
+        (WebCore::InspectorPageAgent::canShowDebugBorders):
+        (WebCore):
+        (WebCore::InspectorPageAgent::setShowDebugBorders):
+        * inspector/InspectorPageAgent.h:
+        * inspector/front-end/Settings.js:
+        * inspector/front-end/SettingsScreen.js:
+        (WebInspector.GenericSettingsTab):
+        (WebInspector.GenericSettingsTab.prototype.get _showDebugBordersChanged):
+        * inspector/front-end/inspector.js:
+        (WebInspector.doLoadedDone):
+
 2013-02-07  Gavin Peters  <gavinp@chromium.org>
 
         Unreviewed, rolling out r142141.
index da1fd4ffa6732e4ce5a3fb1badef7526c7efd88b..0228aa903c14458f73d7fcdb282b6e2bdc5cd63f 100644 (file)
@@ -665,6 +665,7 @@ localizedStrings["Hide navigator"] = "Hide navigator";
 localizedStrings["IndexedDB"] = "IndexedDB";
 localizedStrings["Animation"] = "Animation";
 localizedStrings["Show paint rectangles"] = "Show paint rectangles";
+localizedStrings["Show composited layer borders"] = "Show composited layer borders";
 localizedStrings["Show FPS meter"] = "Show FPS meter";
 localizedStrings["Security origin"] = "Security origin";
 localizedStrings["Version"] = "Version";
index 4e5bb3253b14297d441c528ab272ef5bd458b747..f9f855b116c03d99977d3f51b2c4a6ee674a04d0 100644 (file)
                 ],
                 "hidden": true
             },
+            {
+                "name": "canShowDebugBorders",
+                "description": "Tells if backend supports debug borders on layers",
+                "returns": [
+                    { "name": "show", "type": "boolean", "description": "True if the debug borders can be shown" }
+                ],
+                "hidden": true
+            },
+            {
+                "name": "setShowDebugBorders",
+                "description": "Requests that backend shows debug borders on layers",
+                "parameters": [
+                    { "name": "show", "type": "boolean", "description": "True for showing debug borders" }
+                ],
+                "hidden": true
+            },
             {
                 "name": "canShowFPSCounter",
                 "description": "Tells if backend supports a FPS counter display",
index b9f8f5612f47d5963afab82dc79eff7fbf34c5bf..c86e70b3a09735ad241488fe49b520f9b7f5aeb6 100644 (file)
@@ -73,6 +73,9 @@ public:
     virtual bool overridesShowPaintRects() { return false; }
     virtual void setShowPaintRects(bool) { }
 
+    virtual bool canShowDebugBorders() { return false; }
+    virtual void setShowDebugBorders(bool) { }
+
     virtual bool canShowFPSCounter() { return false; }
     virtual void setShowFPSCounter(bool) { }
 
index e673a003b177d5359323a5807112b6f1d5cdf9f7..5f41b50744d0881735dad8cd80884d19dd50a0df 100644 (file)
@@ -95,6 +95,7 @@ static const char pageAgentFitWindow[] = "pageAgentFitWindow";
 static const char pageAgentShowFPSCounter[] = "pageAgentShowFPSCounter";
 static const char pageAgentContinuousPaintingEnabled[] = "pageAgentContinuousPaintingEnabled";
 static const char pageAgentShowPaintRects[] = "pageAgentShowPaintRects";
+static const char pageAgentShowDebugBorders[] = "pageAgentShowDebugBorders";
 #if ENABLE(TOUCH_EVENTS)
 static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
 #endif
@@ -363,6 +364,8 @@ void InspectorPageAgent::restore()
         setScriptExecutionDisabled(0, scriptExecutionDisabled);
         bool showPaintRects = m_state->getBoolean(PageAgentState::pageAgentShowPaintRects);
         setShowPaintRects(0, showPaintRects);
+        bool showDebugBorders = m_state->getBoolean(PageAgentState::pageAgentShowDebugBorders);
+        setShowDebugBorders(0, showDebugBorders);
         bool showFPSCounter = m_state->getBoolean(PageAgentState::pageAgentShowFPSCounter);
         setShowFPSCounter(0, showFPSCounter);
         String emulatedMedia = m_state->getString(PageAgentState::pageAgentEmulatedMedia);
@@ -402,6 +405,7 @@ void InspectorPageAgent::disable(ErrorString*)
 
     setScriptExecutionDisabled(0, false);
     setShowPaintRects(0, false);
+    setShowDebugBorders(0, false);
     setShowFPSCounter(0, false);
     setEmulatedMedia(0, "");
     setContinuousPaintingEnabled(0, false);
@@ -739,6 +743,19 @@ void InspectorPageAgent::setShowPaintRects(ErrorString*, bool show)
         mainFrame()->view()->invalidate();
 }
 
+void InspectorPageAgent::canShowDebugBorders(ErrorString*, bool* outParam)
+{
+    *outParam = m_client->canShowDebugBorders();
+}
+
+void InspectorPageAgent::setShowDebugBorders(ErrorString*, bool show)
+{
+    m_state->setBoolean(PageAgentState::pageAgentShowDebugBorders, show);
+    m_client->setShowDebugBorders(show);
+    if (mainFrame() && mainFrame()->view())
+        mainFrame()->view()->invalidate();
+}
+
 void InspectorPageAgent::canShowFPSCounter(ErrorString*, bool* outParam)
 {
     *outParam = m_client->canShowFPSCounter();
index 986cc748a24f592f66bbe826dff716be9b296bc2..077f0c7fb490807337e872fef974283dd5844b7f 100644 (file)
@@ -109,6 +109,8 @@ public:
     virtual void canOverrideDeviceMetrics(ErrorString*, bool*);
     virtual void setDeviceMetricsOverride(ErrorString*, int width, int height, double fontScaleFactor, bool fitWindow);
     virtual void setShowPaintRects(ErrorString*, bool show);
+    virtual void canShowDebugBorders(ErrorString*, bool*);
+    virtual void setShowDebugBorders(ErrorString*, bool show);
     virtual void canShowFPSCounter(ErrorString*, bool*);
     virtual void setShowFPSCounter(ErrorString*, bool show);
     virtual void canContinuouslyPaint(ErrorString*, bool*);
index 8e27d49b4443a231ded209c66dad2ba9c3570699..ea0186a5530c1ccf65af44e204063bdda5093d2c 100644 (file)
@@ -60,6 +60,7 @@ var Capabilities = {
     timelineCanMonitorMainThread: false,
     canOverrideGeolocation: false,
     canOverrideDeviceOrientation: false,
+    canShowDebugBorders: false,
     canShowFPSCounter: false,
     canContinuouslyPaint: false
 }
@@ -100,6 +101,7 @@ WebInspector.Settings = function()
     this.emulateTouchEvents = this.createSetting("emulateTouchEvents", false);
     this.showPaintRects = this.createSetting("showPaintRects", false);
     this.continuousPainting = this.createSetting("continuousPainting", false);
+    this.showDebugBorders = this.createSetting("showDebugBorders", false);
     this.showFPSCounter = this.createSetting("showFPSCounter", false);
     this.showShadowDOM = this.createSetting("showShadowDOM", false);
     this.zoomLevel = this.createSetting("zoomLevel", 0);
index 657802c517d399e3d39c5328d06eb711b7b15636..6ef2a86df9947f33dd0e9ea048a864d58b9729c5 100644 (file)
@@ -292,6 +292,10 @@ WebInspector.GenericSettingsTab = function()
     p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show paint rectangles"), WebInspector.settings.showPaintRects));
     WebInspector.settings.showPaintRects.addChangeListener(this._showPaintRectsChanged, this);
 
+    if (Capabilities.canShowDebugBorders) {
+        p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show composited layer borders"), WebInspector.settings.showDebugBorders));
+        WebInspector.settings.showDebugBorders.addChangeListener(this._showDebugBordersChanged, this);
+    }
     if (Capabilities.canShowFPSCounter) {
         p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show FPS meter"), WebInspector.settings.showFPSCounter));
         WebInspector.settings.showFPSCounter.addChangeListener(this._showFPSCounterChanged, this);
@@ -342,6 +346,11 @@ WebInspector.GenericSettingsTab.prototype = {
         PageAgent.setShowPaintRects(WebInspector.settings.showPaintRects.get());
     },
 
+    _showDebugBordersChanged: function()
+    {
+        PageAgent.setShowDebugBorders(WebInspector.settings.showDebugBorders.get());
+    },
+
     _showFPSCounterChanged: function()
     {
         PageAgent.setShowFPSCounter(WebInspector.settings.showFPSCounter.get());
index d94e2854953fc4d9e8baa1572589892db2154190..1fa5314025e2f6246db847d590d152a05aa79e58 100644 (file)
@@ -371,6 +371,7 @@ WebInspector.doLoadedDone = function()
     ProfilerAgent.hasHeapProfiler(WebInspector._initializeCapability.bind(WebInspector, "heapProfilerPresent", null));
     TimelineAgent.supportsFrameInstrumentation(WebInspector._initializeCapability.bind(WebInspector, "timelineSupportsFrameInstrumentation", null));
     TimelineAgent.canMonitorMainThread(WebInspector._initializeCapability.bind(WebInspector, "timelineCanMonitorMainThread", null));
+    PageAgent.canShowDebugBorders(WebInspector._initializeCapability.bind(WebInspector, "canShowDebugBorders", 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));
@@ -492,6 +493,9 @@ WebInspector._doLoadedDoneWithCapabilities = function()
     if (WebInspector.settings.showPaintRects.get())
         PageAgent.setShowPaintRects(true);
 
+    if (WebInspector.settings.showDebugBorders.get())
+        PageAgent.setShowDebugBorders(true);
+
     if (WebInspector.settings.continuousPainting.get())
         PageAgent.setContinuousPaintingEnabled(true);
 
index 3569231df86f34ca5f91616d1b62544c980744f7..c3c393ed26fe750e00883de365a1d79ce184b5e2 100644 (file)
@@ -1,3 +1,27 @@
+2013-02-07  Eberhard Graether  <egraether@google.com>
+
+        Web Inspector: Add settings checkbox for composited layer borders
+        https://bugs.webkit.org/show_bug.cgi?id=109096
+
+        Reviewed by Pavel Feldman.
+
+        This change adds a checkbox to show composited layer borders to the WebInspector's
+        rendering settings and plumbs the setting to Chromium's WebLayerTreeView. The setting
+        is visible if InspectorClient::canShowDebugBorders() returns true.
+
+        * src/InspectorClientImpl.cpp:
+        (WebKit::InspectorClientImpl::canShowDebugBorders):
+        (WebKit):
+        (WebKit::InspectorClientImpl::setShowDebugBorders):
+        * src/InspectorClientImpl.h:
+        (InspectorClientImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::WebViewImpl):
+        (WebKit::WebViewImpl::setShowDebugBorders):
+        (WebKit):
+        (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+        * src/WebViewImpl.h:
+
 2013-02-07  Stephen White  <senorblanco@chromium.org>
 
         Unreviewed.  Rolled DEPS.
index e94df9a7b18f498ebf38ba1820eeb863c9259cfe..06fcda9641c8563bb203726680b181b7c37be247 100644 (file)
@@ -163,6 +163,16 @@ void InspectorClientImpl::setShowPaintRects(bool show)
     m_inspectedWebView->setShowPaintRects(show);
 }
 
+bool InspectorClientImpl::canShowDebugBorders()
+{
+    return true;
+}
+
+void InspectorClientImpl::setShowDebugBorders(bool show)
+{
+    m_inspectedWebView->setShowDebugBorders(show);
+}
+
 bool InspectorClientImpl::canShowFPSCounter()
 {
     if (m_inspectedWebView->page())
index d173fca27e052b834412f84c85265e518630f38d..d256d20fb4b204915f6483ace4e4d202e2e515c7 100644 (file)
@@ -76,6 +76,9 @@ public:
     virtual bool overridesShowPaintRects();
     virtual void setShowPaintRects(bool);
 
+    virtual bool canShowDebugBorders();
+    virtual void setShowDebugBorders(bool);
+
     virtual bool canShowFPSCounter();
     virtual void setShowFPSCounter(bool);
 
index ac8b88e1ce6be5ea4f725e155582d4c8f318460d..51b5c3104e5e9d517e199b3192290495ca30e694 100644 (file)
@@ -451,6 +451,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
     , m_suppressInvalidations(false)
     , m_showFPSCounter(false)
     , m_showPaintRects(false)
+    , m_showDebugBorders(false)
     , m_continuousPaintingEnabled(false)
 {
     // WebKit/win/WebView.cpp does the same thing, except they call the
@@ -877,6 +878,13 @@ void WebViewImpl::setShowPaintRects(bool show)
     m_showPaintRects = show;
 }
 
+void WebViewImpl::setShowDebugBorders(bool show)
+{
+    if (isAcceleratedCompositingActive())
+        m_layerTreeView->setShowDebugBorders(show);
+    m_showDebugBorders = show;
+}
+
 void WebViewImpl::setContinuousPaintingEnabled(bool enabled)
 {
     if (isAcceleratedCompositingActive()) {
@@ -4151,6 +4159,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
                 m_pageOverlays->update();
             m_layerTreeView->setShowFPSCounter(m_showFPSCounter);
             m_layerTreeView->setShowPaintRects(m_showPaintRects);
+            m_layerTreeView->setShowDebugBorders(m_showDebugBorders);
             m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnabled);
         } else {
             m_nonCompositedContentHost.clear();
index 451e6c54586859901a2a2d054b4a68ed25fdfc85..9266fbca9dc09ddd41d20cbf99429f38a3b045ed 100644 (file)
@@ -311,6 +311,7 @@ public:
     virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&);
     virtual WebViewBenchmarkSupport* benchmarkSupport();
     virtual void setShowPaintRects(bool);
+    virtual void setShowDebugBorders(bool);
     virtual void setShowFPSCounter(bool);
     virtual void setContinuousPaintingEnabled(bool);
 
@@ -896,6 +897,7 @@ private:
 
     bool m_showFPSCounter;
     bool m_showPaintRects;
+    bool m_showDebugBorders;
     bool m_continuousPaintingEnabled;
 };