Bug 1535029 - Store the render root rect as a ScreenRect. r=dthayer

The main change here is removing some rounding so that we can do more
accurate hit-testing in APZ. Instead of rounding both the rect and the
point, we just store both as unrounded values. mRenderRootRects is also
changed to be of a Screen type as that better reflects what it's being
used for, and there is a legitimate justification for converting it from
LayoutDevice.

Depends on D25239

Differential Revision: https://phabricator.services.mozilla.com/D25240

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2019-03-28 16:46:35 +00:00
Родитель bc956607f9
Коммит 82e8cfa38b
3 изменённых файлов: 6 добавлений и 6 удалений

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

@ -3198,8 +3198,7 @@ already_AddRefed<wr::WebRenderAPI> APZCTreeManager::GetWebRenderAPIAtPoint(
CompositorBridgeParent::CallWithIndirectShadowTree(
mRootLayersId, [&](LayerTreeState& aState) -> void {
if (aState.mWrBridge) {
IntPoint point = RoundedToInt(aPoint).ToUnknownPoint();
api = aState.mWrBridge->GetWebRenderAPIAtPoint(point);
api = aState.mWrBridge->GetWebRenderAPIAtPoint(aPoint);
}
});
return api.forget();

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

@ -914,7 +914,8 @@ bool WebRenderBridgeParent::SetDisplayList(
if (IsRootWebRenderBridgeParent()) {
if (aRenderRoot != wr::RenderRoot::Default) {
MutexAutoLock lock(mRenderRootRectMutex);
mRenderRootRects[aRenderRoot] = RoundedToInt(aRect).ToUnknownRect();
mRenderRootRects[aRenderRoot] = ViewAs<ScreenPixel>(
aRect, PixelCastJustification::LayoutDeviceIsScreenForTabDims);
}
LayoutDeviceIntSize widgetSize = mWidget->GetClientSize();
LayoutDeviceIntRect rect = RoundedToInt(aRect);
@ -2019,7 +2020,7 @@ void WebRenderBridgeParent::HoldPendingTransactionId(
}
already_AddRefed<wr::WebRenderAPI>
WebRenderBridgeParent::GetWebRenderAPIAtPoint(const gfx::IntPoint& aPoint) {
WebRenderBridgeParent::GetWebRenderAPIAtPoint(const ScreenPoint& aPoint) {
MutexAutoLock lock(mRenderRootRectMutex);
for (auto renderRoot : wr::kNonDefaultRenderRoots) {
if (mRenderRootRects[renderRoot].Contains(aPoint)) {

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

@ -80,7 +80,7 @@ class WebRenderBridgeParent final
return true;
}
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPIAtPoint(
const gfx::IntPoint& aPoint);
const ScreenPoint& aPoint);
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPI(
wr::RenderRoot aRenderRoot) {
if ((size_t)aRenderRoot >= mApis.Length()) {
@ -468,7 +468,7 @@ class WebRenderBridgeParent final
// Kind of clunky, but I can't sort out a more elegant way of getting this to
// work.
Mutex mRenderRootRectMutex;
wr::NonDefaultRenderRootArray<IntRect> mRenderRootRects;
wr::NonDefaultRenderRootArray<ScreenRect> mRenderRootRects;
wr::RenderRoot mRenderRoot;
bool mPaused;