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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 highlightConfig->showRulers = showRulers; | 1227 highlightConfig->showRulers = showRulers; |
1228 bool showExtensionLines = false; // Default: false (do not show extension li
nes). | 1228 bool showExtensionLines = false; // Default: false (do not show extension li
nes). |
1229 highlightInspectorObject->getBoolean("showExtensionLines", &showExtensionLin
es); | 1229 highlightInspectorObject->getBoolean("showExtensionLines", &showExtensionLin
es); |
1230 highlightConfig->showExtensionLines = showExtensionLines; | 1230 highlightConfig->showExtensionLines = showExtensionLines; |
1231 highlightConfig->content = parseConfigColor("contentColor", highlightInspect
orObject); | 1231 highlightConfig->content = parseConfigColor("contentColor", highlightInspect
orObject); |
1232 highlightConfig->contentOutline = parseConfigColor("contentOutlineColor", hi
ghlightInspectorObject); | 1232 highlightConfig->contentOutline = parseConfigColor("contentOutlineColor", hi
ghlightInspectorObject); |
1233 highlightConfig->padding = parseConfigColor("paddingColor", highlightInspect
orObject); | 1233 highlightConfig->padding = parseConfigColor("paddingColor", highlightInspect
orObject); |
1234 highlightConfig->border = parseConfigColor("borderColor", highlightInspector
Object); | 1234 highlightConfig->border = parseConfigColor("borderColor", highlightInspector
Object); |
1235 highlightConfig->margin = parseConfigColor("marginColor", highlightInspector
Object); | 1235 highlightConfig->margin = parseConfigColor("marginColor", highlightInspector
Object); |
1236 highlightConfig->eventTarget = parseConfigColor("eventTargetColor", highligh
tInspectorObject); | 1236 highlightConfig->eventTarget = parseConfigColor("eventTargetColor", highligh
tInspectorObject); |
| 1237 highlightConfig->shape = parseConfigColor("shapeColor", highlightInspectorOb
ject); |
| 1238 highlightConfig->shapeMargin = parseConfigColor("shapeMarginColor", highligh
tInspectorObject); |
| 1239 |
1237 return highlightConfig.release(); | 1240 return highlightConfig.release(); |
1238 } | 1241 } |
1239 | 1242 |
1240 void InspectorDOMAgent::setInspectModeEnabled(ErrorString* errorString, bool ena
bled, const bool* inspectUAShadowDOM, const RefPtr<JSONObject>* highlightConfig) | 1243 void InspectorDOMAgent::setInspectModeEnabled(ErrorString* errorString, bool ena
bled, const bool* inspectUAShadowDOM, const RefPtr<JSONObject>* highlightConfig) |
1241 { | 1244 { |
1242 if (enabled && !pushDocumentUponHandlelessOperation(errorString)) | 1245 if (enabled && !pushDocumentUponHandlelessOperation(errorString)) |
1243 return; | 1246 return; |
1244 SearchMode searchMode = enabled ? (inspectUAShadowDOM && *inspectUAShadowDOM
? SearchingForUAShadow : SearchingForNormal) : NotSearching; | 1247 SearchMode searchMode = enabled ? (inspectUAShadowDOM && *inspectUAShadowDOM
? SearchingForUAShadow : SearchingForNormal) : NotSearching; |
1245 setSearchingForNode(errorString, searchMode, highlightConfig ? highlightConf
ig->get() : 0); | 1248 setSearchingForNode(errorString, searchMode, highlightConfig ? highlightConf
ig->get() : 0); |
1246 } | 1249 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 String path; | 1426 String path; |
1424 if (!(*iter)->asString(&path)) { | 1427 if (!(*iter)->asString(&path)) { |
1425 *errorString = "Files must be strings"; | 1428 *errorString = "Files must be strings"; |
1426 return; | 1429 return; |
1427 } | 1430 } |
1428 fileList->append(File::create(path)); | 1431 fileList->append(File::create(path)); |
1429 } | 1432 } |
1430 toHTMLInputElement(node)->setFiles(fileList); | 1433 toHTMLInputElement(node)->setFiles(fileList); |
1431 } | 1434 } |
1432 | 1435 |
1433 static RefPtr<TypeBuilder::Array<double> > buildArrayForQuad(const FloatQuad& qu
ad) | |
1434 { | |
1435 RefPtr<TypeBuilder::Array<double> > array = TypeBuilder::Array<double>::crea
te(); | |
1436 array->addItem(quad.p1().x()); | |
1437 array->addItem(quad.p1().y()); | |
1438 array->addItem(quad.p2().x()); | |
1439 array->addItem(quad.p2().y()); | |
1440 array->addItem(quad.p3().x()); | |
1441 array->addItem(quad.p3().y()); | |
1442 array->addItem(quad.p4().x()); | |
1443 array->addItem(quad.p4().y()); | |
1444 return array.release(); | |
1445 } | |
1446 | |
1447 void InspectorDOMAgent::getBoxModel(ErrorString* errorString, int nodeId, RefPtr
<TypeBuilder::DOM::BoxModel>& model) | 1436 void InspectorDOMAgent::getBoxModel(ErrorString* errorString, int nodeId, RefPtr
<TypeBuilder::DOM::BoxModel>& model) |
1448 { | 1437 { |
1449 Node* node = assertNode(errorString, nodeId); | 1438 Node* node = assertNode(errorString, nodeId); |
1450 if (!node) | 1439 if (!node) |
1451 return; | 1440 return; |
1452 | 1441 |
1453 Vector<FloatQuad> quads; | 1442 bool result = m_overlay->getBoxModel(node, model); |
1454 bool isInlineOrBox = m_overlay->getBoxModel(node, &quads); | 1443 if (!result) |
1455 if (!isInlineOrBox) { | |
1456 *errorString = "Could not compute box model."; | 1444 *errorString = "Could not compute box model."; |
1457 return; | |
1458 } | |
1459 | 1445 |
1460 RenderObject* renderer = node->renderer(); | |
1461 LocalFrame* frame = node->document().frame(); | |
1462 FrameView* view = frame->view(); | |
1463 | |
1464 IntRect boundingBox = pixelSnappedIntRect(view->contentsToRootView(renderer-
>absoluteBoundingBoxRect())); | |
1465 RenderBoxModelObject* modelObject = renderer->isBoxModelObject() ? toRenderB
oxModelObject(renderer) : 0; | |
1466 RefPtr<TypeBuilder::DOM::ShapeOutsideInfo> shapeOutsideInfo = m_overlay->bui
ldObjectForShapeOutside(node); | |
1467 | |
1468 model = TypeBuilder::DOM::BoxModel::create() | |
1469 .setContent(buildArrayForQuad(quads.at(3))) | |
1470 .setPadding(buildArrayForQuad(quads.at(2))) | |
1471 .setBorder(buildArrayForQuad(quads.at(1))) | |
1472 .setMargin(buildArrayForQuad(quads.at(0))) | |
1473 .setWidth(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedO
ffsetWidth(), modelObject) : boundingBox.width()) | |
1474 .setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnapped
OffsetHeight(), modelObject) : boundingBox.height()); | |
1475 if (shapeOutsideInfo) | |
1476 model->setShapeOutside(shapeOutsideInfo); | |
1477 } | 1446 } |
1478 | 1447 |
1479 void InspectorDOMAgent::getNodeForLocation(ErrorString* errorString, int x, int
y, int* nodeId) | 1448 void InspectorDOMAgent::getNodeForLocation(ErrorString* errorString, int x, int
y, int* nodeId) |
1480 { | 1449 { |
1481 if (!pushDocumentUponHandlelessOperation(errorString)) | 1450 if (!pushDocumentUponHandlelessOperation(errorString)) |
1482 return; | 1451 return; |
1483 HitTestRequest request(HitTestRequest::Move | HitTestRequest::ReadOnly | Hit
TestRequest::AllowChildFrameContent); | 1452 HitTestRequest request(HitTestRequest::Move | HitTestRequest::ReadOnly | Hit
TestRequest::AllowChildFrameContent); |
1484 HitTestResult result(IntPoint(x, y)); | 1453 HitTestResult result(IntPoint(x, y)); |
1485 m_document->frame()->contentRenderer()->hitTest(request, result); | 1454 m_document->frame()->contentRenderer()->hitTest(request, result); |
1486 Node* node = result.innerPossiblyPseudoNode(); | 1455 Node* node = result.innerPossiblyPseudoNode(); |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2193 visitor->trace(m_searchResults); | 2162 visitor->trace(m_searchResults); |
2194 #endif | 2163 #endif |
2195 visitor->trace(m_history); | 2164 visitor->trace(m_history); |
2196 visitor->trace(m_domEditor); | 2165 visitor->trace(m_domEditor); |
2197 visitor->trace(m_listener); | 2166 visitor->trace(m_listener); |
2198 InspectorBaseAgent::trace(visitor); | 2167 InspectorBaseAgent::trace(visitor); |
2199 } | 2168 } |
2200 | 2169 |
2201 } // namespace blink | 2170 } // namespace blink |
2202 | 2171 |
OLD | NEW |