Bug 1493976 - Define OutOfFlowDisplayData::ComputeVisibleRectForFrame() out of line. r=kats

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2018-10-24 19:19:06 +00:00
Родитель 9405cbccaf
Коммит dc9473c8e5
2 изменённых файлов: 54 добавлений и 46 удалений

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

@ -958,6 +958,59 @@ nsDisplayListBuilder::AutoCurrentActiveScrolledRootSetter::InsertScrollFrame(
mUsed = true;
}
/* static */ nsRect
nsDisplayListBuilder::OutOfFlowDisplayData::ComputeVisibleRectForFrame(
nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,
const nsRect& aVisibleRect,
const nsRect& aDirtyRect,
nsRect* aOutDirtyRect)
{
nsRect visible = aVisibleRect;
nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect;
#ifdef MOZ_WIDGET_ANDROID
if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
aBuilder->IsPaintingToWindow()) {
// We want to ensure that fixed position elements are visible when
// being async scrolled, so we paint them at the size of the larger
// viewport.
dirtyRectRelativeToDirtyFrame =
nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());
nsIPresShell* ps = aFrame->PresShell();
if (ps->IsVisualViewportSizeSet() &&
dirtyRectRelativeToDirtyFrame.Size() <
ps->GetVisualViewportSize()) {
dirtyRectRelativeToDirtyFrame.SizeTo(ps->GetVisualViewportSize());
}
visible = dirtyRectRelativeToDirtyFrame;
}
#endif
*aOutDirtyRect = dirtyRectRelativeToDirtyFrame - aFrame->GetPosition();
visible -= aFrame->GetPosition();
nsRect overflowRect = aFrame->GetVisualOverflowRect();
if (aFrame->IsTransformed() &&
mozilla::EffectCompositor::HasAnimationsForCompositor(
aFrame, eCSSProperty_transform)) {
/**
* Add a fuzz factor to the overflow rectangle so that elements only
* just out of view are pulled into the display list, so they can be
* prerendered if necessary.
*/
overflowRect.Inflate(nsPresContext::CSSPixelsToAppUnits(32));
}
visible.IntersectRect(visible, overflowRect);
aOutDirtyRect->IntersectRect(*aOutDirtyRect, overflowRect);
return visible;
}
nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
nsDisplayListBuilderMode aMode,
bool aBuildCaret,

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

@ -1629,52 +1629,7 @@ public:
nsIFrame* aFrame,
const nsRect& aVisibleRect,
const nsRect& aDirtyRect,
nsRect* aOutDirtyRect)
{
nsRect visible = aVisibleRect;
nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect;
#ifdef MOZ_WIDGET_ANDROID
if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
aBuilder->IsPaintingToWindow()) {
// We want to ensure that fixed position elements are visible when
// being async scrolled, so we paint them at the size of the larger
// viewport.
dirtyRectRelativeToDirtyFrame =
nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());
nsIPresShell* ps = aFrame->PresShell();
if (ps->IsVisualViewportSizeSet() &&
dirtyRectRelativeToDirtyFrame.Size() <
ps->GetVisualViewportSize()) {
dirtyRectRelativeToDirtyFrame.SizeTo(ps->GetVisualViewportSize());
}
visible = dirtyRectRelativeToDirtyFrame;
}
#endif
*aOutDirtyRect = dirtyRectRelativeToDirtyFrame - aFrame->GetPosition();
visible -= aFrame->GetPosition();
nsRect overflowRect = aFrame->GetVisualOverflowRect();
if (aFrame->IsTransformed() &&
mozilla::EffectCompositor::HasAnimationsForCompositor(
aFrame, eCSSProperty_transform)) {
/**
* Add a fuzz factor to the overflow rectangle so that elements only
* just out of view are pulled into the display list, so they can be
* prerendered if necessary.
*/
overflowRect.Inflate(nsPresContext::CSSPixelsToAppUnits(32));
}
visible.IntersectRect(visible, overflowRect);
aOutDirtyRect->IntersectRect(*aOutDirtyRect, overflowRect);
return visible;
}
nsRect* aOutDirtyRect);
nsRect GetVisibleRectForFrame(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,