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

Unified Diff: Source/core/css/MediaQueryMatcher.cpp

Issue 396283004: Make the MediaQueryList listener an EventListener (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . 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 | « Source/core/css/MediaQueryListTest.cpp ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/MediaQueryMatcher.cpp
diff --git a/Source/core/css/MediaQueryMatcher.cpp b/Source/core/css/MediaQueryMatcher.cpp
index ead99221953487f6e158042d983311704639fadd..429d4e9e38e9b61b8e21fbfd7e3850ffacb32a4b 100644
--- a/Source/core/css/MediaQueryMatcher.cpp
+++ b/Source/core/css/MediaQueryMatcher.cpp
@@ -23,6 +23,7 @@
#include "core/css/MediaList.h"
#include "core/css/MediaQueryEvaluator.h"
#include "core/css/MediaQueryList.h"
+#include "core/css/MediaQueryListEvent.h"
#include "core/css/MediaQueryListListener.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Document.h"
@@ -121,8 +122,13 @@ void MediaQueryMatcher::mediaFeaturesChanged()
return;
WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener> > listenersToNotify;
- for (MediaQueryListSet::iterator it = m_mediaLists.begin(); it != m_mediaLists.end(); ++it)
- (*it)->mediaFeaturesChanged(&listenersToNotify);
+ for (MediaQueryListSet::iterator it = m_mediaLists.begin(); it != m_mediaLists.end(); ++it) {
+ if ((*it)->mediaFeaturesChanged(&listenersToNotify)) {
+ RefPtrWillBeRawPtr<Event> event(MediaQueryListEvent::create(*it));
+ event->setTarget(*it);
+ m_document->enqueueUniqueAnimationFrameEvent(event);
+ }
+ }
m_document->enqueueMediaQueryChangeListeners(listenersToNotify);
}
« no previous file with comments | « Source/core/css/MediaQueryListTest.cpp ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698