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

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

Issue 201813002: Enable Media query evaluation in the preload scanner (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix Debug crash. Values based MediaValues::create 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
« no previous file with comments | « Source/core/css/MediaQueryEvaluatorTest.cpp ('k') | Source/core/css/MediaValues.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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,
22 DynamicMode };
23
24 enum PointerDeviceType { TouchPointer,
25 MousePointer,
26 NoPointer,
27 UnknownPointer };
28
29
30 static PassRefPtr<MediaValues> create(Document*, MediaValuesMode);
31 static PassRefPtr<MediaValues> create(LocalFrame*, RenderStyle*, MediaValues Mode);
32 static PassRefPtr<MediaValues> create(MediaValuesMode,
33 int viewportWidth,
34 int viewportHeight,
35 int deviceWidth,
36 int deviceHeight,
37 float devicePixelRatio,
38 int colorBitsPerComponent,
39 int monochromeBitsPerComponent,
40 PointerDeviceType,
41 int defaultFontSize,
42 bool threeDEnabled,
43 bool scanMediaType,
44 bool screenMediaType,
45 bool printMediaType,
46 bool strictMode);
47 PassRefPtr<MediaValues> copy() const;
48 bool isSafeToSendToAnotherThread() const;
49
50 int viewportWidth() const;
51 int viewportHeight() const;
52 int deviceWidth() const;
53 int deviceHeight() const;
54 float devicePixelRatio() const;
55 int colorBitsPerComponent() const;
56 int monochromeBitsPerComponent() const;
57 PointerDeviceType pointer() const;
58 int defaultFontSize() const;
59 bool threeDEnabled() const;
60 bool scanMediaType() const;
61 bool screenMediaType() const;
62 bool printMediaType() const;
63 bool strictMode() const;
64 RenderStyle* style() const { return m_style.get(); }
65 Document* document() const;
66
67 private:
68 MediaValues(LocalFrame* frame, PassRefPtr<RenderStyle> style, MediaValuesMod e mode)
69 : m_style(style)
70 , m_frame(frame)
71 , m_mode(mode)
72 , m_viewportWidth(0)
73 , m_viewportHeight(0)
74 , m_deviceWidth(0)
75 , m_deviceHeight(0)
76 , m_devicePixelRatio(0)
77 , m_colorBitsPerComponent(0)
78 , m_monochromeBitsPerComponent(0)
79 , m_pointer(UnknownPointer)
80 , m_defaultFontSize(0)
81 , m_threeDEnabled(false)
82 , m_scanMediaType(false)
83 , m_screenMediaType(false)
84 , m_printMediaType(false)
85 , m_strictMode(false)
86 {
87 }
88
89 RefPtr<RenderStyle> m_style;
90 LocalFrame* m_frame;
91 MediaValuesMode m_mode;
92
93 // Members variables beyond this point must be thread safe, since they're co pied to the parser thread
94 int m_viewportWidth;
95 int m_viewportHeight;
96 int m_deviceWidth;
97 int m_deviceHeight;
98 float m_devicePixelRatio;
99 int m_colorBitsPerComponent;
100 int m_monochromeBitsPerComponent;
101 PointerDeviceType m_pointer;
102 int m_defaultFontSize;
103 bool m_threeDEnabled;
104 bool m_scanMediaType;
105 bool m_screenMediaType;
106 bool m_printMediaType;
107 bool m_strictMode;
108 };
109
110 } // namespace
111 #endif
OLDNEW
« no previous file with comments | « Source/core/css/MediaQueryEvaluatorTest.cpp ('k') | Source/core/css/MediaValues.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698