Issue #1925 - Convert NS_FULL_TO_HALF_CORNER to a constexpr function.

Note: Because the new function checks types, we need to change the
fullCorner type in `nsComputedDOMStyle::GetEllipseRadii()` and
`StyleAnimationValue::ExtractComputedValue()` to `Corner` instead of the
underlying base type.
This commit is contained in:
Moonchild 2024-08-02 10:15:50 +02:00 committed by roytam1
commit 8a2bc8ef4d
7 changed files with 28 additions and 25 deletions

View file

@ -7874,8 +7874,8 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
const nsCSSPropertyID* subprops =
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius);
NS_FOR_CSS_FULL_CORNERS(corner) {
int cx = NS_FULL_TO_HALF_CORNER(corner, false);
int cy = NS_FULL_TO_HALF_CORNER(corner, true);
int cx = FullToHalfCorner(corner, false);
int cy = FullToHalfCorner(corner, true);
const nsCSSValue& radius = *aRuleData->ValueFor(subprops[corner]);
nsStyleCoord parentX = parentBorder->mBorderRadius.Get(cx);
nsStyleCoord parentY = parentBorder->mBorderRadius.Get(cy);
@ -8066,8 +8066,8 @@ nsRuleNode::ComputeOutlineData(void* aStartStruct,
const nsCSSPropertyID* subprops =
nsCSSProps::SubpropertyEntryFor(eCSSProperty__moz_outline_radius);
NS_FOR_CSS_FULL_CORNERS(corner) {
int cx = NS_FULL_TO_HALF_CORNER(corner, false);
int cy = NS_FULL_TO_HALF_CORNER(corner, true);
int cx = FullToHalfCorner(corner, false);
int cy = FullToHalfCorner(corner, true);
const nsCSSValue& radius = *aRuleData->ValueFor(subprops[corner]);
nsStyleCoord parentX = parentOutline->mOutlineRadius.Get(cx);
nsStyleCoord parentY = parentOutline->mOutlineRadius.Get(cy);
@ -9915,8 +9915,8 @@ GetStyleBasicShapeFromCSSValue(const nsCSSValue& aValue,
if (shapeFunction->Item(5).GetUnit() == eCSSUnit_Array) {
nsCSSValue::Array* radiiArray = shapeFunction->Item(5).GetArrayValue();
NS_FOR_CSS_FULL_CORNERS(corner) {
int cx = NS_FULL_TO_HALF_CORNER(corner, false);
int cy = NS_FULL_TO_HALF_CORNER(corner, true);
int cx = FullToHalfCorner(corner, false);
int cy = FullToHalfCorner(corner, true);
const nsCSSValue& radius = radiiArray->Item(corner);
nsStyleCoord coordX, coordY;
DebugOnly<bool> didSetRadii = SetPairCoords(radius, coordX, coordY,