Bug 1466950 - Fix test to work on Android. r=hiro

MozReview-Commit-ID: G2NTiGUiw5Y

--HG--
extra : rebase_source : 149e87e81d115cbb1a1b1684e0022fc24f7a7eb5
This commit is contained in:
Kartikaya Gupta 2018-06-26 09:20:21 -04:00
Родитель b564a1c166
Коммит 4b90819f59
7 изменённых файлов: 29 добавлений и 5 удалений

Просмотреть файл

@ -1698,7 +1698,7 @@ interface nsIDOMWindowUtils : nsISupports {
[optional] in AString aPseudoElement);
/*
* Returns the value of the transform value on the compositor thread.
* Returns the value of the transform on the compositor, in layer pixels.
* Unlike the above getOMTAStyle, the transform value returned by this
* includes both of animating and APZ values.
* Note: This function doesn't work on WebRender at all. Also this function

Просмотреть файл

@ -592,6 +592,17 @@ Layer::HasScrollableFrameMetrics() const
return false;
}
bool
Layer::HasRootScrollableFrameMetrics() const
{
for (uint32_t i = 0; i < GetScrollMetadataCount(); i++) {
if (GetFrameMetrics(i).IsScrollable() && GetFrameMetrics(i).IsRootContent()) {
return true;
}
}
return false;
}
bool
Layer::IsScrollableWithoutContent() const
{

Просмотреть файл

@ -1292,6 +1292,7 @@ public:
uint32_t GetScrollMetadataCount() const { return mScrollMetadata.Length(); }
const nsTArray<ScrollMetadata>& GetAllScrollMetadata() { return mScrollMetadata; }
bool HasScrollableFrameMetrics() const;
bool HasRootScrollableFrameMetrics() const;
bool IsScrollableWithoutContent() const;
const EventRegions& GetEventRegions() const { return mEventRegions; }
ContainerLayer* GetParent() { return mParent; }

Просмотреть файл

@ -35,6 +35,7 @@ const utils = SpecialPowers.getDOMWindowUtils(window);
async function test_opacity() {
utils.setDisplayPortForElement(0, 0, 300, 1000, document.documentElement, 1);
await promiseAllPaintsDone();
let dpr = window.devicePixelRatio;
let transform = utils.getOMTCTransform(anim);
is(transform, "matrix(1, 0, 0, 1, 0, 0)",
@ -45,7 +46,7 @@ async function test_opacity() {
await new Promise(resolve => waitForApzFlushedRepaints(resolve));
transform = utils.getOMTCTransform(anim);
is(transform, "matrix(1, 0, 0, 1, 0, -300)",
is(transform, `matrix(1, 0, 0, 1, 0, ${-300 * dpr})`,
"Element should have been moved by the offset");
}

Просмотреть файл

@ -36,8 +36,9 @@ async function test_transform() {
utils.setDisplayPortForElement(0, 0, 300, 1000, document.documentElement, 1);
await promiseAllPaintsDone();
let dpr = window.devicePixelRatio;
let transform = utils.getOMTCTransform(anim);
is(transform, "matrix(1, 0, 0, 1, 200, 0)",
is(transform, `matrix(1, 0, 0, 1, ${200 * dpr}, 0)`,
"The element shouldn't be moved before scrolling");
utils.setAsyncScrollOffset(document.documentElement, 0, 300);
@ -45,7 +46,7 @@ async function test_transform() {
await new Promise(resolve => waitForApzFlushedRepaints(resolve));
transform = utils.getOMTCTransform(anim);
is(transform, "matrix(1, 0, 0, 1, 200, -300)",
is(transform, `matrix(1, 0, 0, 1, ${200 * dpr}, ${-300 * dpr})`,
"Element should have been moved by the offset");
}

Просмотреть файл

@ -15,7 +15,6 @@
[test_bug1304689.html]
[test_bug1304689-2.html]
[test_bug1464568.html]
skip-if = (toolkit == 'android') # setAsyncScrollOffset doesn't work on mobile
[test_frame_reconstruction.html]
[test_group_mouseevents.html]
skip-if = (toolkit == 'android') # mouse events not supported on mobile

Просмотреть файл

@ -790,6 +790,17 @@ LayerTransactionParent::RecvGetTransform(const LayerHandle& aLayerHandle,
transform.PostTranslate(-scaledOrigin.x, -scaledOrigin.y, -scaledOrigin.z);
}
// This function is supposed to include the APZ transform, but if root scroll
// containers are enabled, then the APZ transform might not be on |layer| but
// instead would be on the parent of |layer|, if that is the root scrollable
// metrics. So we special-case that behaviour.
if (gfxPrefs::LayoutUseContainersForRootFrames() &&
!layer->HasScrollableFrameMetrics() &&
layer->GetParent() &&
layer->GetParent()->HasRootScrollableFrameMetrics()) {
transform *= layer->GetParent()->AsHostLayer()->GetShadowBaseTransform();
}
*aTransform = transform;
return IPC_OK();