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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1942623002: Rename Document::ownerElement to localOwner and fix main frame checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed to localOwner + fixed up rootScroller warnings Created 4 years, 7 months 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
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "core/page/AutoscrollController.h" 77 #include "core/page/AutoscrollController.h"
78 #include "core/page/ChromeClient.h" 78 #include "core/page/ChromeClient.h"
79 #include "core/page/DragController.h" 79 #include "core/page/DragController.h"
80 #include "core/page/DragState.h" 80 #include "core/page/DragState.h"
81 #include "core/page/FocusController.h" 81 #include "core/page/FocusController.h"
82 #include "core/page/FrameTree.h" 82 #include "core/page/FrameTree.h"
83 #include "core/page/Page.h" 83 #include "core/page/Page.h"
84 #include "core/page/SpatialNavigation.h" 84 #include "core/page/SpatialNavigation.h"
85 #include "core/page/TouchAdjustment.h" 85 #include "core/page/TouchAdjustment.h"
86 #include "core/page/scrolling/OverscrollController.h" 86 #include "core/page/scrolling/OverscrollController.h"
87 #include "core/page/scrolling/RootScroller.h"
87 #include "core/page/scrolling/ScrollState.h" 88 #include "core/page/scrolling/ScrollState.h"
88 #include "core/paint/PaintLayer.h" 89 #include "core/paint/PaintLayer.h"
89 #include "core/style/ComputedStyle.h" 90 #include "core/style/ComputedStyle.h"
90 #include "core/svg/SVGDocumentExtensions.h" 91 #include "core/svg/SVGDocumentExtensions.h"
91 #include "platform/PlatformGestureEvent.h" 92 #include "platform/PlatformGestureEvent.h"
92 #include "platform/PlatformKeyboardEvent.h" 93 #include "platform/PlatformKeyboardEvent.h"
93 #include "platform/PlatformTouchEvent.h" 94 #include "platform/PlatformTouchEvent.h"
94 #include "platform/PlatformWheelEvent.h" 95 #include "platform/PlatformWheelEvent.h"
95 #include "platform/RuntimeEnabledFeatures.h" 96 #include "platform/RuntimeEnabledFeatures.h"
96 #include "platform/TraceEvent.h" 97 #include "platform/TraceEvent.h"
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2422 if (m_frame->isMainFrame()) 2423 if (m_frame->isMainFrame())
2423 m_frame->host()->topControls().scrollBegin(); 2424 m_frame->host()->topControls().scrollBegin();
2424 } 2425 }
2425 return WebInputEventResult::HandledSystem; 2426 return WebInputEventResult::HandledSystem;
2426 } 2427 }
2427 2428
2428 bool EventHandler::isRootScroller(const Node& node) const 2429 bool EventHandler::isRootScroller(const Node& node) const
2429 { 2430 {
2430 // The root scroller is the one Element on the page designated to perform 2431 // The root scroller is the one Element on the page designated to perform
2431 // "viewport actions" like top controls movement and overscroll glow. 2432 // "viewport actions" like top controls movement and overscroll glow.
2432 2433 if (!node.isElementNode() || !frameHost() || !frameHost()->rootScroller())
2433 if (!node.isElementNode() || node.document().ownerElement())
2434 return false; 2434 return false;
2435 2435
2436 return node.document().rootScroller() == toElement(&node); 2436 return frameHost()->rootScroller()->get() == toElement(&node);
esprehn 2016/05/09 21:22:34 you don't need to cast a node to an Element to com
bokan 2016/05/09 22:26:18 Done, but this will break silently if Element or C
2437 } 2437 }
2438 2438
2439 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur eEvent& gestureEvent) 2439 WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestur eEvent& gestureEvent)
2440 { 2440 {
2441 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); 2441 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate);
2442 2442
2443 // Negate the deltas since the gesture event stores finger movement and 2443 // Negate the deltas since the gesture event stores finger movement and
2444 // scrolling occurs in the direction opposite the finger's movement 2444 // scrolling occurs in the direction opposite the finger's movement
2445 // direction. e.g. Finger moving up has negative event delta but causes the 2445 // direction. e.g. Finger moving up has negative event delta but causes the
2446 // page to scroll down causing positive scroll delta. 2446 // page to scroll down causing positive scroll delta.
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
3701 { 3701 {
3702 #if OS(MACOSX) 3702 #if OS(MACOSX)
3703 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 3703 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
3704 #else 3704 #else
3705 return PlatformEvent::AltKey; 3705 return PlatformEvent::AltKey;
3706 #endif 3706 #endif
3707 } 3707 }
3708 3708
3709 FrameHost* EventHandler::frameHost() 3709 FrameHost* EventHandler::frameHost()
3710 { 3710 {
3711 return const_cast<FrameHost*>(
3712 static_cast<const EventHandler&>(*this).frameHost());
esprehn 2016/05/09 21:22:34 woah, just mark the getter as const
bokan 2016/05/09 22:26:18 Done.
3713 }
3714
3715 const FrameHost* EventHandler::frameHost() const
esprehn 2016/05/09 21:22:34 no need for this, the getter can just be const
dcheng 2016/05/09 21:26:16 I think we should just make this FrameHost* EventH
bokan 2016/05/09 22:26:18 Done.
3716 {
3711 if (!m_frame->page()) 3717 if (!m_frame->page())
3712 return nullptr; 3718 return nullptr;
3713 3719
3714 return &m_frame->page()->frameHost(); 3720 return &m_frame->page()->frameHost();
3715 } 3721 }
3716 3722
3717 } // namespace blink 3723 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698