static bool widthMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePrefix op, const MediaValues& mediaValues) { int width = mediaValues.viewportWidth(); if (value.isValid()) return computeLengthAndCompare(value, op, mediaValues, width); return width; }
static bool aspectRatioMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePrefix op, const MediaValues& mediaValues) { if (value.isValid()) return compareAspectRatioValue(value, mediaValues.viewportWidth(), mediaValues.viewportHeight(), op); // ({,min-,max-}aspect-ratio) // assume if we have a device, its aspect ratio is non-zero. return true; }
static bool widthMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePrefix op, const MediaValues& mediaValues) { int width = mediaValues.viewportWidth(); if (value.isValid()) { int length; return computeLength(value, mediaValues, length) && compareValue(width, length, op); } return width; }
static bool orientationMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePrefix, const MediaValues& mediaValues) { int width = mediaValues.viewportWidth(); int height = mediaValues.viewportHeight(); if (value.isID) { if (width > height) // Square viewport is portrait. return CSSValueLandscape == value.id; return CSSValuePortrait == value.id; } // Expression (orientation) evaluates to true if width and height >= 0. return height >= 0 && width >= 0; }