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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Fixed compile failures. Created 3 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) 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
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.position.x, event.position.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
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.position.x = m_positionOnFlingStart.x;
641 syntheticWheel.y = m_positionOnFlingStart.y; 641 syntheticWheel.position.y = m_positionOnFlingStart.y;
642 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; 642 syntheticWheel.screenPosition.x = m_globalPositionOnFlingStart.x;
643 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; 643 syntheticWheel.screenPosition.y = 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
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.position.x = pinchEvent.x;
947 wheelEvent.y = pinchEvent.y; 947 wheelEvent.position.y = pinchEvent.y;
948 wheelEvent.globalX = pinchEvent.globalX; 948 wheelEvent.screenPosition.x = pinchEvent.globalX;
949 wheelEvent.globalY = pinchEvent.globalY; 949 wheelEvent.screenPosition.y = pinchEvent.globalY;
950 wheelEvent.deltaX = 0; 950 wheelEvent.deltaX = 0;
951 951
952 // The function to convert scales to deltaY values is designed to be 952 // The function to convert scales to deltaY values is designed to be
953 // compatible with websites existing use of wheel events, and with existing 953 // compatible with websites existing use of wheel events, and with existing
954 // Windows trackpad behavior. In particular, we want: 954 // Windows trackpad behavior. In particular, we want:
955 // - deltas should accumulate via addition: f(s1*s2)==f(s1)+f(s2) 955 // - deltas should accumulate via addition: f(s1*s2)==f(s1)+f(s2)
956 // - deltas should invert via negation: f(1/s) == -f(s) 956 // - deltas should invert via negation: f(1/s) == -f(s)
957 // - zoom in should be positive: f(s) > 0 iff s > 1 957 // - zoom in should be positive: f(s) > 0 iff s > 1
958 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100 958 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100
959 // - a formula that's relatively easy to use from JavaScript 959 // - a formula that's relatively easy to use from JavaScript
(...skipping 3217 matching lines...) Expand 10 before | Expand all | Expand 10 after
4177 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4177 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4178 return nullptr; 4178 return nullptr;
4179 return focusedFrame; 4179 return focusedFrame;
4180 } 4180 }
4181 4181
4182 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4182 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4183 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4183 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4184 } 4184 }
4185 4185
4186 } // namespace blink 4186 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698