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

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

Issue 290203002: <picture>: Update the <img> element when a <source> changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments addressed Created 6 years, 7 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/HTMLSourceElement.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/HTMLSourceElement.cpp
diff --git a/Source/core/html/HTMLSourceElement.cpp b/Source/core/html/HTMLSourceElement.cpp
index 6c613b47a50fc021c7edb8c8a910331f38f80fc6..7f7f52e42a26450eb4cbb89180239acb7cf4f901 100644
--- a/Source/core/html/HTMLSourceElement.cpp
+++ b/Source/core/html/HTMLSourceElement.cpp
@@ -29,6 +29,7 @@
#include "HTMLNames.h"
#include "core/events/EventSender.h"
#include "core/html/HTMLMediaElement.h"
+#include "core/html/HTMLPictureElement.h"
#include "platform/Logging.h"
using namespace std;
@@ -66,6 +67,8 @@ Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode
Element* parent = parentElement();
if (isHTMLMediaElement(parent))
toHTMLMediaElement(parent)->sourceWasAdded(this);
+ if (isHTMLPictureElement(parent))
+ toHTMLPictureElement(parent)->sourceOrMediaChanged();
return InsertionDone;
}
@@ -76,6 +79,8 @@ void HTMLSourceElement::removedFrom(ContainerNode* removalRoot)
parent = toElement(removalRoot);
if (isHTMLMediaElement(parent))
toHTMLMediaElement(parent)->sourceWasRemoved(this);
+ if (isHTMLPictureElement(parent))
+ toHTMLPictureElement(parent)->sourceOrMediaChanged();
HTMLElement::removedFrom(removalRoot);
}
@@ -118,4 +123,14 @@ bool HTMLSourceElement::isURLAttribute(const Attribute& attribute) const
return attribute.name() == srcAttr || HTMLElement::isURLAttribute(attribute);
}
+void HTMLSourceElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
+{
+ HTMLElement::parseAttribute(name, value);
+ if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) {
+ Element* parent = parentElement();
+ if (isHTMLPictureElement(parent))
+ toHTMLPictureElement(parent)->sourceOrMediaChanged();
+ }
+}
+
}
« no previous file with comments | « Source/core/html/HTMLSourceElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698