Bug 1917715 - Rename nsLayoutUtils::GetColor. r=longsonr,dholbert
It's suitable for foreground colors only. Differential Revision: https://phabricator.services.mozilla.com/D221557
This commit is contained in:
@@ -1591,12 +1591,12 @@ class nsLayoutUtils {
|
||||
// Get a suitable foreground color for painting aColor for aFrame.
|
||||
static nscolor DarkenColorIfNeeded(nsIFrame* aFrame, nscolor aColor);
|
||||
|
||||
// Get a suitable foreground color for painting aField for aFrame.
|
||||
// Get a suitable text foreground color for painting aField for aFrame.
|
||||
// Type of aFrame is made a template parameter because nsIFrame is not
|
||||
// a complete type in the header. Type-safety is not harmed given that
|
||||
// DarkenColorIfNeeded requires an nsIFrame pointer.
|
||||
template <typename Frame, typename T, typename S>
|
||||
static nscolor GetColor(Frame* aFrame, T S::*aField) {
|
||||
static nscolor GetTextColor(Frame* aFrame, T S::*aField) {
|
||||
nscolor color = aFrame->GetVisitedDependentColor(aField);
|
||||
return DarkenColorIfNeeded(aFrame, color);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ static void PaintTextShadowCallback(gfxContext* aCtx, nsPoint aShadowOffset,
|
||||
void nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) {
|
||||
nscolor foregroundColor =
|
||||
nsLayoutUtils::GetColor(mFrame, &nsStyleText::mWebkitTextFillColor);
|
||||
nsLayoutUtils::GetTextColor(mFrame, &nsStyleText::mWebkitTextFillColor);
|
||||
|
||||
// Paint the text-shadows for the overflow marker
|
||||
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, mRect,
|
||||
|
||||
@@ -2618,7 +2618,7 @@ void nsIFrame::DisplayCaret(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
nscolor nsIFrame::GetCaretColorAt(int32_t aOffset) {
|
||||
return nsLayoutUtils::GetColor(this, &nsStyleUI::mCaretColor);
|
||||
return nsLayoutUtils::GetTextColor(this, &nsStyleUI::mCaretColor);
|
||||
}
|
||||
|
||||
auto nsIFrame::ComputeShouldPaintBackground() const -> ShouldPaintBackground {
|
||||
|
||||
@@ -4883,8 +4883,8 @@ void nsTextFrame::GetTextDecorations(
|
||||
// This handles the <a href="blah.html"><font color="green">La
|
||||
// la la</font></a> case. The link underline should be green.
|
||||
useOverride = true;
|
||||
overrideColor =
|
||||
nsLayoutUtils::GetColor(f, &nsStyleTextReset::mTextDecorationColor);
|
||||
overrideColor = nsLayoutUtils::GetTextColor(
|
||||
f, &nsStyleTextReset::mTextDecorationColor);
|
||||
}
|
||||
|
||||
nsBlockFrame* fBlock = do_QueryFrame(f);
|
||||
@@ -4938,11 +4938,11 @@ void nsTextFrame::GetTextDecorations(
|
||||
// for SVG text, and have e.g. text-decoration-color:red to
|
||||
// override the fill paint of the decoration.
|
||||
color = aColorResolution == eResolvedColors
|
||||
? nsLayoutUtils::GetColor(f, &nsStyleSVG::mFill)
|
||||
? nsLayoutUtils::GetTextColor(f, &nsStyleSVG::mFill)
|
||||
: NS_SAME_AS_FOREGROUND_COLOR;
|
||||
} else {
|
||||
color =
|
||||
nsLayoutUtils::GetColor(f, &nsStyleTextReset::mTextDecorationColor);
|
||||
color = nsLayoutUtils::GetTextColor(
|
||||
f, &nsStyleTextReset::mTextDecorationColor);
|
||||
}
|
||||
|
||||
bool swapUnderlineAndOverline =
|
||||
@@ -6538,7 +6538,7 @@ void nsTextFrame::DrawEmphasisMarks(gfxContext* aContext, WritingMode aWM,
|
||||
nscolor color =
|
||||
aDecorationOverrideColor
|
||||
? *aDecorationOverrideColor
|
||||
: nsLayoutUtils::GetColor(this, &nsStyleText::mTextEmphasisColor);
|
||||
: nsLayoutUtils::GetTextColor(this, &nsStyleText::mTextEmphasisColor);
|
||||
aContext->SetColor(sRGBColor::FromABGR(color));
|
||||
gfx::Point pt;
|
||||
if (!isTextCombined) {
|
||||
|
||||
@@ -96,14 +96,15 @@ nscolor nsTextPaintStyle::GetTextColor() {
|
||||
case StyleSVGPaintKind::Tag::None:
|
||||
return NS_RGBA(0, 0, 0, 0);
|
||||
case StyleSVGPaintKind::Tag::Color:
|
||||
return nsLayoutUtils::GetColor(mFrame, &nsStyleSVG::mFill);
|
||||
return nsLayoutUtils::GetTextColor(mFrame, &nsStyleSVG::mFill);
|
||||
default:
|
||||
NS_ERROR("cannot resolve SVG paint to nscolor");
|
||||
return NS_RGBA(0, 0, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
return nsLayoutUtils::GetColor(mFrame, &nsStyleText::mWebkitTextFillColor);
|
||||
return nsLayoutUtils::GetTextColor(mFrame,
|
||||
&nsStyleText::mWebkitTextFillColor);
|
||||
}
|
||||
|
||||
bool nsTextPaintStyle::GetSelectionColors(nscolor* aForeColor,
|
||||
|
||||
@@ -839,7 +839,7 @@ void Theme::PaintMenulistArrow(nsIFrame* aFrame, DrawTarget& aDrawTarget,
|
||||
}();
|
||||
|
||||
const auto arrowColor = sRGBColor::FromABGR(
|
||||
nsLayoutUtils::GetColor(aFrame, &nsStyleText::mWebkitTextFillColor));
|
||||
nsLayoutUtils::GetTextColor(aFrame, &nsStyleText::mWebkitTextFillColor));
|
||||
ThemeDrawing::PaintArrow(aDrawTarget, aRect, xs, ys, kPolygonSize,
|
||||
ArrayLength(polygonX), arrowColor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user