Index: Source/core/html/HTMLImageElement.cpp |
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp |
index f8865cee2860b3afa49671d943b54a959f85b9da..e738685e6f1267e4894d29acbb622019399bce0d 100644 |
--- a/Source/core/html/HTMLImageElement.cpp |
+++ b/Source/core/html/HTMLImageElement.cpp |
@@ -346,6 +346,8 @@ Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode* |
{ |
if (!m_formWasSetByParser || NodeTraversal::highestAncestorOrSelf(*insertionPoint) != NodeTraversal::highestAncestorOrSelf(*m_form.get())) |
resetFormOwner(); |
+ if (m_listener) |
+ document().mediaQueryMatcher().addViewportListener(m_listener.get()); |
bool imageWasModified = false; |
if (RuntimeEnabledFeatures::pictureEnabled()) { |
@@ -368,6 +370,8 @@ void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) |
{ |
if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTraversal::highestAncestorOrSelf(*this)) |
resetFormOwner(); |
+ if (m_listener) |
+ document().mediaQueryMatcher().removeViewportListener(m_listener.get()); |
HTMLElement::removedFrom(insertionPoint); |
} |