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

Side by Side Diff: Source/core/html/HTMLPlugInElement.cpp

Issue 134753003: Reland r165710 "Replace RenderFullScreen with top layer" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: patch for landing Created 6 years, 10 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 , m_NPObject(0) 61 , m_NPObject(0)
62 , m_isCapturingMouseEvents(false) 62 , m_isCapturingMouseEvents(false)
63 , m_inBeforeLoadEventHandler(false) 63 , m_inBeforeLoadEventHandler(false)
64 // m_needsWidgetUpdate(!createdByParser) allows HTMLObjectElement to delay 64 // m_needsWidgetUpdate(!createdByParser) allows HTMLObjectElement to delay
65 // widget updates until after all children are parsed. For HTMLEmbedElement 65 // widget updates until after all children are parsed. For HTMLEmbedElement
66 // this delay is unnecessary, but it is simpler to make both classes share 66 // this delay is unnecessary, but it is simpler to make both classes share
67 // the same codepath in this class. 67 // the same codepath in this class.
68 , m_needsWidgetUpdate(!createdByParser) 68 , m_needsWidgetUpdate(!createdByParser)
69 , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPrefe rPlugInsForImages) 69 , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPrefe rPlugInsForImages)
70 , m_displayState(Playing) 70 , m_displayState(Playing)
71 , m_protectWidgetDuringReattach(0)
71 { 72 {
72 setHasCustomStyleCallbacks(); 73 setHasCustomStyleCallbacks();
73 } 74 }
74 75
75 HTMLPlugInElement::~HTMLPlugInElement() 76 HTMLPlugInElement::~HTMLPlugInElement()
76 { 77 {
77 ASSERT(!m_pluginWrapper); // cleared in detach() 78 ASSERT(!m_pluginWrapper); // cleared in detach()
78 ASSERT(!m_isDelayingLoadEvent); 79 ASSERT(!m_isDelayingLoadEvent);
79 80
80 if (m_NPObject) { 81 if (m_NPObject) {
(...skipping 28 matching lines...) Expand all
109 { 110 {
110 if (m_imageLoader) 111 if (m_imageLoader)
111 m_imageLoader->elementDidMoveToNewDocument(); 112 m_imageLoader->elementDidMoveToNewDocument();
112 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); 113 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument);
113 } 114 }
114 115
115 void HTMLPlugInElement::attach(const AttachContext& context) 116 void HTMLPlugInElement::attach(const AttachContext& context)
116 { 117 {
117 HTMLFrameOwnerElement::attach(context); 118 HTMLFrameOwnerElement::attach(context);
118 119
120 if (m_protectWidgetDuringReattach) {
121 RenderEmbeddedObject* object = renderEmbeddedObject();
122 if (object && !needsWidgetUpdate()) {
123 object->setWidget(m_protectWidgetDuringReattach.get());
124 m_protectWidgetDuringReattach.clear();
125 return;
126 }
127 m_protectWidgetDuringReattach.clear();
128 }
129
119 if (!renderer() || useFallbackContent()) 130 if (!renderer() || useFallbackContent())
120 return; 131 return;
132
121 if (isImageType()) { 133 if (isImageType()) {
122 if (!m_imageLoader) 134 if (!m_imageLoader)
123 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); 135 m_imageLoader = adoptPtr(new HTMLImageLoader(this));
124 m_imageLoader->updateFromElement(); 136 m_imageLoader->updateFromElement();
125 } else if (needsWidgetUpdate() 137 } else if (needsWidgetUpdate()
126 && renderEmbeddedObject() 138 && renderEmbeddedObject()
127 && !renderEmbeddedObject()->showsUnavailablePluginIndicator() 139 && !renderEmbeddedObject()->showsUnavailablePluginIndicator()
128 && !wouldLoadAsNetscapePlugin(m_url, m_serviceType) 140 && !wouldLoadAsNetscapePlugin(m_url, m_serviceType)
129 && !m_isDelayingLoadEvent) { 141 && !m_isDelayingLoadEvent) {
130 m_isDelayingLoadEvent = true; 142 m_isDelayingLoadEvent = true;
131 document().incrementLoadEventDelayCount(); 143 document().incrementLoadEventDelayCount();
132 } 144 }
133 } 145 }
134 146
135 void HTMLPlugInElement::updateWidget() 147 void HTMLPlugInElement::updateWidget()
136 { 148 {
137 RefPtr<HTMLPlugInElement> protector(this); 149 RefPtr<HTMLPlugInElement> protector(this);
138 updateWidgetInternal(); 150 updateWidgetInternal();
139 if (m_isDelayingLoadEvent) { 151 if (m_isDelayingLoadEvent) {
140 m_isDelayingLoadEvent = false; 152 m_isDelayingLoadEvent = false;
141 document().decrementLoadEventDelayCount(); 153 document().decrementLoadEventDelayCount();
142 } 154 }
143 } 155 }
144 156
145 void HTMLPlugInElement::detach(const AttachContext& context) 157 void HTMLPlugInElement::detach(const AttachContext& context)
146 { 158 {
147 // Update the widget the next time we attach (detaching destroys the plugin) . 159 // Update the widget the next time we attach (detaching destroys the plugin) .
148 // FIXME: None of this "needsWidgetUpdate" related code looks right. 160 // FIXME: None of this "needsWidgetUpdate" related code looks right.
149 if (renderer() && !useFallbackContent()) 161 if (context.performingReattach && renderEmbeddedObject() && !needsWidgetUpda te() && existingRenderWidget())
162 m_protectWidgetDuringReattach = existingRenderWidget()->widget();
163 else if (renderer() && !useFallbackContent())
150 setNeedsWidgetUpdate(true); 164 setNeedsWidgetUpdate(true);
165
151 if (m_isDelayingLoadEvent) { 166 if (m_isDelayingLoadEvent) {
152 m_isDelayingLoadEvent = false; 167 m_isDelayingLoadEvent = false;
153 document().decrementLoadEventDelayCount(); 168 document().decrementLoadEventDelayCount();
154 } 169 }
155 170
156 resetInstance(); 171 resetInstance();
157 172
158 if (m_isCapturingMouseEvents) { 173 if (m_isCapturingMouseEvents) {
159 if (Frame* frame = document().frame()) 174 if (Frame* frame = document().frame())
160 frame->eventHandler().setCapturingMouseEventsNode(0); 175 frame->eventHandler().setCapturingMouseEventsNode(0);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if (root.isOldestAuthorShadowRoot()) 540 if (root.isOldestAuthorShadowRoot())
526 lazyReattachIfAttached(); 541 lazyReattachIfAttached();
527 } 542 }
528 543
529 bool HTMLPlugInElement::useFallbackContent() const 544 bool HTMLPlugInElement::useFallbackContent() const
530 { 545 {
531 return hasAuthorShadowRoot(); 546 return hasAuthorShadowRoot();
532 } 547 }
533 548
534 } 549 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698