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 #ifndef MediaValues_h | 5 #ifndef MediaValues_h |
6 #define MediaValues_h | 6 #define MediaValues_h |
7 | 7 |
8 #include "core/css/MediaQueryEvaluator.h" | 8 #include "core/css/MediaQueryEvaluator.h" |
9 #include "core/css/resolver/StyleResolverState.h" | 9 #include "core/css/resolver/StyleResolverState.h" |
10 #include "core/rendering/style/RenderStyle.h" | 10 #include "core/rendering/style/RenderStyle.h" |
11 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
12 #include "wtf/RefPtr.h" | 12 #include "wtf/RefPtr.h" |
13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
14 | 14 |
15 namespace WebCore { | 15 namespace WebCore { |
16 | 16 |
17 class Document; | 17 class Document; |
18 | 18 |
19 class MediaValues : public RefCounted<MediaValues> { | 19 class MediaValues : public RefCounted<MediaValues>, public CSSLengthData { |
20 public: | 20 public: |
21 enum MediaValuesMode { CachingMode, | 21 enum MediaValuesMode { CachingMode, |
22 DynamicMode }; | 22 DynamicMode }; |
23 | 23 |
24 enum PointerDeviceType { TouchPointer, | 24 enum PointerDeviceType { TouchPointer, |
25 MousePointer, | 25 MousePointer, |
26 NoPointer, | 26 NoPointer, |
27 UnknownPointer }; | 27 UnknownPointer }; |
28 | 28 |
29 | 29 |
30 static PassRefPtr<MediaValues> create(Document*, MediaValuesMode); | 30 static PassRefPtr<MediaValues> create(const Document&, MediaValuesMode); |
31 static PassRefPtr<MediaValues> create(LocalFrame*, RenderStyle*, MediaValues
Mode); | 31 static PassRefPtr<MediaValues> create(LocalFrame*, RenderStyle*, MediaValues
Mode); |
32 static PassRefPtr<MediaValues> create(MediaValuesMode, | 32 static PassRefPtr<MediaValues> create(MediaValuesMode, |
33 int viewportWidth, | 33 int viewportWidth, |
34 int viewportHeight, | 34 int viewportHeight, |
35 int deviceWidth, | 35 int deviceWidth, |
36 int deviceHeight, | 36 int deviceHeight, |
37 float devicePixelRatio, | 37 float devicePixelRatio, |
38 int colorBitsPerComponent, | 38 int colorBitsPerComponent, |
39 int monochromeBitsPerComponent, | 39 int monochromeBitsPerComponent, |
40 PointerDeviceType, | 40 PointerDeviceType, |
41 int defaultFontSize, | 41 int defaultFontSize, |
| 42 int computedFontSize, |
| 43 bool hasXHeight, |
| 44 double xHeight, |
| 45 double zeroWidth, |
42 bool threeDEnabled, | 46 bool threeDEnabled, |
43 bool scanMediaType, | 47 bool scanMediaType, |
44 bool screenMediaType, | 48 bool screenMediaType, |
45 bool printMediaType, | 49 bool printMediaType, |
46 bool strictMode); | 50 bool strictMode, |
| 51 float effectiveZoom); |
47 PassRefPtr<MediaValues> copy() const; | 52 PassRefPtr<MediaValues> copy() const; |
48 bool isSafeToSendToAnotherThread() const; | 53 bool isSafeToSendToAnotherThread() const; |
49 | 54 |
50 int viewportWidth() const; | 55 int viewportWidth() const; |
51 int viewportHeight() const; | 56 int viewportHeight() const; |
52 int deviceWidth() const; | 57 int deviceWidth() const; |
53 int deviceHeight() const; | 58 int deviceHeight() const; |
54 float devicePixelRatio() const; | 59 float devicePixelRatio() const; |
55 int colorBitsPerComponent() const; | 60 int colorBitsPerComponent() const; |
56 int monochromeBitsPerComponent() const; | 61 int monochromeBitsPerComponent() const; |
57 PointerDeviceType pointer() const; | 62 PointerDeviceType pointer() const; |
58 int defaultFontSize() const; | 63 int defaultFontSize() const; |
| 64 int computedFontSize() const; |
59 bool threeDEnabled() const; | 65 bool threeDEnabled() const; |
60 bool scanMediaType() const; | 66 bool scanMediaType() const; |
61 bool screenMediaType() const; | 67 bool screenMediaType() const; |
62 bool printMediaType() const; | 68 bool printMediaType() const; |
63 bool strictMode() const; | 69 bool strictMode() const; |
| 70 float effectiveZoom() const; |
64 RenderStyle* style() const { return m_style.get(); } | 71 RenderStyle* style() const { return m_style.get(); } |
65 Document* document() const; | 72 Document* document() const; |
66 | 73 |
| 74 virtual float zoom() const; |
| 75 virtual bool computingFontSize() const; |
| 76 virtual double fontSpecifiedSize() const; |
| 77 virtual double fontComputedSize() const; |
| 78 virtual double rootFontSpecifiedSize() const; |
| 79 virtual double rootFontComputedSize() const; |
| 80 virtual bool hasXHeight() const; |
| 81 virtual double xHeight() const; |
| 82 virtual double zeroWidth() const; |
| 83 virtual bool hasRoot() const; |
| 84 |
| 85 virtual double viewportWidthPercent() const; |
| 86 virtual double viewportHeightPercent() const; |
| 87 virtual double viewportMinPercent() const; |
| 88 virtual double viewportMaxPercent() const; |
| 89 |
67 private: | 90 private: |
68 MediaValues(LocalFrame* frame, PassRefPtr<RenderStyle> style, MediaValuesMod
e mode) | 91 MediaValues(LocalFrame* frame, PassRefPtr<RenderStyle> style, MediaValuesMod
e mode) |
69 : m_style(style) | 92 : m_style(style) |
70 , m_frame(frame) | 93 , m_frame(frame) |
71 , m_mode(mode) | 94 , m_mode(mode) |
72 , m_viewportWidth(0) | 95 , m_viewportWidth(0) |
73 , m_viewportHeight(0) | 96 , m_viewportHeight(0) |
74 , m_deviceWidth(0) | 97 , m_deviceWidth(0) |
75 , m_deviceHeight(0) | 98 , m_deviceHeight(0) |
76 , m_devicePixelRatio(0) | 99 , m_devicePixelRatio(0) |
77 , m_colorBitsPerComponent(0) | 100 , m_colorBitsPerComponent(0) |
78 , m_monochromeBitsPerComponent(0) | 101 , m_monochromeBitsPerComponent(0) |
79 , m_pointer(UnknownPointer) | 102 , m_pointer(UnknownPointer) |
80 , m_defaultFontSize(0) | 103 , m_defaultFontSize(0) |
| 104 , m_computedFontSize(0) |
| 105 , m_hasXHeight(false) |
| 106 , m_xHeight(0.0) |
| 107 , m_zeroWidth(0.0) |
81 , m_threeDEnabled(false) | 108 , m_threeDEnabled(false) |
82 , m_scanMediaType(false) | 109 , m_scanMediaType(false) |
83 , m_screenMediaType(false) | 110 , m_screenMediaType(false) |
84 , m_printMediaType(false) | 111 , m_printMediaType(false) |
85 , m_strictMode(false) | 112 , m_strictMode(false) |
| 113 , m_effectiveZoom(1.0) |
86 { | 114 { |
87 } | 115 } |
88 | 116 |
89 RefPtr<RenderStyle> m_style; | 117 RefPtr<RenderStyle> m_style; |
90 LocalFrame* m_frame; | 118 LocalFrame* m_frame; |
91 MediaValuesMode m_mode; | 119 MediaValuesMode m_mode; |
92 | 120 |
93 // Members variables beyond this point must be thread safe, since they're co
pied to the parser thread | 121 // Members variables beyond this point must be thread safe, since they're co
pied to the parser thread |
94 int m_viewportWidth; | 122 int m_viewportWidth; |
95 int m_viewportHeight; | 123 int m_viewportHeight; |
96 int m_deviceWidth; | 124 int m_deviceWidth; |
97 int m_deviceHeight; | 125 int m_deviceHeight; |
98 float m_devicePixelRatio; | 126 float m_devicePixelRatio; |
99 int m_colorBitsPerComponent; | 127 int m_colorBitsPerComponent; |
100 int m_monochromeBitsPerComponent; | 128 int m_monochromeBitsPerComponent; |
101 PointerDeviceType m_pointer; | 129 PointerDeviceType m_pointer; |
102 int m_defaultFontSize; | 130 int m_defaultFontSize; |
| 131 int m_computedFontSize; |
| 132 bool m_hasXHeight; |
| 133 double m_xHeight; |
| 134 double m_zeroWidth; |
103 bool m_threeDEnabled; | 135 bool m_threeDEnabled; |
104 bool m_scanMediaType; | 136 bool m_scanMediaType; |
105 bool m_screenMediaType; | 137 bool m_screenMediaType; |
106 bool m_printMediaType; | 138 bool m_printMediaType; |
107 bool m_strictMode; | 139 bool m_strictMode; |
| 140 float m_effectiveZoom; |
108 }; | 141 }; |
109 | 142 |
110 } // namespace | 143 } // namespace |
111 #endif | 144 #endif |
OLD | NEW |