OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 bool HTMLPlugInImageElement::willRecalcStyle(StyleChange) | 146 bool HTMLPlugInImageElement::willRecalcStyle(StyleChange) |
147 { | 147 { |
148 // FIXME: Why is this necessary? Manual re-attach is almost always wrong. | 148 // FIXME: Why is this necessary? Manual re-attach is almost always wrong. |
149 if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageTy
pe()) | 149 if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageTy
pe()) |
150 reattach(); | 150 reattach(); |
151 return true; | 151 return true; |
152 } | 152 } |
153 | 153 |
154 void HTMLPlugInImageElement::attach() | 154 void HTMLPlugInImageElement::attach() |
155 { | 155 { |
| 156 suspendPostAttachCallbacks(); |
| 157 |
156 bool isImage = isImageType(); | 158 bool isImage = isImageType(); |
157 | 159 |
158 if (!isImage) | 160 if (!isImage) |
159 queuePostAttachCallback(&HTMLPlugInImageElement::updateWidgetCallback, t
his); | 161 queuePostAttachCallback(&HTMLPlugInImageElement::updateWidgetCallback, t
his); |
160 | 162 |
161 HTMLPlugInElement::attach(); | 163 HTMLPlugInElement::attach(); |
162 | 164 |
163 if (isImage && renderer() && !useFallbackContent()) { | 165 if (isImage && renderer() && !useFallbackContent()) { |
164 if (!m_imageLoader) | 166 if (!m_imageLoader) |
165 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); | 167 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); |
166 m_imageLoader->updateFromElement(); | 168 m_imageLoader->updateFromElement(); |
167 } | 169 } |
| 170 |
| 171 resumePostAttachCallbacks(); |
168 } | 172 } |
169 | 173 |
170 void HTMLPlugInImageElement::detach() | 174 void HTMLPlugInImageElement::detach() |
171 { | 175 { |
172 // FIXME: Because of the insanity that is HTMLPlugInImageElement::recalcStyl
e, | 176 // FIXME: Because of the insanity that is HTMLPlugInImageElement::recalcStyl
e, |
173 // we can end up detaching during an attach() call, before we even have a | 177 // we can end up detaching during an attach() call, before we even have a |
174 // renderer. In that case, don't mark the widget for update. | 178 // renderer. In that case, don't mark the widget for update. |
175 if (attached() && renderer() && !useFallbackContent()) | 179 if (attached() && renderer() && !useFallbackContent()) |
176 // Update the widget the next time we attach (detaching destroys the plu
gin). | 180 // Update the widget the next time we attach (detaching destroys the plu
gin). |
177 setNeedsWidgetUpdate(true); | 181 setNeedsWidgetUpdate(true); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 ASSERT(m_customStyleForPageCache); | 249 ASSERT(m_customStyleForPageCache); |
246 return m_customStyleForPageCache; | 250 return m_customStyleForPageCache; |
247 } | 251 } |
248 | 252 |
249 void HTMLPlugInImageElement::updateWidgetCallback(Node* n, unsigned) | 253 void HTMLPlugInImageElement::updateWidgetCallback(Node* n, unsigned) |
250 { | 254 { |
251 static_cast<HTMLPlugInImageElement*>(n)->updateWidgetIfNecessary(); | 255 static_cast<HTMLPlugInImageElement*>(n)->updateWidgetIfNecessary(); |
252 } | 256 } |
253 | 257 |
254 } // namespace WebCore | 258 } // namespace WebCore |
OLD | NEW |