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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 RefPtr<WebPagePopupImpl> pagePopup; | 489 RefPtr<WebPagePopupImpl> pagePopup; |
490 if (event.button == WebMouseEvent::Button::Left) { | 490 if (event.button == WebMouseEvent::Button::Left) { |
491 pagePopup = m_pagePopup; | 491 pagePopup = m_pagePopup; |
492 hidePopups(); | 492 hidePopups(); |
493 DCHECK(!m_pagePopup); | 493 DCHECK(!m_pagePopup); |
494 } | 494 } |
495 | 495 |
496 // Take capture on a mouse down on a plugin so we can send it mouse events. | 496 // Take capture on a mouse down on a plugin so we can send it mouse events. |
497 // If the hit node is a plugin but a scrollbar is over it don't start mouse | 497 // If the hit node is a plugin but a scrollbar is over it don't start mouse |
498 // capture because it will interfere with the scrollbar receiving events. | 498 // capture because it will interfere with the scrollbar receiving events. |
499 IntPoint point(event.x, event.y); | 499 IntPoint point(event.positionInWidget().x, event.positionInWidget().y); |
500 if (event.button == WebMouseEvent::Button::Left && | 500 if (event.button == WebMouseEvent::Button::Left && |
501 m_page->mainFrame()->isLocalFrame()) { | 501 m_page->mainFrame()->isLocalFrame()) { |
502 point = | 502 point = |
503 m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(point); | 503 m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents(point); |
504 HitTestResult result( | 504 HitTestResult result( |
505 m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoint( | 505 m_page->deprecatedLocalMainFrame()->eventHandler().hitTestResultAtPoint( |
506 point)); | 506 point)); |
507 result.setToShadowHostIfInRestrictedShadowRoot(); | 507 result.setToShadowHostIfInRestrictedShadowRoot(); |
508 Node* hitNode = result.innerNodeOrImageMapImage(); | 508 Node* hitNode = result.innerNodeOrImageMapImage(); |
509 | 509 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 WebMouseWheelEvent syntheticWheel(WebInputEvent::MouseWheel, | 630 WebMouseWheelEvent syntheticWheel(WebInputEvent::MouseWheel, |
631 m_flingModifier, | 631 m_flingModifier, |
632 WTF::monotonicallyIncreasingTime()); | 632 WTF::monotonicallyIncreasingTime()); |
633 const float tickDivisor = WheelEvent::TickMultiplier; | 633 const float tickDivisor = WheelEvent::TickMultiplier; |
634 | 634 |
635 syntheticWheel.deltaX = delta.width; | 635 syntheticWheel.deltaX = delta.width; |
636 syntheticWheel.deltaY = delta.height; | 636 syntheticWheel.deltaY = delta.height; |
637 syntheticWheel.wheelTicksX = delta.width / tickDivisor; | 637 syntheticWheel.wheelTicksX = delta.width / tickDivisor; |
638 syntheticWheel.wheelTicksY = delta.height / tickDivisor; | 638 syntheticWheel.wheelTicksY = delta.height / tickDivisor; |
639 syntheticWheel.hasPreciseScrollingDeltas = true; | 639 syntheticWheel.hasPreciseScrollingDeltas = true; |
640 syntheticWheel.x = m_positionOnFlingStart.x; | 640 syntheticWheel.setPositionInWidget(m_positionOnFlingStart.x, |
641 syntheticWheel.y = m_positionOnFlingStart.y; | 641 m_positionOnFlingStart.y); |
642 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; | 642 syntheticWheel.setPositionInScreen(m_globalPositionOnFlingStart.x, |
643 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; | 643 m_globalPositionOnFlingStart.y); |
644 | 644 |
645 if (handleMouseWheel(*m_page->deprecatedLocalMainFrame(), syntheticWheel) != | 645 if (handleMouseWheel(*m_page->deprecatedLocalMainFrame(), syntheticWheel) != |
646 WebInputEventResult::NotHandled) | 646 WebInputEventResult::NotHandled) |
647 return true; | 647 return true; |
648 | 648 |
649 if (!enableTouchpadScrollLatching) { | 649 if (!enableTouchpadScrollLatching) { |
650 WebGestureEvent syntheticScrollBegin = createGestureScrollEventFromFling( | 650 WebGestureEvent syntheticScrollBegin = createGestureScrollEventFromFling( |
651 WebInputEvent::GestureScrollBegin, WebGestureDeviceTouchpad); | 651 WebInputEvent::GestureScrollBegin, WebGestureDeviceTouchpad); |
652 syntheticScrollBegin.data.scrollBegin.deltaXHint = delta.width; | 652 syntheticScrollBegin.data.scrollBegin.deltaXHint = delta.width; |
653 syntheticScrollBegin.data.scrollBegin.deltaYHint = delta.height; | 653 syntheticScrollBegin.data.scrollBegin.deltaYHint = delta.height; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 DCHECK_EQ(pinchEvent.type(), WebInputEvent::GesturePinchUpdate); | 936 DCHECK_EQ(pinchEvent.type(), WebInputEvent::GesturePinchUpdate); |
937 | 937 |
938 // For pinch gesture events, match typical trackpad behavior on Windows by | 938 // For pinch gesture events, match typical trackpad behavior on Windows by |
939 // sending fake wheel events with the ctrl modifier set when we see trackpad | 939 // sending fake wheel events with the ctrl modifier set when we see trackpad |
940 // pinch gestures. Ideally we'd someday get a platform 'pinch' event and | 940 // pinch gestures. Ideally we'd someday get a platform 'pinch' event and |
941 // send that instead. | 941 // send that instead. |
942 WebMouseWheelEvent wheelEvent( | 942 WebMouseWheelEvent wheelEvent( |
943 WebInputEvent::MouseWheel, | 943 WebInputEvent::MouseWheel, |
944 pinchEvent.modifiers() | WebInputEvent::ControlKey, | 944 pinchEvent.modifiers() | WebInputEvent::ControlKey, |
945 pinchEvent.timeStampSeconds()); | 945 pinchEvent.timeStampSeconds()); |
946 wheelEvent.x = pinchEvent.x; | 946 wheelEvent.setPositionInWidget(pinchEvent.x, pinchEvent.y); |
947 wheelEvent.y = pinchEvent.y; | 947 wheelEvent.setPositionInScreen(pinchEvent.globalX, pinchEvent.globalY); |
948 wheelEvent.globalX = pinchEvent.globalX; | |
949 wheelEvent.globalY = pinchEvent.globalY; | |
950 wheelEvent.deltaX = 0; | 948 wheelEvent.deltaX = 0; |
951 | 949 |
952 // The function to convert scales to deltaY values is designed to be | 950 // The function to convert scales to deltaY values is designed to be |
953 // compatible with websites existing use of wheel events, and with existing | 951 // compatible with websites existing use of wheel events, and with existing |
954 // Windows trackpad behavior. In particular, we want: | 952 // Windows trackpad behavior. In particular, we want: |
955 // - deltas should accumulate via addition: f(s1*s2)==f(s1)+f(s2) | 953 // - deltas should accumulate via addition: f(s1*s2)==f(s1)+f(s2) |
956 // - deltas should invert via negation: f(1/s) == -f(s) | 954 // - deltas should invert via negation: f(1/s) == -f(s) |
957 // - zoom in should be positive: f(s) > 0 iff s > 1 | 955 // - zoom in should be positive: f(s) > 0 iff s > 1 |
958 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100 | 956 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100 |
959 // - a formula that's relatively easy to use from JavaScript | 957 // - a formula that's relatively easy to use from JavaScript |
(...skipping 3218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4178 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4176 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4179 return nullptr; | 4177 return nullptr; |
4180 return focusedFrame; | 4178 return focusedFrame; |
4181 } | 4179 } |
4182 | 4180 |
4183 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4181 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4184 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4182 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4185 } | 4183 } |
4186 | 4184 |
4187 } // namespace blink | 4185 } // namespace blink |
OLD | NEW |