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

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

Issue 2256533002: Remove MediaQueryList listener from removed HTMLSourceElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 years, 3 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
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 cab316648a46ec8a9b4c3be5ea27dd641e07bafc..17193faaebff93ba93c28d0681882a4c2b7f71d7 100644
--- a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
@@ -40,6 +40,7 @@
#include "core/html/HTMLCanvasElement.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLImageFallbackHelper.h"
+#include "core/html/HTMLPictureElement.h"
#include "core/html/HTMLSourceElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/html/parser/HTMLSrcsetParser.h"
@@ -377,6 +378,9 @@ Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode*
resetFormOwner();
if (m_listener)
document().mediaQueryMatcher().addViewportListener(m_listener);
+ Node* parent = parentNode();
+ if (parent && isHTMLPictureElement(*parent))
+ toHTMLPictureElement(parent)->addListenerToSourceChildren();
bool imageWasModified = false;
if (document().isActive()) {
@@ -399,8 +403,12 @@ void HTMLImageElement::removedFrom(ContainerNode* insertionPoint)
{
if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTraversal::highestAncestorOrSelf(*this))
resetFormOwner();
- if (m_listener)
+ if (m_listener) {
document().mediaQueryMatcher().removeViewportListener(m_listener);
+ Node* parent = parentNode();
+ if (parent && isHTMLPictureElement(*parent))
+ toHTMLPictureElement(parent)->removeListenerFromSourceChildren();
+ }
HTMLElement::removedFrom(insertionPoint);
}

Powered by Google App Engine
This is Rietveld 408576698