Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 724673003: Don't make :hover sticky on tap on sites that set a mobile viewport set (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Refactored logic and corrected viewport checking Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/page/ChromeClient.h ('k') | Source/core/page/Page.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
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 2647 matching lines...) Expand 10 before | Expand all | Expand 10 after
2658 switch (type) { 2658 switch (type) {
2659 case PlatformEvent::GestureShowPress: 2659 case PlatformEvent::GestureShowPress:
2660 case PlatformEvent::GestureTapUnconfirmed: 2660 case PlatformEvent::GestureTapUnconfirmed:
2661 return hitType | HitTestRequest::Active; 2661 return hitType | HitTestRequest::Active;
2662 case PlatformEvent::GestureTapDownCancel: 2662 case PlatformEvent::GestureTapDownCancel:
2663 // A TapDownCancel received when no element is active shouldn't really b e changing hover state. 2663 // A TapDownCancel received when no element is active shouldn't really b e changing hover state.
2664 if (!m_frame->document()->activeHoverElement()) 2664 if (!m_frame->document()->activeHoverElement())
2665 hitType |= HitTestRequest::ReadOnly; 2665 hitType |= HitTestRequest::ReadOnly;
2666 return hitType | HitTestRequest::Release; 2666 return hitType | HitTestRequest::Release;
2667 case PlatformEvent::GestureTap: 2667 case PlatformEvent::GestureTap:
2668 return hitType | HitTestRequest::Release; 2668 hitType |= HitTestRequest::Release;
2669 // needs to clear hover on mobile optimized pages
2670 if (m_frame->page()->shouldDisableDesktopWorkarounds())
2671 hitType |= HitTestRequest::Leave;
2672 return hitType;
2669 case PlatformEvent::GestureTapDown: 2673 case PlatformEvent::GestureTapDown:
2670 case PlatformEvent::GestureLongPress: 2674 case PlatformEvent::GestureLongPress:
2671 case PlatformEvent::GestureLongTap: 2675 case PlatformEvent::GestureLongTap:
2672 case PlatformEvent::GestureTwoFingerTap: 2676 case PlatformEvent::GestureTwoFingerTap:
2673 // FIXME: Shouldn't LongTap and TwoFingerTap clear the Active state? 2677 // FIXME: Shouldn't LongTap and TwoFingerTap clear the Active state?
2674 return hitType | HitTestRequest::Active | HitTestRequest::ReadOnly; 2678 return hitType | HitTestRequest::Active | HitTestRequest::ReadOnly;
2675 default: 2679 default:
2676 ASSERT_NOT_REACHED(); 2680 ASSERT_NOT_REACHED();
2677 return hitType | HitTestRequest::Active | HitTestRequest::ReadOnly; 2681 return hitType | HitTestRequest::Active | HitTestRequest::ReadOnly;
2678 } 2682 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2953 2957
2954 void EventHandler::activeIntervalTimerFired(Timer<EventHandler>*) 2958 void EventHandler::activeIntervalTimerFired(Timer<EventHandler>*)
2955 { 2959 {
2956 m_activeIntervalTimer.stop(); 2960 m_activeIntervalTimer.stop();
2957 2961
2958 if (m_frame 2962 if (m_frame
2959 && m_frame->document() 2963 && m_frame->document()
2960 && m_lastDeferredTapElement) { 2964 && m_lastDeferredTapElement) {
2961 // FIXME: Enable condition when http://crbug.com/226842 lands 2965 // FIXME: Enable condition when http://crbug.com/226842 lands
2962 // m_lastDeferredTapElement.get() == m_frame->document()->activeElement( ) 2966 // m_lastDeferredTapElement.get() == m_frame->document()->activeElement( )
2963 HitTestRequest request(HitTestRequest::TouchEvent | HitTestRequest::Rele ase); 2967
2968 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent | HitTestRequest::Release;
2969 // This is delayed updating of hover/active states for GestureTap.
2970 // So, this needs to clear hover on mobile optimized pages
2971 if (m_frame->page()->shouldDisableDesktopWorkarounds())
2972 hitType |= HitTestRequest::Leave;
2973
2974 HitTestRequest request(hitType);
2964 m_frame->document()->updateHoverActiveState(request, m_lastDeferredTapEl ement.get()); 2975 m_frame->document()->updateHoverActiveState(request, m_lastDeferredTapEl ement.get());
2965 } 2976 }
2966 m_lastDeferredTapElement = nullptr; 2977 m_lastDeferredTapElement = nullptr;
2967 } 2978 }
2968 2979
2969 void EventHandler::notifyElementActivated() 2980 void EventHandler::notifyElementActivated()
2970 { 2981 {
2971 // Since another element has been set to active, stop current timer and clea r reference. 2982 // Since another element has been set to active, stop current timer and clea r reference.
2972 if (m_activeIntervalTimer.isActive()) 2983 if (m_activeIntervalTimer.isActive())
2973 m_activeIntervalTimer.stop(); 2984 m_activeIntervalTimer.stop();
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
3871 unsigned EventHandler::accessKeyModifiers() 3882 unsigned EventHandler::accessKeyModifiers()
3872 { 3883 {
3873 #if OS(MACOSX) 3884 #if OS(MACOSX)
3874 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3885 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3875 #else 3886 #else
3876 return PlatformEvent::AltKey; 3887 return PlatformEvent::AltKey;
3877 #endif 3888 #endif
3878 } 3889 }
3879 3890
3880 } // namespace blink 3891 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/ChromeClient.h ('k') | Source/core/page/Page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698