| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
| 37 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
| 38 #include "core/loader/EmptyClients.h" | 38 #include "core/loader/EmptyClients.h" |
| 39 #include "core/loader/FrameLoadRequest.h" | 39 #include "core/loader/FrameLoadRequest.h" |
| 40 #include "core/page/Chrome.h" | 40 #include "core/page/Chrome.h" |
| 41 #include "core/page/DOMWindowPagePopup.h" | 41 #include "core/page/DOMWindowPagePopup.h" |
| 42 #include "core/page/EventHandler.h" | 42 #include "core/page/EventHandler.h" |
| 43 #include "core/page/FocusController.h" | 43 #include "core/page/FocusController.h" |
| 44 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
| 45 #include "core/page/PagePopupClient.h" | 45 #include "core/page/PagePopupClient.h" |
| 46 #include "platform/LayoutTestSupport.h" |
| 46 #include "platform/TraceEvent.h" | 47 #include "platform/TraceEvent.h" |
| 47 #include "platform/heap/Handle.h" | 48 #include "platform/heap/Handle.h" |
| 48 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" | 49 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" |
| 49 #include "public/platform/WebCursorInfo.h" | 50 #include "public/platform/WebCursorInfo.h" |
| 50 #include "public/web/WebAXObject.h" | 51 #include "public/web/WebAXObject.h" |
| 51 #include "public/web/WebFrameClient.h" | 52 #include "public/web/WebFrameClient.h" |
| 52 #include "public/web/WebViewClient.h" | 53 #include "public/web/WebViewClient.h" |
| 53 #include "public/web/WebWidgetClient.h" | 54 #include "public/web/WebWidgetClient.h" |
| 54 #include "web/WebInputEventConversion.h" | 55 #include "web/WebInputEventConversion.h" |
| 55 #include "web/WebLocalFrameImpl.h" | 56 #include "web/WebLocalFrameImpl.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 m_popup->widgetClient()->didInvalidateRect(paintRect); | 108 m_popup->widgetClient()->didInvalidateRect(paintRect); |
| 108 } | 109 } |
| 109 | 110 |
| 110 virtual void invalidateContentsForSlowScroll(const IntRect& updateRect) OVER
RIDE | 111 virtual void invalidateContentsForSlowScroll(const IntRect& updateRect) OVER
RIDE |
| 111 { | 112 { |
| 112 invalidateContentsAndRootView(updateRect); | 113 invalidateContentsAndRootView(updateRect); |
| 113 } | 114 } |
| 114 | 115 |
| 115 virtual void scheduleAnimation() OVERRIDE | 116 virtual void scheduleAnimation() OVERRIDE |
| 116 { | 117 { |
| 118 // Calling scheduleAnimation on m_webView so WebTestProxy will call begi
nFrame. |
| 119 if (LayoutTestSupport::isRunningLayoutTest()) |
| 120 m_popup->m_webView->scheduleAnimation(); |
| 121 |
| 117 if (m_popup->isAcceleratedCompositingActive()) { | 122 if (m_popup->isAcceleratedCompositingActive()) { |
| 118 ASSERT(m_popup->m_layerTreeView); | 123 ASSERT(m_popup->m_layerTreeView); |
| 119 m_popup->m_layerTreeView->setNeedsAnimate(); | 124 m_popup->m_layerTreeView->setNeedsAnimate(); |
| 120 return; | 125 return; |
| 121 } | 126 } |
| 122 m_popup->widgetClient()->scheduleAnimation(); | 127 m_popup->m_widgetClient->scheduleAnimation(); |
| 123 } | 128 } |
| 124 | 129 |
| 125 virtual WebScreenInfo screenInfo() const OVERRIDE | 130 virtual WebScreenInfo screenInfo() const OVERRIDE |
| 126 { | 131 { |
| 127 return m_popup->m_webView->client() ? m_popup->m_webView->client()->scre
enInfo() : WebScreenInfo(); | 132 return m_popup->m_webView->client() ? m_popup->m_webView->client()->scre
enInfo() : WebScreenInfo(); |
| 128 } | 133 } |
| 129 | 134 |
| 130 virtual void* webView() const OVERRIDE | 135 virtual void* webView() const OVERRIDE |
| 131 { | 136 { |
| 132 return m_popup->m_webView; | 137 return m_popup->m_webView; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 424 |
| 420 // m_widgetClient might be 0 because this widget might be already closed. | 425 // m_widgetClient might be 0 because this widget might be already closed. |
| 421 if (m_widgetClient) { | 426 if (m_widgetClient) { |
| 422 // closeWidgetSoon() will call this->close() later. | 427 // closeWidgetSoon() will call this->close() later. |
| 423 m_widgetClient->closeWidgetSoon(); | 428 m_widgetClient->closeWidgetSoon(); |
| 424 } | 429 } |
| 425 | 430 |
| 426 m_popupClient->didClosePopup(); | 431 m_popupClient->didClosePopup(); |
| 427 } | 432 } |
| 428 | 433 |
| 434 LocalDOMWindow* WebPagePopupImpl::window() |
| 435 { |
| 436 return m_page->mainFrame()->domWindow(); |
| 437 } |
| 438 |
| 429 void WebPagePopupImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCal
lback* callback) | 439 void WebPagePopupImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCal
lback* callback) |
| 430 { | 440 { |
| 431 ASSERT(isAcceleratedCompositingActive()); | 441 ASSERT(isAcceleratedCompositingActive()); |
| 432 m_layerTreeView->compositeAndReadbackAsync(callback); | 442 m_layerTreeView->compositeAndReadbackAsync(callback); |
| 433 } | 443 } |
| 434 | 444 |
| 435 WebPoint WebPagePopupImpl::positionRelativeToOwner() | 445 WebPoint WebPagePopupImpl::positionRelativeToOwner() |
| 436 { | 446 { |
| 437 WebRect windowRect = m_webView->client()->rootWindowRect(); | 447 WebRect windowRect = m_webView->client()->rootWindowRect(); |
| 438 return WebPoint(m_windowRectInScreen.x - windowRect.x, m_windowRectInScreen.
y - windowRect.y); | 448 return WebPoint(m_windowRectInScreen.x - windowRect.x, m_windowRectInScreen.
y - windowRect.y); |
| 439 } | 449 } |
| 440 | 450 |
| 441 // WebPagePopup ---------------------------------------------------------------- | 451 // WebPagePopup ---------------------------------------------------------------- |
| 442 | 452 |
| 443 WebPagePopup* WebPagePopup::create(WebWidgetClient* client) | 453 WebPagePopup* WebPagePopup::create(WebWidgetClient* client) |
| 444 { | 454 { |
| 445 if (!client) | 455 if (!client) |
| 446 CRASH(); | 456 CRASH(); |
| 447 // A WebPagePopupImpl instance usually has two references. | 457 // A WebPagePopupImpl instance usually has two references. |
| 448 // - One owned by the instance itself. It represents the visible widget. | 458 // - One owned by the instance itself. It represents the visible widget. |
| 449 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 459 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
| 450 // WebPagePopupImpl to close. | 460 // WebPagePopupImpl to close. |
| 451 // We need them because the closing operation is asynchronous and the widget | 461 // We need them because the closing operation is asynchronous and the widget |
| 452 // can be closed while the WebViewImpl is unaware of it. | 462 // can be closed while the WebViewImpl is unaware of it. |
| 453 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 463 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
| 454 } | 464 } |
| 455 | 465 |
| 456 } // namespace blink | 466 } // namespace blink |
| OLD | NEW |