Bug 1287576 - Change namespace and do some formatting cleanup for TouchActionHelper. r?botond
MozReview-Commit-ID: 6g4hLYbPq8i
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -773,18 +773,18 @@ APZCCallbackHelper::SendSetAllowedTouchB
nsIWidget* aWidget,
const WidgetTouchEvent& aEvent,
uint64_t aInputBlockId,
const SetAllowedTouchBehaviorCallback& aCallback)
{
nsTArray<TouchBehaviorFlags> flags;
for (uint32_t i = 0; i < aEvent.mTouches.Length(); i++) {
flags.AppendElement(
- widget::TouchActionHelper::GetAllowedTouchBehavior(
- aWidget, aEvent.mTouches[i]->mRefPoint));
+ TouchActionHelper::GetAllowedTouchBehavior(aWidget,
+ aEvent.mTouches[i]->mRefPoint));
}
aCallback(aInputBlockId, Move(flags));
}
void
APZCCallbackHelper::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
{
nsCOMPtr<nsIContent> targetContent = nsLayoutUtils::FindContentFor(aScrollId);
--- a/gfx/layers/apz/util/TouchActionHelper.cpp
+++ b/gfx/layers/apz/util/TouchActionHelper.cpp
@@ -1,27 +1,28 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "TouchActionHelper.h"
+#include "mozilla/layers/APZCTreeManager.h"
#include "nsContainerFrame.h"
-#include "nsIContent.h"
#include "nsIScrollableFrame.h"
#include "nsLayoutUtils.h"
-#include "nsStyleConsts.h"
#include "nsView.h"
namespace mozilla {
-namespace widget {
+namespace layers {
void
-TouchActionHelper::UpdateAllowedBehavior(uint32_t aTouchActionValue, bool aConsiderPanning, mozilla::layers::TouchBehaviorFlags& aOutBehavior)
+TouchActionHelper::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;
}
@@ -38,18 +39,19 @@ TouchActionHelper::UpdateAllowedBehavior
if ((aTouchActionValue & NS_STYLE_TOUCH_ACTION_PAN_X) && !(aTouchActionValue & NS_STYLE_TOUCH_ACTION_PAN_Y)) {
aOutBehavior &= ~AllowedTouchBehavior::VERTICAL_PAN;
} else if ((aTouchActionValue & NS_STYLE_TOUCH_ACTION_PAN_Y) && !(aTouchActionValue & NS_STYLE_TOUCH_ACTION_PAN_X)) {
aOutBehavior &= ~AllowedTouchBehavior::HORIZONTAL_PAN;
}
}
}
-mozilla::layers::TouchBehaviorFlags
-TouchActionHelper::GetAllowedTouchBehavior(nsIWidget* aWidget, const LayoutDeviceIntPoint& aPoint)
+TouchBehaviorFlags
+TouchActionHelper::GetAllowedTouchBehavior(nsIWidget* aWidget,
+ const LayoutDeviceIntPoint& aPoint)
{
nsView *view = nsView::GetViewFor(aWidget);
TouchBehaviorFlags behavior = AllowedTouchBehavior::VERTICAL_PAN | AllowedTouchBehavior::HORIZONTAL_PAN |
AllowedTouchBehavior::PINCH_ZOOM | AllowedTouchBehavior::DOUBLE_TAP_ZOOM;
if (!view) {
return behavior;
}
@@ -92,10 +94,10 @@ TouchActionHelper::GetAllowedTouchBehavi
// values for the purpose of panning but only for zooming.
considerPanning = false;
}
}
return behavior;
}
-} // namespace widget
+} // namespace layers
} // namespace mozilla
--- a/gfx/layers/apz/util/TouchActionHelper.h
+++ b/gfx/layers/apz/util/TouchActionHelper.h
@@ -1,39 +1,40 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __mozilla_layers_TouchActionHelper_h__
#define __mozilla_layers_TouchActionHelper_h__
-#include "nsIFrame.h"
-#include "nsIWidget.h"
-#include "mozilla/layers/APZCTreeManager.h"
-#include "mozilla/layers/APZUtils.h"
+#include "mozilla/layers/APZUtils.h" // for TouchBehaviorFlags
+
+class nsIWidget;
namespace mozilla {
-namespace widget {
+namespace layers {
/*
- * Allow different platform widgets to access Content/DOM stuff.
+ * Helper class to figure out the allowed touch behavior for frames, as per
+ * the touch-action spec.
*/
class TouchActionHelper
{
- typedef mozilla::layers::AllowedTouchBehavior AllowedTouchBehavior;
-
private:
- static void UpdateAllowedBehavior(uint32_t aTouchActionValue, bool aConsiderPanning, mozilla::layers::TouchBehaviorFlags& aOutBehavior);
+ static void UpdateAllowedBehavior(uint32_t aTouchActionValue,
+ bool aConsiderPanning,
+ TouchBehaviorFlags& aOutBehavior);
public:
/*
* Performs hit testing on content, finds frame that corresponds to the aPoint and retrieves
* touch-action css property value from it according the rules specified in the spec:
* http://www.w3.org/TR/pointerevents/#the-touch-action-css-property.
*/
- static mozilla::layers::TouchBehaviorFlags GetAllowedTouchBehavior(nsIWidget* aWidget, const LayoutDeviceIntPoint& aPoint);
+ static TouchBehaviorFlags GetAllowedTouchBehavior(nsIWidget* aWidget,
+ const LayoutDeviceIntPoint& aPoint);
};
-} // namespace widget
+} // namespace layers
} // namespace mozilla
#endif /*__mozilla_layers_TouchActionHelper_h__ */