Bug 1287576 - Change namespace and do some formatting cleanup for TouchActionHelper. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 25 Jul 2016 20:35:03 -0400
changeset 348708 a6c01c25609d9bbf3d420bc53c4416d6f18a0f0f
parent 348707 ed792deb7bcb93b51d1dd1e720b76c9c79e16457
child 348709 77c13c4140a4c2f95f97c2288e64ffabd4f8280a
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1287576
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1287576 - Change namespace and do some formatting cleanup for TouchActionHelper. r=botond MozReview-Commit-ID: 5Ih5NipLKwI
gfx/layers/apz/util/APZCCallbackHelper.cpp
gfx/layers/apz/util/TouchActionHelper.cpp
gfx/layers/apz/util/TouchActionHelper.h
--- 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__ */