OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 #include "RequestAnimationFrameCallback.h" | 99 #include "RequestAnimationFrameCallback.h" |
100 #include "ScopedEventQueue.h" | 100 #include "ScopedEventQueue.h" |
101 #include "ScriptCallStack.h" | 101 #include "ScriptCallStack.h" |
102 #include "ScriptController.h" | 102 #include "ScriptController.h" |
103 #include "ScriptElement.h" | 103 #include "ScriptElement.h" |
104 #include "ScriptEventListener.h" | 104 #include "ScriptEventListener.h" |
105 #include "ScriptRunner.h" | 105 #include "ScriptRunner.h" |
106 #include "ScriptedAnimationController.h" | 106 #include "ScriptedAnimationController.h" |
107 #include "SelectorQuery.h" | 107 #include "SelectorQuery.h" |
108 #include "ShadowRoot.h" | 108 #include "ShadowRoot.h" |
109 #include "StaticHashSetNodeList.h" | |
110 #include "StylePropertySet.h" | 109 #include "StylePropertySet.h" |
111 #include "StyleResolver.h" | 110 #include "StyleResolver.h" |
112 #include "StyleSheetContents.h" | 111 #include "StyleSheetContents.h" |
113 #include "StyleSheetList.h" | 112 #include "StyleSheetList.h" |
114 #include "TouchList.h" | 113 #include "TouchList.h" |
115 #include "TransformSource.h" | 114 #include "TransformSource.h" |
116 #include "TreeWalker.h" | 115 #include "TreeWalker.h" |
117 #include "UserActionElementSet.h" | 116 #include "UserActionElementSet.h" |
118 #include "VisitedLinkState.h" | 117 #include "VisitedLinkState.h" |
119 #include "WebCoreMemoryInstrumentation.h" | 118 #include "WebCoreMemoryInstrumentation.h" |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 if (xmlStandalone()) | 1283 if (xmlStandalone()) |
1285 return "text/xml"; | 1284 return "text/xml"; |
1286 if (isHTMLDocument()) | 1285 if (isHTMLDocument()) |
1287 return "text/html"; | 1286 return "text/html"; |
1288 | 1287 |
1289 if (DocumentLoader* documentLoader = loader()) | 1288 if (DocumentLoader* documentLoader = loader()) |
1290 return documentLoader->responseMIMEType(); | 1289 return documentLoader->responseMIMEType(); |
1291 return String(); | 1290 return String(); |
1292 } | 1291 } |
1293 | 1292 |
1294 // FIXME: We need to discuss the DOM API here at some point. Ideas: | |
1295 // * making it receive a rect as parameter, i.e. nodesFromRect(x, y, w, h); | |
1296 // * making it receive the expading size of each direction separately, | |
1297 // i.e. nodesFromRect(x, y, topSize, rightSize, bottomSize, leftSize); | |
1298 PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned
topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding,
HitTestRequest::HitTestRequestType hitType) const | |
1299 { | |
1300 // FIXME: Share code between this, elementFromPoint and caretRangeFromPoint. | |
1301 if (!renderer()) | |
1302 return 0; | |
1303 Frame* frame = this->frame(); | |
1304 if (!frame) | |
1305 return 0; | |
1306 FrameView* frameView = frame->view(); | |
1307 if (!frameView) | |
1308 return 0; | |
1309 | |
1310 float zoomFactor = frame->pageZoomFactor(); | |
1311 LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + vie
w()->scrollX(), centerY * zoomFactor + view()->scrollY())); | |
1312 | |
1313 HitTestRequest request(hitType); | |
1314 | |
1315 // When ignoreClipping is false, this method returns null for coordinates ou
tside of the viewport. | |
1316 if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects
(HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, l
eftPadding))) | |
1317 return 0; | |
1318 | |
1319 // Passing a zero padding will trigger a rect hit test, however for the purp
oses of nodesFromRect, | |
1320 // we special handle this case in order to return a valid NodeList. | |
1321 if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) { | |
1322 HitTestResult result(point); | |
1323 return handleZeroPadding(request, result); | |
1324 } | |
1325 | |
1326 HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPad
ding); | |
1327 renderView()->hitTest(request, result); | |
1328 | |
1329 return StaticHashSetNodeList::adopt(result.rectBasedTestResult()); | |
1330 } | |
1331 | |
1332 PassRefPtr<NodeList> Document::handleZeroPadding(const HitTestRequest& request,
HitTestResult& result) const | |
1333 { | |
1334 renderView()->hitTest(request, result); | |
1335 | |
1336 Node* node = result.innerNode(); | |
1337 if (!node) | |
1338 return 0; | |
1339 | |
1340 node = node->deprecatedShadowAncestorNode(); | |
1341 ListHashSet<RefPtr<Node> > list; | |
1342 list.add(node); | |
1343 return StaticHashSetNodeList::adopt(list); | |
1344 } | |
1345 | |
1346 Element* Document::elementFromPoint(int x, int y) const | 1293 Element* Document::elementFromPoint(int x, int y) const |
1347 { | 1294 { |
1348 if (!renderer()) | 1295 if (!renderer()) |
1349 return 0; | 1296 return 0; |
1350 | 1297 |
1351 return TreeScope::elementFromPoint(x, y); | 1298 return TreeScope::elementFromPoint(x, y); |
1352 } | 1299 } |
1353 | 1300 |
1354 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) | 1301 PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) |
1355 { | 1302 { |
(...skipping 4428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5784 return; | 5731 return; |
5785 | 5732 |
5786 Vector<RefPtr<Element> > associatedFormControls; | 5733 Vector<RefPtr<Element> > associatedFormControls; |
5787 copyToVector(m_associatedFormControls, associatedFormControls); | 5734 copyToVector(m_associatedFormControls, associatedFormControls); |
5788 | 5735 |
5789 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm
Controls); | 5736 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm
Controls); |
5790 m_associatedFormControls.clear(); | 5737 m_associatedFormControls.clear(); |
5791 } | 5738 } |
5792 | 5739 |
5793 } // namespace WebCore | 5740 } // namespace WebCore |
OLD | NEW |