Bug 1135913, part 3 - Unify SVGTextFrame's NotifyBeforeDecorationLine and NotifyDecorationLinePathEmitted callbacks. r=heycam

This commit is contained in:
Jonathan Watt 2015-02-03 20:00:18 +00:00
Родитель deaaf27b4e
Коммит 9dd15de828
3 изменённых файлов: 17 добавлений и 26 удалений

Просмотреть файл

@ -5233,10 +5233,7 @@ PaintDecorationLine(nsIFrame* aFrame,
ToPoint(aPt), ToSize(aLineSize), aAscent, aOffset, aDecoration, aStyle,
aVertical, aDescentLimit);
if (aDecorationType == eNormalDecoration) {
aCallbacks->NotifyBeforeDecorationLine(lineColor);
aCtx->NewPath();
aCtx->Rectangle(ThebesRect(path));
aCallbacks->NotifyDecorationLinePathEmitted();
aCallbacks->PaintDecorationLine(path, lineColor);
} else {
aCallbacks->NotifyBeforeSelectionDecorationLine(lineColor);
aCtx->NewPath();

Просмотреть файл

@ -305,12 +305,12 @@ public:
* Callbacks are invoked in the following order:
*
* (NotifySelectionBackgroundNeedsFill)?
* (NotifyBeforeDecorationLine NotifyDecorationLinePathEmitted)*
* PaintDecorationLine*
* NotifyBeforeText
* (NotifyGlyphPathEmitted |
* (NotifyBeforeSVGGlyphPainted NotifyAfterSVGGlyphPainted))*
* NotifyAfterText
* (NotifyBeforeDecorationLine NotifyDecorationLinePathEmitted)*
* PaintDecorationLine*
* (NotifyBeforeSelectionDecorationLine NotifySelectionDecorationLinePathEmitted)*
*
* The color of each part of the frame's text rendering is passed as an argument
@ -337,6 +337,12 @@ public:
nscolor aColor,
DrawTarget& aDrawTarget) { }
/**
* Called before (for under/over-line) or after (for line-through) the text
* is drawn to have a text decoration line drawn.
*/
virtual void PaintDecorationLine(Rect aPath, nscolor aColor) { }
/**
* Called just before any paths have been emitted to the gfxContext
* for the glyphs of the frame's text.
@ -349,18 +355,6 @@ public:
*/
virtual void NotifyAfterText() { }
/**
* Called just before a path corresponding to a text decoration line
* has been emitted to the gfxContext.
*/
virtual void NotifyBeforeDecorationLine(nscolor aColor) { }
/**
* Called just after a path corresponding to a text decoration line
* has been emitted to the gfxContext.
*/
virtual void NotifyDecorationLinePathEmitted() { }
/**
* Called just before a path corresponding to a selection decoration line
* has been emitted to the gfxContext.

Просмотреть файл

@ -2722,13 +2722,12 @@ public:
void NotifySelectionBackgroundNeedsFill(const Rect& aBackgroundRect,
nscolor aColor,
DrawTarget& aDrawTarget) MOZ_OVERRIDE;
void PaintDecorationLine(Rect aPath, nscolor aColor) MOZ_OVERRIDE;
void NotifyBeforeText(nscolor aColor) MOZ_OVERRIDE;
void NotifyGlyphPathEmitted() MOZ_OVERRIDE;
void NotifyBeforeSVGGlyphPainted() MOZ_OVERRIDE;
void NotifyAfterSVGGlyphPainted() MOZ_OVERRIDE;
void NotifyAfterText() MOZ_OVERRIDE;
void NotifyBeforeDecorationLine(nscolor aColor) MOZ_OVERRIDE;
void NotifyDecorationLinePathEmitted() MOZ_OVERRIDE;
void NotifyBeforeSelectionDecorationLine(nscolor aColor) MOZ_OVERRIDE;
void NotifySelectionDecorationLinePathEmitted() MOZ_OVERRIDE;
@ -2838,15 +2837,16 @@ SVGTextDrawPathCallbacks::NotifyAfterText()
}
void
SVGTextDrawPathCallbacks::NotifyBeforeDecorationLine(nscolor aColor)
SVGTextDrawPathCallbacks::PaintDecorationLine(Rect aPath, nscolor aColor)
{
mColor = aColor;
SetupContext();
}
AntialiasMode aaMode =
nsSVGUtils::ToAntialiasMode(mFrame->StyleSVG()->mTextRendering);
void
SVGTextDrawPathCallbacks::NotifyDecorationLinePathEmitted()
{
gfx->Save();
gfx->NewPath();
gfx->SetAntialiasMode(aaMode);
gfx->Rectangle(ThebesRect(aPath));
HandleTextGeometry();
gfx->NewPath();
gfx->Restore();