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 "core/css/MediaValuesCached.h" | 5 #include "core/css/MediaValuesCached.h" |
6 | 6 |
7 #include "core/css/CSSPrimitiveValue.h" | 7 #include "core/css/CSSPrimitiveValue.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
10 #include "core/layout/LayoutObject.h" | 10 #include "core/layout/LayoutObject.h" |
11 #include "core/layout/api/LayoutViewItem.h" | 11 #include "core/layout/api/LayoutViewItem.h" |
| 12 #include "platform/graphics/ColorSpace.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
| 16 MediaValuesCached::MediaValuesCachedData::MediaValuesCachedData() |
| 17 : viewportWidth(0), |
| 18 viewportHeight(0), |
| 19 deviceWidth(0), |
| 20 deviceHeight(0), |
| 21 devicePixelRatio(1.0), |
| 22 colorBitsPerComponent(24), |
| 23 monochromeBitsPerComponent(0), |
| 24 primaryPointerType(PointerTypeNone), |
| 25 availablePointerTypes(PointerTypeNone), |
| 26 primaryHoverType(HoverTypeNone), |
| 27 availableHoverTypes(HoverTypeNone), |
| 28 defaultFontSize(16), |
| 29 threeDEnabled(false), |
| 30 strictMode(true), |
| 31 displayMode(WebDisplayModeBrowser), |
| 32 displayShape(DisplayShapeRect), |
| 33 colorGamut(ColorSpaceGamut::Unknown) {} |
| 34 |
15 MediaValuesCached::MediaValuesCachedData::MediaValuesCachedData( | 35 MediaValuesCached::MediaValuesCachedData::MediaValuesCachedData( |
16 Document& document) | 36 Document& document) |
17 : MediaValuesCached::MediaValuesCachedData() { | 37 : MediaValuesCached::MediaValuesCachedData() { |
18 ASSERT(isMainThread()); | 38 ASSERT(isMainThread()); |
19 LocalFrame* frame = MediaValues::frameFrom(document); | 39 LocalFrame* frame = MediaValues::frameFrom(document); |
20 // TODO(hiroshige): Clean up |frame->view()| conditions. | 40 // TODO(hiroshige): Clean up |frame->view()| conditions. |
21 ASSERT(!frame || frame->view()); | 41 ASSERT(!frame || frame->view()); |
22 if (frame && frame->view()) { | 42 if (frame && frame->view()) { |
23 ASSERT(frame->document() && !frame->document()->layoutViewItem().isNull()); | 43 ASSERT(frame->document() && !frame->document()->layoutViewItem().isNull()); |
24 | 44 |
(...skipping 12 matching lines...) Expand all Loading... |
37 primaryPointerType = MediaValues::calculatePrimaryPointerType(frame); | 57 primaryPointerType = MediaValues::calculatePrimaryPointerType(frame); |
38 availablePointerTypes = MediaValues::calculateAvailablePointerTypes(frame); | 58 availablePointerTypes = MediaValues::calculateAvailablePointerTypes(frame); |
39 primaryHoverType = MediaValues::calculatePrimaryHoverType(frame); | 59 primaryHoverType = MediaValues::calculatePrimaryHoverType(frame); |
40 availableHoverTypes = MediaValues::calculateAvailableHoverTypes(frame); | 60 availableHoverTypes = MediaValues::calculateAvailableHoverTypes(frame); |
41 defaultFontSize = MediaValues::calculateDefaultFontSize(frame); | 61 defaultFontSize = MediaValues::calculateDefaultFontSize(frame); |
42 threeDEnabled = MediaValues::calculateThreeDEnabled(frame); | 62 threeDEnabled = MediaValues::calculateThreeDEnabled(frame); |
43 strictMode = MediaValues::calculateStrictMode(frame); | 63 strictMode = MediaValues::calculateStrictMode(frame); |
44 displayMode = MediaValues::calculateDisplayMode(frame); | 64 displayMode = MediaValues::calculateDisplayMode(frame); |
45 mediaType = MediaValues::calculateMediaType(frame); | 65 mediaType = MediaValues::calculateMediaType(frame); |
46 displayShape = MediaValues::calculateDisplayShape(frame); | 66 displayShape = MediaValues::calculateDisplayShape(frame); |
| 67 colorGamut = MediaValues::calculateColorGamut(frame); |
47 } | 68 } |
48 } | 69 } |
49 | 70 |
50 MediaValuesCached* MediaValuesCached::create() { | 71 MediaValuesCached* MediaValuesCached::create() { |
51 return new MediaValuesCached(); | 72 return new MediaValuesCached(); |
52 } | 73 } |
53 | 74 |
54 MediaValuesCached* MediaValuesCached::create( | 75 MediaValuesCached* MediaValuesCached::create( |
55 const MediaValuesCachedData& data) { | 76 const MediaValuesCachedData& data) { |
56 return new MediaValuesCached(data); | 77 return new MediaValuesCached(data); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 void MediaValuesCached::overrideViewportDimensions(double width, | 173 void MediaValuesCached::overrideViewportDimensions(double width, |
153 double height) { | 174 double height) { |
154 m_data.viewportWidth = width; | 175 m_data.viewportWidth = width; |
155 m_data.viewportHeight = height; | 176 m_data.viewportHeight = height; |
156 } | 177 } |
157 | 178 |
158 DisplayShape MediaValuesCached::displayShape() const { | 179 DisplayShape MediaValuesCached::displayShape() const { |
159 return m_data.displayShape; | 180 return m_data.displayShape; |
160 } | 181 } |
161 | 182 |
| 183 ColorSpaceGamut MediaValuesCached::colorGamut() const { |
| 184 return m_data.colorGamut; |
| 185 } |
| 186 |
162 } // namespace blink | 187 } // namespace blink |
OLD | NEW |