| 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, 2007, 2008, 2009, 2011 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights |
| 6 * reserved. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * | 8 * |
| 8 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 12 * | 13 * |
| 13 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 element->ensureUserAgentShadowRoot(); | 68 element->ensureUserAgentShadowRoot(); |
| 68 return element; | 69 return element; |
| 69 } | 70 } |
| 70 | 71 |
| 71 DEFINE_TRACE(HTMLObjectElement) { | 72 DEFINE_TRACE(HTMLObjectElement) { |
| 72 FormAssociatedElement::trace(visitor); | 73 FormAssociatedElement::trace(visitor); |
| 73 HTMLPlugInElement::trace(visitor); | 74 HTMLPlugInElement::trace(visitor); |
| 74 } | 75 } |
| 75 | 76 |
| 76 LayoutPart* HTMLObjectElement::existingLayoutPart() const { | 77 LayoutPart* HTMLObjectElement::existingLayoutPart() const { |
| 77 return layoutPart(); // This will return 0 if the layoutObject is not a Layou
tPart. | 78 // This will return 0 if the layoutObject is not a LayoutPart. |
| 79 return layoutPart(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 bool HTMLObjectElement::isPresentationAttribute( | 82 bool HTMLObjectElement::isPresentationAttribute( |
| 81 const QualifiedName& name) const { | 83 const QualifiedName& name) const { |
| 82 if (name == borderAttr) | 84 if (name == borderAttr) |
| 83 return true; | 85 return true; |
| 84 return HTMLPlugInElement::isPresentationAttribute(name); | 86 return HTMLPlugInElement::isPresentationAttribute(name); |
| 85 } | 87 } |
| 86 | 88 |
| 87 void HTMLObjectElement::collectStyleForPresentationAttribute( | 89 void HTMLObjectElement::collectStyleForPresentationAttribute( |
| 88 const QualifiedName& name, | 90 const QualifiedName& name, |
| 89 const AtomicString& value, | 91 const AtomicString& value, |
| 90 MutableStylePropertySet* style) { | 92 MutableStylePropertySet* style) { |
| 91 if (name == borderAttr) | 93 if (name == borderAttr) |
| 92 applyBorderAttributeToStyle(value, style); | 94 applyBorderAttributeToStyle(value, style); |
| 93 else | 95 else |
| 94 HTMLPlugInElement::collectStyleForPresentationAttribute(name, value, style); | 96 HTMLPlugInElement::collectStyleForPresentationAttribute(name, value, style); |
| 95 } | 97 } |
| 96 | 98 |
| 97 void HTMLObjectElement::parseAttribute(const QualifiedName& name, | 99 void HTMLObjectElement::parseAttribute(const QualifiedName& name, |
| 98 const AtomicString& oldValue, | 100 const AtomicString& oldValue, |
| 99 const AtomicString& value) { | 101 const AtomicString& value) { |
| 100 if (name == formAttr) { | 102 if (name == formAttr) { |
| 101 formAttributeChanged(); | 103 formAttributeChanged(); |
| 102 } else if (name == typeAttr) { | 104 } else if (name == typeAttr) { |
| 103 m_serviceType = value.lower(); | 105 m_serviceType = value.lower(); |
| 104 size_t pos = m_serviceType.find(";"); | 106 size_t pos = m_serviceType.find(";"); |
| 105 if (pos != kNotFound) | 107 if (pos != kNotFound) |
| 106 m_serviceType = m_serviceType.left(pos); | 108 m_serviceType = m_serviceType.left(pos); |
| 107 // TODO(schenney): crbug.com/572908 What is the right thing to do here? Shou
ld we | 109 // TODO(schenney): crbug.com/572908 What is the right thing to do here? |
| 108 // suppress the reload stuff when a persistable widget-type is specified? | 110 // Should we suppress the reload stuff when a persistable widget-type is |
| 111 // specified? |
| 109 reloadPluginOnAttributeChange(name); | 112 reloadPluginOnAttributeChange(name); |
| 110 if (!layoutObject()) | 113 if (!layoutObject()) |
| 111 requestPluginCreationWithoutLayoutObjectIfPossible(); | 114 requestPluginCreationWithoutLayoutObjectIfPossible(); |
| 112 } else if (name == dataAttr) { | 115 } else if (name == dataAttr) { |
| 113 m_url = stripLeadingAndTrailingHTMLSpaces(value); | 116 m_url = stripLeadingAndTrailingHTMLSpaces(value); |
| 114 if (layoutObject() && isImageType()) { | 117 if (layoutObject() && isImageType()) { |
| 115 setNeedsWidgetUpdate(true); | 118 setNeedsWidgetUpdate(true); |
| 116 if (!m_imageLoader) | 119 if (!m_imageLoader) |
| 117 m_imageLoader = HTMLImageLoader::create(this); | 120 m_imageLoader = HTMLImageLoader::create(this); |
| 118 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousError); | 121 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousError); |
| 119 } else { | 122 } else { |
| 120 reloadPluginOnAttributeChange(name); | 123 reloadPluginOnAttributeChange(name); |
| 121 } | 124 } |
| 122 } else if (name == classidAttr) { | 125 } else if (name == classidAttr) { |
| 123 m_classId = value; | 126 m_classId = value; |
| 124 reloadPluginOnAttributeChange(name); | 127 reloadPluginOnAttributeChange(name); |
| 125 } else { | 128 } else { |
| 126 HTMLPlugInElement::parseAttribute(name, oldValue, value); | 129 HTMLPlugInElement::parseAttribute(name, oldValue, value); |
| 127 } | 130 } |
| 128 } | 131 } |
| 129 | 132 |
| 130 static void mapDataParamToSrc(Vector<String>* paramNames, | 133 static void mapDataParamToSrc(Vector<String>* paramNames, |
| 131 Vector<String>* paramValues) { | 134 Vector<String>* paramValues) { |
| 132 // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e.
Real and WMP | 135 // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e. |
| 133 // require "src" attribute). | 136 // Real and WMP require "src" attribute). |
| 134 int srcIndex = -1, dataIndex = -1; | 137 int srcIndex = -1, dataIndex = -1; |
| 135 for (unsigned i = 0; i < paramNames->size(); ++i) { | 138 for (unsigned i = 0; i < paramNames->size(); ++i) { |
| 136 if (equalIgnoringCase((*paramNames)[i], "src")) | 139 if (equalIgnoringCase((*paramNames)[i], "src")) |
| 137 srcIndex = i; | 140 srcIndex = i; |
| 138 else if (equalIgnoringCase((*paramNames)[i], "data")) | 141 else if (equalIgnoringCase((*paramNames)[i], "data")) |
| 139 dataIndex = i; | 142 dataIndex = i; |
| 140 } | 143 } |
| 141 | 144 |
| 142 if (srcIndex == -1 && dataIndex != -1) { | 145 if (srcIndex == -1 && dataIndex != -1) { |
| 143 paramNames->append("src"); | 146 paramNames->append("src"); |
| 144 paramValues->append((*paramValues)[dataIndex]); | 147 paramValues->append((*paramValues)[dataIndex]); |
| 145 } | 148 } |
| 146 } | 149 } |
| 147 | 150 |
| 148 // TODO(schenney): crbug.com/572908 This function should not deal with url or se
rviceType! | 151 // TODO(schenney): crbug.com/572908 This function should not deal with url or |
| 152 // serviceType! |
| 149 void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, | 153 void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, |
| 150 Vector<String>& paramValues, | 154 Vector<String>& paramValues, |
| 151 String& url, | 155 String& url, |
| 152 String& serviceType) { | 156 String& serviceType) { |
| 153 HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames; | 157 HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames; |
| 154 String urlParameter; | 158 String urlParameter; |
| 155 | 159 |
| 156 // Scan the PARAM children and store their name/value pairs. | 160 // Scan the PARAM children and store their name/value pairs. |
| 157 // Get the URL and type from the params if we don't already have them. | 161 // Get the URL and type from the params if we don't already have them. |
| 158 for (HTMLParamElement* p = Traversal<HTMLParamElement>::firstChild(*this); p; | 162 for (HTMLParamElement* p = Traversal<HTMLParamElement>::firstChild(*this); p; |
| 159 p = Traversal<HTMLParamElement>::nextSibling(*p)) { | 163 p = Traversal<HTMLParamElement>::nextSibling(*p)) { |
| 160 String name = p->name(); | 164 String name = p->name(); |
| 161 if (name.isEmpty()) | 165 if (name.isEmpty()) |
| 162 continue; | 166 continue; |
| 163 | 167 |
| 164 uniqueParamNames.add(name.impl()); | 168 uniqueParamNames.add(name.impl()); |
| 165 paramNames.append(p->name()); | 169 paramNames.append(p->name()); |
| 166 paramValues.append(p->value()); | 170 paramValues.append(p->value()); |
| 167 | 171 |
| 168 // TODO(schenney): crbug.com/572908 url adjustment does not belong in this f
unction. | 172 // TODO(schenney): crbug.com/572908 url adjustment does not belong in this |
| 173 // function. |
| 169 if (url.isEmpty() && urlParameter.isEmpty() && | 174 if (url.isEmpty() && urlParameter.isEmpty() && |
| 170 (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || | 175 (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || |
| 171 equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url"))) | 176 equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url"))) |
| 172 urlParameter = stripLeadingAndTrailingHTMLSpaces(p->value()); | 177 urlParameter = stripLeadingAndTrailingHTMLSpaces(p->value()); |
| 173 // TODO(schenney): crbug.com/572908 serviceType calculation does not belong
in this function. | 178 // TODO(schenney): crbug.com/572908 serviceType calculation does not belong |
| 179 // in this function. |
| 174 if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { | 180 if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { |
| 175 serviceType = p->value(); | 181 serviceType = p->value(); |
| 176 size_t pos = serviceType.find(";"); | 182 size_t pos = serviceType.find(";"); |
| 177 if (pos != kNotFound) | 183 if (pos != kNotFound) |
| 178 serviceType = serviceType.left(pos); | 184 serviceType = serviceType.left(pos); |
| 179 } | 185 } |
| 180 } | 186 } |
| 181 | 187 |
| 182 // When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE attri
bute in the tag | 188 // When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE |
| 183 // points to the Java plugin itself (an ActiveX component) while the actual ap
plet CODEBASE is | 189 // attribute in the tag points to the Java plugin itself (an ActiveX |
| 184 // in a PARAM tag. See <http://java.sun.com/products/plugin/1.2/docs/tags.html
>. This means | 190 // component) while the actual applet CODEBASE is in a PARAM tag. See |
| 185 // we have to explicitly suppress the tag's CODEBASE attribute if there is non
e in a PARAM, | 191 // <http://java.sun.com/products/plugin/1.2/docs/tags.html>. This means we |
| 186 // else our Java plugin will misinterpret it. [4004531] | 192 // have to explicitly suppress the tag's CODEBASE attribute if there is none |
| 193 // in a PARAM, else our Java plugin will misinterpret it. [4004531] |
| 187 String codebase; | 194 String codebase; |
| 188 if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType)) { | 195 if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType)) { |
| 189 codebase = "codebase"; | 196 codebase = "codebase"; |
| 190 uniqueParamNames.add( | 197 uniqueParamNames.add( |
| 191 codebase.impl()); // pretend we found it in a PARAM already | 198 codebase.impl()); // pretend we found it in a PARAM already |
| 192 } | 199 } |
| 193 | 200 |
| 194 // Turn the attributes of the <object> element into arrays, but don't override
<param> values. | 201 // Turn the attributes of the <object> element into arrays, but don't override |
| 202 // <param> values. |
| 195 AttributeCollection attributes = this->attributes(); | 203 AttributeCollection attributes = this->attributes(); |
| 196 for (const Attribute& attribute : attributes) { | 204 for (const Attribute& attribute : attributes) { |
| 197 const AtomicString& name = attribute.name().localName(); | 205 const AtomicString& name = attribute.name().localName(); |
| 198 if (!uniqueParamNames.contains(name.impl())) { | 206 if (!uniqueParamNames.contains(name.impl())) { |
| 199 paramNames.append(name.getString()); | 207 paramNames.append(name.getString()); |
| 200 paramValues.append(attribute.value().getString()); | 208 paramValues.append(attribute.value().getString()); |
| 201 } | 209 } |
| 202 } | 210 } |
| 203 | 211 |
| 204 mapDataParamToSrc(¶mNames, ¶mValues); | 212 mapDataParamToSrc(¶mNames, ¶mValues); |
| 205 | 213 |
| 206 // HTML5 says that an object resource's URL is specified by the object's data | 214 // HTML5 says that an object resource's URL is specified by the object's data |
| 207 // attribute, not by a param element. However, for compatibility, allow the | 215 // attribute, not by a param element. However, for compatibility, allow the |
| 208 // resource's URL to be given by a param named "src", "movie", "code" or "url" | 216 // resource's URL to be given by a param named "src", "movie", "code" or "url" |
| 209 // if we know that resource points to a plugin. | 217 // if we know that resource points to a plugin. |
| 210 if (url.isEmpty() && !urlParameter.isEmpty()) { | 218 if (url.isEmpty() && !urlParameter.isEmpty()) { |
| 211 KURL completedURL = document().completeURL(urlParameter); | 219 KURL completedURL = document().completeURL(urlParameter); |
| 212 bool useFallback; | 220 bool useFallback; |
| 213 if (shouldUsePlugin(completedURL, serviceType, false, useFallback)) | 221 if (shouldUsePlugin(completedURL, serviceType, false, useFallback)) |
| 214 url = urlParameter; | 222 url = urlParameter; |
| 215 } | 223 } |
| 216 } | 224 } |
| 217 | 225 |
| 218 bool HTMLObjectElement::hasFallbackContent() const { | 226 bool HTMLObjectElement::hasFallbackContent() const { |
| 219 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 227 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| 220 // Ignore whitespace-only text, and <param> tags, any other content is fallb
ack content. | 228 // Ignore whitespace-only text, and <param> tags, any other content is |
| 229 // fallback content. |
| 221 if (child->isTextNode()) { | 230 if (child->isTextNode()) { |
| 222 if (!toText(child)->containsOnlyWhitespace()) | 231 if (!toText(child)->containsOnlyWhitespace()) |
| 223 return true; | 232 return true; |
| 224 } else if (!isHTMLParamElement(*child)) { | 233 } else if (!isHTMLParamElement(*child)) { |
| 225 return true; | 234 return true; |
| 226 } | 235 } |
| 227 } | 236 } |
| 228 return false; | 237 return false; |
| 229 } | 238 } |
| 230 | 239 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 256 needsInvalidation = true; | 265 needsInvalidation = true; |
| 257 } else { | 266 } else { |
| 258 NOTREACHED(); | 267 NOTREACHED(); |
| 259 needsInvalidation = false; | 268 needsInvalidation = false; |
| 260 } | 269 } |
| 261 setNeedsWidgetUpdate(true); | 270 setNeedsWidgetUpdate(true); |
| 262 if (needsInvalidation) | 271 if (needsInvalidation) |
| 263 lazyReattachIfNeeded(); | 272 lazyReattachIfNeeded(); |
| 264 } | 273 } |
| 265 | 274 |
| 266 // TODO(schenney): crbug.com/572908 This should be unified with HTMLEmbedElement
::updateWidget and | 275 // TODO(schenney): crbug.com/572908 This should be unified with |
| 267 // moved down into HTMLPluginElement.cpp | 276 // HTMLEmbedElement::updateWidget and moved down into HTMLPluginElement.cpp |
| 268 void HTMLObjectElement::updateWidgetInternal() { | 277 void HTMLObjectElement::updateWidgetInternal() { |
| 269 DCHECK(!layoutEmbeddedItem().showsUnavailablePluginIndicator()); | 278 DCHECK(!layoutEmbeddedItem().showsUnavailablePluginIndicator()); |
| 270 DCHECK(needsWidgetUpdate()); | 279 DCHECK(needsWidgetUpdate()); |
| 271 setNeedsWidgetUpdate(false); | 280 setNeedsWidgetUpdate(false); |
| 272 // TODO(schenney): crbug.com/572908 This should ASSERT isFinishedParsingChildr
en() instead. | 281 // TODO(schenney): crbug.com/572908 This should ASSERT |
| 282 // isFinishedParsingChildren() instead. |
| 273 if (!isFinishedParsingChildren()) { | 283 if (!isFinishedParsingChildren()) { |
| 274 dispatchErrorEvent(); | 284 dispatchErrorEvent(); |
| 275 return; | 285 return; |
| 276 } | 286 } |
| 277 | 287 |
| 278 // TODO(schenney): crbug.com/572908 I'm not sure it's ever possible to get int
o updateWidget during a | 288 // TODO(schenney): crbug.com/572908 I'm not sure it's ever possible to get |
| 279 // removal, but just in case we should avoid loading the frame to prevent secu
rity bugs. | 289 // into updateWidget during a removal, but just in case we should avoid |
| 290 // loading the frame to prevent security bugs. |
| 280 if (!SubframeLoadingDisabler::canLoadFrame(*this)) { | 291 if (!SubframeLoadingDisabler::canLoadFrame(*this)) { |
| 281 dispatchErrorEvent(); | 292 dispatchErrorEvent(); |
| 282 return; | 293 return; |
| 283 } | 294 } |
| 284 | 295 |
| 285 String url = this->url(); | 296 String url = this->url(); |
| 286 String serviceType = m_serviceType; | 297 String serviceType = m_serviceType; |
| 287 | 298 |
| 288 // TODO(schenney): crbug.com/572908 These should be joined into a PluginParame
ters class. | 299 // TODO(schenney): crbug.com/572908 These should be joined into a |
| 300 // PluginParameters class. |
| 289 Vector<String> paramNames; | 301 Vector<String> paramNames; |
| 290 Vector<String> paramValues; | 302 Vector<String> paramValues; |
| 291 parametersForPlugin(paramNames, paramValues, url, serviceType); | 303 parametersForPlugin(paramNames, paramValues, url, serviceType); |
| 292 | 304 |
| 293 // Note: url is modified above by parametersForPlugin. | 305 // Note: url is modified above by parametersForPlugin. |
| 294 if (!allowedToLoadFrameURL(url)) { | 306 if (!allowedToLoadFrameURL(url)) { |
| 295 dispatchErrorEvent(); | 307 dispatchErrorEvent(); |
| 296 return; | 308 return; |
| 297 } | 309 } |
| 298 | 310 |
| 299 // TODO(schenney): crbug.com/572908 Is it possible to get here without a layou
tObject | 311 // TODO(schenney): crbug.com/572908 Is it possible to get here without a |
| 300 // now that we don't have beforeload events? | 312 // layoutObject now that we don't have beforeload events? |
| 301 if (!layoutObject()) | 313 if (!layoutObject()) |
| 302 return; | 314 return; |
| 303 | 315 |
| 304 if (!hasValidClassId() || | 316 if (!hasValidClassId() || |
| 305 !requestObject(url, serviceType, paramNames, paramValues)) { | 317 !requestObject(url, serviceType, paramNames, paramValues)) { |
| 306 if (!url.isEmpty()) | 318 if (!url.isEmpty()) |
| 307 dispatchErrorEvent(); | 319 dispatchErrorEvent(); |
| 308 if (hasFallbackContent()) | 320 if (hasFallbackContent()) |
| 309 renderFallbackContent(); | 321 renderFallbackContent(); |
| 310 } | 322 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 const QualifiedName& HTMLObjectElement::subResourceAttributeName() const { | 356 const QualifiedName& HTMLObjectElement::subResourceAttributeName() const { |
| 345 return dataAttr; | 357 return dataAttr; |
| 346 } | 358 } |
| 347 | 359 |
| 348 const AtomicString HTMLObjectElement::imageSourceURL() const { | 360 const AtomicString HTMLObjectElement::imageSourceURL() const { |
| 349 return getAttribute(dataAttr); | 361 return getAttribute(dataAttr); |
| 350 } | 362 } |
| 351 | 363 |
| 352 // TODO(schenney): crbug.com/572908 Remove this hack. | 364 // TODO(schenney): crbug.com/572908 Remove this hack. |
| 353 void HTMLObjectElement::reattachFallbackContent() { | 365 void HTMLObjectElement::reattachFallbackContent() { |
| 354 // This can happen inside of attachLayoutTree() in the middle of a recalcStyle
so we need to | 366 // This can happen inside of attachLayoutTree() in the middle of a recalcStyle |
| 355 // reattach synchronously here. | 367 // so we need to reattach synchronously here. |
| 356 if (document().inStyleRecalc()) | 368 if (document().inStyleRecalc()) |
| 357 reattachLayoutTree(); | 369 reattachLayoutTree(); |
| 358 else | 370 else |
| 359 lazyReattachIfAttached(); | 371 lazyReattachIfAttached(); |
| 360 } | 372 } |
| 361 | 373 |
| 362 void HTMLObjectElement::renderFallbackContent() { | 374 void HTMLObjectElement::renderFallbackContent() { |
| 363 if (useFallbackContent()) | 375 if (useFallbackContent()) |
| 364 return; | 376 return; |
| 365 | 377 |
| 366 if (!isConnected()) | 378 if (!isConnected()) |
| 367 return; | 379 return; |
| 368 | 380 |
| 369 // Before we give up and use fallback content, check to see if this is a MIME
type issue. | 381 // Before we give up and use fallback content, check to see if this is a MIME |
| 382 // type issue. |
| 370 if (m_imageLoader && m_imageLoader->image() && | 383 if (m_imageLoader && m_imageLoader->image() && |
| 371 m_imageLoader->image()->getStatus() != Resource::LoadError) { | 384 m_imageLoader->image()->getStatus() != Resource::LoadError) { |
| 372 m_serviceType = m_imageLoader->image()->response().mimeType(); | 385 m_serviceType = m_imageLoader->image()->response().mimeType(); |
| 373 if (!isImageType()) { | 386 if (!isImageType()) { |
| 374 // If we don't think we have an image type anymore, then clear the image f
rom the loader. | 387 // If we don't think we have an image type anymore, then clear the image |
| 388 // from the loader. |
| 375 m_imageLoader->setImage(0); | 389 m_imageLoader->setImage(0); |
| 376 reattachFallbackContent(); | 390 reattachFallbackContent(); |
| 377 return; | 391 return; |
| 378 } | 392 } |
| 379 } | 393 } |
| 380 | 394 |
| 381 m_useFallbackContent = true; | 395 m_useFallbackContent = true; |
| 382 | 396 |
| 383 // TODO(schenney): crbug.com/572908 Style gets recalculated which is suboptima
l. | 397 // TODO(schenney): crbug.com/572908 Style gets recalculated which is |
| 398 // suboptimal. |
| 384 reattachFallbackContent(); | 399 reattachFallbackContent(); |
| 385 } | 400 } |
| 386 | 401 |
| 387 bool HTMLObjectElement::isExposed() const { | 402 bool HTMLObjectElement::isExposed() const { |
| 388 // http://www.whatwg.org/specs/web-apps/current-work/#exposed | 403 // http://www.whatwg.org/specs/web-apps/current-work/#exposed |
| 389 for (HTMLObjectElement* ancestor = | 404 for (HTMLObjectElement* ancestor = |
| 390 Traversal<HTMLObjectElement>::firstAncestor(*this); | 405 Traversal<HTMLObjectElement>::firstAncestor(*this); |
| 391 ancestor; | 406 ancestor; |
| 392 ancestor = Traversal<HTMLObjectElement>::firstAncestor(*ancestor)) { | 407 ancestor = Traversal<HTMLObjectElement>::firstAncestor(*ancestor)) { |
| 393 if (ancestor->isExposed()) | 408 if (ancestor->isExposed()) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 444 |
| 430 bool HTMLObjectElement::isInteractiveContent() const { | 445 bool HTMLObjectElement::isInteractiveContent() const { |
| 431 return fastHasAttribute(usemapAttr); | 446 return fastHasAttribute(usemapAttr); |
| 432 } | 447 } |
| 433 | 448 |
| 434 bool HTMLObjectElement::useFallbackContent() const { | 449 bool HTMLObjectElement::useFallbackContent() const { |
| 435 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent; | 450 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent; |
| 436 } | 451 } |
| 437 | 452 |
| 438 } // namespace blink | 453 } // namespace blink |
| OLD | NEW |