OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1371 array->addItem(quad.p1().y()); | 1371 array->addItem(quad.p1().y()); |
1372 array->addItem(quad.p2().x()); | 1372 array->addItem(quad.p2().x()); |
1373 array->addItem(quad.p2().y()); | 1373 array->addItem(quad.p2().y()); |
1374 array->addItem(quad.p3().x()); | 1374 array->addItem(quad.p3().x()); |
1375 array->addItem(quad.p3().y()); | 1375 array->addItem(quad.p3().y()); |
1376 array->addItem(quad.p4().x()); | 1376 array->addItem(quad.p4().x()); |
1377 array->addItem(quad.p4().y()); | 1377 array->addItem(quad.p4().y()); |
1378 return array.release(); | 1378 return array.release(); |
1379 } | 1379 } |
1380 | 1380 |
1381 static RefPtr<TypeBuilder::Array<JSONValue> > buildArrayForShapeOutside(PassRefP tr<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
| |
1382 { | |
1383 RefPtr<TypeBuilder::Array<JSONValue> > array = TypeBuilder::Array<JSONValue> ::create(); | |
1384 array->addItem(value); | |
1385 return array.release(); | |
1386 } | |
1387 | |
1381 void InspectorDOMAgent::getBoxModel(ErrorString* errorString, int nodeId, RefPtr <TypeBuilder::DOM::BoxModel>& model) | 1388 void InspectorDOMAgent::getBoxModel(ErrorString* errorString, int nodeId, RefPtr <TypeBuilder::DOM::BoxModel>& model) |
1382 { | 1389 { |
1383 Node* node = assertNode(errorString, nodeId); | 1390 Node* node = assertNode(errorString, nodeId); |
1384 if (!node) | 1391 if (!node) |
1385 return; | 1392 return; |
1386 | 1393 |
1387 Vector<FloatQuad> quads; | 1394 Vector<FloatQuad> quads; |
1388 bool isInlineOrBox = m_overlay->getBoxModel(node, &quads); | 1395 bool isInlineOrBox = m_overlay->getBoxModel(node, &quads); |
1389 if (!isInlineOrBox) { | 1396 if (!isInlineOrBox) { |
1390 *errorString = "Could not compute box model."; | 1397 *errorString = "Could not compute box model."; |
1391 return; | 1398 return; |
1392 } | 1399 } |
1393 | 1400 |
1394 RenderObject* renderer = node->renderer(); | 1401 RenderObject* renderer = node->renderer(); |
1395 LocalFrame* frame = node->document().frame(); | 1402 LocalFrame* frame = node->document().frame(); |
1396 FrameView* view = frame->view(); | 1403 FrameView* view = frame->view(); |
1397 | 1404 |
1398 IntRect boundingBox = pixelSnappedIntRect(view->contentsToRootView(renderer- >absoluteBoundingBoxRect())); | 1405 IntRect boundingBox = pixelSnappedIntRect(view->contentsToRootView(renderer- >absoluteBoundingBoxRect())); |
1399 RenderBoxModelObject* modelObject = renderer->isBoxModelObject() ? toRenderB oxModelObject(renderer) : 0; | 1406 RenderBoxModelObject* modelObject = renderer->isBoxModelObject() ? toRenderB oxModelObject(renderer) : 0; |
1400 | 1407 |
1408 RefPtr<TypeBuilder::DOM::ShapeOutsideInfo> shapeOutsideInfo = TypeBuilder::D OM::ShapeOutsideInfo::create() | |
1409 .setBounds(buildArrayForShapeOutside(JSONValue::null())) | |
1410 .setShape(buildArrayForShapeOutside(JSONValue::null())) | |
1411 .setMarginShape(buildArrayForShapeOutside(JSONValue::null())); | |
1412 | |
1413 if (renderer->isBox()) { | |
1414 RenderBox* renderBox = toRenderBox(renderer); | |
1415 if (renderBox && renderBox->shapeOutsideInfo()) { | |
1416 RefPtr<JSONObject> shapeOutsideObj = m_overlay->buildObjectForShapeO utside(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
| |
1417 shapeOutsideInfo = TypeBuilder::DOM::ShapeOutsideInfo::create() | |
1418 .setBounds(buildArrayForShapeOutside(shapeOutsideObj->getArray(" bounds"))) | |
1419 .setShape(buildArrayForShapeOutside(shapeOutsideObj->getArray("s hape"))) | |
1420 .setMarginShape(buildArrayForShapeOutside(shapeOutsideObj->getAr ray("marginShape"))); | |
1421 } | |
1422 } | |
1423 | |
1401 model = TypeBuilder::DOM::BoxModel::create() | 1424 model = TypeBuilder::DOM::BoxModel::create() |
1402 .setContent(buildArrayForQuad(quads.at(3))) | 1425 .setContent(buildArrayForQuad(quads.at(3))) |
1403 .setPadding(buildArrayForQuad(quads.at(2))) | 1426 .setPadding(buildArrayForQuad(quads.at(2))) |
1404 .setBorder(buildArrayForQuad(quads.at(1))) | 1427 .setBorder(buildArrayForQuad(quads.at(1))) |
1405 .setMargin(buildArrayForQuad(quads.at(0))) | 1428 .setMargin(buildArrayForQuad(quads.at(0))) |
1406 .setWidth(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedO ffsetWidth(), modelObject) : boundingBox.width()) | 1429 .setWidth(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedO ffsetWidth(), modelObject) : boundingBox.width()) |
1407 .setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnapped OffsetHeight(), modelObject) : boundingBox.height()); | 1430 .setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnapped OffsetHeight(), modelObject) : boundingBox.height()) |
1431 .setShapeOutside(shapeOutsideInfo); | |
1408 } | 1432 } |
1409 | 1433 |
1410 void InspectorDOMAgent::getNodeForLocation(ErrorString* errorString, int x, int y, int* nodeId) | 1434 void InspectorDOMAgent::getNodeForLocation(ErrorString* errorString, int x, int y, int* nodeId) |
1411 { | 1435 { |
1412 if (!pushDocumentUponHandlelessOperation(errorString)) | 1436 if (!pushDocumentUponHandlelessOperation(errorString)) |
1413 return; | 1437 return; |
1414 | 1438 |
1415 Node* node = hoveredNodeForPoint(m_document->frame(), IntPoint(x, y), false) ; | 1439 Node* node = hoveredNodeForPoint(m_document->frame(), IntPoint(x, y), false) ; |
1416 if (!node) { | 1440 if (!node) { |
1417 *errorString = "No node found at given location"; | 1441 *errorString = "No node found at given location"; |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2102 if (!m_documentNodeToIdMap.contains(m_document)) { | 2126 if (!m_documentNodeToIdMap.contains(m_document)) { |
2103 RefPtr<TypeBuilder::DOM::Node> root; | 2127 RefPtr<TypeBuilder::DOM::Node> root; |
2104 getDocument(errorString, root); | 2128 getDocument(errorString, root); |
2105 return errorString->isEmpty(); | 2129 return errorString->isEmpty(); |
2106 } | 2130 } |
2107 return true; | 2131 return true; |
2108 } | 2132 } |
2109 | 2133 |
2110 } // namespace WebCore | 2134 } // namespace WebCore |
2111 | 2135 |
OLD | NEW |