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/web/WebPagePopupImpl.cpp

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased + fixed a Mac crack. 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 cancel(); 470 cancel();
471 return WebInputEventResult::NotHandled; 471 return WebInputEventResult::NotHandled;
472 } 472 }
473 LocalFrame& frame = *toLocalFrame(m_page->mainFrame()); 473 LocalFrame& frame = *toLocalFrame(m_page->mainFrame());
474 WebGestureEvent scaledEvent = TransformWebGestureEvent(frame.view(), event); 474 WebGestureEvent scaledEvent = TransformWebGestureEvent(frame.view(), event);
475 return frame.eventHandler().handleGestureEvent(scaledEvent); 475 return frame.eventHandler().handleGestureEvent(scaledEvent);
476 } 476 }
477 477
478 void WebPagePopupImpl::handleMouseDown(LocalFrame& mainFrame, 478 void WebPagePopupImpl::handleMouseDown(LocalFrame& mainFrame,
479 const WebMouseEvent& event) { 479 const WebMouseEvent& event) {
480 if (isViewportPointInWindow(event.x, event.y)) 480 if (isViewportPointInWindow(event.positionInWidget().x,
481 event.positionInWidget().y))
481 PageWidgetEventHandler::handleMouseDown(mainFrame, event); 482 PageWidgetEventHandler::handleMouseDown(mainFrame, event);
482 else 483 else
483 cancel(); 484 cancel();
484 } 485 }
485 486
486 WebInputEventResult WebPagePopupImpl::handleMouseWheel( 487 WebInputEventResult WebPagePopupImpl::handleMouseWheel(
487 LocalFrame& mainFrame, 488 LocalFrame& mainFrame,
488 const WebMouseWheelEvent& event) { 489 const WebMouseWheelEvent& event) {
489 if (isViewportPointInWindow(event.x, event.y)) 490 if (isViewportPointInWindow(event.positionInWidget().x,
491 event.positionInWidget().y))
490 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); 492 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event);
491 cancel(); 493 cancel();
492 return WebInputEventResult::NotHandled; 494 return WebInputEventResult::NotHandled;
493 } 495 }
494 496
495 bool WebPagePopupImpl::isViewportPointInWindow(int x, int y) { 497 bool WebPagePopupImpl::isViewportPointInWindow(int x, int y) {
496 WebRect pointInWindow(x, y, 0, 0); 498 WebRect pointInWindow(x, y, 0, 0);
497 widgetClient()->convertViewportToWindow(&pointInWindow); 499 widgetClient()->convertViewportToWindow(&pointInWindow);
498 WebRect windowRect = windowRectInScreen(); 500 WebRect windowRect = windowRectInScreen();
499 return IntRect(0, 0, windowRect.width, windowRect.height) 501 return IntRect(0, 0, windowRect.width, windowRect.height)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // A WebPagePopupImpl instance usually has two references. 592 // A WebPagePopupImpl instance usually has two references.
591 // - One owned by the instance itself. It represents the visible widget. 593 // - One owned by the instance itself. It represents the visible widget.
592 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 594 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
593 // WebPagePopupImpl to close. 595 // WebPagePopupImpl to close.
594 // We need them because the closing operation is asynchronous and the widget 596 // We need them because the closing operation is asynchronous and the widget
595 // can be closed while the WebViewImpl is unaware of it. 597 // can be closed while the WebViewImpl is unaware of it.
596 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 598 return adoptRef(new WebPagePopupImpl(client)).leakRef();
597 } 599 }
598 600
599 } // namespace blink 601 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698