Bug 1329241 - Add support for touch-action:pinch-zoom - Add pinch-zoom support to touchAction r=kats,emilio

Differential Revision: https://phabricator.services.mozilla.com/D97815
This commit is contained in:
Sunita Sen 2020-11-24 13:33:51 +00:00
parent 6542f9d999
commit 663194d7fc
4 changed files with 86 additions and 6 deletions

View File

@ -10457,6 +10457,7 @@ exports.CSS_PROPERTIES = {
"none",
"pan-x",
"pan-y",
"pinch-zoom",
"revert",
"unset"
]

View File

@ -11792,8 +11792,19 @@ if (IsCSSPropertyPrefEnabled("layout.css.touch_action.enabled")) {
"none",
"pan-x",
"pan-y",
"pinch-zoom",
"pan-x pan-y",
"pan-y pan-x",
"pinch-zoom pan-x",
"pinch-zoom pan-y",
"pan-x pinch-zoom",
"pan-y pinch-zoom",
"pinch-zoom pan-x pan-y",
"pinch-zoom pan-y pan-x",
"pan-x pinch-zoom pan-y",
"pan-y pinch-zoom pan-x",
"pan-x pan-y pinch-zoom",
"pan-y pan-x pinch-zoom",
"manipulation",
],
invalid_values: [
@ -11812,30 +11823,83 @@ if (IsCSSPropertyPrefEnabled("layout.css.touch_action.enabled")) {
"pan-y none",
"pan-x pan-x",
"pan-y pan-y",
"auto pinch-zoom",
"pinch-zoom auto",
"none pinch-zoom",
"pinch-zoom none",
"pinch-zoom pinch-zoom",
"pan-x pan-y none",
"pan-x none pan-y",
"none pan-x pan-y",
"pan-y pan-x none",
"pan-y none pan-x",
"none pan-y pan-x",
"pan-x pinch-zoom none",
"pan-x none pinch-zoom",
"none pan-x pinch-zoom",
"pinch-zoom pan-x none",
"pinch-zoom none pan-x",
"none pinch-zoom pan-x",
"pinch-zoom pan-y none",
"pinch-zoom none pan-y",
"none pinch-zoom pan-y",
"pan-y pinch-zoom none",
"pan-y none pinch-zoom",
"none pan-y pinch-zoom",
"pan-x pan-y auto",
"pan-x auto pan-y",
"auto pan-x pan-y",
"pan-y pan-x auto",
"pan-y auto pan-x",
"auto pan-y pan-x",
"pan-x pinch-zoom auto",
"pan-x auto pinch-zoom",
"auto pan-x pinch-zoom",
"pinch-zoom pan-x auto",
"pinch-zoom auto pan-x",
"auto pinch-zoom pan-x",
"pinch-zoom pan-y auto",
"pinch-zoom auto pan-y",
"auto pinch-zoom pan-y",
"pan-y pinch-zoom auto",
"pan-y auto pinch-zoom",
"auto pan-y pinch-zoom",
"pan-x pan-y zoom",
"pan-x zoom pan-y",
"zoom pan-x pan-y",
"pan-y pan-x zoom",
"pan-y zoom pan-x",
"zoom pan-y pan-x",
"pinch-zoom pan-y zoom",
"pinch-zoom zoom pan-y",
"zoom pinch-zoom pan-y",
"pan-y pinch-zoom zoom",
"pan-y zoom pinch-zoom",
"zoom pan-y pinch-zoom",
"pan-x pinch-zoom zoom",
"pan-x zoom pinch-zoom",
"zoom pan-x pinch-zoom",
"pinch-zoom pan-x zoom",
"pinch-zoom zoom pan-x",
"zoom pinch-zoom pan-x",
"pan-x pan-y pan-x",
"pan-x pan-x pan-y",
"pan-y pan-x pan-x",
"pan-y pan-x pan-y",
"pan-y pan-y pan-x",
"pan-x pan-y pan-y",
"pan-x pinch-zoom pan-x",
"pan-x pan-x pinch-zoom",
"pinch-zoom pan-x pan-x",
"pinch-zoom pan-x pinch-zoom",
"pinch-zoom pinch-zoom pan-x",
"pan-x pinch-zoom pinch-zoom",
"pinch-zoom pan-y pinch-zoom",
"pinch-zoom pinch-zoom pan-y",
"pan-y pinch-zoom pinch-zoom",
"pan-y pinch-zoom pan-y",
"pan-y pan-y pinch-zoom",
"pinch-zoom pan-y pan-y",
"manipulation none",
"none manipulation",
"manipulation auto",
@ -11847,12 +11911,26 @@ if (IsCSSPropertyPrefEnabled("layout.css.touch_action.enabled")) {
"pan-x manipulation",
"manipulation pan-y",
"pan-y manipulation",
"manipulation pinch-zoom",
"pinch-zoom manipulation",
"manipulation pan-x pan-y",
"pan-x manipulation pan-y",
"pan-x pan-y manipulation",
"manipulation pan-y pan-x",
"pan-y manipulation pan-x",
"pan-y pan-x manipulation",
"manipulation pinch-zoom pan-y",
"pinch-zoom manipulation pan-y",
"pinch-zoom pan-y manipulation",
"manipulation pan-y pinch-zoom",
"pan-y manipulation pinch-zoom",
"pan-y pinch-zoom manipulation",
"manipulation pan-x pinch-zoom",
"pan-x manipulation pinch-zoom",
"pan-x pinch-zoom manipulation",
"manipulation pinch-zoom pan-x",
"pinch-zoom manipulation pan-x",
"pinch-zoom pan-x manipulation",
],
};
}

View File

@ -1171,7 +1171,7 @@ bitflags! {
/// Values for the `touch-action` property.
#[derive(MallocSizeOf, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, ToShmem)]
/// These constants match Gecko's `NS_STYLE_TOUCH_ACTION_*` constants.
#[value_info(other_values = "auto,none,manipulation,pan-x,pan-y")]
#[value_info(other_values = "auto,none,manipulation,pan-x,pan-y,pinch-zoom")]
#[repr(C)]
pub struct TouchAction: u8 {
/// `none` variant
@ -1184,6 +1184,8 @@ bitflags! {
const PAN_Y = 1 << 3;
/// `manipulation` variant
const MANIPULATION = 1 << 4;
/// `pinch-zoom` variant
const PINCH_ZOOM = 1 << 5;
}
}
@ -1224,6 +1226,7 @@ impl ToCss for TouchAction {
}
maybe_write_value!(TouchAction::PAN_X => "pan-x");
maybe_write_value!(TouchAction::PAN_Y => "pan-y");
maybe_write_value!(TouchAction::PINCH_ZOOM => "pinch-zoom");
debug_assert!(has_any);
Ok(())
@ -1231,7 +1234,7 @@ impl ToCss for TouchAction {
}
impl Parse for TouchAction {
/// auto | none | [ pan-x || pan-y ] | manipulation
/// auto | none | [ pan-x || pan-y || pinch-zoom ] | manipulation
fn parse<'i, 't>(
_context: &ParserContext,
input: &mut Parser<'i, 't>,
@ -1241,6 +1244,7 @@ impl Parse for TouchAction {
let flag = match_ignore_ascii_case! { &name,
"pan-x" => Some(TouchAction::PAN_X),
"pan-y" => Some(TouchAction::PAN_Y),
"pinch-zoom" => Some(TouchAction::PINCH_ZOOM),
"none" if result.is_empty() => return Ok(TouchAction::NONE),
"manipulation" if result.is_empty() => return Ok(TouchAction::MANIPULATION),
"auto" if result.is_empty() => return Ok(TouchAction::AUTO),

View File

@ -1,10 +1,7 @@
[pointerevent_touch-action-verification.html]
[explicit-pinch-zoom-pan-x-pan-up]
expected: FAIL
[explicit-pinch-zoom]
expected: FAIL
[explicit-pinch-zoom-pan-x-pan-y]
expected: FAIL