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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 void MediaQueryList::removeListener(MediaQueryListListener* listener) { | 78 void MediaQueryList::removeListener(MediaQueryListListener* listener) { |
79 if (!listener) | 79 if (!listener) |
80 return; | 80 return; |
81 | 81 |
82 m_listeners.remove(listener); | 82 m_listeners.remove(listener); |
83 } | 83 } |
84 | 84 |
85 bool MediaQueryList::hasPendingActivity() const { | 85 bool MediaQueryList::hasPendingActivity() const { |
86 return m_listeners.size() || hasEventListeners(EventTypeNames::change); | 86 return getExecutionContext() && |
| 87 (m_listeners.size() || hasEventListeners(EventTypeNames::change)); |
87 } | 88 } |
88 | 89 |
89 void MediaQueryList::contextDestroyed() { | 90 void MediaQueryList::contextDestroyed() { |
90 m_listeners.clear(); | 91 m_listeners.clear(); |
91 removeAllEventListeners(); | 92 removeAllEventListeners(); |
92 } | 93 } |
93 | 94 |
94 bool MediaQueryList::mediaFeaturesChanged( | 95 bool MediaQueryList::mediaFeaturesChanged( |
95 HeapVector<Member<MediaQueryListListener>>* listenersToNotify) { | 96 HeapVector<Member<MediaQueryListListener>>* listenersToNotify) { |
96 m_matchesDirty = true; | 97 m_matchesDirty = true; |
(...skipping 29 matching lines...) Expand all Loading... |
126 | 127 |
127 const AtomicString& MediaQueryList::interfaceName() const { | 128 const AtomicString& MediaQueryList::interfaceName() const { |
128 return EventTargetNames::MediaQueryList; | 129 return EventTargetNames::MediaQueryList; |
129 } | 130 } |
130 | 131 |
131 ExecutionContext* MediaQueryList::getExecutionContext() const { | 132 ExecutionContext* MediaQueryList::getExecutionContext() const { |
132 return SuspendableObject::getExecutionContext(); | 133 return SuspendableObject::getExecutionContext(); |
133 } | 134 } |
134 | 135 |
135 } // namespace blink | 136 } // namespace blink |
OLD | NEW |