OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/css/MediaValuesCached.h" | 6 #include "core/css/MediaValuesCached.h" |
7 | 7 |
8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 m_data.viewportWidth = calculateViewportWidth(frame); | 53 m_data.viewportWidth = calculateViewportWidth(frame); |
54 m_data.viewportHeight = calculateViewportHeight(frame); | 54 m_data.viewportHeight = calculateViewportHeight(frame); |
55 m_data.deviceWidth = calculateDeviceWidth(frame); | 55 m_data.deviceWidth = calculateDeviceWidth(frame); |
56 m_data.deviceHeight = calculateDeviceHeight(frame); | 56 m_data.deviceHeight = calculateDeviceHeight(frame); |
57 m_data.devicePixelRatio = calculateDevicePixelRatio(frame); | 57 m_data.devicePixelRatio = calculateDevicePixelRatio(frame); |
58 m_data.colorBitsPerComponent = calculateColorBitsPerComponent(frame); | 58 m_data.colorBitsPerComponent = calculateColorBitsPerComponent(frame); |
59 m_data.monochromeBitsPerComponent = calculateMonochromeBitsPerComponent(fram
e); | 59 m_data.monochromeBitsPerComponent = calculateMonochromeBitsPerComponent(fram
e); |
60 m_data.pointer = calculateLeastCapablePrimaryPointerDeviceType(frame); | 60 m_data.pointer = calculateLeastCapablePrimaryPointerDeviceType(frame); |
61 m_data.defaultFontSize = calculateDefaultFontSize(frame); | 61 m_data.defaultFontSize = calculateDefaultFontSize(frame); |
62 m_data.threeDEnabled = calculateThreeDEnabled(frame); | 62 m_data.threeDEnabled = calculateThreeDEnabled(frame); |
63 m_data.scanMediaType = calculateScanMediaType(frame); | |
64 m_data.screenMediaType = calculateScreenMediaType(frame); | |
65 m_data.printMediaType = calculatePrintMediaType(frame); | |
66 m_data.strictMode = calculateStrictMode(frame); | 63 m_data.strictMode = calculateStrictMode(frame); |
| 64 const String mediaType = calculateMediaType(frame); |
| 65 if (!mediaType.isEmpty()) |
| 66 m_data.mediaType = mediaType.isolatedCopy(); |
67 } | 67 } |
68 | 68 |
69 MediaValuesCached::MediaValuesCached(const MediaValuesCachedData& data) | 69 MediaValuesCached::MediaValuesCached(const MediaValuesCachedData& data) |
70 : m_data(data) | 70 : m_data(data) |
71 { | 71 { |
72 } | 72 } |
73 | 73 |
74 PassRefPtr<MediaValues> MediaValuesCached::copy() const | 74 PassRefPtr<MediaValues> MediaValuesCached::copy() const |
75 { | 75 { |
76 return adoptRef(new MediaValuesCached(m_data)); | 76 return adoptRef(new MediaValuesCached(m_data)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 MediaValues::PointerDeviceType MediaValuesCached::pointer() const | 129 MediaValues::PointerDeviceType MediaValuesCached::pointer() const |
130 { | 130 { |
131 return m_data.pointer; | 131 return m_data.pointer; |
132 } | 132 } |
133 | 133 |
134 bool MediaValuesCached::threeDEnabled() const | 134 bool MediaValuesCached::threeDEnabled() const |
135 { | 135 { |
136 return m_data.threeDEnabled; | 136 return m_data.threeDEnabled; |
137 } | 137 } |
138 | 138 |
139 bool MediaValuesCached::scanMediaType() const | |
140 { | |
141 return m_data.scanMediaType; | |
142 } | |
143 | |
144 bool MediaValuesCached::screenMediaType() const | |
145 { | |
146 return m_data.screenMediaType; | |
147 } | |
148 | |
149 bool MediaValuesCached::printMediaType() const | |
150 { | |
151 return m_data.printMediaType; | |
152 } | |
153 | |
154 bool MediaValuesCached::strictMode() const | 139 bool MediaValuesCached::strictMode() const |
155 { | 140 { |
156 return m_data.strictMode; | 141 return m_data.strictMode; |
157 } | 142 } |
| 143 const String MediaValuesCached::mediaType() const |
| 144 { |
| 145 return m_data.mediaType; |
| 146 } |
158 | 147 |
159 Document* MediaValuesCached::document() const | 148 Document* MediaValuesCached::document() const |
160 { | 149 { |
161 return 0; | 150 return 0; |
162 } | 151 } |
163 | 152 |
164 bool MediaValuesCached::hasValues() const | 153 bool MediaValuesCached::hasValues() const |
165 { | 154 { |
166 return true; | 155 return true; |
167 } | 156 } |
168 | 157 |
169 } // namespace | 158 } // namespace |
OLD | NEW |