tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit a24e64c61e6b6f00e04af6e075fe737479338fc0
parent 1c231104ab5197bcd7da9b5adb5e12e545529d63
Author: Timothy Nikkel <tnikkel@gmail.com>
Date:   Mon, 20 Oct 2025 00:09:24 +0000

Bug 1995174. Fix Matrix4x4TypedFlagged::TransformAndClipBounds to clamp properly. r=gfx-reviewers,lsalzman

It clamps on the lower end of the rect only against the lower bound, and only clamps the upper end of the rect against the upper bound, but the lower end of the rect could be above the upper clip bound. This makes the output rect weird whn we encounter this.

Differential Revision: https://phabricator.services.mozilla.com/D269153

Diffstat:
Mgfx/2d/Matrix.h | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h @@ -2099,9 +2099,10 @@ class Matrix4x4TypedFlagged F min_y = std::min(std::min(std::min(p1.y, p2.y), p3.y), p4.y); F max_y = std::max(std::max(std::max(p1.y, p2.y), p3.y), p4.y); - TargetPoint topLeft(std::max(min_x, aClip.x), std::max(min_y, aClip.y)); - F width = std::min(max_x, aClip.XMost()) - topLeft.x; - F height = std::min(max_y, aClip.YMost()) - topLeft.y; + TargetPoint topLeft(std::min(std::max(min_x, aClip.x), aClip.XMost()), + std::min(std::max(min_y, aClip.y), aClip.YMost())); + F width = std::min(std::max(max_x, aClip.x), aClip.XMost()) - topLeft.x; + F height = std::min(std::max(max_y, aClip.y), aClip.YMost()) - topLeft.y; return RectTyped<TargetUnits, F>(topLeft.x, topLeft.y, width, height); }