| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 return image; | 140 return image; |
| 141 } | 141 } |
| 142 | 142 |
| 143 return new RenderEmbeddedObject(this); | 143 return new RenderEmbeddedObject(this); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void HTMLPlugInImageElement::willRecalcStyle(StyleRecalcChange) | 146 void HTMLPlugInImageElement::willRecalcStyle(StyleRecalcChange) |
| 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 recreateRenderTree(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void HTMLPlugInImageElement::attach(const AttachContext& context) | 153 void HTMLPlugInImageElement::createRenderTree(const AttachContext& context) |
| 154 { | 154 { |
| 155 bool isImage = isImageType(); | 155 bool isImage = isImageType(); |
| 156 | 156 |
| 157 if (!isImage) | 157 if (!isImage) |
| 158 PostAttachCallbacks::queueCallback(HTMLPlugInImageElement::updateWidgetC
allback, this); | 158 PostAttachCallbacks::queueCallback(HTMLPlugInImageElement::updateWidgetC
allback, this); |
| 159 | 159 |
| 160 HTMLPlugInElement::attach(context); | 160 HTMLPlugInElement::createRenderTree(context); |
| 161 | 161 |
| 162 if (isImage && renderer() && !useFallbackContent()) { | 162 if (isImage && renderer() && !useFallbackContent()) { |
| 163 if (!m_imageLoader) | 163 if (!m_imageLoader) |
| 164 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); | 164 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); |
| 165 m_imageLoader->updateFromElement(); | 165 m_imageLoader->updateFromElement(); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 | 168 |
| 169 void HTMLPlugInImageElement::detach(const AttachContext& context) | 169 void HTMLPlugInImageElement::destroyRenderTree(const AttachContext& context) |
| 170 { | 170 { |
| 171 // FIXME: Because of the insanity that is HTMLPlugInImageElement::recalcStyl
e, | 171 // FIXME: Because of the insanity that is HTMLPlugInImageElement::recalcStyl
e, |
| 172 // we can end up detaching during an attach() call, before we even have a | 172 // we can end up detaching during an attach() call, before we even have a |
| 173 // renderer. In that case, don't mark the widget for update. | 173 // renderer. In that case, don't mark the widget for update. |
| 174 if (attached() && renderer() && !useFallbackContent()) | 174 if (attached() && renderer() && !useFallbackContent()) |
| 175 // Update the widget the next time we attach (detaching destroys the plu
gin). | 175 // Update the widget the next time we attach (detaching destroys the plu
gin). |
| 176 setNeedsWidgetUpdate(true); | 176 setNeedsWidgetUpdate(true); |
| 177 HTMLPlugInElement::detach(context); | 177 HTMLPlugInElement::destroyRenderTree(context); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void HTMLPlugInImageElement::updateWidgetIfNecessary() | 180 void HTMLPlugInImageElement::updateWidgetIfNecessary() |
| 181 { | 181 { |
| 182 document().updateStyleIfNeeded(); | 182 document().updateStyleIfNeeded(); |
| 183 | 183 |
| 184 if (!needsWidgetUpdate() || useFallbackContent() || isImageType()) | 184 if (!needsWidgetUpdate() || useFallbackContent() || isImageType()) |
| 185 return; | 185 return; |
| 186 | 186 |
| 187 if (!renderEmbeddedObject() || renderEmbeddedObject()->showsUnavailablePlugi
nIndicator()) | 187 if (!renderEmbeddedObject() || renderEmbeddedObject()->showsUnavailablePlugi
nIndicator()) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 renderEmbeddedObject()->setPluginUnavailabilityReason(RenderEmbeddedObje
ct::PluginBlockedByContentSecurityPolicy); | 321 renderEmbeddedObject()->setPluginUnavailabilityReason(RenderEmbeddedObje
ct::PluginBlockedByContentSecurityPolicy); |
| 322 return false; | 322 return false; |
| 323 } | 323 } |
| 324 | 324 |
| 325 if (frame->loader() && !frame->loader()->mixedContentChecker()->canRunInsecu
reContent(document().securityOrigin(), url)) | 325 if (frame->loader() && !frame->loader()->mixedContentChecker()->canRunInsecu
reContent(document().securityOrigin(), url)) |
| 326 return false; | 326 return false; |
| 327 return true; | 327 return true; |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace WebCore | 330 } // namespace WebCore |
| OLD | NEW |