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

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

Issue 1685003002: Plumb the correct owner document through DocumentInit::m_owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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
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 23 matching lines...) Expand all
34 #include "core/events/MessageEvent.h" 34 #include "core/events/MessageEvent.h"
35 #include "core/frame/FrameHost.h" 35 #include "core/frame/FrameHost.h"
36 #include "core/frame/FrameView.h" 36 #include "core/frame/FrameView.h"
37 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
38 #include "core/frame/Settings.h" 38 #include "core/frame/Settings.h"
39 #include "core/frame/VisualViewport.h" 39 #include "core/frame/VisualViewport.h"
40 #include "core/input/EventHandler.h" 40 #include "core/input/EventHandler.h"
41 #include "core/layout/LayoutView.h" 41 #include "core/layout/LayoutView.h"
42 #include "core/loader/EmptyClients.h" 42 #include "core/loader/EmptyClients.h"
43 #include "core/loader/FrameLoadRequest.h" 43 #include "core/loader/FrameLoadRequest.h"
44 #include "core/page/DOMWindowPagePopup.h"
45 #include "core/page/FocusController.h" 44 #include "core/page/FocusController.h"
46 #include "core/page/Page.h" 45 #include "core/page/Page.h"
47 #include "core/page/PagePopupClient.h" 46 #include "core/page/PagePopupClient.h"
47 #include "core/page/PagePopupSupplement.h"
48 #include "modules/accessibility/AXObject.h" 48 #include "modules/accessibility/AXObject.h"
49 #include "modules/accessibility/AXObjectCacheImpl.h" 49 #include "modules/accessibility/AXObjectCacheImpl.h"
50 #include "platform/EventDispatchForbiddenScope.h" 50 #include "platform/EventDispatchForbiddenScope.h"
51 #include "platform/LayoutTestSupport.h" 51 #include "platform/LayoutTestSupport.h"
52 #include "platform/ScriptForbiddenScope.h" 52 #include "platform/ScriptForbiddenScope.h"
53 #include "platform/TraceEvent.h" 53 #include "platform/TraceEvent.h"
54 #include "platform/heap/Handle.h" 54 #include "platform/heap/Handle.h"
55 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" 55 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h"
56 #include "public/platform/WebCursorInfo.h" 56 #include "public/platform/WebCursorInfo.h"
57 #include "public/web/WebAXObject.h" 57 #include "public/web/WebAXObject.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 frame->setPagePopupOwner(m_popupClient->ownerElement()); 287 frame->setPagePopupOwner(m_popupClient->ownerElement());
288 frame->setView(FrameView::create(frame.get())); 288 frame->setView(FrameView::create(frame.get()));
289 frame->init(); 289 frame->init();
290 frame->view()->setParentVisible(true); 290 frame->view()->setParentVisible(true);
291 frame->view()->setSelfVisible(true); 291 frame->view()->setSelfVisible(true);
292 frame->view()->setTransparent(false); 292 frame->view()->setTransparent(false);
293 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache()) 293 if (AXObjectCache* cache = m_popupClient->ownerElement().document().existing AXObjectCache())
294 cache->childrenChanged(&m_popupClient->ownerElement()); 294 cache->childrenChanged(&m_popupClient->ownerElement());
295 295
296 ASSERT(frame->localDOMWindow()); 296 ASSERT(frame->localDOMWindow());
297 DOMWindowPagePopup::install(*frame->localDOMWindow(), *this, m_popupClient); 297 PagePopupSupplement::install(*frame, *this, m_popupClient);
298 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache()); 298 ASSERT(m_popupClient->ownerElement().document().existingAXObjectCache() == f rame->document()->existingAXObjectCache());
299 299
300 RefPtr<SharedBuffer> data = SharedBuffer::create(); 300 RefPtr<SharedBuffer> data = SharedBuffer::create();
301 m_popupClient->writeDocument(data.get()); 301 m_popupClient->writeDocument(data.get());
302 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad))); 302 frame->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data, "t ext/html", "UTF-8", KURL(), ForceSynchronousLoad)));
303 frame->setPageZoomFactor(m_popupClient->zoomFactor()); 303 frame->setPageZoomFactor(m_popupClient->zoomFactor());
304 return true; 304 return true;
305 } 305 }
306 306
307 void WebPagePopupImpl::postMessage(const String& message) 307 void WebPagePopupImpl::postMessage(const String& message)
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 507
508 void WebPagePopupImpl::closePopup() 508 void WebPagePopupImpl::closePopup()
509 { 509 {
510 // This function can be called in EventDispatchForbiddenScope for the main 510 // This function can be called in EventDispatchForbiddenScope for the main
511 // document, and the following operations dispatch some events. It's safe 511 // document, and the following operations dispatch some events. It's safe
512 // because web authors can't listen the events. 512 // because web authors can't listen the events.
513 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; 513 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents;
514 514
515 if (m_page) { 515 if (m_page) {
516 toLocalFrame(m_page->mainFrame())->loader().stopAllLoaders(); 516 toLocalFrame(m_page->mainFrame())->loader().stopAllLoaders();
517 ASSERT(m_page->deprecatedLocalMainFrame()->localDOMWindow()); 517 PagePopupSupplement::uninstall(*toLocalFrame(m_page->mainFrame()));
518 DOMWindowPagePopup::uninstall(*m_page->deprecatedLocalMainFrame()->local DOMWindow());
519 } 518 }
520 m_closing = true; 519 m_closing = true;
521 520
522 destroyPage(); 521 destroyPage();
523 522
524 // m_widgetClient might be 0 because this widget might be already closed. 523 // m_widgetClient might be 0 because this widget might be already closed.
525 if (m_widgetClient) { 524 if (m_widgetClient) {
526 // closeWidgetSoon() will call this->close() later. 525 // closeWidgetSoon() will call this->close() later.
527 m_widgetClient->closeWidgetSoon(); 526 m_widgetClient->closeWidgetSoon();
528 } 527 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // A WebPagePopupImpl instance usually has two references. 566 // A WebPagePopupImpl instance usually has two references.
568 // - One owned by the instance itself. It represents the visible widget. 567 // - One owned by the instance itself. It represents the visible widget.
569 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 568 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
570 // WebPagePopupImpl to close. 569 // WebPagePopupImpl to close.
571 // We need them because the closing operation is asynchronous and the widget 570 // We need them because the closing operation is asynchronous and the widget
572 // can be closed while the WebViewImpl is unaware of it. 571 // can be closed while the WebViewImpl is unaware of it.
573 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 572 return adoptRef(new WebPagePopupImpl(client)).leakRef();
574 } 573 }
575 574
576 } // namespace blink 575 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698