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

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

Issue 1087743002: Support multiple displays for PagePopup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 WTF_MAKE_NONCOPYABLE(PagePopupChromeClient); 70 WTF_MAKE_NONCOPYABLE(PagePopupChromeClient);
71 WTF_MAKE_FAST_ALLOCATED(PagePopupChromeClient); 71 WTF_MAKE_FAST_ALLOCATED(PagePopupChromeClient);
72 72
73 public: 73 public:
74 explicit PagePopupChromeClient(WebPagePopupImpl* popup) 74 explicit PagePopupChromeClient(WebPagePopupImpl* popup)
75 : m_popup(popup) 75 : m_popup(popup)
76 { 76 {
77 ASSERT(m_popup->widgetClient()); 77 ASSERT(m_popup->widgetClient());
78 } 78 }
79 79
80 virtual void setWindowRect(const IntRect& rect) override
81 {
82 m_popup->m_windowRectInScreen = rect;
83 m_popup->widgetClient()->setWindowRect(m_popup->m_windowRectInScreen);
84 }
85
80 private: 86 private:
81 virtual void closeWindowSoon() override 87 virtual void closeWindowSoon() override
82 { 88 {
83 m_popup->closePopup(); 89 m_popup->closePopup();
84 } 90 }
85 91
86 virtual IntRect windowRect() override 92 virtual IntRect windowRect() override
87 { 93 {
88 return IntRect(m_popup->m_windowRectInScreen.x, m_popup->m_windowRectInS creen.y, m_popup->m_windowRectInScreen.width, m_popup->m_windowRectInScreen.heig ht); 94 return IntRect(m_popup->m_windowRectInScreen.x, m_popup->m_windowRectInS creen.y, m_popup->m_windowRectInScreen.width, m_popup->m_windowRectInScreen.heig ht);
89 } 95 }
90 96
91 virtual void setWindowRect(const IntRect& rect) override
92 {
93 m_popup->m_windowRectInScreen = rect;
94 m_popup->widgetClient()->setWindowRect(m_popup->m_windowRectInScreen);
95 }
96
97 virtual IntRect viewportToScreen(const IntRect& rect) const override 97 virtual IntRect viewportToScreen(const IntRect& rect) const override
98 { 98 {
99 IntRect rectInScreen(rect); 99 IntRect rectInScreen(rect);
100 rectInScreen.move(m_popup->m_windowRectInScreen.x, m_popup->m_windowRect InScreen.y); 100 rectInScreen.move(m_popup->m_windowRectInScreen.x, m_popup->m_windowRect InScreen.y);
101 return rectInScreen; 101 return rectInScreen;
102 } 102 }
103 103
104 virtual void addMessageToConsole(LocalFrame*, MessageSource, MessageLevel, c onst String& message, unsigned lineNumber, const String&, const String&) overrid e 104 virtual void addMessageToConsole(LocalFrame*, MessageSource, MessageLevel, c onst String& message, unsigned lineNumber, const String&, const String&) overrid e
105 { 105 {
106 #ifndef NDEBUG 106 #ifndef NDEBUG
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(emptyFrameLoaderCl ient, &m_page->frameHost(), 0); 252 RefPtrWillBeRawPtr<LocalFrame> frame = LocalFrame::create(emptyFrameLoaderCl ient, &m_page->frameHost(), 0);
253 frame->setPagePopupOwner(m_popupClient->ownerElement()); 253 frame->setPagePopupOwner(m_popupClient->ownerElement());
254 frame->setView(FrameView::create(frame.get())); 254 frame->setView(FrameView::create(frame.get()));
255 frame->init(); 255 frame->init();
256 frame->view()->resize(m_popupClient->contentSize()); 256 frame->view()->resize(m_popupClient->contentSize());
257 frame->view()->setTransparent(false); 257 frame->view()->setTransparent(false);
258 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache()) 258 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache())
259 cache->childrenChanged(&m_popupClient->ownerElement()); 259 cache->childrenChanged(&m_popupClient->ownerElement());
260 260
261 ASSERT(frame->localDOMWindow()); 261 ASSERT(frame->localDOMWindow());
262 DOMWindowPagePopup::install(*frame->localDOMWindow(), m_popupClient); 262 DOMWindowPagePopup::install(*frame->localDOMWindow(), this, m_popupClient);
263 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache()); 263 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache());
264 264
265 RefPtr<SharedBuffer> data = SharedBuffer::create(); 265 RefPtr<SharedBuffer> data = SharedBuffer::create();
266 m_popupClient->writeDocument(data.get()); 266 m_popupClient->writeDocument(data.get());
267 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); 267 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad)));
268 268
269 return true; 269 return true;
270 } 270 }
271 271
272 void WebPagePopupImpl::postMessage(const String& message) 272 void WebPagePopupImpl::postMessage(const String& message)
(...skipping 19 matching lines...) Expand all
292 if (!m_page || !m_page->mainFrame()) 292 if (!m_page || !m_page->mainFrame())
293 return 0; 293 return 0;
294 Document* document = toLocalFrame(m_page->mainFrame())->document(); 294 Document* document = toLocalFrame(m_page->mainFrame())->document();
295 if (!document) 295 if (!document)
296 return 0; 296 return 0;
297 AXObjectCache* cache = document->axObjectCache(); 297 AXObjectCache* cache = document->axObjectCache();
298 ASSERT(cache); 298 ASSERT(cache);
299 return toAXObjectCacheImpl(cache)->getOrCreate(document->layoutView()); 299 return toAXObjectCacheImpl(cache)->getOrCreate(document->layoutView());
300 } 300 }
301 301
302 void WebPagePopupImpl::setWindowRect(const IntRect& rect)
303 {
304 m_chromeClient->setWindowRect(rect);
305 }
306
302 void WebPagePopupImpl::setRootGraphicsLayer(GraphicsLayer* layer) 307 void WebPagePopupImpl::setRootGraphicsLayer(GraphicsLayer* layer)
303 { 308 {
304 m_rootGraphicsLayer = layer; 309 m_rootGraphicsLayer = layer;
305 m_rootLayer = layer ? layer->platformLayer() : 0; 310 m_rootLayer = layer ? layer->platformLayer() : 0;
306 311
307 setIsAcceleratedCompositingActive(layer); 312 setIsAcceleratedCompositingActive(layer);
308 if (m_layerTreeView) { 313 if (m_layerTreeView) {
309 if (m_rootLayer) { 314 if (m_rootLayer) {
310 m_layerTreeView->setRootLayer(*m_rootLayer); 315 m_layerTreeView->setRootLayer(*m_rootLayer);
311 } else { 316 } else {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // A WebPagePopupImpl instance usually has two references. 511 // A WebPagePopupImpl instance usually has two references.
507 // - One owned by the instance itself. It represents the visible widget. 512 // - One owned by the instance itself. It represents the visible widget.
508 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 513 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
509 // WebPagePopupImpl to close. 514 // WebPagePopupImpl to close.
510 // We need them because the closing operation is asynchronous and the widget 515 // We need them because the closing operation is asynchronous and the widget
511 // can be closed while the WebViewImpl is unaware of it. 516 // can be closed while the WebViewImpl is unaware of it.
512 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 517 return adoptRef(new WebPagePopupImpl(client)).leakRef();
513 } 518 }
514 519
515 } // namespace blink 520 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698