mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1137267 - Remove unneeded flags to track touch listeners and touch caret. r=smaug,dvander,botond
This commit is contained in:
parent
cf25343ea5
commit
c6da1df376
@ -575,8 +575,6 @@ nsPIDOMWindow::nsPIDOMWindow(nsPIDOMWindow *aOuterWindow)
|
||||
mRunningTimeout(nullptr), mMutationBits(0), mIsDocumentLoaded(false),
|
||||
mIsHandlingResizeEvent(false), mIsInnerWindow(aOuterWindow != nullptr),
|
||||
mMayHavePaintEventListener(false), mMayHaveTouchEventListener(false),
|
||||
mMayHaveTouchCaret(false),
|
||||
mMayHaveScrollWheelEventListener(false),
|
||||
mMayHaveMouseEnterLeaveEventListener(false),
|
||||
mMayHavePointerEnterLeaveEventListener(false),
|
||||
mIsModalContentWindow(false),
|
||||
|
@ -430,9 +430,6 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
|
||||
if (elm->MayHaveTouchEventListener()) {
|
||||
window->SetHasTouchEventListeners();
|
||||
}
|
||||
if (elm->MayHaveScrollWheelEventListener()) {
|
||||
window->SetHasScrollWheelEventListeners();
|
||||
}
|
||||
if (elm->MayHaveMouseEnterLeaveEventListener()) {
|
||||
window->SetHasMouseEnterLeaveEventListeners();
|
||||
}
|
||||
|
@ -443,44 +443,6 @@ public:
|
||||
return mMayHaveTouchEventListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this to indicate that some node (this window, its document,
|
||||
* or content in that document) has a scroll wheel event listener.
|
||||
*/
|
||||
void SetHasScrollWheelEventListeners()
|
||||
{
|
||||
mMayHaveScrollWheelEventListener = true;
|
||||
}
|
||||
|
||||
bool HasScrollWheelEventListeners()
|
||||
{
|
||||
return mMayHaveScrollWheelEventListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not any event listeners are present that APZ must be
|
||||
* aware of.
|
||||
*/
|
||||
bool HasApzAwareEventListeners()
|
||||
{
|
||||
return HasTouchEventListeners() || HasScrollWheelEventListeners();
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when touch caret visibility has changed. mMayHaveTouchCaret
|
||||
* is set if that some node (this window, its document, or content in that
|
||||
* document) has a visible touch caret.
|
||||
*/
|
||||
void SetMayHaveTouchCaret(bool aSetValue)
|
||||
{
|
||||
mMayHaveTouchCaret = aSetValue;
|
||||
}
|
||||
|
||||
bool MayHaveTouchCaret()
|
||||
{
|
||||
return mMayHaveTouchCaret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the top-level window into fullscreen mode if aIsFullScreen is true,
|
||||
* otherwise exits fullscreen. If aRequireTrust is true, this method only
|
||||
@ -802,8 +764,6 @@ protected:
|
||||
bool mIsInnerWindow;
|
||||
bool mMayHavePaintEventListener;
|
||||
bool mMayHaveTouchEventListener;
|
||||
bool mMayHaveTouchCaret;
|
||||
bool mMayHaveScrollWheelEventListener;
|
||||
bool mMayHaveMouseEnterLeaveEventListener;
|
||||
bool mMayHavePointerEnterLeaveEventListener;
|
||||
|
||||
|
@ -98,7 +98,6 @@ EventListenerManager::EventListenerManager(EventTarget* aTarget)
|
||||
, mMayHaveCapturingListeners(false)
|
||||
, mMayHaveSystemGroupListeners(false)
|
||||
, mMayHaveTouchEventListener(false)
|
||||
, mMayHaveScrollWheelEventListener(false)
|
||||
, mMayHaveMouseEnterLeaveEventListener(false)
|
||||
, mMayHavePointerEnterLeaveEventListener(false)
|
||||
, mClearingListeners(false)
|
||||
@ -340,16 +339,6 @@ EventListenerManager::AddEventListenerInternal(
|
||||
if (window && !aFlags.mInSystemGroup) {
|
||||
window->SetHasTouchEventListeners();
|
||||
}
|
||||
} else if (aTypeAtom == nsGkAtoms::onwheel ||
|
||||
aTypeAtom == nsGkAtoms::onDOMMouseScroll ||
|
||||
aTypeAtom == nsHtml5Atoms::onmousewheel) {
|
||||
mMayHaveScrollWheelEventListener = true;
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
// we don't want touchevent listeners added by scrollbars to flip this flag
|
||||
// so we ignore listeners created with system event flag
|
||||
if (window && !aFlags.mInSystemGroup) {
|
||||
window->SetHasScrollWheelEventListeners();
|
||||
}
|
||||
} else if (aType >= NS_POINTER_EVENT_START && aType <= NS_POINTER_LOST_CAPTURE) {
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (aTypeAtom == nsGkAtoms::onpointerenter ||
|
||||
|
@ -394,12 +394,6 @@ public:
|
||||
*/
|
||||
bool MayHaveTouchEventListener() { return mMayHaveTouchEventListener; }
|
||||
|
||||
/**
|
||||
* Returns true if there may be a scroll wheel listener registered,
|
||||
* false if there definitely isn't.
|
||||
*/
|
||||
bool MayHaveScrollWheelEventListener() { return mMayHaveScrollWheelEventListener; }
|
||||
|
||||
bool MayHaveMouseEnterLeaveEventListener() { return mMayHaveMouseEnterLeaveEventListener; }
|
||||
bool MayHavePointerEnterLeaveEventListener() { return mMayHavePointerEnterLeaveEventListener; }
|
||||
|
||||
@ -550,7 +544,6 @@ protected:
|
||||
uint32_t mMayHaveCapturingListeners : 1;
|
||||
uint32_t mMayHaveSystemGroupListeners : 1;
|
||||
uint32_t mMayHaveTouchEventListener : 1;
|
||||
uint32_t mMayHaveScrollWheelEventListener : 1;
|
||||
uint32_t mMayHaveMouseEnterLeaveEventListener : 1;
|
||||
uint32_t mMayHavePointerEnterLeaveEventListener : 1;
|
||||
uint32_t mClearingListeners : 1;
|
||||
|
@ -724,8 +724,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
WriteParam(aMsg, aParam.mCumulativeResolution);
|
||||
WriteParam(aMsg, aParam.mZoom);
|
||||
WriteParam(aMsg, aParam.mDevPixelsPerCSSPixel);
|
||||
WriteParam(aMsg, aParam.mMayHaveTouchListeners);
|
||||
WriteParam(aMsg, aParam.mMayHaveTouchCaret);
|
||||
WriteParam(aMsg, aParam.mPresShellId);
|
||||
WriteParam(aMsg, aParam.mIsRoot);
|
||||
WriteParam(aMsg, aParam.mHasScrollgrab);
|
||||
@ -767,8 +765,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
||||
ReadParam(aMsg, aIter, &aResult->mCumulativeResolution) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mZoom) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchListeners) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchCaret) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPresShellId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mIsRoot) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHasScrollgrab) &&
|
||||
|
@ -46,8 +46,6 @@ public:
|
||||
, mScrollableRect(0, 0, 0, 0)
|
||||
, mCumulativeResolution(1)
|
||||
, mDevPixelsPerCSSPixel(1)
|
||||
, mMayHaveTouchListeners(false)
|
||||
, mMayHaveTouchCaret(false)
|
||||
, mIsRoot(false)
|
||||
, mHasScrollgrab(false)
|
||||
, mScrollId(NULL_SCROLL_ID)
|
||||
@ -85,8 +83,6 @@ public:
|
||||
mPresShellResolution == aOther.mPresShellResolution &&
|
||||
mCumulativeResolution == aOther.mCumulativeResolution &&
|
||||
mDevPixelsPerCSSPixel == aOther.mDevPixelsPerCSSPixel &&
|
||||
mMayHaveTouchListeners == aOther.mMayHaveTouchListeners &&
|
||||
mMayHaveTouchCaret == aOther.mMayHaveTouchCaret &&
|
||||
mPresShellId == aOther.mPresShellId &&
|
||||
mIsRoot == aOther.mIsRoot &&
|
||||
mScrollId == aOther.mScrollId &&
|
||||
@ -482,26 +478,6 @@ public:
|
||||
mContentDescription = aContentDescription;
|
||||
}
|
||||
|
||||
bool GetMayHaveTouchCaret() const
|
||||
{
|
||||
return mMayHaveTouchCaret;
|
||||
}
|
||||
|
||||
void SetMayHaveTouchCaret(bool aMayHaveTouchCaret)
|
||||
{
|
||||
mMayHaveTouchCaret = aMayHaveTouchCaret;
|
||||
}
|
||||
|
||||
bool GetMayHaveTouchListeners() const
|
||||
{
|
||||
return mMayHaveTouchListeners;
|
||||
}
|
||||
|
||||
void SetMayHaveTouchListeners(bool aMayHaveTouchListeners)
|
||||
{
|
||||
mMayHaveTouchListeners = aMayHaveTouchListeners;
|
||||
}
|
||||
|
||||
const LayoutDeviceIntSize& GetLineScrollAmount() const
|
||||
{
|
||||
return mLineScrollAmount;
|
||||
@ -592,12 +568,6 @@ private:
|
||||
// resolution.
|
||||
CSSToLayoutDeviceScale mDevPixelsPerCSSPixel;
|
||||
|
||||
// Whether or not this frame may have touch or scroll wheel listeners.
|
||||
bool mMayHaveTouchListeners;
|
||||
|
||||
// Whether or not this frame may have a touch caret.
|
||||
bool mMayHaveTouchCaret;
|
||||
|
||||
// Whether or not this is the root scroll frame for the root content document.
|
||||
bool mIsRoot;
|
||||
|
||||
|
@ -2663,8 +2663,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
||||
|
||||
mLastContentPaintMetrics = aLayerMetrics;
|
||||
|
||||
mFrameMetrics.SetMayHaveTouchListeners(aLayerMetrics.GetMayHaveTouchListeners());
|
||||
mFrameMetrics.SetMayHaveTouchCaret(aLayerMetrics.GetMayHaveTouchCaret());
|
||||
mFrameMetrics.SetScrollParentId(aLayerMetrics.GetScrollParentId());
|
||||
APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d", this, aIsFirstPaint);
|
||||
|
||||
@ -2926,12 +2924,6 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncPanZoomController::NeedToWaitForContent() const
|
||||
{
|
||||
return (mFrameMetrics.GetMayHaveTouchListeners() || mFrameMetrics.GetMayHaveTouchCaret());
|
||||
}
|
||||
|
||||
TouchBlockState*
|
||||
AsyncPanZoomController::CurrentTouchBlock()
|
||||
{
|
||||
|
@ -775,12 +775,6 @@ public:
|
||||
*/
|
||||
bool ArePointerEventsConsumable(TouchBlockState* aBlock, uint32_t aTouchPoints);
|
||||
|
||||
/**
|
||||
* Return true if there are are touch listeners registered on content
|
||||
* scrolled by this APZC.
|
||||
*/
|
||||
bool NeedToWaitForContent() const;
|
||||
|
||||
/**
|
||||
* Clear internal state relating to input handling.
|
||||
*/
|
||||
|
@ -261,7 +261,7 @@ protected:
|
||||
apzc->Destroy();
|
||||
}
|
||||
|
||||
void SetMayHaveTouchListeners()
|
||||
void MakeApzcWaitForMainThread()
|
||||
{
|
||||
apzc->SetWaitForMainThread();
|
||||
}
|
||||
@ -765,7 +765,7 @@ TEST_F(APZCPinchGestureDetectorTester, Pinch_PreventDefault) {
|
||||
FrameMetrics originalMetrics = GetPinchableFrameMetrics();
|
||||
apzc->SetFrameMetrics(originalMetrics);
|
||||
|
||||
SetMayHaveTouchListeners();
|
||||
MakeApzcWaitForMainThread();
|
||||
MakeApzcZoomable();
|
||||
|
||||
int touchInputId = 0;
|
||||
@ -969,7 +969,7 @@ protected:
|
||||
|
||||
void DoPanWithPreventDefaultTest()
|
||||
{
|
||||
SetMayHaveTouchListeners();
|
||||
MakeApzcWaitForMainThread();
|
||||
|
||||
int time = 0;
|
||||
int touchStart = 50;
|
||||
@ -1248,7 +1248,7 @@ protected:
|
||||
}
|
||||
|
||||
void DoFlingStopWithSlowListener(bool aPreventDefault) {
|
||||
SetMayHaveTouchListeners();
|
||||
MakeApzcWaitForMainThread();
|
||||
|
||||
int time = 0;
|
||||
int touchStart = 50;
|
||||
@ -1573,7 +1573,7 @@ DoubleTapAndCheckStatus(const nsRefPtr<InputReceiver>& aTarget, int aX, int aY,
|
||||
}
|
||||
|
||||
TEST_F(APZCGestureDetectorTester, DoubleTap) {
|
||||
SetMayHaveTouchListeners();
|
||||
MakeApzcWaitForMainThread();
|
||||
MakeApzcZoomable();
|
||||
|
||||
EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(0);
|
||||
@ -1593,7 +1593,7 @@ TEST_F(APZCGestureDetectorTester, DoubleTap) {
|
||||
}
|
||||
|
||||
TEST_F(APZCGestureDetectorTester, DoubleTapNotZoomable) {
|
||||
SetMayHaveTouchListeners();
|
||||
MakeApzcWaitForMainThread();
|
||||
MakeApzcUnzoomable();
|
||||
|
||||
EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(2);
|
||||
@ -1613,7 +1613,7 @@ TEST_F(APZCGestureDetectorTester, DoubleTapNotZoomable) {
|
||||
}
|
||||
|
||||
TEST_F(APZCGestureDetectorTester, DoubleTapPreventDefaultFirstOnly) {
|
||||
SetMayHaveTouchListeners();
|
||||
MakeApzcWaitForMainThread();
|
||||
MakeApzcZoomable();
|
||||
|
||||
EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1);
|
||||
@ -1633,7 +1633,7 @@ TEST_F(APZCGestureDetectorTester, DoubleTapPreventDefaultFirstOnly) {
|
||||
}
|
||||
|
||||
TEST_F(APZCGestureDetectorTester, DoubleTapPreventDefaultBoth) {
|
||||
SetMayHaveTouchListeners();
|
||||
MakeApzcWaitForMainThread();
|
||||
MakeApzcZoomable();
|
||||
|
||||
EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(0);
|
||||
|
@ -319,12 +319,6 @@ SelectionCarets::SetVisibility(bool aVisible)
|
||||
|
||||
dom::Element* endElement = mPresShell->GetSelectionCaretsEndElement();
|
||||
SetElementVisibility(endElement, mVisible && mEndCaretVisible);
|
||||
|
||||
// We must call SetHasTouchCaret() in order to get APZC to wait until the
|
||||
// event has been round-tripped and check whether it has been handled,
|
||||
// otherwise B2G will end up panning the document when the user tries to drag
|
||||
// selection caret.
|
||||
mPresShell->SetMayHaveTouchCaret(mVisible);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -181,12 +181,6 @@ TouchCaret::SetVisibility(bool aVisible)
|
||||
|
||||
// Set touch caret expiration time.
|
||||
mVisible ? LaunchExpirationTimer() : CancelExpirationTimer();
|
||||
|
||||
// We must call SetMayHaveTouchCaret() in order to get APZC to wait until the
|
||||
// event has been round-tripped and check whether it has been handled,
|
||||
// otherwise B2G will end up panning the document when the user tries to drag
|
||||
// touch caret.
|
||||
presShell->SetMayHaveTouchCaret(mVisible);
|
||||
}
|
||||
|
||||
nsRect
|
||||
|
@ -828,18 +828,6 @@ nsDisplayScrollLayer::ComputeFrameMetrics(nsIFrame* aForFrame,
|
||||
metrics.SetZoom(metrics.GetCumulativeResolution() * metrics.GetDevPixelsPerCSSPixel()
|
||||
* layerToParentLayerScale);
|
||||
|
||||
if (presShell) {
|
||||
nsIDocument* document = nullptr;
|
||||
document = presShell->GetDocument();
|
||||
if (document) {
|
||||
nsCOMPtr<nsPIDOMWindow> innerWin(document->GetInnerWindow());
|
||||
if (innerWin) {
|
||||
metrics.SetMayHaveTouchListeners(innerWin->HasApzAwareEventListeners());
|
||||
}
|
||||
}
|
||||
metrics.SetMayHaveTouchCaret(presShell->MayHaveTouchCaret());
|
||||
}
|
||||
|
||||
// Calculate the composition bounds as the size of the scroll frame and
|
||||
// its origin relative to the reference frame.
|
||||
// If aScrollFrame is null, we are in a document without a root scroll frame,
|
||||
|
@ -794,17 +794,6 @@ public:
|
||||
*/
|
||||
virtual mozilla::dom::Element* GetTouchCaretElement() const = 0;
|
||||
|
||||
/**
|
||||
* Will be called when touch caret visibility has changed.
|
||||
* Set the mMayHaveTouchCaret flag to aSet.
|
||||
*/
|
||||
virtual void SetMayHaveTouchCaret(bool aSet) = 0;
|
||||
|
||||
/**
|
||||
* Get the mMayHaveTouchCaret flag.
|
||||
*/
|
||||
virtual bool MayHaveTouchCaret() = 0;
|
||||
|
||||
/**
|
||||
* Get the selection caret, if it exists. AddRefs it.
|
||||
*/
|
||||
|
@ -2591,52 +2591,6 @@ PresShell::GetTouchCaretElement() const
|
||||
return GetCanvasFrame() ? GetCanvasFrame()->GetTouchCaretElement() : nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
PresShell::SetMayHaveTouchCaret(bool aSet)
|
||||
{
|
||||
if (!mPresContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mPresContext->IsRoot()) {
|
||||
nsIPresShell* rootPresShell = GetRootPresShell();
|
||||
if (rootPresShell) {
|
||||
rootPresShell->SetMayHaveTouchCaret(aSet);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
nsIDocument* document = GetDocument();
|
||||
if (document) {
|
||||
nsPIDOMWindow* innerWin = document->GetInnerWindow();
|
||||
if (innerWin) {
|
||||
innerWin->SetMayHaveTouchCaret(aSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PresShell::MayHaveTouchCaret()
|
||||
{
|
||||
if (!mPresContext) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mPresContext->IsRoot()) {
|
||||
nsIPresShell* rootPresShell = GetRootPresShell();
|
||||
return rootPresShell ? rootPresShell->MayHaveTouchCaret() : false;
|
||||
}
|
||||
|
||||
nsIDocument* document = GetDocument();
|
||||
if (document) {
|
||||
nsPIDOMWindow* innerWin = document->GetInnerWindow();
|
||||
if (innerWin) {
|
||||
return innerWin->MayHaveTouchCaret();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Element*
|
||||
PresShell::GetSelectionCaretsStartElement() const
|
||||
{
|
||||
|
@ -235,8 +235,6 @@ public:
|
||||
// touch caret
|
||||
virtual already_AddRefed<mozilla::TouchCaret> GetTouchCaret() const MOZ_OVERRIDE;
|
||||
virtual mozilla::dom::Element* GetTouchCaretElement() const MOZ_OVERRIDE;
|
||||
virtual void SetMayHaveTouchCaret(bool aSet) MOZ_OVERRIDE;
|
||||
virtual bool MayHaveTouchCaret() MOZ_OVERRIDE;
|
||||
// selection caret
|
||||
virtual already_AddRefed<mozilla::SelectionCarets> GetSelectionCarets() const MOZ_OVERRIDE;
|
||||
virtual mozilla::dom::Element* GetSelectionCaretsStartElement() const MOZ_OVERRIDE;
|
||||
|
Loading…
Reference in New Issue
Block a user