Chromium Code Reviews| Index: Source/core/html/HTMLObjectElement.cpp |
| diff --git a/Source/core/html/HTMLObjectElement.cpp b/Source/core/html/HTMLObjectElement.cpp |
| index c2751ebf6bf50e2cbe22c5aa2434900cc588c65c..14b88416900cbb91623331ffde31fd29e0de368a 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); |
| + reloadPluginOnAttributeChange(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 { |
| + reloadPluginOnAttributeChange(name); |
| } |
| } else if (name == classidAttr) { |
| m_classId = value; |
| - if (renderer()) |
| - setNeedsWidgetUpdate(true); |
| + reloadPluginOnAttributeChange(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::reloadPluginOnAttributeChange(const QualifiedName& name) |
| +{ |
| + // 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(); |
|
rune
2014/01/17 21:12:21
What's the recalc for? Is it the right tool here?
sof
2014/01/17 21:20:36
That's the prevalent mechanism for elements to tri
|
| +} |
| + |
| // FIXME: This should be unified with HTMLEmbedElement::updateWidget and |
| // moved down into HTMLPluginElement.cpp |
| void HTMLObjectElement::updateWidgetInternal() |