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

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

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 #ifndef MediaValuesCached_h 5 #ifndef MediaValuesCached_h
6 #define MediaValuesCached_h 6 #define MediaValuesCached_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/css/MediaValues.h" 9 #include "core/css/MediaValues.h"
10 #include "platform/CrossThreadCopier.h" 10 #include "platform/CrossThreadCopier.h"
11 #include "platform/graphics/ColorSpace.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 class CORE_EXPORT MediaValuesCached final : public MediaValues { 15 class CORE_EXPORT MediaValuesCached final : public MediaValues {
15 public: 16 public:
16 struct MediaValuesCachedData final { 17 struct MediaValuesCachedData final {
jochen (gone - plz use gerrit) 2017/01/29 17:25:33 also put CORE_EXPORT on the struct
17 DISALLOW_NEW(); 18 DISALLOW_NEW();
18 // Members variables must be thread safe, since they're copied to the parser 19 // Members variables must be thread safe, since they're copied to the parser
19 // thread 20 // thread
20 double viewportWidth; 21 double viewportWidth;
21 double viewportHeight; 22 double viewportHeight;
22 int deviceWidth; 23 int deviceWidth;
23 int deviceHeight; 24 int deviceHeight;
24 float devicePixelRatio; 25 float devicePixelRatio;
25 int colorBitsPerComponent; 26 int colorBitsPerComponent;
26 int monochromeBitsPerComponent; 27 int monochromeBitsPerComponent;
27 PointerType primaryPointerType; 28 PointerType primaryPointerType;
28 int availablePointerTypes; 29 int availablePointerTypes;
29 HoverType primaryHoverType; 30 HoverType primaryHoverType;
30 int availableHoverTypes; 31 int availableHoverTypes;
31 int defaultFontSize; 32 int defaultFontSize;
32 bool threeDEnabled; 33 bool threeDEnabled;
33 bool strictMode; 34 bool strictMode;
34 String mediaType; 35 String mediaType;
35 WebDisplayMode displayMode; 36 WebDisplayMode displayMode;
36 DisplayShape displayShape; 37 DisplayShape displayShape;
38 ColorSpaceGamut colorGamut;
37 39
38 MediaValuesCachedData() 40 MediaValuesCachedData();
39 : viewportWidth(0),
40 viewportHeight(0),
41 deviceWidth(0),
42 deviceHeight(0),
43 devicePixelRatio(1.0),
44 colorBitsPerComponent(24),
45 monochromeBitsPerComponent(0),
46 primaryPointerType(PointerTypeNone),
47 availablePointerTypes(PointerTypeNone),
48 primaryHoverType(HoverTypeNone),
49 availableHoverTypes(HoverTypeNone),
50 defaultFontSize(16),
51 threeDEnabled(false),
52 strictMode(true),
53 displayMode(WebDisplayModeBrowser),
54 displayShape(DisplayShapeRect) {}
55
56 explicit MediaValuesCachedData(Document&); 41 explicit MediaValuesCachedData(Document&);
57 42
58 MediaValuesCachedData deepCopy() const { 43 MediaValuesCachedData deepCopy() const {
59 MediaValuesCachedData data; 44 MediaValuesCachedData data;
60 data.viewportWidth = viewportWidth; 45 data.viewportWidth = viewportWidth;
61 data.viewportHeight = viewportHeight; 46 data.viewportHeight = viewportHeight;
62 data.deviceWidth = deviceWidth; 47 data.deviceWidth = deviceWidth;
63 data.deviceHeight = deviceHeight; 48 data.deviceHeight = deviceHeight;
64 data.devicePixelRatio = devicePixelRatio; 49 data.devicePixelRatio = devicePixelRatio;
65 data.colorBitsPerComponent = colorBitsPerComponent; 50 data.colorBitsPerComponent = colorBitsPerComponent;
66 data.monochromeBitsPerComponent = monochromeBitsPerComponent; 51 data.monochromeBitsPerComponent = monochromeBitsPerComponent;
67 data.primaryPointerType = primaryPointerType; 52 data.primaryPointerType = primaryPointerType;
68 data.availablePointerTypes = availablePointerTypes; 53 data.availablePointerTypes = availablePointerTypes;
69 data.primaryHoverType = primaryHoverType; 54 data.primaryHoverType = primaryHoverType;
70 data.availableHoverTypes = availableHoverTypes; 55 data.availableHoverTypes = availableHoverTypes;
71 data.defaultFontSize = defaultFontSize; 56 data.defaultFontSize = defaultFontSize;
72 data.threeDEnabled = threeDEnabled; 57 data.threeDEnabled = threeDEnabled;
73 data.strictMode = strictMode; 58 data.strictMode = strictMode;
74 data.mediaType = mediaType.isolatedCopy(); 59 data.mediaType = mediaType.isolatedCopy();
75 data.displayMode = displayMode; 60 data.displayMode = displayMode;
76 data.displayShape = displayShape; 61 data.displayShape = displayShape;
62 data.colorGamut = colorGamut;
77 return data; 63 return data;
78 } 64 }
79 }; 65 };
80 66
81 static MediaValuesCached* create(); 67 static MediaValuesCached* create();
82 static MediaValuesCached* create(const MediaValuesCachedData&); 68 static MediaValuesCached* create(const MediaValuesCachedData&);
83 MediaValues* copy() const override; 69 MediaValues* copy() const override;
84 bool computeLength(double value, 70 bool computeLength(double value,
85 CSSPrimitiveValue::UnitType, 71 CSSPrimitiveValue::UnitType,
86 int& result) const override; 72 int& result) const override;
(...skipping 12 matching lines...) Expand all
99 int availablePointerTypes() const override; 85 int availablePointerTypes() const override;
100 HoverType primaryHoverType() const override; 86 HoverType primaryHoverType() const override;
101 int availableHoverTypes() const override; 87 int availableHoverTypes() const override;
102 bool threeDEnabled() const override; 88 bool threeDEnabled() const override;
103 bool strictMode() const override; 89 bool strictMode() const override;
104 Document* document() const override; 90 Document* document() const override;
105 bool hasValues() const override; 91 bool hasValues() const override;
106 const String mediaType() const override; 92 const String mediaType() const override;
107 WebDisplayMode displayMode() const override; 93 WebDisplayMode displayMode() const override;
108 DisplayShape displayShape() const override; 94 DisplayShape displayShape() const override;
95 ColorSpaceGamut colorGamut() const override;
109 96
110 void overrideViewportDimensions(double width, double height) override; 97 void overrideViewportDimensions(double width, double height) override;
111 98
112 protected: 99 protected:
113 MediaValuesCached(); 100 MediaValuesCached();
114 MediaValuesCached(LocalFrame*); 101 MediaValuesCached(LocalFrame*);
115 MediaValuesCached(const MediaValuesCachedData&); 102 MediaValuesCached(const MediaValuesCachedData&);
116 103
117 MediaValuesCachedData m_data; 104 MediaValuesCachedData m_data;
118 }; 105 };
119 106
120 template <> 107 template <>
121 struct CrossThreadCopier<MediaValuesCached::MediaValuesCachedData> { 108 struct CrossThreadCopier<MediaValuesCached::MediaValuesCachedData> {
122 typedef MediaValuesCached::MediaValuesCachedData Type; 109 typedef MediaValuesCached::MediaValuesCachedData Type;
123 static Type copy(const MediaValuesCached::MediaValuesCachedData& data) { 110 static Type copy(const MediaValuesCached::MediaValuesCachedData& data) {
124 return data.deepCopy(); 111 return data.deepCopy();
125 } 112 }
126 }; 113 };
127 114
128 } // namespace blink 115 } // namespace blink
129 116
130 #endif // MediaValuesCached_h 117 #endif // MediaValuesCached_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaValues.cpp ('k') | third_party/WebKit/Source/core/css/MediaValuesCached.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698