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

Side by Side Diff: Source/web/WebPagePopupImpl.cpp

Issue 513723003: Add pixel readback to page popup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
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 26 matching lines...) Expand all
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/TraceEvent.h" 46 #include "platform/TraceEvent.h"
47 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h"
47 #include "public/platform/WebCursorInfo.h" 48 #include "public/platform/WebCursorInfo.h"
48 #include "public/web/WebViewClient.h" 49 #include "public/web/WebViewClient.h"
49 #include "public/web/WebWidgetClient.h" 50 #include "public/web/WebWidgetClient.h"
50 #include "web/WebInputEventConversion.h" 51 #include "web/WebInputEventConversion.h"
51 #include "web/WebSettingsImpl.h" 52 #include "web/WebSettingsImpl.h"
52 #include "web/WebViewImpl.h" 53 #include "web/WebViewImpl.h"
53 54
54 namespace blink { 55 namespace blink {
55 56
56 class PagePopupChromeClient : public EmptyChromeClient { 57 class PagePopupChromeClient : public EmptyChromeClient {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 386
386 // m_widgetClient might be 0 because this widget might be already closed. 387 // m_widgetClient might be 0 because this widget might be already closed.
387 if (m_widgetClient) { 388 if (m_widgetClient) {
388 // closeWidgetSoon() will call this->close() later. 389 // closeWidgetSoon() will call this->close() later.
389 m_widgetClient->closeWidgetSoon(); 390 m_widgetClient->closeWidgetSoon();
390 } 391 }
391 392
392 m_popupClient->didClosePopup(); 393 m_popupClient->didClosePopup();
393 } 394 }
394 395
396 void WebPagePopupImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCal lback* callback)
397 {
398 ASSERT(isAcceleratedCompositingActive());
399 callback->setIsPopup(true);
400 callback->setReadbackPosition(WebPoint(m_windowRectInScreen.x, m_windowRectI nScreen.y));
401 m_layerTreeView->compositeAndReadbackAsync(callback);
402 }
403
404 LocalDOMWindow* WebPagePopupImpl::window()
405 {
406 return m_page->mainFrame()->domWindow();
407 }
408
409 WebPoint WebPagePopupImpl::relativePosition()
410 {
411 WebRect windowRect = m_webView->client()->rootWindowRect();
412 return WebPoint(m_windowRectInScreen.x - windowRect.x, m_windowRectInScreen. y - windowRect.y);
413 }
414
395 // WebPagePopup ---------------------------------------------------------------- 415 // WebPagePopup ----------------------------------------------------------------
396 416
397 WebPagePopup* WebPagePopup::create(WebWidgetClient* client) 417 WebPagePopup* WebPagePopup::create(WebWidgetClient* client)
398 { 418 {
399 if (!client) 419 if (!client)
400 CRASH(); 420 CRASH();
401 // A WebPagePopupImpl instance usually has two references. 421 // A WebPagePopupImpl instance usually has two references.
402 // - One owned by the instance itself. It represents the visible widget. 422 // - One owned by the instance itself. It represents the visible widget.
403 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 423 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
404 // WebPagePopupImpl to close. 424 // WebPagePopupImpl to close.
405 // We need them because the closing operation is asynchronous and the widget 425 // We need them because the closing operation is asynchronous and the widget
406 // can be closed while the WebViewImpl is unaware of it. 426 // can be closed while the WebViewImpl is unaware of it.
407 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 427 return adoptRef(new WebPagePopupImpl(client)).leakRef();
408 } 428 }
409 429
410 } // namespace blink 430 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698