| Index: third_party/WebKit/Source/core/html/HTMLImageElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
|
| index 6c492e273da854fdbb0747be8ecc5d36c61fde20..b9033e31d7925222a33d1dbd16abb4df5c32aa06 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
|
| @@ -269,7 +269,7 @@ void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
|
| if (text && text->textContent() != value)
|
| text->setTextContent(altText());
|
| }
|
| - } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) {
|
| + } else if (name == srcAttr || ((name == srcsetAttr || name == sizesAttr) && (value != oldValue))) {
|
| selectSourceURL(ImageLoader::UpdateIgnorePreviousError);
|
| } else if (name == usemapAttr) {
|
| setIsLink(!value.isNull());
|
| @@ -399,19 +399,26 @@ Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode*
|
|
|
| // If we have been inserted from a layoutObject-less document,
|
| // our loader may have not fetched the image, so do it now.
|
| - if ((insertionPoint->inDocument() && !imageLoader().image()) || imageWasModified)
|
| + if ((insertionPoint->inDocument() && !imageLoader().image()) || imageWasModified || isHTMLPictureElement(insertionPoint))
|
| imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_referrerPolicy);
|
|
|
| return HTMLElement::insertedInto(insertionPoint);
|
| }
|
|
|
| -void HTMLImageElement::removedFrom(ContainerNode* insertionPoint)
|
| +void HTMLImageElement::removedFrom(ContainerNode* insertionPoint, Node* next)
|
| {
|
| if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTraversal::highestAncestorOrSelf(*this))
|
| resetFormOwner();
|
| if (m_listener)
|
| document().mediaQueryMatcher().removeViewportListener(m_listener);
|
| - HTMLElement::removedFrom(insertionPoint);
|
| + HTMLElement::removedFrom(insertionPoint, next);
|
| +
|
| + if (isHTMLPictureElement(insertionPoint)) {
|
| + // This is diverging from the spec because we don't want to trigger spurious downloads of fallback images.
|
| + // See https://github.com/ResponsiveImagesCG/picture-element/issues/274
|
| + m_bestFitImageURL = AtomicString();
|
| + imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_referrerPolicy);
|
| + }
|
| }
|
|
|
| int HTMLImageElement::width()
|
|
|