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

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

Issue 13896036: [CSSMQ] Implemented support for the scan media feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed review issues. Created 7 years, 7 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/MediaQueryEvaluator.cpp
diff --git a/Source/core/css/MediaQueryEvaluator.cpp b/Source/core/css/MediaQueryEvaluator.cpp
index d1aa3f74b23342f292cac7de4e29f9d4ac323a69..eb0018d4d1dd3387bf810a9329cb1ea43590d180 100644
--- a/Source/core/css/MediaQueryEvaluator.cpp
+++ b/Source/core/css/MediaQueryEvaluator.cpp
@@ -67,14 +67,6 @@ typedef bool (*EvalFunc)(CSSValue*, RenderStyle*, Frame*, MediaFeaturePrefix);
typedef HashMap<AtomicStringImpl*, EvalFunc> FunctionMap;
static FunctionMap* gFunctionMap;
-/*
- * FIXME: following media features are not implemented: scan
- *
- * scan: The "scan" media feature describes the scanning process of
- * tv output devices. It's unknown how to retrieve this information from
- * the platform
- */
-
MediaQueryEvaluator::MediaQueryEvaluator(bool mediaFeatureResult)
: m_frame(0)
, m_style(0)
@@ -660,6 +652,25 @@ static bool pointerMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame,
|| (pointer == MousePointer && id == CSSValueFine);
}
+static bool scanMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix)
+{
+ // Scan only applies to tv media.
+ if (!equalIgnoringCase(frame->view()->mediaType(), "tv"))
+ return false;
+
+ if (!value)
+ return true;
+
+ if (!value->isPrimitiveValue())
+ return false;
+
+ // If a platform interface supplies progressive/interlace info for TVs in the
+ // future, it needs to be handled here. For now, assume a modern TV with
+ // progressive display.
+ const int id = static_cast<CSSPrimitiveValue*>(value)->getIdent();
+ return id == CSSValueProgressive;
+}
+
static void createFunctionMap()
{
// Create the table.

Powered by Google App Engine
This is Rietveld 408576698