| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MediaValues_h | 5 #ifndef MediaValues_h |
| 6 #define MediaValues_h | 6 #define MediaValues_h |
| 7 | 7 |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "wtf/RefCounted.h" | 9 #include "wtf/RefCounted.h" |
| 10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
| 11 | 11 |
| 12 namespace WebCore { | 12 namespace WebCore { |
| 13 | 13 |
| 14 class Document; | 14 class Document; |
| 15 class RenderStyle; | |
| 16 class CSSPrimitiveValue; | 15 class CSSPrimitiveValue; |
| 17 | 16 |
| 18 class MediaValues : public RefCounted<MediaValues> { | 17 class MediaValues : public RefCounted<MediaValues> { |
| 19 public: | 18 public: |
| 20 | 19 |
| 21 enum MediaValuesMode { | 20 enum MediaValuesMode { |
| 22 CachingMode, | 21 CachingMode, |
| 23 DynamicMode | 22 DynamicMode |
| 24 }; | 23 }; |
| 25 | 24 |
| 26 enum PointerDeviceType { | 25 enum PointerDeviceType { |
| 27 TouchPointer, | 26 TouchPointer, |
| 28 MousePointer, | 27 MousePointer, |
| 29 NoPointer, | 28 NoPointer, |
| 30 UnknownPointer | 29 UnknownPointer |
| 31 }; | 30 }; |
| 32 | 31 |
| 33 virtual ~MediaValues() { } | 32 virtual ~MediaValues() { } |
| 34 | 33 |
| 34 static PassRefPtr<MediaValues> createDynamicIfFrameExists(LocalFrame*); |
| 35 virtual PassRefPtr<MediaValues> copy() const = 0; | 35 virtual PassRefPtr<MediaValues> copy() const = 0; |
| 36 virtual bool isSafeToSendToAnotherThread() const = 0; | 36 virtual bool isSafeToSendToAnotherThread() const = 0; |
| 37 static bool computeLength(double value, unsigned short type, unsigned defaul
tFontSize, unsigned viewportWidth, unsigned viewportHeight, int& result); |
| 37 virtual bool computeLength(double value, unsigned short type, int& result) c
onst = 0; | 38 virtual bool computeLength(double value, unsigned short type, int& result) c
onst = 0; |
| 38 | 39 |
| 39 virtual int viewportWidth() const = 0; | 40 virtual int viewportWidth() const = 0; |
| 40 virtual int viewportHeight() const = 0; | 41 virtual int viewportHeight() const = 0; |
| 41 virtual int deviceWidth() const = 0; | 42 virtual int deviceWidth() const = 0; |
| 42 virtual int deviceHeight() const = 0; | 43 virtual int deviceHeight() const = 0; |
| 43 virtual float devicePixelRatio() const = 0; | 44 virtual float devicePixelRatio() const = 0; |
| 44 virtual int colorBitsPerComponent() const = 0; | 45 virtual int colorBitsPerComponent() const = 0; |
| 45 virtual int monochromeBitsPerComponent() const = 0; | 46 virtual int monochromeBitsPerComponent() const = 0; |
| 46 virtual PointerDeviceType pointer() const = 0; | 47 virtual PointerDeviceType pointer() const = 0; |
| 47 virtual bool threeDEnabled() const = 0; | 48 virtual bool threeDEnabled() const = 0; |
| 48 virtual bool scanMediaType() const = 0; | 49 virtual bool scanMediaType() const = 0; |
| 49 virtual bool screenMediaType() const = 0; | 50 virtual bool screenMediaType() const = 0; |
| 50 virtual bool printMediaType() const = 0; | 51 virtual bool printMediaType() const = 0; |
| 51 virtual bool strictMode() const = 0; | 52 virtual bool strictMode() const = 0; |
| 52 virtual Document* document() const = 0; | 53 virtual Document* document() const = 0; |
| 53 virtual bool hasValues() const = 0; | 54 virtual bool hasValues() const = 0; |
| 54 | 55 |
| 55 protected: | 56 protected: |
| 56 static Document* getExecutingDocument(Document&); | |
| 57 | |
| 58 int calculateViewportWidth(LocalFrame*) const; | 57 int calculateViewportWidth(LocalFrame*) const; |
| 59 int calculateViewportHeight(LocalFrame*) const; | 58 int calculateViewportHeight(LocalFrame*) const; |
| 60 int calculateDeviceWidth(LocalFrame*) const; | 59 int calculateDeviceWidth(LocalFrame*) const; |
| 61 int calculateDeviceHeight(LocalFrame*) const; | 60 int calculateDeviceHeight(LocalFrame*) const; |
| 62 bool calculateStrictMode(LocalFrame*) const; | 61 bool calculateStrictMode(LocalFrame*) const; |
| 63 float calculateDevicePixelRatio(LocalFrame*) const; | 62 float calculateDevicePixelRatio(LocalFrame*) const; |
| 64 int calculateColorBitsPerComponent(LocalFrame*) const; | 63 int calculateColorBitsPerComponent(LocalFrame*) const; |
| 65 int calculateMonochromeBitsPerComponent(LocalFrame*) const; | 64 int calculateMonochromeBitsPerComponent(LocalFrame*) const; |
| 66 int calculateDefaultFontSize(RenderStyle*) const; | 65 int calculateDefaultFontSize(LocalFrame*) const; |
| 67 int calculateComputedFontSize(RenderStyle*) const; | |
| 68 bool calculateHasXHeight(RenderStyle*) const; | |
| 69 double calculateXHeight(RenderStyle*) const; | |
| 70 double calculateZeroWidth(RenderStyle*) const; | |
| 71 bool calculateScanMediaType(LocalFrame*) const; | 66 bool calculateScanMediaType(LocalFrame*) const; |
| 72 bool calculateScreenMediaType(LocalFrame*) const; | 67 bool calculateScreenMediaType(LocalFrame*) const; |
| 73 bool calculatePrintMediaType(LocalFrame*) const; | 68 bool calculatePrintMediaType(LocalFrame*) const; |
| 74 bool calculateThreeDEnabled(LocalFrame*) const; | 69 bool calculateThreeDEnabled(LocalFrame*) const; |
| 75 float calculateEffectiveZoom(RenderStyle*) const; | |
| 76 MediaValues::PointerDeviceType calculateLeastCapablePrimaryPointerDeviceType
(LocalFrame*) const; | 70 MediaValues::PointerDeviceType calculateLeastCapablePrimaryPointerDeviceType
(LocalFrame*) const; |
| 77 | 71 |
| 78 }; | 72 }; |
| 79 | 73 |
| 80 } // namespace | 74 } // namespace |
| 81 | 75 |
| 82 #endif // MediaValues_h | 76 #endif // MediaValues_h |
| OLD | NEW |