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

Side by Side Diff: Source/core/css/MediaValues.h

Issue 227043007: CSS Length calculation with MediaValues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sizes_parser3
Patch Set: Rebase Created 6 years, 8 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 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> {
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;
65 bool hasXHeight() const;
66 double xHeight() const;
67 double zeroWidth() const;
59 bool threeDEnabled() const; 68 bool threeDEnabled() const;
60 bool scanMediaType() const; 69 bool scanMediaType() const;
61 bool screenMediaType() const; 70 bool screenMediaType() const;
62 bool printMediaType() const; 71 bool printMediaType() const;
63 bool strictMode() const; 72 bool strictMode() const;
73 float effectiveZoom() const;
64 RenderStyle* style() const { return m_style.get(); } 74 RenderStyle* style() const { return m_style.get(); }
65 Document* document() const; 75 Document* document() const;
66 76
67 private: 77 private:
68 MediaValues(LocalFrame* frame, PassRefPtr<RenderStyle> style, MediaValuesMod e mode) 78 MediaValues(LocalFrame* frame, PassRefPtr<RenderStyle> style, MediaValuesMod e mode)
69 : m_style(style) 79 : m_style(style)
70 , m_frame(frame) 80 , m_frame(frame)
71 , m_mode(mode) 81 , m_mode(mode)
72 , m_viewportWidth(0) 82 , m_viewportWidth(0)
73 , m_viewportHeight(0) 83 , m_viewportHeight(0)
74 , m_deviceWidth(0) 84 , m_deviceWidth(0)
75 , m_deviceHeight(0) 85 , m_deviceHeight(0)
76 , m_devicePixelRatio(0) 86 , m_devicePixelRatio(0)
77 , m_colorBitsPerComponent(0) 87 , m_colorBitsPerComponent(0)
78 , m_monochromeBitsPerComponent(0) 88 , m_monochromeBitsPerComponent(0)
79 , m_pointer(UnknownPointer) 89 , m_pointer(UnknownPointer)
80 , m_defaultFontSize(0) 90 , m_defaultFontSize(0)
91 , m_computedFontSize(0)
92 , m_hasXHeight(false)
93 , m_xHeight(0.0)
94 , m_zeroWidth(0.0)
81 , m_threeDEnabled(false) 95 , m_threeDEnabled(false)
82 , m_scanMediaType(false) 96 , m_scanMediaType(false)
83 , m_screenMediaType(false) 97 , m_screenMediaType(false)
84 , m_printMediaType(false) 98 , m_printMediaType(false)
85 , m_strictMode(false) 99 , m_strictMode(false)
100 , m_effectiveZoom(1.0)
86 { 101 {
87 } 102 }
88 103
89 RefPtr<RenderStyle> m_style; 104 RefPtr<RenderStyle> m_style;
90 LocalFrame* m_frame; 105 LocalFrame* m_frame;
91 MediaValuesMode m_mode; 106 MediaValuesMode m_mode;
92 107
93 // Members variables beyond this point must be thread safe, since they're co pied to the parser thread 108 // Members variables beyond this point must be thread safe, since they're co pied to the parser thread
94 int m_viewportWidth; 109 int m_viewportWidth;
95 int m_viewportHeight; 110 int m_viewportHeight;
96 int m_deviceWidth; 111 int m_deviceWidth;
97 int m_deviceHeight; 112 int m_deviceHeight;
98 float m_devicePixelRatio; 113 float m_devicePixelRatio;
99 int m_colorBitsPerComponent; 114 int m_colorBitsPerComponent;
100 int m_monochromeBitsPerComponent; 115 int m_monochromeBitsPerComponent;
101 PointerDeviceType m_pointer; 116 PointerDeviceType m_pointer;
102 int m_defaultFontSize; 117 int m_defaultFontSize;
118 int m_computedFontSize;
119 bool m_hasXHeight;
120 double m_xHeight;
121 double m_zeroWidth;
103 bool m_threeDEnabled; 122 bool m_threeDEnabled;
104 bool m_scanMediaType; 123 bool m_scanMediaType;
105 bool m_screenMediaType; 124 bool m_screenMediaType;
106 bool m_printMediaType; 125 bool m_printMediaType;
107 bool m_strictMode; 126 bool m_strictMode;
127 float m_effectiveZoom;
108 }; 128 };
109 129
110 } // namespace 130 } // namespace
111 #endif 131 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698