Index: Source/core/css/MediaQueryListListener.h |
diff --git a/Source/core/css/MediaQueryListListener.h b/Source/core/css/MediaQueryListListener.h |
index d9299b0b3d650dd345c4febcb4dc8022ea23a282..ba2877695a1c4ee651a81a56e132d6378ff70b7a 100644 |
--- a/Source/core/css/MediaQueryListListener.h |
+++ b/Source/core/css/MediaQueryListListener.h |
@@ -22,6 +22,7 @@ |
#include "bindings/v8/ScriptState.h" |
#include "bindings/v8/ScriptValue.h" |
+#include "core/css/MediaQueryList.h" |
#include "platform/heap/Handle.h" |
#include "wtf/RefCounted.h" |
@@ -31,7 +32,7 @@ class MediaQueryList; |
// See http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface |
// FIXME: MediaQueryListListener should be implemented using callback interface |
-class MediaQueryListListener : public RefCountedWillBeGarbageCollectedFinalized<MediaQueryListListener> { |
+class MediaQueryListListener : public MediaQueryList::Listener { |
public: |
static PassRefPtrWillBeRawPtr<MediaQueryListListener> create(ScriptState* scriptState, const ScriptValue& value) |
{ |
@@ -41,21 +42,23 @@ public: |
} |
void call(); |
- // Used to keep the MediaQueryList alive and registered with the MediaQueryMatcher |
- // as long as the listener exists. |
- void setMediaQueryList(MediaQueryList* query) { m_query = query; } |
- void clearMediaQueryList() { m_query = nullptr; } |
+ virtual void mediaQueryChanged() { call(); } |
+ virtual MediaQueryListListener* isMediaQueryListListener() { return this; } |
bool operator==(const MediaQueryListListener& other) const { return m_function == other.m_function; } |
- |
- void trace(Visitor* visitor) { visitor->trace(m_query); } |
+ virtual bool equals(MediaQueryList::Listener* other) |
+ { |
+ MediaQueryListListener* otherListener = other->isMediaQueryListListener(); |
esprehn
2014/07/01 00:01:06
"is" methods shouldn't return a pointer.
cbiesinger
2014/07/01 00:12:09
Can I rename it "to" even without adding an assert
|
+ if (!otherListener) |
+ return false; |
+ return *this == *otherListener; |
+ } |
private: |
MediaQueryListListener(ScriptState*, const ScriptValue&); |
RefPtr<ScriptState> m_scriptState; |
ScriptValue m_function; |
- RefPtrWillBeMember<MediaQueryList> m_query; |
}; |
} |