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 MediaValuesCached_h | 5 #ifndef MediaValuesCached_h |
6 #define MediaValuesCached_h | 6 #define MediaValuesCached_h |
7 | 7 |
8 #include "core/css/MediaValues.h" | 8 #include "core/css/MediaValues.h" |
9 | 9 |
10 namespace WebCore { | 10 namespace WebCore { |
11 | 11 |
12 class MediaValuesCached FINAL : public MediaValues { | 12 class MediaValuesCached FINAL : public MediaValues { |
13 public: | 13 public: |
14 struct MediaValuesCachedData { | 14 struct MediaValuesCachedData { |
15 // Members variables must be thread safe, since they're copied to the pa
rser thread | 15 // Members variables must be thread safe, since they're copied to the pa
rser thread |
16 int viewportWidth; | 16 int viewportWidth; |
17 int viewportHeight; | 17 int viewportHeight; |
18 int deviceWidth; | 18 int deviceWidth; |
19 int deviceHeight; | 19 int deviceHeight; |
20 float devicePixelRatio; | 20 float devicePixelRatio; |
21 int colorBitsPerComponent; | 21 int colorBitsPerComponent; |
22 int monochromeBitsPerComponent; | 22 int monochromeBitsPerComponent; |
23 PointerDeviceType pointer; | 23 PointerDeviceType pointer; |
24 int defaultFontSize; | 24 int defaultFontSize; |
25 bool threeDEnabled; | 25 bool threeDEnabled; |
26 bool scanMediaType; | |
27 bool screenMediaType; | |
28 bool printMediaType; | |
29 bool strictMode; | 26 bool strictMode; |
| 27 String mediaType; |
30 | 28 |
31 MediaValuesCachedData() | 29 MediaValuesCachedData() |
32 : viewportWidth(0) | 30 : viewportWidth(0) |
33 , viewportHeight(0) | 31 , viewportHeight(0) |
34 , deviceWidth(0) | 32 , deviceWidth(0) |
35 , deviceHeight(0) | 33 , deviceHeight(0) |
36 , devicePixelRatio(1.0) | 34 , devicePixelRatio(1.0) |
37 , colorBitsPerComponent(24) | 35 , colorBitsPerComponent(24) |
38 , monochromeBitsPerComponent(0) | 36 , monochromeBitsPerComponent(0) |
39 , pointer(UnknownPointer) | 37 , pointer(UnknownPointer) |
40 , defaultFontSize(16) | 38 , defaultFontSize(16) |
41 , threeDEnabled(false) | 39 , threeDEnabled(false) |
42 , scanMediaType(false) | |
43 , screenMediaType(true) | |
44 , printMediaType(false) | |
45 , strictMode(true) | 40 , strictMode(true) |
46 { | 41 { |
47 } | 42 } |
48 }; | 43 }; |
49 | 44 |
50 static PassRefPtr<MediaValues> create(); | 45 static PassRefPtr<MediaValues> create(); |
51 static PassRefPtr<MediaValues> create(Document&); | 46 static PassRefPtr<MediaValues> create(Document&); |
52 static PassRefPtr<MediaValues> create(LocalFrame*); | 47 static PassRefPtr<MediaValues> create(LocalFrame*); |
53 static PassRefPtr<MediaValues> create(MediaValuesCachedData&); | 48 static PassRefPtr<MediaValues> create(MediaValuesCachedData&); |
54 virtual PassRefPtr<MediaValues> copy() const OVERRIDE; | 49 virtual PassRefPtr<MediaValues> copy() const OVERRIDE; |
55 virtual bool isSafeToSendToAnotherThread() const OVERRIDE; | 50 virtual bool isSafeToSendToAnotherThread() const OVERRIDE; |
56 virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, int& r
esult) const OVERRIDE; | 51 virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, int& r
esult) const OVERRIDE; |
57 virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, double
& result) const OVERRIDE; | 52 virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, double
& result) const OVERRIDE; |
58 | 53 |
59 virtual int viewportWidth() const OVERRIDE; | 54 virtual int viewportWidth() const OVERRIDE; |
60 virtual int viewportHeight() const OVERRIDE; | 55 virtual int viewportHeight() const OVERRIDE; |
61 virtual int deviceWidth() const OVERRIDE; | 56 virtual int deviceWidth() const OVERRIDE; |
62 virtual int deviceHeight() const OVERRIDE; | 57 virtual int deviceHeight() const OVERRIDE; |
63 virtual float devicePixelRatio() const OVERRIDE; | 58 virtual float devicePixelRatio() const OVERRIDE; |
64 virtual int colorBitsPerComponent() const OVERRIDE; | 59 virtual int colorBitsPerComponent() const OVERRIDE; |
65 virtual int monochromeBitsPerComponent() const OVERRIDE; | 60 virtual int monochromeBitsPerComponent() const OVERRIDE; |
66 virtual PointerDeviceType pointer() const OVERRIDE; | 61 virtual PointerDeviceType pointer() const OVERRIDE; |
67 virtual bool threeDEnabled() const OVERRIDE; | 62 virtual bool threeDEnabled() const OVERRIDE; |
68 virtual bool scanMediaType() const OVERRIDE; | |
69 virtual bool screenMediaType() const OVERRIDE; | |
70 virtual bool printMediaType() const OVERRIDE; | |
71 virtual bool strictMode() const OVERRIDE; | 63 virtual bool strictMode() const OVERRIDE; |
72 virtual Document* document() const OVERRIDE; | 64 virtual Document* document() const OVERRIDE; |
73 virtual bool hasValues() const OVERRIDE; | 65 virtual bool hasValues() const OVERRIDE; |
| 66 virtual const String mediaType() const OVERRIDE; |
74 | 67 |
75 protected: | 68 protected: |
76 MediaValuesCached(); | 69 MediaValuesCached(); |
77 MediaValuesCached(LocalFrame*); | 70 MediaValuesCached(LocalFrame*); |
78 MediaValuesCached(const MediaValuesCachedData&); | 71 MediaValuesCached(const MediaValuesCachedData&); |
79 | 72 |
80 MediaValuesCachedData m_data; | 73 MediaValuesCachedData m_data; |
81 }; | 74 }; |
82 | 75 |
83 } // namespace | 76 } // namespace |
84 | 77 |
85 #endif // MediaValuesCached_h | 78 #endif // MediaValuesCached_h |
OLD | NEW |