Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1122)

Unified Diff: Source/core/html/HTMLObjectElement.cpp

Issue 135103003: Updating <object> upon changing "data", "classid", "type" attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase + method rename Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLObjectElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « Source/core/html/HTMLObjectElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698