Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp

Issue 1738073002: DevTools: introduce protocol::Value, baseline for hierarchical data in remote debugging protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp b/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
index 9d66f7042deba8f5eb86d6b7e3802496c0629e85..1a0bb64f108e10c722e76429bea0d03bad7809ab 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
@@ -22,10 +22,10 @@ class PathBuilder {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(PathBuilder);
public:
- PathBuilder() : m_path(JSONArray::create()) { }
+ PathBuilder() : m_path(protocol::ListValue::create()) { }
virtual ~PathBuilder() { }
- PassRefPtr<JSONArray> path() const { return m_path; }
+ PassRefPtr<protocol::ListValue> path() const { return m_path; }
void appendPath(const Path& path)
{
@@ -44,16 +44,16 @@ private:
void appendPathElement(const PathElement*);
void appendPathCommandAndPoints(const char* command, const FloatPoint points[], size_t length);
- RefPtr<JSONArray> m_path;
+ RefPtr<protocol::ListValue> m_path;
};
void PathBuilder::appendPathCommandAndPoints(const char* command, const FloatPoint points[], size_t length)
{
- m_path->pushString(command);
+ m_path->pushValue(protocol::StringValue::create(command));
for (size_t i = 0; i < length; i++) {
FloatPoint point = translatePoint(points[i]);
- m_path->pushNumber(point.x());
- m_path->pushNumber(point.y());
+ m_path->pushValue(protocol::FundamentalValue::create(point.x()));
+ m_path->pushValue(protocol::FundamentalValue::create(point.y()));
}
}
@@ -90,7 +90,7 @@ public:
, m_layoutObject(layoutObject)
, m_shapeOutsideInfo(shapeOutsideInfo) { }
- static RefPtr<JSONArray> buildPath(FrameView& view, LayoutObject& layoutObject, const ShapeOutsideInfo& shapeOutsideInfo, const Path& path)
+ static RefPtr<protocol::ListValue> buildPath(FrameView& view, LayoutObject& layoutObject, const ShapeOutsideInfo& shapeOutsideInfo, const Path& path)
{
ShapePathBuilder builder(view, layoutObject, shapeOutsideInfo);
builder.appendPath(path);
@@ -163,9 +163,9 @@ const ShapeOutsideInfo* shapeOutsideInfoForNode(Node* node, Shape::DisplayPaths*
return shapeOutsideInfo;
}
-PassRefPtr<JSONObject> buildElementInfo(Element* element)
+PassRefPtr<protocol::DictionaryValue> buildElementInfo(Element* element)
{
- RefPtr<JSONObject> elementInfo = JSONObject::create();
+ RefPtr<protocol::DictionaryValue> elementInfo = protocol::DictionaryValue::create();
Element* realElement = element;
PseudoElement* pseudoElement = nullptr;
if (element->isPseudoElement()) {
@@ -214,7 +214,7 @@ PassRefPtr<JSONObject> buildElementInfo(Element* element)
} // namespace
InspectorHighlight::InspectorHighlight()
- : m_highlightPaths(JSONArray::create())
+ : m_highlightPaths(protocol::ListValue::create())
, m_showRulers(false)
, m_showExtensionLines(false)
, m_displayAsMaterial(false)
@@ -230,7 +230,7 @@ InspectorHighlightConfig::InspectorHighlightConfig()
}
InspectorHighlight::InspectorHighlight(Node* node, const InspectorHighlightConfig& highlightConfig, bool appendElementInfo)
- : m_highlightPaths(JSONArray::create())
+ : m_highlightPaths(protocol::ListValue::create())
, m_showRulers(highlightConfig.showRulers)
, m_showExtensionLines(highlightConfig.showExtensionLines)
, m_displayAsMaterial(highlightConfig.displayAsMaterial)
@@ -253,16 +253,16 @@ void InspectorHighlight::appendQuad(const FloatQuad& quad, const Color& fillColo
appendPath(builder.path(), fillColor, outlineColor, name);
}
-void InspectorHighlight::appendPath(PassRefPtr<JSONArray> path, const Color& fillColor, const Color& outlineColor, const String& name)
+void InspectorHighlight::appendPath(PassRefPtr<protocol::ListValue> path, const Color& fillColor, const Color& outlineColor, const String& name)
{
- RefPtr<JSONObject> object = JSONObject::create();
+ RefPtr<protocol::DictionaryValue> object = protocol::DictionaryValue::create();
object->setValue("path", path);
object->setString("fillColor", fillColor.serialized());
if (outlineColor != Color::transparent)
object->setString("outlineColor", outlineColor.serialized());
if (!name.isEmpty())
object->setString("name", name);
- m_highlightPaths->pushObject(object.release());
+ m_highlightPaths->pushValue(object.release());
}
void InspectorHighlight::appendEventTargetQuads(Node* eventTargetNode, const InspectorHighlightConfig& highlightConfig)
@@ -321,9 +321,9 @@ void InspectorHighlight::appendNodeHighlight(Node* node, const InspectorHighligh
appendQuad(margin, highlightConfig.margin, Color::transparent, "margin");
}
-PassRefPtr<JSONObject> InspectorHighlight::asJSONObject() const
+PassRefPtr<protocol::DictionaryValue> InspectorHighlight::asProtocolValue() const
{
- RefPtr<JSONObject> object = JSONObject::create();
+ RefPtr<protocol::DictionaryValue> object = protocol::DictionaryValue::create();
object->setArray("paths", m_highlightPaths);
object->setBoolean("showRulers", m_showRulers);
object->setBoolean("showExtensionLines", m_showExtensionLines);
@@ -362,8 +362,8 @@ bool InspectorHighlight::getBoxModel(Node* node, OwnPtr<protocol::DOM::BoxModel>
if (const ShapeOutsideInfo* shapeOutsideInfo = shapeOutsideInfoForNode(node, &paths, &boundsQuad)) {
(*model)->setShapeOutside(protocol::DOM::ShapeOutsideInfo::create()
.setBounds(buildArrayForQuad(boundsQuad))
- .setShape(protocol::Array<RefPtr<JSONValue>>::parse(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.shape), &errors))
- .setMarginShape(protocol::Array<RefPtr<JSONValue>>::parse(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.marginShape), &errors))
+ .setShape(protocol::Array<RefPtr<protocol::Value>>::parse(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.shape), &errors))
+ .setMarginShape(protocol::Array<RefPtr<protocol::Value>>::parse(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.marginShape), &errors))
.build());
}

Powered by Google App Engine
This is Rietveld 408576698