Merge pull request 'Clamp border-radius value to Int32.MaxValue' (#3112) from border-radius-clamp into master

Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/3112
This commit is contained in:
Moonchild committed 2026-05-30 08:42:57 +00:00
commit 7b4aaca975
1 file changed
+6 -2
+6 -2
View File
@@ -8610,14 +8610,18 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
{
const nsCSSPropertyID* subprops =
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius);
const float RADIUS_MAX = 17895697; // CSS length clamp value
NS_FOR_CSS_FULL_CORNERS(corner) {
int cx = FullToHalfCorner(corner, false);
int cy = FullToHalfCorner(corner, true);
const nsCSSValue& radius = *aRuleData->ValueFor(subprops[corner]);
nsCSSValue radius = *aRuleData->ValueFor(subprops[corner]);
nsStyleCoord parentX = parentBorder->mBorderRadius.Get(cx);
nsStyleCoord parentY = parentBorder->mBorderRadius.Get(cy);
nsStyleCoord coordX, coordY;
// Clamp border radius to the max value so it will not wrap and cause artifacts.
if (radius.GetFloatValue() > RADIUS_MAX) {
radius.SetFloatValue(RADIUS_MAX, eCSSUnit_Number);
}
if (SetPairCoords(radius, coordX, coordY, parentX, parentY,
SETCOORD_LPH | SETCOORD_INITIAL_ZERO |
SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL,