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

Side by Side Diff: Source/core/css/MediaValues.h

Issue 1104103002: Add <meta viewport> support to the preloader (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: moved CachedDocumentParameters constructor to private Created 5 years, 7 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 unified diff | Download patch
OLDNEW
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/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/PointerProperties.h" 10 #include "core/css/PointerProperties.h"
11 #include "public/platform/WebDisplayMode.h" 11 #include "public/platform/WebDisplayMode.h"
12 #include "wtf/RefCounted.h" 12 #include "wtf/RefCounted.h"
13 #include "wtf/RefPtr.h" 13 #include "wtf/RefPtr.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class Document; 17 class Document;
18 class CSSPrimitiveValue; 18 class CSSPrimitiveValue;
19 class LocalFrame; 19 class LocalFrame;
20 20
21 class CORE_EXPORT MediaValues : public RefCounted<MediaValues> { 21 class CORE_EXPORT MediaValues : public RefCounted<MediaValues> {
22 public: 22 public:
23 23
24 enum MediaValuesMode {
25 CachingMode,
26 DynamicMode
27 };
28
29 virtual ~MediaValues() { } 24 virtual ~MediaValues() { }
30 25
31 static PassRefPtr<MediaValues> createDynamicIfFrameExists(LocalFrame*); 26 static PassRefPtr<MediaValues> createDynamicIfFrameExists(LocalFrame*);
32 virtual PassRefPtr<MediaValues> copy() const = 0; 27 virtual PassRefPtr<MediaValues> copy() const = 0;
33 virtual bool isSafeToSendToAnotherThread() const = 0; 28 virtual bool isSafeToSendToAnotherThread() const = 0;
34 29
35 static bool computeLengthImpl(double value, CSSPrimitiveValue::UnitType, uns igned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, double& result); 30 static bool computeLengthImpl(double value, CSSPrimitiveValue::UnitType, uns igned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, double& result);
36 template<typename T> 31 template<typename T>
37 static bool computeLength(double value, CSSPrimitiveValue::UnitType type, un signed defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, T& resu lt) 32 static bool computeLength(double value, CSSPrimitiveValue::UnitType type, un signed defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, T& resu lt)
38 { 33 {
(...skipping 17 matching lines...) Expand all
56 virtual int availablePointerTypes() const = 0; 51 virtual int availablePointerTypes() const = 0;
57 virtual HoverType primaryHoverType() const = 0; 52 virtual HoverType primaryHoverType() const = 0;
58 virtual int availableHoverTypes() const = 0; 53 virtual int availableHoverTypes() const = 0;
59 virtual bool threeDEnabled() const = 0; 54 virtual bool threeDEnabled() const = 0;
60 virtual const String mediaType() const = 0; 55 virtual const String mediaType() const = 0;
61 virtual WebDisplayMode displayMode() const = 0; 56 virtual WebDisplayMode displayMode() const = 0;
62 virtual bool strictMode() const = 0; 57 virtual bool strictMode() const = 0;
63 virtual Document* document() const = 0; 58 virtual Document* document() const = 0;
64 virtual bool hasValues() const = 0; 59 virtual bool hasValues() const = 0;
65 60
61 virtual bool isCached() const { return false; }
62
66 protected: 63 protected:
67 int calculateViewportWidth(LocalFrame*) const; 64 int calculateViewportWidth(LocalFrame*) const;
68 int calculateViewportHeight(LocalFrame*) const; 65 int calculateViewportHeight(LocalFrame*) const;
69 int calculateDeviceWidth(LocalFrame*) const; 66 int calculateDeviceWidth(LocalFrame*) const;
70 int calculateDeviceHeight(LocalFrame*) const; 67 int calculateDeviceHeight(LocalFrame*) const;
71 bool calculateStrictMode(LocalFrame*) const; 68 bool calculateStrictMode(LocalFrame*) const;
72 float calculateDevicePixelRatio(LocalFrame*) const; 69 float calculateDevicePixelRatio(LocalFrame*) const;
73 int calculateColorBitsPerComponent(LocalFrame*) const; 70 int calculateColorBitsPerComponent(LocalFrame*) const;
74 int calculateMonochromeBitsPerComponent(LocalFrame*) const; 71 int calculateMonochromeBitsPerComponent(LocalFrame*) const;
75 int calculateDefaultFontSize(LocalFrame*) const; 72 int calculateDefaultFontSize(LocalFrame*) const;
76 const String calculateMediaType(LocalFrame*) const; 73 const String calculateMediaType(LocalFrame*) const;
77 WebDisplayMode calculateDisplayMode(LocalFrame*) const; 74 WebDisplayMode calculateDisplayMode(LocalFrame*) const;
78 bool calculateThreeDEnabled(LocalFrame*) const; 75 bool calculateThreeDEnabled(LocalFrame*) const;
79 PointerType calculatePrimaryPointerType(LocalFrame*) const; 76 PointerType calculatePrimaryPointerType(LocalFrame*) const;
80 int calculateAvailablePointerTypes(LocalFrame*) const; 77 int calculateAvailablePointerTypes(LocalFrame*) const;
81 HoverType calculatePrimaryHoverType(LocalFrame*) const; 78 HoverType calculatePrimaryHoverType(LocalFrame*) const;
82 int calculateAvailableHoverTypes(LocalFrame*) const; 79 int calculateAvailableHoverTypes(LocalFrame*) const;
83 static LocalFrame* frameFrom(Document&); 80 static LocalFrame* frameFrom(Document&);
84 81
85 }; 82 };
86 83
87 } // namespace 84 } // namespace
88 85
89 #endif // MediaValues_h 86 #endif // MediaValues_h
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/HTMLImageElement/image-sizes-meta-viewport.html ('k') | Source/core/css/MediaValuesCached.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698