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_lastCancelledPagePopup && |
878 if (m_pagePopup && pagePopup && | 871 m_pagePopup->hasSamePopupClient(m_lastCancelledPagePopup.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. |
874 m_lastCancelledPagePopup = nullptr; | |
bokan
2016/12/08 16:28:35
This should be cleared even if we opened a differe
sahel
2016/12/09 15:36:37
A gestureTapDown will close a popup and store it i
bokan
2016/12/09 16:58:08
Yep, I agree the logic is correct. But this value
| |
882 cancelPagePopup(); | 875 cancelPagePopup(); |
883 } | 876 } |
877 | |
bokan
2016/12/08 16:28:35
Nit: remove line.
sahel
2016/12/09 15:36:36
Done.
| |
884 break; | 878 break; |
885 } | 879 } |
886 case WebInputEvent::GestureTwoFingerTap: | 880 case WebInputEvent::GestureTwoFingerTap: |
887 case WebInputEvent::GestureLongPress: | 881 case WebInputEvent::GestureLongPress: |
888 case WebInputEvent::GestureLongTap: { | 882 case WebInputEvent::GestureLongTap: { |
889 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 883 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
890 break; | 884 break; |
891 | 885 |
892 m_client->cancelScheduledContentIntents(); | 886 m_client->cancelScheduledContentIntents(); |
893 m_page->contextMenuController().clearContextMenu(); | 887 m_page->contextMenuController().clearContextMenu(); |
894 { | 888 { |
895 ContextMenuAllowedScope scope; | 889 ContextMenuAllowedScope scope; |
896 eventResult = | 890 eventResult = |
897 mainFrameImpl()->frame()->eventHandler().handleGestureEvent( | 891 mainFrameImpl()->frame()->eventHandler().handleGestureEvent( |
898 targetedEvent); | 892 targetedEvent); |
899 } | 893 } |
900 | 894 |
901 break; | 895 break; |
902 } | 896 } |
897 case WebInputEvent::GestureTapDown: { | |
898 // Touch pinch zoom and scroll on the page (outside of a popup) must hide | |
899 // the popup. In case of a touch scroll or pinch zoom, this function is | |
900 // called with GestureTapDown rather than a GSB/GSU/GSE or GPB/GPU/GPE. | |
901 // When we close a popup because of a GestureTapDown, we also save it so | |
902 // we can prevent the following GestureTap from immediately reopening the | |
903 // same popup. | |
904 m_lastCancelledPagePopup = m_pagePopup; | |
905 hidePopups(); | |
906 DCHECK(!m_pagePopup); | |
907 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( | |
908 targetedEvent); | |
909 break; | |
910 } | |
911 case WebInputEvent::GestureTapCancel: { | |
912 m_lastCancelledPagePopup = nullptr; | |
913 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( | |
914 targetedEvent); | |
915 break; | |
916 } | |
903 case WebInputEvent::GestureShowPress: | 917 case WebInputEvent::GestureShowPress: |
904 m_client->cancelScheduledContentIntents(); | 918 m_client->cancelScheduledContentIntents(); |
bokan
2016/12/08 16:28:34
For consistency, add a handleGestureEvent call her
sahel
2016/12/09 15:36:36
Done.
| |
905 case WebInputEvent::GestureTapDown: | |
906 // Touch pinch zoom and scroll must hide the popup. In case of a touch | |
907 // scroll or pinch zoom, this function is called with GestureTapDown | |
908 // rather than a GSB/GSU/GSE or GPB/GPU/GPE. | |
909 hidePopups(); | |
910 case WebInputEvent::GestureTapCancel: | |
911 case WebInputEvent::GestureTapUnconfirmed: { | 919 case WebInputEvent::GestureTapUnconfirmed: { |
912 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( | 920 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( |
913 targetedEvent); | 921 targetedEvent); |
914 break; | 922 break; |
915 } | 923 } |
916 default: | 924 default: |
917 NOTREACHED(); | 925 NOTREACHED(); |
bokan
2016/12/08 16:28:35
Nit: add braces here.
sahel
2016/12/09 15:36:37
Done.
| |
918 } | 926 } |
919 m_client->didHandleGestureEvent(event, eventCancelled); | 927 m_client->didHandleGestureEvent(event, eventCancelled); |
920 return eventResult; | 928 return eventResult; |
921 } | 929 } |
922 | 930 |
923 WebInputEventResult WebViewImpl::handleSyntheticWheelFromTouchpadPinchEvent( | 931 WebInputEventResult WebViewImpl::handleSyntheticWheelFromTouchpadPinchEvent( |
924 const WebGestureEvent& pinchEvent) { | 932 const WebGestureEvent& pinchEvent) { |
925 DCHECK_EQ(pinchEvent.type, WebInputEvent::GesturePinchUpdate); | 933 DCHECK_EQ(pinchEvent.type, WebInputEvent::GesturePinchUpdate); |
926 | 934 |
927 // For pinch gesture events, match typical trackpad behavior on Windows by | 935 // 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()) | 4212 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4205 return nullptr; | 4213 return nullptr; |
4206 return focusedFrame; | 4214 return focusedFrame; |
4207 } | 4215 } |
4208 | 4216 |
4209 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4217 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4210 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4218 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4211 } | 4219 } |
4212 | 4220 |
4213 } // namespace blink | 4221 } // namespace blink |
OLD | NEW |