Bug 1261578 - Part 3. Correct MathML text color;
MozReview-Commit-ID: HqQX88Ja6ug
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -2119,17 +2119,18 @@ nsMathMLChar::PaintForeground(nsPresCont
// normal drawing if there is nothing special about this char
// Set default context to the parent context
styleContext = parentContext;
}
RefPtr<gfxContext> thebesContext = aRenderingContext.ThebesContext();
// Set color ...
- nscolor fgColor = styleContext->GetVisitedDependentColor(eCSSProperty_color);
+ nsCSSProperty colorProp = styleContext->GetTextFillColorProp();
+ nscolor fgColor = styleContext->GetVisitedDependentColor(colorProp);
if (aIsSelected) {
// get color to use for selection from the look&feel object
fgColor = LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground,
fgColor);
}
thebesContext->SetColor(Color::FromABGR(fgColor));
thebesContext->Save();
nsRect r = mRect + aPt;
--- a/layout/mathml/nsMathMLFrame.cpp
+++ b/layout/mathml/nsMathMLFrame.cpp
@@ -360,18 +360,19 @@ void nsDisplayMathMLBar::Paint(nsDisplay
nsRenderingContext* aCtx)
{
// paint the bar with the current text color
DrawTarget* drawTarget = aCtx->GetDrawTarget();
Rect rect =
NSRectToNonEmptySnappedRect(mRect + ToReferenceFrame(),
mFrame->PresContext()->AppUnitsPerDevPixel(),
*drawTarget);
+ nsCSSProperty colorProp = mFrame->StyleContext()->GetTextFillColorProp();
ColorPattern color(ToDeviceColor(
- mFrame->GetVisitedDependentColor(eCSSProperty_color)));
+ mFrame->GetVisitedDependentColor(colorProp)));
drawTarget->FillRect(rect, color);
}
void
nsMathMLFrame::DisplayBar(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, const nsRect& aRect,
const nsDisplayListSet& aLists) {
if (!aFrame->StyleVisibility()->IsVisible() || aRect.IsEmpty())
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -774,18 +774,19 @@ void nsDisplayNotation::Paint(nsDisplayL
nsPresContext* presContext = mFrame->PresContext();
Float strokeWidth = presContext->AppUnitsToGfxUnits(mThickness);
Rect rect = NSRectToRect(mRect + ToReferenceFrame(),
presContext->AppUnitsPerDevPixel());
rect.Deflate(strokeWidth / 2.f);
+ nsCSSProperty colorProp = mFrame->StyleContext()->GetTextFillColorProp();
ColorPattern color(ToDeviceColor(
- mFrame->GetVisitedDependentColor(eCSSProperty_color)));
+ mFrame->GetVisitedDependentColor(colorProp)));
StrokeOptions strokeOptions(strokeWidth);
switch(mType)
{
case NOTATION_CIRCLE: {
RefPtr<Path> ellipse =
MakePathForEllipse(aDrawTarget, rect.Center(), rect.Size());
--- a/layout/mathml/nsMathMLmfracFrame.cpp
+++ b/layout/mathml/nsMathMLmfracFrame.cpp
@@ -624,18 +624,19 @@ void nsDisplayMathMLSlash::Paint(nsDispl
{
DrawTarget& aDrawTarget = *aCtx->GetDrawTarget();
// get the gfxRect
nsPresContext* presContext = mFrame->PresContext();
Rect rect = NSRectToRect(mRect + ToReferenceFrame(),
presContext->AppUnitsPerDevPixel());
+ nsCSSProperty colorProp = mFrame->StyleContext()->GetTextFillColorProp();
ColorPattern color(ToDeviceColor(
- mFrame->GetVisitedDependentColor(eCSSProperty_color)));
+ mFrame->GetVisitedDependentColor(colorProp)));
// draw the slash as a parallelogram
Point delta = Point(presContext->AppUnitsToGfxUnits(mThickness), 0);
RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder();
if (mRTL) {
builder->MoveTo(rect.TopLeft());
builder->LineTo(rect.TopLeft() + delta);
builder->LineTo(rect.BottomRight());