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

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

Issue 455333002: ViewportChangeListener deregister and reregister on DOM changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added a test Created 6 years, 4 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 | « LayoutTests/fast/dom/HTMLImageElement/image-srcset-deregistration-after-move-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « LayoutTests/fast/dom/HTMLImageElement/image-srcset-deregistration-after-move-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698