From b0494d18eab484dd18a36be5b1295688994457b1 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Tue, 22 Apr 2014 15:29:11 -0700 Subject: [PATCH] Backed out changeset 039b15c9b84e (bug 979345) for build bustage on a CLOSED TREE --- gfx/layers/apz/src/APZCTreeManager.h | 5 ++-- gfx/layers/apz/src/AsyncPanZoomController.cpp | 26 ++++++------------- gfx/layers/apz/src/AsyncPanZoomController.h | 9 ++----- .../gtest/TestAsyncPanZoomController.cpp | 6 ++--- layout/style/nsCSSKeywordList.h | 1 - layout/style/nsCSSParser.cpp | 13 ++-------- layout/style/nsCSSProps.cpp | 9 +++---- layout/style/nsCSSValue.cpp | 4 +-- layout/style/nsComputedDOMStyle.cpp | 22 ++++++++++------ layout/style/nsStyleConsts.h | 1 - layout/style/test/property_database.js | 13 +++------- widget/xpwidgets/ContentHelper.cpp | 13 ++++------ 12 files changed, 44 insertions(+), 78 deletions(-) diff --git a/gfx/layers/apz/src/APZCTreeManager.h b/gfx/layers/apz/src/APZCTreeManager.h index b0eec16712ac..5d3e2e12f437 100644 --- a/gfx/layers/apz/src/APZCTreeManager.h +++ b/gfx/layers/apz/src/APZCTreeManager.h @@ -32,9 +32,8 @@ enum AllowedTouchBehavior { NONE = 0, VERTICAL_PAN = 1 << 0, HORIZONTAL_PAN = 1 << 1, - PINCH_ZOOM = 1 << 2, - DOUBLE_TAP_ZOOM = 1 << 3, - UNKNOWN = 1 << 4 + ZOOM = 1 << 2, + UNKNOWN = 1 << 3 }; class Layer; diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index c09e5aee3176..c8af51ad5ded 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -233,8 +233,7 @@ typedef GeckoContentController::APZStateChange APZStateChange; */ static const uint32_t DefaultTouchBehavior = AllowedTouchBehavior::VERTICAL_PAN | AllowedTouchBehavior::HORIZONTAL_PAN | - AllowedTouchBehavior::PINCH_ZOOM | - AllowedTouchBehavior::DOUBLE_TAP_ZOOM; + AllowedTouchBehavior::ZOOM; /** * Angle from axis within which we stay axis-locked @@ -782,7 +781,7 @@ nsEventStatus AsyncPanZoomController::OnTouchCancel(const MultiTouchInput& aEven nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEvent) { APZC_LOG("%p got a scale-begin in state %d\n", this, mState); - if (!TouchActionAllowPinchZoom()) { + if (!TouchActionAllowZoom()) { return nsEventStatus_eIgnore; } @@ -973,7 +972,7 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEven APZC_LOG("%p got a single-tap-up in state %d\n", this, mState); // If mZoomConstraints.mAllowDoubleTapZoom is true we wait for a call to OnSingleTapConfirmed before // sending event to content - if (!(mZoomConstraints.mAllowDoubleTapZoom && TouchActionAllowDoubleTapZoom())) { + if (!mZoomConstraints.mAllowDoubleTapZoom) { return GenerateSingleTap(aEvent.mPoint, aEvent.modifiers); } return nsEventStatus_eIgnore; @@ -988,13 +987,14 @@ nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent) APZC_LOG("%p got a double-tap in state %d\n", this, mState); nsRefPtr controller = GetGeckoContentController(); if (controller) { - if (mZoomConstraints.mAllowDoubleTapZoom && TouchActionAllowDoubleTapZoom()) { + if (mZoomConstraints.mAllowDoubleTapZoom) { int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers); CSSPoint geckoScreenPoint; if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) { controller->HandleDoubleTap(geckoScreenPoint, modifiers, GetGuid()); } } + return nsEventStatus_eConsumeNoDefault; } return nsEventStatus_eIgnore; @@ -1961,29 +1961,19 @@ void AsyncPanZoomController::CheckContentResponse() { } } -bool AsyncPanZoomController::TouchActionAllowPinchZoom() { +bool AsyncPanZoomController::TouchActionAllowZoom() { if (!mTouchActionPropertyEnabled) { return true; } + // Pointer events specification implies all touch points to allow zoom // to perform it. for (size_t i = 0; i < mTouchBlockState.mAllowedTouchBehaviors.Length(); i++) { - if (!(mTouchBlockState.mAllowedTouchBehaviors[i] & AllowedTouchBehavior::PINCH_ZOOM)) { + if (!(mTouchBlockState.mAllowedTouchBehaviors[i] & AllowedTouchBehavior::ZOOM)) { return false; } } - return true; -} -bool AsyncPanZoomController::TouchActionAllowDoubleTapZoom() { - if (!mTouchActionPropertyEnabled) { - return true; - } - for (size_t i = 0; i < mTouchBlockState.mAllowedTouchBehaviors.Length(); i++) { - if (!(mTouchBlockState.mAllowedTouchBehaviors[i] & AllowedTouchBehavior::DOUBLE_TAP_ZOOM)) { - return false; - } - } return true; } diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h index 3c67ba157da5..996f8abd700f 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -595,14 +595,9 @@ private: }; /* - * Returns whether current touch behavior values allow pinch-zooming. + * Returns whether current touch behavior values allow zooming. */ - bool TouchActionAllowPinchZoom(); - - /* - * Returns whether current touch behavior values allow double-tap-zooming. - */ - bool TouchActionAllowDoubleTapZoom(); + bool TouchActionAllowZoom(); /* * Returns allowed touch behavior from the mAllowedTouchBehavior array. diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index cbe592927cff..07e0d6ad00c9 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -415,7 +415,7 @@ TEST_F(AsyncPanZoomControllerTester, PinchWithTouchActionNone) { nsTArray values; values.AppendElement(mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN); - values.AppendElement(mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM); + values.AppendElement(mozilla::layers::AllowedTouchBehavior::ZOOM); apzc->SetTouchActionEnabled(true); apzc->SetAllowedTouchBehavior(values); @@ -906,7 +906,7 @@ TEST_F(AsyncPanZoomControllerTester, LongPress) { TEST_F(AsyncPanZoomControllerTester, LongPressWithTouchAction) { DoLongPressTest(true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN | mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN - | mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM); + | mozilla::layers::AllowedTouchBehavior::ZOOM); } TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefault) { @@ -916,7 +916,7 @@ TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefault) { TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefaultWithTouchAction) { DoLongPressPreventDefaultTest(true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN | mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN - | mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM); + | mozilla::layers::AllowedTouchBehavior::ZOOM); } // Layer tree for HitTesting1 diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index c43eaa990b37..606023d9b5ae 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -372,7 +372,6 @@ CSS_KEY(lowercase, lowercase) CSS_KEY(ltr, ltr) CSS_KEY(luminance, luminance) CSS_KEY(luminosity, luminosity) -CSS_KEY(manipulation, manipulation) CSS_KEY(manual, manual) CSS_KEY(margin-box, margin_box) CSS_KEY(markers, markers) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index e0e749d479d6..9a7aff43e95a 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -12405,10 +12405,8 @@ CSSParserImpl::ParseTextOverflow(nsCSSValue& aValue) bool CSSParserImpl::ParseTouchAction(nsCSSValue& aValue) { - // Avaliable values of property touch-action: - // auto | none | [pan-x || pan-y] | manipulation - - if (!ParseVariant(aValue, VARIANT_HK, nsCSSProps::kTouchActionKTable)) { + if (!ParseVariant(aValue, VARIANT_HK | VARIANT_NONE | VARIANT_AUTO, + nsCSSProps::kTouchActionKTable)) { return false; } @@ -12428,13 +12426,6 @@ CSSParserImpl::ParseTouchAction(nsCSSValue& aValue) return false; } - // Auto and None and Manipulation is not allowed in conjunction with others. - if ((intValue | nextIntValue) & (NS_STYLE_TOUCH_ACTION_NONE | - NS_STYLE_TOUCH_ACTION_AUTO | - NS_STYLE_TOUCH_ACTION_MANIPULATION)) { - return false; - } - aValue.SetIntValue(nextIntValue | intValue, eCSSUnit_Enumerated); } diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 80803f987c79..886407141b64 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -1620,12 +1620,9 @@ const KTableValue nsCSSProps::kTextTransformKTable[] = { }; const KTableValue nsCSSProps::kTouchActionKTable[] = { - eCSSKeyword_none, NS_STYLE_TOUCH_ACTION_NONE, - eCSSKeyword_auto, NS_STYLE_TOUCH_ACTION_AUTO, - eCSSKeyword_pan_x, NS_STYLE_TOUCH_ACTION_PAN_X, - eCSSKeyword_pan_y, NS_STYLE_TOUCH_ACTION_PAN_Y, - eCSSKeyword_manipulation, NS_STYLE_TOUCH_ACTION_MANIPULATION, - eCSSKeyword_UNKNOWN, -1 + eCSSKeyword_pan_x, NS_STYLE_TOUCH_ACTION_PAN_X, + eCSSKeyword_pan_y, NS_STYLE_TOUCH_ACTION_PAN_Y, + eCSSKeyword_UNKNOWN, -1 }; const KTableValue nsCSSProps::kTransitionTimingFunctionKTable[] = { diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index 781ef65c8bfd..e0a720328344 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -1048,8 +1048,8 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, case eCSSProperty_touch_action: nsStyleUtil::AppendBitmaskCSSValue(aProperty, intValue, - NS_STYLE_TOUCH_ACTION_NONE, - NS_STYLE_TOUCH_ACTION_MANIPULATION, + NS_STYLE_TOUCH_ACTION_PAN_X, + NS_STYLE_TOUCH_ACTION_PAN_Y, aResult); break; diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 1f6993492fcd..dcf90381c5e0 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -4063,14 +4063,20 @@ nsComputedDOMStyle::DoGetTouchAction() int32_t intValue = StyleDisplay()->mTouchAction; - // None and Auto and Manipulation values aren't allowed - // to be in conjunction with other values. - // But there are all checks in CSSParserImpl::ParseTouchAction - nsAutoString valueStr; - nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_touch_action, intValue, - NS_STYLE_TOUCH_ACTION_NONE, NS_STYLE_TOUCH_ACTION_MANIPULATION, - valueStr); - val->SetString(valueStr); + // None and Auto values aren't allowed to be in conjunction with + // other values. + if (NS_STYLE_TOUCH_ACTION_AUTO == intValue) { + val->SetIdent(eCSSKeyword_auto); + } else if (NS_STYLE_TOUCH_ACTION_NONE == intValue) { + val->SetIdent(eCSSKeyword_none); + } else { + nsAutoString valueStr; + nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_touch_action, + intValue, NS_STYLE_TOUCH_ACTION_PAN_X, + NS_STYLE_TOUCH_ACTION_PAN_Y, valueStr); + val->SetString(valueStr); + } + return val; } diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index 8836c798532a..e2de9998afea 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -779,7 +779,6 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_TOUCH_ACTION_AUTO (1 << 1) #define NS_STYLE_TOUCH_ACTION_PAN_X (1 << 2) #define NS_STYLE_TOUCH_ACTION_PAN_Y (1 << 3) -#define NS_STYLE_TOUCH_ACTION_MANIPULATION (1 << 4) // See nsStyleDisplay #define NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE 0 diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index ac6dbf3eb2f3..b5ba594a87f1 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -4373,17 +4373,10 @@ if (SpecialPowers.getBoolPref("layout.css.touch_action.enabled")) { inherited: false, type: CSS_TYPE_LONGHAND, initial_values: ["auto"], - other_values: ["none", "pan-x", "pan-y", "pan-x pan-y", "pan-y pan-x", "manipulation"], + other_values: ["none", "pan-x", "pan-y", "pan-x pan-y", "pan-y pan-x"], invalid_values: ["zoom", "pinch", "tap", "10px", "2", "auto pan-x", "pan-x auto", "none pan-x", "pan-x none", - "auto pan-y", "pan-y auto", "none pan-y", "pan-y none", "pan-x pan-x", "pan-y pan-y", - "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 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 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", - "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", - "manipulation none", "none manipulation", "manipulation auto", "auto manipulation", "manipulation zoom", "zoom manipulation", - "manipulation manipulation", "manipulation pan-x", "pan-x manipulation", "manipulation pan-y", "pan-y 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"] + "auto pan-y", "pan-y auto", "none pan-y", "pan-y none", + "pan-x pan-y none", "none pan-x pan-y", "pan-x pan-y auto", "auto pan-x pan-y"] }; } diff --git a/widget/xpwidgets/ContentHelper.cpp b/widget/xpwidgets/ContentHelper.cpp index 8d25edb001b9..f7c6698a2802 100644 --- a/widget/xpwidgets/ContentHelper.cpp +++ b/widget/xpwidgets/ContentHelper.cpp @@ -35,12 +35,9 @@ void ContentHelper::UpdateAllowedBehavior(uint32_t aTouchActionValue, bool aConsiderPanning, TouchBehaviorFlags& aOutBehavior) { if (aTouchActionValue != NS_STYLE_TOUCH_ACTION_AUTO) { - // Double-tap-zooming need property value AUTO - aOutBehavior &= ~AllowedTouchBehavior::DOUBLE_TAP_ZOOM; - if (aTouchActionValue != NS_STYLE_TOUCH_ACTION_MANIPULATION) { - // Pinch-zooming need value AUTO or MANIPULATION - aOutBehavior &= ~AllowedTouchBehavior::PINCH_ZOOM; - } + // Dropping zoom flag since zooming requires touch-action values of all touches + // to be AUTO. + aOutBehavior &= ~AllowedTouchBehavior::ZOOM; } if (aConsiderPanning) { @@ -89,7 +86,7 @@ ContentHelper::GetAllowedTouchBehavior(nsIWidget* aWidget, const nsIntPoint& aPo bool considerPanning = true; TouchBehaviorFlags behavior = AllowedTouchBehavior::VERTICAL_PAN | AllowedTouchBehavior::HORIZONTAL_PAN | - AllowedTouchBehavior::PINCH_ZOOM | + AllowedTouchBehavior::ZOOM; for (nsIFrame *frame = target; frame && frame->GetContent() && behavior; frame = frame->GetParent()) { UpdateAllowedBehavior(GetTouchActionFromFrame(frame), considerPanning, behavior); @@ -105,4 +102,4 @@ ContentHelper::GetAllowedTouchBehavior(nsIWidget* aWidget, const nsIntPoint& aPo } } -} +} \ No newline at end of file