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

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

Issue 1057603002: Expose scroll customization for touch to JS (behind REF). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 5 years, 6 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 { 198 {
199 scrollChain.clear(); 199 scrollChain.clear();
200 200
201 ASSERT(startNode.layoutObject()); 201 ASSERT(startNode.layoutObject());
202 LayoutBox* curBox = startNode.layoutObject()->enclosingBox(); 202 LayoutBox* curBox = startNode.layoutObject()->enclosingBox();
203 203
204 // Scrolling propagates along the containing block chain. 204 // Scrolling propagates along the containing block chain.
205 while (curBox && !curBox->isLayoutView()) { 205 while (curBox && !curBox->isLayoutView()) {
206 Node* curNode = curBox->node(); 206 Node* curNode = curBox->node();
207 // FIXME: this should reject more elements, as part of crbug.com/410974. 207 // FIXME: this should reject more elements, as part of crbug.com/410974.
208 if (curNode && curNode->isElementNode()) 208 if (curNode && curNode->isElementNode()) {
209 scrollChain.prepend(toElement(curNode)); 209 Element* curElement = toElement(curNode);
210 if (curElement == frame.document()->scrollingElement())
211 break;
212 scrollChain.prepend(curElement);
213 }
210 curBox = curBox->containingBlock(); 214 curBox = curBox->containingBlock();
211 } 215 }
212 216 // TODO(tdresser): this should sometimes be excluded, as part of crbug.com/4 10974.
213 // FIXME: we should exclude the document in some cases, as part 217 // We need to ensure that the scrollingElement is always part of
214 // of crbug.com/410974. 218 // the scroll chain. In quirks mode, when the scrollingElement is
215 scrollChain.prepend(frame.document()->documentElement()); 219 // the body, some elements may use the documentElement as their
220 // containingBlock, so we ensure the scrollingElement is added
221 // here.
222 scrollChain.prepend(frame.document()->scrollingElement());
216 } 223 }
217 224
218 EventHandler::EventHandler(LocalFrame* frame) 225 EventHandler::EventHandler(LocalFrame* frame)
219 : m_frame(frame) 226 : m_frame(frame)
220 , m_mousePressed(false) 227 , m_mousePressed(false)
221 , m_capturesDragging(false) 228 , m_capturesDragging(false)
222 , m_mouseDownMayStartSelect(false) 229 , m_mouseDownMayStartSelect(false)
223 , m_mouseDownMayStartDrag(false) 230 , m_mouseDownMayStartDrag(false)
224 , m_mouseDownWasSingleClickInSelection(false) 231 , m_mouseDownWasSingleClickInSelection(false)
225 , m_selectionInitiationState(HaveNotStartedSelection) 232 , m_selectionInitiationState(HaveNotStartedSelection)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 m_lastMouseDownUserGestureToken.clear(); 310 m_lastMouseDownUserGestureToken.clear();
304 m_mousePressNode = nullptr; 311 m_mousePressNode = nullptr;
305 m_mousePressed = false; 312 m_mousePressed = false;
306 m_capturesDragging = false; 313 m_capturesDragging = false;
307 m_capturingMouseEventsNode = nullptr; 314 m_capturingMouseEventsNode = nullptr;
308 m_latchedWheelEventNode = nullptr; 315 m_latchedWheelEventNode = nullptr;
309 m_previousWheelScrolledNode = nullptr; 316 m_previousWheelScrolledNode = nullptr;
310 m_targetForTouchID.clear(); 317 m_targetForTouchID.clear();
311 m_touchSequenceDocument.clear(); 318 m_touchSequenceDocument.clear();
312 m_touchSequenceUserGestureToken.clear(); 319 m_touchSequenceUserGestureToken.clear();
313 m_scrollGestureHandlingNode = nullptr; 320 clearGestureScrollState();
314 m_lastGestureScrollOverWidget = false; 321 m_lastGestureScrollOverWidget = false;
315 m_previousGestureScrolledNode = nullptr;
316 m_scrollbarHandlingScrollGesture = nullptr; 322 m_scrollbarHandlingScrollGesture = nullptr;
317 m_maxMouseMovedDuration = 0; 323 m_maxMouseMovedDuration = 0;
318 m_touchPressed = false; 324 m_touchPressed = false;
319 m_mouseDownMayStartSelect = false; 325 m_mouseDownMayStartSelect = false;
320 m_mouseDownMayStartDrag = false; 326 m_mouseDownMayStartDrag = false;
321 m_lastShowPressTimestamp = 0; 327 m_lastShowPressTimestamp = 0;
322 m_lastDeferredTapElement = nullptr; 328 m_lastDeferredTapElement = nullptr;
323 m_eventHandlerWillResetCapturingMouseEventsNode = false; 329 m_eventHandlerWillResetCapturingMouseEventsNode = false;
324 m_mouseDownWasSingleClickInSelection = false; 330 m_mouseDownWasSingleClickInSelection = false;
325 m_selectionInitiationState = HaveNotStartedSelection; 331 m_selectionInitiationState = HaveNotStartedSelection;
(...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 if (node) { 2606 if (node) {
2601 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); 2607 passScrollGestureEventToWidget(gestureEvent, node->layoutObject());
2602 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2608 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2603 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( 2609 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(
2604 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */ 2610 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */
2605 false, /* isEnding */ true, /* fromUserInput */ true); 2611 false, /* isEnding */ true, /* fromUserInput */ true);
2606 customizedScroll(*node.get(), *scrollState); 2612 customizedScroll(*node.get(), *scrollState);
2607 } 2613 }
2608 } 2614 }
2609 2615
2610 clearGestureScrollNodes(); 2616 clearGestureScrollState();
2611 return false; 2617 return false;
2612 } 2618 }
2613 2619
2614 bool EventHandler::handleGestureScrollBegin(const PlatformGestureEvent& gestureE vent) 2620 bool EventHandler::handleGestureScrollBegin(const PlatformGestureEvent& gestureE vent)
2615 { 2621 {
2616 Document* document = m_frame->document(); 2622 Document* document = m_frame->document();
2617 if (!document->layoutView()) 2623 if (!document->layoutView())
2618 return false; 2624 return false;
2619 2625
2620 FrameView* view = m_frame->view(); 2626 FrameView* view = m_frame->view();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 2733
2728 // Try to scroll the frame view. 2734 // Try to scroll the frame view.
2729 if (m_frame->applyScrollDelta(delta, false)) { 2735 if (m_frame->applyScrollDelta(delta, false)) {
2730 setFrameWasScrolledByUser(); 2736 setFrameWasScrolledByUser();
2731 return true; 2737 return true;
2732 } 2738 }
2733 2739
2734 return false; 2740 return false;
2735 } 2741 }
2736 2742
2737 void EventHandler::clearGestureScrollNodes() 2743 void EventHandler::clearGestureScrollState()
2738 { 2744 {
2739 m_scrollGestureHandlingNode = nullptr; 2745 m_scrollGestureHandlingNode = nullptr;
2740 m_previousGestureScrolledNode = nullptr; 2746 m_previousGestureScrolledNode = nullptr;
2741 m_deltaConsumedForScrollSequence = false; 2747 m_deltaConsumedForScrollSequence = false;
2742 m_currentScrollChain.clear(); 2748 m_currentScrollChain.clear();
2743 } 2749 }
2744 2750
2745 bool EventHandler::isScrollbarHandlingGestures() const 2751 bool EventHandler::isScrollbarHandlingGestures() const
2746 { 2752 {
2747 return m_scrollbarHandlingScrollGesture.get(); 2753 return m_scrollbarHandlingScrollGesture.get();
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 unsigned EventHandler::accessKeyModifiers() 4176 unsigned EventHandler::accessKeyModifiers()
4171 { 4177 {
4172 #if OS(MACOSX) 4178 #if OS(MACOSX)
4173 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4179 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4174 #else 4180 #else
4175 return PlatformEvent::AltKey; 4181 return PlatformEvent::AltKey;
4176 #endif 4182 #endif
4177 } 4183 }
4178 4184
4179 } // namespace blink 4185 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698