Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: Source/core/css/MediaQueryMatcher.cpp

Issue 335313003: MediaQueryEvaluator getting mediaType from MediaValues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // Take a ref to each MediaQueryList as removing the listeners in documentDe tached 46 // Take a ref to each MediaQueryList as removing the listeners in documentDe tached
47 // could release the last ref and mutate the m_mediaLists. 47 // could release the last ref and mutate the m_mediaLists.
48 WillBeHeapVector<RefPtrWillBeMember<MediaQueryList> > lists; 48 WillBeHeapVector<RefPtrWillBeMember<MediaQueryList> > lists;
49 copyToVector(m_mediaLists, lists); 49 copyToVector(m_mediaLists, lists);
50 50
51 for (size_t i = 0; i < lists.size(); ++i) 51 for (size_t i = 0; i < lists.size(); ++i)
52 lists[i]->documentDetached(); 52 lists[i]->documentDetached();
53 } 53 }
54 54
55 AtomicString MediaQueryMatcher::mediaType() const
56 {
57 if (!m_document || !m_document->frame() || !m_document->frame()->view())
58 return nullAtom;
59
60 return m_document->frame()->view()->mediaType();
61 }
62
63 PassOwnPtr<MediaQueryEvaluator> MediaQueryMatcher::createEvaluator() const 55 PassOwnPtr<MediaQueryEvaluator> MediaQueryMatcher::createEvaluator() const
64 { 56 {
65 if (!m_document || !m_document->frame()) 57 if (!m_document || !m_document->frame())
66 return nullptr; 58 return nullptr;
67 59
68 return adoptPtr(new MediaQueryEvaluator(mediaType(), m_document->frame())); 60 return adoptPtr(new MediaQueryEvaluator(m_document->frame()));
69 } 61 }
70 62
71 bool MediaQueryMatcher::evaluate(const MediaQuerySet* media) 63 bool MediaQueryMatcher::evaluate(const MediaQuerySet* media)
72 { 64 {
73 if (!media) 65 if (!media)
74 return false; 66 return false;
75 67
76 if (m_evaluator) 68 if (m_evaluator)
77 return m_evaluator->eval(media); 69 return m_evaluator->eval(media);
78 70
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 listenersToNotify[i]->call(); 119 listenersToNotify[i]->call();
128 } 120 }
129 121
130 void MediaQueryMatcher::trace(Visitor* visitor) 122 void MediaQueryMatcher::trace(Visitor* visitor)
131 { 123 {
132 visitor->trace(m_document); 124 visitor->trace(m_document);
133 visitor->trace(m_mediaLists); 125 visitor->trace(m_mediaLists);
134 } 126 }
135 127
136 } 128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698