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