mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 831237 - Reduce APZC buffer churn; r=BenWa
Prevents the display port from getting smaller as the visible region approaches the edges of the scrollable rect.
This commit is contained in:
parent
bf4fc9d9a6
commit
b7c0e66763
@ -418,6 +418,22 @@ struct BaseRect {
|
||||
std::max(y, std::min(YMost(), aPoint.y)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamp aRect to this rectangle. This returns aRect after it is forced
|
||||
* inside the bounds of this rectangle. It will attempt to retain the size
|
||||
* but will shrink the dimensions that don't fit.
|
||||
*/
|
||||
Sub ClampRect(const Sub& aRect) const
|
||||
{
|
||||
Sub rect(std::max(aRect.x, x),
|
||||
std::max(aRect.y, y),
|
||||
std::min(aRect.width, width),
|
||||
std::min(aRect.height, height));
|
||||
rect.x = std::min(rect.XMost(), XMost()) - rect.width;
|
||||
rect.y = std::min(rect.YMost(), YMost()) - rect.height;
|
||||
return rect;
|
||||
}
|
||||
|
||||
private:
|
||||
// Do not use the default operator== or operator!= !
|
||||
// Use IsEqualEdges or IsEqualInterior explicitly.
|
||||
|
@ -987,7 +987,7 @@ const gfx::Rect AsyncPanZoomController::CalculatePendingDisplayPort(
|
||||
|
||||
gfx::Rect shiftedDisplayPort = displayPort;
|
||||
shiftedDisplayPort.MoveBy(scrollOffset.x, scrollOffset.y);
|
||||
displayPort = shiftedDisplayPort.Intersect(scrollableRect);
|
||||
displayPort = scrollableRect.ClampRect(shiftedDisplayPort);
|
||||
displayPort.MoveBy(-scrollOffset.x, -scrollOffset.y);
|
||||
|
||||
return displayPort;
|
||||
|
Loading…
Reference in New Issue
Block a user