Bug 1194851. Split GetDisplayPort callers into GetDisplayPortRelativeToScrollPort and GetDisplayPortRelativeToScrollFrame. r=botond

Temporarily rename GetDisplayPort to GetDisplayPortRelativeToScrollPort for the duration of this patchset.

This means that every caller of GetDisplayPort is guaranteed to be touched by this patchset (assuming it compiles), and thus each call site can be checked in review to make sure it is relative to the correct coordinate system.
This commit is contained in:
Timothy Nikkel 2016-01-07 18:27:49 -06:00
Родитель a83245ddd4
Коммит 3c7c901321
5 изменённых файлов: 11 добавлений и 11 удалений

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

@ -3746,7 +3746,7 @@ ContainerState::ComputeOpaqueRect(nsDisplayItem* aItem,
if (sf) {
nsRect displayport;
bool usingDisplayport =
nsLayoutUtils::GetDisplayPort((*aAnimatedGeometryRoot)->GetContent(), &displayport);
nsLayoutUtils::GetDisplayPortRelativeToScrollFrame((*aAnimatedGeometryRoot)->GetContent(), &displayport);
if (!usingDisplayport) {
// No async scrolling, so all that matters is that the layer contents
// cover the scrollport.

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

@ -4527,7 +4527,7 @@ nsDisplaySubDocument::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRect displayport;
nsIFrame* rootScrollFrame = mFrame->PresContext()->PresShell()->GetRootScrollFrame();
MOZ_ASSERT(rootScrollFrame);
Unused << nsLayoutUtils::GetDisplayPort(rootScrollFrame->GetContent(), &displayport);
Unused << nsLayoutUtils::GetDisplayPortRelativeToScrollFrame(rootScrollFrame->GetContent(), &displayport);
nsRegion childVisibleRegion;
// The visible region for the children may be much bigger than the hole we

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

@ -1078,7 +1078,7 @@ GetDisplayPortImpl(nsIContent* aContent, nsRect *aResult, float aMultiplier)
}
bool
nsLayoutUtils::GetDisplayPort(nsIContent* aContent, nsRect *aResult)
nsLayoutUtils::GetDisplayPortRelativeToScrollPort(nsIContent* aContent, nsRect *aResult)
{
if (gfxPrefs::UseLowPrecisionBuffer()) {
return GetDisplayPortImpl(aContent, aResult, 1.0f / gfxPrefs::LowPrecisionResolution());
@ -1100,7 +1100,7 @@ bool
nsLayoutUtils::GetDisplayPortRelativeToScrollFrame(nsIContent* aContent, nsRect *aResult)
{
MOZ_ASSERT(aResult);
bool usingDisplayPort = GetDisplayPort(aContent, aResult);
bool usingDisplayPort = GetDisplayPortRelativeToScrollPort(aContent, aResult);
if (usingDisplayPort) {
TranslateFromScrollPortToScrollFrame(aContent, aResult);
}
@ -1109,7 +1109,7 @@ nsLayoutUtils::GetDisplayPortRelativeToScrollFrame(nsIContent* aContent, nsRect
bool
nsLayoutUtils::HasDisplayPort(nsIContent* aContent) {
return GetDisplayPort(aContent, nullptr);
return GetDisplayPortRelativeToScrollPort(aContent, nullptr);
}
/* static */ bool
@ -8522,7 +8522,7 @@ nsLayoutUtils::ComputeFrameMetrics(nsIFrame* aForFrame,
if (aContent) {
scrollId = nsLayoutUtils::FindOrCreateIDFor(aContent);
nsRect dp;
if (nsLayoutUtils::GetDisplayPort(aContent, &dp)) {
if (nsLayoutUtils::GetDisplayPortRelativeToScrollPort(aContent, &dp)) {
metrics.SetDisplayPort(CSSRect::FromAppUnits(dp));
nsLayoutUtils::LogTestDataForPaint(aLayer->Manager(), scrollId, "displayport",
metrics.GetDisplayPort());

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

@ -169,7 +169,7 @@ public:
* Get display port for the given element. The displayport is relative to the
* scrollport.
*/
static bool GetDisplayPort(nsIContent* aContent, nsRect *aResult);
static bool GetDisplayPortRelativeToScrollPort(nsIContent* aContent, nsRect *aResult);
/**
* Get display port for the given element relative to the scroll frame.

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

@ -2540,7 +2540,7 @@ ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange, nsIAtom* aOri
}
nsRect oldDisplayPort;
nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &oldDisplayPort);
nsLayoutUtils::GetDisplayPortRelativeToScrollPort(mOuter->GetContent(), &oldDisplayPort);
oldDisplayPort.MoveBy(-mScrolledFrame->GetPosition());
// Update frame position for scrolling
@ -2557,7 +2557,7 @@ ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange, nsIAtom* aOri
// any painting, so no need to schedule one.
nsRect displayPort;
DebugOnly<bool> usingDisplayPort =
nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &displayPort);
nsLayoutUtils::GetDisplayPortRelativeToScrollPort(mOuter->GetContent(), &displayPort);
NS_ASSERTION(usingDisplayPort, "Must have a displayport for apz scrolls!");
displayPort.MoveBy(-mScrolledFrame->GetPosition());
@ -3249,7 +3249,7 @@ ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
// displayport base.
MOZ_ASSERT(content->GetProperty(nsGkAtoms::DisplayPortBase));
nsRect displayPort;
usingDisplayPort = nsLayoutUtils::GetDisplayPort(content, &displayPort);
usingDisplayPort = nsLayoutUtils::GetDisplayPortRelativeToScrollFrame(content, &displayPort);
// Override the dirty rectangle if the displayport has been set.
if (usingDisplayPort) {
@ -3346,7 +3346,7 @@ ScrollFrameHelper::IsRectNearlyVisible(const nsRect& aRect) const
{
// Use the right rect depending on if a display port is set.
nsRect displayPort;
bool usingDisplayport = nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &displayPort);
bool usingDisplayport = nsLayoutUtils::GetDisplayPortRelativeToScrollFrame(mOuter->GetContent(), &displayPort);
return aRect.Intersects(ExpandRectToNearlyVisible(usingDisplayport ? displayPort : mScrollPort));
}