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

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

Issue 1646663002: Refactor Scroll Customization to share cc::ScrollStateData with blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix linking more. Created 4 years, 10 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 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 } 2433 }
2434 2434
2435 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent) 2435 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent)
2436 { 2436 {
2437 RefPtrWillBeRawPtr<Node> node = m_scrollGestureHandlingNode; 2437 RefPtrWillBeRawPtr<Node> node = m_scrollGestureHandlingNode;
2438 2438
2439 if (node) { 2439 if (node) {
2440 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); 2440 passScrollGestureEventToWidget(gestureEvent, node->layoutObject());
2441 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2441 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2442 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( 2442 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(
2443 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */ 2443 0 /* deltaX */, 0 /* deltaY */,
2444 false, /* isEnding */ true, /* fromUserInput */ true); 2444 gestureEvent.position().x(), gestureEvent.position().y(),
2445 0 /* velocityX*/, 0 /* velocityY */,
2446 false /* isBeginning */, gestureEvent.inertial(), true /* isEndi ng */,
2447 false /* shouldPropagate */, true /* fromUserInput */,
2448 true /* isDirectManipulation */, 0 /* deltaGranularity*/,
2449 m_deltaConsumedForScrollSequence);
2445 customizedScroll(*node.get(), *scrollState); 2450 customizedScroll(*node.get(), *scrollState);
2446 } 2451 }
2447 } 2452 }
2448 2453
2449 clearGestureScrollState(); 2454 clearGestureScrollState();
2450 return WebInputEventResult::NotHandled; 2455 return WebInputEventResult::NotHandled;
2451 } 2456 }
2452 2457
2453 WebInputEventResult EventHandler::handleGestureScrollBegin(const PlatformGesture Event& gestureEvent) 2458 WebInputEventResult EventHandler::handleGestureScrollBegin(const PlatformGesture Event& gestureEvent)
2454 { 2459 {
(...skipping 15 matching lines...) Expand all
2470 m_scrollGestureHandlingNode = m_frame->document()->documentElement() ; 2475 m_scrollGestureHandlingNode = m_frame->document()->documentElement() ;
2471 else 2476 else
2472 return WebInputEventResult::NotHandled; 2477 return WebInputEventResult::NotHandled;
2473 } 2478 }
2474 ASSERT(m_scrollGestureHandlingNode); 2479 ASSERT(m_scrollGestureHandlingNode);
2475 2480
2476 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la youtObject()); 2481 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la youtObject());
2477 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2482 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2478 m_currentScrollChain.clear(); 2483 m_currentScrollChain.clear();
2479 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( 2484 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(
2480 0, 0, 0, 0, 0, /* inInertialPhase */ false, /* isBeginning */ 2485 0 /* deltaX */, 0 /* deltaY */,
2481 true, /* isEnding */ false, /* fromUserInput */ true); 2486 gestureEvent.position().x(), gestureEvent.position().y(),
2487 0 /* velocityX*/, 0 /* velocityY */,
2488 true /* isBeginning */, false /* inertial */, false /* isEnding */,
2489 false /* shouldPropagate */, true /* fromUserInput */,
2490 true /* isDirectManipulation */, 0 /* deltaGranularity*/,
2491 m_deltaConsumedForScrollSequence);
2482 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState); 2492 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState);
2483 } else { 2493 } else {
2484 if (m_frame->isMainFrame()) 2494 if (m_frame->isMainFrame())
2485 m_frame->host()->topControls().scrollBegin(); 2495 m_frame->host()->topControls().scrollBegin();
2486 } 2496 }
2487 return WebInputEventResult::HandledSystem; 2497 return WebInputEventResult::HandledSystem;
2488 } 2498 }
2489 2499
2490 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY) 2500 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY)
2491 { 2501 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 // FIXME: we should allow simultaneous scrolling of nested 2560 // FIXME: we should allow simultaneous scrolling of nested
2551 // iframes along perpendicular axes. See crbug.com/466991. 2561 // iframes along perpendicular axes. See crbug.com/466991.
2552 m_deltaConsumedForScrollSequence = true; 2562 m_deltaConsumedForScrollSequence = true;
2553 return result; 2563 return result;
2554 } 2564 }
2555 2565
2556 bool scrolled = false; 2566 bool scrolled = false;
2557 if (handleScrollCustomization) { 2567 if (handleScrollCustomization) {
2558 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( 2568 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(
2559 gestureEvent.deltaX(), gestureEvent.deltaY(), 2569 gestureEvent.deltaX(), gestureEvent.deltaY(),
2560 0, gestureEvent.velocityX(), gestureEvent.velocityY(), 2570 gestureEvent.position().x(), gestureEvent.position().y(),
2561 gestureEvent.inertial(), /* isBeginning */ 2571 gestureEvent.velocityX(), gestureEvent.velocityY(),
2562 false, /* isEnding */ false, /* fromUserInput */ true, 2572 false /* isBeginning */, gestureEvent.inertial(), false /* isEnd ing */,
2563 !gestureEvent.preventPropagation(), m_deltaConsumedForScrollSequ ence); 2573 !gestureEvent.preventPropagation(), true /* fromUserInput */,
2574 true /* isDirectManipulation */, 0 /* deltaGranularity*/,
2575 m_deltaConsumedForScrollSequence);
2564 if (m_previousGestureScrolledNode) { 2576 if (m_previousGestureScrolledNode) {
2565 // The ScrollState needs to know what the current 2577 // The ScrollState needs to know what the current
2566 // native scrolling element is, so that for an 2578 // native scrolling element is, so that for an
2567 // inertial scroll that shouldn't propagate, only the 2579 // inertial scroll that shouldn't propagate, only the
2568 // currently scrolling element responds. 2580 // currently scrolling element responds.
2569 ASSERT(m_previousGestureScrolledNode->isElementNode()); 2581 ASSERT(m_previousGestureScrolledNode->isElementNode());
2570 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get())); 2582 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get()));
2571 } 2583 }
2572 customizedScroll(*node, *scrollState); 2584 customizedScroll(*node, *scrollState);
2573 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement(); 2585 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement();
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
4169 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4181 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4170 { 4182 {
4171 #if OS(MACOSX) 4183 #if OS(MACOSX)
4172 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4184 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4173 #else 4185 #else
4174 return PlatformEvent::AltKey; 4186 return PlatformEvent::AltKey;
4175 #endif 4187 #endif
4176 } 4188 }
4177 4189
4178 } // namespace blink 4190 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698