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

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

Issue 138833005: Replace RenderFullScreen with top layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: protect only for top layer changes 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
« no previous file with comments | « Source/core/html/HTMLPlugInElement.h ('k') | Source/core/rendering/RenderFullScreen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 (renderer() && !useFallbackContent() && !(context.performingReattach && m _protectWidgetDuringReattach))
150 setNeedsWidgetUpdate(true); 162 setNeedsWidgetUpdate(true);
163
151 if (m_isDelayingLoadEvent) { 164 if (m_isDelayingLoadEvent) {
152 m_isDelayingLoadEvent = false; 165 m_isDelayingLoadEvent = false;
153 document().decrementLoadEventDelayCount(); 166 document().decrementLoadEventDelayCount();
154 } 167 }
155 168
156 resetInstance(); 169 resetInstance();
157 170
158 if (m_isCapturingMouseEvents) { 171 if (m_isCapturingMouseEvents) {
159 if (Frame* frame = document().frame()) 172 if (Frame* frame = document().frame())
160 frame->eventHandler().setCapturingMouseEventsNode(0); 173 frame->eventHandler().setCapturingMouseEventsNode(0);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } else if (name == hspaceAttr) { 284 } else if (name == hspaceAttr) {
272 addHTMLLengthToStyle(style, CSSPropertyMarginLeft, value); 285 addHTMLLengthToStyle(style, CSSPropertyMarginLeft, value);
273 addHTMLLengthToStyle(style, CSSPropertyMarginRight, value); 286 addHTMLLengthToStyle(style, CSSPropertyMarginRight, value);
274 } else if (name == alignAttr) { 287 } else if (name == alignAttr) {
275 applyAlignmentAttributeToStyle(value, style); 288 applyAlignmentAttributeToStyle(value, style);
276 } else { 289 } else {
277 HTMLFrameOwnerElement::collectStyleForPresentationAttribute(name, value, style); 290 HTMLFrameOwnerElement::collectStyleForPresentationAttribute(name, value, style);
278 } 291 }
279 } 292 }
280 293
294 // FIXME: Hack to prevent the plugin from reloading when entering/exiting
295 // fullscreen. When plugins are moved out of render objects, this function won't
296 // be needed.
297 void HTMLPlugInElement::setIsInTopLayer(bool inTopLayer)
298 {
299 if (isInTopLayer() == inTopLayer)
300 return;
301 if (renderEmbeddedObject() && !needsWidgetUpdate() && existingRenderWidget() )
302 m_protectWidgetDuringReattach = existingRenderWidget()->widget();
esprehn 2014/02/11 00:25:16 This doesn't seem right, what if you have <div><ob
falken 2014/02/11 14:39:58 Ah, good point. How about adding "topLayerChanged"
303 HTMLFrameOwnerElement::setIsInTopLayer(inTopLayer);
304 }
305
281 void HTMLPlugInElement::defaultEventHandler(Event* event) 306 void HTMLPlugInElement::defaultEventHandler(Event* event)
282 { 307 {
283 // Firefox seems to use a fake event listener to dispatch events to plug-in 308 // Firefox seems to use a fake event listener to dispatch events to plug-in
284 // (tested with mouse events only). This is observable via different order 309 // (tested with mouse events only). This is observable via different order
285 // of events - in Firefox, event listeners specified in HTML attributes 310 // of events - in Firefox, event listeners specified in HTML attributes
286 // fires first, then an event gets dispatched to plug-in, and only then 311 // fires first, then an event gets dispatched to plug-in, and only then
287 // other event listeners fire. Hopefully, this difference does not matter in 312 // other event listeners fire. Hopefully, this difference does not matter in
288 // practice. 313 // practice.
289 314
290 // FIXME: Mouse down and scroll events are passed down to plug-in via custom 315 // FIXME: Mouse down and scroll events are passed down to plug-in via custom
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 if (root.isOldestAuthorShadowRoot()) 550 if (root.isOldestAuthorShadowRoot())
526 lazyReattachIfAttached(); 551 lazyReattachIfAttached();
527 } 552 }
528 553
529 bool HTMLPlugInElement::useFallbackContent() const 554 bool HTMLPlugInElement::useFallbackContent() const
530 { 555 {
531 return hasAuthorShadowRoot(); 556 return hasAuthorShadowRoot();
532 } 557 }
533 558
534 } 559 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLPlugInElement.h ('k') | Source/core/rendering/RenderFullScreen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698