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 23 matching lines...) Expand all Loading... |
34 class MediaQuerySet; | 34 class MediaQuerySet; |
35 | 35 |
36 // MediaQueryMatcher class is responsible for keeping a vector of pairs | 36 // MediaQueryMatcher class is responsible for keeping a vector of pairs |
37 // MediaQueryList x MediaQueryListListener. It is responsible for evaluating the
queries | 37 // MediaQueryList x MediaQueryListListener. It is responsible for evaluating the
queries |
38 // whenever it is needed and to call the listeners if the corresponding query ha
s changed. | 38 // whenever it is needed and to call the listeners if the corresponding query ha
s changed. |
39 // The listeners must be called in the very same order in which they have been a
dded. | 39 // The listeners must be called in the very same order in which they have been a
dded. |
40 | 40 |
41 class CORE_EXPORT MediaQueryMatcher final : public GarbageCollectedFinalized<Med
iaQueryMatcher> { | 41 class CORE_EXPORT MediaQueryMatcher final : public GarbageCollectedFinalized<Med
iaQueryMatcher> { |
42 WTF_MAKE_NONCOPYABLE(MediaQueryMatcher); | 42 WTF_MAKE_NONCOPYABLE(MediaQueryMatcher); |
43 public: | 43 public: |
44 static RawPtr<MediaQueryMatcher> create(Document&); | 44 static MediaQueryMatcher* create(Document&); |
45 ~MediaQueryMatcher(); | 45 ~MediaQueryMatcher(); |
46 | 46 |
47 void documentDetached(); | 47 void documentDetached(); |
48 | 48 |
49 void addMediaQueryList(MediaQueryList*); | 49 void addMediaQueryList(MediaQueryList*); |
50 void removeMediaQueryList(MediaQueryList*); | 50 void removeMediaQueryList(MediaQueryList*); |
51 | 51 |
52 void addViewportListener(RawPtr<MediaQueryListListener>); | 52 void addViewportListener(MediaQueryListListener*); |
53 void removeViewportListener(RawPtr<MediaQueryListListener>); | 53 void removeViewportListener(MediaQueryListListener*); |
54 | 54 |
55 RawPtr<MediaQueryList> matchMedia(const String&); | 55 MediaQueryList* matchMedia(const String&); |
56 | 56 |
57 void mediaFeaturesChanged(); | 57 void mediaFeaturesChanged(); |
58 void viewportChanged(); | 58 void viewportChanged(); |
59 bool evaluate(const MediaQuerySet*); | 59 bool evaluate(const MediaQuerySet*); |
60 | 60 |
61 DECLARE_TRACE(); | 61 DECLARE_TRACE(); |
62 | 62 |
63 private: | 63 private: |
64 explicit MediaQueryMatcher(Document&); | 64 explicit MediaQueryMatcher(Document&); |
65 | 65 |
66 RawPtr<MediaQueryEvaluator> createEvaluator() const; | 66 MediaQueryEvaluator* createEvaluator() const; |
67 | 67 |
68 Member<Document> m_document; | 68 Member<Document> m_document; |
69 Member<MediaQueryEvaluator> m_evaluator; | 69 Member<MediaQueryEvaluator> m_evaluator; |
70 | 70 |
71 using MediaQueryListSet = HeapLinkedHashSet<WeakMember<MediaQueryList>>; | 71 using MediaQueryListSet = HeapLinkedHashSet<WeakMember<MediaQueryList>>; |
72 MediaQueryListSet m_mediaLists; | 72 MediaQueryListSet m_mediaLists; |
73 | 73 |
74 using ViewportListenerSet = HeapLinkedHashSet<Member<MediaQueryListListener>
>; | 74 using ViewportListenerSet = HeapLinkedHashSet<Member<MediaQueryListListener>
>; |
75 ViewportListenerSet m_viewportListeners; | 75 ViewportListenerSet m_viewportListeners; |
76 }; | 76 }; |
77 | 77 |
78 } // namespace blink | 78 } // namespace blink |
79 | 79 |
80 #endif // MediaQueryMatcher_h | 80 #endif // MediaQueryMatcher_h |
OLD | NEW |