Bug 1120358 - Part 1: Handle scroll position change that is not triggered by APZ. r=roc

This commit is contained in:
Jeremy Chen 2015-01-15 00:42:00 -05:00
parent 5e51099400
commit 6660d30c24
2 changed files with 18 additions and 5 deletions

View File

@ -78,6 +78,7 @@ SelectionCarets::SelectionCarets(nsIPresShell* aPresShell)
, mCaretCenterToDownPointOffsetY(0)
, mDragMode(NONE)
, mAsyncPanZoomEnabled(false)
, mInAsyncPanZoomGesture(false)
, mEndCaretVisible(false)
, mStartCaretVisible(false)
, mSelectionVisibleInScrollFrames(true)
@ -1183,6 +1184,7 @@ DispatchScrollViewChangeEvent(nsIPresShell *aPresShell, const dom::ScrollState a
void
SelectionCarets::AsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos)
{
mInAsyncPanZoomGesture = true;
SetVisibility(false);
SELECTIONCARETS_LOG("Dispatch scroll started with position x=%d, y=%d",
@ -1193,6 +1195,7 @@ SelectionCarets::AsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos)
void
SelectionCarets::AsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos)
{
mInAsyncPanZoomGesture = false;
SELECTIONCARETS_LOG("Update selection carets after APZ is stopped!");
UpdateSelectionCarets();
@ -1209,12 +1212,20 @@ SelectionCarets::AsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos)
void
SelectionCarets::ScrollPositionChanged()
{
if (!mAsyncPanZoomEnabled && mVisible) {
SetVisibility(false);
//TODO: handling scrolling for selection bubble when APZ is off
if (mVisible) {
if (!mAsyncPanZoomEnabled) {
SetVisibility(false);
//TODO: handling scrolling for selection bubble when APZ is off
SELECTIONCARETS_LOG("Launch scroll end detector");
LaunchScrollEndDetector();
SELECTIONCARETS_LOG("Launch scroll end detector");
LaunchScrollEndDetector();
} else {
if (!mInAsyncPanZoomGesture) {
UpdateSelectionCarets();
DispatchSelectionStateChangedEvent(GetSelection(),
SelectionState::Updateposition);
}
}
}
}

View File

@ -260,6 +260,8 @@ private:
// True if AsyncPanZoom is enabled
bool mAsyncPanZoomEnabled;
// True if AsyncPanZoom is started
bool mInAsyncPanZoomGesture;
bool mEndCaretVisible;
bool mStartCaretVisible;