Bug 1239799 part 2: Add support for @media(-webkit-transform-3d) media query, for web compatibility. r=heycam

This commit is contained in:
Daniel Holbert 2016-01-18 09:24:44 -08:00
parent e037620319
commit 45a9745978
3 changed files with 21 additions and 0 deletions

View File

@ -1222,6 +1222,7 @@ GK_ATOM(tr, "tr")
GK_ATOM(track, "track")
GK_ATOM(trailing, "trailing")
GK_ATOM(transform, "transform")
GK_ATOM(transform_3d, "transform-3d")
GK_ATOM(transformiix, "transformiix")
GK_ATOM(translate, "translate")
GK_ATOM(transparent, "transparent")

View File

@ -324,6 +324,15 @@ GetDevicePixelRatio(nsPresContext* aPresContext, const nsMediaFeature*,
return NS_OK;
}
static nsresult
GetTransform3d(nsPresContext* aPresContext, const nsMediaFeature*,
nsCSSValue& aResult)
{
// Gecko supports 3d transforms, so this feature is always 1.
aResult.SetIntValue(1, eCSSUnit_Integer);
return NS_OK;
}
static nsresult
GetSystemMetric(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
@ -533,6 +542,15 @@ nsMediaFeatures::features[] = {
{ nullptr },
GetDevicePixelRatio
},
// -webkit-transform-3d:
{
&nsGkAtoms::transform_3d,
nsMediaFeature::eMinMaxNotAllowed,
nsMediaFeature::eBoolInteger,
nsMediaFeature::eHasWebkitPrefix,
{ nullptr },
GetTransform3d
},
// Mozilla extensions
{

View File

@ -440,6 +440,8 @@ function run() {
expression_should_be_parseable("-webkit-max-device-pixel-ratio: 1.0");
expression_should_not_be_parseable("max-device-pixel-ratio: 1.0");
should_apply("(-webkit-transform-3d)");
features = [ "max-aspect-ratio", "device-aspect-ratio" ];
for (i in features) {
feature = features[i];