Chromium Code Reviews| Index: Source/core/css/MediaQueryEvaluator.h |
| diff --git a/Source/core/css/MediaQueryEvaluator.h b/Source/core/css/MediaQueryEvaluator.h |
| index 4b3f9cff2d9f98bb120ead21bf02a399d3b67657..d94f8bdf2f72bb5a3b23e3cb356472269a8f4281 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 RefCounted<MediaValues> { |
|
abarth-chromium
2014/03/24 19:43:31
We prefer to have one class per file. This class
|
| +public: |
| + // Should return a pointer that auto destructs when copied |
|
abarth-chromium
2014/03/24 19:43:31
I'm not sure what this comment means... Is this a
|
| + static PassRefPtr<MediaValues> create(Document*); |
| + static PassRefPtr<MediaValues> copy(const MediaValues*); |
|
abarth-chromium
2014/03/24 19:43:31
Why isn't this a regular member function?
|
| + |
| + 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; } |
|
abarth-chromium
2014/03/24 19:43:31
We generally omit the "get" prefix on getters. Fo
|
| + |
| +private: |
| + MediaValues(int viewportWidth, |
|
eseidel
2014/03/25 13:15:19
I don't quite understand what's special about this
|
| + 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 |
| + */ |
|
abarth-chromium
2014/03/24 19:43:31
Can you convert these comments to C++ style commen
|
| + MediaQueryEvaluator(const String& acceptedMediaType, const MediaValues* , bool mediaFeatureResult); |
|
abarth-chromium
2014/03/24 19:43:31
You've got an extra space between the * and the ,
|
| + |
| ~MediaQueryEvaluator(); |
| bool mediaTypeMatch(const String& mediaTypeToMatch) const; |
| @@ -88,6 +150,7 @@ private: |
| LocalFrame* m_frame; // Not owned. |
|
abarth-chromium
2014/03/24 19:43:31
I'd remove this comment. The frame obviously isn'
|
| RefPtr<RenderStyle> m_style; |
| bool m_expResult; |
| + RefPtr<MediaValues> m_mediaValues; |
| }; |
| } // namespace |