зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 121326268074 (bug 1737722) for causing build bustages on WRHitTester.cpp. CLOSED TREE
This commit is contained in:
Родитель
24843e3503
Коммит
7ad40f6883
|
@ -12,7 +12,6 @@
|
||||||
#include "mozilla/webrender/WebRenderAPI.h"
|
#include "mozilla/webrender/WebRenderAPI.h"
|
||||||
#include "nsDebug.h" // for NS_ASSERTION
|
#include "nsDebug.h" // for NS_ASSERTION
|
||||||
#include "nsIXULRuntime.h" // for FissionAutostart
|
#include "nsIXULRuntime.h" // for FissionAutostart
|
||||||
#include "mozilla/gfx/Matrix.h"
|
|
||||||
|
|
||||||
#define APZCTM_LOG(...) \
|
#define APZCTM_LOG(...) \
|
||||||
MOZ_LOG(APZCTreeManager::sLog, LogLevel::Debug, (__VA_ARGS__))
|
MOZ_LOG(APZCTreeManager::sLog, LogLevel::Debug, (__VA_ARGS__))
|
||||||
|
@ -23,53 +22,6 @@ namespace layers {
|
||||||
using mozilla::gfx::CompositorHitTestFlags;
|
using mozilla::gfx::CompositorHitTestFlags;
|
||||||
using mozilla::gfx::CompositorHitTestInvisibleToHit;
|
using mozilla::gfx::CompositorHitTestInvisibleToHit;
|
||||||
|
|
||||||
static bool CheckCloseToIdentity(const gfx::Matrix4x4& aMatrix) {
|
|
||||||
// We allow a factor of 1/2048 in the multiply part of the matrix, so that if
|
|
||||||
// we multiply by a point on a screen of size 2048 we would be off by at most
|
|
||||||
// 1 pixel approximately.
|
|
||||||
const float multiplyEps = 1 / 2048.f;
|
|
||||||
// We allow 1 pixel in the translate part of the matrix.
|
|
||||||
const float translateEps = 1.f;
|
|
||||||
|
|
||||||
if (!FuzzyEqualsAdditive(aMatrix._11, 1.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._12, 0.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._13, 0.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._14, 0.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._21, 0.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._22, 1.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._23, 0.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._24, 0.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._31, 0.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._32, 0.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._33, 1.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._34, 0.f, multiplyEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._41, 0.f, translateEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._42, 0.f, translateEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._43, 0.f, translateEps) ||
|
|
||||||
!FuzzyEqualsAdditive(aMatrix._44, 1.f, multiplyEps)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checks that within the constraints of floating point math we can invert it
|
|
||||||
// reasonably enough that multiplying by the computed inverse is close to the
|
|
||||||
// identity.
|
|
||||||
static bool CheckInvertibleWithFinitePrecision(const gfx::Matrix4x4& aMatrix) {
|
|
||||||
auto inverse = aMatrix.MaybeInverse();
|
|
||||||
if (inverse.isNothing()) {
|
|
||||||
// Should we return false?
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!CheckCloseToIdentity(aMatrix * *inverse)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!CheckCloseToIdentity(*inverse * aMatrix)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
IAPZHitTester::HitTestResult WRHitTester::GetAPZCAtPoint(
|
IAPZHitTester::HitTestResult WRHitTester::GetAPZCAtPoint(
|
||||||
const ScreenPoint& aHitTestPoint,
|
const ScreenPoint& aHitTestPoint,
|
||||||
const RecursiveMutexAutoLock& aProofOfTreeLock) {
|
const RecursiveMutexAutoLock& aProofOfTreeLock) {
|
||||||
|
@ -144,19 +96,6 @@ IAPZHitTester::HitTestResult WRHitTester::GetAPZCAtPoint(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CheckInvertibleWithFinitePrecision(
|
|
||||||
mTreeManager->GetScreenToApzcTransform(node->GetApzc())
|
|
||||||
.ToUnknownMatrix())) {
|
|
||||||
APZCTM_LOG("skipping due to check inverse accuracy\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!CheckInvertibleWithFinitePrecision(
|
|
||||||
mTreeManager->GetApzcToGeckoTransform(node->GetApzc())
|
|
||||||
.ToUnknownMatrix())) {
|
|
||||||
APZCTM_LOG("skipping due to check inverse accuracy\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
APZCTM_LOG("selecting as chosen result.\n");
|
APZCTM_LOG("selecting as chosen result.\n");
|
||||||
chosenResult = Some(result);
|
chosenResult = Some(result);
|
||||||
hit.mTargetApzc = node->GetApzc();
|
hit.mTargetApzc = node->GetApzc();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче