| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/css/StyleMedia.h" | 27 #include "core/css/StyleMedia.h" |
| 28 | 28 |
| 29 #include "core/css/MediaList.h" | 29 #include "core/css/MediaList.h" |
| 30 #include "core/css/MediaQueryEvaluator.h" | 30 #include "core/css/MediaQueryEvaluator.h" |
| 31 #include "core/css/resolver/StyleResolver.h" | |
| 32 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 33 #include "core/frame/FrameView.h" | 32 #include "core/frame/FrameView.h" |
| 34 #include "core/frame/LocalFrame.h" | 33 #include "core/frame/LocalFrame.h" |
| 35 | 34 |
| 36 namespace WebCore { | 35 namespace WebCore { |
| 37 | 36 |
| 38 StyleMedia::StyleMedia(LocalFrame* frame) | 37 StyleMedia::StyleMedia(LocalFrame* frame) |
| 39 : DOMWindowProperty(frame) | 38 : DOMWindowProperty(frame) |
| 40 { | 39 { |
| 41 } | 40 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 53 { | 52 { |
| 54 if (!m_frame) | 53 if (!m_frame) |
| 55 return false; | 54 return false; |
| 56 | 55 |
| 57 Document* document = m_frame->document(); | 56 Document* document = m_frame->document(); |
| 58 ASSERT(document); | 57 ASSERT(document); |
| 59 Element* documentElement = document->documentElement(); | 58 Element* documentElement = document->documentElement(); |
| 60 if (!documentElement) | 59 if (!documentElement) |
| 61 return false; | 60 return false; |
| 62 | 61 |
| 63 StyleResolver& styleResolver = document->ensureStyleResolver(); | |
| 64 RefPtr<RenderStyle> rootStyle = styleResolver.styleForElement(documentElemen
t, 0 /*defaultParent*/, DisallowStyleSharing, MatchOnlyUserAgentRules); | |
| 65 | |
| 66 RefPtrWillBeRawPtr<MediaQuerySet> media = MediaQuerySet::create(); | 62 RefPtrWillBeRawPtr<MediaQuerySet> media = MediaQuerySet::create(); |
| 67 if (!media->set(query)) | 63 if (!media->set(query)) |
| 68 return false; | 64 return false; |
| 69 | 65 |
| 70 MediaQueryEvaluator screenEval(type(), m_frame, rootStyle.get()); | 66 MediaQueryEvaluator screenEval(type(), m_frame); |
| 71 return screenEval.eval(media.get()); | 67 return screenEval.eval(media.get()); |
| 72 } | 68 } |
| 73 | 69 |
| 74 } // namespace WebCore | 70 } // namespace WebCore |
| OLD | NEW |