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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 case WebInputEvent::GestureLongPress: | 809 case WebInputEvent::GestureLongPress: |
810 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 810 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
811 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); | 811 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
812 break; | 812 break; |
813 default: | 813 default: |
814 break; | 814 break; |
815 } | 815 } |
816 | 816 |
817 switch (event.type) { | 817 switch (event.type) { |
818 case WebInputEvent::GestureTap: { | 818 case WebInputEvent::GestureTap: { |
819 // If there is a popup open, close it as the user is clicking on the page | |
820 // (outside of the popup). We also save it so we can prevent a tap on an | |
821 // element from immediately reopening the same popup. | |
822 RefPtr<WebPagePopupImpl> pagePopup = m_pagePopup; | |
823 hidePopups(); | |
824 DCHECK(!m_pagePopup); | |
825 | |
826 m_client->cancelScheduledContentIntents(); | 819 m_client->cancelScheduledContentIntents(); |
827 if (detectContentOnTouch(targetedEvent)) { | 820 if (detectContentOnTouch(targetedEvent)) { |
828 eventResult = WebInputEventResult::HandledSystem; | 821 eventResult = WebInputEventResult::HandledSystem; |
829 break; | 822 break; |
830 } | 823 } |
831 | 824 |
832 // Don't trigger a disambiguation popup on sites designed for mobile | 825 // Don't trigger a disambiguation popup on sites designed for mobile |
833 // devices. Instead, assume that the page has been designed with big | 826 // devices. Instead, assume that the page has been designed with big |
834 // enough buttons and links. Don't trigger a disambiguation popup when | 827 // enough buttons and links. Don't trigger a disambiguation popup when |
835 // screencasting, since it's implemented outside of compositor pipeline | 828 // screencasting, since it's implemented outside of compositor pipeline |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); | 860 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
868 eventResult = WebInputEventResult::HandledSystem; | 861 eventResult = WebInputEventResult::HandledSystem; |
869 eventCancelled = true; | 862 eventCancelled = true; |
870 break; | 863 break; |
871 } | 864 } |
872 } | 865 } |
873 } | 866 } |
874 | 867 |
875 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( | 868 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( |
876 targetedEvent); | 869 targetedEvent); |
877 | 870 if (m_pagePopup && m_lastHiddenPagePopup && |
878 if (m_pagePopup && pagePopup && | 871 m_pagePopup->hasSamePopupClient(m_lastHiddenPagePopup.get())) { |
879 m_pagePopup->hasSamePopupClient(pagePopup.get())) { | |
880 // The tap triggered a page popup that is the same as the one we just | 872 // The tap triggered a page popup that is the same as the one we just |
881 // closed. It needs to be closed. | 873 // closed. It needs to be closed. |
882 cancelPagePopup(); | 874 cancelPagePopup(); |
883 } | 875 } |
| 876 m_lastHiddenPagePopup = nullptr; |
884 break; | 877 break; |
885 } | 878 } |
886 case WebInputEvent::GestureTwoFingerTap: | 879 case WebInputEvent::GestureTwoFingerTap: |
887 case WebInputEvent::GestureLongPress: | 880 case WebInputEvent::GestureLongPress: |
888 case WebInputEvent::GestureLongTap: { | 881 case WebInputEvent::GestureLongTap: { |
889 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 882 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
890 break; | 883 break; |
891 | 884 |
892 m_client->cancelScheduledContentIntents(); | 885 m_client->cancelScheduledContentIntents(); |
893 m_page->contextMenuController().clearContextMenu(); | 886 m_page->contextMenuController().clearContextMenu(); |
894 { | 887 { |
895 ContextMenuAllowedScope scope; | 888 ContextMenuAllowedScope scope; |
896 eventResult = | 889 eventResult = |
897 mainFrameImpl()->frame()->eventHandler().handleGestureEvent( | 890 mainFrameImpl()->frame()->eventHandler().handleGestureEvent( |
898 targetedEvent); | 891 targetedEvent); |
899 } | 892 } |
900 | 893 |
901 break; | 894 break; |
902 } | 895 } |
903 case WebInputEvent::GestureShowPress: | 896 case WebInputEvent::GestureTapDown: { |
| 897 // Touch pinch zoom and scroll on the page (outside of a popup) must hide |
| 898 // the popup. In case of a touch scroll or pinch zoom, this function is |
| 899 // called with GestureTapDown rather than a GSB/GSU/GSE or GPB/GPU/GPE. |
| 900 // When we close a popup because of a GestureTapDown, we also save it so |
| 901 // we can prevent the following GestureTap from immediately reopening the |
| 902 // same popup. |
| 903 m_lastHiddenPagePopup = m_pagePopup; |
| 904 hidePopups(); |
| 905 DCHECK(!m_pagePopup); |
| 906 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( |
| 907 targetedEvent); |
| 908 break; |
| 909 } |
| 910 case WebInputEvent::GestureTapCancel: { |
| 911 m_lastHiddenPagePopup = nullptr; |
| 912 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( |
| 913 targetedEvent); |
| 914 break; |
| 915 } |
| 916 case WebInputEvent::GestureShowPress: { |
904 m_client->cancelScheduledContentIntents(); | 917 m_client->cancelScheduledContentIntents(); |
905 case WebInputEvent::GestureTapDown: | 918 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( |
906 // Touch pinch zoom and scroll must hide the popup. In case of a touch | 919 targetedEvent); |
907 // scroll or pinch zoom, this function is called with GestureTapDown | 920 break; |
908 // rather than a GSB/GSU/GSE or GPB/GPU/GPE. | 921 } |
909 hidePopups(); | |
910 case WebInputEvent::GestureTapCancel: | |
911 case WebInputEvent::GestureTapUnconfirmed: { | 922 case WebInputEvent::GestureTapUnconfirmed: { |
912 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( | 923 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( |
913 targetedEvent); | 924 targetedEvent); |
914 break; | 925 break; |
915 } | 926 } |
916 default: | 927 default: { NOTREACHED(); } |
917 NOTREACHED(); | |
918 } | 928 } |
919 m_client->didHandleGestureEvent(event, eventCancelled); | 929 m_client->didHandleGestureEvent(event, eventCancelled); |
920 return eventResult; | 930 return eventResult; |
921 } | 931 } |
922 | 932 |
923 WebInputEventResult WebViewImpl::handleSyntheticWheelFromTouchpadPinchEvent( | 933 WebInputEventResult WebViewImpl::handleSyntheticWheelFromTouchpadPinchEvent( |
924 const WebGestureEvent& pinchEvent) { | 934 const WebGestureEvent& pinchEvent) { |
925 DCHECK_EQ(pinchEvent.type, WebInputEvent::GesturePinchUpdate); | 935 DCHECK_EQ(pinchEvent.type, WebInputEvent::GesturePinchUpdate); |
926 | 936 |
927 // For pinch gesture events, match typical trackpad behavior on Windows by | 937 // For pinch gesture events, match typical trackpad behavior on Windows by |
(...skipping 3276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4204 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4214 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4205 return nullptr; | 4215 return nullptr; |
4206 return focusedFrame; | 4216 return focusedFrame; |
4207 } | 4217 } |
4208 | 4218 |
4209 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4219 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4210 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4220 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4211 } | 4221 } |
4212 | 4222 |
4213 } // namespace blink | 4223 } // namespace blink |
OLD | NEW |