OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MediaValues_h | |
6 #define MediaValues_h | |
7 | |
8 #include "core/css/MediaQueryEvaluator.h" | |
9 #include "core/css/resolver/StyleResolverState.h" | |
10 #include "core/rendering/style/RenderStyle.h" | |
11 #include "wtf/RefCounted.h" | |
12 #include "wtf/RefPtr.h" | |
13 #include "wtf/text/WTFString.h" | |
14 | |
15 namespace WebCore { | |
16 | |
17 class Document; | |
18 | |
19 class MediaValues : public RefCounted<MediaValues> { | |
20 public: | |
21 enum MediaValuesMode { CachingMode, DynamicMode }; | |
abarth-chromium
2014/03/27 21:01:55
These should all be on separate lines.
| |
22 | |
23 static PassRefPtr<MediaValues> create(Document*, MediaValuesMode); | |
24 static PassRefPtr<MediaValues> create(LocalFrame*, RenderStyle*, MediaValues Mode); | |
25 PassRefPtr<MediaValues> copy() const; | |
26 | |
27 enum PointerDeviceType { TouchPointer, MousePointer, NoPointer, UnknownPoint er }; | |
abarth-chromium
2014/03/27 21:01:55
These too.
| |
28 | |
29 int viewportWidth() const; | |
30 int viewportHeight() const; | |
31 int deviceWidth() const; | |
32 int deviceHeight() const; | |
33 float devicePixelRatio() const; | |
34 int colorBitsPerComponent() const; | |
35 int monochromeBitsPerComponent() const; | |
36 PointerDeviceType pointer() const; | |
37 int defaultFontSize() const; | |
38 bool threeDEnabled() const; | |
39 bool scanMediaType() const; | |
40 bool screenMediaType() const; | |
41 bool printMediaType() const; | |
42 bool strictMode() const; | |
43 RenderStyle* style() const { return m_style.get(); } | |
44 Document* document() const; | |
45 | |
46 MediaValues(PassRefPtr<RenderStyle> style, | |
47 LocalFrame* frame, | |
48 MediaValuesMode mode) | |
abarth-chromium
2014/03/27 21:01:55
You can merge these three lines though. :)
| |
49 : m_style(style) | |
50 , m_frame(frame) | |
51 , m_mode(mode) | |
52 , m_viewportWidth(0) | |
53 , m_viewportHeight(0) | |
54 , m_deviceWidth(0) | |
55 , m_deviceHeight(0) | |
56 , m_devicePixelRatio(0) | |
57 , m_colorBitsPerComponent(0) | |
58 , m_monochromeBitsPerComponent(0) | |
59 , m_pointer(UnknownPointer) | |
60 , m_defaultFontSize(0) | |
61 , m_threeDEnabled(false) | |
62 , m_scanMediaType(false) | |
63 , m_screenMediaType(false) | |
64 , m_printMediaType(false) | |
65 , m_strictMode(false) | |
66 { | |
67 ASSERT(mode == DynamicMode); | |
68 } | |
69 | |
70 MediaValues(MediaValuesMode mode, | |
71 int viewportWidth, | |
72 int viewportHeight, | |
73 int deviceWidth, | |
74 int deviceHeight, | |
75 float devicePixelRatio, | |
76 int colorBitsPerComponent, | |
77 int monochromeBitsPerComponent, | |
78 PointerDeviceType pointer, | |
79 int defaultFontSize, | |
80 bool threeDEnabled, | |
81 bool scanMediaType, | |
82 bool screenMediaType, | |
83 bool printMediaType, | |
84 bool strictMode) | |
85 : m_frame(0) | |
86 , m_mode(mode) | |
87 , m_viewportWidth(viewportWidth) | |
88 , m_viewportHeight(viewportHeight) | |
89 , m_deviceWidth(deviceWidth) | |
90 , m_deviceHeight(deviceHeight) | |
91 , m_devicePixelRatio(devicePixelRatio) | |
92 , m_colorBitsPerComponent(colorBitsPerComponent) | |
93 , m_monochromeBitsPerComponent(monochromeBitsPerComponent) | |
94 , m_pointer(pointer) | |
95 , m_defaultFontSize(defaultFontSize) | |
96 , m_threeDEnabled(threeDEnabled) | |
97 , m_scanMediaType(scanMediaType) | |
98 , m_screenMediaType(screenMediaType) | |
99 , m_printMediaType(printMediaType) | |
100 , m_strictMode(strictMode) | |
101 { | |
102 ASSERT(mode == CachingMode); | |
103 } | |
104 | |
105 private: | |
106 RefPtr<RenderStyle> m_style; | |
107 LocalFrame* m_frame; | |
108 MediaValuesMode m_mode; | |
109 | |
110 int m_viewportWidth; | |
abarth-chromium
2014/03/27 21:01:55
I'd add a comment here explaining that the members
| |
111 int m_viewportHeight; | |
112 int m_deviceWidth; | |
113 int m_deviceHeight; | |
114 float m_devicePixelRatio; | |
115 int m_colorBitsPerComponent; | |
116 int m_monochromeBitsPerComponent; | |
117 PointerDeviceType m_pointer; | |
118 int m_defaultFontSize; | |
119 bool m_threeDEnabled; | |
120 bool m_scanMediaType; | |
121 bool m_screenMediaType; | |
122 bool m_printMediaType; | |
123 bool m_strictMode; | |
124 }; | |
125 | |
126 } // namespace | |
127 #endif | |
OLD | NEW |