Chromium Code Reviews| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 #include "core/loader/DocumentLoader.h" | 64 #include "core/loader/DocumentLoader.h" |
| 65 #include "core/loader/FrameLoader.h" | 65 #include "core/loader/FrameLoader.h" |
| 66 #include "core/loader/UniqueIdentifier.h" | 66 #include "core/loader/UniqueIdentifier.h" |
| 67 #include "core/page/Chrome.h" | 67 #include "core/page/Chrome.h" |
| 68 #include "core/page/ContextMenuController.h" | 68 #include "core/page/ContextMenuController.h" |
| 69 #include "core/page/ContextMenuProvider.h" | 69 #include "core/page/ContextMenuProvider.h" |
| 70 #include "core/page/DragController.h" | 70 #include "core/page/DragController.h" |
| 71 #include "core/page/DragData.h" | 71 #include "core/page/DragData.h" |
| 72 #include "core/page/DragSession.h" | 72 #include "core/page/DragSession.h" |
| 73 #include "core/page/EventHandler.h" | 73 #include "core/page/EventHandler.h" |
| 74 #include "core/page/EventWithHitTestResults.h" | |
| 75 #include "core/page/FocusController.h" | 74 #include "core/page/FocusController.h" |
| 76 #include "core/page/FrameTree.h" | 75 #include "core/page/FrameTree.h" |
| 77 #include "core/page/InjectedStyleSheets.h" | 76 #include "core/page/InjectedStyleSheets.h" |
| 78 #include "core/page/Page.h" | 77 #include "core/page/Page.h" |
| 79 #include "core/page/PagePopupClient.h" | 78 #include "core/page/PagePopupClient.h" |
| 80 #include "core/page/PointerLockController.h" | 79 #include "core/page/PointerLockController.h" |
| 81 #include "core/page/ScopedPageLoadDeferrer.h" | 80 #include "core/page/ScopedPageLoadDeferrer.h" |
| 82 #include "core/page/TouchDisambiguation.h" | 81 #include "core/page/TouchDisambiguation.h" |
| 83 #include "core/rendering/RenderView.h" | 82 #include "core/rendering/RenderView.h" |
| 84 #include "core/rendering/RenderWidget.h" | 83 #include "core/rendering/RenderWidget.h" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 syntheticGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 623 syntheticGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 625 | 624 |
| 626 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame() && m_page->deprecatedLocalMainFrame()->view()) | 625 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame() && m_page->deprecatedLocalMainFrame()->view()) |
| 627 return handleGestureEvent(syntheticGestureEvent); | 626 return handleGestureEvent(syntheticGestureEvent); |
| 628 } | 627 } |
| 629 return false; | 628 return false; |
| 630 } | 629 } |
| 631 | 630 |
| 632 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) | 631 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) |
| 633 { | 632 { |
| 633 if (event.isScrollEvent()) | |
| 634 return handleGestureScrollEvent(event); | |
| 635 | |
| 634 bool eventSwallowed = false; | 636 bool eventSwallowed = false; |
| 635 bool eventCancelled = false; // for disambiguation | 637 bool eventCancelled = false; // for disambiguation |
| 636 | 638 |
| 637 // Special handling for slow-path fling gestures. | 639 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), even t); |
|
Rick Byers
2014/08/22 14:49:57
These are really special WebGestureEvent types tha
Zeeshan Qureshi
2014/08/22 15:30:50
Having a single source of truth is definitely bett
| |
| 638 switch (event.type) { | 640 |
| 639 case WebInputEvent::GestureFlingStart: { | 641 // Special handling for double tap as we don't want to hit test for it. |
|
Rick Byers
2014/08/22 14:49:57
Right - GestureDoubleTap is similar to GestureFlin
| |
| 640 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures ()) | 642 if (event.type == WebInputEvent::GestureDoubleTap) { |
| 641 break; | 643 if (m_webSettings->doubleTapToZoomEnabled() && minimumPageScaleFactor() != maximumPageScaleFactor()) { |
| 642 m_client->cancelScheduledContentIntents(); | 644 m_client->cancelScheduledContentIntents(); |
| 643 m_positionOnFlingStart = WebPoint(event.x / pageScaleFactor(), event.y / pageScaleFactor()); | 645 animateDoubleTapZoom(platformEvent.position()); |
| 644 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); | 646 } |
| 645 m_flingModifier = event.modifiers; | 647 // GestureDoubleTap is currently only used by Android for zooming. For W ebCore, |
| 646 m_flingSourceDevice = event.sourceDevice; | 648 // GestureTap with tap count = 2 is used instead. So we drop GestureDoub leTap here. |
| 647 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel ocityX, event.data.flingStart.velocityY), WebSize())); | |
| 648 ASSERT(flingCurve); | |
| 649 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f lingCurve.release(), this); | |
| 650 scheduleAnimation(); | |
| 651 eventSwallowed = true; | 649 eventSwallowed = true; |
| 652 | |
| 653 m_client->didHandleGestureEvent(event, eventCancelled); | 650 m_client->didHandleGestureEvent(event, eventCancelled); |
| 654 return eventSwallowed; | 651 return eventSwallowed; |
| 655 } | 652 } |
| 656 case WebInputEvent::GestureFlingCancel: | |
| 657 if (endActiveFlingAnimation()) | |
| 658 eventSwallowed = true; | |
| 659 | 653 |
| 660 m_client->didHandleGestureEvent(event, eventCancelled); | 654 // Hit test across all frames and do touch adjustment as necessary for the e vent type. |
| 661 return eventSwallowed; | 655 GestureEventWithHitTestResults targetedEvent = |
| 662 default: | 656 m_page->deprecatedLocalMainFrame()->eventHandler().targetGestureEvent(pl atformEvent); |
| 663 break; | |
| 664 } | |
| 665 | |
| 666 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), even t); | |
| 667 | |
| 668 // FIXME: Remove redundant hit tests by pushing the call to EventHandler::ta rgetGestureEvent | |
| 669 // up to this point and pass GestureEventWithHitTestResults around. | |
| 670 | 657 |
| 671 // Handle link highlighting outside the main switch to avoid getting lost in the | 658 // Handle link highlighting outside the main switch to avoid getting lost in the |
| 672 // complicated set of cases handled below. | 659 // complicated set of cases handled below. |
| 673 switch (event.type) { | 660 switch (event.type) { |
| 674 case WebInputEvent::GestureShowPress: | 661 case WebInputEvent::GestureShowPress: |
| 675 // Queue a highlight animation, then hand off to regular handler. | 662 // Queue a highlight animation, then hand off to regular handler. |
| 676 enableTapHighlightAtPoint(platformEvent); | 663 enableTapHighlightAtPoint(targetedEvent); |
| 677 break; | 664 break; |
| 678 case WebInputEvent::GestureTapCancel: | 665 case WebInputEvent::GestureTapCancel: |
| 679 case WebInputEvent::GestureTap: | 666 case WebInputEvent::GestureTap: |
| 680 case WebInputEvent::GestureLongPress: | 667 case WebInputEvent::GestureLongPress: |
| 681 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 668 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 682 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); | 669 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
| 683 break; | 670 break; |
| 684 default: | 671 default: |
| 685 break; | 672 break; |
| 686 } | 673 } |
| 687 | 674 |
| 688 switch (event.type) { | 675 switch (event.type) { |
| 689 case WebInputEvent::GestureTap: { | 676 case WebInputEvent::GestureTap: { |
| 690 m_client->cancelScheduledContentIntents(); | 677 m_client->cancelScheduledContentIntents(); |
| 691 if (detectContentOnTouch(platformEvent.position())) { | 678 // FIXME: Use targeted event here and save another hit test. |
| 679 if (detectContentOnTouch(targetedEvent.event().position())) { | |
| 692 eventSwallowed = true; | 680 eventSwallowed = true; |
| 693 break; | 681 break; |
| 694 } | 682 } |
| 695 | 683 |
| 696 RefPtr<PopupContainer> selectPopup; | 684 RefPtr<PopupContainer> selectPopup; |
| 697 selectPopup = m_selectPopup; | 685 selectPopup = m_selectPopup; |
| 698 hideSelectPopup(); | 686 hideSelectPopup(); |
| 699 ASSERT(!m_selectPopup); | 687 ASSERT(!m_selectPopup); |
| 700 | 688 |
| 701 // Don't trigger a disambiguation popup on sites designed for mobile dev ices. | 689 // Don't trigger a disambiguation popup on sites designed for mobile dev ices. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 717 if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleT argets(scaledEvent, goodTargets)) { | 705 if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleT argets(scaledEvent, goodTargets)) { |
| 718 enableTapHighlights(highlightNodes); | 706 enableTapHighlights(highlightNodes); |
| 719 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 707 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
| 720 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); | 708 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
| 721 eventSwallowed = true; | 709 eventSwallowed = true; |
| 722 eventCancelled = true; | 710 eventCancelled = true; |
| 723 break; | 711 break; |
| 724 } | 712 } |
| 725 } | 713 } |
| 726 | 714 |
| 727 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent); | 715 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(targetedEvent); |
| 728 | 716 |
| 729 if (m_selectPopup && m_selectPopup == selectPopup) { | 717 if (m_selectPopup && m_selectPopup == selectPopup) { |
| 730 // That tap triggered a select popup which is the same as the one th at | 718 // That tap triggered a select popup which is the same as the one th at |
| 731 // was showing before the tap. It means the user tapped the select | 719 // was showing before the tap. It means the user tapped the select |
| 732 // while the popup was showing, and as a result we first closed then | 720 // while the popup was showing, and as a result we first closed then |
| 733 // immediately reopened the select popup. It needs to be closed. | 721 // immediately reopened the select popup. It needs to be closed. |
| 734 hideSelectPopup(); | 722 hideSelectPopup(); |
| 735 } | 723 } |
| 736 | 724 |
| 737 break; | 725 break; |
| 738 } | 726 } |
| 739 case WebInputEvent::GestureTwoFingerTap: | 727 case WebInputEvent::GestureTwoFingerTap: |
| 740 case WebInputEvent::GestureLongPress: | 728 case WebInputEvent::GestureLongPress: |
| 741 case WebInputEvent::GestureLongTap: { | 729 case WebInputEvent::GestureLongTap: { |
| 742 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 730 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 743 break; | 731 break; |
| 744 | 732 |
| 745 m_client->cancelScheduledContentIntents(); | 733 m_client->cancelScheduledContentIntents(); |
| 746 m_page->contextMenuController().clearContextMenu(); | 734 m_page->contextMenuController().clearContextMenu(); |
| 747 m_contextMenuAllowed = true; | 735 m_contextMenuAllowed = true; |
| 748 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent); | 736 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(targetedEvent); |
| 749 m_contextMenuAllowed = false; | 737 m_contextMenuAllowed = false; |
| 750 | 738 |
| 751 break; | 739 break; |
| 752 } | 740 } |
| 753 case WebInputEvent::GestureShowPress: { | 741 case WebInputEvent::GestureShowPress: |
| 754 m_client->cancelScheduledContentIntents(); | |
| 755 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent); | |
| 756 break; | |
| 757 } | |
| 758 case WebInputEvent::GestureDoubleTap: | |
| 759 if (m_webSettings->doubleTapToZoomEnabled() && minimumPageScaleFactor() != maximumPageScaleFactor()) { | |
| 760 m_client->cancelScheduledContentIntents(); | |
| 761 animateDoubleTapZoom(platformEvent.position()); | |
| 762 } | |
| 763 // GestureDoubleTap is currently only used by Android for zooming. For W ebCore, | |
| 764 // GestureTap with tap count = 2 is used instead. So we drop GestureDoub leTap here. | |
| 765 eventSwallowed = true; | |
| 766 break; | |
| 767 case WebInputEvent::GestureScrollBegin: | |
| 768 case WebInputEvent::GesturePinchBegin: | |
| 769 m_client->cancelScheduledContentIntents(); | 742 m_client->cancelScheduledContentIntents(); |
| 770 case WebInputEvent::GestureTapDown: | 743 case WebInputEvent::GestureTapDown: |
| 771 case WebInputEvent::GestureScrollEnd: | |
| 772 case WebInputEvent::GestureScrollUpdate: | |
| 773 case WebInputEvent::GestureScrollUpdateWithoutPropagation: | |
| 774 case WebInputEvent::GestureTapCancel: | 744 case WebInputEvent::GestureTapCancel: |
| 775 case WebInputEvent::GestureTapUnconfirmed: | 745 case WebInputEvent::GestureTapUnconfirmed: { |
| 776 case WebInputEvent::GesturePinchEnd: | 746 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(targetedEvent); |
| 777 case WebInputEvent::GesturePinchUpdate: | |
| 778 case WebInputEvent::GestureFlingStart: { | |
| 779 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent); | |
| 780 break; | 747 break; |
| 781 } | 748 } |
| 782 default: | 749 default: |
| 783 ASSERT_NOT_REACHED(); | 750 ASSERT_NOT_REACHED(); |
| 784 } | 751 } |
| 785 m_client->didHandleGestureEvent(event, eventCancelled); | 752 m_client->didHandleGestureEvent(event, eventCancelled); |
| 786 return eventSwallowed; | 753 return eventSwallowed; |
| 787 } | 754 } |
| 755 | |
| 756 bool WebViewImpl::handleGestureScrollEvent(const WebGestureEvent& event) | |
| 757 { | |
| 758 bool eventSwallowed = false; | |
| 759 bool eventCancelled = false; // for disambiguation | |
| 760 | |
| 761 // Special handling for slow-path fling gestures. | |
| 762 switch (event.type) { | |
| 763 case WebInputEvent::GestureFlingStart: { | |
| 764 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures ()) | |
| 765 break; | |
| 766 m_client->cancelScheduledContentIntents(); | |
| 767 m_positionOnFlingStart = WebPoint(event.x / pageScaleFactor(), event.y / pageScaleFactor()); | |
| 768 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); | |
| 769 m_flingModifier = event.modifiers; | |
| 770 m_flingSourceDevice = event.sourceDevice; | |
| 771 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel ocityX, event.data.flingStart.velocityY), WebSize())); | |
| 772 ASSERT(flingCurve); | |
| 773 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f lingCurve.release(), this); | |
| 774 scheduleAnimation(); | |
| 775 eventSwallowed = true; | |
| 776 | |
| 777 m_client->didHandleGestureEvent(event, eventCancelled); | |
| 778 return eventSwallowed; | |
| 779 } | |
| 780 case WebInputEvent::GestureFlingCancel: | |
| 781 if (endActiveFlingAnimation()) | |
| 782 eventSwallowed = true; | |
| 783 | |
| 784 m_client->didHandleGestureEvent(event, eventCancelled); | |
| 785 return eventSwallowed; | |
| 786 default: | |
| 787 break; | |
| 788 } | |
| 789 | |
| 790 switch (event.type) { | |
| 791 case WebInputEvent::GestureScrollBegin: | |
| 792 case WebInputEvent::GesturePinchBegin: | |
| 793 m_client->cancelScheduledContentIntents(); | |
| 794 case WebInputEvent::GestureScrollEnd: | |
| 795 case WebInputEvent::GestureScrollUpdate: | |
| 796 case WebInputEvent::GestureScrollUpdateWithoutPropagation: | |
| 797 case WebInputEvent::GesturePinchEnd: | |
| 798 case WebInputEvent::GesturePinchUpdate: | |
| 799 case WebInputEvent::GestureFlingStart: { | |
| 800 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); | |
| 801 | |
| 802 // Scrolling-related gesture events invoke EventHandler recursively for each frame down | |
| 803 // the chain, doing a single-frame hit-test per frame. This matches hand leWheelEvent. | |
| 804 // Perhaps we could simplify things by rewriting scroll handling to work inner frame | |
| 805 // out, and then unify with other gesture events. | |
| 806 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureS crollEvent(platformEvent); | |
| 807 break; | |
| 808 } | |
| 809 default: | |
| 810 ASSERT_NOT_REACHED(); | |
| 811 } | |
| 812 | |
| 813 m_client->didHandleGestureEvent(event, eventCancelled); | |
| 814 return eventSwallowed; | |
| 815 } | |
| 788 | 816 |
| 789 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar ameters& parameters) | 817 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar ameters& parameters) |
| 790 { | 818 { |
| 791 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); | 819 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); |
| 792 ASSERT(!m_gestureAnimation); | 820 ASSERT(!m_gestureAnimation); |
| 793 m_positionOnFlingStart = parameters.point; | 821 m_positionOnFlingStart = parameters.point; |
| 794 m_globalPositionOnFlingStart = parameters.globalPoint; | 822 m_globalPositionOnFlingStart = parameters.globalPoint; |
| 795 m_flingModifier = parameters.modifiers; | 823 m_flingModifier = parameters.modifiers; |
| 796 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni mationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters .cumulativeScroll)); | 824 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni mationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters .cumulativeScroll)); |
| 797 ASSERT(curve); | 825 ASSERT(curve); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1189 static bool showsHandCursor(Node* node, LocalFrame* frame) | 1217 static bool showsHandCursor(Node* node, LocalFrame* frame) |
| 1190 { | 1218 { |
| 1191 if (!node || !node->renderer()) | 1219 if (!node || !node->renderer()) |
| 1192 return false; | 1220 return false; |
| 1193 | 1221 |
| 1194 ECursor cursor = node->renderer()->style()->cursor(); | 1222 ECursor cursor = node->renderer()->style()->cursor(); |
| 1195 return cursor == CURSOR_POINTER | 1223 return cursor == CURSOR_POINTER |
| 1196 || (cursor == CURSOR_AUTO && frame->eventHandler().useHandCursor(node, n ode->isLink())); | 1224 || (cursor == CURSOR_AUTO && frame->eventHandler().useHandCursor(node, n ode->isLink())); |
| 1197 } | 1225 } |
| 1198 | 1226 |
| 1199 Node* WebViewImpl::bestTapNode(const PlatformGestureEvent& tapEvent) | 1227 Node* WebViewImpl::bestTapNode(const GestureEventWithHitTestResults& targetedTap Event) |
| 1200 { | 1228 { |
| 1201 TRACE_EVENT0("input", "WebViewImpl::bestTapNode"); | 1229 TRACE_EVENT0("input", "WebViewImpl::bestTapNode"); |
| 1202 | 1230 |
| 1203 if (!m_page || !m_page->mainFrame()) | 1231 if (!m_page || !m_page->mainFrame()) |
| 1204 return 0; | 1232 return 0; |
| 1205 | 1233 |
| 1206 // FIXME: Rely on earlier hit test instead of hit testing again. | 1234 Node* bestTouchNode = targetedTapEvent.hitTestResult().targetNode(); |
| 1207 GestureEventWithHitTestResults targetedEvent = | |
| 1208 m_page->deprecatedLocalMainFrame()->eventHandler().targetGestureEvent(ta pEvent, true); | |
| 1209 Node* bestTouchNode = targetedEvent.hitTestResult().targetNode(); | |
| 1210 | 1235 |
| 1211 // We might hit something like an image map that has no renderer on it | 1236 // We might hit something like an image map that has no renderer on it |
| 1212 // Walk up the tree until we have a node with an attached renderer | 1237 // Walk up the tree until we have a node with an attached renderer |
| 1213 while (bestTouchNode && !bestTouchNode->renderer()) | 1238 while (bestTouchNode && !bestTouchNode->renderer()) |
| 1214 bestTouchNode = NodeRenderingTraversal::parent(bestTouchNode); | 1239 bestTouchNode = NodeRenderingTraversal::parent(bestTouchNode); |
| 1215 | 1240 |
| 1216 Node* cursorDefiningAncestor = | 1241 Node* cursorDefiningAncestor = |
| 1217 findCursorDefiningAncestor(bestTouchNode, m_page->deprecatedLocalMainFra me()); | 1242 findCursorDefiningAncestor(bestTouchNode, m_page->deprecatedLocalMainFra me()); |
| 1218 // We show a highlight on tap only when the current node shows a hand cursor | 1243 // We show a highlight on tap only when the current node shows a hand cursor |
| 1219 if (!cursorDefiningAncestor || !showsHandCursor(cursorDefiningAncestor, m_pa ge->deprecatedLocalMainFrame())) { | 1244 if (!cursorDefiningAncestor || !showsHandCursor(cursorDefiningAncestor, m_pa ge->deprecatedLocalMainFrame())) { |
| 1220 return 0; | 1245 return 0; |
| 1221 } | 1246 } |
| 1222 | 1247 |
| 1223 // We should pick the largest enclosing node with hand cursor set. We do thi s by first jumping | 1248 // We should pick the largest enclosing node with hand cursor set. We do thi s by first jumping |
| 1224 // up to cursorDefiningAncestor (which is already known to have hand cursor set). Then we locate | 1249 // up to cursorDefiningAncestor (which is already known to have hand cursor set). Then we locate |
| 1225 // the next cursor-defining ancestor up in the the tree and repeat the jumps as long as the node | 1250 // the next cursor-defining ancestor up in the the tree and repeat the jumps as long as the node |
| 1226 // has hand cursor set. | 1251 // has hand cursor set. |
| 1227 do { | 1252 do { |
| 1228 bestTouchNode = cursorDefiningAncestor; | 1253 bestTouchNode = cursorDefiningAncestor; |
| 1229 cursorDefiningAncestor = findCursorDefiningAncestor(NodeRenderingTravers al::parent(bestTouchNode), | 1254 cursorDefiningAncestor = findCursorDefiningAncestor(NodeRenderingTravers al::parent(bestTouchNode), |
| 1230 m_page->deprecatedLocalMainFrame()); | 1255 m_page->deprecatedLocalMainFrame()); |
| 1231 } while (cursorDefiningAncestor && showsHandCursor(cursorDefiningAncestor, m _page->deprecatedLocalMainFrame())); | 1256 } while (cursorDefiningAncestor && showsHandCursor(cursorDefiningAncestor, m _page->deprecatedLocalMainFrame())); |
| 1232 | 1257 |
| 1233 return bestTouchNode; | 1258 return bestTouchNode; |
| 1234 } | 1259 } |
| 1235 | 1260 |
| 1236 void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent ) | 1261 void WebViewImpl::enableTapHighlightAtPoint(const GestureEventWithHitTestResults & targetedTapEvent) |
| 1237 { | 1262 { |
| 1238 Node* touchNode = bestTapNode(tapEvent); | 1263 Node* touchNode = bestTapNode(targetedTapEvent); |
| 1239 | 1264 |
| 1240 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes; | 1265 WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes; |
| 1241 highlightNodes.append(touchNode); | 1266 highlightNodes.append(touchNode); |
| 1242 | 1267 |
| 1243 enableTapHighlights(highlightNodes); | 1268 enableTapHighlights(highlightNodes); |
| 1244 } | 1269 } |
| 1245 | 1270 |
| 1246 void WebViewImpl::enableTapHighlights(WillBeHeapVector<RawPtrWillBeMember<Node> >& highlightNodes) | 1271 void WebViewImpl::enableTapHighlights(WillBeHeapVector<RawPtrWillBeMember<Node> >& highlightNodes) |
| 1247 { | 1272 { |
| 1248 if (highlightNodes.isEmpty()) | 1273 if (highlightNodes.isEmpty()) |
| (...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4269 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); | 4294 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); |
| 4270 | 4295 |
| 4271 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4296 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 4272 return false; | 4297 return false; |
| 4273 | 4298 |
| 4274 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4299 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
| 4275 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); | 4300 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); |
| 4276 } | 4301 } |
| 4277 | 4302 |
| 4278 } // namespace blink | 4303 } // namespace blink |
| OLD | NEW |