зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1249943 - Make test_basic_pan work on Fennec and Linux as well. r=botond
This patch convers the APZ:TransformEnd notification from a MessageManager message to an observer notification so that it is more general and works on other platforms. MozReview-Commit-ID: 8SSir828Ch7
This commit is contained in:
Родитель
262f630e11
Коммит
eb1055aff7
|
@ -1768,9 +1768,8 @@ TabChild::NotifyAPZStateChange(const ViewID& aViewId,
|
|||
if (aChange == layers::GeckoContentController::APZStateChange::TransformEnd) {
|
||||
// This is used by tests to determine when the APZ is done doing whatever
|
||||
// it's doing. XXX generify this as needed when writing additional tests.
|
||||
DispatchMessageManagerMessage(
|
||||
NS_LITERAL_STRING("APZ:TransformEnd"),
|
||||
NS_LITERAL_STRING("{}"));
|
||||
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
||||
observerService->NotifyObservers(nullptr, "APZ:TransformEnd", nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -10,10 +10,12 @@
|
|||
<script type="application/javascript">
|
||||
|
||||
function scrollPage() {
|
||||
SpecialPowers._addMessageListener("APZ:TransformEnd", function() {
|
||||
var transformEnd = function() {
|
||||
SpecialPowers.Services.obs.removeObserver(transformEnd, "APZ:TransformEnd", false);
|
||||
dump("Transform complete; flushing repaints...\n");
|
||||
flushApzRepaints(checkScroll);
|
||||
});
|
||||
};
|
||||
SpecialPowers.Services.obs.addObserver(transformEnd, "APZ:TransformEnd", false);
|
||||
|
||||
const TOUCH_SLOP = 1;
|
||||
synthesizeNativeDrag(document.body, 10, 100, 0, -(50 + TOUCH_SLOP));
|
||||
|
|
|
@ -10,10 +10,12 @@
|
|||
<script type="application/javascript">
|
||||
|
||||
function scrollOuter() {
|
||||
SpecialPowers._addMessageListener("APZ:TransformEnd", function() {
|
||||
var transformEnd = function() {
|
||||
SpecialPowers.Services.obs.removeObserver(transformEnd, "APZ:TransformEnd", false);
|
||||
dump("Transform complete; flushing repaints...\n");
|
||||
flushApzRepaints(checkScroll);
|
||||
});
|
||||
};
|
||||
SpecialPowers.Services.obs.addObserver(transformEnd, "APZ:TransformEnd", false);
|
||||
|
||||
const TOUCH_SLOP = 1;
|
||||
synthesizeNativeDrag(document.getElementById('outer'), 10, 100, 0, -(50 + TOUCH_SLOP));
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
|
||||
function scrollOuter() {
|
||||
var outer = document.getElementById('outer');
|
||||
SpecialPowers._addMessageListener("APZ:TransformEnd", function() {
|
||||
var transformEnd = function() {
|
||||
SpecialPowers.Services.obs.removeObserver(transformEnd, "APZ:TransformEnd", false);
|
||||
dump("Transform complete; flushing repaints...\n");
|
||||
flushApzRepaints(checkScroll, outer.contentWindow);
|
||||
});
|
||||
};
|
||||
SpecialPowers.Services.obs.addObserver(transformEnd, "APZ:TransformEnd", false);
|
||||
|
||||
const TOUCH_SLOP = 1;
|
||||
synthesizeNativeDrag(outer.contentDocument.body, 10, 100, 0, -(50 + TOUCH_SLOP));
|
||||
|
|
|
@ -25,7 +25,9 @@ skip-if = (os == 'android') || (os == 'b2g') # wheel events not supported on mob
|
|||
[test_layerization.html]
|
||||
skip-if = (os == 'android') || (os == 'b2g') # uses wheel events which are not supported on mobile
|
||||
[test_basic_pan.html]
|
||||
skip-if = toolkit != 'gonk'
|
||||
# Windows touch injection doesn't work in automation, but this test can be run locally on a windows touch device.
|
||||
# On OS X we don't support touch events at all.
|
||||
skip-if = (toolkit == 'windows') || (toolkit == 'cocoa')
|
||||
[test_scroll_inactive_flattened_frame.html]
|
||||
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
|
||||
[test_scroll_inactive_bug1190112.html]
|
||||
|
|
|
@ -34,6 +34,16 @@ function testDone() {
|
|||
}
|
||||
|
||||
window.onload = function() {
|
||||
if (!SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled) {
|
||||
ok(true, "APZ is not enabled, this test is not relevant, sorry!\n");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
if (!window.TouchEvent) {
|
||||
ok(true, "Touch events are not supported on this platform, sorry!\n");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ "set":
|
||||
[
|
||||
|
@ -45,6 +55,10 @@ window.onload = function() {
|
|||
// events get held up. Try to prevent that by making long-taps require
|
||||
// a 10 second hold.
|
||||
["ui.click_hold_context_menus.delay", "10000"],
|
||||
// The subtests in this test do touch-drags to pan the page, but we don't
|
||||
// want those pans to turn into fling animations, so we increase the
|
||||
// fling-stop threshold velocity to absurdly high.
|
||||
["apz.fling_stopped_threshold", "10000"],
|
||||
]
|
||||
}, testDone);
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "base/message_loop.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsWindow.h"
|
||||
|
||||
|
@ -98,5 +99,23 @@ AndroidContentController::UpdateOverscrollOffset(const float aX,const float aY)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
AndroidContentController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
||||
APZStateChange aChange,
|
||||
int aArg)
|
||||
{
|
||||
// This function may get invoked twice, if the first invocation is not on
|
||||
// the main thread then the ChromeProcessController version of this function
|
||||
// will redispatch to the main thread. We want to make sure that our handling
|
||||
// only happens on the main thread.
|
||||
ChromeProcessController::NotifyAPZStateChange(aGuid, aChange, aArg);
|
||||
if (NS_IsMainThread() && aChange == layers::GeckoContentController::APZStateChange::TransformEnd) {
|
||||
// This is used by tests to determine when the APZ is done doing whatever
|
||||
// it's doing. XXX generify this as needed when writing additional tests.
|
||||
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
|
||||
observerService->NotifyObservers(nullptr, "APZ:TransformEnd", nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -40,6 +40,9 @@ public:
|
|||
void PostDelayedTask(Task* aTask, int aDelayMs) override;
|
||||
void UpdateOverscrollVelocity(const float aX, const float aY) override;
|
||||
void UpdateOverscrollOffset(const float aX,const float aY) override;
|
||||
void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
||||
APZStateChange aChange,
|
||||
int aArg) override;
|
||||
|
||||
static void NotifyDefaultPrevented(mozilla::layers::APZCTreeManager* aManager,
|
||||
uint64_t aInputBlockId, bool aDefaultPrevented);
|
||||
|
|
Загрузка…
Ссылка в новой задаче