Bug 951463 - Rename ClampRect to ForceInside; r=botond

This commit is contained in:
Anthony Jones 2014-01-06 10:05:07 -05:00
parent e1cec36a10
commit 3b3605ff77
3 changed files with 8 additions and 9 deletions

View File

@ -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;
}

View File

@ -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() {

View File

@ -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;
}
}