author | Kartikaya Gupta <kgupta@mozilla.com> |
Tue, 10 Mar 2015 09:29:25 -0400 | |
changeset 232737 | 420b643efff12dd8e9dbbd9aae30a10817340bec |
parent 232736 | 3ec10401043061ba61ecf5ceb19724ed4d5f2e67 |
child 232738 | 074a9461cafd2784ad9c9d8ec21085ad37515768 |
push id | 56645 |
push user | kgupta@mozilla.com |
push date | Tue, 10 Mar 2015 13:30:03 +0000 |
treeherder | mozilla-inbound@420b643efff1 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smaug, dvander, botond |
bugs | 1137267 |
milestone | 39.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
|
--- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -570,18 +570,16 @@ NextWindowID(); } } nsPIDOMWindow::nsPIDOMWindow(nsPIDOMWindow *aOuterWindow) : mFrameElement(nullptr), mDocShell(nullptr), mModalStateDepth(0), 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), mIsActive(false), mIsBackground(false), mAudioMuted(false), mAudioVolume(1.0), mInnerWindow(nullptr), mOuterWindow(aOuterWindow), // Make sure no actual window ends up with mWindowID == 0 mWindowID(NextWindowID()), mHasNotifiedGlobalCreated(false),
--- a/dom/base/nsNodeUtils.cpp +++ b/dom/base/nsNodeUtils.cpp @@ -425,19 +425,16 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNod if (elm) { window->SetMutationListeners(elm->MutationListenerBits()); if (elm->MayHavePaintEventListener()) { window->SetHasPaintEventListeners(); } if (elm->MayHaveTouchEventListener()) { window->SetHasTouchEventListeners(); } - if (elm->MayHaveScrollWheelEventListener()) { - window->SetHasScrollWheelEventListeners(); - } if (elm->MayHaveMouseEnterLeaveEventListener()) { window->SetHasMouseEnterLeaveEventListeners(); } if (elm->MayHavePointerEnterLeaveEventListener()) { window->SetHasPointerEnterLeaveEventListeners(); } } }
--- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -439,54 +439,16 @@ public: } bool HasTouchEventListeners() { 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 * changes window state in a context trusted for write. * * If aHMD is not null, the window is made full screen on the given VR HMD * device instead of its currrent display. * * Outer windows only. @@ -797,18 +759,16 @@ protected: uint32_t mMutationBits; bool mIsDocumentLoaded; bool mIsHandlingResizeEvent; bool mIsInnerWindow; bool mMayHavePaintEventListener; bool mMayHaveTouchEventListener; - bool mMayHaveTouchCaret; - bool mMayHaveScrollWheelEventListener; bool mMayHaveMouseEnterLeaveEventListener; bool mMayHavePointerEnterLeaveEventListener; // This variable is used on both inner and outer windows (and they // should match). bool mIsModalContentWindow; // Tracks activation state that's used for :-moz-window-inactive.
--- a/dom/events/EventListenerManager.cpp +++ b/dom/events/EventListenerManager.cpp @@ -93,17 +93,16 @@ MutationBitForEventType(uint32_t aEventT uint32_t EventListenerManager::sMainThreadCreatedCount = 0; EventListenerManager::EventListenerManager(EventTarget* aTarget) : mMayHavePaintEventListener(false) , mMayHaveMutationListeners(false) , mMayHaveCapturingListeners(false) , mMayHaveSystemGroupListeners(false) , mMayHaveTouchEventListener(false) - , mMayHaveScrollWheelEventListener(false) , mMayHaveMouseEnterLeaveEventListener(false) , mMayHavePointerEnterLeaveEventListener(false) , mClearingListeners(false) , mIsMainThreadELM(NS_IsMainThread()) , mNoListenerForEvent(0) , mTarget(aTarget) { NS_ASSERTION(aTarget, "unexpected null pointer"); @@ -335,26 +334,16 @@ EventListenerManager::AddEventListenerIn aTypeAtom == nsGkAtoms::ontouchcancel) { mMayHaveTouchEventListener = 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->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 || aTypeAtom == nsGkAtoms::onpointerleave) { mMayHavePointerEnterLeaveEventListener = true; if (window) { #ifdef DEBUG nsCOMPtr<nsIDocument> d = window->GetExtantDoc();
--- a/dom/events/EventListenerManager.h +++ b/dom/events/EventListenerManager.h @@ -389,22 +389,16 @@ public: bool MayHavePaintEventListener() { return mMayHavePaintEventListener; } /** * Returns true if there may be a touch event listener registered, * false if there definitely isn't. */ 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; } size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const; uint32_t ListenerCount() const { return mListeners.Length(); @@ -545,17 +539,16 @@ protected: already_AddRefed<nsIScriptGlobalObject> GetScriptGlobalAndDocument(nsIDocument** aDoc); uint32_t mMayHavePaintEventListener : 1; uint32_t mMayHaveMutationListeners : 1; 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; uint32_t mIsMainThreadELM : 1; uint32_t mNoListenerForEvent : 23; nsAutoTObserverArray<Listener, 2> mListeners; dom::EventTarget* MOZ_NON_OWNING_REF mTarget;
--- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -719,18 +719,16 @@ struct ParamTraits<mozilla::layers::Fram WriteParam(aMsg, aParam.mCompositionBounds); WriteParam(aMsg, aParam.mRootCompositionSize); WriteParam(aMsg, aParam.mScrollId); WriteParam(aMsg, aParam.mScrollParentId); WriteParam(aMsg, aParam.mPresShellResolution); 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); WriteParam(aMsg, aParam.mUpdateScrollOffset); WriteParam(aMsg, aParam.mScrollGeneration); WriteParam(aMsg, aParam.mExtraResolution); WriteParam(aMsg, aParam.mBackgroundColor); WriteParam(aMsg, aParam.mDoSmoothScroll); @@ -762,18 +760,16 @@ struct ParamTraits<mozilla::layers::Fram ReadParam(aMsg, aIter, &aResult->mCompositionBounds) && ReadParam(aMsg, aIter, &aResult->mRootCompositionSize) && ReadParam(aMsg, aIter, &aResult->mScrollId) && ReadParam(aMsg, aIter, &aResult->mScrollParentId) && ReadParam(aMsg, aIter, &aResult->mPresShellResolution) && 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) && ReadParam(aMsg, aIter, &aResult->mUpdateScrollOffset) && ReadParam(aMsg, aIter, &aResult->mScrollGeneration) && ReadParam(aMsg, aIter, &aResult->mExtraResolution) && ReadParam(aMsg, aIter, &aResult->mBackgroundColor) && ReadParam(aMsg, aIter, &aResult->mDoSmoothScroll) &&
--- a/gfx/layers/FrameMetrics.h +++ b/gfx/layers/FrameMetrics.h @@ -41,18 +41,16 @@ public: FrameMetrics() : mCompositionBounds(0, 0, 0, 0) , mPresShellResolution(1) , mDisplayPort(0, 0, 0, 0) , mCriticalDisplayPort(0, 0, 0, 0) , mScrollableRect(0, 0, 0, 0) , mCumulativeResolution(1) , mDevPixelsPerCSSPixel(1) - , mMayHaveTouchListeners(false) - , mMayHaveTouchCaret(false) , mIsRoot(false) , mHasScrollgrab(false) , mScrollId(NULL_SCROLL_ID) , mScrollParentId(NULL_SCROLL_ID) , mScrollOffset(0, 0) , mZoom(1) , mUpdateScrollOffset(false) , mScrollGeneration(0) @@ -80,18 +78,16 @@ public: mDisplayPortMargins == aOther.mDisplayPortMargins && mUseDisplayPortMargins == aOther.mUseDisplayPortMargins && mCriticalDisplayPort.IsEqualEdges(aOther.mCriticalDisplayPort) && mViewport.IsEqualEdges(aOther.mViewport) && mScrollableRect.IsEqualEdges(aOther.mScrollableRect) && mPresShellResolution == aOther.mPresShellResolution && mCumulativeResolution == aOther.mCumulativeResolution && mDevPixelsPerCSSPixel == aOther.mDevPixelsPerCSSPixel && - mMayHaveTouchListeners == aOther.mMayHaveTouchListeners && - mMayHaveTouchCaret == aOther.mMayHaveTouchCaret && mPresShellId == aOther.mPresShellId && mIsRoot == aOther.mIsRoot && mScrollId == aOther.mScrollId && mScrollParentId == aOther.mScrollParentId && mScrollOffset == aOther.mScrollOffset && mSmoothScrollOffset == aOther.mSmoothScrollOffset && mHasScrollgrab == aOther.mHasScrollgrab && mUpdateScrollOffset == aOther.mUpdateScrollOffset && @@ -477,36 +473,16 @@ public: return mContentDescription; } void SetContentDescription(const nsCString& aContentDescription) { 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; } void SetLineScrollAmount(const LayoutDeviceIntSize& size) { mLineScrollAmount = size; @@ -587,22 +563,16 @@ private: // be refactored to be private. // The conversion factor between CSS pixels and device pixels for this frame. // This can vary based on a variety of things, such as reflowing-zoom. The // conversion factor for device pixels to layers pixels is just the // 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; // Whether or not this frame is for an element marked 'scrollgrab'. bool mHasScrollgrab; // A unique ID assigned to each scrollable frame. ViewID mScrollId;
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2658,18 +2658,16 @@ bool AsyncPanZoomController::IsCurrently void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint) { APZThreadUtils::AssertOnCompositorThread(); ReentrantMonitorAutoEnter lock(mMonitor); bool isDefault = mFrameMetrics.IsDefault(); 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); LogRendertraceRect(GetGuid(), "page", "brown", aLayerMetrics.GetScrollableRect()); LogRendertraceRect(GetGuid(), "painted displayport", "lightgreen", aLayerMetrics.GetDisplayPort() + aLayerMetrics.GetScrollOffset()); if (!aLayerMetrics.GetCriticalDisplayPort().IsEmpty()) { LogRendertraceRect(GetGuid(), "painted critical displayport", "darkgreen", @@ -2921,22 +2919,16 @@ void AsyncPanZoomController::ZoomToRect( endZoomToMetrics.GetZoom())); // Schedule a repaint now, so the new displayport will be painted before the // animation finishes. RequestContentRepaint(endZoomToMetrics); } } -bool -AsyncPanZoomController::NeedToWaitForContent() const -{ - return (mFrameMetrics.GetMayHaveTouchListeners() || mFrameMetrics.GetMayHaveTouchCaret()); -} - TouchBlockState* AsyncPanZoomController::CurrentTouchBlock() { return GetInputQueue()->CurrentTouchBlock(); } void AsyncPanZoomController::ResetInputState()
--- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -771,22 +771,16 @@ public: * Given the number of touch points in an input event and touch block they * belong to, check if the event can result in a panning/zooming behavior. * This is primarily used to figure out when to dispatch the pointercancel * event for the pointer events spec. */ 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. */ void ResetInputState(); private: nsRefPtr<InputQueue> mInputQueue; TouchBlockState* CurrentTouchBlock(); bool HasReadyTouchBlock();
--- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -256,17 +256,17 @@ protected: apzc->SetFrameMetrics(TestFrameMetrics()); } virtual void TearDown() { apzc->Destroy(); } - void SetMayHaveTouchListeners() + void MakeApzcWaitForMainThread() { apzc->SetWaitForMainThread(); } void MakeApzcZoomable() { apzc->UpdateZoomConstraints(ZoomConstraints(true, true, CSSToParentLayerScale(0.25f), CSSToParentLayerScale(4.0f))); } @@ -760,17 +760,17 @@ TEST_F(APZCPinchGestureDetectorTester, P behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM); DoPinchTest(false, &behaviors); } TEST_F(APZCPinchGestureDetectorTester, Pinch_PreventDefault) { FrameMetrics originalMetrics = GetPinchableFrameMetrics(); apzc->SetFrameMetrics(originalMetrics); - SetMayHaveTouchListeners(); + MakeApzcWaitForMainThread(); MakeApzcZoomable(); int touchInputId = 0; uint64_t blockId = 0; PinchWithTouchInput(apzc, 250, 300, 1.25, touchInputId, nullptr, nullptr, &blockId); // Send the prevent-default notification for the touch block apzc->ContentReceivedInputBlock(blockId, true); @@ -964,17 +964,17 @@ protected: apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut); EXPECT_EQ(ParentLayerPoint(), pointOut); EXPECT_EQ(ViewTransform(), viewTransformOut); } void DoPanWithPreventDefaultTest() { - SetMayHaveTouchListeners(); + MakeApzcWaitForMainThread(); int time = 0; int touchStart = 50; int touchEnd = 10; ParentLayerPoint pointOut; ViewTransform viewTransformOut; uint64_t blockId = 0; @@ -1243,17 +1243,17 @@ protected: apzc->SampleContentTransformForFrame(testStartTime + TimeDuration::FromMilliseconds(timeDelta + 1000), &viewTransformOut, finalPointOut); EXPECT_EQ(pointOut.x, finalPointOut.x); EXPECT_EQ(pointOut.y, finalPointOut.y); apzc->AssertStateIsReset(); } void DoFlingStopWithSlowListener(bool aPreventDefault) { - SetMayHaveTouchListeners(); + MakeApzcWaitForMainThread(); int time = 0; int touchStart = 50; int touchEnd = 10; uint64_t blockId = 0; // Start the fling down. Pan(apzc, time, touchStart, touchEnd, false, nullptr, nullptr, &blockId); @@ -1568,17 +1568,17 @@ DoubleTapAndCheckStatus(const nsRefPtr<I DoubleTap(aTarget, aX, aY, aTime, &statuses, aOutInputBlockIds); EXPECT_EQ(nsEventStatus_eConsumeDoDefault, statuses[0]); EXPECT_EQ(nsEventStatus_eConsumeDoDefault, statuses[1]); EXPECT_EQ(nsEventStatus_eConsumeDoDefault, statuses[2]); EXPECT_EQ(nsEventStatus_eConsumeDoDefault, statuses[3]); } TEST_F(APZCGestureDetectorTester, DoubleTap) { - SetMayHaveTouchListeners(); + MakeApzcWaitForMainThread(); MakeApzcZoomable(); EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(0); EXPECT_CALL(*mcc, HandleDoubleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1); int time = 0; uint64_t blockIds[2]; DoubleTapAndCheckStatus(apzc, 10, 10, time, &blockIds); @@ -1588,17 +1588,17 @@ TEST_F(APZCGestureDetectorTester, Double apzc->ContentReceivedInputBlock(blockIds[1], false); while (mcc->RunThroughDelayedTasks()); apzc->AssertStateIsReset(); } TEST_F(APZCGestureDetectorTester, DoubleTapNotZoomable) { - SetMayHaveTouchListeners(); + MakeApzcWaitForMainThread(); MakeApzcUnzoomable(); EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(2); EXPECT_CALL(*mcc, HandleDoubleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(0); int time = 0; uint64_t blockIds[2]; DoubleTapAndCheckStatus(apzc, 10, 10, time, &blockIds); @@ -1608,17 +1608,17 @@ TEST_F(APZCGestureDetectorTester, Double apzc->ContentReceivedInputBlock(blockIds[1], false); while (mcc->RunThroughDelayedTasks()); apzc->AssertStateIsReset(); } TEST_F(APZCGestureDetectorTester, DoubleTapPreventDefaultFirstOnly) { - SetMayHaveTouchListeners(); + MakeApzcWaitForMainThread(); MakeApzcZoomable(); EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1); EXPECT_CALL(*mcc, HandleDoubleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(0); int time = 0; uint64_t blockIds[2]; DoubleTapAndCheckStatus(apzc, 10, 10, time, &blockIds); @@ -1628,17 +1628,17 @@ TEST_F(APZCGestureDetectorTester, Double apzc->ContentReceivedInputBlock(blockIds[1], false); while (mcc->RunThroughDelayedTasks()); apzc->AssertStateIsReset(); } TEST_F(APZCGestureDetectorTester, DoubleTapPreventDefaultBoth) { - SetMayHaveTouchListeners(); + MakeApzcWaitForMainThread(); MakeApzcZoomable(); EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(0); EXPECT_CALL(*mcc, HandleDoubleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(0); int time = 0; uint64_t blockIds[2]; DoubleTapAndCheckStatus(apzc, 10, 10, time, &blockIds);
--- a/layout/base/SelectionCarets.cpp +++ b/layout/base/SelectionCarets.cpp @@ -314,22 +314,16 @@ SelectionCarets::SetVisibility(bool aVis mVisible = aVisible; SELECTIONCARETS_LOG("Set visibility %s", (mVisible ? "shown" : "hidden")); dom::Element* startElement = mPresShell->GetSelectionCaretsStartElement(); SetElementVisibility(startElement, mVisible && mStartCaretVisible); 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 SelectionCarets::SetStartFrameVisibility(bool aVisible) { mStartCaretVisible = aVisible; SELECTIONCARETS_LOG("Set start frame visibility %s", (mStartCaretVisible ? "shown" : "hidden"));
--- a/layout/base/TouchCaret.cpp +++ b/layout/base/TouchCaret.cpp @@ -176,22 +176,16 @@ TouchCaret::SetVisibility(bool aVisible) ErrorResult err; touchCaretElement->ClassList()->Toggle(NS_LITERAL_STRING("hidden"), dom::Optional<bool>(!mVisible), err); TOUCHCARET_LOG("Set visibility %s", (mVisible ? "shown" : "hidden")); // 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 TouchCaret::GetTouchFrameRect() { nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell); if (!presShell) { return nsRect();
--- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -823,28 +823,16 @@ nsDisplayScrollLayer::ComputeFrameMetric (float)nsPresContext::AppUnitsPerCSSPixel() / auPerDevPixel)); // Initially, AsyncPanZoomController should render the content to the screen // at the painted resolution. const LayerToParentLayerScale layerToParentLayerScale(1.0f); 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, // so it's a xul document. In this case, use the size of the viewport frame. nsIFrame* frameForCompositionBoundsCalculation = aScrollFrame ? aScrollFrame : aForFrame; nsRect compositionBounds(frameForCompositionBoundsCalculation->GetOffsetToCrossDoc(aReferenceFrame), frameForCompositionBoundsCalculation->GetSize()); if (scrollableFrame) {
--- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -790,27 +790,16 @@ public: virtual already_AddRefed<mozilla::TouchCaret> GetTouchCaret() const = 0; /** * Returns the touch caret element of the presshell. */ 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. */ virtual already_AddRefed<mozilla::SelectionCarets> GetSelectionCarets() const = 0; /** * Returns the start part of selection caret element of the presshell. */ virtual mozilla::dom::Element* GetSelectionCaretsStartElement() const = 0;
--- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -2586,62 +2586,16 @@ PresShell::GetCanvasFrame() const } Element* 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 { return GetCanvasFrame() ? GetCanvasFrame()->GetSelectionCaretsStartElement() : nullptr; } Element* PresShell::GetSelectionCaretsEndElement() const
--- a/layout/base/nsPresShell.h +++ b/layout/base/nsPresShell.h @@ -230,18 +230,16 @@ public: virtual void DispatchSynthMouseMove(mozilla::WidgetGUIEvent* aEvent, bool aFlushOnHoverChange) MOZ_OVERRIDE; virtual void ClearMouseCaptureOnView(nsView* aView) MOZ_OVERRIDE; virtual bool IsVisible() MOZ_OVERRIDE; // 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; virtual mozilla::dom::Element* GetSelectionCaretsEndElement() const MOZ_OVERRIDE; // caret handling virtual already_AddRefed<nsCaret> GetCaret() const MOZ_OVERRIDE; NS_IMETHOD SetCaretEnabled(bool aInEnable) MOZ_OVERRIDE; NS_IMETHOD SetCaretReadOnly(bool aReadOnly) MOZ_OVERRIDE;