| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 void setWindowRect(const IntRect& rect) override | 75 void setWindowRect(const IntRect& rect) override |
| 76 { | 76 { |
| 77 m_popup->setWindowRect(rect); | 77 m_popup->setWindowRect(rect); |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 explicit PagePopupChromeClient(WebPagePopupImpl* popup) | 81 explicit PagePopupChromeClient(WebPagePopupImpl* popup) |
| 82 : m_popup(popup) | 82 : m_popup(popup) |
| 83 { | 83 { |
| 84 ASSERT(m_popup->widgetClient()); | 84 DCHECK(m_popup->widgetClient()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void closeWindowSoon() override | 87 void closeWindowSoon() override |
| 88 { | 88 { |
| 89 m_popup->closePopup(); | 89 m_popup->closePopup(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 IntRect windowRect() override | 92 IntRect windowRect() override |
| 93 { | 93 { |
| 94 return m_popup->m_windowRectInScreen; | 94 return m_popup->m_windowRectInScreen; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 116 m_popup->widgetClient()->didInvalidateRect(paintRect); | 116 m_popup->widgetClient()->didInvalidateRect(paintRect); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void scheduleAnimation(Widget*) override | 119 void scheduleAnimation(Widget*) override |
| 120 { | 120 { |
| 121 // Calling scheduleAnimation on m_webView so WebTestProxy will call begi
nFrame. | 121 // Calling scheduleAnimation on m_webView so WebTestProxy will call begi
nFrame. |
| 122 if (LayoutTestSupport::isRunningLayoutTest()) | 122 if (LayoutTestSupport::isRunningLayoutTest()) |
| 123 m_popup->m_webView->scheduleAnimation(); | 123 m_popup->m_webView->scheduleAnimation(); |
| 124 | 124 |
| 125 if (m_popup->isAcceleratedCompositingActive()) { | 125 if (m_popup->isAcceleratedCompositingActive()) { |
| 126 ASSERT(m_popup->m_layerTreeView); | 126 DCHECK(m_popup->m_layerTreeView); |
| 127 m_popup->m_layerTreeView->setNeedsBeginFrame(); | 127 m_popup->m_layerTreeView->setNeedsBeginFrame(); |
| 128 return; | 128 return; |
| 129 } | 129 } |
| 130 m_popup->m_widgetClient->scheduleAnimation(); | 130 m_popup->m_widgetClient->scheduleAnimation(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void attachCompositorAnimationTimeline(CompositorAnimationTimeline* timeline
, LocalFrame*) override | 133 void attachCompositorAnimationTimeline(CompositorAnimationTimeline* timeline
, LocalFrame*) override |
| 134 { | 134 { |
| 135 if (m_popup->m_layerTreeView) | 135 if (m_popup->m_layerTreeView) |
| 136 m_popup->m_layerTreeView->attachCompositorAnimationTimeline(timeline
->animationTimeline()); | 136 m_popup->m_layerTreeView->attachCompositorAnimationTimeline(timeline
->animationTimeline()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // WebPagePopupImpl ------------------------------------------------------------
---- | 231 // WebPagePopupImpl ------------------------------------------------------------
---- |
| 232 | 232 |
| 233 WebPagePopupImpl::WebPagePopupImpl(WebWidgetClient* client) | 233 WebPagePopupImpl::WebPagePopupImpl(WebWidgetClient* client) |
| 234 : m_widgetClient(client) | 234 : m_widgetClient(client) |
| 235 , m_closing(false) | 235 , m_closing(false) |
| 236 , m_layerTreeView(0) | 236 , m_layerTreeView(0) |
| 237 , m_rootLayer(0) | 237 , m_rootLayer(0) |
| 238 , m_rootGraphicsLayer(0) | 238 , m_rootGraphicsLayer(0) |
| 239 , m_isAcceleratedCompositingActive(false) | 239 , m_isAcceleratedCompositingActive(false) |
| 240 { | 240 { |
| 241 ASSERT(client); | 241 DCHECK(client); |
| 242 } | 242 } |
| 243 | 243 |
| 244 WebPagePopupImpl::~WebPagePopupImpl() | 244 WebPagePopupImpl::~WebPagePopupImpl() |
| 245 { | 245 { |
| 246 ASSERT(!m_page); | 246 DCHECK(!m_page); |
| 247 } | 247 } |
| 248 | 248 |
| 249 bool WebPagePopupImpl::initialize(WebViewImpl* webView, PagePopupClient* popupCl
ient) | 249 bool WebPagePopupImpl::initialize(WebViewImpl* webView, PagePopupClient* popupCl
ient) |
| 250 { | 250 { |
| 251 ASSERT(webView); | 251 DCHECK(webView); |
| 252 ASSERT(popupClient); | 252 DCHECK(popupClient); |
| 253 m_webView = webView; | 253 m_webView = webView; |
| 254 m_popupClient = popupClient; | 254 m_popupClient = popupClient; |
| 255 | 255 |
| 256 if (!m_widgetClient || !initializePage()) | 256 if (!m_widgetClient || !initializePage()) |
| 257 return false; | 257 return false; |
| 258 m_widgetClient->show(WebNavigationPolicy()); | 258 m_widgetClient->show(WebNavigationPolicy()); |
| 259 setFocus(true); | 259 setFocus(true); |
| 260 | 260 |
| 261 return true; | 261 return true; |
| 262 } | 262 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 281 RawPtr<LocalFrame> frame = LocalFrame::create(emptyFrameLoaderClient.get(),
&m_page->frameHost(), 0); | 281 RawPtr<LocalFrame> frame = LocalFrame::create(emptyFrameLoaderClient.get(),
&m_page->frameHost(), 0); |
| 282 frame->setPagePopupOwner(m_popupClient->ownerElement()); | 282 frame->setPagePopupOwner(m_popupClient->ownerElement()); |
| 283 frame->setView(FrameView::create(frame.get())); | 283 frame->setView(FrameView::create(frame.get())); |
| 284 frame->init(); | 284 frame->init(); |
| 285 frame->view()->setParentVisible(true); | 285 frame->view()->setParentVisible(true); |
| 286 frame->view()->setSelfVisible(true); | 286 frame->view()->setSelfVisible(true); |
| 287 frame->view()->setTransparent(false); | 287 frame->view()->setTransparent(false); |
| 288 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing
AXObjectCache()) | 288 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing
AXObjectCache()) |
| 289 cache->childrenChanged(&m_popupClient->ownerElement()); | 289 cache->childrenChanged(&m_popupClient->ownerElement()); |
| 290 | 290 |
| 291 ASSERT(frame->localDOMWindow()); | 291 DCHECK(frame->localDOMWindow()); |
| 292 PagePopupSupplement::install(*frame, *this, m_popupClient); | 292 PagePopupSupplement::install(*frame, *this, m_popupClient); |
| 293 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f
rame->document()->existingAXObjectCache()); | 293 DCHECK_EQ(m_popupClient->ownerElement().document().existingAXObjectCache(),
frame->document()->existingAXObjectCache()); |
| 294 | 294 |
| 295 RefPtr<SharedBuffer> data = SharedBuffer::create(); | 295 RefPtr<SharedBuffer> data = SharedBuffer::create(); |
| 296 m_popupClient->writeDocument(data.get()); | 296 m_popupClient->writeDocument(data.get()); |
| 297 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t
ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); | 297 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t
ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); |
| 298 frame->setPageZoomFactor(m_popupClient->zoomFactor()); | 298 frame->setPageZoomFactor(m_popupClient->zoomFactor()); |
| 299 return true; | 299 return true; |
| 300 } | 300 } |
| 301 | 301 |
| 302 void WebPagePopupImpl::postMessage(const String& message) | 302 void WebPagePopupImpl::postMessage(const String& message) |
| 303 { | 303 { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 318 } | 318 } |
| 319 | 319 |
| 320 AXObject* WebPagePopupImpl::rootAXObject() | 320 AXObject* WebPagePopupImpl::rootAXObject() |
| 321 { | 321 { |
| 322 if (!m_page || !m_page->mainFrame()) | 322 if (!m_page || !m_page->mainFrame()) |
| 323 return 0; | 323 return 0; |
| 324 Document* document = toLocalFrame(m_page->mainFrame())->document(); | 324 Document* document = toLocalFrame(m_page->mainFrame())->document(); |
| 325 if (!document) | 325 if (!document) |
| 326 return 0; | 326 return 0; |
| 327 AXObjectCache* cache = document->axObjectCache(); | 327 AXObjectCache* cache = document->axObjectCache(); |
| 328 ASSERT(cache); | 328 DCHECK(cache); |
| 329 return toAXObjectCacheImpl(cache)->getOrCreate(document->layoutView()); | 329 return toAXObjectCacheImpl(cache)->getOrCreate(document->layoutView()); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void WebPagePopupImpl::setWindowRect(const IntRect& rectInScreen) | 332 void WebPagePopupImpl::setWindowRect(const IntRect& rectInScreen) |
| 333 { | 333 { |
| 334 m_windowRectInScreen = rectInScreen; | 334 m_windowRectInScreen = rectInScreen; |
| 335 widgetClient()->setWindowRect(m_windowRectInScreen); | 335 widgetClient()->setWindowRect(m_windowRectInScreen); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void WebPagePopupImpl::setRootGraphicsLayer(GraphicsLayer* layer) | 338 void WebPagePopupImpl::setRootGraphicsLayer(GraphicsLayer* layer) |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 return m_page->deprecatedLocalMainFrame()->localDOMWindow(); | 528 return m_page->deprecatedLocalMainFrame()->localDOMWindow(); |
| 529 } | 529 } |
| 530 | 530 |
| 531 void WebPagePopupImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* callb
ack) | 531 void WebPagePopupImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* callb
ack) |
| 532 { | 532 { |
| 533 m_layerTreeView->layoutAndPaintAsync(callback); | 533 m_layerTreeView->layoutAndPaintAsync(callback); |
| 534 } | 534 } |
| 535 | 535 |
| 536 void WebPagePopupImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCal
lback* callback) | 536 void WebPagePopupImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCal
lback* callback) |
| 537 { | 537 { |
| 538 ASSERT(isAcceleratedCompositingActive()); | 538 DCHECK(isAcceleratedCompositingActive()); |
| 539 m_layerTreeView->compositeAndReadbackAsync(callback); | 539 m_layerTreeView->compositeAndReadbackAsync(callback); |
| 540 } | 540 } |
| 541 | 541 |
| 542 WebPoint WebPagePopupImpl::positionRelativeToOwner() | 542 WebPoint WebPagePopupImpl::positionRelativeToOwner() |
| 543 { | 543 { |
| 544 WebRect windowRect = m_webView->client()->rootWindowRect(); | 544 WebRect windowRect = m_webView->client()->rootWindowRect(); |
| 545 return WebPoint(m_windowRectInScreen.x - windowRect.x, m_windowRectInScreen.
y - windowRect.y); | 545 return WebPoint(m_windowRectInScreen.x - windowRect.x, m_windowRectInScreen.
y - windowRect.y); |
| 546 } | 546 } |
| 547 | 547 |
| 548 void WebPagePopupImpl::cancel() | 548 void WebPagePopupImpl::cancel() |
| (...skipping 11 matching lines...) Expand all Loading... |
| 560 // A WebPagePopupImpl instance usually has two references. | 560 // A WebPagePopupImpl instance usually has two references. |
| 561 // - One owned by the instance itself. It represents the visible widget. | 561 // - One owned by the instance itself. It represents the visible widget. |
| 562 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the | 562 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the |
| 563 // WebPagePopupImpl to close. | 563 // WebPagePopupImpl to close. |
| 564 // We need them because the closing operation is asynchronous and the widget | 564 // We need them because the closing operation is asynchronous and the widget |
| 565 // can be closed while the WebViewImpl is unaware of it. | 565 // can be closed while the WebViewImpl is unaware of it. |
| 566 return adoptRef(new WebPagePopupImpl(client)).leakRef(); | 566 return adoptRef(new WebPagePopupImpl(client)).leakRef(); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace blink | 569 } // namespace blink |
| OLD | NEW |