| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 | 1107 |
| 1108 Node* bestTouchNode = 0; | 1108 Node* bestTouchNode = 0; |
| 1109 | 1109 |
| 1110 IntPoint touchEventLocation(tapEvent.position()); | 1110 IntPoint touchEventLocation(tapEvent.position()); |
| 1111 m_page->mainFrame()->eventHandler().adjustGesturePosition(tapEvent, touchEve
ntLocation); | 1111 m_page->mainFrame()->eventHandler().adjustGesturePosition(tapEvent, touchEve
ntLocation); |
| 1112 | 1112 |
| 1113 IntPoint hitTestPoint = m_page->mainFrame()->view()->windowToContents(touchE
ventLocation); | 1113 IntPoint hitTestPoint = m_page->mainFrame()->view()->windowToContents(touchE
ventLocation); |
| 1114 HitTestResult result = m_page->mainFrame()->eventHandler().hitTestResultAtPo
int(hitTestPoint, HitTestRequest::TouchEvent | HitTestRequest::ConfusingAndOften
MisusedDisallowShadowContent); | 1114 HitTestResult result = m_page->mainFrame()->eventHandler().hitTestResultAtPo
int(hitTestPoint, HitTestRequest::TouchEvent | HitTestRequest::ConfusingAndOften
MisusedDisallowShadowContent); |
| 1115 bestTouchNode = result.targetNode(); | 1115 bestTouchNode = result.targetNode(); |
| 1116 | 1116 |
| 1117 Node* firstUncontainedNode = 0; | |
| 1118 | |
| 1119 // We might hit something like an image map that has no renderer on it | 1117 // We might hit something like an image map that has no renderer on it |
| 1120 // Walk up the tree until we have a node with an attached renderer | 1118 // Walk up the tree until we have a node with an attached renderer |
| 1121 while (bestTouchNode && !bestTouchNode->renderer()) | 1119 while (bestTouchNode && !bestTouchNode->renderer()) |
| 1122 bestTouchNode = bestTouchNode->parentNode(); | 1120 bestTouchNode = bestTouchNode->parentNode(); |
| 1123 | 1121 |
| 1124 // FIXME: http://crbug.com/289764 - Instead of stopping early on isContained
InParentBoundingBox, LinkHighlight | |
| 1125 // should calculate the appropriate rects (currently it just uses the linebo
x) | |
| 1126 | |
| 1127 // Check if we're in the subtree of a node with a hand cursor | 1122 // Check if we're in the subtree of a node with a hand cursor |
| 1128 // this is the heuristic we use to determine if we show a highlight on tap | 1123 // this is the heuristic we use to determine if we show a highlight on tap |
| 1129 while (bestTouchNode && !invokesHandCursor(bestTouchNode, false, m_page->mai
nFrame())) { | 1124 while (bestTouchNode && !invokesHandCursor(bestTouchNode, false, m_page->mai
nFrame())) |
| 1130 if (!firstUncontainedNode && !bestTouchNode->renderer()->isContainedInPa
rentBoundingBox()) | |
| 1131 firstUncontainedNode = bestTouchNode; | |
| 1132 | |
| 1133 bestTouchNode = bestTouchNode->parentNode(); | 1125 bestTouchNode = bestTouchNode->parentNode(); |
| 1134 } | |
| 1135 | 1126 |
| 1136 if (!bestTouchNode) | 1127 if (!bestTouchNode) |
| 1137 return 0; | 1128 return 0; |
| 1138 | 1129 |
| 1139 if (firstUncontainedNode) | |
| 1140 return firstUncontainedNode; | |
| 1141 | |
| 1142 // We should pick the largest enclosing node with hand cursor set. | 1130 // We should pick the largest enclosing node with hand cursor set. |
| 1143 while (bestTouchNode->parentNode() | 1131 while (bestTouchNode->parentNode() && invokesHandCursor(bestTouchNode->paren
tNode(), false, m_page->mainFrame())) |
| 1144 && invokesHandCursor(bestTouchNode->parentNode(), false, m_page->mainFra
me()) | |
| 1145 && bestTouchNode->renderer()->isContainedInParentBoundingBox()) | |
| 1146 bestTouchNode = bestTouchNode->parentNode(); | 1132 bestTouchNode = bestTouchNode->parentNode(); |
| 1147 | 1133 |
| 1148 return bestTouchNode; | 1134 return bestTouchNode; |
| 1149 } | 1135 } |
| 1150 | 1136 |
| 1151 void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent
) | 1137 void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent
) |
| 1152 { | 1138 { |
| 1153 Node* touchNode = bestTapNode(tapEvent); | 1139 Node* touchNode = bestTapNode(tapEvent); |
| 1154 | 1140 |
| 1155 Vector<Node*> highlightNodes; | 1141 Vector<Node*> highlightNodes; |
| (...skipping 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4002 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 3988 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
| 4003 | 3989 |
| 4004 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 3990 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4005 return false; | 3991 return false; |
| 4006 | 3992 |
| 4007 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 3993 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4008 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 3994 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
| 4009 } | 3995 } |
| 4010 | 3996 |
| 4011 } // namespace blink | 3997 } // namespace blink |
| OLD | NEW |