OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |