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

Side by Side Diff: third_party/WebKit/Source/core/css/MediaValuesCached.cpp

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

Powered by Google App Engine
This is Rietveld 408576698