mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 951463 - Rename ClampRect to ForceInside; r=botond
This commit is contained in:
parent
d7d0f83bb0
commit
ee3c6259c8
@ -441,18 +441,18 @@ struct BaseRect {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Clamp this rectangle to be inside aRect. The function returns a copy of
|
||||
* this rect after it is forced inside the bounds of aRect. It will attempt to
|
||||
* retain the size but will shrink the dimensions that don't fit.
|
||||
*/
|
||||
Sub ClampRect(const Sub& aRect) const
|
||||
Sub ForceInside(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;
|
||||
rect.x = std::min(rect.XMost(), aRect.XMost()) - rect.width;
|
||||
rect.y = std::min(rect.YMost(), aRect.YMost()) - rect.height;
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
@ -1257,8 +1257,7 @@ const CSSRect AsyncPanZoomController::CalculatePendingDisplayPort(
|
||||
scrollOffset.y = scrollableRect.y;
|
||||
}
|
||||
|
||||
CSSRect shiftedDisplayPort = displayPort + scrollOffset;
|
||||
return scrollableRect.ClampRect(shiftedDisplayPort) - scrollOffset;
|
||||
return displayPort.ForceInside(scrollableRect - scrollOffset);
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::ScheduleComposite() {
|
||||
|
@ -716,7 +716,7 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
||||
ScreenIntRect screenBounds = ScreenIntRect::FromUnknownRect(mozilla::gfx::IntRect(
|
||||
bounds.x, bounds.y, bounds.width, bounds.height));
|
||||
AdjustForScrollBars(screenBounds, scrollableFrame);
|
||||
metrics.mCompositionBounds = screenBounds.ClampRect(metrics.mCompositionBounds);
|
||||
metrics.mCompositionBounds = metrics.mCompositionBounds.ForceInside(screenBounds);
|
||||
useWidgetBounds = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user