| 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 20 matching lines...) Expand all Loading... |
| 31 class MediaQueryEvaluator; | 31 class MediaQueryEvaluator; |
| 32 class MediaQueryMatcher; | 32 class MediaQueryMatcher; |
| 33 class MediaQuerySet; | 33 class MediaQuerySet; |
| 34 | 34 |
| 35 // MediaQueryList interface is specified at http://dev.w3.org/csswg/cssom-view/#
the-mediaquerylist-interface | 35 // MediaQueryList interface is specified at http://dev.w3.org/csswg/cssom-view/#
the-mediaquerylist-interface |
| 36 // The objects of this class are returned by window.matchMedia. They may be used
to | 36 // The objects of this class are returned by window.matchMedia. They may be used
to |
| 37 // retrieve the current value of the given media query and to add/remove listene
rs that | 37 // retrieve the current value of the given media query and to add/remove listene
rs that |
| 38 // will be called whenever the value of the query changes. | 38 // will be called whenever the value of the query changes. |
| 39 | 39 |
| 40 class MediaQueryList FINAL : public RefCountedWillBeGarbageCollected<MediaQueryL
ist> { | 40 class MediaQueryList FINAL : public RefCountedWillBeGarbageCollected<MediaQueryL
ist> { |
| 41 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(MediaQueryList); | |
| 42 public: | 41 public: |
| 43 static PassRefPtrWillBeRawPtr<MediaQueryList> create(PassRefPtrWillBeRawPtr<
MediaQueryMatcher>, PassRefPtrWillBeRawPtr<MediaQuerySet>, bool); | 42 static PassRefPtrWillBeRawPtr<MediaQueryList> create(PassRefPtrWillBeRawPtr<
MediaQueryMatcher>, PassRefPtrWillBeRawPtr<MediaQuerySet>); |
| 43 virtual ~MediaQueryList(); |
| 44 |
| 44 String media() const; | 45 String media() const; |
| 45 bool matches(); | 46 bool matches(); |
| 46 | 47 |
| 47 void addListener(PassRefPtrWillBeRawPtr<MediaQueryListListener>); | 48 void addListener(PassRefPtrWillBeRawPtr<MediaQueryListListener>); |
| 48 void removeListener(PassRefPtrWillBeRawPtr<MediaQueryListListener>); | 49 void removeListener(PassRefPtrWillBeRawPtr<MediaQueryListListener>); |
| 49 | 50 |
| 50 bool evaluate(MediaQueryEvaluator*); | 51 void mediaChanged(WillBeHeapVector<RefPtrWillBeMember<MediaQueryListListener
> >* toNotify); |
| 51 | 52 |
| 52 void trace(Visitor*); | 53 void trace(Visitor*); |
| 53 | 54 |
| 55 void documentDetached(); |
| 56 |
| 54 private: | 57 private: |
| 55 MediaQueryList(PassRefPtrWillBeRawPtr<MediaQueryMatcher>, PassRefPtrWillBeRa
wPtr<MediaQuerySet>, bool matches); | 58 MediaQueryList(PassRefPtrWillBeRawPtr<MediaQueryMatcher>, PassRefPtrWillBeRa
wPtr<MediaQuerySet>); |
| 56 void setMatches(bool); | 59 |
| 60 bool updateMatches(); |
| 57 | 61 |
| 58 RefPtrWillBeMember<MediaQueryMatcher> m_matcher; | 62 RefPtrWillBeMember<MediaQueryMatcher> m_matcher; |
| 59 RefPtrWillBeMember<MediaQuerySet> m_media; | 63 RefPtrWillBeMember<MediaQuerySet> m_media; |
| 60 unsigned m_evaluationRound; // Indicates if the query has been evaluated aft
er the last style selector change. | 64 typedef HeapListHashSet<RefPtrWillBePersistent<MediaQueryListListener> > Lis
tenerList; |
| 61 unsigned m_changeRound; // Used to know if the query has changed in the last
style selector change. | 65 ListenerList m_listeners; |
| 66 bool m_matchesDirty; |
| 62 bool m_matches; | 67 bool m_matches; |
| 63 }; | 68 }; |
| 64 | 69 |
| 65 } | 70 } |
| 66 | 71 |
| 67 #endif // MediaQueryList_h | 72 #endif // MediaQueryList_h |
| OLD | NEW |