Index: Source/core/css/MediaQueryEvaluator.h |
diff --git a/Source/core/css/MediaQueryEvaluator.h b/Source/core/css/MediaQueryEvaluator.h |
index 4b3f9cff2d9f98bb120ead21bf02a399d3b67657..c42d7493216e4b152d3e6eb67fac403a258dd716 100644 |
--- a/Source/core/css/MediaQueryEvaluator.h |
+++ b/Source/core/css/MediaQueryEvaluator.h |
@@ -40,6 +40,64 @@ class RenderStyle; |
typedef WillBeHeapVector<RefPtrWillBeMember<MediaQueryResult> > MediaQueryResultList; |
typedef WillBePersistentHeapVector<RefPtrWillBeMember<MediaQueryResult> > WillBePersistentMediaQueryResultList; |
+class Document; |
+ |
+class MediaValues : public RefCountedWillBeGarbageCollected<MediaValues> { |
Mads Ager (chromium)
2014/03/22 09:33:54
As far as I can tell, there is no need to worry ab
|
+public: |
+ // Should return a pointer that auto destructs when copied |
+ static PassRefPtr<MediaValues> create(Document*); |
+ static PassRefPtr<MediaValues> copy(const MediaValues*); |
+ |
+ int getViewportWidth() { return m_viewportWidth; } |
+ int getViewportHeight() { return m_viewportHeight; } |
+ int getDeviceWidth() { return m_deviceWidth; } |
+ int getDeviceHeight() { return m_deviceHeight; } |
+ float getPixelRatio() { return m_pixelRatio; } |
+ int getColorBitsPerComponent() { return m_colorBitsPerComponent; } |
+ int getMonochromeBitsPerComponent() { return m_monochromeBitsPerComponent; } |
+ int getPointer() { return m_pointer; } |
+ int getDefaultFontSize() { return m_defaultFontSize; } |
+ bool getThreeDEnabled() { return m_threeDEnabled; } |
+ String getMediaType() { return m_mediaType; } |
+ |
+private: |
+ MediaValues(int viewportWidth, |
+ int viewportHeight, |
+ int deviceWidth, |
+ int deviceHeight, |
+ float pixelRatio, |
+ int colorBitsPerComponent, |
+ int monochromeBitsPerComponent, |
+ int pointer, |
+ int defaultFontSize, |
+ int threeDEnabled, |
+ String mediaType) |
+ : m_viewportWidth(viewportWidth) |
+ , m_viewportHeight(viewportHeight) |
+ , m_deviceWidth(deviceWidth) |
+ , m_deviceHeight(deviceHeight) |
+ , m_pixelRatio(pixelRatio) |
+ , m_colorBitsPerComponent(colorBitsPerComponent) |
+ , m_monochromeBitsPerComponent(monochromeBitsPerComponent) |
+ , m_pointer(pointer) |
+ , m_defaultFontSize(defaultFontSize) |
+ , m_threeDEnabled(threeDEnabled) |
+ , m_mediaType(mediaType.isolatedCopy()) |
+ { |
+ } |
+ |
+ int m_viewportWidth; |
+ int m_viewportHeight; |
+ int m_deviceWidth; |
+ int m_deviceHeight; |
+ float m_pixelRatio; |
+ int m_colorBitsPerComponent; |
+ int m_monochromeBitsPerComponent; |
+ int m_pointer; |
+ int m_defaultFontSize; |
+ bool m_threeDEnabled; |
+ String m_mediaType; |
+}; |
/** |
* Class that evaluates css media queries as defined in |
@@ -72,6 +130,10 @@ public: |
/** Creates evaluator which evaluates full media queries */ |
MediaQueryEvaluator(const String& acceptedMediaType, LocalFrame*, RenderStyle*); |
+ /** Creates evaluator which evaluates in a thread-safe manner a subset of media values |
+ */ |
+ MediaQueryEvaluator(const String& acceptedMediaType, const MediaValues* , bool mediaFeatureResult); |
+ |
~MediaQueryEvaluator(); |
bool mediaTypeMatch(const String& mediaTypeToMatch) const; |
@@ -88,6 +150,7 @@ private: |
LocalFrame* m_frame; // Not owned. |
RefPtr<RenderStyle> m_style; |
bool m_expResult; |
+ RefPtr<MediaValues> m_mediaValues; |
}; |
} // namespace |