PR #2643 - The border-radius Directive Should Apply to Outlines

However, `-moz-outline-radius` should still override any `border-radius`.
This is primarily done for backward compatibility with some themes.
Additionally, it also allows for more advanced outline control than the CSS spec provides, without breaking spec.
Finally, if the spec is ever updated to include `outline-radius`, we'll be ready to drop the `-moz-` prefix!

Note: BZ 315209 has an inadvertent double-negative in nsDisplayList.cpp:
HasRadius() essentially returns the opposite value it should.
This commit is contained in:
Andy 2024-10-09 12:08:46 -07:00 committed by roytam1
commit cee682b980
4 changed files with 48 additions and 33 deletions

View file

@ -3757,18 +3757,23 @@ nsDisplayOutline::Paint(nsDisplayListBuilder* aBuilder,
mFrame->StyleContext());
}
bool nsDisplayOutline::HasRadius() const {
if (nsLayoutUtils::HasNonZeroCorner(mFrame->StyleOutline()->mOutlineRadius)) {
return true;
}
return nsLayoutUtils::HasNonZeroCorner(mFrame->StyleBorder()->mBorderRadius);
}
bool
nsDisplayOutline::IsInvisibleInRect(const nsRect& aRect)
{
const nsStyleOutline* outline = mFrame->StyleOutline();
nsRect borderBox(ToReferenceFrame(), mFrame->GetSize());
if (borderBox.Contains(aRect) &&
!nsLayoutUtils::HasNonZeroCorner(outline->mOutlineRadius)) {
if (outline->mOutlineOffset >= 0) {
// aRect is entirely inside the border-rect, and the outline isn't
// rendered inside the border-rect, so the outline is not visible.
return true;
}
if (borderBox.Contains(aRect) && !HasRadius() &&
outline->mOutlineOffset >= 0) {
// aRect is entirely inside the border-rect, and the outline isn't
// rendered inside the border-rect, so the outline is not visible.
return true;
}
return false;