Chromium Code Reviews| Index: Source/core/css/MediaValuesDynamic.cpp |
| diff --git a/Source/core/css/MediaValuesDynamic.cpp b/Source/core/css/MediaValuesDynamic.cpp |
| index 7608c28d2ce859097fe9b05869eec30c91db1080..810bf0f09e79c575a43aafe6d169cf0e550696e1 100644 |
| --- a/Source/core/css/MediaValuesDynamic.cpp |
| +++ b/Source/core/css/MediaValuesDynamic.cpp |
| @@ -9,40 +9,40 @@ |
| #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)); |
|
eseidel
2014/04/18 16:50:13
Why do we ever create a MediaValuesDynamic when th
|
| } |
| PassRefPtr<MediaValues> MediaValuesDynamic::create(Document& document) |
| { |
| Document* executingDocument = getExecutingDocument(document); |
| - return MediaValuesDynamic::create(executingDocument->frame(), executingDocument->renderer()->style()); |
| + ASSERT(executingDocument->frame()); |
| + return MediaValuesDynamic::create(executingDocument->frame()); |
| } |
| -MediaValuesDynamic::MediaValuesDynamic(PassRefPtr<LocalFrame> frame, PassRefPtr<RenderStyle> style) |
| - : m_style(style) |
| - , m_frame(frame) |
| +MediaValuesDynamic::MediaValuesDynamic(PassRefPtr<LocalFrame> frame) |
| + : m_frame(frame) |
| { |
| } |
| 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,14 +52,12 @@ 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()); |
| } |
| @@ -138,7 +136,7 @@ Document* MediaValuesDynamic::document() const |
| bool MediaValuesDynamic::hasValues() const |
| { |
| - return(m_style.get() && m_frame.get()); |
| + return(m_frame.get()); |
| } |
| } // namespace |