| 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 b169e89681dbf453baead43b4393e8a9d77ac905..8badfb57b3bf6ee87ec7a8af330d0e9c2646eee8 100644
|
| --- a/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/InspectorHighlight.cpp
|
| @@ -22,10 +22,11 @@ class PathBuilder {
|
| STACK_ALLOCATED();
|
| WTF_MAKE_NONCOPYABLE(PathBuilder);
|
| public:
|
| - PathBuilder() : m_path(protocol::TypeBuilder::Array<JSONValue>::create()) { }
|
| + PathBuilder() : m_path(JSONArray::create()) { }
|
| virtual ~PathBuilder() { }
|
|
|
| - PassRefPtr<protocol::TypeBuilder::Array<JSONValue>> path() const { return m_path; }
|
| + PassRefPtr<JSONArray> path() const { return m_path; }
|
| +
|
| void appendPath(const Path& path)
|
| {
|
| path.apply(this, &PathBuilder::appendPathElement);
|
| @@ -43,16 +44,16 @@ private:
|
| void appendPathElement(const PathElement*);
|
| void appendPathCommandAndPoints(const char* command, const FloatPoint points[], size_t length);
|
|
|
| - RefPtr<protocol::TypeBuilder::Array<JSONValue>> m_path;
|
| + RefPtr<JSONArray> m_path;
|
| };
|
|
|
| void PathBuilder::appendPathCommandAndPoints(const char* command, const FloatPoint points[], size_t length)
|
| {
|
| - m_path->addItem(JSONString::create(command));
|
| + m_path->pushString(command);
|
| for (size_t i = 0; i < length; i++) {
|
| FloatPoint point = translatePoint(points[i]);
|
| - m_path->addItem(JSONBasicValue::create(point.x()));
|
| - m_path->addItem(JSONBasicValue::create(point.y()));
|
| + m_path->pushNumber(point.x());
|
| + m_path->pushNumber(point.y());
|
| }
|
| }
|
|
|
| @@ -89,7 +90,7 @@ public:
|
| , m_layoutObject(layoutObject)
|
| , m_shapeOutsideInfo(shapeOutsideInfo) { }
|
|
|
| - static PassRefPtr<protocol::TypeBuilder::Array<JSONValue>> buildPath(FrameView& view, LayoutObject& layoutObject, const ShapeOutsideInfo& shapeOutsideInfo, const Path& path)
|
| + static RefPtr<JSONArray> buildPath(FrameView& view, LayoutObject& layoutObject, const ShapeOutsideInfo& shapeOutsideInfo, const Path& path)
|
| {
|
| ShapePathBuilder builder(view, layoutObject, shapeOutsideInfo);
|
| builder.appendPath(path);
|
| @@ -110,9 +111,9 @@ private:
|
| };
|
|
|
|
|
| -PassRefPtr<protocol::TypeBuilder::Array<double>> buildArrayForQuad(const FloatQuad& quad)
|
| +PassOwnPtr<protocol::Array<double>> buildArrayForQuad(const FloatQuad& quad)
|
| {
|
| - RefPtr<protocol::TypeBuilder::Array<double>> array = protocol::TypeBuilder::Array<double>::create();
|
| + OwnPtr<protocol::Array<double>> array = protocol::Array<double>::create();
|
| array->addItem(quad.p1().x());
|
| array->addItem(quad.p1().y());
|
| array->addItem(quad.p2().x());
|
| @@ -252,7 +253,7 @@ void InspectorHighlight::appendQuad(const FloatQuad& quad, const Color& fillColo
|
| appendPath(builder.path(), fillColor, outlineColor, name);
|
| }
|
|
|
| -void InspectorHighlight::appendPath(PassRefPtr<JSONArrayBase> path, const Color& fillColor, const Color& outlineColor, const String& name)
|
| +void InspectorHighlight::appendPath(PassRefPtr<JSONArray> path, const Color& fillColor, const Color& outlineColor, const String& name)
|
| {
|
| RefPtr<JSONObject> object = JSONObject::create();
|
| object->setValue("path", path);
|
| @@ -333,7 +334,7 @@ PassRefPtr<JSONObject> InspectorHighlight::asJSONObject() const
|
| }
|
|
|
| // static
|
| -bool InspectorHighlight::getBoxModel(Node* node, RefPtr<protocol::TypeBuilder::DOM::BoxModel>& model)
|
| +bool InspectorHighlight::getBoxModel(Node* node, OwnPtr<protocol::DOM::BoxModel>* model)
|
| {
|
| LayoutObject* layoutObject = node->layoutObject();
|
| FrameView* view = node->document().view();
|
| @@ -347,22 +348,22 @@ bool InspectorHighlight::getBoxModel(Node* node, RefPtr<protocol::TypeBuilder::D
|
| IntRect boundingBox = view->contentsToRootFrame(layoutObject->absoluteBoundingBoxRect());
|
| LayoutBoxModelObject* modelObject = layoutObject->isBoxModelObject() ? toLayoutBoxModelObject(layoutObject) : nullptr;
|
|
|
| - model = protocol::TypeBuilder::DOM::BoxModel::create()
|
| + *model = protocol::DOM::BoxModel::create()
|
| .setContent(buildArrayForQuad(content))
|
| .setPadding(buildArrayForQuad(padding))
|
| .setBorder(buildArrayForQuad(border))
|
| .setMargin(buildArrayForQuad(margin))
|
| .setWidth(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), modelObject) : boundingBox.width())
|
| - .setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height());
|
| + .setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height()).build();
|
|
|
| Shape::DisplayPaths paths;
|
| FloatQuad boundsQuad;
|
| if (const ShapeOutsideInfo* shapeOutsideInfo = shapeOutsideInfoForNode(node, &paths, &boundsQuad)) {
|
| - RefPtr<protocol::TypeBuilder::DOM::ShapeOutsideInfo> shapeTypeBuilder = protocol::TypeBuilder::DOM::ShapeOutsideInfo::create()
|
| + (*model)->setShapeOutside(protocol::DOM::ShapeOutsideInfo::create()
|
| .setBounds(buildArrayForQuad(boundsQuad))
|
| - .setShape(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.shape))
|
| - .setMarginShape(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.marginShape));
|
| - model->setShapeOutside(shapeTypeBuilder);
|
| + .setShape(protocol::Array<RefPtr<JSONValue>>::runtimeCast(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.shape)))
|
| + .setMarginShape(protocol::Array<RefPtr<JSONValue>>::runtimeCast(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.marginShape)))
|
| + .build());
|
| }
|
|
|
| return true;
|
|
|