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 int computedFontSize; | |
26 bool threeDEnabled; | 25 bool threeDEnabled; |
27 bool scanMediaType; | 26 bool scanMediaType; |
28 bool screenMediaType; | 27 bool screenMediaType; |
29 bool printMediaType; | 28 bool printMediaType; |
30 bool strictMode; | 29 bool strictMode; |
| 30 |
| 31 MediaValuesCachedData() |
| 32 : viewportWidth(0) |
| 33 , viewportHeight(0) |
| 34 , deviceWidth(0) |
| 35 , deviceHeight(0) |
| 36 , devicePixelRatio(1.0) |
| 37 , colorBitsPerComponent(24) |
| 38 , monochromeBitsPerComponent(0) |
| 39 , pointer(UnknownPointer) |
| 40 , defaultFontSize(16) |
| 41 , threeDEnabled(false) |
| 42 , scanMediaType(false) |
| 43 , screenMediaType(true) |
| 44 , printMediaType(false) |
| 45 , strictMode(true) |
| 46 { |
| 47 } |
31 }; | 48 }; |
32 | 49 |
| 50 static PassRefPtr<MediaValues> create(); |
33 static PassRefPtr<MediaValues> create(Document&); | 51 static PassRefPtr<MediaValues> create(Document&); |
34 static PassRefPtr<MediaValues> create(LocalFrame*, RenderStyle*); | 52 static PassRefPtr<MediaValues> create(LocalFrame*); |
35 static PassRefPtr<MediaValues> create(MediaValuesCachedData&); | 53 static PassRefPtr<MediaValues> create(MediaValuesCachedData&); |
36 virtual PassRefPtr<MediaValues> copy() const OVERRIDE; | 54 virtual PassRefPtr<MediaValues> copy() const OVERRIDE; |
37 virtual bool isSafeToSendToAnotherThread() const OVERRIDE; | 55 virtual bool isSafeToSendToAnotherThread() const OVERRIDE; |
38 virtual bool computeLength(double value, unsigned short type, int& result) c
onst OVERRIDE; | 56 virtual bool computeLength(double value, unsigned short type, int& result) c
onst OVERRIDE; |
39 | 57 |
40 virtual int viewportWidth() const OVERRIDE; | 58 virtual int viewportWidth() const OVERRIDE; |
41 virtual int viewportHeight() const OVERRIDE; | 59 virtual int viewportHeight() const OVERRIDE; |
42 virtual int deviceWidth() const OVERRIDE; | 60 virtual int deviceWidth() const OVERRIDE; |
43 virtual int deviceHeight() const OVERRIDE; | 61 virtual int deviceHeight() const OVERRIDE; |
44 virtual float devicePixelRatio() const OVERRIDE; | 62 virtual float devicePixelRatio() const OVERRIDE; |
45 virtual int colorBitsPerComponent() const OVERRIDE; | 63 virtual int colorBitsPerComponent() const OVERRIDE; |
46 virtual int monochromeBitsPerComponent() const OVERRIDE; | 64 virtual int monochromeBitsPerComponent() const OVERRIDE; |
47 virtual PointerDeviceType pointer() const OVERRIDE; | 65 virtual PointerDeviceType pointer() const OVERRIDE; |
48 virtual bool threeDEnabled() const OVERRIDE; | 66 virtual bool threeDEnabled() const OVERRIDE; |
49 virtual bool scanMediaType() const OVERRIDE; | 67 virtual bool scanMediaType() const OVERRIDE; |
50 virtual bool screenMediaType() const OVERRIDE; | 68 virtual bool screenMediaType() const OVERRIDE; |
51 virtual bool printMediaType() const OVERRIDE; | 69 virtual bool printMediaType() const OVERRIDE; |
52 virtual bool strictMode() const OVERRIDE; | 70 virtual bool strictMode() const OVERRIDE; |
53 virtual Document* document() const OVERRIDE; | 71 virtual Document* document() const OVERRIDE; |
54 virtual bool hasValues() const OVERRIDE; | 72 virtual bool hasValues() const OVERRIDE; |
55 | 73 |
56 protected: | 74 protected: |
57 MediaValuesCached(LocalFrame*, RenderStyle*); | 75 MediaValuesCached(); |
| 76 MediaValuesCached(LocalFrame*); |
58 MediaValuesCached(const MediaValuesCachedData&); | 77 MediaValuesCached(const MediaValuesCachedData&); |
59 | 78 |
60 MediaValuesCachedData m_data; | 79 MediaValuesCachedData m_data; |
61 }; | 80 }; |
62 | 81 |
63 } // namespace | 82 } // namespace |
64 | 83 |
65 #endif // MediaValuesCached_h | 84 #endif // MediaValuesCached_h |
OLD | NEW |