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 22 matching lines...) Expand all Loading... |
33 class MediaQueryListListener; | 33 class MediaQueryListListener; |
34 class MediaQueryEvaluator; | 34 class MediaQueryEvaluator; |
35 class MediaQuerySet; | 35 class MediaQuerySet; |
36 | 36 |
37 // MediaQueryMatcher class is responsible for keeping a vector of pairs | 37 // MediaQueryMatcher class is responsible for keeping a vector of pairs |
38 // MediaQueryList x MediaQueryListListener. It is responsible for evaluating the
queries | 38 // MediaQueryList x MediaQueryListListener. It is responsible for evaluating the
queries |
39 // whenever it is needed and to call the listeners if the corresponding query ha
s changed. | 39 // whenever it is needed and to call the listeners if the corresponding query ha
s changed. |
40 // The listeners must be called in the very same order in which they have been a
dded. | 40 // The listeners must be called in the very same order in which they have been a
dded. |
41 | 41 |
42 class MediaQueryMatcher FINAL : public RefCountedWillBeGarbageCollected<MediaQue
ryMatcher> { | 42 class MediaQueryMatcher FINAL : public RefCountedWillBeGarbageCollected<MediaQue
ryMatcher> { |
| 43 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(MediaQueryMatcher); |
43 public: | 44 public: |
44 static PassRefPtrWillBeRawPtr<MediaQueryMatcher> create(Document* document)
{ return adoptRefWillBeNoop(new MediaQueryMatcher(document)); } | 45 static PassRefPtrWillBeRawPtr<MediaQueryMatcher> create(Document* document)
{ return adoptRefWillBeNoop(new MediaQueryMatcher(document)); } |
45 ~MediaQueryMatcher(); | |
46 void documentDestroyed(); | 46 void documentDestroyed(); |
47 | 47 |
48 void addListener(PassRefPtrWillBeRawPtr<MediaQueryListListener>, PassRefPtrW
illBeRawPtr<MediaQueryList>); | 48 void addListener(PassRefPtrWillBeRawPtr<MediaQueryListListener>, PassRefPtrW
illBeRawPtr<MediaQueryList>); |
49 void removeListener(MediaQueryListListener*, MediaQueryList*); | 49 void removeListener(MediaQueryListListener*, MediaQueryList*); |
50 | 50 |
51 PassRefPtrWillBeRawPtr<MediaQueryList> matchMedia(const String&); | 51 PassRefPtrWillBeRawPtr<MediaQueryList> matchMedia(const String&); |
52 | 52 |
53 unsigned evaluationRound() const { return m_evaluationRound; } | 53 unsigned evaluationRound() const { return m_evaluationRound; } |
54 void styleResolverChanged(); | 54 void styleResolverChanged(); |
55 bool evaluate(const MediaQuerySet*); | 55 bool evaluate(const MediaQuerySet*); |
(...skipping 26 matching lines...) Expand all Loading... |
82 | 82 |
83 // This value is incremented at style selector changes. | 83 // This value is incremented at style selector changes. |
84 // It is used to avoid evaluating queries more then once and to make sure | 84 // It is used to avoid evaluating queries more then once and to make sure |
85 // that a media query result change is notified exactly once. | 85 // that a media query result change is notified exactly once. |
86 unsigned m_evaluationRound; | 86 unsigned m_evaluationRound; |
87 }; | 87 }; |
88 | 88 |
89 } | 89 } |
90 | 90 |
91 #endif // MediaQueryMatcher_h | 91 #endif // MediaQueryMatcher_h |
OLD | NEW |