Bug 1697325 Part 5 - Add GetOverflowAreasRelativeToParent(), and simplify all the call sites. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D107740
This commit is contained in:
Ting-Yu Lin 2021-03-10 05:59:49 +00:00
Родитель 9cb2451f17
Коммит e1b891089b
5 изменённых файлов: 15 добавлений и 7 удалений

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

@ -561,9 +561,7 @@ void nsLayoutUtils::UnionChildOverflow(nsIFrame* aFrame,
continue;
}
for (nsIFrame* child : list) {
OverflowAreas childOverflow =
child->GetOverflowAreas() + child->GetPosition();
aOverflowAreas.UnionWith(childOverflow);
aOverflowAreas.UnionWith(child->GetOverflowAreasRelativeToParent());
}
}
}

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

@ -865,8 +865,7 @@ bool BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat) {
// Update the float combined area state
// XXX Floats should really just get invalidated here if necessary
mFloatOverflowAreas.UnionWith(aFloat->GetOverflowAreas() +
aFloat->GetPosition());
mFloatOverflowAreas.UnionWith(aFloat->GetOverflowAreasRelativeToParent());
// Place the float in the float manager
// calculate region

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

@ -2810,8 +2810,7 @@ void nsContainerFrame::ConsiderChildOverflow(OverflowAreas& aOverflowAreas,
OverflowAreas combined = OverflowAreas(childVisual, nsRect());
aOverflowAreas.UnionWith(combined + aChildFrame->GetPosition());
} else {
aOverflowAreas.UnionWith(aChildFrame->GetOverflowAreas() +
aChildFrame->GetPosition());
aOverflowAreas.UnionWith(aChildFrame->GetOverflowAreasRelativeToParent());
}
}

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

@ -7458,6 +7458,10 @@ OverflowAreas nsIFrame::GetOverflowAreasRelativeToSelf() const {
return OverflowAreas(InkOverflowRect(), ScrollableOverflowRect());
}
OverflowAreas nsIFrame::GetOverflowAreasRelativeToParent() const {
return GetOverflowAreas() + mRect.TopLeft();
}
nsRect nsIFrame::ScrollableOverflowRectRelativeToParent() const {
return ScrollableOverflowRect() + mRect.TopLeft();
}

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

@ -3622,6 +3622,14 @@ class nsIFrame : public nsQueryFrame {
*/
mozilla::OverflowAreas GetOverflowAreasRelativeToSelf() const;
/**
* Same as GetOverflowAreas, except relative to the parent frame.
*
* @return the overflow area relative to the parent frame, in the parent
* frame's coordinate system
*/
mozilla::OverflowAreas GetOverflowAreasRelativeToParent() const;
/**
* Same as ScrollableOverflowRect, except relative to the parent
* frame.