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

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

Issue 59573002: Add Frame::isMainFrame and deploy it (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
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 3790 matching lines...) Expand 10 before | Expand all | Expand 10 after
3801 SyntheticSingleTouchEvent touchEvent(event); 3801 SyntheticSingleTouchEvent touchEvent(event);
3802 if (handleTouchEvent(touchEvent)) 3802 if (handleTouchEvent(touchEvent))
3803 return true; 3803 return true;
3804 3804
3805 return handleMouseEventAsEmulatedGesture(event); 3805 return handleMouseEventAsEmulatedGesture(event);
3806 } 3806 }
3807 3807
3808 bool EventHandler::handleMouseEventAsEmulatedGesture(const PlatformMouseEvent& e vent) 3808 bool EventHandler::handleMouseEventAsEmulatedGesture(const PlatformMouseEvent& e vent)
3809 { 3809 {
3810 PlatformEvent::Type eventType = event.type(); 3810 PlatformEvent::Type eventType = event.type();
3811 Page* page = m_frame->page(); 3811 if (event.button() != LeftButton || !m_frame->isMainFrame())
3812 FrameView* view = m_frame->view();
3813 if (event.button() != LeftButton || page->mainFrame() != m_frame)
3814 return false; 3812 return false;
3815 3813
3816 // Simulate pinch / scroll gesture. 3814 // Simulate pinch / scroll gesture.
3817 const IntPoint& position = event.position(); 3815 const IntPoint& position = event.position();
3818 bool swallowEvent = false; 3816 bool swallowEvent = false;
3819 3817
3818 FrameView* view = m_frame->view();
3820 if (event.shiftKey()) { 3819 if (event.shiftKey()) {
3821 // Shift pressed - consider it gesture. 3820 // Shift pressed - consider it gesture.
3822 swallowEvent = true; 3821 swallowEvent = true;
3822 Page* page = m_frame->page();
3823 float pageScaleFactor = page->pageScaleFactor(); 3823 float pageScaleFactor = page->pageScaleFactor();
3824 switch (eventType) { 3824 switch (eventType) {
3825 case PlatformEvent::MousePressed: 3825 case PlatformEvent::MousePressed:
3826 m_lastSyntheticPinchAnchorCss = adoptPtr(new IntPoint(view->scrollPo sition() + position)); 3826 m_lastSyntheticPinchAnchorCss = adoptPtr(new IntPoint(view->scrollPo sition() + position));
3827 m_lastSyntheticPinchAnchorDip = adoptPtr(new IntPoint(position)); 3827 m_lastSyntheticPinchAnchorDip = adoptPtr(new IntPoint(position));
3828 m_lastSyntheticPinchAnchorDip->scale(pageScaleFactor, pageScaleFacto r); 3828 m_lastSyntheticPinchAnchorDip->scale(pageScaleFactor, pageScaleFacto r);
3829 m_syntheticPageScaleFactor = pageScaleFactor; 3829 m_syntheticPageScaleFactor = pageScaleFactor;
3830 break; 3830 break;
3831 case PlatformEvent::MouseMoved: 3831 case PlatformEvent::MouseMoved:
3832 { 3832 {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3977 unsigned EventHandler::accessKeyModifiers() 3977 unsigned EventHandler::accessKeyModifiers()
3978 { 3978 {
3979 #if OS(MACOSX) 3979 #if OS(MACOSX)
3980 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3980 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3981 #else 3981 #else
3982 return PlatformEvent::AltKey; 3982 return PlatformEvent::AltKey;
3983 #endif 3983 #endif
3984 } 3984 }
3985 3985
3986 } // namespace WebCore 3986 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/AutoscrollController.cpp ('k') | Source/core/rendering/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698