Bug 1548247 - Correct and limit scroll update renderroot usage r=kats

There's two things going on here. 1) nsGfxScrollFrame is getting the
wrong renderroot, because it's not correctly recursing up the frame
tree. 2) Hiding behind that problem is that if we do correctly assign
the renderroot, we end up blocking on both render roots updating if
we don't, say, have a horizontal scroll option, because that leaves
us with a wr::RenderRoot::Default. 2.1) We then still end up blocking
on the default renderroot because we initialize the selector with
WebRenderBridgeParent's mRenderRoot.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Doug Thayer 2019-06-18 22:02:57 +00:00
Родитель 532d1f55c1
Коммит 5a066b03f1
5 изменённых файлов: 26 добавлений и 19 удалений

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

@ -157,12 +157,18 @@ void APZUpdater::UpdateFocusState(LayersId aRootLayerTreeId,
WRRootId aOriginatingWrRootId,
const FocusTarget& aFocusTarget) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
UpdaterQueueSelector selector(aOriginatingWrRootId);
UpdaterQueueSelector selector(aOriginatingWrRootId.mLayersId);
if (aFocusTarget.mData.is<FocusTarget::ScrollTargets>()) {
const FocusTarget::ScrollTargets& targets =
aFocusTarget.mData.as<FocusTarget::ScrollTargets>();
selector.mRenderRoots += targets.mHorizontalRenderRoot;
selector.mRenderRoots += targets.mVerticalRenderRoot;
if (targets.mHorizontalRenderRoot) {
selector.mRenderRoots += *targets.mHorizontalRenderRoot;
}
if (targets.mVerticalRenderRoot) {
selector.mRenderRoots += *targets.mVerticalRenderRoot;
}
} else {
selector.mRenderRoots += aOriginatingWrRootId.mRenderRoot;
}
RunOnUpdaterThread(selector,
NewRunnableMethod<LayersId, LayersId, FocusTarget>(

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

@ -207,17 +207,19 @@ FocusTarget::FocusTarget(PresShell* aRootPresShell,
target.mHorizontal = nsLayoutUtils::FindIDForScrollableFrame(horizontal);
target.mVertical = nsLayoutUtils::FindIDForScrollableFrame(vertical);
if (XRE_IsContentProcess()) {
target.mHorizontalRenderRoot = gfxUtils::GetContentRenderRoot();
target.mVerticalRenderRoot = gfxUtils::GetContentRenderRoot();
target.mHorizontalRenderRoot = Some(gfxUtils::GetContentRenderRoot());
target.mVerticalRenderRoot = Some(gfxUtils::GetContentRenderRoot());
} else {
target.mHorizontalRenderRoot =
horizontal ? gfxUtils::RecursivelyGetRenderRootForFrame(
horizontal->GetScrolledFrame())
: wr::RenderRoot::Default;
target.mVerticalRenderRoot =
vertical ? gfxUtils::RecursivelyGetRenderRootForFrame(
vertical->GetScrolledFrame())
: wr::RenderRoot::Default;
if (horizontal) {
auto renderRoot = gfxUtils::RecursivelyGetRenderRootForFrame(
horizontal->GetScrolledFrame());
target.mHorizontalRenderRoot = Some(renderRoot);
}
if (vertical) {
auto renderRoot = gfxUtils::RecursivelyGetRenderRootForFrame(
vertical->GetScrolledFrame());
target.mVerticalRenderRoot = Some(renderRoot);
}
}
mData = AsVariant(target);

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

@ -13,6 +13,7 @@
#include "mozilla/layers/ScrollableLayerGuid.h" // for ViewID
#include "mozilla/webrender/WebRenderTypes.h" // for RenderRoot
#include "mozilla/Variant.h" // for Variant
#include "mozilla/Maybe.h" // for Maybe
namespace mozilla {
@ -30,9 +31,9 @@ class FocusTarget final {
public:
struct ScrollTargets {
ScrollableLayerGuid::ViewID mHorizontal;
wr::RenderRoot mHorizontalRenderRoot;
Maybe<wr::RenderRoot> mHorizontalRenderRoot;
ScrollableLayerGuid::ViewID mVertical;
wr::RenderRoot mVerticalRenderRoot;
Maybe<wr::RenderRoot> mVerticalRenderRoot;
bool operator==(const ScrollTargets& aRhs) const {
bool ret =

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

@ -1511,7 +1511,7 @@ wr::RenderRoot gfxUtils::RecursivelyGetRenderRootForFrame(
}
for (const nsIFrame* current = aFrame; current;
current = current->GetParent()) {
current = nsLayoutUtils::GetCrossDocParentFrame(current)) {
auto renderRoot = gfxUtils::GetRenderRootForFrame(current);
if (renderRoot) {
return *renderRoot;

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

@ -2856,9 +2856,7 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
// might still get squashed into a full transaction if something
// happens to trigger one.
wr::RenderRoot renderRoot = wr::RenderRoot::Default;
if (XRE_IsContentProcess()) {
renderRoot = gfxUtils::GetContentRenderRoot();
} else {
if (XRE_IsParentProcess()) {
renderRoot = gfxUtils::RecursivelyGetRenderRootForFrame(mOuter);
}
success = manager->SetPendingScrollUpdateForNextTransaction(