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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 break; | 79 break; |
80 } | 80 } |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 void MediaQueryList::documentDetached() | 84 void MediaQueryList::documentDetached() |
85 { | 85 { |
86 m_listeners.clear(); | 86 m_listeners.clear(); |
87 } | 87 } |
88 | 88 |
89 void MediaQueryList::mediaFeaturesChanged(WillBeHeapVector<RefPtrWillBeMember<Me
diaQueryListListener> >* listenersToNotify) | 89 void MediaQueryList::mediaFeaturesChanged(WillBeHeapVector<RefPtrWillBeMember<Me
diaQueryListListener> >* toNotify) |
90 { | 90 { |
91 m_matchesDirty = true; | 91 m_matchesDirty = true; |
92 if (!updateMatches()) | 92 if (!updateMatches()) |
93 return; | 93 return; |
94 for (ListenerList::const_iterator it = m_listeners.begin(), end = m_listener
s.end(); it != end; ++it) { | 94 for (ListenerList::const_iterator it = m_listeners.begin(), end = m_listener
s.end(); it != end; ++it) { |
95 listenersToNotify->append(*it); | 95 toNotify->append(*it); |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 bool MediaQueryList::updateMatches() | 99 bool MediaQueryList::updateMatches() |
100 { | 100 { |
101 m_matchesDirty = false; | 101 m_matchesDirty = false; |
102 if (m_matches != m_matcher->evaluate(m_media.get())) { | 102 if (m_matches != m_matcher->evaluate(m_media.get())) { |
103 m_matches = !m_matches; | 103 m_matches = !m_matches; |
104 return true; | 104 return true; |
105 } | 105 } |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 bool MediaQueryList::matches() | 109 bool MediaQueryList::matches() |
110 { | 110 { |
111 updateMatches(); | 111 updateMatches(); |
112 return m_matches; | 112 return m_matches; |
113 } | 113 } |
114 | 114 |
115 void MediaQueryList::trace(Visitor* visitor) | 115 void MediaQueryList::trace(Visitor* visitor) |
116 { | 116 { |
117 visitor->trace(m_matcher); | 117 visitor->trace(m_matcher); |
118 visitor->trace(m_media); | 118 visitor->trace(m_media); |
119 visitor->trace(m_listeners); | 119 visitor->trace(m_listeners); |
120 } | 120 } |
121 | 121 |
122 } | 122 } |
OLD | NEW |