Index: Source/core/css/MediaValues.h |
diff --git a/Source/core/css/MediaValues.h b/Source/core/css/MediaValues.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..15fc1af761a3d4fc877428c09fe312cf176f1699 |
--- /dev/null |
+++ b/Source/core/css/MediaValues.h |
@@ -0,0 +1,127 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MediaValues_h |
+#define MediaValues_h |
+ |
+#include "core/css/MediaQueryEvaluator.h" |
+#include "core/css/resolver/StyleResolverState.h" |
+#include "core/rendering/style/RenderStyle.h" |
+#include "wtf/RefCounted.h" |
+#include "wtf/RefPtr.h" |
+#include "wtf/text/WTFString.h" |
+ |
+namespace WebCore { |
+ |
+class Document; |
+ |
+class MediaValues : public RefCounted<MediaValues> { |
+public: |
+ enum MediaValuesMode { CachingMode, DynamicMode }; |
abarth-chromium
2014/03/27 21:01:55
These should all be on separate lines.
|
+ |
+ static PassRefPtr<MediaValues> create(Document*, MediaValuesMode); |
+ static PassRefPtr<MediaValues> create(LocalFrame*, RenderStyle*, MediaValuesMode); |
+ PassRefPtr<MediaValues> copy() const; |
+ |
+ enum PointerDeviceType { TouchPointer, MousePointer, NoPointer, UnknownPointer }; |
abarth-chromium
2014/03/27 21:01:55
These too.
|
+ |
+ int viewportWidth() const; |
+ int viewportHeight() const; |
+ int deviceWidth() const; |
+ int deviceHeight() const; |
+ float devicePixelRatio() const; |
+ int colorBitsPerComponent() const; |
+ int monochromeBitsPerComponent() const; |
+ PointerDeviceType pointer() const; |
+ int defaultFontSize() const; |
+ bool threeDEnabled() const; |
+ bool scanMediaType() const; |
+ bool screenMediaType() const; |
+ bool printMediaType() const; |
+ bool strictMode() const; |
+ RenderStyle* style() const { return m_style.get(); } |
+ Document* document() const; |
+ |
+ MediaValues(PassRefPtr<RenderStyle> style, |
+ LocalFrame* frame, |
+ MediaValuesMode mode) |
abarth-chromium
2014/03/27 21:01:55
You can merge these three lines though. :)
|
+ : m_style(style) |
+ , m_frame(frame) |
+ , m_mode(mode) |
+ , m_viewportWidth(0) |
+ , m_viewportHeight(0) |
+ , m_deviceWidth(0) |
+ , m_deviceHeight(0) |
+ , m_devicePixelRatio(0) |
+ , m_colorBitsPerComponent(0) |
+ , m_monochromeBitsPerComponent(0) |
+ , m_pointer(UnknownPointer) |
+ , m_defaultFontSize(0) |
+ , m_threeDEnabled(false) |
+ , m_scanMediaType(false) |
+ , m_screenMediaType(false) |
+ , m_printMediaType(false) |
+ , m_strictMode(false) |
+ { |
+ ASSERT(mode == DynamicMode); |
+ } |
+ |
+ MediaValues(MediaValuesMode mode, |
+ int viewportWidth, |
+ int viewportHeight, |
+ int deviceWidth, |
+ int deviceHeight, |
+ float devicePixelRatio, |
+ int colorBitsPerComponent, |
+ int monochromeBitsPerComponent, |
+ PointerDeviceType pointer, |
+ int defaultFontSize, |
+ bool threeDEnabled, |
+ bool scanMediaType, |
+ bool screenMediaType, |
+ bool printMediaType, |
+ bool strictMode) |
+ : m_frame(0) |
+ , m_mode(mode) |
+ , m_viewportWidth(viewportWidth) |
+ , m_viewportHeight(viewportHeight) |
+ , m_deviceWidth(deviceWidth) |
+ , m_deviceHeight(deviceHeight) |
+ , m_devicePixelRatio(devicePixelRatio) |
+ , m_colorBitsPerComponent(colorBitsPerComponent) |
+ , m_monochromeBitsPerComponent(monochromeBitsPerComponent) |
+ , m_pointer(pointer) |
+ , m_defaultFontSize(defaultFontSize) |
+ , m_threeDEnabled(threeDEnabled) |
+ , m_scanMediaType(scanMediaType) |
+ , m_screenMediaType(screenMediaType) |
+ , m_printMediaType(printMediaType) |
+ , m_strictMode(strictMode) |
+ { |
+ ASSERT(mode == CachingMode); |
+ } |
+ |
+private: |
+ RefPtr<RenderStyle> m_style; |
+ LocalFrame* m_frame; |
+ MediaValuesMode m_mode; |
+ |
+ int m_viewportWidth; |
abarth-chromium
2014/03/27 21:01:55
I'd add a comment here explaining that the members
|
+ int m_viewportHeight; |
+ int m_deviceWidth; |
+ int m_deviceHeight; |
+ float m_devicePixelRatio; |
+ int m_colorBitsPerComponent; |
+ int m_monochromeBitsPerComponent; |
+ PointerDeviceType m_pointer; |
+ int m_defaultFontSize; |
+ bool m_threeDEnabled; |
+ bool m_scanMediaType; |
+ bool m_screenMediaType; |
+ bool m_printMediaType; |
+ bool m_strictMode; |
+}; |
+ |
+} // namespace |
+#endif |