summaryrefslogtreecommitdiffstats
path: root/WebCore/css/MediaQueryEvaluator.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-11 17:01:47 +0100
committerBen Murdoch <benm@google.com>2009-08-11 18:21:02 +0100
commit0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch)
tree2943df35f62d885c89d01063cc528dd73b480fea /WebCore/css/MediaQueryEvaluator.cpp
parent7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff)
downloadexternal_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2
Merge in WebKit r47029.
Diffstat (limited to 'WebCore/css/MediaQueryEvaluator.cpp')
-rw-r--r--WebCore/css/MediaQueryEvaluator.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/WebCore/css/MediaQueryEvaluator.cpp b/WebCore/css/MediaQueryEvaluator.cpp
index c641dfd..4963ed4 100644
--- a/WebCore/css/MediaQueryEvaluator.cpp
+++ b/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;
@@ -162,7 +168,7 @@ bool MediaQueryEvaluator::eval(const MediaList* mediaList, CSSStyleSelector* sty
static bool parseAspectRatio(CSSValue* value, int& h, int& v)
{
- if (value->isValueList()){
+ if (value->isValueList()) {
CSSValueList* valueList = static_cast<CSSValueList*>(value);
if (valueList->length() == 3) {
CSSValue* i0 = valueList->itemWithoutBoundsCheck(0);
@@ -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