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, WRRootId aOriginatingWrRootId,
const FocusTarget& aFocusTarget) { const FocusTarget& aFocusTarget) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread()); MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
UpdaterQueueSelector selector(aOriginatingWrRootId); UpdaterQueueSelector selector(aOriginatingWrRootId.mLayersId);
if (aFocusTarget.mData.is<FocusTarget::ScrollTargets>()) { if (aFocusTarget.mData.is<FocusTarget::ScrollTargets>()) {
const FocusTarget::ScrollTargets& targets = const FocusTarget::ScrollTargets& targets =
aFocusTarget.mData.as<FocusTarget::ScrollTargets>(); aFocusTarget.mData.as<FocusTarget::ScrollTargets>();
selector.mRenderRoots += targets.mHorizontalRenderRoot; if (targets.mHorizontalRenderRoot) {
selector.mRenderRoots += targets.mVerticalRenderRoot; selector.mRenderRoots += *targets.mHorizontalRenderRoot;
}
if (targets.mVerticalRenderRoot) {
selector.mRenderRoots += *targets.mVerticalRenderRoot;
}
} else {
selector.mRenderRoots += aOriginatingWrRootId.mRenderRoot;
} }
RunOnUpdaterThread(selector, RunOnUpdaterThread(selector,
NewRunnableMethod<LayersId, LayersId, FocusTarget>( NewRunnableMethod<LayersId, LayersId, FocusTarget>(

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

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

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

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

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

@ -1511,7 +1511,7 @@ wr::RenderRoot gfxUtils::RecursivelyGetRenderRootForFrame(
} }
for (const nsIFrame* current = aFrame; current; for (const nsIFrame* current = aFrame; current;
current = current->GetParent()) { current = nsLayoutUtils::GetCrossDocParentFrame(current)) {
auto renderRoot = gfxUtils::GetRenderRootForFrame(current); auto renderRoot = gfxUtils::GetRenderRootForFrame(current);
if (renderRoot) { if (renderRoot) {
return *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 // might still get squashed into a full transaction if something
// happens to trigger one. // happens to trigger one.
wr::RenderRoot renderRoot = wr::RenderRoot::Default; wr::RenderRoot renderRoot = wr::RenderRoot::Default;
if (XRE_IsContentProcess()) { if (XRE_IsParentProcess()) {
renderRoot = gfxUtils::GetContentRenderRoot();
} else {
renderRoot = gfxUtils::RecursivelyGetRenderRootForFrame(mOuter); renderRoot = gfxUtils::RecursivelyGetRenderRootForFrame(mOuter);
} }
success = manager->SetPendingScrollUpdateForNextTransaction( success = manager->SetPendingScrollUpdateForNextTransaction(