| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2011, 2012 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return new (arena) RenderEmbeddedObject(this); | 152 return new (arena) RenderEmbeddedObject(this); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void HTMLPlugInImageElement::willRecalcStyle(StyleChange) | 155 void HTMLPlugInImageElement::willRecalcStyle(StyleChange) |
| 156 { | 156 { |
| 157 // FIXME: Why is this necessary? Manual re-attach is almost always wrong. | 157 // FIXME: Why is this necessary? Manual re-attach is almost always wrong. |
| 158 if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageTy
pe()) | 158 if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageTy
pe()) |
| 159 reattach(); | 159 reattach(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void HTMLPlugInImageElement::attach() | 162 void HTMLPlugInImageElement::attach(const AttachContext& context) |
| 163 { | 163 { |
| 164 PostAttachCallbackDisabler disabler(this); | 164 PostAttachCallbackDisabler disabler(this); |
| 165 | 165 |
| 166 bool isImage = isImageType(); | 166 bool isImage = isImageType(); |
| 167 | 167 |
| 168 if (!isImage) | 168 if (!isImage) |
| 169 queuePostAttachCallback(&HTMLPlugInImageElement::updateWidgetCallback, t
his); | 169 queuePostAttachCallback(&HTMLPlugInImageElement::updateWidgetCallback, t
his); |
| 170 | 170 |
| 171 HTMLPlugInElement::attach(); | 171 HTMLPlugInElement::attach(context); |
| 172 | 172 |
| 173 if (isImage && renderer() && !useFallbackContent()) { | 173 if (isImage && renderer() && !useFallbackContent()) { |
| 174 if (!m_imageLoader) | 174 if (!m_imageLoader) |
| 175 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); | 175 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); |
| 176 m_imageLoader->updateFromElement(); | 176 m_imageLoader->updateFromElement(); |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 void HTMLPlugInImageElement::detach() | 180 void HTMLPlugInImageElement::detach(const AttachContext& context) |
| 181 { | 181 { |
| 182 // FIXME: Because of the insanity that is HTMLPlugInImageElement::recalcStyl
e, | 182 // FIXME: Because of the insanity that is HTMLPlugInImageElement::recalcStyl
e, |
| 183 // we can end up detaching during an attach() call, before we even have a | 183 // we can end up detaching during an attach() call, before we even have a |
| 184 // renderer. In that case, don't mark the widget for update. | 184 // renderer. In that case, don't mark the widget for update. |
| 185 if (attached() && renderer() && !useFallbackContent()) | 185 if (attached() && renderer() && !useFallbackContent()) |
| 186 // Update the widget the next time we attach (detaching destroys the plu
gin). | 186 // Update the widget the next time we attach (detaching destroys the plu
gin). |
| 187 setNeedsWidgetUpdate(true); | 187 setNeedsWidgetUpdate(true); |
| 188 HTMLPlugInElement::detach(); | 188 HTMLPlugInElement::detach(context); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void HTMLPlugInImageElement::updateWidgetIfNecessary() | 191 void HTMLPlugInImageElement::updateWidgetIfNecessary() |
| 192 { | 192 { |
| 193 document()->updateStyleIfNeeded(); | 193 document()->updateStyleIfNeeded(); |
| 194 | 194 |
| 195 if (!needsWidgetUpdate() || useFallbackContent() || isImageType()) | 195 if (!needsWidgetUpdate() || useFallbackContent() || isImageType()) |
| 196 return; | 196 return; |
| 197 | 197 |
| 198 if (!renderEmbeddedObject() || renderEmbeddedObject()->showsUnavailablePlugi
nIndicator()) | 198 if (!renderEmbeddedObject() || renderEmbeddedObject()->showsUnavailablePlugi
nIndicator()) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 226 | 226 |
| 227 void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url) | 227 void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url) |
| 228 { | 228 { |
| 229 LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); | 229 LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); |
| 230 LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); | 230 LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); |
| 231 | 231 |
| 232 m_loadedUrl = url; | 232 m_loadedUrl = url; |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace WebCore | 235 } // namespace WebCore |
| OLD | NEW |