forked from mirrors/gecko-dev
Bug 1676814 - Revert a2f0dae16c37 to stop crashing on fast fling etc. r=botond,geckoview-reviewers,snorp
Differential Revision: https://phabricator.services.mozilla.com/D96965
This commit is contained in:
parent
16460d64d1
commit
9b56e1a377
4 changed files with 82 additions and 13 deletions
|
|
@ -0,0 +1,37 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.5">
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
/* background contains one extra transparent.gif because we want trick the
|
||||
contentful paint detection; We want to make sure the background is loaded
|
||||
before the test starts so we always wait for the contentful paint timestamp
|
||||
to exist, however, gradient isn't considered as contentful per spec, so Gecko
|
||||
wouldn't generate a timestamp for it. Hence, we added a transparent gif
|
||||
to the image list to trick the detection. */
|
||||
background: url('/assets/www/transparent.gif'), linear-gradient(135deg, red, white);
|
||||
}
|
||||
|
||||
#one {
|
||||
background-color: red;
|
||||
width: 200%;
|
||||
height: 100vh;
|
||||
}
|
||||
#two {
|
||||
background-color: blue;
|
||||
width: 200%;
|
||||
height: 800vh;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="one"></div>
|
||||
<div id="two"></div>
|
||||
<script>
|
||||
document.getElementById("two").addEventListener("touchstart", e => {
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -90,6 +90,7 @@ open class BaseSessionTest(noErrorCollector: Boolean = false) {
|
|||
const val IFRAME_100_PERCENT_HEIGHT_SCROLLABLE_HTML_PATH = "/assets/www/iframe_100_percent_height_scrollable.html"
|
||||
const val IFRAME_98VH_SCROLLABLE_HTML_PATH = "/assets/www/iframe_98vh_scrollable.html"
|
||||
const val IFRAME_98VH_NO_SCROLLABLE_HTML_PATH = "/assets/www/iframe_98vh_no_scrollable.html"
|
||||
const val TOUCHSTART_HTML_PATH = "/assets/www/touchstart.html"
|
||||
|
||||
const val TEST_ENDPOINT = GeckoSessionTestRule.TEST_ENDPOINT
|
||||
}
|
||||
|
|
|
|||
|
|
@ -449,4 +449,31 @@ class PanZoomControllerTest : BaseSessionTest() {
|
|||
value, equalTo(PanZoomController.INPUT_RESULT_HANDLED_CONTENT))
|
||||
}
|
||||
}
|
||||
|
||||
private fun fling() {
|
||||
val downTime = SystemClock.uptimeMillis();
|
||||
val down = MotionEvent.obtain(
|
||||
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, 50f, 90f, 0)
|
||||
|
||||
mainSession.panZoomController.onTouchEventForResult(down)
|
||||
var move = MotionEvent.obtain(
|
||||
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_MOVE, 50f, 70f, 0)
|
||||
mainSession.panZoomController.onTouchEvent(move)
|
||||
move = MotionEvent.obtain(
|
||||
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_MOVE, 50f, 30f, 0)
|
||||
mainSession.panZoomController.onTouchEvent(move)
|
||||
|
||||
val up = MotionEvent.obtain(
|
||||
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, 50f, 10f, 0)
|
||||
mainSession.panZoomController.onTouchEvent(up)
|
||||
}
|
||||
|
||||
@WithDisplay(width = 100, height = 100)
|
||||
@Test
|
||||
fun dontCrashDuringFastFling() {
|
||||
setupDocument(TOUCHSTART_HTML_PATH)
|
||||
|
||||
fling()
|
||||
fling()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,9 +360,13 @@ class NPZCSupport final
|
|||
WheelDeltaAdjustmentStrategy::eNone);
|
||||
|
||||
APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input);
|
||||
int32_t ret =
|
||||
(result.mHandledResult == Some(APZHandledResult::HandledByRoot))
|
||||
? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
|
||||
if (result.mStatus == nsEventStatus_eConsumeNoDefault) {
|
||||
MOZ_ASSERT(result.mHandledResult, "Should have a valid APZHandledResult");
|
||||
return ConvertAPZHandledResult(result.mHandledResult.value());
|
||||
return ret;
|
||||
}
|
||||
|
||||
PostInputEvent([input, result](nsWindow* window) {
|
||||
|
|
@ -374,9 +378,7 @@ class NPZCSupport final
|
|||
case nsEventStatus_eIgnore:
|
||||
return INPUT_RESULT_UNHANDLED;
|
||||
case nsEventStatus_eConsumeDoDefault:
|
||||
return (result.mHandledResult == Some(APZHandledResult::HandledByRoot))
|
||||
? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
return ret;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected nsEventStatus");
|
||||
return INPUT_RESULT_UNHANDLED;
|
||||
|
|
@ -501,9 +503,13 @@ class NPZCSupport final
|
|||
nsWindow::GetEventTimeStamp(aTime), nsWindow::GetModifiers(aMetaState));
|
||||
|
||||
APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input);
|
||||
int32_t ret =
|
||||
(result.mHandledResult == Some(APZHandledResult::HandledByRoot))
|
||||
? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
|
||||
if (result.mStatus == nsEventStatus_eConsumeNoDefault) {
|
||||
MOZ_ASSERT(result.mHandledResult, "Should have a valid APZHandledResult");
|
||||
return ConvertAPZHandledResult(result.mHandledResult.value());
|
||||
return ret;
|
||||
}
|
||||
|
||||
PostInputEvent([input, result](nsWindow* window) {
|
||||
|
|
@ -515,9 +521,7 @@ class NPZCSupport final
|
|||
case nsEventStatus_eIgnore:
|
||||
return INPUT_RESULT_UNHANDLED;
|
||||
case nsEventStatus_eConsumeDoDefault:
|
||||
return (result.mHandledResult == Some(APZHandledResult::HandledByRoot))
|
||||
? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT;
|
||||
return ret;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected nsEventStatus");
|
||||
return INPUT_RESULT_UNHANDLED;
|
||||
|
|
@ -702,10 +706,10 @@ class NPZCSupport final
|
|||
APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input);
|
||||
if (result.mStatus == nsEventStatus_eConsumeNoDefault) {
|
||||
if (returnResult) {
|
||||
MOZ_ASSERT(result.mHandledResult,
|
||||
"Should have a valid APZHandledResult");
|
||||
returnResult->Complete(java::sdk::Integer::ValueOf(
|
||||
ConvertAPZHandledResult(result.mHandledResult.value())));
|
||||
(result.mHandledResult == Some(APZHandledResult::HandledByRoot))
|
||||
? INPUT_RESULT_HANDLED
|
||||
: INPUT_RESULT_HANDLED_CONTENT));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue