Fix CSS border rounding and currentcolor clipping

This commit is contained in:
Basilisk-Dev 2026-05-09 14:27:59 -04:00 • committed by wuggy
commit 84b9b77335
10 changed files with 147 additions and 21 deletions

View file

@ -3312,6 +3312,66 @@ nsComputedDOMStyle::DoGetBorderRightWidth()
return GetBorderWidthFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderWidth()
{
nscoord widths[4];
if (mInnerFrame) {
AssertFlushedPendingReflows();
const nsMargin& usedBorder = mInnerFrame->GetUsedBorder();
NS_FOR_CSS_SIDES(side) {
widths[side] = usedBorder.Side(side);
}
} else {
const nsStyleBorder* border = StyleBorder();
NS_FOR_CSS_SIDES(side) {
widths[side] = border->GetComputedBorderWidth(side);
}
}
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
RefPtr<nsROCSSPrimitiveValue> top = new nsROCSSPrimitiveValue;
top->SetAppUnits(widths[eSideTop]);
valueList->AppendCSSValue(top.forget());
if (widths[eSideRight] == widths[eSideLeft]) {
if (widths[eSideTop] == widths[eSideBottom]) {
if (widths[eSideTop] == widths[eSideRight]) {
return valueList.forget();
}
RefPtr<nsROCSSPrimitiveValue> right = new nsROCSSPrimitiveValue;
right->SetAppUnits(widths[eSideRight]);
valueList->AppendCSSValue(right.forget());
return valueList.forget();
}
RefPtr<nsROCSSPrimitiveValue> right = new nsROCSSPrimitiveValue;
right->SetAppUnits(widths[eSideRight]);
valueList->AppendCSSValue(right.forget());
RefPtr<nsROCSSPrimitiveValue> bottom = new nsROCSSPrimitiveValue;
bottom->SetAppUnits(widths[eSideBottom]);
valueList->AppendCSSValue(bottom.forget());
return valueList.forget();
}
RefPtr<nsROCSSPrimitiveValue> right = new nsROCSSPrimitiveValue;
right->SetAppUnits(widths[eSideRight]);
valueList->AppendCSSValue(right.forget());
RefPtr<nsROCSSPrimitiveValue> bottom = new nsROCSSPrimitiveValue;
bottom->SetAppUnits(widths[eSideBottom]);
valueList->AppendCSSValue(bottom.forget());
RefPtr<nsROCSSPrimitiveValue> left = new nsROCSSPrimitiveValue;
left->SetAppUnits(widths[eSideLeft]);
valueList->AppendCSSValue(left.forget());
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderTopColor()
{
@ -6960,4 +7020,5 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetOverflowBlockEnd()
{
return DoGetOverflowBlock();
}
}