OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 RefPtr<WebPagePopupImpl> pagePopup; | 494 RefPtr<WebPagePopupImpl> pagePopup; |
495 if (event.button == WebMouseEvent::Button::Left) { | 495 if (event.button == WebMouseEvent::Button::Left) { |
496 pagePopup = m_pagePopup; | 496 pagePopup = m_pagePopup; |
497 hidePopups(); | 497 hidePopups(); |
498 DCHECK(!m_pagePopup); | 498 DCHECK(!m_pagePopup); |
499 } | 499 } |
500 | 500 |
501 // Take capture on a mouse down on a plugin so we can send it mouse events. | 501 // Take capture on a mouse down on a plugin so we can send it mouse events. |
502 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 502 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
503 // capture because it will interfere with the scrollbar receiving events. | 503 // capture because it will interfere with the scrollbar receiving events. |
504 IntPoint point(event.x, event.y); | 504 IntPoint point(event.positionInWidget().x, event.positionInWidget().y); |
505 if (event.button == WebMouseEvent::Button::Left && | 505 if (event.button == WebMouseEvent::Button::Left && |
506 m_page->mainFrame()->isLocalFrame()) { | 506 m_page->mainFrame()->isLocalFrame()) { |
507 point = | 507 point = |
508 m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(point); | 508 m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(point); |
509 HitTestResult result( | 509 HitTestResult result( |
510 m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoint( | 510 m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoint( |
511 point)); | 511 point)); |
512 result.setToShadowHostIfInRestrictedShadowRoot(); | 512 result.setToShadowHostIfInRestrictedShadowRoot(); |
513 Node* hitNode = result.innerNodeOrImageMapImage(); | 513 Node* hitNode = result.innerNodeOrImageMapImage(); |
514 | 514 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 WebMouseWheelEvent syntheticWheel(WebInputEvent::MouseWheel, | 635 WebMouseWheelEvent syntheticWheel(WebInputEvent::MouseWheel, |
636 m_flingModifier, | 636 m_flingModifier, |
637 WTF::monotonicallyIncreasingTime()); | 637 WTF::monotonicallyIncreasingTime()); |
638 const float tickDivisor = WheelEvent::TickMultiplier; | 638 const float tickDivisor = WheelEvent::TickMultiplier; |
639 | 639 |
640 syntheticWheel.deltaX = delta.width; | 640 syntheticWheel.deltaX = delta.width; |
641 syntheticWheel.deltaY = delta.height; | 641 syntheticWheel.deltaY = delta.height; |
642 syntheticWheel.wheelTicksX = delta.width / tickDivisor; | 642 syntheticWheel.wheelTicksX = delta.width / tickDivisor; |
643 syntheticWheel.wheelTicksY = delta.height / tickDivisor; | 643 syntheticWheel.wheelTicksY = delta.height / tickDivisor; |
644 syntheticWheel.hasPreciseScrollingDeltas = true; | 644 syntheticWheel.hasPreciseScrollingDeltas = true; |
645 syntheticWheel.x = m_positionOnFlingStart.x; | 645 syntheticWheel.setPositionInWidget(m_positionOnFlingStart.x, |
646 syntheticWheel.y = m_positionOnFlingStart.y; | 646 m_positionOnFlingStart.y); |
647 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; | 647 syntheticWheel.setPositionInScreen(m_globalPositionOnFlingStart.x, |
648 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; | 648 m_globalPositionOnFlingStart.y); |
649 | 649 |
650 if (handleMouseWheel(*m_page->deprecatedLocalMainFrame(), syntheticWheel) != | 650 if (handleMouseWheel(*m_page->deprecatedLocalMainFrame(), syntheticWheel) != |
651 WebInputEventResult::NotHandled) | 651 WebInputEventResult::NotHandled) |
652 return true; | 652 return true; |
653 | 653 |
654 if (!enableTouchpadScrollLatching) { | 654 if (!enableTouchpadScrollLatching) { |
655 WebGestureEvent syntheticScrollBegin = createGestureScrollEventFromFling( | 655 WebGestureEvent syntheticScrollBegin = createGestureScrollEventFromFling( |
656 WebInputEvent::GestureScrollBegin, WebGestureDeviceTouchpad); | 656 WebInputEvent::GestureScrollBegin, WebGestureDeviceTouchpad); |
657 syntheticScrollBegin.data.scrollBegin.deltaXHint = delta.width; | 657 syntheticScrollBegin.data.scrollBegin.deltaXHint = delta.width; |
658 syntheticScrollBegin.data.scrollBegin.deltaYHint = delta.height; | 658 syntheticScrollBegin.data.scrollBegin.deltaYHint = delta.height; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 DCHECK_EQ(pinchEvent.type(), WebInputEvent::GesturePinchUpdate); | 1000 DCHECK_EQ(pinchEvent.type(), WebInputEvent::GesturePinchUpdate); |
1001 | 1001 |
1002 // For pinch gesture events, match typical trackpad behavior on Windows by | 1002 // For pinch gesture events, match typical trackpad behavior on Windows by |
1003 // sending fake wheel events with the ctrl modifier set when we see trackpad | 1003 // sending fake wheel events with the ctrl modifier set when we see trackpad |
1004 // pinch gestures. Ideally we'd someday get a platform 'pinch' event and | 1004 // pinch gestures. Ideally we'd someday get a platform 'pinch' event and |
1005 // send that instead. | 1005 // send that instead. |
1006 WebMouseWheelEvent wheelEvent( | 1006 WebMouseWheelEvent wheelEvent( |
1007 WebInputEvent::MouseWheel, | 1007 WebInputEvent::MouseWheel, |
1008 pinchEvent.modifiers() | WebInputEvent::ControlKey, | 1008 pinchEvent.modifiers() | WebInputEvent::ControlKey, |
1009 pinchEvent.timeStampSeconds()); | 1009 pinchEvent.timeStampSeconds()); |
1010 wheelEvent.x = pinchEvent.x; | 1010 wheelEvent.setPositionInWidget(pinchEvent.x, pinchEvent.y); |
1011 wheelEvent.y = pinchEvent.y; | 1011 wheelEvent.setPositionInScreen(pinchEvent.globalX, pinchEvent.globalY); |
1012 wheelEvent.globalX = pinchEvent.globalX; | |
1013 wheelEvent.globalY = pinchEvent.globalY; | |
1014 wheelEvent.deltaX = 0; | 1012 wheelEvent.deltaX = 0; |
1015 | 1013 |
1016 // The function to convert scales to deltaY values is designed to be | 1014 // The function to convert scales to deltaY values is designed to be |
1017 // compatible with websites existing use of wheel events, and with existing | 1015 // compatible with websites existing use of wheel events, and with existing |
1018 // Windows trackpad behavior. In particular, we want: | 1016 // Windows trackpad behavior. In particular, we want: |
1019 // - deltas should accumulate via addition: f(s1*s2)==f(s1)+f(s2) | 1017 // - deltas should accumulate via addition: f(s1*s2)==f(s1)+f(s2) |
1020 // - deltas should invert via negation: f(1/s) == -f(s) | 1018 // - deltas should invert via negation: f(1/s) == -f(s) |
1021 // - zoom in should be positive: f(s) > 0 iff s > 1 | 1019 // - zoom in should be positive: f(s) > 0 iff s > 1 |
1022 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100 | 1020 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100 |
1023 // - a formula that's relatively easy to use from JavaScript | 1021 // - a formula that's relatively easy to use from JavaScript |
(...skipping 3211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4235 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4233 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4236 return nullptr; | 4234 return nullptr; |
4237 return focusedFrame; | 4235 return focusedFrame; |
4238 } | 4236 } |
4239 | 4237 |
4240 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4238 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4241 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4239 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4242 } | 4240 } |
4243 | 4241 |
4244 } // namespace blink | 4242 } // namespace blink |
OLD | NEW |