Title: [178631] trunk/Source
Revision
178631
Author
[email protected]
Date
2015-01-18 09:07:05 -0800 (Sun, 18 Jan 2015)

Log Message

Web Inspector: highlight data for overlay should use protocol type builders
https://bugs.webkit.org/show_bug.cgi?id=129441

Reviewed by Timothy Hatcher.

Source/_javascript_Core:

Add a new domain for overlay types.

* CMakeLists.txt:
* DerivedSources.make:
* inspector/protocol/OverlayTypes.json: Added.

Source/WebCore:

As a first step towards cleaning up the inspector overlay, convert highlight
data construction to use protocol type builders. It's now really obvious what
data is being sent to the inspector overlay page.

This change paves the way towards using inspector protocol commands and events
if we want to support more interactive functionality in the inspector overlay.

This patch makes a few style cleanups, such as standardizing variable names,
using default member initializers, passing by reference, and fixing casts.

No new tests, no behavior changed.

* WebCore.exp.in:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::getHighlight):
(WebCore::InspectorController::buildObjectForHighlightedNode):
(WebCore::InspectorController::inspect): Deleted.
* inspector/InspectorController.h:
* inspector/InspectorOverlay.cpp:
(WebCore::buildRendererHighlight):
(WebCore::buildNodeHighlight):
(WebCore::buildQuadHighlight):
(WebCore::InspectorOverlay::InspectorOverlay):
(WebCore::InspectorOverlay::getHighlight):
(WebCore::buildObjectForPoint):
(WebCore::buildObjectForRect):
(WebCore::buildArrayForQuad):
(WebCore::buildObjectForHighlight):
(WebCore::buildObjectForRegion):
(WebCore::buildObjectForFlowRegions):
(WebCore::buildObjectForSize):
(WebCore::buildQuadObjectForCSSRegionContentClip):
Simplify how the clipping area is encoded. It's now 'regionClippingArea'
stored on a FragmentHighlightData instance.

(WebCore::InspectorOverlay::updatePaintRectsTimerFired):
(WebCore::InspectorOverlay::drawPaintRects):
(WebCore::buildArrayForRendererFragments):
(WebCore::appendPathCommandAndPoints):
(WebCore::appendPathSegment):
(WebCore::buildObjectForShapeOutside):
(WebCore::buildObjectForElementData):
(WebCore::InspectorOverlay::buildObjectForHighlightedNode):
(WebCore::InspectorOverlay::drawNodeHighlight):
(WebCore::InspectorOverlay::drawQuadHighlight):
(WebCore::InspectorOverlay::reset):
(WebCore::buildObjectForRegionHighlight): Deleted.
(WebCore::buildObjectForCSSRegionsHighlight): Deleted.
(WebCore::buildObjectForCSSRegionContentClip): Deleted.
(WebCore::buildObjectForRendererFragments): Deleted.
(WebCore::buildObjectForElementInfo): Deleted.
* inspector/InspectorOverlay.h:
(WebCore::Highlight::Highlight):
* inspector/InspectorOverlayPage.js:
(_createElementTitle):
(_drawElementTitle):
(_drawFragmentHighlight):
(drawNodeHighlight):
* testing/Internals.cpp:
(WebCore::Internals::inspectorHighlightRects):
(WebCore::Internals::inspectorHighlightObject):

Source/WebKit:

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: Update symbol.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (178630 => 178631)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2015-01-18 17:07:05 UTC (rev 178631)
@@ -1024,6 +1024,7 @@
     ${_javascript_CORE_DIR}/inspector/protocol/Inspector.json
     ${_javascript_CORE_DIR}/inspector/protocol/LayerTree.json
     ${_javascript_CORE_DIR}/inspector/protocol/Network.json
+    ${_javascript_CORE_DIR}/inspector/protocol/OverlayTypes.json
     ${_javascript_CORE_DIR}/inspector/protocol/Page.json
     ${_javascript_CORE_DIR}/inspector/protocol/Runtime.json
     ${_javascript_CORE_DIR}/inspector/protocol/Timeline.json

Modified: trunk/Source/_javascript_Core/ChangeLog (178630 => 178631)


--- trunk/Source/_javascript_Core/ChangeLog	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-01-18 17:07:05 UTC (rev 178631)
@@ -1,3 +1,16 @@
+2015-01-17  Brian J. Burg  <[email protected]>
+
+        Web Inspector: highlight data for overlay should use protocol type builders
+        https://bugs.webkit.org/show_bug.cgi?id=129441
+
+        Reviewed by Timothy Hatcher.
+
+        Add a new domain for overlay types.
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * inspector/protocol/OverlayTypes.json: Added.
+
 2015-01-17  Michael Saboff  <[email protected]>
 
         Crash in JSScope::resolve() on tools.ups.com

Modified: trunk/Source/_javascript_Core/DerivedSources.make (178630 => 178631)


--- trunk/Source/_javascript_Core/DerivedSources.make	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/_javascript_Core/DerivedSources.make	2015-01-18 17:07:05 UTC (rev 178631)
@@ -125,6 +125,7 @@
     $(_javascript_Core)/inspector/protocol/Inspector.json \
     $(_javascript_Core)/inspector/protocol/LayerTree.json \
     $(_javascript_Core)/inspector/protocol/Network.json \
+    $(_javascript_Core)/inspector/protocol/OverlayTypes.json \
     $(_javascript_Core)/inspector/protocol/Page.json \
     $(_javascript_Core)/inspector/protocol/Runtime.json \
     $(_javascript_Core)/inspector/protocol/Timeline.json \

Added: trunk/Source/_javascript_Core/inspector/protocol/OverlayTypes.json (0 => 178631)


--- trunk/Source/_javascript_Core/inspector/protocol/OverlayTypes.json	                        (rev 0)
+++ trunk/Source/_javascript_Core/inspector/protocol/OverlayTypes.json	2015-01-18 17:07:05 UTC (rev 178631)
@@ -0,0 +1,129 @@
+{
+    "domain": "OverlayTypes",
+    "description": "Exposes types to be used by the inspector overlay.",
+    "types": [
+        {
+            "id": "Point",
+            "type": "object",
+            "properties": [
+                { "name": "x", "type": "number" },
+                { "name": "y", "type": "number" }
+            ]
+        },
+        {
+            "id": "Size",
+            "type": "object",
+            "properties": [
+                { "name": "width", "type": "integer" },
+                { "name": "height", "type": "integer" }
+            ]
+        },
+        {
+            "id": "Quad",
+            "description": "A quad is a collection of 4 points. When initialized from a rect, the points are in clockwise order from top left.",
+            "type": "array",
+            "items": { "$ref": "Point" }
+        },
+        {
+            "id": "Rect",
+            "description": "A rectangle specified by a reference coordinate and width/height offsets.",
+            "type": "object",
+            "properties": [
+                { "name": "x", "type": "number" },
+                { "name": "y", "type": "number" },
+                { "name": "width", "type": "number" },
+                { "name": "height", "type": "number" }
+            ]
+        },
+        {
+            "id": "Region",
+            "description": "A single region in a flow thread.",
+            "type": "object",
+            "properties": [
+                { "name": "borderQuad", "$ref": "Quad" },
+                { "name": "incomingQuad", "$ref": "Quad" },
+                { "name": "outgoingQuad", "$ref": "Quad" },
+                { "name": "isHighlighted", "type": "boolean", "optional": true }
+            ]
+        },
+        {
+            "id": "DisplayPath",
+            "description": "A vector path described using SVG path syntax.",
+            "type": "array",
+            "items": { "type": "any" }
+        },
+        {
+            "id": "RegionFlowData",
+            "type": "object",
+            "properties": [
+                { "name": "regions", "type": "array", "items": { "$ref": "Region"} },
+                { "name": "name", "type": "string" }
+            ]
+        },
+        {
+            "id": "ContentFlowData",
+            "type": "object",
+            "properties": [
+                { "name": "name", "type": "string" }
+            ]
+        },
+        {
+            "id": "ShapeOutsideData",
+            "type": "object",
+            "properties": [
+                { "name": "bounds", "$ref": "Quad", "description": "Bounds for the shape-outside paths." },
+                { "name": "shape", "$ref": "DisplayPath", "description": "Path for the element's shape.", "optional": true },
+                { "name": "marginShape", "$ref": "DisplayPath", "description": "Path for the element's margin shape.", "optional": true }
+            ]
+        },
+        {
+            "id": "ElementData",
+            "description": "Data that describes an element to be highlighted.",
+            "type": "object",
+            "properties": [
+                { "name": "tagName", "type": "string" },
+                { "name": "idValue", "type": "string", "description": "The value of the element's 'id' attribute." },
+                { "name": "className", "type": "string", "optional": true },
+                { "name": "size", "$ref": "Size", "optional": true },
+                { "name": "role", "type": "string", "description": "Computed accessibility role for the element.", "optional": true },
+                { "name": "regionFlowData", "$ref": "RegionFlowData", "optional": true },
+                { "name": "contentFlowData", "$ref": "ContentFlowData", "optional": true },
+                { "name": "shapeOutsideData", "$ref": "ShapeOutsideData", "optional": true }
+            ]
+        },
+        {
+            "id": "FragmentHighlightData",
+            "description": "Data required to highlight multiple quads.",
+            "type": "object",
+            "properties": [
+                { "name": "quads", "type": "array", "items": { "$ref": "Quad" }, "description": "Quads for which the highlight should be applied."},
+                { "name": "contentColor", "type": "string" },
+                { "name": "contentOutlineColor", "type": "string" },
+                { "name": "paddingColor", "type": "string" },
+                { "name": "borderColor", "type": "string" },
+                { "name": "marginColor", "type": "string" },
+                { "name": "regionClippingArea", "$ref": "Quad", "optional": true }
+            ]
+        },
+        {
+            "id": "NodeHighlightData",
+            "description": "Data required to highlight a DOM node.",
+            "type": "object",
+            "properties": [
+                { "name": "scrollOffset", "$ref": "Point", "description": "Scroll offset for the MainFrame's FrameView that is shared across all quads." },
+                { "name": "fragments", "type": "array", "items": { "$ref": "FragmentHighlightData" } },
+                { "name": "elementData", "$ref": "ElementData", "optional": true }
+            ]
+        },
+        {
+            "id": "OverlayConfiguration",
+            "description": "Data required to configure the overlay's size and scaling behavior.",
+            "type": "object",
+            "properties": [
+                { "name": "deviceScaleFactor", "type": "number" },
+                { "name": "viewportSize", "$ref": "Size" },
+                { "name": "frameViewFullSize", "$ref": "Size" }
+            ]
+        }
+    ]
+}

Modified: trunk/Source/WebCore/ChangeLog (178630 => 178631)


--- trunk/Source/WebCore/ChangeLog	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebCore/ChangeLog	2015-01-18 17:07:05 UTC (rev 178631)
@@ -1,3 +1,72 @@
+2015-01-17  Brian J. Burg  <[email protected]>
+
+        Web Inspector: highlight data for overlay should use protocol type builders
+        https://bugs.webkit.org/show_bug.cgi?id=129441
+
+        Reviewed by Timothy Hatcher.
+
+        As a first step towards cleaning up the inspector overlay, convert highlight
+        data construction to use protocol type builders. It's now really obvious what
+        data is being sent to the inspector overlay page.
+
+        This change paves the way towards using inspector protocol commands and events
+        if we want to support more interactive functionality in the inspector overlay.
+
+        This patch makes a few style cleanups, such as standardizing variable names,
+        using default member initializers, passing by reference, and fixing casts.
+
+        No new tests, no behavior changed.
+
+        * WebCore.exp.in:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::getHighlight):
+        (WebCore::InspectorController::buildObjectForHighlightedNode):
+        (WebCore::InspectorController::inspect): Deleted.
+        * inspector/InspectorController.h:
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::buildRendererHighlight):
+        (WebCore::buildNodeHighlight):
+        (WebCore::buildQuadHighlight):
+        (WebCore::InspectorOverlay::InspectorOverlay):
+        (WebCore::InspectorOverlay::getHighlight):
+        (WebCore::buildObjectForPoint):
+        (WebCore::buildObjectForRect):
+        (WebCore::buildArrayForQuad):
+        (WebCore::buildObjectForHighlight):
+        (WebCore::buildObjectForRegion):
+        (WebCore::buildObjectForFlowRegions):
+        (WebCore::buildObjectForSize):
+        (WebCore::buildQuadObjectForCSSRegionContentClip):
+        Simplify how the clipping area is encoded. It's now 'regionClippingArea'
+        stored on a FragmentHighlightData instance.
+
+        (WebCore::InspectorOverlay::updatePaintRectsTimerFired):
+        (WebCore::InspectorOverlay::drawPaintRects):
+        (WebCore::buildArrayForRendererFragments):
+        (WebCore::appendPathCommandAndPoints):
+        (WebCore::appendPathSegment):
+        (WebCore::buildObjectForShapeOutside):
+        (WebCore::buildObjectForElementData):
+        (WebCore::InspectorOverlay::buildObjectForHighlightedNode):
+        (WebCore::InspectorOverlay::drawNodeHighlight):
+        (WebCore::InspectorOverlay::drawQuadHighlight):
+        (WebCore::InspectorOverlay::reset):
+        (WebCore::buildObjectForRegionHighlight): Deleted.
+        (WebCore::buildObjectForCSSRegionsHighlight): Deleted.
+        (WebCore::buildObjectForCSSRegionContentClip): Deleted.
+        (WebCore::buildObjectForRendererFragments): Deleted.
+        (WebCore::buildObjectForElementInfo): Deleted.
+        * inspector/InspectorOverlay.h:
+        (WebCore::Highlight::Highlight):
+        * inspector/InspectorOverlayPage.js:
+        (_createElementTitle):
+        (_drawElementTitle):
+        (_drawFragmentHighlight):
+        (drawNodeHighlight):
+        * testing/Internals.cpp:
+        (WebCore::Internals::inspectorHighlightRects):
+        (WebCore::Internals::inspectorHighlightObject):
+
 2015-01-17  Myles C. Maxfield  <[email protected]>
 
         [SVG -> OTF Converter] Crashes when SVG font is invalid

Modified: trunk/Source/WebCore/WebCore.exp.in (178630 => 178631)


--- trunk/Source/WebCore/WebCore.exp.in	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebCore/WebCore.exp.in	2015-01-18 17:07:05 UTC (rev 178631)
@@ -1859,7 +1859,7 @@
 __ZNK7WebCore19HTMLOptGroupElement14groupLabelTextEv
 __ZNK7WebCore19HTMLTextAreaElement5valueEv
 __ZNK7WebCore19IDBDatabaseMetadata12isolatedCopyEv
-__ZNK7WebCore19InspectorController12getHighlightEPNS_9HighlightENS_16InspectorOverlay16CoordinateSystemE
+__ZNK7WebCore19InspectorController12getHighlightERNS_9HighlightENS_16InspectorOverlay16CoordinateSystemE
 __ZNK7WebCore19InspectorController29buildObjectForHighlightedNodeEv
 __ZNK7WebCore19MediaSessionManager30applicationWillEnterBackgroundEv
 __ZNK7WebCore19MediaSessionManager30applicationWillEnterForegroundEv

Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (178630 => 178631)


--- trunk/Source/WebCore/inspector/InspectorController.cpp	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp	2015-01-18 17:07:05 UTC (rev 178631)
@@ -321,12 +321,12 @@
     m_overlay->paint(context);
 }
 
-void InspectorController::getHighlight(Highlight* highlight, InspectorOverlay::CoordinateSystem coordinateSystem) const
+void InspectorController::getHighlight(Highlight& highlight, InspectorOverlay::CoordinateSystem coordinateSystem) const
 {
     m_overlay->getHighlight(highlight, coordinateSystem);
 }
 
-RefPtr<InspectorObject> InspectorController::buildObjectForHighlightedNode() const
+RefPtr<Inspector::Protocol::OverlayTypes::NodeHighlightData> InspectorController::buildObjectForHighlightedNode() const
 {
     return m_overlay->buildObjectForHighlightedNode();
 }

Modified: trunk/Source/WebCore/inspector/InspectorController.h (178630 => 178631)


--- trunk/Source/WebCore/inspector/InspectorController.h	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebCore/inspector/InspectorController.h	2015-01-18 17:07:05 UTC (rev 178631)
@@ -48,7 +48,13 @@
 class InspectorBackendDispatcher;
 class InspectorFrontendChannel;
 class InspectorObject;
+
+namespace Protocol {
+namespace OverlayTypes {
+class NodeHighlightData;
 }
+}
+}
 
 namespace WebCore {
 
@@ -104,13 +110,13 @@
 
     void inspect(Node*);
     WEBCORE_EXPORT void drawHighlight(GraphicsContext&) const;
-    WEBCORE_EXPORT void getHighlight(Highlight*, InspectorOverlay::CoordinateSystem) const;
+    WEBCORE_EXPORT void getHighlight(Highlight&, InspectorOverlay::CoordinateSystem) const;
     void hideHighlight();
     Node* highlightedNode() const;
 
     void setIndicating(bool);
 
-    WEBCORE_EXPORT RefPtr<Inspector::InspectorObject> buildObjectForHighlightedNode() const;
+    WEBCORE_EXPORT RefPtr<Inspector::Protocol::OverlayTypes::NodeHighlightData> buildObjectForHighlightedNode() const;
 
     bool isUnderTest() const { return m_isUnderTest; }
     void setIsUnderTest(bool isUnderTest) { m_isUnderTest = isUnderTest; }

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (178630 => 178631)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2015-01-18 17:07:05 UTC (rev 178631)
@@ -57,6 +57,7 @@
 #include "Settings.h"
 #include "StyledElement.h"
 #include <bindings/ScriptValue.h>
+#include <inspector/InspectorProtocolObjects.h>
 #include <inspector/InspectorValues.h>
 #include <wtf/text/StringBuilder.h>
 
@@ -80,13 +81,13 @@
     contentsQuadToCoordinateSystem(mainView, view, quad, InspectorOverlay::CoordinateSystem::View);
 }
 
-static void buildRendererHighlight(RenderObject* renderer, RenderRegion* region, const HighlightConfig& highlightConfig, Highlight* highlight, InspectorOverlay::CoordinateSystem coordinateSystem)
+static void buildRendererHighlight(RenderObject* renderer, RenderRegion* region, const HighlightConfig& highlightConfig, Highlight& highlight, InspectorOverlay::CoordinateSystem coordinateSystem)
 {
     Frame* containingFrame = renderer->document().frame();
     if (!containingFrame)
         return;
 
-    highlight->setDataFromConfig(highlightConfig);
+    highlight.setDataFromConfig(highlightConfig);
     FrameView* containingView = containingFrame->view();
     FrameView* mainView = containingFrame->page()->mainFrame().view();
 
@@ -94,10 +95,10 @@
     bool isSVGRenderer = renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVGRoot();
 
     if (isSVGRenderer) {
-        highlight->type = HighlightTypeRects;
-        renderer->absoluteQuads(highlight->quads);
-        for (size_t i = 0; i < highlight->quads.size(); ++i)
-            contentsQuadToCoordinateSystem(mainView, containingView, highlight->quads[i], coordinateSystem);
+        highlight.type = HighlightType::Rects;
+        renderer->absoluteQuads(highlight.quads);
+        for (size_t i = 0; i < highlight.quads.size(); ++i)
+            contentsQuadToCoordinateSystem(mainView, containingView, highlight.quads[i], coordinateSystem);
     } else if (is<RenderBox>(*renderer) || is<RenderInline>(*renderer)) {
         LayoutRect contentBox;
         LayoutRect paddingBox;
@@ -178,35 +179,34 @@
         contentsQuadToCoordinateSystem(mainView, containingView, absBorderQuad, coordinateSystem);
         contentsQuadToCoordinateSystem(mainView, containingView, absMarginQuad, coordinateSystem);
 
-        highlight->type = HighlightTypeNode;
-        highlight->quads.append(absMarginQuad);
-        highlight->quads.append(absBorderQuad);
-        highlight->quads.append(absPaddingQuad);
-        highlight->quads.append(absContentQuad);
+        highlight.type = HighlightType::Node;
+        highlight.quads.append(absMarginQuad);
+        highlight.quads.append(absBorderQuad);
+        highlight.quads.append(absPaddingQuad);
+        highlight.quads.append(absContentQuad);
     }
 }
 
-static void buildNodeHighlight(Node* node, RenderRegion* region, const HighlightConfig& highlightConfig, Highlight* highlight, InspectorOverlay::CoordinateSystem coordinateSystem)
+static void buildNodeHighlight(Node& node, RenderRegion* region, const HighlightConfig& highlightConfig, Highlight& highlight, InspectorOverlay::CoordinateSystem coordinateSystem)
 {
-    RenderObject* renderer = node->renderer();
+    RenderObject* renderer = node.renderer();
     if (!renderer)
         return;
+
     buildRendererHighlight(renderer, region, highlightConfig, highlight, coordinateSystem);
 }
 
-static void buildQuadHighlight(const FloatQuad& quad, const HighlightConfig& highlightConfig, Highlight *highlight)
+static void buildQuadHighlight(const FloatQuad& quad, const HighlightConfig& highlightConfig, Highlight& highlight)
 {
-    highlight->setDataFromConfig(highlightConfig);
-    highlight->type = HighlightTypeRects;
-    highlight->quads.append(quad);
+    highlight.setDataFromConfig(highlightConfig);
+    highlight.type = HighlightType::Rects;
+    highlight.quads.append(quad);
 }
 
 InspectorOverlay::InspectorOverlay(Page& page, InspectorClient* client)
     : m_page(page)
     , m_client(client)
     , m_paintRectUpdateTimer(*this, &InspectorOverlay::updatePaintRectsTimerFired)
-    , m_indicating(false)
-    , m_showingPaintRects(false)
 {
 }
 
@@ -225,14 +225,14 @@
     view->paint(&context, IntRect(0, 0, view->width(), view->height()));
 }
 
-void InspectorOverlay::getHighlight(Highlight* highlight, InspectorOverlay::CoordinateSystem coordinateSystem) const
+void InspectorOverlay::getHighlight(Highlight& highlight, InspectorOverlay::CoordinateSystem coordinateSystem) const
 {
     if (!m_highlightNode && !m_highlightQuad)
         return;
 
-    highlight->type = HighlightTypeRects;
+    highlight.type = HighlightType::Rects;
     if (m_highlightNode)
-        buildNodeHighlight(m_highlightNode.get(), nullptr, m_nodeHighlightConfig, highlight, coordinateSystem);
+        buildNodeHighlight(*m_highlightNode, nullptr, m_nodeHighlightConfig, highlight, coordinateSystem);
     else
         buildQuadHighlight(*m_highlightQuad, m_quadHighlightConfig, highlight);
 }
@@ -331,50 +331,51 @@
     forcePaint();
 }
 
-static Ref<InspectorObject> buildObjectForPoint(const FloatPoint& point)
+static Ref<Inspector::Protocol::OverlayTypes::Point> buildObjectForPoint(const FloatPoint& point)
 {
-    Ref<InspectorObject> object = InspectorObject::create();
-    object->setDouble(ASCIILiteral("x"), point.x());
-    object->setDouble(ASCIILiteral("y"), point.y());
-    return WTF::move(object);
+    return Inspector::Protocol::OverlayTypes::Point::create()
+        .setX(point.x())
+        .setY(point.y())
+        .release();
 }
 
-static Ref<InspectorObject> buildObjectForRect(const FloatRect& rect)
+static Ref<Inspector::Protocol::OverlayTypes::Rect> buildObjectForRect(const FloatRect& rect)
 {
-    Ref<InspectorObject> object = InspectorObject::create();
-    object->setDouble(ASCIILiteral("x"), rect.x());
-    object->setDouble(ASCIILiteral("y"), rect.y());
-    object->setDouble(ASCIILiteral("width"), rect.width());
-    object->setDouble(ASCIILiteral("height"), rect.height());
-    return WTF::move(object);
+    return Inspector::Protocol::OverlayTypes::Rect::create()
+        .setX(rect.x())
+        .setY(rect.y())
+        .setWidth(rect.width())
+        .setHeight(rect.height())
+        .release();
 }
 
-static Ref<InspectorArray> buildArrayForQuad(const FloatQuad& quad)
+static Ref<Inspector::Protocol::OverlayTypes::Quad> buildArrayForQuad(const FloatQuad& quad)
 {
-    Ref<InspectorArray> array = InspectorArray::create();
-    array->pushObject(buildObjectForPoint(quad.p1()));
-    array->pushObject(buildObjectForPoint(quad.p2()));
-    array->pushObject(buildObjectForPoint(quad.p3()));
-    array->pushObject(buildObjectForPoint(quad.p4()));
+    auto array = Inspector::Protocol::OverlayTypes::Quad::create();
+    array->addItem(buildObjectForPoint(quad.p1()));
+    array->addItem(buildObjectForPoint(quad.p2()));
+    array->addItem(buildObjectForPoint(quad.p3()));
+    array->addItem(buildObjectForPoint(quad.p4()));
     return WTF::move(array);
 }
 
-static Ref<InspectorObject> buildObjectForHighlight(const Highlight& highlight)
+static Ref<Inspector::Protocol::OverlayTypes::FragmentHighlightData> buildObjectForHighlight(const Highlight& highlight)
 {
-    Ref<InspectorObject> object = InspectorObject::create();
-    Ref<InspectorArray> array = InspectorArray::create();
+    auto arrayOfQuads = Inspector::Protocol::Array<Inspector::Protocol::OverlayTypes::Quad>::create();
     for (size_t i = 0; i < highlight.quads.size(); ++i)
-        array->pushArray(buildArrayForQuad(highlight.quads[i]));
-    object->setArray("quads", WTF::move(array));
-    object->setString("contentColor", highlight.contentColor.serialized());
-    object->setString("contentOutlineColor", highlight.contentOutlineColor.serialized());
-    object->setString("paddingColor", highlight.paddingColor.serialized());
-    object->setString("borderColor", highlight.borderColor.serialized());
-    object->setString("marginColor", highlight.marginColor.serialized());
-    return WTF::move(object);
+        arrayOfQuads->addItem(buildArrayForQuad(highlight.quads[i]));
+
+    return Inspector::Protocol::OverlayTypes::FragmentHighlightData::create()
+        .setQuads(WTF::move(arrayOfQuads))
+        .setContentColor(highlight.contentColor.serialized())
+        .setContentOutlineColor(highlight.contentOutlineColor.serialized())
+        .setPaddingColor(highlight.paddingColor.serialized())
+        .setBorderColor(highlight.borderColor.serialized())
+        .setMarginColor(highlight.marginColor.serialized())
+        .release();
 }
 
-static RefPtr<InspectorObject> buildObjectForRegionHighlight(FrameView* mainView, RenderRegion* region)
+static RefPtr<Inspector::Protocol::OverlayTypes::Region> buildObjectForRegion(FrameView* mainView, RenderRegion* region)
 {
     FrameView* containingView = region->frame().view();
     if (!containingView)
@@ -388,7 +389,7 @@
     // Create incoming and outgoing boxes that we use to chain the regions toghether.
     const LayoutSize linkBoxSize(10, 10);
     const LayoutSize linkBoxMidpoint(linkBoxSize.width() / 2, linkBoxSize.height() / 2);
-    
+
     LayoutRect incomingRectBox = LayoutRect(borderBox.location() - linkBoxMidpoint, linkBoxSize);
     LayoutRect outgoingRectBox = LayoutRect(borderBox.location() - linkBoxMidpoint + borderBox.size(), linkBoxSize);
 
@@ -406,47 +407,45 @@
     contentsQuadToPage(mainView, containingView, incomingRectQuad);
     contentsQuadToPage(mainView, containingView, outgoingRectQuad);
 
-    Ref<InspectorObject> regionObject = InspectorObject::create();
-
-    regionObject->setArray("borderQuad", buildArrayForQuad(borderRectQuad));
-    regionObject->setArray("incomingQuad", buildArrayForQuad(incomingRectQuad));
-    regionObject->setArray("outgoingQuad", buildArrayForQuad(outgoingRectQuad));
-
-    return WTF::move(regionObject);
+    return Inspector::Protocol::OverlayTypes::Region::create()
+        .setBorderQuad(buildArrayForQuad(borderRectQuad))
+        .setIncomingQuad(buildArrayForQuad(incomingRectQuad))
+        .setOutgoingQuad(buildArrayForQuad(outgoingRectQuad))
+        .release();
 }
 
-static Ref<InspectorArray> buildObjectForCSSRegionsHighlight(RenderRegion* region, RenderFlowThread* flowThread)
+static Ref<Inspector::Protocol::Array<Inspector::Protocol::OverlayTypes::Region>> buildObjectForFlowRegions(RenderRegion* region, RenderFlowThread* flowThread)
 {
     FrameView* mainFrameView = region->document().page()->mainFrame().view();
 
-    Ref<InspectorArray> array = InspectorArray::create();
+    auto arrayOfRegions = Inspector::Protocol::Array<Inspector::Protocol::OverlayTypes::Region>::create();
 
     const RenderRegionList& regionList = flowThread->renderRegionList();
     for (auto& iterRegion : regionList) {
         if (!iterRegion->isValid())
             continue;
-        RefPtr<InspectorObject> regionHighlightObject = buildObjectForRegionHighlight(mainFrameView, iterRegion);
-        if (!regionHighlightObject)
+        RefPtr<Inspector::Protocol::OverlayTypes::Region> regionObject = buildObjectForRegion(mainFrameView, iterRegion);
+        if (!regionObject)
             continue;
         if (region == iterRegion) {
             // Let the script know that this is the currently highlighted node.
-            regionHighlightObject->setBoolean("isHighlighted", true);
+            regionObject->setIsHighlighted(true);
         }
-        array->pushObject(regionHighlightObject.release());
+        arrayOfRegions->addItem(WTF::move(regionObject));
     }
 
-    return WTF::move(array);
+    return WTF::move(arrayOfRegions);
 }
 
-static Ref<InspectorObject> buildObjectForSize(const IntSize& size)
+static Ref<Inspector::Protocol::OverlayTypes::Size> buildObjectForSize(const IntSize& size)
 {
-    Ref<InspectorObject> result = InspectorObject::create();
-    result->setInteger("width", size.width());
-    result->setInteger("height", size.height());
-    return WTF::move(result);
+    return Inspector::Protocol::OverlayTypes::Size::create()
+        .setWidth(size.width())
+        .setHeight(size.height())
+        .release();
 }
 
-static RefPtr<InspectorObject> buildObjectForCSSRegionContentClip(RenderRegion* region)
+static RefPtr<Inspector::Protocol::OverlayTypes::Quad> buildQuadObjectForCSSRegionContentClip(RenderRegion* region)
 {
     Frame* containingFrame = region->document().frame();
     if (!containingFrame)
@@ -466,9 +465,7 @@
     FloatQuad clipQuad = region->localToAbsoluteQuad(FloatRect(flippedRegionRect));
     contentsQuadToPage(mainView, containingView, clipQuad);
 
-    Ref<InspectorObject> regionObject = InspectorObject::create();
-    regionObject->setArray("quad", buildArrayForQuad(clipQuad));
-    return WTF::move(regionObject);
+    return buildArrayForQuad(clipQuad);
 }
 
 void InspectorOverlay::setShowingPaintRects(bool showingPaintRects)
@@ -514,7 +511,7 @@
         m_paintRects.removeFirst();
         rectsChanged = true;
     }
-    
+
     if (m_paintRects.isEmpty())
         m_paintRectUpdateTimer.stop();
 
@@ -526,11 +523,11 @@
 
 void InspectorOverlay::drawPaintRects()
 {
-    Ref<InspectorArray> fragmentsArray = InspectorArray::create();
+    auto arrayOfRects = Inspector::Protocol::Array<Inspector::Protocol::OverlayTypes::Rect>::create();
     for (const auto& pair : m_paintRects)
-        fragmentsArray->pushObject(buildObjectForRect(pair.second));
+        arrayOfRects->addItem(buildObjectForRect(pair.second));
 
-    evaluateInOverlay(ASCIILiteral("updatePaintRects"), WTF::move(fragmentsArray));
+    evaluateInOverlay(ASCIILiteral("updatePaintRects"), WTF::move(arrayOfRects));
 }
 
 void InspectorOverlay::drawGutter()
@@ -538,15 +535,15 @@
     evaluateInOverlay(ASCIILiteral("drawGutter"));
 }
 
-static RefPtr<InspectorArray> buildObjectForRendererFragments(RenderObject* renderer, const HighlightConfig& config)
+static RefPtr<Inspector::Protocol::Array<Inspector::Protocol::OverlayTypes::FragmentHighlightData>> buildArrayForRendererFragments(RenderObject* renderer, const HighlightConfig& config)
 {
-    Ref<InspectorArray> fragmentsArray = InspectorArray::create();
+    auto arrayOfFragments = Inspector::Protocol::Array<Inspector::Protocol::OverlayTypes::FragmentHighlightData>::create();
 
     RenderFlowThread* containingFlowThread = renderer->flowThreadContainingBlock();
     if (!containingFlowThread) {
         Highlight highlight;
-        buildRendererHighlight(renderer, nullptr, config, &highlight, InspectorOverlay::CoordinateSystem::View);
-        fragmentsArray->pushObject(buildObjectForHighlight(highlight));
+        buildRendererHighlight(renderer, nullptr, config, highlight, InspectorOverlay::CoordinateSystem::View);
+        arrayOfFragments->addItem(buildObjectForHighlight(highlight));
     } else {
         RenderRegion* startRegion = nullptr;
         RenderRegion* endRegion = nullptr;
@@ -561,19 +558,19 @@
             if (region->isValid()) {
                 // Compute the highlight of the fragment inside the current region.
                 Highlight highlight;
-                buildRendererHighlight(renderer, region, config, &highlight, InspectorOverlay::CoordinateSystem::View);
-                Ref<InspectorObject> fragmentObject = buildObjectForHighlight(highlight);
+                buildRendererHighlight(renderer, region, config, highlight, InspectorOverlay::CoordinateSystem::View);
+                Ref<Inspector::Protocol::OverlayTypes::FragmentHighlightData> fragmentHighlight = buildObjectForHighlight(highlight);
 
                 // Compute the clipping area of the region.
-                fragmentObject->setObject("region", buildObjectForCSSRegionContentClip(region));
-                fragmentsArray->pushObject(WTF::move(fragmentObject));
+                fragmentHighlight->setRegionClippingArea(buildQuadObjectForCSSRegionContentClip(region));
+                arrayOfFragments->addItem(WTF::move(fragmentHighlight));
             }
             if (region == endRegion)
                 break;
         }
     }
 
-    return WTF::move(fragmentsArray);
+    return WTF::move(arrayOfFragments);
 }
 
 #if ENABLE(CSS_SHAPES)
@@ -588,26 +585,27 @@
 struct PathApplyInfo {
     FrameView* rootView;
     FrameView* view;
-    InspectorArray* array;
+    Inspector::Protocol::OverlayTypes::DisplayPath* pathArray;
     RenderObject* renderer;
     const ShapeOutsideInfo* shapeOutsideInfo;
 };
 
-static void appendPathCommandAndPoints(PathApplyInfo* info, const String& command, const FloatPoint points[], unsigned length)
+static void appendPathCommandAndPoints(PathApplyInfo& info, const String& command, const FloatPoint points[], unsigned length)
 {
     FloatPoint point;
-    info->array->pushString(command);
+    info.pathArray->addItem(command);
     for (unsigned i = 0; i < length; i++) {
-        point = info->shapeOutsideInfo->shapeToRendererPoint(points[i]);
-        point = localPointToRoot(info->renderer, info->rootView, info->view, point);
-        info->array->pushDouble(point.x());
-        info->array->pushDouble(point.y());
+        point = info.shapeOutsideInfo->shapeToRendererPoint(points[i]);
+        point = localPointToRoot(info.renderer, info.rootView, info.view, point);
+        info.pathArray->addItem(point.x());
+        info.pathArray->addItem(point.y());
     }
 }
 
+// Used as a functor for Shape::apply, which has not been cleaned up to use modern C++.
 static void appendPathSegment(void* info, const PathElement* pathElement)
 {
-    PathApplyInfo* pathApplyInfo = static_cast<PathApplyInfo*>(info);
+    PathApplyInfo& pathApplyInfo = *static_cast<PathApplyInfo*>(info);
     FloatPoint point;
     switch (pathElement->type) {
     // The points member will contain 1 value.
@@ -633,41 +631,43 @@
     }
 }
 
-static RefPtr<InspectorObject> buildObjectForShapeOutside(Frame* containingFrame, RenderBox* renderer)
+static RefPtr<Inspector::Protocol::OverlayTypes::ShapeOutsideData> buildObjectForShapeOutside(Frame* containingFrame, RenderBox* renderer)
 {
     const ShapeOutsideInfo* shapeOutsideInfo = renderer->shapeOutsideInfo();
     if (!shapeOutsideInfo)
         return nullptr;
 
-    Ref<InspectorObject> shapeObject = InspectorObject::create();
     LayoutRect shapeBounds = shapeOutsideInfo->computedShapePhysicalBoundingBox();
     FloatQuad shapeQuad = renderer->localToAbsoluteQuad(FloatRect(shapeBounds));
     contentsQuadToPage(containingFrame->page()->mainFrame().view(), containingFrame->view(), shapeQuad);
-    shapeObject->setArray(ASCIILiteral("bounds"), buildArrayForQuad(shapeQuad));
 
+    auto shapeObject = Inspector::Protocol::OverlayTypes::ShapeOutsideData::create()
+        .setBounds(buildArrayForQuad(shapeQuad))
+        .release();
+
     Shape::DisplayPaths paths;
     shapeOutsideInfo->computedShape().buildDisplayPaths(paths);
 
     if (paths.shape.length()) {
-        Ref<InspectorArray> shapePath = InspectorArray::create();
+        auto shapePath = Inspector::Protocol::OverlayTypes::DisplayPath::create();
         PathApplyInfo info;
         info.rootView = containingFrame->page()->mainFrame().view();
         info.view = containingFrame->view();
-        info.array = &shapePath.get();
+        info.pathArray = &shapePath.get();
         info.renderer = renderer;
         info.shapeOutsideInfo = shapeOutsideInfo;
 
         paths.shape.apply(&info, &appendPathSegment);
 
-        shapeObject->setArray(ASCIILiteral("shape"), shapePath.copyRef());
+        shapeObject->setShape(shapePath.copyRef());
 
         if (paths.marginShape.length()) {
-            shapePath = InspectorArray::create();
-            info.array = &shapePath.get();
+            auto marginShapePath = Inspector::Protocol::OverlayTypes::DisplayPath::create();
+            info.pathArray = &marginShapePath.get();
 
             paths.marginShape.apply(&info, &appendPathSegment);
 
-            shapeObject->setArray(ASCIILiteral("marginShape"), shapePath.copyRef());
+            shapeObject->setMarginShape(shapePath.copyRef());
         }
     }
 
@@ -675,18 +675,19 @@
 }
 #endif
 
-static RefPtr<InspectorObject> buildObjectForElementInfo(Node* node)
+static RefPtr<Inspector::Protocol::OverlayTypes::ElementData> buildObjectForElementData(Node* node)
 {
-    ASSERT(node);
-    if (!is<Element>(*node) || !node->document().frame())
+    if (!is<Element>(node) || !node->document().frame())
         return nullptr;
 
-    Ref<InspectorObject> elementInfo = InspectorObject::create();
-
     Element& element = downcast<Element>(*node);
     bool isXHTML = element.document().isXHTMLDocument();
-    elementInfo->setString("tagName", isXHTML ? element.nodeName() : element.nodeName().lower());
-    elementInfo->setString("idValue", element.getIdAttribute());
+
+    auto elementData = Inspector::Protocol::OverlayTypes::ElementData::create()
+        .setTagName(isXHTML ? element.nodeName() : element.nodeName().lower())
+        .setIdValue(element.getIdAttribute())
+        .release();
+
     HashSet<AtomicString> usedClassNames;
     if (element.hasClass() && is<StyledElement>(element)) {
         StringBuilder classNames;
@@ -700,40 +701,49 @@
             classNames.append('.');
             classNames.append(className);
         }
-        elementInfo->setString("className", classNames.toString());
+        elementData->setClassName(classNames.toString());
     }
 
     RenderElement* renderer = element.renderer();
+    if (!renderer)
+        return nullptr;
+
     Frame* containingFrame = node->document().frame();
     FrameView* containingView = containingFrame->view();
     IntRect boundingBox = snappedIntRect(containingView->contentsToRootView(renderer->absoluteBoundingBoxRect()));
     RenderBoxModelObject* modelObject = is<RenderBoxModelObject>(*renderer) ? downcast<RenderBoxModelObject>(renderer) : nullptr;
-    elementInfo->setString("nodeWidth", String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), *modelObject) : boundingBox.width()));
-    elementInfo->setString("nodeHeight", String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), *modelObject) : boundingBox.height()));
-    
+    auto sizeObject = Inspector::Protocol::OverlayTypes::Size::create()
+        .setWidth(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), *modelObject) : boundingBox.width())
+        .setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), *modelObject) : boundingBox.height())
+        .release();
+    elementData->setSize(WTF::move(sizeObject));
+
     if (renderer->isRenderNamedFlowFragmentContainer()) {
         RenderNamedFlowFragment& region = *downcast<RenderBlockFlow>(*renderer).renderNamedFlowFragment();
         if (region.isValid()) {
             RenderFlowThread* flowThread = region.flowThread();
-            RefPtr<InspectorObject> regionFlowInfo = InspectorObject::create();
-            regionFlowInfo->setString("name", downcast<RenderNamedFlowThread>(*flowThread).flowThreadName());
-            regionFlowInfo->setArray("regions", buildObjectForCSSRegionsHighlight(&region, flowThread));
-            elementInfo->setObject("regionFlowInfo", regionFlowInfo.release());
+            auto regionFlowData = Inspector::Protocol::OverlayTypes::RegionFlowData::create()
+                .setName(downcast<RenderNamedFlowThread>(*flowThread).flowThreadName())
+                .setRegions(buildObjectForFlowRegions(&region, flowThread))
+                .release();
+            elementData->setRegionFlowData(WTF::move(regionFlowData));
         }
     }
 
     RenderFlowThread* containingFlowThread = renderer->flowThreadContainingBlock();
     if (is<RenderNamedFlowThread>(containingFlowThread)) {
-        RefPtr<InspectorObject> contentFlowInfo = InspectorObject::create();
-        contentFlowInfo->setString("name", downcast<RenderNamedFlowThread>(*containingFlowThread).flowThreadName());
-        elementInfo->setObject("contentFlowInfo", contentFlowInfo.release());
+        auto contentFlowData = Inspector::Protocol::OverlayTypes::ContentFlowData::create()
+            .setName(downcast<RenderNamedFlowThread>(*containingFlowThread).flowThreadName())
+            .release();
+
+        elementData->setContentFlowData(WTF::move(contentFlowData));
     }
 
 #if ENABLE(CSS_SHAPES)
     if (is<RenderBox>(*renderer)) {
         auto& renderBox = downcast<RenderBox>(*renderer);
-        if (RefPtr<InspectorObject> shapeObject = buildObjectForShapeOutside(containingFrame, &renderBox))
-            elementInfo->setObject("shapeOutsideInfo", shapeObject.release());
+        if (RefPtr<Inspector::Protocol::OverlayTypes::ShapeOutsideData> shapeObject = buildObjectForShapeOutside(containingFrame, &renderBox))
+            elementData->setShapeOutsideData(WTF::move(shapeObject));
     }
 #endif
 
@@ -743,13 +753,13 @@
 
     if (AXObjectCache* axObjectCache = node->document().axObjectCache()) {
         if (AccessibilityObject* axObject = axObjectCache->getOrCreate(node))
-            elementInfo->setString("role", axObject->computedRoleString());
+            elementData->setRole(axObject->computedRoleString());
     }
 
-    return WTF::move(elementInfo);
+    return WTF::move(elementData);
 }
 
-RefPtr<InspectorObject> InspectorOverlay::buildObjectForHighlightedNode() const
+RefPtr<Inspector::Protocol::OverlayTypes::NodeHighlightData> InspectorOverlay::buildObjectForHighlightedNode() const
 {
     if (!m_highlightNode)
         return nullptr;
@@ -759,33 +769,30 @@
     if (!renderer)
         return nullptr;
 
-    RefPtr<InspectorArray> highlightFragments = buildObjectForRendererFragments(renderer, m_nodeHighlightConfig);
-    if (!highlightFragments)
+    RefPtr<Inspector::Protocol::Array<Inspector::Protocol::OverlayTypes::FragmentHighlightData>> arrayOfFragmentHighlights = buildArrayForRendererFragments(renderer, m_nodeHighlightConfig);
+    if (!arrayOfFragmentHighlights)
         return nullptr;
 
-    Ref<InspectorObject> highlightObject = InspectorObject::create();
-
     // The main view's scroll offset is shared across all quads.
     FrameView* mainView = m_page.mainFrame().view();
-    highlightObject->setObject("scroll", buildObjectForPoint(!mainView->delegatesScrolling() ? mainView->visibleContentRect().location() : FloatPoint()));
 
-    highlightObject->setArray("fragments", highlightFragments.release());
+    auto nodeHighlightObject = Inspector::Protocol::OverlayTypes::NodeHighlightData::create()
+        .setScrollOffset(buildObjectForPoint(!mainView->delegatesScrolling() ? mainView->visibleContentRect().location() : FloatPoint()))
+        .setFragments(WTF::move(arrayOfFragmentHighlights))
+        .release();
 
     if (m_nodeHighlightConfig.showInfo) {
-        RefPtr<InspectorObject> elementInfo = buildObjectForElementInfo(node);
-        if (elementInfo)
-            highlightObject->setObject("elementInfo", elementInfo.release());
+        if (RefPtr<Inspector::Protocol::OverlayTypes::ElementData> elementData = buildObjectForElementData(node))
+            nodeHighlightObject->setElementData(WTF::move(elementData));
     }
-        
-    return WTF::move(highlightObject);
+
+    return WTF::move(nodeHighlightObject);
 }
 
 void InspectorOverlay::drawNodeHighlight()
 {
-    RefPtr<InspectorObject> highlightObject = buildObjectForHighlightedNode();
-    if (!highlightObject)
-        return;
-    evaluateInOverlay("drawNodeHighlight", highlightObject);
+    if (RefPtr<Inspector::Protocol::OverlayTypes::NodeHighlightData> highlightObject = buildObjectForHighlightedNode())
+        evaluateInOverlay("drawNodeHighlight", WTF::move(highlightObject));
 }
 
 void InspectorOverlay::drawQuadHighlight()
@@ -794,7 +801,7 @@
         return;
 
     Highlight highlight;
-    buildQuadHighlight(*m_highlightQuad, m_quadHighlightConfig, &highlight);
+    buildQuadHighlight(*m_highlightQuad, m_quadHighlightConfig, highlight);
     evaluateInOverlay("drawQuadHighlight", buildObjectForHighlight(highlight));
 }
 
@@ -859,11 +866,12 @@
 
 void InspectorOverlay::reset(const IntSize& viewportSize, const IntSize& frameViewFullSize)
 {
-    Ref<InspectorObject> resetData = InspectorObject::create();
-    resetData->setDouble("deviceScaleFactor", m_page.deviceScaleFactor());
-    resetData->setObject("viewportSize", buildObjectForSize(viewportSize));
-    resetData->setObject("frameViewFullSize", buildObjectForSize(frameViewFullSize));
-    evaluateInOverlay("reset", WTF::move(resetData));
+    auto configObject = Inspector::Protocol::OverlayTypes::OverlayConfiguration::create()
+        .setDeviceScaleFactor(m_page.deviceScaleFactor())
+        .setViewportSize(buildObjectForSize(viewportSize))
+        .setFrameViewFullSize(buildObjectForSize(frameViewFullSize))
+        .release();
+    evaluateInOverlay("reset", WTF::move(configObject));
 }
 
 void InspectorOverlay::evaluateInOverlay(const String& method)

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.h (178630 => 178631)


--- trunk/Source/WebCore/inspector/InspectorOverlay.h	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.h	2015-01-18 17:07:05 UTC (rev 178631)
@@ -41,7 +41,13 @@
 namespace Inspector {
 class InspectorObject;
 class InspectorValue;
+
+namespace Protocol {
+namespace OverlayTypes {
+class NodeHighlightData;
 }
+}
+}
 
 namespace WebCore {
 
@@ -64,17 +70,13 @@
     bool usePageCoordinates;
 };
 
-enum HighlightType {
-    HighlightTypeNode,
-    HighlightTypeRects,
+enum class HighlightType {
+    Node, // Provides 4 quads: margin, border, padding, content.
+    Rects, // Provides a list of quads.
 };
 
 struct Highlight {
-    Highlight()
-        : type(HighlightTypeNode)
-        , usePageCoordinates(true)
-    {
-    }
+    Highlight() { }
 
     void setDataFromConfig(const HighlightConfig& highlightConfig)
     {
@@ -92,11 +94,9 @@
     Color borderColor;
     Color marginColor;
 
-    // When the type is Node, there are 4 quads (margin, border, padding, content).
-    // When the type is Rects, this is just a list of quads.
-    HighlightType type;
+    HighlightType type {HighlightType::Node};
     Vector<FloatQuad> quads;
-    bool usePageCoordinates;
+    bool usePageCoordinates {true};
 };
 
 class InspectorOverlay {
@@ -112,7 +112,7 @@
 
     void update();
     void paint(GraphicsContext&);
-    void getHighlight(Highlight*, CoordinateSystem) const;
+    void getHighlight(Highlight&, CoordinateSystem) const;
 
     void setPausedInDebuggerMessage(const String*);
 
@@ -129,7 +129,7 @@
 
     void setIndicating(bool indicating);
 
-    RefPtr<Inspector::InspectorObject> buildObjectForHighlightedNode() const;
+    RefPtr<Inspector::Protocol::OverlayTypes::NodeHighlightData> buildObjectForHighlightedNode() const;
 
     void freePage();
 private:
@@ -161,8 +161,8 @@
     typedef std::pair<std::chrono::steady_clock::time_point, FloatRect> TimeRectPair;
     Deque<TimeRectPair> m_paintRects;
     Timer m_paintRectUpdateTimer;
-    bool m_indicating;
-    bool m_showingPaintRects;
+    bool m_indicating {false};
+    bool m_showingPaintRects {false};
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/inspector/InspectorOverlayPage.js (178630 => 178631)


--- trunk/Source/WebCore/inspector/InspectorOverlayPage.js	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebCore/inspector/InspectorOverlayPage.js	2015-01-18 17:07:05 UTC (rev 178631)
@@ -261,37 +261,37 @@
     return value && value.length > maxLength ? value.substring(0, 50) + "\u2026" : value;
 }
 
-function _createElementTitle(elementInfo)
+function _createElementTitle(elementData)
 {
     var builder = new DOMBuilder("div", "element-title");
     
-    builder.appendSpanIfNotNull("tag-name", elementInfo.tagName);
-    builder.appendSpanIfNotNull("node-id", elementInfo.idValue, "#");
-    builder.appendSpanIfNotNull("class-name", _truncateString(elementInfo.className, 50));
+    builder.appendSpanIfNotNull("tag-name", elementData.tagName);
+    builder.appendSpanIfNotNull("node-id", elementData.idValue, "#");
+    builder.appendSpanIfNotNull("class-name", _truncateString(elementData.className, 50));
 
     builder.appendTextNode(" ");
-    builder.appendSpan("node-width", elementInfo.nodeWidth);
+    builder.appendSpan("node-width", elementData.size.width);
     // \xd7 is the code for the &times; HTML entity.
     builder.appendSpan("px", "px \xd7 ");
-    builder.appendSpan("node-height", elementInfo.nodeHeight);
+    builder.appendSpan("node-height", elementData.size.height);
     builder.appendSpan("px", "px");
 
-    builder.appendPropertyIfNotNull("role-name", "Role", elementInfo.role);
-    builder.appendPropertyIfNotNull("region-flow-name", "Region Flow", elementInfo.regionFlowInfo ? elementInfo.regionFlowInfo.name : null);
-    builder.appendPropertyIfNotNull("content-flow-name", "Content Flow", elementInfo.contentFlowInfo ? elementInfo.contentFlowInfo.name : null);
+    builder.appendPropertyIfNotNull("role-name", "Role", elementData.role);
+    builder.appendPropertyIfNotNull("region-flow-name", "Region Flow", elementData.regionFlowData ? elementData.regionFlowData.name : null);
+    builder.appendPropertyIfNotNull("content-flow-name", "Content Flow", elementData.contentFlowData ? elementData.contentFlowData.name : null);
 
     document.getElementById("element-title-container").appendChild(builder.element);
 
     return builder.element;
 }
 
-function _drawElementTitle(elementInfo, fragmentHighlight, scroll)
+function _drawElementTitle(elementData, fragmentHighlight, scroll)
 {
-    if (!elementInfo || !fragmentHighlight.quads.length)
+    if (!elementData || !fragmentHighlight.quads.length)
         return;
-    
-    var elementTitle = _createElementTitle(elementInfo);
 
+    var elementTitle = _createElementTitle(elementData);
+
     var marginQuad = fragmentHighlight.quads[0];
 
     var titleWidth = elementTitle.offsetWidth + 6;
@@ -305,11 +305,10 @@
     var renderArrowDown = false;
 
     var boxX = marginQuad[0].x;
-    
-    var containingRegion = fragmentHighlight.region;
-    if (containingRegion) {
+
+    var clipQuad = fragmentHighlight.regionClippingArea;
+    if (clipQuad) {
         // Restrict the position of the title box to the area of the containing region.
-        var clipQuad = containingRegion.quad;
         anchorTop = Math.max(anchorTop, Math.min(clipQuad[0].y, clipQuad[1].y, clipQuad[2].y, clipQuad[3].y));
         anchorBottom = Math.min(anchorBottom, Math.max(clipQuad[0].y, clipQuad[1].y, clipQuad[2].y, clipQuad[3].y));
         boxX = Math.max(boxX, Math.min(clipQuad[0].x, clipQuad[1].x, clipQuad[2].x, clipQuad[3].x));
@@ -430,9 +429,9 @@
 
     context.save();
 
-    if (highlight.region) {
+    if (highlight.regionClippingArea) {
         // Clip to the containing region to avoid showing fragments that are not rendered by this region.
-        quadToPath(highlight.region.quad).clip();
+        quadToPath(highlight.regionClippingArea).clip();
     }
 
     var quads = highlight.quads.slice();
@@ -491,23 +490,23 @@
 function drawNodeHighlight(highlight)
 {
     context.save();
-    context.translate(-highlight.scroll.x, -highlight.scroll.y);
+    context.translate(-highlight.scrollOffset.x, -highlight.scrollOffset.y);
 
     for (var i = 0; i < highlight.fragments.length; ++i)
         _drawFragmentHighlight(highlight.fragments[i]);
 
-    if (highlight.elementInfo && highlight.elementInfo.regionFlowInfo)
-        _drawRegionsHighlight(highlight.elementInfo.regionFlowInfo.regions);
+    if (highlight.elementData && highlight.elementData.regionFlowData)
+        _drawRegionsHighlight(highlight.elementData.regionFlowData.regions);
 
-    if (highlight.elementInfo && highlight.elementInfo.shapeOutsideInfo)
-        _drawShapeHighlight(highlight.elementInfo.shapeOutsideInfo);
+    if (highlight.elementData && highlight.elementData.shapeOutsideData)
+        _drawShapeHighlight(highlight.elementData.shapeOutsideData);
 
     context.restore();
 
     var elementTitleContainer = document.getElementById("element-title-container");
     elementTitleContainer.innerHTML = "";
     for (var i = 0; i < highlight.fragments.length; ++i)
-        _drawElementTitle(highlight.elementInfo, highlight.fragments[i], highlight.scroll);
+        _drawElementTitle(highlight.elementData, highlight.fragments[i], highlight.scrollOffset);
 }
 
 function drawQuadHighlight(highlight)

Modified: trunk/Source/WebCore/testing/Internals.cpp (178630 => 178631)


--- trunk/Source/WebCore/testing/Internals.cpp	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebCore/testing/Internals.cpp	2015-01-18 17:07:05 UTC (rev 178631)
@@ -785,7 +785,7 @@
     }
 
     Highlight highlight;
-    document->page()->inspectorController().getHighlight(&highlight, InspectorOverlay::CoordinateSystem::View);
+    document->page()->inspectorController().getHighlight(highlight, InspectorOverlay::CoordinateSystem::View);
     return ClientRectList::create(highlight.quads);
 #else
     UNUSED_PARAM(ec);
@@ -801,7 +801,7 @@
         ec = INVALID_ACCESS_ERR;
         return String();
     }
-    RefPtr<InspectorObject> object = document->page()->inspectorController().buildObjectForHighlightedNode();
+    auto object = document->page()->inspectorController().buildObjectForHighlightedNode();
     return object ? object->toJSONString() : String();
 #else
     UNUSED_PARAM(ec);

Modified: trunk/Source/WebKit/ChangeLog (178630 => 178631)


--- trunk/Source/WebKit/ChangeLog	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebKit/ChangeLog	2015-01-18 17:07:05 UTC (rev 178631)
@@ -1,3 +1,12 @@
+2015-01-17  Brian J. Burg  <[email protected]>
+
+        Web Inspector: highlight data for overlay should use protocol type builders
+        https://bugs.webkit.org/show_bug.cgi?id=129441
+
+        Reviewed by Timothy Hatcher.
+
+        * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: Update symbol.
+
 2015-01-14  Brent Fulgham  <[email protected]>
 
         [Win] Unreviewed build fix after r178459 and r178462.

Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in (178630 => 178631)


--- trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2015-01-18 01:41:15 UTC (rev 178630)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2015-01-18 17:07:05 UTC (rev 178631)
@@ -208,8 +208,8 @@
         symbolWithPointer(?item@StaticNodeList@WebCore@@UBEPAVNode@2@I@Z, ?item@StaticNodeList@WebCore@@UEBAPEAVNode@2@I@Z)
         ?selectTag@HTMLNames@WebCore@@3VHTMLQualifiedName@2@B
 #if ENABLE(INSPECTOR)
-        symbolWithPointer(?buildObjectForHighlightedNode@InspectorController@WebCore@@QBE?AV?$RefPtr@VInspectorObject@Inspector@@@WTF@@XZ, ?buildObjectForHighlightedNode@InspectorController@WebCore@@QEBA?AV?$RefPtr@VInspectorObject@Inspector@@@WTF@@XZ)
-        symbolWithPointer(?getHighlight@InspectorController@WebCore@@QBEXPAUHighlight@2@W4CoordinateSystem@InspectorOverlay@2@@Z, ?getHighlight@InspectorController@WebCore@@QEBAXPEAUHighlight@2@W4CoordinateSystem@InspectorOverlay@2@@Z)
+        symbolWithPointer(?buildObjectForHighlightedNode@InspectorController@WebCore@@QBE?AV?$RefPtr@VNodeHighlightData@OverlayTypes@Protocol@Inspector@@@WTF@@XZ, ?buildObjectForHighlightedNode@InspectorController@WebCore@@QBEA?AV?$RefPtr@VNodeHighlightData@OverlayTypes@Protocol@Inspector@@@WTF@@XZ)
+        symbolWithPointer(?getHighlight@InspectorController@WebCore@@QBEXAAUHighlight@2@W4CoordinateSystem@InspectorOverlay@2@@Z, ?getHighlight@InspectorController@WebCore@@QBEXEAAUHighlight@2@W4CoordinateSystem@InspectorOverlay@2@@Z)
         symbolWithPointer(?instrumentingAgentsForPage@InspectorInstrumentation@WebCore@@SAPAVInstrumentingAgents@2@PAVPage@2@@Z, ?instrumentingAgentsForPage@InspectorInstrumentation@WebCore@@SAPEAVInstrumentingAgents@2@PEAVPage@2@@Z)
         ?s_frontendCounter@InspectorInstrumentation@WebCore@@0HA
         symbolWithPointer(?isUnderTest@InspectorFrontendClientLocal@WebCore@@UAE_NXZ, ?isUnderTest@InspectorFrontendClientLocal@WebCore@@UEAA_NXZ)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to