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

Unified Diff: Source/core/html/HTMLSourceElement.h

Issue 287163010: Notify <picture> elements when a media query (potentially) changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review comments Created 6 years, 6 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: Source/core/html/HTMLSourceElement.h
diff --git a/Source/core/html/HTMLSourceElement.h b/Source/core/html/HTMLSourceElement.h
index 339c12a99af11064554671698340eb12d8e6fb4a..30a5b49639db62b04ea1851c5e8485308ee432a0 100644
--- a/Source/core/html/HTMLSourceElement.h
+++ b/Source/core/html/HTMLSourceElement.h
@@ -26,6 +26,7 @@
#ifndef HTMLSourceElement_h
#define HTMLSourceElement_h
+#include "core/css/MediaQueryListListener.h"
#include "core/html/HTMLElement.h"
#include "platform/Timer.h"
@@ -36,6 +37,20 @@ typedef EventSender<HTMLSourceElement> SourceEventSender;
class HTMLSourceElement FINAL : public HTMLElement {
public:
+ class Listener : public MediaQueryListListener {
esprehn 2014/07/02 21:15:42 Put this in the cpp file please. class Listener;
+ public:
+ explicit Listener(HTMLSourceElement* element) : m_element(element) { }
+ virtual void call() OVERRIDE
+ {
+ if (m_element)
+ m_element->notifyMediaQueryChanged();
+ }
+
+ void clearElement() { m_element = nullptr; }
+ private:
+ HTMLSourceElement* m_element;
sof 2014/07/02 21:22:18 RawPtrWillBeMember<> + add a trace() method which
+ };
+
DECLARE_NODE_FACTORY(HTMLSourceElement);
virtual ~HTMLSourceElement();
@@ -48,6 +63,8 @@ public:
void dispatchPendingEvent(SourceEventSender*);
+ bool mediaQueryMatches() const;
+
private:
explicit HTMLSourceElement(Document&);
@@ -55,6 +72,11 @@ private:
virtual void removedFrom(ContainerNode*) OVERRIDE;
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
+
+ void notifyMediaQueryChanged();
+
+ RefPtrWillBeRawPtr<MediaQueryList> m_mediaQueryList;
sof 2014/07/02 21:22:18 I think you need RefPtrWillBeMember<>, as you want
+ RefPtrWillBeRawPtr<Listener> m_listener;
sof 2014/07/02 21:22:18 RefPtrWillBeMember<>
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698