summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp b/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp
index 16af9812e..4963ed4ed 100644
--- a/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp
+++ b/src/3rdparty/webkit/WebCore/css/MediaQueryEvaluator.cpp
@@ -40,11 +40,17 @@
#include "MediaList.h"
#include "MediaQuery.h"
#include "MediaQueryExp.h"
+#include "NodeRenderStyle.h"
#include "Page.h"
+#include "RenderView.h"
#include "RenderStyle.h"
#include "PlatformScreen.h"
#include <wtf/HashMap.h>
+#if ENABLE(3D_RENDERING)
+#include "RenderLayerCompositor.h"
+#endif
+
namespace WebCore {
using namespace MediaFeatureNames;
@@ -300,7 +306,8 @@ static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, F
{
if (value) {
FloatRect sg = screenRect(frame->page()->mainFrame()->view());
- return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.height()), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style), op);
+ RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
+ return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.height()), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op);
}
// ({,min-,max-}device-height)
// assume if we have a device, assume non-zero
@@ -311,7 +318,8 @@ static bool device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr
{
if (value) {
FloatRect sg = screenRect(frame->page()->mainFrame()->view());
- return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.width()), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style), op);
+ RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
+ return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.width()), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op);
}
// ({,min-,max-}device-width)
// assume if we have a device, assume non-zero
@@ -321,9 +329,10 @@ static bool device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Fr
static bool heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
{
FrameView* view = frame->view();
-
+ RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
+
if (value)
- return value->isPrimitiveValue() && compareValue(view->layoutHeight(), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style), op);
+ return value->isPrimitiveValue() && compareValue(view->layoutHeight(), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op);
return view->layoutHeight() != 0;
}
@@ -331,9 +340,10 @@ static bool heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* f
static bool widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op)
{
FrameView* view = frame->view();
-
+ RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle();
+
if (value)
- return value->isPrimitiveValue() && compareValue(view->layoutWidth(), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style), op);
+ return value->isPrimitiveValue() && compareValue(view->layoutWidth(), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op);
return view->layoutWidth() != 0;
}
@@ -457,15 +467,20 @@ static bool transform_2dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*,
return true;
}
-static bool transform_3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFeaturePrefix op)
+static bool transform_3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
{
bool returnValueIfNoParameter;
int have3dRendering;
#if ENABLE(3D_RENDERING)
- returnValueIfNoParameter = true;
- have3dRendering = 1;
+ bool threeDEnabled = false;
+ if (RenderView* view = frame->contentRenderer())
+ threeDEnabled = view->compositor()->hasAcceleratedCompositing();
+
+ returnValueIfNoParameter = threeDEnabled;
+ have3dRendering = threeDEnabled ? 1 : 0;
#else
+ UNUSED_PARAM(frame);
returnValueIfNoParameter = false;
have3dRendering = 0;
#endif