OLD | NEW |
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...) Loading... |
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) | |
72 { | 71 { |
73 setHasCustomStyleCallbacks(); | 72 setHasCustomStyleCallbacks(); |
74 } | 73 } |
75 | 74 |
76 HTMLPlugInElement::~HTMLPlugInElement() | 75 HTMLPlugInElement::~HTMLPlugInElement() |
77 { | 76 { |
78 ASSERT(!m_pluginWrapper); // cleared in detach() | 77 ASSERT(!m_pluginWrapper); // cleared in detach() |
79 ASSERT(!m_isDelayingLoadEvent); | 78 ASSERT(!m_isDelayingLoadEvent); |
80 | 79 |
81 if (m_NPObject) { | 80 if (m_NPObject) { |
(...skipping 28 matching lines...) Loading... |
110 { | 109 { |
111 if (m_imageLoader) | 110 if (m_imageLoader) |
112 m_imageLoader->elementDidMoveToNewDocument(); | 111 m_imageLoader->elementDidMoveToNewDocument(); |
113 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); | 112 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); |
114 } | 113 } |
115 | 114 |
116 void HTMLPlugInElement::attach(const AttachContext& context) | 115 void HTMLPlugInElement::attach(const AttachContext& context) |
117 { | 116 { |
118 HTMLFrameOwnerElement::attach(context); | 117 HTMLFrameOwnerElement::attach(context); |
119 | 118 |
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 | |
130 if (!renderer() || useFallbackContent()) | 119 if (!renderer() || useFallbackContent()) |
131 return; | 120 return; |
132 | |
133 if (isImageType()) { | 121 if (isImageType()) { |
134 if (!m_imageLoader) | 122 if (!m_imageLoader) |
135 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); | 123 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); |
136 m_imageLoader->updateFromElement(); | 124 m_imageLoader->updateFromElement(); |
137 } else if (needsWidgetUpdate() | 125 } else if (needsWidgetUpdate() |
138 && renderEmbeddedObject() | 126 && renderEmbeddedObject() |
139 && !renderEmbeddedObject()->showsUnavailablePluginIndicator() | 127 && !renderEmbeddedObject()->showsUnavailablePluginIndicator() |
140 && !wouldLoadAsNetscapePlugin(m_url, m_serviceType) | 128 && !wouldLoadAsNetscapePlugin(m_url, m_serviceType) |
141 && !m_isDelayingLoadEvent) { | 129 && !m_isDelayingLoadEvent) { |
142 m_isDelayingLoadEvent = true; | 130 m_isDelayingLoadEvent = true; |
143 document().incrementLoadEventDelayCount(); | 131 document().incrementLoadEventDelayCount(); |
144 } | 132 } |
145 } | 133 } |
146 | 134 |
147 void HTMLPlugInElement::updateWidget() | 135 void HTMLPlugInElement::updateWidget() |
148 { | 136 { |
149 RefPtr<HTMLPlugInElement> protector(this); | 137 RefPtr<HTMLPlugInElement> protector(this); |
150 updateWidgetInternal(); | 138 updateWidgetInternal(); |
151 if (m_isDelayingLoadEvent) { | 139 if (m_isDelayingLoadEvent) { |
152 m_isDelayingLoadEvent = false; | 140 m_isDelayingLoadEvent = false; |
153 document().decrementLoadEventDelayCount(); | 141 document().decrementLoadEventDelayCount(); |
154 } | 142 } |
155 } | 143 } |
156 | 144 |
157 void HTMLPlugInElement::detach(const AttachContext& context) | 145 void HTMLPlugInElement::detach(const AttachContext& context) |
158 { | 146 { |
159 // Update the widget the next time we attach (detaching destroys the plugin)
. | 147 // Update the widget the next time we attach (detaching destroys the plugin)
. |
160 // FIXME: None of this "needsWidgetUpdate" related code looks right. | 148 // FIXME: None of this "needsWidgetUpdate" related code looks right. |
161 if (context.performingReattach && renderEmbeddedObject() && !needsWidgetUpda
te()) | 149 if (renderer() && !useFallbackContent()) |
162 m_protectWidgetDuringReattach = pluginWidget(); | |
163 else if (renderer() && !useFallbackContent()) | |
164 setNeedsWidgetUpdate(true); | 150 setNeedsWidgetUpdate(true); |
165 | |
166 if (m_isDelayingLoadEvent) { | 151 if (m_isDelayingLoadEvent) { |
167 m_isDelayingLoadEvent = false; | 152 m_isDelayingLoadEvent = false; |
168 document().decrementLoadEventDelayCount(); | 153 document().decrementLoadEventDelayCount(); |
169 } | 154 } |
170 | 155 |
171 resetInstance(); | 156 resetInstance(); |
172 | 157 |
173 if (m_isCapturingMouseEvents) { | 158 if (m_isCapturingMouseEvents) { |
174 if (Frame* frame = document().frame()) | 159 if (Frame* frame = document().frame()) |
175 frame->eventHandler().setCapturingMouseEventsNode(0); | 160 frame->eventHandler().setCapturingMouseEventsNode(0); |
(...skipping 364 matching lines...) Loading... |
540 if (root.isOldestAuthorShadowRoot()) | 525 if (root.isOldestAuthorShadowRoot()) |
541 lazyReattachIfAttached(); | 526 lazyReattachIfAttached(); |
542 } | 527 } |
543 | 528 |
544 bool HTMLPlugInElement::useFallbackContent() const | 529 bool HTMLPlugInElement::useFallbackContent() const |
545 { | 530 { |
546 return hasAuthorShadowRoot(); | 531 return hasAuthorShadowRoot(); |
547 } | 532 } |
548 | 533 |
549 } | 534 } |
OLD | NEW |