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

Unified Diff: Source/core/css/MediaQueryEvaluator.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 android build issue Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « no previous file | Source/core/css/MediaQueryEvaluator.cpp » ('j') | Source/core/html/parser/HTMLResourcePreloader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698