OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 return 0; | 973 return 0; |
974 } | 974 } |
975 | 975 |
976 document->updateLayout(); | 976 document->updateLayout(); |
977 | 977 |
978 IntSize radius(width / 2, height / 2); | 978 IntSize radius(width / 2, height / 2); |
979 IntPoint point(x + radius.width(), y + radius.height()); | 979 IntPoint point(x + radius.width(), y + radius.height()); |
980 | 980 |
981 EventHandler& eventHandler = document->frame()->eventHandler(); | 981 EventHandler& eventHandler = document->frame()->eventHandler(); |
982 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 982 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
983 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, LayoutSize(radius)); | 983 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); |
984 | 984 |
985 Node* targetNode = 0; | 985 Node* targetNode = 0; |
986 IntPoint adjustedPoint; | 986 IntPoint adjustedPoint; |
987 | 987 |
988 bool foundNode = eventHandler.bestClickableNodeForHitTestResult(result, adju
stedPoint, targetNode); | 988 bool foundNode = eventHandler.bestClickableNodeForHitTestResult(result, adju
stedPoint, targetNode); |
989 if (foundNode) | 989 if (foundNode) |
990 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 990 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
991 | 991 |
992 return 0; | 992 return 0; |
993 } | 993 } |
994 | 994 |
995 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) | 995 Node* Internals::touchNodeAdjustedToBestClickableNode(long x, long y, long width
, long height, Document* document, ExceptionState& exceptionState) |
996 { | 996 { |
997 ASSERT(document); | 997 ASSERT(document); |
998 if (!document->frame()) { | 998 if (!document->frame()) { |
999 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 999 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
1000 return 0; | 1000 return 0; |
1001 } | 1001 } |
1002 | 1002 |
1003 document->updateLayout(); | 1003 document->updateLayout(); |
1004 | 1004 |
1005 IntSize radius(width / 2, height / 2); | 1005 IntSize radius(width / 2, height / 2); |
1006 IntPoint point(x + radius.width(), y + radius.height()); | 1006 IntPoint point(x + radius.width(), y + radius.height()); |
1007 | 1007 |
1008 EventHandler& eventHandler = document->frame()->eventHandler(); | 1008 EventHandler& eventHandler = document->frame()->eventHandler(); |
1009 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 1009 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
1010 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, LayoutSize(radius)); | 1010 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); |
1011 | 1011 |
1012 Node* targetNode = 0; | 1012 Node* targetNode = 0; |
1013 IntPoint adjustedPoint; | 1013 IntPoint adjustedPoint; |
1014 document->frame()->eventHandler().bestClickableNodeForHitTestResult(result,
adjustedPoint, targetNode); | 1014 document->frame()->eventHandler().bestClickableNodeForHitTestResult(result,
adjustedPoint, targetNode); |
1015 return targetNode; | 1015 return targetNode; |
1016 } | 1016 } |
1017 | 1017 |
1018 DOMPoint* Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y,
long width, long height, Document* document, ExceptionState& exceptionState) | 1018 DOMPoint* Internals::touchPositionAdjustedToBestContextMenuNode(long x, long y,
long width, long height, Document* document, ExceptionState& exceptionState) |
1019 { | 1019 { |
1020 ASSERT(document); | 1020 ASSERT(document); |
1021 if (!document->frame()) { | 1021 if (!document->frame()) { |
1022 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1022 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
1023 return 0; | 1023 return 0; |
1024 } | 1024 } |
1025 | 1025 |
1026 document->updateLayout(); | 1026 document->updateLayout(); |
1027 | 1027 |
1028 IntSize radius(width / 2, height / 2); | 1028 IntSize radius(width / 2, height / 2); |
1029 IntPoint point(x + radius.width(), y + radius.height()); | 1029 IntPoint point(x + radius.width(), y + radius.height()); |
1030 | 1030 |
1031 EventHandler& eventHandler = document->frame()->eventHandler(); | 1031 EventHandler& eventHandler = document->frame()->eventHandler(); |
1032 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 1032 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
1033 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, LayoutSize(radius)); | 1033 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); |
1034 | 1034 |
1035 Node* targetNode = 0; | 1035 Node* targetNode = 0; |
1036 IntPoint adjustedPoint; | 1036 IntPoint adjustedPoint; |
1037 | 1037 |
1038 bool foundNode = eventHandler.bestContextMenuNodeForHitTestResult(result, ad
justedPoint, targetNode); | 1038 bool foundNode = eventHandler.bestContextMenuNodeForHitTestResult(result, ad
justedPoint, targetNode); |
1039 if (foundNode) | 1039 if (foundNode) |
1040 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); | 1040 return DOMPoint::create(adjustedPoint.x(), adjustedPoint.y()); |
1041 | 1041 |
1042 return DOMPoint::create(x, y); | 1042 return DOMPoint::create(x, y); |
1043 } | 1043 } |
1044 | 1044 |
1045 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionState& exceptionState) | 1045 Node* Internals::touchNodeAdjustedToBestContextMenuNode(long x, long y, long wid
th, long height, Document* document, ExceptionState& exceptionState) |
1046 { | 1046 { |
1047 ASSERT(document); | 1047 ASSERT(document); |
1048 if (!document->frame()) { | 1048 if (!document->frame()) { |
1049 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); | 1049 exceptionState.throwDOMException(InvalidAccessError, "The document provi
ded is invalid."); |
1050 return 0; | 1050 return 0; |
1051 } | 1051 } |
1052 | 1052 |
1053 document->updateLayout(); | 1053 document->updateLayout(); |
1054 | 1054 |
1055 IntSize radius(width / 2, height / 2); | 1055 IntSize radius(width / 2, height / 2); |
1056 IntPoint point(x + radius.width(), y + radius.height()); | 1056 IntPoint point(x + radius.width(), y + radius.height()); |
1057 | 1057 |
1058 EventHandler& eventHandler = document->frame()->eventHandler(); | 1058 EventHandler& eventHandler = document->frame()->eventHandler(); |
1059 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); | 1059 IntPoint hitTestPoint = document->frame()->view()->windowToContents(point); |
1060 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active, LayoutSize(radius)); | 1060 HitTestResult result = eventHandler.hitTestResultAtPoint(hitTestPoint, HitTe
stRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, Layout
Size(radius)); |
1061 | 1061 |
1062 Node* targetNode = 0; | 1062 Node* targetNode = 0; |
1063 IntPoint adjustedPoint; | 1063 IntPoint adjustedPoint; |
1064 eventHandler.bestContextMenuNodeForHitTestResult(result, adjustedPoint, targ
etNode); | 1064 eventHandler.bestContextMenuNodeForHitTestResult(result, adjustedPoint, targ
etNode); |
1065 return targetNode; | 1065 return targetNode; |
1066 } | 1066 } |
1067 | 1067 |
1068 PassRefPtrWillBeRawPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long
x, long y, long width, long height, Document* document, ExceptionState& excepti
onState) | 1068 PassRefPtrWillBeRawPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long
x, long y, long width, long height, Document* document, ExceptionState& excepti
onState) |
1069 { | 1069 { |
1070 ASSERT(document); | 1070 ASSERT(document); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 LocalFrame* frame = document->frame(); | 1354 LocalFrame* frame = document->frame(); |
1355 FrameView* frameView = document->view(); | 1355 FrameView* frameView = document->view(); |
1356 RenderView* renderView = document->renderView(); | 1356 RenderView* renderView = document->renderView(); |
1357 | 1357 |
1358 if (!renderView) | 1358 if (!renderView) |
1359 return nullptr; | 1359 return nullptr; |
1360 | 1360 |
1361 float zoomFactor = frame->pageZoomFactor(); | 1361 float zoomFactor = frame->pageZoomFactor(); |
1362 LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + fra
meView->scrollX(), centerY * zoomFactor + frameView->scrollY())); | 1362 LayoutPoint point = roundedLayoutPoint(FloatPoint(centerX * zoomFactor + fra
meView->scrollX(), centerY * zoomFactor + frameView->scrollY())); |
1363 | 1363 |
1364 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT
estRequest::Active; | 1364 HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitT
estRequest::Active | HitTestRequest::ListBased; |
1365 if (ignoreClipping) | 1365 if (ignoreClipping) |
1366 hitType |= HitTestRequest::IgnoreClipping; | 1366 hitType |= HitTestRequest::IgnoreClipping; |
1367 if (allowChildFrameContent) | 1367 if (allowChildFrameContent) |
1368 hitType |= HitTestRequest::AllowChildFrameContent; | 1368 hitType |= HitTestRequest::AllowChildFrameContent; |
1369 | 1369 |
1370 HitTestRequest request(hitType); | 1370 HitTestRequest request(hitType); |
1371 | 1371 |
1372 // When ignoreClipping is false, this method returns null for coordinates ou
tside of the viewport. | 1372 // When ignoreClipping is false, this method returns null for coordinates ou
tside of the viewport. |
1373 if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects
(HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, l
eftPadding))) | 1373 if (!request.ignoreClipping() && !frameView->visibleContentRect().intersects
(HitTestLocation::rectForPoint(point, topPadding, rightPadding, bottomPadding, l
eftPadding))) |
1374 return nullptr; | 1374 return nullptr; |
1375 | 1375 |
1376 WillBeHeapVector<RefPtrWillBeMember<Node> > matches; | 1376 WillBeHeapVector<RefPtrWillBeMember<Node> > matches; |
1377 | 1377 HitTestResult result(point, topPadding, rightPadding, bottomPadding, leftPad
ding); |
1378 // Need padding to trigger a rect based hit test, but we want to return a No
deList | 1378 renderView->hitTest(request, result); |
1379 // so we special case this. | 1379 copyToVector(result.listBasedTestResult(), matches); |
1380 if (!topPadding && !rightPadding && !bottomPadding && !leftPadding) { | |
1381 HitTestResult result(point); | |
1382 renderView->hitTest(request, result); | |
1383 | |
1384 if (Node* innerNode = result.innerNode()) { | |
1385 if (innerNode->isInShadowTree()) | |
1386 innerNode = innerNode->shadowHost(); | |
1387 matches.append(innerNode); | |
1388 } | |
1389 } else { | |
1390 HitTestResult result(point, topPadding, rightPadding, bottomPadding, lef
tPadding); | |
1391 renderView->hitTest(request, result); | |
1392 copyToVector(result.rectBasedTestResult(), matches); | |
1393 } | |
1394 | 1380 |
1395 return StaticNodeList::adopt(matches); | 1381 return StaticNodeList::adopt(matches); |
1396 } | 1382 } |
1397 | 1383 |
1398 bool Internals::hasSpellingMarker(Document* document, int from, int length) | 1384 bool Internals::hasSpellingMarker(Document* document, int from, int length) |
1399 { | 1385 { |
1400 ASSERT(document); | 1386 ASSERT(document); |
1401 if (!document->frame()) | 1387 if (!document->frame()) |
1402 return false; | 1388 return false; |
1403 | 1389 |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 { | 2322 { |
2337 ThreadState::current()->schedulePreciseGC(); | 2323 ThreadState::current()->schedulePreciseGC(); |
2338 } | 2324 } |
2339 | 2325 |
2340 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc
eptionState&) | 2326 ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, Exc
eptionState&) |
2341 { | 2327 { |
2342 return new InternalsIterationSource(); | 2328 return new InternalsIterationSource(); |
2343 } | 2329 } |
2344 | 2330 |
2345 } // namespace blink | 2331 } // namespace blink |
OLD | NEW |