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/MediaValues.h" | 5 #include "core/css/MediaValues.h" |
6 | 6 |
7 #include "core/css/CSSHelper.h" | 7 #include "core/css/CSSHelper.h" |
8 #include "core/css/MediaValuesCached.h" | 8 #include "core/css/MediaValuesCached.h" |
9 #include "core/css/MediaValuesDynamic.h" | 9 #include "core/css/MediaValuesDynamic.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
11 #include "core/dom/Element.h" | 11 #include "core/dom/Element.h" |
12 #include "core/frame/FrameHost.h" | 12 #include "core/frame/FrameHost.h" |
13 #include "core/frame/FrameView.h" | 13 #include "core/frame/FrameView.h" |
14 #include "core/frame/LocalFrame.h" | 14 #include "core/frame/LocalFrame.h" |
15 #include "core/frame/Settings.h" | 15 #include "core/frame/Settings.h" |
16 #include "core/html/imports/HTMLImportsController.h" | 16 #include "core/html/imports/HTMLImportsController.h" |
17 #include "core/layout/LayoutObject.h" | 17 #include "core/layout/LayoutObject.h" |
18 #include "core/layout/api/LayoutViewItem.h" | 18 #include "core/layout/api/LayoutViewItem.h" |
19 #include "core/layout/compositing/PaintLayerCompositor.h" | 19 #include "core/layout/compositing/PaintLayerCompositor.h" |
20 #include "core/page/ChromeClient.h" | 20 #include "core/page/ChromeClient.h" |
21 #include "core/page/Page.h" | 21 #include "core/page/Page.h" |
22 #include "core/style/ComputedStyle.h" | 22 #include "core/style/ComputedStyle.h" |
| 23 #include "platform/graphics/ColorSpace.h" |
23 #include "public/platform/WebScreenInfo.h" | 24 #include "public/platform/WebScreenInfo.h" |
24 | 25 |
25 namespace blink { | 26 namespace blink { |
26 | 27 |
27 MediaValues* MediaValues::createDynamicIfFrameExists(LocalFrame* frame) { | 28 MediaValues* MediaValues::createDynamicIfFrameExists(LocalFrame* frame) { |
28 if (frame) | 29 if (frame) |
29 return MediaValuesDynamic::create(frame); | 30 return MediaValuesDynamic::create(frame); |
30 return MediaValuesCached::create(); | 31 return MediaValuesCached::create(); |
31 } | 32 } |
32 | 33 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 int MediaValues::calculateAvailableHoverTypes(LocalFrame* frame) { | 139 int MediaValues::calculateAvailableHoverTypes(LocalFrame* frame) { |
139 ASSERT(frame && frame->settings()); | 140 ASSERT(frame && frame->settings()); |
140 return frame->settings()->getAvailableHoverTypes(); | 141 return frame->settings()->getAvailableHoverTypes(); |
141 } | 142 } |
142 | 143 |
143 DisplayShape MediaValues::calculateDisplayShape(LocalFrame* frame) { | 144 DisplayShape MediaValues::calculateDisplayShape(LocalFrame* frame) { |
144 DCHECK(frame && frame->host()); | 145 DCHECK(frame && frame->host()); |
145 return frame->host()->chromeClient().screenInfo().displayShape; | 146 return frame->host()->chromeClient().screenInfo().displayShape; |
146 } | 147 } |
147 | 148 |
| 149 ColorSpaceGamut MediaValues::calculateColorGamut(LocalFrame* frame) { |
| 150 DCHECK(frame && frame->host()); |
| 151 return ColorSpaceUtilities::getColorSpaceGamut( |
| 152 frame->host()->chromeClient().screenInfo()); |
| 153 } |
| 154 |
148 bool MediaValues::computeLengthImpl(double value, | 155 bool MediaValues::computeLengthImpl(double value, |
149 CSSPrimitiveValue::UnitType type, | 156 CSSPrimitiveValue::UnitType type, |
150 unsigned defaultFontSize, | 157 unsigned defaultFontSize, |
151 double viewportWidth, | 158 double viewportWidth, |
152 double viewportHeight, | 159 double viewportHeight, |
153 double& result) { | 160 double& result) { |
154 // The logic in this function is duplicated from | 161 // The logic in this function is duplicated from |
155 // CSSToLengthConversionData::zoomedComputedPixels() because | 162 // CSSToLengthConversionData::zoomedComputedPixels() because |
156 // MediaValues::computeLength() needs nearly identical logic, but we haven't | 163 // MediaValues::computeLength() needs nearly identical logic, but we haven't |
157 // found a way to make CSSToLengthConversionData::zoomedComputedPixels() more | 164 // found a way to make CSSToLengthConversionData::zoomedComputedPixels() more |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 217 |
211 LocalFrame* MediaValues::frameFrom(Document& document) { | 218 LocalFrame* MediaValues::frameFrom(Document& document) { |
212 Document* executingDocument = document.importsController() | 219 Document* executingDocument = document.importsController() |
213 ? document.importsController()->master() | 220 ? document.importsController()->master() |
214 : &document; | 221 : &document; |
215 ASSERT(executingDocument); | 222 ASSERT(executingDocument); |
216 return executingDocument->frame(); | 223 return executingDocument->frame(); |
217 } | 224 } |
218 | 225 |
219 } // namespace blink | 226 } // namespace blink |
OLD | NEW |