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

Unified Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 237313003: CSS shapes support in Web Inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated inspectorOverlay to not pass string instead pass JSONObject, which is serialized Created 6 years, 8 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: Source/core/inspector/InspectorDOMAgent.cpp
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
index 9be9fddb472d28b627232f58baffdcba9b5b089f..40e32f7c42cf3ba97ff70b50e73f6bd2906c63e1 100644
--- a/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/Source/core/inspector/InspectorDOMAgent.cpp
@@ -1378,6 +1378,13 @@ static RefPtr<TypeBuilder::Array<double> > buildArrayForQuad(const FloatQuad& qu
return array.release();
}
+static RefPtr<TypeBuilder::Array<JSONValue> > buildArrayForShapeOutside(PassRefPtr<JSONValue> value)
pfeldman 2014/05/01 10:18:50 I'm not sure I follow what this does. It puts give
Habib Virji 2014/05/01 10:38:07 Idea is to take a JSONValue put in TypeBuilder::Ar
+{
+ RefPtr<TypeBuilder::Array<JSONValue> > array = TypeBuilder::Array<JSONValue>::create();
+ array->addItem(value);
+ return array.release();
+}
+
void InspectorDOMAgent::getBoxModel(ErrorString* errorString, int nodeId, RefPtr<TypeBuilder::DOM::BoxModel>& model)
{
Node* node = assertNode(errorString, nodeId);
@@ -1398,13 +1405,30 @@ void InspectorDOMAgent::getBoxModel(ErrorString* errorString, int nodeId, RefPtr
IntRect boundingBox = pixelSnappedIntRect(view->contentsToRootView(renderer->absoluteBoundingBoxRect()));
RenderBoxModelObject* modelObject = renderer->isBoxModelObject() ? toRenderBoxModelObject(renderer) : 0;
+ RefPtr<TypeBuilder::DOM::ShapeOutsideInfo> shapeOutsideInfo = TypeBuilder::DOM::ShapeOutsideInfo::create()
+ .setBounds(buildArrayForShapeOutside(JSONValue::null()))
+ .setShape(buildArrayForShapeOutside(JSONValue::null()))
+ .setMarginShape(buildArrayForShapeOutside(JSONValue::null()));
+
+ if (renderer->isBox()) {
+ RenderBox* renderBox = toRenderBox(renderer);
+ if (renderBox && renderBox->shapeOutsideInfo()) {
+ RefPtr<JSONObject> shapeOutsideObj = m_overlay->buildObjectForShapeOutside(node);
pfeldman 2014/05/01 10:18:50 I'm confused - why doesn't it return RefPtr<TypeBu
Habib Virji 2014/05/01 10:38:07 Ok, i was not sure whether it is correct to use ty
+ shapeOutsideInfo = TypeBuilder::DOM::ShapeOutsideInfo::create()
+ .setBounds(buildArrayForShapeOutside(shapeOutsideObj->getArray("bounds")))
+ .setShape(buildArrayForShapeOutside(shapeOutsideObj->getArray("shape")))
+ .setMarginShape(buildArrayForShapeOutside(shapeOutsideObj->getArray("marginShape")));
+ }
+ }
+
model = TypeBuilder::DOM::BoxModel::create()
.setContent(buildArrayForQuad(quads.at(3)))
.setPadding(buildArrayForQuad(quads.at(2)))
.setBorder(buildArrayForQuad(quads.at(1)))
.setMargin(buildArrayForQuad(quads.at(0)))
.setWidth(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), modelObject) : boundingBox.width())
- .setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height());
+ .setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height())
+ .setShapeOutside(shapeOutsideInfo);
}
void InspectorDOMAgent::getNodeForLocation(ErrorString* errorString, int x, int y, int* nodeId)

Powered by Google App Engine
This is Rietveld 408576698