Bug 1523692 - Set the prefers-reduce-motion value for test to the instance of nsLookAndFeel in child processes. r=snorp

So that we can query the test value in the child process properly.

Note that the APIs used for setting the prefers-reduced-motion value for testing
are only used on Android and MacOSX.  As for MacOSX we have a different
machinery (see bug 1486971) to deliver the test value without spinning native
event loop in the child process so the change here is valid only for Android.

Differential Revision: https://phabricator.services.mozilla.com/D18311
This commit is contained in:
Hiroyuki Ikezoe
2019-02-01 22:07:26 +00:00
parent 8c057ab512
commit f0c3fac208
6 changed files with 28 additions and 29 deletions

View File

@@ -28,6 +28,7 @@
#include "nsIWidgetListener.h"
#include "imgIContainer.h"
#include "nsView.h"
#include "nsXPLookAndFeel.h"
#include "nsPrintfCString.h"
using namespace mozilla;
@@ -903,10 +904,8 @@ struct CursorSurface {
IntSize mSize;
};
void PuppetWidget::SetCursor(nsCursor aCursor,
imgIContainer* aCursorImage,
uint32_t aHotspotX,
uint32_t aHotspotY) {
void PuppetWidget::SetCursor(nsCursor aCursor, imgIContainer* aCursorImage,
uint32_t aHotspotX, uint32_t aHotspotY) {
if (!mTabChild) {
return;
}
@@ -945,7 +944,8 @@ void PuppetWidget::SetCursor(nsCursor aCursor,
mCustomCursor = nullptr;
nsDependentCString cursorData(customCursorData ? customCursorData.get() : "", length);
nsDependentCString cursorData(customCursorData ? customCursorData.get() : "",
length);
if (!mTabChild->SendSetCursor(aCursor, hasCustomCursor, cursorData,
customCursorSize.width, customCursorSize.height,
stride, format, aHotspotX, aHotspotY, force)) {
@@ -1409,6 +1409,9 @@ nsresult PuppetWidget::SetPrefersReducedMotionOverrideForTest(bool aValue) {
return NS_ERROR_FAILURE;
}
nsXPLookAndFeel::GetInstance()->SetPrefersReducedMotionOverrideForTest(
aValue);
mTabChild->SendSetPrefersReducedMotionOverrideForTest(aValue);
return NS_OK;
}
@@ -1418,6 +1421,7 @@ nsresult PuppetWidget::ResetPrefersReducedMotionOverrideForTest() {
return NS_ERROR_FAILURE;
}
nsXPLookAndFeel::GetInstance()->ResetPrefersReducedMotionOverrideForTest();
mTabChild->SendResetPrefersReducedMotionOverrideForTest();
return NS_OK;
}