Bug 1929262 - Use std::clamp instead of min/max chain in widget/nsBaseWidget.h r=m_kato

Differential Revision: https://phabricator.services.mozilla.com/D227974
This commit is contained in:
serge-sans-paille 2024-11-06 10:14:24 +00:00
parent 99b89d001a
commit c72bd3a22d

View File

@ -570,9 +570,8 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
*/
void ConstrainSize(int32_t* aWidth, int32_t* aHeight) override {
SizeConstraints c = GetSizeConstraints();
*aWidth = std::max(c.mMinSize.width, std::min(c.mMaxSize.width, *aWidth));
*aHeight =
std::max(c.mMinSize.height, std::min(c.mMaxSize.height, *aHeight));
*aWidth = std::clamp(*aWidth, c.mMinSize.width, c.mMaxSize.width);
*aHeight = std::clamp(*aHeight, c.mMinSize.height, c.mMaxSize.height);
}
CompositorBridgeChild* GetRemoteRenderer() override;