зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1420996) for marionette failures.
Backed out changeset 413bd039c126 (bug 1420996) Backed out changeset 01ed229650de (bug 1420996)
This commit is contained in:
Родитель
b401573dfe
Коммит
a12393e44d
|
@ -20,6 +20,7 @@
|
|||
#include "gfxTelemetry.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "mozilla/gfx/CompositorHitTestInfo.h"
|
||||
#include "mozilla/gfx/Matrix.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsRegion.h"
|
||||
|
@ -949,6 +950,13 @@ struct ParamTraits<mozilla::Array<T, Length>>
|
|||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::gfx::CompositorHitTestInfo>
|
||||
: public BitFlagsEnumSerializer<mozilla::gfx::CompositorHitTestInfo,
|
||||
mozilla::gfx::CompositorHitTestInfo::ALL_BITS>
|
||||
{
|
||||
};
|
||||
|
||||
} /* namespace IPC */
|
||||
|
||||
#endif /* __GFXMESSAGEUTILS_H__ */
|
||||
|
|
|
@ -248,6 +248,7 @@ APZCTreeManager::APZCTreeManager(LayersId aRootLayersId)
|
|||
mUpdater(nullptr),
|
||||
mTreeLock("APZCTreeLock"),
|
||||
mMapLock("APZCMapLock"),
|
||||
mHitResultForInputBlock(CompositorHitTestInfo::eInvisibleToHitTest),
|
||||
mRetainedTouchIdentifier(-1),
|
||||
mInScrollbarTouchDrag(false),
|
||||
mApzcTreeLog("apzctree"),
|
||||
|
@ -1177,7 +1178,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
*aOutInputBlockId = InputBlockState::NO_BLOCK_ID;
|
||||
}
|
||||
nsEventStatus result = nsEventStatus_eIgnore;
|
||||
CompositorHitTestInfo hitResult = CompositorHitTestInvisibleToHit;
|
||||
CompositorHitTestInfo hitResult = CompositorHitTestInfo::eInvisibleToHitTest;
|
||||
switch (aEvent.mInputType) {
|
||||
case MULTITOUCH_INPUT: {
|
||||
MultiTouchInput& touchInput = aEvent.AsMultiTouchInput();
|
||||
|
@ -1284,7 +1285,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(wheelInput.mOrigin,
|
||||
&hitResult);
|
||||
if (apzc) {
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInvisibleToHit);
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInfo::eInvisibleToHitTest);
|
||||
|
||||
if (wheelInput.mAPZAction == APZWheelAction::PinchZoom) {
|
||||
// The mousewheel may have hit a subframe, but we want to send the
|
||||
|
@ -1349,7 +1350,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(panInput.mPanStartPoint,
|
||||
&hitResult);
|
||||
if (apzc) {
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInvisibleToHit);
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInfo::eInvisibleToHitTest);
|
||||
|
||||
// For pan gesture events, the call to ReceiveInputEvent below may result in
|
||||
// scrolling, which changes the async transform. However, the event we
|
||||
|
@ -1388,7 +1389,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(pinchInput.mFocusPoint,
|
||||
&hitResult);
|
||||
if (apzc) {
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInvisibleToHit);
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInfo::eInvisibleToHitTest);
|
||||
|
||||
ScreenToScreenMatrix4x4 outTransform = GetScreenToApzcTransform(apzc)
|
||||
* GetApzcToGeckoTransform(apzc);
|
||||
|
@ -1414,7 +1415,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(tapInput.mPoint,
|
||||
&hitResult);
|
||||
if (apzc) {
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInvisibleToHit);
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInfo::eInvisibleToHitTest);
|
||||
|
||||
ScreenToScreenMatrix4x4 outTransform = GetScreenToApzcTransform(apzc)
|
||||
* GetApzcToGeckoTransform(apzc);
|
||||
|
@ -1529,28 +1530,28 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
}
|
||||
|
||||
static TouchBehaviorFlags
|
||||
ConvertToTouchBehavior(const CompositorHitTestInfo& info)
|
||||
ConvertToTouchBehavior(CompositorHitTestInfo info)
|
||||
{
|
||||
TouchBehaviorFlags result = AllowedTouchBehavior::UNKNOWN;
|
||||
if (info == CompositorHitTestInvisibleToHit) {
|
||||
if (info == CompositorHitTestInfo::eInvisibleToHitTest) {
|
||||
result = AllowedTouchBehavior::NONE;
|
||||
} else if (info.contains(CompositorHitTestFlags::eDispatchToContent)) {
|
||||
} else if (info & CompositorHitTestInfo::eDispatchToContent) {
|
||||
result = AllowedTouchBehavior::UNKNOWN;
|
||||
} else {
|
||||
result = AllowedTouchBehavior::VERTICAL_PAN
|
||||
| AllowedTouchBehavior::HORIZONTAL_PAN
|
||||
| AllowedTouchBehavior::PINCH_ZOOM
|
||||
| AllowedTouchBehavior::DOUBLE_TAP_ZOOM;
|
||||
if (info.contains(CompositorHitTestFlags::eTouchActionPanXDisabled)) {
|
||||
if (info & CompositorHitTestInfo::eTouchActionPanXDisabled) {
|
||||
result &= ~AllowedTouchBehavior::HORIZONTAL_PAN;
|
||||
}
|
||||
if (info.contains(CompositorHitTestFlags::eTouchActionPanYDisabled)) {
|
||||
if (info & CompositorHitTestInfo::eTouchActionPanYDisabled) {
|
||||
result &= ~AllowedTouchBehavior::VERTICAL_PAN;
|
||||
}
|
||||
if (info.contains(CompositorHitTestFlags::eTouchActionPinchZoomDisabled)) {
|
||||
if (info & CompositorHitTestInfo::eTouchActionPinchZoomDisabled) {
|
||||
result &= ~AllowedTouchBehavior::PINCH_ZOOM;
|
||||
}
|
||||
if (info.contains(CompositorHitTestFlags::eTouchActionDoubleTapZoomDisabled)) {
|
||||
if (info & CompositorHitTestInfo::eTouchActionDoubleTapZoomDisabled) {
|
||||
result &= ~AllowedTouchBehavior::DOUBLE_TAP_ZOOM;
|
||||
}
|
||||
}
|
||||
|
@ -1621,7 +1622,7 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
|
|||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
mHitResultForInputBlock = CompositorHitTestInvisibleToHit;
|
||||
mHitResultForInputBlock = CompositorHitTestInfo::eInvisibleToHitTest;
|
||||
mApzcForInputBlock = GetTouchInputBlockAPZC(aInput, &touchBehaviors,
|
||||
&mHitResultForInputBlock, &hitScrollbarNode);
|
||||
|
||||
|
@ -1680,7 +1681,7 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
|
|||
}
|
||||
|
||||
if (mApzcForInputBlock) {
|
||||
MOZ_ASSERT(mHitResultForInputBlock != CompositorHitTestInvisibleToHit);
|
||||
MOZ_ASSERT(mHitResultForInputBlock != CompositorHitTestInfo::eInvisibleToHitTest);
|
||||
|
||||
mApzcForInputBlock->GetGuid(aOutTargetGuid);
|
||||
uint64_t inputBlockId = 0;
|
||||
|
@ -1719,7 +1720,7 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
|
|||
// don't keep dangling references and leak things.
|
||||
if (mTouchCounter.GetActiveTouchCount() == 0) {
|
||||
mApzcForInputBlock = nullptr;
|
||||
mHitResultForInputBlock = CompositorHitTestInvisibleToHit;
|
||||
mHitResultForInputBlock = CompositorHitTestInfo::eInvisibleToHitTest;
|
||||
mRetainedTouchIdentifier = -1;
|
||||
mInScrollbarTouchDrag = false;
|
||||
}
|
||||
|
@ -1973,13 +1974,13 @@ APZCTreeManager::ProcessUnhandledEvent(LayoutDeviceIntPoint* aRefPoint,
|
|||
|
||||
// Transform the aRefPoint.
|
||||
// If the event hits an overscrolled APZC, instruct the caller to ignore it.
|
||||
CompositorHitTestInfo hitResult = CompositorHitTestInvisibleToHit;
|
||||
CompositorHitTestInfo hitResult = CompositorHitTestInfo::eInvisibleToHitTest;
|
||||
PixelCastJustification LDIsScreen = PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent;
|
||||
ScreenIntPoint refPointAsScreen =
|
||||
ViewAs<ScreenPixel>(*aRefPoint, LDIsScreen);
|
||||
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(refPointAsScreen, &hitResult);
|
||||
if (apzc) {
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInvisibleToHit);
|
||||
MOZ_ASSERT(hitResult != CompositorHitTestInfo::eInvisibleToHitTest);
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
ScreenToParentLayerMatrix4x4 transformToApzc = GetScreenToApzcTransform(apzc);
|
||||
ParentLayerToScreenMatrix4x4 transformToGecko = GetApzcToGeckoTransform(apzc);
|
||||
|
@ -2469,7 +2470,7 @@ APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint,
|
|||
{
|
||||
RecursiveMutexAutoLock lock(mTreeLock);
|
||||
|
||||
CompositorHitTestInfo hitResult;
|
||||
CompositorHitTestInfo hitResult = CompositorHitTestInfo::eInvisibleToHitTest;
|
||||
HitTestingTreeNode* scrollbarNode = nullptr;
|
||||
RefPtr<AsyncPanZoomController> target;
|
||||
if (gfx::gfxVars::UseWebRender()) {
|
||||
|
@ -2505,7 +2506,7 @@ APZCTreeManager::GetAPZCAtPointWR(const ScreenPoint& aHitTestPoint,
|
|||
// here allows those tests which are not specifically
|
||||
// testing the hit-test algorithm to still work.
|
||||
result = FindRootApzcForLayersId(mRootLayersId);
|
||||
*aOutHitResult = CompositorHitTestFlags::eVisibleToHitTest;
|
||||
*aOutHitResult = CompositorHitTestInfo::eVisibleToHitTest;
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
|
@ -2527,9 +2528,9 @@ APZCTreeManager::GetAPZCAtPointWR(const ScreenPoint& aHitTestPoint,
|
|||
MOZ_ASSERT(result);
|
||||
}
|
||||
|
||||
const bool isScrollbar = hitInfo.contains(gfx::CompositorHitTestFlags::eScrollbar);
|
||||
const bool isScrollbarThumb = hitInfo.contains(gfx::CompositorHitTestFlags::eScrollbarThumb);
|
||||
const ScrollDirection direction = hitInfo.contains(gfx::CompositorHitTestFlags::eScrollbarVertical)
|
||||
bool isScrollbar = bool(hitInfo & gfx::CompositorHitTestInfo::eScrollbar);
|
||||
bool isScrollbarThumb = bool(hitInfo & gfx::CompositorHitTestInfo::eScrollbarThumb);
|
||||
ScrollDirection direction = (hitInfo & gfx::CompositorHitTestInfo::eScrollbarVertical)
|
||||
? ScrollDirection::eVertical
|
||||
: ScrollDirection::eHorizontal;
|
||||
if (isScrollbar || isScrollbarThumb) {
|
||||
|
@ -2699,7 +2700,7 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
|
|||
hitTestPoints.pop();
|
||||
APZCTM_LOG("Testing Layer point %s against node %p\n",
|
||||
Stringify(hitTestPoints.top()).c_str(), aNode);
|
||||
if (hitResult != CompositorHitTestInvisibleToHit) {
|
||||
if (hitResult != CompositorHitTestInfo::eInvisibleToHitTest) {
|
||||
resultNode = aNode;
|
||||
*aOutHitResult = hitResult;
|
||||
return TraversalFlag::Abort;
|
||||
|
@ -2708,17 +2709,17 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
|
|||
}
|
||||
);
|
||||
|
||||
if (*aOutHitResult != CompositorHitTestInvisibleToHit) {
|
||||
if (*aOutHitResult != CompositorHitTestInfo::eInvisibleToHitTest) {
|
||||
MOZ_ASSERT(resultNode);
|
||||
for (HitTestingTreeNode* n = resultNode; n; n = n->GetParent()) {
|
||||
if (n->IsScrollbarNode()) {
|
||||
*aOutScrollbarNode = n;
|
||||
*aOutHitResult += CompositorHitTestFlags::eScrollbar;
|
||||
*aOutHitResult |= CompositorHitTestInfo::eScrollbar;
|
||||
if (n->IsScrollThumbNode()) {
|
||||
*aOutHitResult += CompositorHitTestFlags::eScrollbarThumb;
|
||||
*aOutHitResult |= CompositorHitTestInfo::eScrollbarThumb;
|
||||
}
|
||||
if (n->GetScrollbarDirection() == ScrollDirection::eVertical) {
|
||||
*aOutHitResult += CompositorHitTestFlags::eScrollbarVertical;
|
||||
*aOutHitResult |= CompositorHitTestInfo::eScrollbarVertical;
|
||||
}
|
||||
|
||||
// If we hit a scrollbar, target the APZC for the content scrolled
|
||||
|
|
|
@ -90,10 +90,10 @@ struct TargetConfirmationFlags {
|
|||
, mRequiresTargetConfirmation(false)
|
||||
{}
|
||||
|
||||
explicit TargetConfirmationFlags(const gfx::CompositorHitTestInfo& aHitTestInfo)
|
||||
: mTargetConfirmed((aHitTestInfo != gfx::CompositorHitTestInvisibleToHit) &&
|
||||
!aHitTestInfo.contains(gfx::CompositorHitTestFlags::eDispatchToContent))
|
||||
, mRequiresTargetConfirmation(aHitTestInfo.contains(gfx::CompositorHitTestFlags::eRequiresTargetConfirmation))
|
||||
explicit TargetConfirmationFlags(gfx::CompositorHitTestInfo aHitTestInfo)
|
||||
: mTargetConfirmed(aHitTestInfo != gfx::CompositorHitTestInfo::eInvisibleToHitTest &&
|
||||
!(aHitTestInfo & gfx::CompositorHitTestInfo::eDispatchToContent))
|
||||
, mRequiresTargetConfirmation(aHitTestInfo & gfx::CompositorHitTestInfo::eRequiresTargetConfirmation)
|
||||
{}
|
||||
|
||||
bool mTargetConfirmed : 1;
|
||||
|
|
|
@ -18,9 +18,6 @@ namespace mozilla {
|
|||
namespace layers {
|
||||
|
||||
using gfx::CompositorHitTestInfo;
|
||||
using gfx::CompositorHitTestFlags;
|
||||
using gfx::CompositorHitTestTouchActionMask;
|
||||
using gfx::CompositorHitTestInvisibleToHit;
|
||||
|
||||
HitTestingTreeNode::HitTestingTreeNode(AsyncPanZoomController* aApzc,
|
||||
bool aIsPrimaryHolder,
|
||||
|
@ -294,7 +291,7 @@ HitTestingTreeNode::Untransform(const ParentLayerPoint& aPoint,
|
|||
CompositorHitTestInfo
|
||||
HitTestingTreeNode::HitTest(const LayerPoint& aPoint) const
|
||||
{
|
||||
CompositorHitTestInfo result = CompositorHitTestInvisibleToHit;
|
||||
CompositorHitTestInfo result = CompositorHitTestInfo::eInvisibleToHitTest;
|
||||
|
||||
if (mOverride & EventRegionsOverride::ForceEmptyHitRegion) {
|
||||
return result;
|
||||
|
@ -314,36 +311,36 @@ HitTestingTreeNode::HitTest(const LayerPoint& aPoint) const
|
|||
return result;
|
||||
}
|
||||
|
||||
result = CompositorHitTestFlags::eVisibleToHitTest;
|
||||
result |= CompositorHitTestInfo::eVisibleToHitTest;
|
||||
|
||||
if ((mOverride & EventRegionsOverride::ForceDispatchToContent) ||
|
||||
mEventRegions.mDispatchToContentHitRegion.Contains(point.x, point.y))
|
||||
{
|
||||
result += CompositorHitTestFlags::eDispatchToContent;
|
||||
result |= CompositorHitTestInfo::eDispatchToContent;
|
||||
if (mEventRegions.mDTCRequiresTargetConfirmation) {
|
||||
result += CompositorHitTestFlags::eRequiresTargetConfirmation;
|
||||
result |= CompositorHitTestInfo::eRequiresTargetConfirmation;
|
||||
}
|
||||
} else if (gfxPrefs::TouchActionEnabled()) {
|
||||
if (mEventRegions.mNoActionRegion.Contains(point.x, point.y)) {
|
||||
// set all the touch-action flags as disabled
|
||||
result += CompositorHitTestTouchActionMask;
|
||||
result |= CompositorHitTestInfo::eTouchActionMask;
|
||||
} else {
|
||||
bool panX = mEventRegions.mHorizontalPanRegion.Contains(point.x, point.y);
|
||||
bool panY = mEventRegions.mVerticalPanRegion.Contains(point.x, point.y);
|
||||
if (panX && panY) {
|
||||
// touch-action: pan-x pan-y
|
||||
result += CompositorHitTestFlags::eTouchActionDoubleTapZoomDisabled;
|
||||
result += CompositorHitTestFlags::eTouchActionPinchZoomDisabled;
|
||||
result |= CompositorHitTestInfo::eTouchActionDoubleTapZoomDisabled
|
||||
| CompositorHitTestInfo::eTouchActionPinchZoomDisabled;
|
||||
} else if (panX) {
|
||||
// touch-action: pan-x
|
||||
result += CompositorHitTestFlags::eTouchActionPanYDisabled;
|
||||
result += CompositorHitTestFlags::eTouchActionPinchZoomDisabled;
|
||||
result += CompositorHitTestFlags::eTouchActionDoubleTapZoomDisabled;
|
||||
result |= CompositorHitTestInfo::eTouchActionPanYDisabled
|
||||
| CompositorHitTestInfo::eTouchActionPinchZoomDisabled
|
||||
| CompositorHitTestInfo::eTouchActionDoubleTapZoomDisabled;
|
||||
} else if (panY) {
|
||||
// touch-action: pan-y
|
||||
result += CompositorHitTestFlags::eTouchActionPanXDisabled;
|
||||
result += CompositorHitTestFlags::eTouchActionPinchZoomDisabled;
|
||||
result += CompositorHitTestFlags::eTouchActionDoubleTapZoomDisabled;
|
||||
result |= CompositorHitTestInfo::eTouchActionPanXDisabled
|
||||
| CompositorHitTestInfo::eTouchActionPinchZoomDisabled
|
||||
| CompositorHitTestInfo::eTouchActionDoubleTapZoomDisabled;
|
||||
} // else we're in the touch-action: auto or touch-action: manipulation
|
||||
// cases and we'll allow all actions. Technically we shouldn't allow
|
||||
// double-tap zooming in the manipulation case but apparently this has
|
||||
|
|
|
@ -243,7 +243,7 @@ TEST_F(APZEventRegionsTester, Obscuration) {
|
|||
gfx::CompositorHitTestInfo result;
|
||||
RefPtr<AsyncPanZoomController> hit = manager->GetTargetAPZC(ScreenPoint(50, 75), &result);
|
||||
EXPECT_EQ(child, hit.get());
|
||||
EXPECT_EQ(result, CompositorHitTestFlags::eVisibleToHitTest);
|
||||
EXPECT_EQ(CompositorHitTestInfo::eVisibleToHitTest, result);
|
||||
}
|
||||
|
||||
TEST_F(APZEventRegionsTester, Bug1119497) {
|
||||
|
@ -254,7 +254,7 @@ TEST_F(APZEventRegionsTester, Bug1119497) {
|
|||
// We should hit layers[2], so |result| will be eVisibleToHitTest but there's no
|
||||
// actual APZC on layers[2], so it will be the APZC of the root layer.
|
||||
EXPECT_EQ(ApzcOf(layers[0]), hit.get());
|
||||
EXPECT_EQ(result, CompositorHitTestFlags::eVisibleToHitTest);
|
||||
EXPECT_EQ(CompositorHitTestInfo::eVisibleToHitTest, result);
|
||||
}
|
||||
|
||||
TEST_F(APZEventRegionsTester, Bug1117712) {
|
||||
|
|
|
@ -69,10 +69,9 @@ struct APZTestDataToJSConverter {
|
|||
dom::APZHitResult& aOutHitResult) {
|
||||
aOutHitResult.mScreenX.Construct() = aResult.point.x;
|
||||
aOutHitResult.mScreenY.Construct() = aResult.point.y;
|
||||
static_assert(MaxEnumValue<CompositorHitTestInfo::valueType>::value
|
||||
< std::numeric_limits<uint16_t>::digits,
|
||||
"CompositorHitTestFlags MAX value have to be less than number of bits in uint16_t");
|
||||
aOutHitResult.mHitResult.Construct() = static_cast<uint16_t>(aResult.result.serialize());
|
||||
static_assert(sizeof(aResult.result) == sizeof(uint16_t),
|
||||
"Expected CompositorHitTestInfo to be 16-bit");
|
||||
aOutHitResult.mHitResult.Construct() = static_cast<uint16_t>(aResult.result);
|
||||
aOutHitResult.mScrollId.Construct() = aResult.scrollId;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -701,8 +701,8 @@ struct DIGroup
|
|||
bool backfaceHidden = false;
|
||||
|
||||
// Emit a dispatch-to-content hit test region covering this area
|
||||
CompositorHitTestInfo hitInfo(CompositorHitTestFlags::eVisibleToHitTest,
|
||||
CompositorHitTestFlags::eDispatchToContent);
|
||||
auto hitInfo = CompositorHitTestInfo::eVisibleToHitTest |
|
||||
CompositorHitTestInfo::eDispatchToContent;
|
||||
|
||||
// XXX - clipping the item against the paint rect breaks some content.
|
||||
// cf. Bug 1455422.
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
#ifndef MOZILLA_GFX_COMPOSITORHITTESTINFO_H_
|
||||
#define MOZILLA_GFX_COMPOSITORHITTESTINFO_H_
|
||||
|
||||
#include "mozilla/EnumSet.h"
|
||||
#include "mozilla/EnumTypeTraits.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -18,74 +17,49 @@ namespace gfx {
|
|||
// intentionally set up so that if all of them are 0 the item is effectively
|
||||
// invisible to hit-testing, and no information for this frame needs to be
|
||||
// sent to the compositor.
|
||||
enum class CompositorHitTestFlags : uint8_t {
|
||||
enum class CompositorHitTestInfo : uint16_t {
|
||||
// Shortcut for checking that none of the flags are set
|
||||
eInvisibleToHitTest = 0,
|
||||
|
||||
// The frame participates in hit-testing
|
||||
eVisibleToHitTest = 0,
|
||||
eVisibleToHitTest = 1 << 0,
|
||||
// The frame requires main-thread handling for events
|
||||
eDispatchToContent,
|
||||
eDispatchToContent = 1 << 1,
|
||||
|
||||
// The touch action flags are set up so that the default of
|
||||
// touch-action:auto on an element leaves all the flags as 0.
|
||||
eTouchActionPanXDisabled,
|
||||
eTouchActionPanYDisabled,
|
||||
eTouchActionPinchZoomDisabled,
|
||||
eTouchActionDoubleTapZoomDisabled,
|
||||
eTouchActionPanXDisabled = 1 << 2,
|
||||
eTouchActionPanYDisabled = 1 << 3,
|
||||
eTouchActionPinchZoomDisabled = 1 << 4,
|
||||
eTouchActionDoubleTapZoomDisabled = 1 << 5,
|
||||
// Mask to check for all the touch-action flags at once
|
||||
eTouchActionMask = (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5),
|
||||
|
||||
// The frame is a scrollbar or a subframe inside a scrollbar (including
|
||||
// scroll thumbs)
|
||||
eScrollbar,
|
||||
eScrollbar = 1 << 6,
|
||||
// The frame is a scrollthumb. If this is set then eScrollbar will also be
|
||||
// set, unless gecko somehow generates a scroll thumb without a containing
|
||||
// scrollbar.
|
||||
eScrollbarThumb,
|
||||
eScrollbarThumb = 1 << 7,
|
||||
// If eScrollbar is set, this flag indicates if the scrollbar is a vertical
|
||||
// one (if set) or a horizontal one (if not set)
|
||||
eScrollbarVertical,
|
||||
eScrollbarVertical = 1 << 8,
|
||||
|
||||
// Events targeting this frame should only be processed if a target
|
||||
// confirmation is received from the main thread. If no such confirmation
|
||||
// is received within a timeout period, the event may be dropped.
|
||||
// Only meaningful in combination with eDispatchToContent.
|
||||
eRequiresTargetConfirmation,
|
||||
eRequiresTargetConfirmation = 1 << 9,
|
||||
|
||||
// Used for IPDL serialization. This bitmask should include all the bits
|
||||
// that are defined in the enum.
|
||||
ALL_BITS = (1 << 10) - 1,
|
||||
};
|
||||
|
||||
using CompositorHitTestInfo = EnumSet<CompositorHitTestFlags>;
|
||||
|
||||
// A CompositorHitTestInfo with none of the flags set
|
||||
const CompositorHitTestInfo CompositorHitTestInvisibleToHit;
|
||||
|
||||
// Mask to check for all the touch-action flags at once
|
||||
const CompositorHitTestInfo CompositorHitTestTouchActionMask =
|
||||
CompositorHitTestInfo(CompositorHitTestFlags::eTouchActionPanXDisabled) +
|
||||
CompositorHitTestInfo(CompositorHitTestFlags::eTouchActionPanYDisabled) +
|
||||
CompositorHitTestInfo(CompositorHitTestFlags::eTouchActionPinchZoomDisabled) +
|
||||
CompositorHitTestInfo(CompositorHitTestFlags::eTouchActionDoubleTapZoomDisabled);
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CompositorHitTestInfo)
|
||||
|
||||
} // namespace gfx
|
||||
|
||||
|
||||
// Used for IPDL serialization. The 'value' have to be the biggest enum from CompositorHitTestFlags.
|
||||
template <>
|
||||
struct MaxEnumValue<::mozilla::gfx::CompositorHitTestFlags>
|
||||
{
|
||||
static constexpr unsigned int value = static_cast<unsigned int>(gfx::CompositorHitTestFlags::eRequiresTargetConfirmation);
|
||||
};
|
||||
|
||||
namespace gfx {
|
||||
|
||||
// Checks if the CompositorHitTestFlags max enum value is less than N.
|
||||
template <int N>
|
||||
static constexpr bool DoesCompositorHitTestInfoFitIntoBits()
|
||||
{
|
||||
if (MaxEnumValue<CompositorHitTestInfo::valueType>::value < N)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} // namespace gfx
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* MOZILLA_GFX_COMPOSITORHITTESTINFO_H_ */
|
||||
|
|
|
@ -364,17 +364,10 @@ WebRenderAPI::HitTest(const wr::WorldPoint& aPoint,
|
|||
layers::FrameMetrics::ViewID& aOutScrollId,
|
||||
gfx::CompositorHitTestInfo& aOutHitInfo)
|
||||
{
|
||||
static_assert(DoesCompositorHitTestInfoFitIntoBits<16>(),
|
||||
"CompositorHitTestFlags MAX value has to be less than number of bits in uint16_t");
|
||||
|
||||
uint16_t serialized = static_cast<uint16_t>(aOutHitInfo.serialize());
|
||||
const bool result = wr_api_hit_test(mDocHandle, aPoint,
|
||||
&aOutPipelineId, &aOutScrollId, &serialized);
|
||||
|
||||
if (result) {
|
||||
aOutHitInfo.deserialize(serialized);
|
||||
}
|
||||
return result;
|
||||
static_assert(sizeof(gfx::CompositorHitTestInfo) == sizeof(uint16_t),
|
||||
"CompositorHitTestInfo should be u16-sized");
|
||||
return wr_api_hit_test(mDocHandle, aPoint,
|
||||
&aOutPipelineId, &aOutScrollId, (uint16_t*)&aOutHitInfo);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1289,10 +1282,9 @@ void
|
|||
DisplayListBuilder::SetHitTestInfo(const layers::FrameMetrics::ViewID& aScrollId,
|
||||
gfx::CompositorHitTestInfo aHitInfo)
|
||||
{
|
||||
static_assert(DoesCompositorHitTestInfoFitIntoBits<16>(),
|
||||
"CompositorHitTestFlags MAX value has to be less than number of bits in uint16_t");
|
||||
|
||||
wr_set_item_tag(mWrState, aScrollId, static_cast<uint16_t>(aHitInfo.serialize()));
|
||||
static_assert(sizeof(gfx::CompositorHitTestInfo) == sizeof(uint16_t),
|
||||
"CompositorHitTestInfo should be u16-sized");
|
||||
wr_set_item_tag(mWrState, aScrollId, static_cast<uint16_t>(aHitInfo));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -2429,8 +2429,8 @@ pub extern "C" fn wr_api_hit_test(dh: &mut DocumentHandle,
|
|||
let result = dh.api.hit_test(dh.document_id, None, point, HitTestFlags::empty());
|
||||
for item in &result.items {
|
||||
// For now we should never be getting results back for which the tag is
|
||||
// 0 (== CompositorHitTestInvisibleToHit). In the future if we allow this,
|
||||
// we'll want to |continue| on the loop in this scenario.
|
||||
// 0 (== CompositorHitTestInfo::eInvisibleToHitTest). In the future if
|
||||
// we allow this, we'll want to |continue| on the loop in this scenario.
|
||||
debug_assert!(item.tag.1 != 0);
|
||||
*out_pipeline_id = item.pipeline;
|
||||
*out_scroll_id = item.tag.0;
|
||||
|
|
|
@ -11241,7 +11241,7 @@ nsIFrame::AddSizeOfExcludingThisForTree(nsWindowSizes& aSizes) const
|
|||
CompositorHitTestInfo
|
||||
nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
CompositorHitTestInfo result = CompositorHitTestInvisibleToHit;
|
||||
CompositorHitTestInfo result = CompositorHitTestInfo::eInvisibleToHitTest;
|
||||
|
||||
if (aBuilder->IsInsidePointerEventsNoneDoc()) {
|
||||
// Somewhere up the parent document chain is a subdocument with pointer-
|
||||
|
@ -11263,7 +11263,7 @@ nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
|
|||
}
|
||||
|
||||
// Anything that didn't match the above conditions is visible to hit-testing.
|
||||
result = CompositorHitTestFlags::eVisibleToHitTest;
|
||||
result |= CompositorHitTestInfo::eVisibleToHitTest;
|
||||
|
||||
if (aBuilder->IsBuildingNonLayerizedScrollbar() ||
|
||||
aBuilder->GetAncestorHasApzAwareEventHandler()) {
|
||||
|
@ -11272,13 +11272,13 @@ nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
|
|||
// instead of the intended scrollframe. To address this, we force a d-t-c
|
||||
// region on scrollbar frames that won't be placed in their own layer. See
|
||||
// bug 1213324 for details.
|
||||
result += CompositorHitTestFlags::eDispatchToContent;
|
||||
result |= CompositorHitTestInfo::eDispatchToContent;
|
||||
} else if (IsObjectFrame()) {
|
||||
// If the frame is a plugin frame and wants to handle wheel events as
|
||||
// default action, we should add the frame to dispatch-to-content region.
|
||||
nsPluginFrame* pluginFrame = do_QueryFrame(this);
|
||||
if (pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction()) {
|
||||
result += CompositorHitTestFlags::eDispatchToContent;
|
||||
result |= CompositorHitTestInfo::eDispatchToContent;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11292,9 +11292,9 @@ nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
|
|||
// ancestor DOM elements. Refer to the documentation in TouchActionHelper.cpp
|
||||
// for details; this code is meant to be equivalent to that code, but woven
|
||||
// into the top-down recursive display list building process.
|
||||
CompositorHitTestInfo inheritedTouchAction = CompositorHitTestInvisibleToHit;
|
||||
CompositorHitTestInfo inheritedTouchAction = CompositorHitTestInfo::eInvisibleToHitTest;
|
||||
if (nsDisplayCompositorHitTestInfo* parentInfo = aBuilder->GetCompositorHitTestInfo()) {
|
||||
inheritedTouchAction = parentInfo->HitTestInfo() & CompositorHitTestTouchActionMask;
|
||||
inheritedTouchAction = (parentInfo->HitTestInfo() & CompositorHitTestInfo::eTouchActionMask);
|
||||
}
|
||||
|
||||
nsIFrame* touchActionFrame = this;
|
||||
|
@ -11305,12 +11305,12 @@ nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
|
|||
// encounter an element that disables it that's inside the scrollframe.
|
||||
// This is equivalent to the |considerPanning| variable in
|
||||
// TouchActionHelper.cpp, but for a top-down traversal.
|
||||
CompositorHitTestInfo panMask(CompositorHitTestFlags::eTouchActionPanXDisabled,
|
||||
CompositorHitTestFlags::eTouchActionPanYDisabled);
|
||||
inheritedTouchAction -= panMask;
|
||||
CompositorHitTestInfo panMask = CompositorHitTestInfo::eTouchActionPanXDisabled
|
||||
| CompositorHitTestInfo::eTouchActionPanYDisabled;
|
||||
inheritedTouchAction &= ~panMask;
|
||||
}
|
||||
|
||||
result += inheritedTouchAction;
|
||||
result |= inheritedTouchAction;
|
||||
|
||||
const uint32_t touchAction = nsLayoutUtils::GetTouchActionFromFrame(touchActionFrame);
|
||||
// The CSS allows the syntax auto | none | [pan-x || pan-y] | manipulation
|
||||
|
@ -11318,22 +11318,23 @@ nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
|
|||
if (touchAction == NS_STYLE_TOUCH_ACTION_AUTO) {
|
||||
// nothing to do
|
||||
} else if (touchAction & NS_STYLE_TOUCH_ACTION_MANIPULATION) {
|
||||
result += CompositorHitTestFlags::eTouchActionDoubleTapZoomDisabled;
|
||||
result |= CompositorHitTestInfo::eTouchActionDoubleTapZoomDisabled;
|
||||
} else {
|
||||
// This path handles the cases none | [pan-x || pan-y] and so both
|
||||
// double-tap and pinch zoom are disabled in here.
|
||||
result += CompositorHitTestFlags::eTouchActionPinchZoomDisabled;
|
||||
result += CompositorHitTestFlags::eTouchActionDoubleTapZoomDisabled;
|
||||
result |= CompositorHitTestInfo::eTouchActionPinchZoomDisabled
|
||||
| CompositorHitTestInfo::eTouchActionDoubleTapZoomDisabled;
|
||||
|
||||
if (!(touchAction & NS_STYLE_TOUCH_ACTION_PAN_X)) {
|
||||
result += CompositorHitTestFlags::eTouchActionPanXDisabled;
|
||||
result |= CompositorHitTestInfo::eTouchActionPanXDisabled;
|
||||
}
|
||||
if (!(touchAction & NS_STYLE_TOUCH_ACTION_PAN_Y)) {
|
||||
result += CompositorHitTestFlags::eTouchActionPanYDisabled;
|
||||
result |= CompositorHitTestInfo::eTouchActionPanYDisabled;
|
||||
}
|
||||
if (touchAction & NS_STYLE_TOUCH_ACTION_NONE) {
|
||||
// all the touch-action disabling flags will already have been set above
|
||||
MOZ_ASSERT(result.contains(CompositorHitTestTouchActionMask));
|
||||
MOZ_ASSERT((result & CompositorHitTestInfo::eTouchActionMask)
|
||||
== CompositorHitTestInfo::eTouchActionMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11344,19 +11345,19 @@ nsIFrame::GetCompositorHitTestInfo(nsDisplayListBuilder* aBuilder)
|
|||
const bool thumbGetsLayer = aBuilder->GetCurrentScrollbarTarget() !=
|
||||
layers::FrameMetrics::NULL_SCROLL_ID;
|
||||
if (thumbGetsLayer) {
|
||||
result += CompositorHitTestFlags::eScrollbarThumb;
|
||||
result |= CompositorHitTestInfo::eScrollbarThumb;
|
||||
} else {
|
||||
result += CompositorHitTestFlags::eDispatchToContent;
|
||||
result |= CompositorHitTestInfo::eDispatchToContent;
|
||||
}
|
||||
}
|
||||
|
||||
if (*scrollDirection == ScrollDirection::eVertical) {
|
||||
result += CompositorHitTestFlags::eScrollbarVertical;
|
||||
result |= CompositorHitTestInfo::eScrollbarVertical;
|
||||
}
|
||||
|
||||
// includes the ScrollbarFrame, SliderFrame, anything else that
|
||||
// might be inside the xul:scrollbar
|
||||
result += CompositorHitTestFlags::eScrollbar;
|
||||
result |= CompositorHitTestInfo::eScrollbar;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -3651,7 +3651,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
// if we are checkerboarding.
|
||||
if (aBuilder->BuildCompositorHitTestInfo()) {
|
||||
CompositorHitTestInfo info = mScrolledFrame->GetCompositorHitTestInfo(aBuilder);
|
||||
if (info != CompositorHitTestInvisibleToHit) {
|
||||
if (info != CompositorHitTestInfo::eInvisibleToHitTest) {
|
||||
nsDisplayCompositorHitTestInfo* hitInfo =
|
||||
MakeDisplayItem<nsDisplayCompositorHitTestInfo>(aBuilder, mScrolledFrame, info, 1);
|
||||
aBuilder->SetCompositorHitTestInfo(hitInfo);
|
||||
|
@ -3759,8 +3759,8 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
// a displayport for this frame. We'll add the item later on.
|
||||
if (!mWillBuildScrollableLayer) {
|
||||
if (aBuilder->BuildCompositorHitTestInfo()) {
|
||||
CompositorHitTestInfo info(CompositorHitTestFlags::eVisibleToHitTest,
|
||||
CompositorHitTestFlags::eDispatchToContent);
|
||||
CompositorHitTestInfo info = CompositorHitTestInfo::eVisibleToHitTest
|
||||
| CompositorHitTestInfo::eDispatchToContent;
|
||||
// If the scroll frame has non-default overscroll-behavior, instruct
|
||||
// APZ to require a target confirmation before processing events that
|
||||
// hit this scroll frame (that is, to drop the events if a confirmation
|
||||
|
@ -3770,7 +3770,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
ScrollStyles scrollStyles = GetScrollStylesFromFrame();
|
||||
if (scrollStyles.mOverscrollBehaviorX != StyleOverscrollBehavior::Auto ||
|
||||
scrollStyles.mOverscrollBehaviorY != StyleOverscrollBehavior::Auto) {
|
||||
info += CompositorHitTestFlags::eRequiresTargetConfirmation;
|
||||
info |= CompositorHitTestInfo::eRequiresTargetConfirmation;
|
||||
}
|
||||
nsDisplayCompositorHitTestInfo* hitInfo =
|
||||
MakeDisplayItem<nsDisplayCompositorHitTestInfo>(aBuilder, mScrolledFrame, info, 1,
|
||||
|
|
|
@ -4062,16 +4062,16 @@ PaintedLayerData::AccumulateHitTestInfo(ContainerState* aState,
|
|||
mHitRegion.OrWith(area);
|
||||
}
|
||||
|
||||
if (aItem->HitTestInfo().contains(CompositorHitTestFlags::eDispatchToContent)) {
|
||||
if (aItem->HitTestInfo() & CompositorHitTestInfo::eDispatchToContent) {
|
||||
mDispatchToContentHitRegion.OrWith(area);
|
||||
|
||||
if (aItem->HitTestInfo().contains(CompositorHitTestFlags::eRequiresTargetConfirmation)) {
|
||||
if (aItem->HitTestInfo() & CompositorHitTestInfo::eRequiresTargetConfirmation) {
|
||||
mDTCRequiresTargetConfirmation = true;
|
||||
}
|
||||
}
|
||||
|
||||
const auto touchFlags = hitTestInfo & CompositorHitTestTouchActionMask;
|
||||
if (!touchFlags.isEmpty()) {
|
||||
auto touchFlags = hitTestInfo & CompositorHitTestInfo::eTouchActionMask;
|
||||
if (touchFlags) {
|
||||
// If there are multiple touch-action areas, there are multiple elements with
|
||||
// touch-action properties. We don't know what the relationship is between
|
||||
// those elements in terms of DOM ancestry, and so we don't know how to
|
||||
|
@ -4080,7 +4080,7 @@ PaintedLayerData::AccumulateHitTestInfo(ContainerState* aState,
|
|||
// main thread. See bug 1286957.
|
||||
if (mCollapsedTouchActions) {
|
||||
mDispatchToContentHitRegion.OrWith(area);
|
||||
} else if (touchFlags == CompositorHitTestTouchActionMask) {
|
||||
} else if (touchFlags == CompositorHitTestInfo::eTouchActionMask) {
|
||||
// everything was disabled, so touch-action:none
|
||||
mNoActionRegion.OrWith(area);
|
||||
} else {
|
||||
|
@ -4099,12 +4099,12 @@ PaintedLayerData::AccumulateHitTestInfo(ContainerState* aState,
|
|||
// we still use the event regions, we must collapse these two cases back
|
||||
// together. Or add another region to the event regions to fix this
|
||||
// properly.
|
||||
if (touchFlags != CompositorHitTestFlags::eTouchActionDoubleTapZoomDisabled) {
|
||||
if (!hitTestInfo.contains(CompositorHitTestFlags::eTouchActionPanXDisabled)) {
|
||||
if (touchFlags != CompositorHitTestInfo::eTouchActionDoubleTapZoomDisabled) {
|
||||
if (!(hitTestInfo & CompositorHitTestInfo::eTouchActionPanXDisabled)) {
|
||||
// pan-x is allowed
|
||||
mHorizontalPanRegion.OrWith(area);
|
||||
}
|
||||
if (!hitTestInfo.contains(CompositorHitTestFlags::eTouchActionPanYDisabled)) {
|
||||
if (!(hitTestInfo & CompositorHitTestInfo::eTouchActionPanYDisabled)) {
|
||||
// pan-y is allowed
|
||||
mVerticalPanRegion.OrWith(area);
|
||||
}
|
||||
|
|
|
@ -2268,7 +2268,7 @@ nsDisplayListBuilder::ShouldBuildCompositorHitTestInfo(const nsIFrame* aFrame,
|
|||
{
|
||||
MOZ_ASSERT(mBuildCompositorHitTestInfo);
|
||||
|
||||
if (aInfo == CompositorHitTestInvisibleToHit) {
|
||||
if (aInfo == CompositorHitTestInfo::eInvisibleToHitTest) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -5069,12 +5069,12 @@ nsDisplayCompositorHitTestInfo::nsDisplayCompositorHitTestInfo(nsDisplayListBuil
|
|||
// compositor hit-test info or if the computed hit info indicated the
|
||||
// frame is invisible to hit-testing
|
||||
MOZ_ASSERT(aBuilder->BuildCompositorHitTestInfo());
|
||||
MOZ_ASSERT(mHitTestInfo != CompositorHitTestInvisibleToHit);
|
||||
MOZ_ASSERT(mHitTestInfo != mozilla::gfx::CompositorHitTestInfo::eInvisibleToHitTest);
|
||||
|
||||
if (aBuilder->GetCurrentScrollbarDirection().isSome()) {
|
||||
// In the case of scrollbar frames, we use the scrollbar's target scrollframe
|
||||
// instead of the scrollframe with which the scrollbar actually moves.
|
||||
MOZ_ASSERT(mHitTestInfo.contains(CompositorHitTestFlags::eScrollbar));
|
||||
MOZ_ASSERT(mHitTestInfo & CompositorHitTestInfo::eScrollbar);
|
||||
mScrollTarget = Some(aBuilder->GetCurrentScrollbarTarget());
|
||||
}
|
||||
|
||||
|
@ -5132,7 +5132,7 @@ nsDisplayCompositorHitTestInfo::CreateWebRenderCommands(mozilla::wr::DisplayList
|
|||
void
|
||||
nsDisplayCompositorHitTestInfo::WriteDebugInfo(std::stringstream& aStream)
|
||||
{
|
||||
aStream << nsPrintfCString(" (hitTestInfo 0x%x)", mHitTestInfo.serialize()).get();
|
||||
aStream << nsPrintfCString(" (hitTestInfo 0x%x)", (int)mHitTestInfo).get();
|
||||
AppendToString(aStream, mArea, " hitTestArea");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ class EnumSet
|
|||
{
|
||||
public:
|
||||
typedef uint32_t serializedType;
|
||||
typedef T valueType;
|
||||
|
||||
EnumSet()
|
||||
: mBitField(0)
|
||||
|
@ -68,12 +67,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void operator=(T aEnum)
|
||||
{
|
||||
incVersion();
|
||||
mBitField = bitFor(aEnum);
|
||||
}
|
||||
|
||||
EnumSet(const EnumSet& aEnumSet)
|
||||
: mBitField(aEnumSet.mBitField)
|
||||
{
|
||||
|
@ -101,7 +94,7 @@ public:
|
|||
/**
|
||||
* Union
|
||||
*/
|
||||
void operator+=(const EnumSet<T>& aEnumSet)
|
||||
void operator+=(const EnumSet<T> aEnumSet)
|
||||
{
|
||||
incVersion();
|
||||
mBitField |= aEnumSet.mBitField;
|
||||
|
@ -110,7 +103,7 @@ public:
|
|||
/**
|
||||
* Union
|
||||
*/
|
||||
EnumSet<T> operator+(const EnumSet<T>& aEnumSet) const
|
||||
EnumSet<T> operator+(const EnumSet<T> aEnumSet) const
|
||||
{
|
||||
EnumSet<T> result(*this);
|
||||
result += aEnumSet;
|
||||
|
@ -139,7 +132,7 @@ public:
|
|||
/**
|
||||
* Remove a set of elements
|
||||
*/
|
||||
void operator-=(const EnumSet<T>& aEnumSet)
|
||||
void operator-=(const EnumSet<T> aEnumSet)
|
||||
{
|
||||
incVersion();
|
||||
mBitField &= ~(aEnumSet.mBitField);
|
||||
|
@ -148,7 +141,7 @@ public:
|
|||
/**
|
||||
* Remove a set of elements
|
||||
*/
|
||||
EnumSet<T> operator-(const EnumSet<T>& aEnumSet) const
|
||||
EnumSet<T> operator-(const EnumSet<T> aEnumSet) const
|
||||
{
|
||||
EnumSet<T> result(*this);
|
||||
result -= aEnumSet;
|
||||
|
@ -167,7 +160,7 @@ public:
|
|||
/**
|
||||
* Intersection
|
||||
*/
|
||||
void operator&=(const EnumSet<T>& aEnumSet)
|
||||
void operator&=(const EnumSet<T> aEnumSet)
|
||||
{
|
||||
incVersion();
|
||||
mBitField &= aEnumSet.mBitField;
|
||||
|
@ -176,7 +169,7 @@ public:
|
|||
/**
|
||||
* Intersection
|
||||
*/
|
||||
EnumSet<T> operator&(const EnumSet<T>& aEnumSet) const
|
||||
EnumSet<T> operator&(const EnumSet<T> aEnumSet) const
|
||||
{
|
||||
EnumSet<T> result(*this);
|
||||
result &= aEnumSet;
|
||||
|
@ -186,51 +179,19 @@ public:
|
|||
/**
|
||||
* Equality
|
||||
*/
|
||||
bool operator==(const EnumSet<T>& aEnumSet) const
|
||||
bool operator==(const EnumSet<T> aEnumSet) const
|
||||
{
|
||||
return mBitField == aEnumSet.mBitField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Equality
|
||||
*/
|
||||
bool operator==(T aEnum) const
|
||||
{
|
||||
return mBitField == bitFor(aEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not equal
|
||||
*/
|
||||
bool operator!=(const EnumSet<T>& aEnumSet) const
|
||||
{
|
||||
return !operator==(aEnumSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Not equal
|
||||
*/
|
||||
bool operator!=(T aEnum) const
|
||||
{
|
||||
return !operator==(aEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if an element is contained in the set.
|
||||
* Test is an element is contained in the set.
|
||||
*/
|
||||
bool contains(T aEnum) const
|
||||
{
|
||||
return mBitField & bitFor(aEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a set is contained in the set.
|
||||
*/
|
||||
bool contains(const EnumSet<T>& aEnumSet) const
|
||||
{
|
||||
return (mBitField & aEnumSet.mBitField) == aEnumSet.mBitField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of elements in the set.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче