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

Side by Side Diff: Source/core/css/MediaQueryMatcher.cpp

Issue 369423002: Have srcset respond to viewport changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Haraken's comments Created 6 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 m_mediaLists.add(query); 93 m_mediaLists.add(query);
94 } 94 }
95 95
96 void MediaQueryMatcher::removeMediaQueryList(MediaQueryList* query) 96 void MediaQueryMatcher::removeMediaQueryList(MediaQueryList* query)
97 { 97 {
98 if (!m_document) 98 if (!m_document)
99 return; 99 return;
100 m_mediaLists.remove(query); 100 m_mediaLists.remove(query);
101 } 101 }
102 102
103 void MediaQueryMatcher::addViewportListener(MediaQueryListListener* listener)
104 {
105 if (!m_document)
106 return;
107 m_viewportListeners.add(listener);
108 }
109
110 void MediaQueryMatcher::removeViewportListener(MediaQueryListListener* listener)
111 {
112 if (!m_document)
113 return;
114 m_viewportListeners.remove(listener);
115 }
116
103 void MediaQueryMatcher::mediaFeaturesChanged() 117 void MediaQueryMatcher::mediaFeaturesChanged()
104 { 118 {
105 if (!m_document) 119 if (!m_document)
106 return; 120 return;
107 121
108 WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener> > listenersToNot ify; 122 WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener> > listenersToNot ify;
109 for (MediaQueryListSet::iterator it = m_mediaLists.begin(); it != m_mediaLis ts.end(); ++it) 123 for (MediaQueryListSet::iterator it = m_mediaLists.begin(); it != m_mediaLis ts.end(); ++it)
110 (*it)->mediaFeaturesChanged(&listenersToNotify); 124 (*it)->mediaFeaturesChanged(&listenersToNotify);
125 m_document->enqueueMediaQueryChangeListeners(listenersToNotify);
126 }
127
128 void MediaQueryMatcher::viewportChanged()
129 {
130 if (!m_document)
131 return;
132
133 WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener> > listenersToNot ify;
134 for (ViewportListenerSet::iterator it = m_viewportListeners.begin(); it != m _viewportListeners.end(); ++it)
135 listenersToNotify.append(*it);
111 136
112 m_document->enqueueMediaQueryChangeListeners(listenersToNotify); 137 m_document->enqueueMediaQueryChangeListeners(listenersToNotify);
113 } 138 }
114 139
115 void MediaQueryMatcher::trace(Visitor* visitor) 140 void MediaQueryMatcher::trace(Visitor* visitor)
116 { 141 {
117 #if ENABLE(OILPAN) 142 #if ENABLE(OILPAN)
118 visitor->trace(m_document); 143 visitor->trace(m_document);
119 visitor->trace(m_mediaLists); 144 visitor->trace(m_mediaLists);
120 #endif 145 #endif
121 } 146 }
122 147
123 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698