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

Unified Diff: Source/core/css/MediaValuesDynamic.cpp

Issue 242883002: Remove MediaValues' dependency on RenderStyle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use MediaValuesCached in HTMLImageElement Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698