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

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. 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 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after
2438 return toFrameView(widget)->frame().eventHandler().handleGestureScrollEvent( gestureEvent); 2438 return toFrameView(widget)->frame().eventHandler().handleGestureScrollEvent( gestureEvent);
2439 } 2439 }
2440 2440
2441 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent) 2441 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent)
2442 { 2442 {
2443 RefPtrWillBeRawPtr<Node> node = m_scrollGestureHandlingNode; 2443 RefPtrWillBeRawPtr<Node> node = m_scrollGestureHandlingNode;
2444 2444
2445 if (node) { 2445 if (node) {
2446 passScrollGestureEventToWidget(gestureEvent, node->layoutObject()); 2446 passScrollGestureEventToWidget(gestureEvent, node->layoutObject());
2447 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2447 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2448 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( 2448 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta());
2449 0, 0, 0, 0, 0, gestureEvent.inertial(), /* isBeginning */ 2449 scrollStateData->is_ending = true;
2450 false, /* isEnding */ true, /* fromUserInput */ true); 2450 scrollStateData->is_in_inertial_phase = gestureEvent.inertial();
2451 scrollStateData->from_user_input = true;
2452 scrollStateData->is_direct_manipulation = true;
2453 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence;
2454 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(sc rollStateData.release());
2451 customizedScroll(*node.get(), *scrollState); 2455 customizedScroll(*node.get(), *scrollState);
2452 } 2456 }
2453 } 2457 }
2454 2458
2455 clearGestureScrollState(); 2459 clearGestureScrollState();
2456 return WebInputEventResult::NotHandled; 2460 return WebInputEventResult::NotHandled;
2457 } 2461 }
2458 2462
2459 WebInputEventResult EventHandler::handleGestureScrollBegin(const PlatformGesture Event& gestureEvent) 2463 WebInputEventResult EventHandler::handleGestureScrollBegin(const PlatformGesture Event& gestureEvent)
2460 { 2464 {
(...skipping 14 matching lines...) Expand all
2475 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) 2479 if (RuntimeEnabledFeatures::scrollCustomizationEnabled())
2476 m_scrollGestureHandlingNode = m_frame->document()->documentElement() ; 2480 m_scrollGestureHandlingNode = m_frame->document()->documentElement() ;
2477 else 2481 else
2478 return WebInputEventResult::NotHandled; 2482 return WebInputEventResult::NotHandled;
2479 } 2483 }
2480 ASSERT(m_scrollGestureHandlingNode); 2484 ASSERT(m_scrollGestureHandlingNode);
2481 2485
2482 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la youtObject()); 2486 passScrollGestureEventToWidget(gestureEvent, m_scrollGestureHandlingNode->la youtObject());
2483 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) { 2487 if (RuntimeEnabledFeatures::scrollCustomizationEnabled()) {
2484 m_currentScrollChain.clear(); 2488 m_currentScrollChain.clear();
2485 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( 2489 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData() );
2486 0, 0, 0, 0, 0, /* inInertialPhase */ false, /* isBeginning */ 2490 scrollStateData->start_position_x = gestureEvent.position().x();
2487 true, /* isEnding */ false, /* fromUserInput */ true); 2491 scrollStateData->start_position_y = gestureEvent.position().y();
2492 scrollStateData->is_beginning = true;
2493 scrollStateData->from_user_input = true;
2494 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsumedFor ScrollSequence;
2495 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(scroll StateData.release());
2488 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState); 2496 customizedScroll(*m_scrollGestureHandlingNode.get(), *scrollState);
2489 } else { 2497 } else {
2490 if (m_frame->isMainFrame()) 2498 if (m_frame->isMainFrame())
2491 m_frame->host()->topControls().scrollBegin(); 2499 m_frame->host()->topControls().scrollBegin();
2492 } 2500 }
2493 return WebInputEventResult::HandledSystem; 2501 return WebInputEventResult::HandledSystem;
2494 } 2502 }
2495 2503
2496 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY) 2504 void EventHandler::resetOverscroll(bool didScrollX, bool didScrollY)
2497 { 2505 {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2554 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; 2562 m_previousGestureScrolledNode = m_scrollGestureHandlingNode;
2555 } 2563 }
2556 // FIXME: we should allow simultaneous scrolling of nested 2564 // FIXME: we should allow simultaneous scrolling of nested
2557 // iframes along perpendicular axes. See crbug.com/466991. 2565 // iframes along perpendicular axes. See crbug.com/466991.
2558 m_deltaConsumedForScrollSequence = true; 2566 m_deltaConsumedForScrollSequence = true;
2559 return result; 2567 return result;
2560 } 2568 }
2561 2569
2562 bool scrolled = false; 2570 bool scrolled = false;
2563 if (handleScrollCustomization) { 2571 if (handleScrollCustomization) {
2564 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create( 2572 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateDa ta());
2565 gestureEvent.deltaX(), gestureEvent.deltaY(), 2573 scrollStateData->delta_x = gestureEvent.deltaX();
2566 0, gestureEvent.velocityX(), gestureEvent.velocityY(), 2574 scrollStateData->delta_y = gestureEvent.deltaY();
2567 gestureEvent.inertial(), /* isBeginning */ 2575 scrollStateData->velocity_x = gestureEvent.velocityX();
2568 false, /* isEnding */ false, /* fromUserInput */ true, 2576 scrollStateData->velocity_y = gestureEvent.velocityY();
2569 !gestureEvent.preventPropagation(), m_deltaConsumedForScrollSequ ence); 2577 scrollStateData->should_propagate = !gestureEvent.preventPropagation ();
2578 scrollStateData->is_in_inertial_phase = gestureEvent.inertial();
2579 scrollStateData->from_user_input = true;
2580 scrollStateData->delta_consumed_for_scroll_sequence = m_deltaConsume dForScrollSequence;
2581 RefPtrWillBeRawPtr<ScrollState> scrollState = ScrollState::create(sc rollStateData.release());
2570 if (m_previousGestureScrolledNode) { 2582 if (m_previousGestureScrolledNode) {
2571 // The ScrollState needs to know what the current 2583 // The ScrollState needs to know what the current
2572 // native scrolling element is, so that for an 2584 // native scrolling element is, so that for an
2573 // inertial scroll that shouldn't propagate, only the 2585 // inertial scroll that shouldn't propagate, only the
2574 // currently scrolling element responds. 2586 // currently scrolling element responds.
2575 ASSERT(m_previousGestureScrolledNode->isElementNode()); 2587 ASSERT(m_previousGestureScrolledNode->isElementNode());
2576 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get())); 2588 scrollState->setCurrentNativeScrollingElement(toElement(m_previo usGestureScrolledNode.get()));
2577 } 2589 }
2578 customizedScroll(*node, *scrollState); 2590 customizedScroll(*node, *scrollState);
2579 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement(); 2591 m_previousGestureScrolledNode = scrollState->currentNativeScrollingE lement();
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
4175 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4187 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4176 { 4188 {
4177 #if OS(MACOSX) 4189 #if OS(MACOSX)
4178 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4190 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4179 #else 4191 #else
4180 return PlatformEvent::AltKey; 4192 return PlatformEvent::AltKey;
4181 #endif 4193 #endif
4182 } 4194 }
4183 4195
4184 } // namespace blink 4196 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/page/scrolling/ScrollState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698