mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 716863 - Abort uselessly continuing to fling subdocuments once they can't go any farther. r=Cwiiis
This commit is contained in:
parent
203e7a6341
commit
2b4d6ba175
@ -212,6 +212,12 @@ abstract class Axis {
|
||||
if (mFlingState != FlingStates.FLINGING) {
|
||||
return false;
|
||||
}
|
||||
if (mSubscroller.scrolling() && !mSubscroller.lastScrollSucceeded()) {
|
||||
// if the subdocument stopped scrolling, it's because it reached the end
|
||||
// of the subdocument. we don't do overscroll on subdocuments, so there's
|
||||
// no point in continuing this fling.
|
||||
return false;
|
||||
}
|
||||
|
||||
float excess = getExcess();
|
||||
if (mDisableSnap || FloatUtils.fuzzyEquals(excess, 0.0f)) {
|
||||
|
@ -60,6 +60,7 @@ class SubdocumentScrollHelper implements GeckoEventListener {
|
||||
private boolean mOverridePanning;
|
||||
private boolean mOverrideScrollAck;
|
||||
private boolean mOverrideScrollPending;
|
||||
private boolean mScrollSucceeded;
|
||||
|
||||
SubdocumentScrollHelper(PanZoomController controller) {
|
||||
mPanZoomController = controller;
|
||||
@ -104,6 +105,10 @@ class SubdocumentScrollHelper implements GeckoEventListener {
|
||||
return mOverridePanning;
|
||||
}
|
||||
|
||||
boolean lastScrollSucceeded() {
|
||||
return mScrollSucceeded;
|
||||
}
|
||||
|
||||
// GeckoEventListener implementation
|
||||
|
||||
public void handleMessage(final String event, final JSONObject message) {
|
||||
@ -116,10 +121,12 @@ class SubdocumentScrollHelper implements GeckoEventListener {
|
||||
mOverridePanning = true;
|
||||
mOverrideScrollAck = true;
|
||||
mOverrideScrollPending = false;
|
||||
mScrollSucceeded = true;
|
||||
} else if (MESSAGE_CANCEL_OVERRIDE.equals(event)) {
|
||||
mOverridePanning = false;
|
||||
} else if (MESSAGE_SCROLL_ACK.equals(event)) {
|
||||
mOverrideScrollAck = true;
|
||||
mScrollSucceeded = message.getBoolean("scrolled");
|
||||
if (mOverridePanning && mOverrideScrollPending) {
|
||||
scrollBy(mPanZoomController.getDisplacement());
|
||||
}
|
||||
|
@ -2075,8 +2075,12 @@ var BrowserEventHandler = {
|
||||
}
|
||||
|
||||
// Scroll the scrollable element
|
||||
this._scrollElementBy(this._scrollableElement, data.x, data.y);
|
||||
sendMessageToJava({ gecko: { type: "Gesture:ScrollAck" } });
|
||||
if (this._elementCanScroll(this._scrollableElement, data.x, data.y)) {
|
||||
this._scrollElementBy(this._scrollableElement, data.x, data.y);
|
||||
sendMessageToJava({ gecko: { type: "Gesture:ScrollAck", scrolled: true } });
|
||||
} else {
|
||||
sendMessageToJava({ gecko: { type: "Gesture:ScrollAck", scrolled: false } });
|
||||
}
|
||||
} else if (aTopic == "Gesture:CancelTouch") {
|
||||
this._cancelTapHighlight();
|
||||
} else if (aTopic == "Gesture:ShowPress") {
|
||||
|
Loading…
Reference in New Issue
Block a user