mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1659642 - Split out a new file APZPublicUtils.h from APZUtils.h. r=kats
By moving the few things that need to be exposed to other components to APZPublicUtils.h, APZUtils.h becomes much less widely included (and thus changing it triggers a quicker recompile) while retaining most of its utilities. Differential Revision: https://phabricator.services.mozilla.com/D87404
This commit is contained in:
parent
f5e336aae1
commit
eff3b083d0
@ -15,7 +15,7 @@
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/layers/APZUtils.h"
|
||||
#include "mozilla/layers/APZPublicUtils.h"
|
||||
#include "Units.h"
|
||||
#include "WheelHandlingHelper.h" // for WheelDeltaAdjustmentStrategy
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "mozilla/ipc/ProcessChild.h"
|
||||
#include "mozilla/layers/APZInputBridgeParent.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/layers/APZUtils.h" // for apz::InitializeGlobalState
|
||||
#include "mozilla/layers/APZPublicUtils.h" // for apz::InitializeGlobalState
|
||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
||||
#include "mozilla/layers/CompositorManagerParent.h"
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
|
@ -7,9 +7,9 @@
|
||||
#ifndef mozilla_layers_APZInputBridge_h
|
||||
#define mozilla_layers_APZInputBridge_h
|
||||
|
||||
#include "mozilla/EventForwards.h" // for WidgetInputEvent, nsEventStatus
|
||||
#include "mozilla/layers/APZUtils.h" // for APZWheelAction
|
||||
#include "Units.h" // for LayoutDeviceIntPoint
|
||||
#include "mozilla/EventForwards.h" // for WidgetInputEvent, nsEventStatus
|
||||
#include "mozilla/layers/APZPublicUtils.h" // for APZWheelAction
|
||||
#include "Units.h" // for LayoutDeviceIntPoint
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
81
gfx/layers/apz/public/APZPublicUtils.h
Normal file
81
gfx/layers/apz/public/APZPublicUtils.h
Normal file
@ -0,0 +1,81 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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_APZPublicUtils_h
|
||||
#define mozilla_layers_APZPublicUtils_h
|
||||
|
||||
// This file is for APZ-related utilities that need to be consumed from outside
|
||||
// of gfx/layers. For internal utilities, prefer APZUtils.h.
|
||||
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <type_traits>
|
||||
#include "gfxTypes.h"
|
||||
#include "FrameMetrics.h"
|
||||
#include "LayersTypes.h"
|
||||
#include "UnitTransforms.h"
|
||||
#include "mozilla/gfx/CompositorHitTestInfo.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
#include "mozilla/DefineEnum.h"
|
||||
#include "mozilla/EnumSet.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct ExternalPixel;
|
||||
|
||||
template <>
|
||||
struct IsPixel<ExternalPixel> : std::true_type {};
|
||||
|
||||
typedef gfx::CoordTyped<ExternalPixel> ExternalCoord;
|
||||
typedef gfx::IntCoordTyped<ExternalPixel> ExternalIntCoord;
|
||||
typedef gfx::PointTyped<ExternalPixel> ExternalPoint;
|
||||
typedef gfx::IntPointTyped<ExternalPixel> ExternalIntPoint;
|
||||
typedef gfx::SizeTyped<ExternalPixel> ExternalSize;
|
||||
typedef gfx::IntSizeTyped<ExternalPixel> ExternalIntSize;
|
||||
typedef gfx::RectTyped<ExternalPixel> ExternalRect;
|
||||
typedef gfx::IntRectTyped<ExternalPixel> ExternalIntRect;
|
||||
typedef gfx::MarginTyped<ExternalPixel> ExternalMargin;
|
||||
typedef gfx::IntMarginTyped<ExternalPixel> ExternalIntMargin;
|
||||
typedef gfx::IntRegionTyped<ExternalPixel> ExternalIntRegion;
|
||||
|
||||
typedef gfx::Matrix4x4Typed<ExternalPixel, ParentLayerPixel>
|
||||
ExternalToParentLayerMatrix4x4;
|
||||
|
||||
struct ExternalPixel {};
|
||||
|
||||
namespace layers {
|
||||
|
||||
// clang-format off
|
||||
MOZ_DEFINE_ENUM_CLASS_WITH_BASE(APZWheelAction, uint8_t, (
|
||||
Scroll,
|
||||
PinchZoom
|
||||
))
|
||||
// clang-format on
|
||||
|
||||
namespace apz {
|
||||
|
||||
/**
|
||||
* Initializes the global state used in AsyncPanZoomController.
|
||||
* This is normally called when it is first needed in the constructor
|
||||
* of APZCTreeManager, but can be called manually to force it to be
|
||||
* initialized earlier.
|
||||
*/
|
||||
void InitializeGlobalState();
|
||||
|
||||
/**
|
||||
* See AsyncPanZoomController::CalculatePendingDisplayPort. This
|
||||
* function simply delegates to that one, so that non-layers code
|
||||
* never needs to include AsyncPanZoomController.h
|
||||
*/
|
||||
const ScreenMargin CalculatePendingDisplayPort(
|
||||
const FrameMetrics& aFrameMetrics, const ParentLayerPoint& aVelocity);
|
||||
|
||||
} // namespace apz
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_layers_APZPublicUtils_h
|
29
gfx/layers/apz/src/APZPublicUtils.cpp
Normal file
29
gfx/layers/apz/src/APZPublicUtils.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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 "mozilla/layers/APZPublicUtils.h"
|
||||
|
||||
#include "AsyncPanZoomController.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
namespace apz {
|
||||
|
||||
/*static*/ void InitializeGlobalState() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
AsyncPanZoomController::InitializeGlobalState();
|
||||
}
|
||||
|
||||
/*static*/ const ScreenMargin CalculatePendingDisplayPort(
|
||||
const FrameMetrics& aFrameMetrics, const ParentLayerPoint& aVelocity) {
|
||||
return AsyncPanZoomController::CalculatePendingDisplayPort(aFrameMetrics,
|
||||
aVelocity);
|
||||
}
|
||||
|
||||
} // namespace apz
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
@ -6,24 +6,11 @@
|
||||
|
||||
#include "mozilla/layers/APZUtils.h"
|
||||
|
||||
#include "AsyncPanZoomController.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
namespace apz {
|
||||
|
||||
/*static*/ void InitializeGlobalState() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
AsyncPanZoomController::InitializeGlobalState();
|
||||
}
|
||||
|
||||
/*static*/ const ScreenMargin CalculatePendingDisplayPort(
|
||||
const FrameMetrics& aFrameMetrics, const ParentLayerPoint& aVelocity) {
|
||||
return AsyncPanZoomController::CalculatePendingDisplayPort(aFrameMetrics,
|
||||
aVelocity);
|
||||
}
|
||||
|
||||
/*static*/ bool IsCloseToHorizontal(float aAngle, float aThreshold) {
|
||||
return (aAngle < aThreshold || aAngle > (M_PI - aThreshold));
|
||||
}
|
||||
|
@ -7,6 +7,11 @@
|
||||
#ifndef mozilla_layers_APZUtils_h
|
||||
#define mozilla_layers_APZUtils_h
|
||||
|
||||
// This file is for APZ-related utilities that are used by code in gfx/layers
|
||||
// only. For APZ-related utilities used by the Rest of the World (widget/,
|
||||
// layout/, dom/, IPDL protocols, etc.), use APZPublicUtils.h.
|
||||
// Do not include this header from source files outside of gfx/layers.
|
||||
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <type_traits>
|
||||
#include "gfxTypes.h"
|
||||
@ -21,32 +26,8 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct ExternalPixel;
|
||||
|
||||
template <>
|
||||
struct IsPixel<ExternalPixel> : std::true_type {};
|
||||
|
||||
typedef gfx::CoordTyped<ExternalPixel> ExternalCoord;
|
||||
typedef gfx::IntCoordTyped<ExternalPixel> ExternalIntCoord;
|
||||
typedef gfx::PointTyped<ExternalPixel> ExternalPoint;
|
||||
typedef gfx::IntPointTyped<ExternalPixel> ExternalIntPoint;
|
||||
typedef gfx::SizeTyped<ExternalPixel> ExternalSize;
|
||||
typedef gfx::IntSizeTyped<ExternalPixel> ExternalIntSize;
|
||||
typedef gfx::RectTyped<ExternalPixel> ExternalRect;
|
||||
typedef gfx::IntRectTyped<ExternalPixel> ExternalIntRect;
|
||||
typedef gfx::MarginTyped<ExternalPixel> ExternalMargin;
|
||||
typedef gfx::IntMarginTyped<ExternalPixel> ExternalIntMargin;
|
||||
typedef gfx::IntRegionTyped<ExternalPixel> ExternalIntRegion;
|
||||
|
||||
typedef gfx::Matrix4x4Typed<ExternalPixel, ParentLayerPixel>
|
||||
ExternalToParentLayerMatrix4x4;
|
||||
|
||||
struct ExternalPixel {};
|
||||
|
||||
namespace layers {
|
||||
|
||||
class AsyncPanZoomController;
|
||||
|
||||
enum CancelAnimationFlags : uint32_t {
|
||||
Default = 0x0, /* Cancel all animations */
|
||||
ExcludeOverscroll = 0x1, /* Don't clear overscroll */
|
||||
@ -78,11 +59,6 @@ enum class ScrollSource {
|
||||
// Keyboard
|
||||
Keyboard,
|
||||
};
|
||||
|
||||
MOZ_DEFINE_ENUM_CLASS_WITH_BASE(APZWheelAction, uint8_t, (
|
||||
Scroll,
|
||||
PinchZoom
|
||||
))
|
||||
// clang-format on
|
||||
|
||||
// Epsilon to be used when comparing 'float' coordinate values
|
||||
@ -138,22 +114,6 @@ constexpr AsyncTransformComponents LayoutAndVisual(
|
||||
|
||||
namespace apz {
|
||||
|
||||
/**
|
||||
* Initializes the global state used in AsyncPanZoomController.
|
||||
* This is normally called when it is first needed in the constructor
|
||||
* of APZCTreeManager, but can be called manually to force it to be
|
||||
* initialized earlier.
|
||||
*/
|
||||
void InitializeGlobalState();
|
||||
|
||||
/**
|
||||
* See AsyncPanZoomController::CalculatePendingDisplayPort. This
|
||||
* function simply delegates to that one, so that non-layers code
|
||||
* never needs to include AsyncPanZoomController.h
|
||||
*/
|
||||
const ScreenMargin CalculatePendingDisplayPort(
|
||||
const FrameMetrics& aFrameMetrics, const ParentLayerPoint& aVelocity);
|
||||
|
||||
/**
|
||||
* Is aAngle within the given threshold of the horizontal axis?
|
||||
* @param aAngle an angle in radians in the range [0, pi]
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "LayersTypes.h"
|
||||
#include "Units.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/layers/APZUtils.h"
|
||||
#include "mozilla/layers/MatrixMessage.h"
|
||||
#include "mozilla/layers/RepaintRequest.h"
|
||||
#include "nsRefreshObservers.h"
|
||||
|
@ -95,6 +95,7 @@ EXPORTS.mozilla.layers += [
|
||||
'AnimationInfo.h',
|
||||
'AnimationStorageData.h',
|
||||
'apz/public/APZInputBridge.h',
|
||||
'apz/public/APZPublicUtils.h',
|
||||
'apz/public/APZSampler.h',
|
||||
'apz/public/APZUpdater.h',
|
||||
'apz/public/CompositorController.h',
|
||||
@ -351,6 +352,7 @@ UNIFIED_SOURCES += [
|
||||
'AnimationInfo.cpp',
|
||||
'apz/src/APZCTreeManager.cpp',
|
||||
'apz/src/APZInputBridge.cpp',
|
||||
'apz/src/APZPublicUtils.cpp',
|
||||
'apz/src/APZSampler.cpp',
|
||||
'apz/src/APZUpdater.cpp',
|
||||
'apz/src/APZUtils.cpp',
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/layers/APZUtils.h" // for apz::CalculatePendingDisplayPort
|
||||
#include "mozilla/layers/APZPublicUtils.h" // for apz::CalculatePendingDisplayPort
|
||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||
#include "mozilla/layers/PAPZ.h"
|
||||
#include "mozilla/layers/StackingContextHelper.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/WheelHandlingHelper.h" // for WheelDeltaAdjustmentStrategy
|
||||
#include "mozilla/gfx/MatrixFwd.h"
|
||||
#include "mozilla/layers/APZUtils.h"
|
||||
#include "mozilla/layers/APZPublicUtils.h"
|
||||
#include "mozilla/layers/KeyboardScrollAction.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user