| Index: Source/core/css/MediaValuesDynamic.cpp
|
| diff --git a/Source/core/css/MediaValuesDynamic.cpp b/Source/core/css/MediaValuesDynamic.cpp
|
| index 7608c28d2ce859097fe9b05869eec30c91db1080..b1539e53a3063d7b60c4963acf4b225e07a43fc0 100644
|
| --- a/Source/core/css/MediaValuesDynamic.cpp
|
| +++ b/Source/core/css/MediaValuesDynamic.cpp
|
| @@ -9,40 +9,34 @@
|
| #include "core/css/CSSPrimitiveValue.h"
|
| #include "core/css/CSSToLengthConversionData.h"
|
| #include "core/dom/Document.h"
|
| -#include "core/rendering/RenderObject.h"
|
| -#include "core/rendering/style/RenderStyle.h"
|
| -#include "core/rendering/style/StyleInheritedData.h"
|
|
|
| namespace WebCore {
|
|
|
| -PassRefPtr<MediaValues> MediaValuesDynamic::create(PassRefPtr<LocalFrame> frame, PassRefPtr<RenderStyle> style)
|
| +PassRefPtr<MediaValues> MediaValuesDynamic::create(PassRefPtr<LocalFrame> frame)
|
| {
|
| - return adoptRef(new MediaValuesDynamic(frame, style));
|
| + return adoptRef(new MediaValuesDynamic(frame));
|
| }
|
|
|
| -PassRefPtr<MediaValues> MediaValuesDynamic::create(Document& document)
|
| -{
|
| - Document* executingDocument = getExecutingDocument(document);
|
| - return MediaValuesDynamic::create(executingDocument->frame(), executingDocument->renderer()->style());
|
| -}
|
| -
|
| -MediaValuesDynamic::MediaValuesDynamic(PassRefPtr<LocalFrame> frame, PassRefPtr<RenderStyle> style)
|
| - : m_style(style)
|
| - , m_frame(frame)
|
| +MediaValuesDynamic::MediaValuesDynamic(PassRefPtr<LocalFrame> frame)
|
| + : m_frame(frame)
|
| {
|
| + ASSERT(m_frame.get());
|
| }
|
|
|
| PassRefPtr<MediaValues> MediaValuesDynamic::copy() const
|
| {
|
| - return adoptRef(new MediaValuesDynamic(m_frame, m_style));
|
| + return adoptRef(new MediaValuesDynamic(m_frame));
|
| }
|
|
|
| bool MediaValuesDynamic::computeLength(double value, unsigned short type, int& result) const
|
| {
|
| - ASSERT(m_style.get());
|
| - RefPtr<CSSPrimitiveValue> primitiveValue = CSSPrimitiveValue::create(value, (CSSPrimitiveValue::UnitTypes)type);
|
| - result = primitiveValue->computeLength<int>(CSSToLengthConversionData(m_style.get(), m_style.get(), 0, 1.0 /* zoom */, true /* computingFontSize */));
|
| - return true;
|
| + LocalFrame* frame = m_frame.get();
|
| + return MediaValues::computeLength(value,
|
| + type,
|
| + calculateDefaultFontSize(frame),
|
| + calculateViewportWidth(frame),
|
| + calculateViewportHeight(frame),
|
| + result);
|
| }
|
|
|
| bool MediaValuesDynamic::isSafeToSendToAnotherThread() const
|
| @@ -52,93 +46,77 @@ bool MediaValuesDynamic::isSafeToSendToAnotherThread() const
|
|
|
| int MediaValuesDynamic::viewportWidth() const
|
| {
|
| - ASSERT(m_style.get());
|
| - ASSERT(m_frame.get());
|
| return calculateViewportWidth(m_frame.get());
|
| }
|
|
|
| int MediaValuesDynamic::viewportHeight() const
|
| {
|
| - ASSERT(m_style.get());
|
| - ASSERT(m_frame.get());
|
| return calculateViewportHeight(m_frame.get());
|
| }
|
|
|
| int MediaValuesDynamic::deviceWidth() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateDeviceWidth(m_frame.get());
|
| }
|
|
|
| int MediaValuesDynamic::deviceHeight() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateDeviceHeight(m_frame.get());
|
| }
|
|
|
| float MediaValuesDynamic::devicePixelRatio() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateDevicePixelRatio(m_frame.get());
|
| }
|
|
|
| int MediaValuesDynamic::colorBitsPerComponent() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateColorBitsPerComponent(m_frame.get());
|
| }
|
|
|
| int MediaValuesDynamic::monochromeBitsPerComponent() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateMonochromeBitsPerComponent(m_frame.get());
|
| }
|
|
|
| MediaValues::PointerDeviceType MediaValuesDynamic::pointer() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateLeastCapablePrimaryPointerDeviceType(m_frame.get());
|
| }
|
|
|
| bool MediaValuesDynamic::threeDEnabled() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateThreeDEnabled(m_frame.get());
|
| }
|
|
|
| bool MediaValuesDynamic::scanMediaType() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateScanMediaType(m_frame.get());
|
| }
|
|
|
| bool MediaValuesDynamic::screenMediaType() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateScreenMediaType(m_frame.get());
|
| }
|
|
|
| bool MediaValuesDynamic::printMediaType() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculatePrintMediaType(m_frame.get());
|
| }
|
|
|
| bool MediaValuesDynamic::strictMode() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return calculateStrictMode(m_frame.get());
|
| }
|
|
|
| Document* MediaValuesDynamic::document() const
|
| {
|
| - ASSERT(m_frame.get());
|
| return m_frame->document();
|
| }
|
|
|
| bool MediaValuesDynamic::hasValues() const
|
| {
|
| - return(m_style.get() && m_frame.get());
|
| + return(m_frame.get());
|
| }
|
|
|
| } // namespace
|
|
|