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
3 // found in the LICENSE file.
6 #include "core/css/MediaValuesDynamic.h"
8 #include "core/css/CSSHelper.h"
9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/CSSToLengthConversionData.h"
11 #include "core/dom/Document.h"
12 #include "core/frame/LocalFrame.h"
16 PassRefPtr<MediaValues> MediaValuesDynamic::create(LocalFrame* frame)
18 return adoptRef(new MediaValuesDynamic(frame));
21 MediaValuesDynamic::MediaValuesDynamic(LocalFrame* frame)
27 PassRefPtr<MediaValues> MediaValuesDynamic::copy() const
29 return adoptRef(new MediaValuesDynamic(m_frame));
32 bool MediaValuesDynamic::computeLength(double value, CSSPrimitiveValue::UnitTypes type, int& result) const
34 return MediaValues::computeLength(value,
36 calculateDefaultFontSize(m_frame),
37 calculateViewportWidth(m_frame),
38 calculateViewportHeight(m_frame),
42 bool MediaValuesDynamic::computeLength(double value, CSSPrimitiveValue::UnitTypes type, double& result) const
44 return MediaValues::computeLength(value,
46 calculateDefaultFontSize(m_frame),
47 calculateViewportWidth(m_frame),
48 calculateViewportHeight(m_frame),
52 bool MediaValuesDynamic::isSafeToSendToAnotherThread() const
57 int MediaValuesDynamic::viewportWidth() const
59 return calculateViewportWidth(m_frame);
62 int MediaValuesDynamic::viewportHeight() const
64 return calculateViewportHeight(m_frame);
67 int MediaValuesDynamic::deviceWidth() const
69 return calculateDeviceWidth(m_frame);
72 int MediaValuesDynamic::deviceHeight() const
74 return calculateDeviceHeight(m_frame);
77 float MediaValuesDynamic::devicePixelRatio() const
79 return calculateDevicePixelRatio(m_frame);
82 int MediaValuesDynamic::colorBitsPerComponent() const
84 return calculateColorBitsPerComponent(m_frame);
87 int MediaValuesDynamic::monochromeBitsPerComponent() const
89 return calculateMonochromeBitsPerComponent(m_frame);
92 MediaValues::PointerDeviceType MediaValuesDynamic::pointer() const
94 return calculateLeastCapablePrimaryPointerDeviceType(m_frame);
97 bool MediaValuesDynamic::threeDEnabled() const
99 return calculateThreeDEnabled(m_frame);
102 bool MediaValuesDynamic::scanMediaType() const
104 return calculateScanMediaType(m_frame);
107 bool MediaValuesDynamic::screenMediaType() const
109 return calculateScreenMediaType(m_frame);
112 bool MediaValuesDynamic::printMediaType() const
114 return calculatePrintMediaType(m_frame);
117 bool MediaValuesDynamic::strictMode() const
119 return calculateStrictMode(m_frame);
122 Document* MediaValuesDynamic::document() const
124 return m_frame->document();
127 bool MediaValuesDynamic::hasValues() const