| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 DCHECK(!document_ || document_->GetFrame() || !evaluator_); | 59 DCHECK(!document_ || document_->GetFrame() || !evaluator_); |
| 60 | 60 |
| 61 if (!media) | 61 if (!media) |
| 62 return false; | 62 return false; |
| 63 | 63 |
| 64 // Cache the evaluator to avoid allocating one per evaluation. | 64 // Cache the evaluator to avoid allocating one per evaluation. |
| 65 if (!evaluator_) | 65 if (!evaluator_) |
| 66 evaluator_ = CreateEvaluator(); | 66 evaluator_ = CreateEvaluator(); |
| 67 | 67 |
| 68 if (evaluator_) | 68 if (evaluator_) |
| 69 return evaluator_->Eval(media); | 69 return evaluator_->Eval(*media); |
| 70 | 70 |
| 71 return false; | 71 return false; |
| 72 } | 72 } |
| 73 | 73 |
| 74 MediaQueryList* MediaQueryMatcher::MatchMedia(const String& query) { | 74 MediaQueryList* MediaQueryMatcher::MatchMedia(const String& query) { |
| 75 if (!document_) | 75 if (!document_) |
| 76 return nullptr; | 76 return nullptr; |
| 77 | 77 |
| 78 MediaQuerySet* media = MediaQuerySet::Create(query); | 78 RefPtr<MediaQuerySet> media = MediaQuerySet::Create(query); |
| 79 return MediaQueryList::Create(document_, this, media); | 79 return MediaQueryList::Create(document_, this, media); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void MediaQueryMatcher::AddMediaQueryList(MediaQueryList* query) { | 82 void MediaQueryMatcher::AddMediaQueryList(MediaQueryList* query) { |
| 83 if (!document_) | 83 if (!document_) |
| 84 return; | 84 return; |
| 85 media_lists_.insert(query); | 85 media_lists_.insert(query); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void MediaQueryMatcher::RemoveMediaQueryList(MediaQueryList* query) { | 88 void MediaQueryMatcher::RemoveMediaQueryList(MediaQueryList* query) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 DEFINE_TRACE(MediaQueryMatcher) { | 133 DEFINE_TRACE(MediaQueryMatcher) { |
| 134 visitor->Trace(document_); | 134 visitor->Trace(document_); |
| 135 visitor->Trace(evaluator_); | 135 visitor->Trace(evaluator_); |
| 136 visitor->Trace(media_lists_); | 136 visitor->Trace(media_lists_); |
| 137 visitor->Trace(viewport_listeners_); | 137 visitor->Trace(viewport_listeners_); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |