Bug 1145085 - Move widget/ContentHelper.* to gfx/layers/apz/util/TouchActionHelper.*.
r?BenWa,kats
MozReview-Commit-ID: 5snt3fIGnAS
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -1,16 +1,16 @@
/* -*- 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 "APZCCallbackHelper.h"
-#include "ContentHelper.h"
+#include "TouchActionHelper.h"
#include "gfxPlatform.h" // For gfxPlatform::UseTiling
#include "gfxPrefs.h"
#include "LayersLogging.h" // For Stringify
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/ShadowLayers.h"
@@ -782,17 +782,17 @@ 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::ContentHelper::GetAllowedTouchBehavior(
+ widget::TouchActionHelper::GetAllowedTouchBehavior(
aWidget, aEvent.mTouches[i]->mRefPoint));
}
aCallback(aInputBlockId, Move(flags));
}
void
APZCCallbackHelper::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
{
rename from widget/ContentHelper.cpp
rename to gfx/layers/apz/util/TouchActionHelper.cpp
--- a/widget/ContentHelper.cpp
+++ b/gfx/layers/apz/util/TouchActionHelper.cpp
@@ -1,27 +1,27 @@
/* -*- 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 "ContentHelper.h"
+#include "TouchActionHelper.h"
#include "nsContainerFrame.h"
#include "nsIContent.h"
#include "nsIScrollableFrame.h"
#include "nsLayoutUtils.h"
#include "nsStyleConsts.h"
#include "nsView.h"
namespace mozilla {
namespace widget {
void
-ContentHelper::UpdateAllowedBehavior(uint32_t aTouchActionValue, bool aConsiderPanning, TouchBehaviorFlags& aOutBehavior)
+TouchActionHelper::UpdateAllowedBehavior(uint32_t aTouchActionValue, bool aConsiderPanning, mozilla::layers::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 +38,18 @@ ContentHelper::UpdateAllowedBehavior(uin
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;
}
}
}
-ContentHelper::TouchBehaviorFlags
-ContentHelper::GetAllowedTouchBehavior(nsIWidget* aWidget, const LayoutDeviceIntPoint& aPoint)
+mozilla::layers::TouchBehaviorFlags
+TouchActionHelper::GetAllowedTouchBehavior(nsIWidget* aWidget, const LayoutDeviceIntPoint& aPoint)
{
nsView *view = nsView::GetViewFor(aWidget);
nsIFrame *viewFrame = view->GetFrame();
nsPoint relativePoint =
nsLayoutUtils::GetEventCoordinatesRelativeTo(aWidget, aPoint, viewFrame);
nsIFrame *target = nsLayoutUtils::GetFrameForPoint(viewFrame, relativePoint, nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME);
rename from widget/ContentHelper.h
rename to gfx/layers/apz/util/TouchActionHelper.h
--- a/widget/ContentHelper.h
+++ b/gfx/layers/apz/util/TouchActionHelper.h
@@ -1,39 +1,39 @@
/* -*- 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_widget_ContentHelper_h__
-#define __mozilla_widget_ContentHelper_h__
+#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"
namespace mozilla {
namespace widget {
/*
* Allow different platform widgets to access Content/DOM stuff.
*/
-class ContentHelper
+class TouchActionHelper
{
typedef mozilla::layers::AllowedTouchBehavior AllowedTouchBehavior;
- typedef uint32_t TouchBehaviorFlags;
private:
- static void UpdateAllowedBehavior(uint32_t aTouchActionValue, bool aConsiderPanning, TouchBehaviorFlags& aOutBehavior);
+ static void UpdateAllowedBehavior(uint32_t aTouchActionValue, bool aConsiderPanning, mozilla::layers::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 TouchBehaviorFlags GetAllowedTouchBehavior(nsIWidget* aWidget, const LayoutDeviceIntPoint& aPoint);
+ static mozilla::layers::TouchBehaviorFlags GetAllowedTouchBehavior(nsIWidget* aWidget, const LayoutDeviceIntPoint& aPoint);
};
} // namespace widget
} // namespace mozilla
-#endif /*__mozilla_widget_ContentHelper_h__ */
+#endif /*__mozilla_layers_TouchActionHelper_h__ */
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -110,16 +110,17 @@ EXPORTS.mozilla.layers += [
'apz/util/APZCCallbackHelper.h',
'apz/util/APZEventState.h',
'apz/util/APZThreadUtils.h',
'apz/util/ChromeProcessController.h',
'apz/util/DoubleTapToZoom.h',
'apz/util/InputAPZContext.h',
'apz/util/ScrollInputMethods.h',
'apz/util/ScrollLinkedEffectDetector.h',
+ 'apz/util/TouchActionHelper.h',
'AsyncCanvasRenderer.h',
'AtomicRefCountedWithFinalize.h',
'AxisPhysicsModel.h',
'AxisPhysicsMSDModel.h',
'basic/BasicCompositor.h',
'basic/MacIOSurfaceTextureHostBasic.h',
'basic/TextureHostBasic.h',
'BufferTexture.h',
@@ -279,16 +280,17 @@ UNIFIED_SOURCES += [
'apz/util/APZCCallbackHelper.cpp',
'apz/util/APZEventState.cpp',
'apz/util/APZThreadUtils.cpp',
'apz/util/CheckerboardReportService.cpp',
'apz/util/ChromeProcessController.cpp',
'apz/util/DoubleTapToZoom.cpp',
'apz/util/InputAPZContext.cpp',
'apz/util/ScrollLinkedEffectDetector.cpp',
+ 'apz/util/TouchActionHelper.cpp',
'AsyncCanvasRenderer.cpp',
'AxisPhysicsModel.cpp',
'AxisPhysicsMSDModel.cpp',
'basic/BasicCanvasLayer.cpp',
'basic/BasicColorLayer.cpp',
'basic/BasicCompositor.cpp',
'basic/BasicContainerLayer.cpp',
'basic/BasicImages.cpp',
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -16,16 +16,18 @@
#include "mozilla/layers/PLayerTransactionChild.h"
#include "mozilla/Preferences.h"
#include "mozilla/TextComposition.h"
#include "mozilla/TextEvents.h"
#include "mozilla/unused.h"
#include "PuppetWidget.h"
#include "nsContentUtils.h"
#include "nsIWidgetListener.h"
+#include "imgIContainer.h"
+#include "nsView.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::hal;
using namespace mozilla::gfx;
using namespace mozilla::layers;
using namespace mozilla::widget;
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -83,17 +83,16 @@ XPIDL_SOURCES += [
'nsISound.idl',
'nsITransferable.idl',
]
XPIDL_MODULE = 'widget'
EXPORTS += [
'CompositorWidgetProxy.h',
- 'ContentHelper.h',
'GfxDriverInfo.h',
'GfxInfoBase.h',
'GfxInfoCollector.h',
'InputData.h',
'nsBaseScreen.h',
'nsBaseWidget.h',
'nsIDeviceContextSpec.h',
'nsIKeyEventInPluginCallback.h',
@@ -132,24 +131,22 @@ EXPORTS.mozilla.widget += [
'IMEData.h',
'PuppetBidiKeyboard.h',
'WidgetMessageUtils.h',
]
UNIFIED_SOURCES += [
'CompositorWidgetProxy.cpp',
'ContentCache.cpp',
- 'ContentHelper.cpp',
'GfxDriverInfo.cpp',
'GfxInfoBase.cpp',
'GfxInfoCollector.cpp',
'GfxInfoWebGL.cpp',
'InputData.cpp',
'nsBaseAppShell.cpp',
- 'nsBaseDragService.cpp',
'nsBaseScreen.cpp',
'nsClipboardHelper.cpp',
'nsClipboardProxy.cpp',
'nsColorPickerProxy.cpp',
'nsContentProcessWidgetFactory.cpp',
'nsDragServiceProxy.cpp',
'nsFilePickerProxy.cpp',
'nsHTMLFormatConverter.cpp',
@@ -178,18 +175,20 @@ if CONFIG['MOZ_XUL'] and CONFIG['NS_PRIN
]
UNIFIED_SOURCES += [
'nsDeviceContextSpecProxy.cpp',
'nsPrintOptionsImpl.cpp',
'nsPrintSession.cpp',
]
# nsBaseWidget.cpp needs to be built separately because of name clashes in the OS X headers
+# nsBaseDragService.cpp moved out of UNIFIED to fix xgill crash (bug 1259850) after moving widget/ContentHelper -> apz/util/TouchActionHelper
SOURCES += [
- 'nsBaseWidget.cpp',
+ 'nsBaseDragService.cpp',
+ 'nsBaseWidget.cpp'
]
if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
EXPORTS.mozilla += [
'WidgetTraceEvent.h',
]
EXPORTS.ipc = ['nsGUIEventIPC.h']
--- a/widget/nsDeviceContextSpecProxy.cpp
+++ b/widget/nsDeviceContextSpecProxy.cpp
@@ -74,17 +74,17 @@ nsDeviceContextSpecProxy::GetSurfaceForP
}
// convert twips to points
width /= TWIPS_PER_POINT_FLOAT;
height /= TWIPS_PER_POINT_FLOAT;
RefPtr<gfxASurface> surface = gfxPlatform::GetPlatform()->
CreateOffscreenSurface(mozilla::gfx::IntSize(width, height),
- SurfaceFormat::A8R8G8B8_UINT32);
+ mozilla::gfx::SurfaceFormat::A8R8G8B8_UINT32);
surface.forget(aSurface);
return NS_OK;
}
NS_IMETHODIMP
nsDeviceContextSpecProxy::GetDrawEventRecorder(mozilla::gfx::DrawEventRecorder** aDrawEventRecorder)
{
@@ -110,17 +110,17 @@ nsDeviceContextSpecProxy::GetPrintingSca
return mRealDeviceContextSpec->GetPrintingScale();
}
NS_IMETHODIMP
nsDeviceContextSpecProxy::BeginDocument(const nsAString& aTitle,
const nsAString& aPrintToFileName,
int32_t aStartPage, int32_t aEndPage)
{
- mRecorder = new DrawEventRecorderMemory();
+ mRecorder = new mozilla::gfx::DrawEventRecorderMemory();
return mRemotePrintJob->InitializePrint(nsString(aTitle),
nsString(aPrintToFileName),
aStartPage, aEndPage);
}
NS_IMETHODIMP
nsDeviceContextSpecProxy::EndDocument()
{