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

Side by Side Diff: Source/core/page/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: Fix case where documentElement was added to scroll chain twice. Created 5 years, 8 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 { 199 {
200 scrollChain.clear(); 200 scrollChain.clear();
201 201
202 ASSERT(startNode.layoutObject()); 202 ASSERT(startNode.layoutObject());
203 LayoutBox* curBox = startNode.layoutObject()->enclosingBox(); 203 LayoutBox* curBox = startNode.layoutObject()->enclosingBox();
204 204
205 // Scrolling propagates along the containing block chain. 205 // Scrolling propagates along the containing block chain.
206 while (curBox && !curBox->isLayoutView()) { 206 while (curBox && !curBox->isLayoutView()) {
207 Node* curNode = curBox->node(); 207 Node* curNode = curBox->node();
208 // FIXME: this should reject more elements, as part of crbug.com/410974. 208 // FIXME: this should reject more elements, as part of crbug.com/410974.
209 if (curNode && curNode->isElementNode()) 209 if (curNode && curNode->isElementNode()) {
210 scrollChain.prepend(toElement(curNode)); 210 Element* curElement = toElement(curNode);
211 if (curElement == frame.document()->documentElement())
Rick Byers 2015/04/10 14:51:44 why doesn't the documentElement get put on the scr
tdresser 2015/05/08 18:23:02 I've clarified this in a comment. This only matter
212 break;
213 scrollChain.prepend(curElement);
214 }
211 curBox = curBox->containingBlock(); 215 curBox = curBox->containingBlock();
212 } 216 }
213 217
214 // FIXME: we should exclude the document in some cases, as part 218 // FIXME: we should exclude the document in some cases, as part
215 // of crbug.com/410974. 219 // of crbug.com/410974.
216 scrollChain.prepend(frame.document()->documentElement()); 220 scrollChain.prepend(frame.document()->documentElement());
217 } 221 }
218 222
219 EventHandler::EventHandler(LocalFrame* frame) 223 EventHandler::EventHandler(LocalFrame* frame)
220 : m_frame(frame) 224 : m_frame(frame)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 m_lastMouseDownUserGestureToken.clear(); 308 m_lastMouseDownUserGestureToken.clear();
305 m_mousePressNode = nullptr; 309 m_mousePressNode = nullptr;
306 m_mousePressed = false; 310 m_mousePressed = false;
307 m_capturesDragging = false; 311 m_capturesDragging = false;
308 m_capturingMouseEventsNode = nullptr; 312 m_capturingMouseEventsNode = nullptr;
309 m_latchedWheelEventNode = nullptr; 313 m_latchedWheelEventNode = nullptr;
310 m_previousWheelScrolledNode = nullptr; 314 m_previousWheelScrolledNode = nullptr;
311 m_targetForTouchID.clear(); 315 m_targetForTouchID.clear();
312 m_touchSequenceDocument.clear(); 316 m_touchSequenceDocument.clear();
313 m_touchSequenceUserGestureToken.clear(); 317 m_touchSequenceUserGestureToken.clear();
314 m_scrollGestureHandlingNode = nullptr; 318 clearGestureScrollState();
315 m_lastGestureScrollOverWidget = false; 319 m_lastGestureScrollOverWidget = false;
316 m_previousGestureScrolledNode = nullptr;
317 m_scrollbarHandlingScrollGesture = nullptr; 320 m_scrollbarHandlingScrollGesture = nullptr;
318 m_maxMouseMovedDuration = 0; 321 m_maxMouseMovedDuration = 0;
319 m_touchPressed = false; 322 m_touchPressed = false;
320 m_mouseDownMayStartSelect = false; 323 m_mouseDownMayStartSelect = false;
321 m_mouseDownMayStartDrag = false; 324 m_mouseDownMayStartDrag = false;
322 m_lastShowPressTimestamp = 0; 325 m_lastShowPressTimestamp = 0;
323 m_lastDeferredTapElement = nullptr; 326 m_lastDeferredTapElement = nullptr;
324 m_eventHandlerWillResetCapturingMouseEventsNode = false; 327 m_eventHandlerWillResetCapturingMouseEventsNode = false;
325 m_mouseDownWasSingleClickInSelection = false; 328 m_mouseDownWasSingleClickInSelection = false;
326 m_selectionInitiationState = HaveNotStartedSelection; 329 m_selectionInitiationState = HaveNotStartedSelection;
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 if (node) { 2600 if (node) {
2598 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); 2601 passScrollGestureEventToWidget(gestureEvent, node->layoutObject());
2599 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2602 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2600 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( 2603 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(
2601 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */ 2604 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */
2602 false, /* isEnding */ true, /* fromUserInput */ true); 2605 false, /* isEnding */ true, /* fromUserInput */ true);
2603 customizedScroll(*node.get(), *scrollState); 2606 customizedScroll(*node.get(), *scrollState);
2604 } 2607 }
2605 } 2608 }
2606 2609
2607 clearGestureScrollNodes(); 2610 clearGestureScrollState();
2608 return false; 2611 return false;
2609 } 2612 }
2610 2613
2611 bool EventHandler::handleGestureScrollBegin(const PlatformGestureEvent& gestureE vent) 2614 bool EventHandler::handleGestureScrollBegin(const PlatformGestureEvent& gestureE vent)
2612 { 2615 {
2613 Document* document = m_frame->document(); 2616 Document* document = m_frame->document();
2614 if (!document->layoutView()) 2617 if (!document->layoutView())
2615 return false; 2618 return false;
2616 2619
2617 FrameView* view = m_frame->view(); 2620 FrameView* view = m_frame->view();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2724 2727
2725 // Try to scroll the frame view. 2728 // Try to scroll the frame view.
2726 if (m_frame->applyScrollDelta(delta, false)) { 2729 if (m_frame->applyScrollDelta(delta, false)) {
2727 setFrameWasScrolledByUser(); 2730 setFrameWasScrolledByUser();
2728 return true; 2731 return true;
2729 } 2732 }
2730 2733
2731 return false; 2734 return false;
2732 } 2735 }
2733 2736
2734 void EventHandler::clearGestureScrollNodes() 2737 void EventHandler::clearGestureScrollState()
2735 { 2738 {
2736 m_scrollGestureHandlingNode = nullptr; 2739 m_scrollGestureHandlingNode = nullptr;
2737 m_previousGestureScrolledNode = nullptr; 2740 m_previousGestureScrolledNode = nullptr;
2738 m_deltaConsumedForScrollSequence = false; 2741 m_deltaConsumedForScrollSequence = false;
2739 m_currentScrollChain.clear(); 2742 m_currentScrollChain.clear();
2740 } 2743 }
2741 2744
2742 bool EventHandler::isScrollbarHandlingGestures() const 2745 bool EventHandler::isScrollbarHandlingGestures() const
2743 { 2746 {
2744 return m_scrollbarHandlingScrollGesture.get(); 2747 return m_scrollbarHandlingScrollGesture.get();
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
4076 unsigned EventHandler::accessKeyModifiers() 4079 unsigned EventHandler::accessKeyModifiers()
4077 { 4080 {
4078 #if OS(MACOSX) 4081 #if OS(MACOSX)
4079 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4082 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4080 #else 4083 #else
4081 return PlatformEvent::AltKey; 4084 return PlatformEvent::AltKey;
4082 #endif 4085 #endif
4083 } 4086 }
4084 4087
4085 } // namespace blink 4088 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698