Chromium Code Reviews| Index: Source/core/html/HTMLObjectElement.cpp |
| diff --git a/Source/core/html/HTMLObjectElement.cpp b/Source/core/html/HTMLObjectElement.cpp |
| index 76d2709da0c1a3b12500a1c79257659dad30e836..97293af27fd2cd231f083975f36f06e7ac18f374 100644 |
| --- a/Source/core/html/HTMLObjectElement.cpp |
| +++ b/Source/core/html/HTMLObjectElement.cpp |
| @@ -98,22 +98,20 @@ void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicSt |
| size_t pos = m_serviceType.find(";"); |
| if (pos != kNotFound) |
| m_serviceType = m_serviceType.left(pos); |
| - if (renderer()) |
| - setNeedsWidgetUpdate(true); |
| + shouldReloadPluginOnAttributeChange(name); |
| } else if (name == dataAttr) { |
| m_url = stripLeadingAndTrailingHTMLSpaces(value); |
| - if (renderer()) { |
| + if (renderer() && isImageType()) { |
| setNeedsWidgetUpdate(true); |
| - if (isImageType()) { |
| - if (!m_imageLoader) |
| - m_imageLoader = adoptPtr(new HTMLImageLoader(this)); |
| - m_imageLoader->updateFromElementIgnoringPreviousError(); |
| - } |
| + if (!m_imageLoader) |
| + m_imageLoader = adoptPtr(new HTMLImageLoader(this)); |
| + m_imageLoader->updateFromElementIgnoringPreviousError(); |
| + } else { |
| + shouldReloadPluginOnAttributeChange(name); |
| } |
| } else if (name == classidAttr) { |
| m_classId = value; |
| - if (renderer()) |
| - setNeedsWidgetUpdate(true); |
| + shouldReloadPluginOnAttributeChange(name); |
| } else if (name == onbeforeloadAttr) { |
| setAttributeEventListener(EventTypeNames::beforeload, createAttributeEventListener(this, name, value)); |
| } else { |
| @@ -262,6 +260,30 @@ bool HTMLObjectElement::hasValidClassId() |
| return classId().isEmpty(); |
| } |
| +void HTMLObjectElement::shouldReloadPluginOnAttributeChange(const QualifiedName& name) |
|
esprehn
2014/01/16 23:23:05
should methods usually return a boolean, I think y
sof
2014/01/17 07:14:53
right, done.
|
| +{ |
| + // Following, |
| + // http://www.whatwg.org/specs/web-apps/current-work/#the-object-element |
| + // (Enumerated list below "Whenever one of the following conditions occur:") |
| + // |
| + // the updating of certain attributes should bring about "redetermination" |
| + // of what the element contains. |
| + bool needsInvalidation; |
| + if (name == typeAttr) { |
| + needsInvalidation = !fastHasAttribute(classidAttr) && !fastHasAttribute(dataAttr); |
| + } else if (name == dataAttr) { |
| + needsInvalidation = !fastHasAttribute(classidAttr); |
| + } else if (name == classidAttr) { |
| + needsInvalidation = true; |
| + } else { |
| + ASSERT_NOT_REACHED(); |
| + needsInvalidation = false; |
| + } |
| + setNeedsWidgetUpdate(true); |
| + if (needsInvalidation) |
| + setNeedsStyleRecalc(); |
| +} |
| + |
| // FIXME: This should be unified with HTMLEmbedElement::updateWidget and |
| // moved down into HTMLPluginElement.cpp |
| void HTMLObjectElement::updateWidgetInternal() |