Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 4395828

Browse files
committed
Bug 1917715 - Don't use nsLayoutUtils::GetColor for SVG rects. r=dholbert
It's intended for text colors only (and it applies auto-darkening in printing), see nsLayoutUtils::DarkenColorIfNeeded. Differential Revision: https://phabricator.services.mozilla.com/D221556
1 parent 385383c commit 4395828

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

layout/svg/SVGGeometryFrame.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,9 @@ bool SVGGeometryFrame::CreateWebRenderCommands(
764764
float fillOpacity = SVGUtils::GetOpacity(style->mFillOpacity, contextPaint);
765765
float opacity = elemOpacity * fillOpacity;
766766

767-
auto c = nsLayoutUtils::GetColor(this, &nsStyleSVG::mFill);
768-
wr::ColorF color{
769-
((float)NS_GET_R(c)) / 255.0f, ((float)NS_GET_G(c)) / 255.0f,
770-
((float)NS_GET_B(c)) / 255.0f, ((float)NS_GET_A(c)) / 255.0f * opacity};
771-
767+
auto color = wr::ToColorF(
768+
ToDeviceColor(StyleSVG()->mFill.kind.AsColor().CalcColor(this)));
769+
color.a *= opacity;
772770
aBuilder.PushRect(wrRect, wrRect, !aItem->BackfaceIsHidden(), true, false,
773771
color);
774772
}

0 commit comments

Comments
 (0)