Backed out changesets 6c097bdfc079, 51f5d900cd27, 9fdf99c07466, and b322938b37ef (bug 798843) due to intermittent Windows test failures.
This commit is contained in:
@@ -290,11 +290,11 @@ gfxFontEntry::GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
gfxFontEntry::RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId,
|
gfxFontEntry::RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId,
|
||||||
int aDrawMode, gfxTextContextPaint *aContextPaint)
|
int aDrawMode, gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mSVGInitialized, "SVG data has not yet been loaded. TryGetSVGData() first.");
|
NS_ASSERTION(mSVGInitialized, "SVG data has not yet been loaded. TryGetSVGData() first.");
|
||||||
return mSVGGlyphs->RenderGlyph(aContext, aGlyphId, gfxFont::DrawMode(aDrawMode),
|
return mSVGGlyphs->RenderGlyph(aContext, aGlyphId, gfxFont::DrawMode(aDrawMode),
|
||||||
aContextPaint);
|
aObjectPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -2118,7 +2118,7 @@ struct GlyphBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Flush(cairo_t *aCR, gfxFont::DrawMode aDrawMode, bool aReverse,
|
void Flush(cairo_t *aCR, gfxFont::DrawMode aDrawMode, bool aReverse,
|
||||||
gfxTextContextPaint *aContextPaint,
|
gfxTextObjectPaint *aObjectPaint,
|
||||||
const gfxMatrix& aGlobalMatrix, bool aFinish = false) {
|
const gfxMatrix& aGlobalMatrix, bool aFinish = false) {
|
||||||
// Ensure there's enough room for a glyph to be added to the buffer
|
// Ensure there's enough room for a glyph to be added to the buffer
|
||||||
// and we actually have glyphs to draw
|
// and we actually have glyphs to draw
|
||||||
@@ -2139,13 +2139,13 @@ struct GlyphBuffer {
|
|||||||
} else {
|
} else {
|
||||||
if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) ==
|
if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) ==
|
||||||
(gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) {
|
(gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) {
|
||||||
FlushStroke(aCR, aContextPaint, aGlobalMatrix);
|
FlushStroke(aCR, aObjectPaint, aGlobalMatrix);
|
||||||
}
|
}
|
||||||
if (aDrawMode & gfxFont::GLYPH_FILL) {
|
if (aDrawMode & gfxFont::GLYPH_FILL) {
|
||||||
PROFILER_LABEL("GlyphBuffer", "cairo_show_glyphs");
|
PROFILER_LABEL("GlyphBuffer", "cairo_show_glyphs");
|
||||||
nsRefPtr<gfxPattern> pattern;
|
nsRefPtr<gfxPattern> pattern;
|
||||||
if (aContextPaint &&
|
if (aObjectPaint &&
|
||||||
!!(pattern = aContextPaint->GetFillPattern(aGlobalMatrix))) {
|
!!(pattern = aObjectPaint->GetFillPattern(aGlobalMatrix))) {
|
||||||
cairo_save(aCR);
|
cairo_save(aCR);
|
||||||
cairo_set_source(aCR, pattern->CairoPattern());
|
cairo_set_source(aCR, pattern->CairoPattern());
|
||||||
}
|
}
|
||||||
@@ -2158,7 +2158,7 @@ struct GlyphBuffer {
|
|||||||
}
|
}
|
||||||
if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) ==
|
if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) ==
|
||||||
gfxFont::GLYPH_STROKE) {
|
gfxFont::GLYPH_STROKE) {
|
||||||
FlushStroke(aCR, aContextPaint, aGlobalMatrix);
|
FlushStroke(aCR, aObjectPaint, aGlobalMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2166,11 +2166,11 @@ struct GlyphBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void FlushStroke(cairo_t *aCR, gfxTextContextPaint *aContextPaint,
|
void FlushStroke(cairo_t *aCR, gfxTextObjectPaint *aObjectPaint,
|
||||||
const gfxMatrix& aGlobalMatrix) {
|
const gfxMatrix& aGlobalMatrix) {
|
||||||
nsRefPtr<gfxPattern> pattern;
|
nsRefPtr<gfxPattern> pattern;
|
||||||
if (aContextPaint &&
|
if (aObjectPaint &&
|
||||||
!!(pattern = aContextPaint->GetStrokePattern(aGlobalMatrix))) {
|
!!(pattern = aObjectPaint->GetStrokePattern(aGlobalMatrix))) {
|
||||||
cairo_save(aCR);
|
cairo_save(aCR);
|
||||||
cairo_set_source(aCR, pattern->CairoPattern());
|
cairo_set_source(aCR, pattern->CairoPattern());
|
||||||
}
|
}
|
||||||
@@ -2212,7 +2212,7 @@ struct GlyphBufferAzure {
|
|||||||
return &mGlyphBuffer[mNumGlyphs++];
|
return &mGlyphBuffer[mNumGlyphs++];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Flush(DrawTarget *aDT, gfxTextContextPaint *aContextPaint, ScaledFont *aFont,
|
void Flush(DrawTarget *aDT, gfxTextObjectPaint *aObjectPaint, ScaledFont *aFont,
|
||||||
gfxFont::DrawMode aDrawMode, bool aReverse, const GlyphRenderingOptions *aOptions,
|
gfxFont::DrawMode aDrawMode, bool aReverse, const GlyphRenderingOptions *aOptions,
|
||||||
gfxContext *aThebesContext, const Matrix *aInvFontMatrix, const DrawOptions &aDrawOptions,
|
gfxContext *aThebesContext, const Matrix *aInvFontMatrix, const DrawOptions &aDrawOptions,
|
||||||
bool aFinish = false)
|
bool aFinish = false)
|
||||||
@@ -2235,15 +2235,15 @@ struct GlyphBufferAzure {
|
|||||||
gfxContext::AzureState state = aThebesContext->CurrentState();
|
gfxContext::AzureState state = aThebesContext->CurrentState();
|
||||||
if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) ==
|
if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) ==
|
||||||
(gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) {
|
(gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) {
|
||||||
FlushStroke(aDT, aContextPaint, aFont, aThebesContext, buf, state);
|
FlushStroke(aDT, aObjectPaint, aFont, aThebesContext, buf, state);
|
||||||
}
|
}
|
||||||
if (aDrawMode & gfxFont::GLYPH_FILL) {
|
if (aDrawMode & gfxFont::GLYPH_FILL) {
|
||||||
if (state.pattern || aContextPaint) {
|
if (state.pattern || aObjectPaint) {
|
||||||
Pattern *pat;
|
Pattern *pat;
|
||||||
|
|
||||||
nsRefPtr<gfxPattern> fillPattern;
|
nsRefPtr<gfxPattern> fillPattern;
|
||||||
if (!aContextPaint ||
|
if (!aObjectPaint ||
|
||||||
!(fillPattern = aContextPaint->GetFillPattern(aThebesContext->CurrentMatrix()))) {
|
!(fillPattern = aObjectPaint->GetFillPattern(aThebesContext->CurrentMatrix()))) {
|
||||||
if (state.pattern) {
|
if (state.pattern) {
|
||||||
pat = state.pattern->GetPattern(aDT, state.patternTransformChanged ? &state.patternTransform : nullptr);
|
pat = state.pattern->GetPattern(aDT, state.patternTransformChanged ? &state.patternTransform : nullptr);
|
||||||
} else {
|
} else {
|
||||||
@@ -2300,21 +2300,21 @@ struct GlyphBufferAzure {
|
|||||||
}
|
}
|
||||||
if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) ==
|
if ((aDrawMode & (gfxFont::GLYPH_STROKE | gfxFont::GLYPH_STROKE_UNDERNEATH)) ==
|
||||||
gfxFont::GLYPH_STROKE) {
|
gfxFont::GLYPH_STROKE) {
|
||||||
FlushStroke(aDT, aContextPaint, aFont, aThebesContext, buf, state);
|
FlushStroke(aDT, aObjectPaint, aFont, aThebesContext, buf, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
mNumGlyphs = 0;
|
mNumGlyphs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void FlushStroke(DrawTarget *aDT, gfxTextContextPaint *aContextPaint,
|
void FlushStroke(DrawTarget *aDT, gfxTextObjectPaint *aObjectPaint,
|
||||||
ScaledFont *aFont, gfxContext *aThebesContext,
|
ScaledFont *aFont, gfxContext *aThebesContext,
|
||||||
gfx::GlyphBuffer& aBuf, gfxContext::AzureState& aState)
|
gfx::GlyphBuffer& aBuf, gfxContext::AzureState& aState)
|
||||||
{
|
{
|
||||||
RefPtr<Path> path = aFont->GetPathForGlyphs(aBuf, aDT);
|
RefPtr<Path> path = aFont->GetPathForGlyphs(aBuf, aDT);
|
||||||
if (aContextPaint) {
|
if (aObjectPaint) {
|
||||||
nsRefPtr<gfxPattern> strokePattern =
|
nsRefPtr<gfxPattern> strokePattern =
|
||||||
aContextPaint->GetStrokePattern(aThebesContext->CurrentMatrix());
|
aObjectPaint->GetStrokePattern(aThebesContext->CurrentMatrix());
|
||||||
if (strokePattern) {
|
if (strokePattern) {
|
||||||
aDT->Stroke(path, *strokePattern->GetPattern(aDT), aState.strokeOptions);
|
aDT->Stroke(path, *strokePattern->GetPattern(aDT), aState.strokeOptions);
|
||||||
}
|
}
|
||||||
@@ -2362,7 +2362,7 @@ ForcePaintingDrawMode(gfxFont::DrawMode aDrawMode)
|
|||||||
void
|
void
|
||||||
gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
||||||
gfxContext *aContext, DrawMode aDrawMode, gfxPoint *aPt,
|
gfxContext *aContext, DrawMode aDrawMode, gfxPoint *aPt,
|
||||||
Spacing *aSpacing, gfxTextContextPaint *aContextPaint,
|
Spacing *aSpacing, gfxTextObjectPaint *aObjectPaint,
|
||||||
gfxTextRunDrawCallbacks *aCallbacks)
|
gfxTextRunDrawCallbacks *aCallbacks)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aDrawMode == gfxFont::GLYPH_PATH || !(aDrawMode & gfxFont::GLYPH_PATH),
|
NS_ASSERTION(aDrawMode == gfxFont::GLYPH_PATH || !(aDrawMode & gfxFont::GLYPH_PATH),
|
||||||
@@ -2379,14 +2379,14 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
gfxMatrix globalMatrix = aContext->CurrentMatrix();
|
gfxMatrix globalMatrix = aContext->CurrentMatrix();
|
||||||
|
|
||||||
bool haveSVGGlyphs = GetFontEntry()->TryGetSVGData(this);
|
bool haveSVGGlyphs = GetFontEntry()->TryGetSVGData(this);
|
||||||
nsAutoPtr<gfxTextContextPaint> contextPaint;
|
nsAutoPtr<gfxTextObjectPaint> objectPaint;
|
||||||
if (haveSVGGlyphs && !aContextPaint) {
|
if (haveSVGGlyphs && !aObjectPaint) {
|
||||||
// If no pattern is specified for fill, use the current pattern
|
// If no pattern is specified for fill, use the current pattern
|
||||||
NS_ASSERTION((aDrawMode & GLYPH_STROKE) == 0, "no pattern supplied for stroking text");
|
NS_ASSERTION((aDrawMode & GLYPH_STROKE) == 0, "no pattern supplied for stroking text");
|
||||||
nsRefPtr<gfxPattern> fillPattern = aContext->GetPattern();
|
nsRefPtr<gfxPattern> fillPattern = aContext->GetPattern();
|
||||||
contextPaint = new SimpleTextContextPaint(fillPattern, nullptr,
|
objectPaint = new SimpleTextObjectPaint(fillPattern, nullptr,
|
||||||
aContext->CurrentMatrix());
|
aContext->CurrentMatrix());
|
||||||
aContextPaint = contextPaint;
|
aObjectPaint = objectPaint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// synthetic-bold strikes are each offset one device pixel in run direction
|
// synthetic-bold strikes are each offset one device pixel in run direction
|
||||||
@@ -2445,7 +2445,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
ToDeviceUnits(y, devUnitsPerAppUnit));
|
ToDeviceUnits(y, devUnitsPerAppUnit));
|
||||||
gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode);
|
gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode);
|
||||||
if (RenderSVGGlyph(aContext, point, mode,
|
if (RenderSVGGlyph(aContext, point, mode,
|
||||||
glyphData->GetSimpleGlyph(), aContextPaint,
|
glyphData->GetSimpleGlyph(), aObjectPaint,
|
||||||
aCallbacks, emittedGlyphs)) {
|
aCallbacks, emittedGlyphs)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2460,7 +2460,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
glyph->index = glyphData->GetSimpleGlyph();
|
glyph->index = glyphData->GetSimpleGlyph();
|
||||||
glyph->x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
glyph->x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
||||||
glyph->y = ToDeviceUnits(y, devUnitsPerAppUnit);
|
glyph->y = ToDeviceUnits(y, devUnitsPerAppUnit);
|
||||||
glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix);
|
glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix);
|
||||||
|
|
||||||
// synthetic bolding by multi-striking with 1-pixel offsets
|
// synthetic bolding by multi-striking with 1-pixel offsets
|
||||||
// at least once, more if there's room (large font sizes)
|
// at least once, more if there's room (large font sizes)
|
||||||
@@ -2476,7 +2476,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
devUnitsPerAppUnit);
|
devUnitsPerAppUnit);
|
||||||
doubleglyph->y = glyph->y;
|
doubleglyph->y = glyph->y;
|
||||||
strikeOffset += synBoldOnePixelOffset;
|
strikeOffset += synBoldOnePixelOffset;
|
||||||
glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix);
|
glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix);
|
||||||
} while (--strikeCount > 0);
|
} while (--strikeCount > 0);
|
||||||
}
|
}
|
||||||
emittedGlyphs = true;
|
emittedGlyphs = true;
|
||||||
@@ -2523,7 +2523,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode);
|
gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode);
|
||||||
if (RenderSVGGlyph(aContext, point, mode,
|
if (RenderSVGGlyph(aContext, point, mode,
|
||||||
details->mGlyphID,
|
details->mGlyphID,
|
||||||
aContextPaint, aCallbacks,
|
aObjectPaint, aCallbacks,
|
||||||
emittedGlyphs)) {
|
emittedGlyphs)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2533,7 +2533,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
glyph->index = details->mGlyphID;
|
glyph->index = details->mGlyphID;
|
||||||
glyph->x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
glyph->x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
||||||
glyph->y = ToDeviceUnits(y + details->mYOffset, devUnitsPerAppUnit);
|
glyph->y = ToDeviceUnits(y + details->mYOffset, devUnitsPerAppUnit);
|
||||||
glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix);
|
glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix);
|
||||||
|
|
||||||
if (IsSyntheticBold()) {
|
if (IsSyntheticBold()) {
|
||||||
double strikeOffset = synBoldOnePixelOffset;
|
double strikeOffset = synBoldOnePixelOffset;
|
||||||
@@ -2548,7 +2548,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
devUnitsPerAppUnit);
|
devUnitsPerAppUnit);
|
||||||
doubleglyph->y = glyph->y;
|
doubleglyph->y = glyph->y;
|
||||||
strikeOffset += synBoldOnePixelOffset;
|
strikeOffset += synBoldOnePixelOffset;
|
||||||
glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix);
|
glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix);
|
||||||
} while (--strikeCount > 0);
|
} while (--strikeCount > 0);
|
||||||
}
|
}
|
||||||
emittedGlyphs = true;
|
emittedGlyphs = true;
|
||||||
@@ -2577,7 +2577,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// draw any remaining glyphs
|
// draw any remaining glyphs
|
||||||
glyphs.Flush(cr, aDrawMode, isRTL, aContextPaint, globalMatrix, true);
|
glyphs.Flush(cr, aDrawMode, isRTL, aObjectPaint, globalMatrix, true);
|
||||||
if (aCallbacks && emittedGlyphs) {
|
if (aCallbacks && emittedGlyphs) {
|
||||||
aCallbacks->NotifyGlyphPathEmitted();
|
aCallbacks->NotifyGlyphPathEmitted();
|
||||||
}
|
}
|
||||||
@@ -2660,7 +2660,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
ToDeviceUnits(y, devUnitsPerAppUnit));
|
ToDeviceUnits(y, devUnitsPerAppUnit));
|
||||||
gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode);
|
gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode);
|
||||||
if (RenderSVGGlyph(aContext, point, mode,
|
if (RenderSVGGlyph(aContext, point, mode,
|
||||||
glyphData->GetSimpleGlyph(), aContextPaint,
|
glyphData->GetSimpleGlyph(), aObjectPaint,
|
||||||
aCallbacks, emittedGlyphs)) {
|
aCallbacks, emittedGlyphs)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2676,7 +2676,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
glyph->mPosition.x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
glyph->mPosition.x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
||||||
glyph->mPosition.y = ToDeviceUnits(y, devUnitsPerAppUnit);
|
glyph->mPosition.y = ToDeviceUnits(y, devUnitsPerAppUnit);
|
||||||
glyph->mPosition = matInv * glyph->mPosition;
|
glyph->mPosition = matInv * glyph->mPosition;
|
||||||
glyphs.Flush(dt, aContextPaint, scaledFont,
|
glyphs.Flush(dt, aObjectPaint, scaledFont,
|
||||||
aDrawMode, isRTL, renderingOptions,
|
aDrawMode, isRTL, renderingOptions,
|
||||||
aContext, passedInvMatrix,
|
aContext, passedInvMatrix,
|
||||||
drawOptions);
|
drawOptions);
|
||||||
@@ -2696,7 +2696,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
doubleglyph->mPosition.y = glyph->mPosition.y;
|
doubleglyph->mPosition.y = glyph->mPosition.y;
|
||||||
doubleglyph->mPosition = matInv * doubleglyph->mPosition;
|
doubleglyph->mPosition = matInv * doubleglyph->mPosition;
|
||||||
strikeOffset += synBoldOnePixelOffset;
|
strikeOffset += synBoldOnePixelOffset;
|
||||||
glyphs.Flush(dt, aContextPaint, scaledFont,
|
glyphs.Flush(dt, aObjectPaint, scaledFont,
|
||||||
aDrawMode, isRTL, renderingOptions,
|
aDrawMode, isRTL, renderingOptions,
|
||||||
aContext, passedInvMatrix,
|
aContext, passedInvMatrix,
|
||||||
drawOptions);
|
drawOptions);
|
||||||
@@ -2746,7 +2746,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode);
|
gfxFont::DrawMode mode = ForcePaintingDrawMode(aDrawMode);
|
||||||
if (RenderSVGGlyph(aContext, point, mode,
|
if (RenderSVGGlyph(aContext, point, mode,
|
||||||
details->mGlyphID,
|
details->mGlyphID,
|
||||||
aContextPaint, aCallbacks,
|
aObjectPaint, aCallbacks,
|
||||||
emittedGlyphs)) {
|
emittedGlyphs)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2757,7 +2757,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
glyph->mPosition.x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
glyph->mPosition.x = ToDeviceUnits(glyphX, devUnitsPerAppUnit);
|
||||||
glyph->mPosition.y = ToDeviceUnits(y + details->mYOffset, devUnitsPerAppUnit);
|
glyph->mPosition.y = ToDeviceUnits(y + details->mYOffset, devUnitsPerAppUnit);
|
||||||
glyph->mPosition = matInv * glyph->mPosition;
|
glyph->mPosition = matInv * glyph->mPosition;
|
||||||
glyphs.Flush(dt, aContextPaint, scaledFont, aDrawMode,
|
glyphs.Flush(dt, aObjectPaint, scaledFont, aDrawMode,
|
||||||
isRTL, renderingOptions, aContext, passedInvMatrix,
|
isRTL, renderingOptions, aContext, passedInvMatrix,
|
||||||
drawOptions);
|
drawOptions);
|
||||||
|
|
||||||
@@ -2775,7 +2775,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
doubleglyph->mPosition.y = glyph->mPosition.y;
|
doubleglyph->mPosition.y = glyph->mPosition.y;
|
||||||
strikeOffset += synBoldOnePixelOffset;
|
strikeOffset += synBoldOnePixelOffset;
|
||||||
doubleglyph->mPosition = matInv * doubleglyph->mPosition;
|
doubleglyph->mPosition = matInv * doubleglyph->mPosition;
|
||||||
glyphs.Flush(dt, aContextPaint, scaledFont,
|
glyphs.Flush(dt, aObjectPaint, scaledFont,
|
||||||
aDrawMode, isRTL, renderingOptions,
|
aDrawMode, isRTL, renderingOptions,
|
||||||
aContext, passedInvMatrix, drawOptions);
|
aContext, passedInvMatrix, drawOptions);
|
||||||
} while (--strikeCount > 0);
|
} while (--strikeCount > 0);
|
||||||
@@ -2795,7 +2795,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glyphs.Flush(dt, aContextPaint, scaledFont, aDrawMode, isRTL,
|
glyphs.Flush(dt, aObjectPaint, scaledFont, aDrawMode, isRTL,
|
||||||
renderingOptions, aContext, passedInvMatrix,
|
renderingOptions, aContext, passedInvMatrix,
|
||||||
drawOptions, true);
|
drawOptions, true);
|
||||||
if (aCallbacks && emittedGlyphs) {
|
if (aCallbacks && emittedGlyphs) {
|
||||||
@@ -2812,7 +2812,7 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode,
|
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode,
|
||||||
uint32_t aGlyphId, gfxTextContextPaint *aContextPaint)
|
uint32_t aGlyphId, gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
if (!GetFontEntry()->HasSVGGlyph(aGlyphId)) {
|
if (!GetFontEntry()->HasSVGGlyph(aGlyphId)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -2824,15 +2824,15 @@ gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMod
|
|||||||
aContext->Translate(gfxPoint(aPoint.x, aPoint.y));
|
aContext->Translate(gfxPoint(aPoint.x, aPoint.y));
|
||||||
aContext->Scale(devUnitsPerSVGUnit, devUnitsPerSVGUnit);
|
aContext->Scale(devUnitsPerSVGUnit, devUnitsPerSVGUnit);
|
||||||
|
|
||||||
aContextPaint->InitStrokeGeometry(aContext, devUnitsPerSVGUnit);
|
aObjectPaint->InitStrokeGeometry(aContext, devUnitsPerSVGUnit);
|
||||||
|
|
||||||
return GetFontEntry()->RenderSVGGlyph(aContext, aGlyphId, aDrawMode,
|
return GetFontEntry()->RenderSVGGlyph(aContext, aGlyphId, aDrawMode,
|
||||||
aContextPaint);
|
aObjectPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode,
|
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode,
|
||||||
uint32_t aGlyphId, gfxTextContextPaint *aContextPaint,
|
uint32_t aGlyphId, gfxTextObjectPaint *aObjectPaint,
|
||||||
gfxTextRunDrawCallbacks *aCallbacks,
|
gfxTextRunDrawCallbacks *aCallbacks,
|
||||||
bool& aEmittedGlyphs)
|
bool& aEmittedGlyphs)
|
||||||
{
|
{
|
||||||
@@ -2844,7 +2844,7 @@ gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMod
|
|||||||
aCallbacks->NotifyBeforeSVGGlyphPainted();
|
aCallbacks->NotifyBeforeSVGGlyphPainted();
|
||||||
}
|
}
|
||||||
bool rendered = RenderSVGGlyph(aContext, aPoint, aDrawMode, aGlyphId,
|
bool rendered = RenderSVGGlyph(aContext, aPoint, aDrawMode, aGlyphId,
|
||||||
aContextPaint);
|
aObjectPaint);
|
||||||
if (aCallbacks) {
|
if (aCallbacks) {
|
||||||
aCallbacks->NotifyAfterSVGGlyphPainted();
|
aCallbacks->NotifyAfterSVGGlyphPainted();
|
||||||
}
|
}
|
||||||
@@ -5738,7 +5738,7 @@ gfxTextRun::ShrinkToLigatureBoundaries(uint32_t *aStart, uint32_t *aEnd)
|
|||||||
void
|
void
|
||||||
gfxTextRun::DrawGlyphs(gfxFont *aFont, gfxContext *aContext,
|
gfxTextRun::DrawGlyphs(gfxFont *aFont, gfxContext *aContext,
|
||||||
gfxFont::DrawMode aDrawMode, gfxPoint *aPt,
|
gfxFont::DrawMode aDrawMode, gfxPoint *aPt,
|
||||||
gfxTextContextPaint *aContextPaint,
|
gfxTextObjectPaint *aObjectPaint,
|
||||||
uint32_t aStart, uint32_t aEnd,
|
uint32_t aStart, uint32_t aEnd,
|
||||||
PropertyProvider *aProvider,
|
PropertyProvider *aProvider,
|
||||||
uint32_t aSpacingStart, uint32_t aSpacingEnd,
|
uint32_t aSpacingStart, uint32_t aSpacingEnd,
|
||||||
@@ -5748,7 +5748,7 @@ gfxTextRun::DrawGlyphs(gfxFont *aFont, gfxContext *aContext,
|
|||||||
bool haveSpacing = GetAdjustedSpacingArray(aStart, aEnd, aProvider,
|
bool haveSpacing = GetAdjustedSpacingArray(aStart, aEnd, aProvider,
|
||||||
aSpacingStart, aSpacingEnd, &spacingBuffer);
|
aSpacingStart, aSpacingEnd, &spacingBuffer);
|
||||||
aFont->Draw(this, aStart, aEnd, aContext, aDrawMode, aPt,
|
aFont->Draw(this, aStart, aEnd, aContext, aDrawMode, aPt,
|
||||||
haveSpacing ? spacingBuffer.Elements() : nullptr, aContextPaint,
|
haveSpacing ? spacingBuffer.Elements() : nullptr, aObjectPaint,
|
||||||
aCallbacks);
|
aCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5889,7 +5889,7 @@ void
|
|||||||
gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, gfxFont::DrawMode aDrawMode,
|
gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, gfxFont::DrawMode aDrawMode,
|
||||||
uint32_t aStart, uint32_t aLength,
|
uint32_t aStart, uint32_t aLength,
|
||||||
PropertyProvider *aProvider, gfxFloat *aAdvanceWidth,
|
PropertyProvider *aProvider, gfxFloat *aAdvanceWidth,
|
||||||
gfxTextContextPaint *aContextPaint,
|
gfxTextObjectPaint *aObjectPaint,
|
||||||
gfxTextRunDrawCallbacks *aCallbacks)
|
gfxTextRunDrawCallbacks *aCallbacks)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aStart + aLength <= GetLength(), "Substring out of range");
|
NS_ASSERTION(aStart + aLength <= GetLength(), "Substring out of range");
|
||||||
@@ -5955,7 +5955,7 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, gfxFont::DrawMode aDrawMode
|
|||||||
aProvider, aCallbacks);
|
aProvider, aCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawGlyphs(font, aContext, aDrawMode, &pt, aContextPaint, ligatureRunStart,
|
DrawGlyphs(font, aContext, aDrawMode, &pt, aObjectPaint, ligatureRunStart,
|
||||||
ligatureRunEnd, aProvider, ligatureRunStart, ligatureRunEnd,
|
ligatureRunEnd, aProvider, ligatureRunStart, ligatureRunEnd,
|
||||||
aCallbacks);
|
aCallbacks);
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class gfxUserFontData;
|
|||||||
class gfxShapedText;
|
class gfxShapedText;
|
||||||
class gfxShapedWord;
|
class gfxShapedWord;
|
||||||
class gfxSVGGlyphs;
|
class gfxSVGGlyphs;
|
||||||
class gfxTextContextPaint;
|
class gfxTextObjectPaint;
|
||||||
|
|
||||||
class nsILanguageAtomService;
|
class nsILanguageAtomService;
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ public:
|
|||||||
bool GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId,
|
bool GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId,
|
||||||
gfxRect *aResult);
|
gfxRect *aResult);
|
||||||
bool RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId, int aDrawMode,
|
bool RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId, int aDrawMode,
|
||||||
gfxTextContextPaint *aContextPaint);
|
gfxTextObjectPaint *aObjectPaint);
|
||||||
// Call this when glyph geometry or rendering has changed
|
// Call this when glyph geometry or rendering has changed
|
||||||
// (e.g. animated SVG glyphs)
|
// (e.g. animated SVG glyphs)
|
||||||
void NotifyGlyphsChanged();
|
void NotifyGlyphsChanged();
|
||||||
@@ -1512,7 +1512,7 @@ public:
|
|||||||
* that there is no spacing.
|
* that there is no spacing.
|
||||||
* @param aDrawMode specifies whether the fill or stroke of the glyph should be
|
* @param aDrawMode specifies whether the fill or stroke of the glyph should be
|
||||||
* drawn, or if it should be drawn into the current path
|
* drawn, or if it should be drawn into the current path
|
||||||
* @param aContextPaint information about how to construct the fill and
|
* @param aObjectPaint information about how to construct the fill and
|
||||||
* stroke pattern. Can be nullptr if we are not stroking the text, which
|
* stroke pattern. Can be nullptr if we are not stroking the text, which
|
||||||
* indicates that the current source from aContext should be used for filling
|
* indicates that the current source from aContext should be used for filling
|
||||||
*
|
*
|
||||||
@@ -1525,7 +1525,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
virtual void Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
|
||||||
gfxContext *aContext, DrawMode aDrawMode, gfxPoint *aBaselineOrigin,
|
gfxContext *aContext, DrawMode aDrawMode, gfxPoint *aBaselineOrigin,
|
||||||
Spacing *aSpacing, gfxTextContextPaint *aContextPaint,
|
Spacing *aSpacing, gfxTextObjectPaint *aObjectPaint,
|
||||||
gfxTextRunDrawCallbacks *aCallbacks);
|
gfxTextRunDrawCallbacks *aCallbacks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1962,9 +1962,9 @@ protected:
|
|||||||
void SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont);
|
void SanitizeMetrics(gfxFont::Metrics *aMetrics, bool aIsBadUnderlineFont);
|
||||||
|
|
||||||
bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode,
|
bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode,
|
||||||
uint32_t aGlyphId, gfxTextContextPaint *aContextPaint);
|
uint32_t aGlyphId, gfxTextObjectPaint *aObjectPaint);
|
||||||
bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode,
|
bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMode,
|
||||||
uint32_t aGlyphId, gfxTextContextPaint *aContextPaint,
|
uint32_t aGlyphId, gfxTextObjectPaint *aObjectPaint,
|
||||||
gfxTextRunDrawCallbacks *aCallbacks,
|
gfxTextRunDrawCallbacks *aCallbacks,
|
||||||
bool& aEmittedGlyphs);
|
bool& aEmittedGlyphs);
|
||||||
|
|
||||||
@@ -2818,7 +2818,7 @@ public:
|
|||||||
gfxFont::DrawMode aDrawMode,
|
gfxFont::DrawMode aDrawMode,
|
||||||
uint32_t aStart, uint32_t aLength,
|
uint32_t aStart, uint32_t aLength,
|
||||||
PropertyProvider *aProvider,
|
PropertyProvider *aProvider,
|
||||||
gfxFloat *aAdvanceWidth, gfxTextContextPaint *aContextPaint,
|
gfxFloat *aAdvanceWidth, gfxTextObjectPaint *aObjectPaint,
|
||||||
gfxTextRunDrawCallbacks *aCallbacks = nullptr);
|
gfxTextRunDrawCallbacks *aCallbacks = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3245,7 +3245,7 @@ private:
|
|||||||
// **** drawing helper ****
|
// **** drawing helper ****
|
||||||
void DrawGlyphs(gfxFont *aFont, gfxContext *aContext,
|
void DrawGlyphs(gfxFont *aFont, gfxContext *aContext,
|
||||||
gfxFont::DrawMode aDrawMode, gfxPoint *aPt,
|
gfxFont::DrawMode aDrawMode, gfxPoint *aPt,
|
||||||
gfxTextContextPaint *aContextPaint, uint32_t aStart,
|
gfxTextObjectPaint *aObjectPaint, uint32_t aStart,
|
||||||
uint32_t aEnd, PropertyProvider *aProvider,
|
uint32_t aEnd, PropertyProvider *aProvider,
|
||||||
uint32_t aSpacingStart, uint32_t aSpacingEnd,
|
uint32_t aSpacingStart, uint32_t aSpacingEnd,
|
||||||
gfxTextRunDrawCallbacks *aCallbacks);
|
gfxTextRunDrawCallbacks *aCallbacks);
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ using namespace mozilla;
|
|||||||
|
|
||||||
typedef mozilla::dom::Element Element;
|
typedef mozilla::dom::Element Element;
|
||||||
|
|
||||||
mozilla::gfx::UserDataKey gfxTextContextPaint::sUserDataKey;
|
mozilla::gfx::UserDataKey gfxTextObjectPaint::sUserDataKey;
|
||||||
|
|
||||||
const float gfxSVGGlyphs::SVG_UNITS_PER_EM = 1000.0f;
|
const float gfxSVGGlyphs::SVG_UNITS_PER_EM = 1000.0f;
|
||||||
|
|
||||||
const gfxRGBA SimpleTextContextPaint::sZero = gfxRGBA(0.0f, 0.0f, 0.0f, 0.0f);
|
const gfxRGBA SimpleTextObjectPaint::sZero = gfxRGBA(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
gfxSVGGlyphs::gfxSVGGlyphs(hb_blob_t *aSVGTable, gfxFontEntry *aFontEntry)
|
gfxSVGGlyphs::gfxSVGGlyphs(hb_blob_t *aSVGTable, gfxFontEntry *aFontEntry)
|
||||||
: mSVGData(aSVGTable)
|
: mSVGData(aSVGTable)
|
||||||
@@ -221,7 +221,7 @@ gfxSVGGlyphsDocument::FindGlyphElements(Element *aElem)
|
|||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
gfxSVGGlyphs::RenderGlyph(gfxContext *aContext, uint32_t aGlyphId,
|
gfxSVGGlyphs::RenderGlyph(gfxContext *aContext, uint32_t aGlyphId,
|
||||||
DrawMode aDrawMode, gfxTextContextPaint *aContextPaint)
|
DrawMode aDrawMode, gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
if (aDrawMode == gfxFont::GLYPH_PATH) {
|
if (aDrawMode == gfxFont::GLYPH_PATH) {
|
||||||
return false;
|
return false;
|
||||||
@@ -232,7 +232,7 @@ gfxSVGGlyphs::RenderGlyph(gfxContext *aContext, uint32_t aGlyphId,
|
|||||||
Element *glyph = mGlyphIdMap.Get(aGlyphId);
|
Element *glyph = mGlyphIdMap.Get(aGlyphId);
|
||||||
NS_ASSERTION(glyph, "No glyph element. Should check with HasSVGGlyph() first!");
|
NS_ASSERTION(glyph, "No glyph element. Should check with HasSVGGlyph() first!");
|
||||||
|
|
||||||
return nsSVGUtils::PaintSVGGlyph(glyph, aContext, aDrawMode, aContextPaint);
|
return nsSVGUtils::PaintSVGGlyph(glyph, aContext, aDrawMode, aObjectPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -446,7 +446,7 @@ gfxSVGGlyphsDocument::InsertGlyphId(Element *aGlyphElement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gfxTextContextPaint::InitStrokeGeometry(gfxContext *aContext,
|
gfxTextObjectPaint::InitStrokeGeometry(gfxContext *aContext,
|
||||||
float devUnitsPerSVGUnit)
|
float devUnitsPerSVGUnit)
|
||||||
{
|
{
|
||||||
mStrokeWidth = aContext->CurrentLineWidth() / devUnitsPerSVGUnit;
|
mStrokeWidth = aContext->CurrentLineWidth() / devUnitsPerSVGUnit;
|
||||||
|
|||||||
@@ -114,11 +114,11 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Render the SVG glyph for |aGlyphId|
|
* Render the SVG glyph for |aGlyphId|
|
||||||
* @param aDrawMode Whether to fill or stroke or both; see gfxFont::DrawMode
|
* @param aDrawMode Whether to fill or stroke or both; see gfxFont::DrawMode
|
||||||
* @param aContextPaint Information on text context paints.
|
* @param aObjectPaint Information on outer text object paints.
|
||||||
* See |gfxTextContextPaint|.
|
* See |gfxTextObjectPaint|.
|
||||||
*/
|
*/
|
||||||
bool RenderGlyph(gfxContext *aContext, uint32_t aGlyphId, DrawMode aDrawMode,
|
bool RenderGlyph(gfxContext *aContext, uint32_t aGlyphId, DrawMode aDrawMode,
|
||||||
gfxTextContextPaint *aContextPaint);
|
gfxTextObjectPaint *aObjectPaint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the extents for the SVG glyph associated with |aGlyphId|
|
* Get the extents for the SVG glyph associated with |aGlyphId|
|
||||||
@@ -160,17 +160,18 @@ private:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for trickling down paint information through to SVG glyphs.
|
* Used for trickling down paint information through to SVG glyphs.
|
||||||
|
* Will be extended in later patch.
|
||||||
*/
|
*/
|
||||||
class gfxTextContextPaint
|
class gfxTextObjectPaint
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
gfxTextContextPaint() { }
|
gfxTextObjectPaint() { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static mozilla::gfx::UserDataKey sUserDataKey;
|
static mozilla::gfx::UserDataKey sUserDataKey;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get text context pattern with the specified opacity value.
|
* Get outer text object pattern with the specified opacity value.
|
||||||
* This lets us inherit paints and paint opacities (i.e. fill/stroke and
|
* This lets us inherit paints and paint opacities (i.e. fill/stroke and
|
||||||
* fill-opacity/stroke-opacity) separately.
|
* fill-opacity/stroke-opacity) separately.
|
||||||
*/
|
*/
|
||||||
@@ -205,7 +206,7 @@ public:
|
|||||||
return GetStrokePattern(GetStrokeOpacity(), aCTM);
|
return GetStrokePattern(GetStrokeOpacity(), aCTM);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~gfxTextContextPaint() { }
|
virtual ~gfxTextObjectPaint() { }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FallibleTArray<gfxFloat> mDashes;
|
FallibleTArray<gfxFloat> mDashes;
|
||||||
@@ -214,10 +215,10 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For passing in patterns where the text context has no separate pattern
|
* For passing in patterns where the outer text object has no separate pattern
|
||||||
* opacity value.
|
* opacity value.
|
||||||
*/
|
*/
|
||||||
class SimpleTextContextPaint : public gfxTextContextPaint
|
class SimpleTextObjectPaint : public gfxTextObjectPaint
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static const gfxRGBA sZero;
|
static const gfxRGBA sZero;
|
||||||
@@ -234,7 +235,7 @@ public:
|
|||||||
return deviceToUser * aPattern->GetMatrix();
|
return deviceToUser * aPattern->GetMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTextContextPaint(gfxPattern *aFillPattern, gfxPattern *aStrokePattern,
|
SimpleTextObjectPaint(gfxPattern *aFillPattern, gfxPattern *aStrokePattern,
|
||||||
const gfxMatrix& aCTM) :
|
const gfxMatrix& aCTM) :
|
||||||
mFillPattern(aFillPattern ? aFillPattern : new gfxPattern(sZero)),
|
mFillPattern(aFillPattern ? aFillPattern : new gfxPattern(sZero)),
|
||||||
mStrokePattern(aStrokePattern ? aStrokePattern : new gfxPattern(sZero))
|
mStrokePattern(aStrokePattern ? aStrokePattern : new gfxPattern(sZero))
|
||||||
|
|||||||
@@ -5587,7 +5587,7 @@ nsTextFrame::PaintTextWithSelection(gfxContext* aCtx,
|
|||||||
uint32_t aContentOffset, uint32_t aContentLength,
|
uint32_t aContentOffset, uint32_t aContentLength,
|
||||||
nsTextPaintStyle& aTextPaintStyle,
|
nsTextPaintStyle& aTextPaintStyle,
|
||||||
const nsCharClipDisplayItem::ClipEdges& aClipEdges,
|
const nsCharClipDisplayItem::ClipEdges& aClipEdges,
|
||||||
gfxTextContextPaint* aContextPaint,
|
gfxTextObjectPaint* aObjectPaint,
|
||||||
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(GetContent()->IsSelectionDescendant(), "wrong paint path");
|
NS_ASSERTION(GetContent()->IsSelectionDescendant(), "wrong paint path");
|
||||||
@@ -5801,7 +5801,7 @@ void
|
|||||||
nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
|
nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsCharClipDisplayItem& aItem,
|
const nsCharClipDisplayItem& aItem,
|
||||||
gfxTextContextPaint* aContextPaint,
|
gfxTextObjectPaint* aObjectPaint,
|
||||||
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
||||||
{
|
{
|
||||||
// Don't pass in aRenderingContext here, because we need a *reference*
|
// Don't pass in aRenderingContext here, because we need a *reference*
|
||||||
@@ -5844,7 +5844,7 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
|
|||||||
tmp.ConvertSkippedToOriginal(startOffset + maxLength) - contentOffset;
|
tmp.ConvertSkippedToOriginal(startOffset + maxLength) - contentOffset;
|
||||||
if (PaintTextWithSelection(ctx, framePt, textBaselinePt, dirtyRect,
|
if (PaintTextWithSelection(ctx, framePt, textBaselinePt, dirtyRect,
|
||||||
provider, contentOffset, contentLength,
|
provider, contentOffset, contentLength,
|
||||||
textPaintStyle, clipEdges, aContextPaint,
|
textPaintStyle, clipEdges, aObjectPaint,
|
||||||
aCallbacks)) {
|
aCallbacks)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -5873,7 +5873,7 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
|
|||||||
DrawText(ctx, dirtyRect, framePt, textBaselinePt, startOffset, maxLength, provider,
|
DrawText(ctx, dirtyRect, framePt, textBaselinePt, startOffset, maxLength, provider,
|
||||||
textPaintStyle, foregroundColor, clipEdges, advanceWidth,
|
textPaintStyle, foregroundColor, clipEdges, advanceWidth,
|
||||||
(GetStateBits() & TEXT_HYPHEN_BREAK) != 0,
|
(GetStateBits() & TEXT_HYPHEN_BREAK) != 0,
|
||||||
nullptr, aContextPaint, aCallbacks);
|
nullptr, aObjectPaint, aCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -5884,7 +5884,7 @@ DrawTextRun(gfxTextRun* aTextRun,
|
|||||||
PropertyProvider* aProvider,
|
PropertyProvider* aProvider,
|
||||||
nscolor aTextColor,
|
nscolor aTextColor,
|
||||||
gfxFloat* aAdvanceWidth,
|
gfxFloat* aAdvanceWidth,
|
||||||
gfxTextContextPaint* aContextPaint,
|
gfxTextObjectPaint* aObjectPaint,
|
||||||
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
||||||
{
|
{
|
||||||
gfxFont::DrawMode drawMode = aCallbacks ? gfxFont::GLYPH_PATH :
|
gfxFont::DrawMode drawMode = aCallbacks ? gfxFont::GLYPH_PATH :
|
||||||
@@ -5892,12 +5892,12 @@ DrawTextRun(gfxTextRun* aTextRun,
|
|||||||
if (aCallbacks) {
|
if (aCallbacks) {
|
||||||
aCallbacks->NotifyBeforeText(aTextColor);
|
aCallbacks->NotifyBeforeText(aTextColor);
|
||||||
aTextRun->Draw(aCtx, aTextBaselinePt, drawMode, aOffset, aLength,
|
aTextRun->Draw(aCtx, aTextBaselinePt, drawMode, aOffset, aLength,
|
||||||
aProvider, aAdvanceWidth, aContextPaint, aCallbacks);
|
aProvider, aAdvanceWidth, aObjectPaint, aCallbacks);
|
||||||
aCallbacks->NotifyAfterText();
|
aCallbacks->NotifyAfterText();
|
||||||
} else {
|
} else {
|
||||||
aCtx->SetColor(gfxRGBA(aTextColor));
|
aCtx->SetColor(gfxRGBA(aTextColor));
|
||||||
aTextRun->Draw(aCtx, aTextBaselinePt, drawMode, aOffset, aLength,
|
aTextRun->Draw(aCtx, aTextBaselinePt, drawMode, aOffset, aLength,
|
||||||
aProvider, aAdvanceWidth, aContextPaint);
|
aProvider, aAdvanceWidth, aObjectPaint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5909,11 +5909,11 @@ nsTextFrame::DrawTextRun(gfxContext* const aCtx,
|
|||||||
nscolor aTextColor,
|
nscolor aTextColor,
|
||||||
gfxFloat& aAdvanceWidth,
|
gfxFloat& aAdvanceWidth,
|
||||||
bool aDrawSoftHyphen,
|
bool aDrawSoftHyphen,
|
||||||
gfxTextContextPaint* aContextPaint,
|
gfxTextObjectPaint* aObjectPaint,
|
||||||
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
||||||
{
|
{
|
||||||
::DrawTextRun(mTextRun, aCtx, aTextBaselinePt, aOffset, aLength, &aProvider,
|
::DrawTextRun(mTextRun, aCtx, aTextBaselinePt, aOffset, aLength, &aProvider,
|
||||||
aTextColor, &aAdvanceWidth, aContextPaint, aCallbacks);
|
aTextColor, &aAdvanceWidth, aObjectPaint, aCallbacks);
|
||||||
|
|
||||||
if (aDrawSoftHyphen) {
|
if (aDrawSoftHyphen) {
|
||||||
// Don't use ctx as the context, because we need a reference context here,
|
// Don't use ctx as the context, because we need a reference context here,
|
||||||
@@ -5927,7 +5927,7 @@ nsTextFrame::DrawTextRun(gfxContext* const aCtx,
|
|||||||
::DrawTextRun(hyphenTextRun.get(), aCtx,
|
::DrawTextRun(hyphenTextRun.get(), aCtx,
|
||||||
gfxPoint(hyphenBaselineX, aTextBaselinePt.y),
|
gfxPoint(hyphenBaselineX, aTextBaselinePt.y),
|
||||||
0, hyphenTextRun->GetLength(),
|
0, hyphenTextRun->GetLength(),
|
||||||
nullptr, aTextColor, nullptr, aContextPaint, aCallbacks);
|
nullptr, aTextColor, nullptr, aObjectPaint, aCallbacks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5945,7 +5945,7 @@ nsTextFrame::DrawTextRunAndDecorations(
|
|||||||
bool aDrawSoftHyphen,
|
bool aDrawSoftHyphen,
|
||||||
const TextDecorations& aDecorations,
|
const TextDecorations& aDecorations,
|
||||||
const nscolor* const aDecorationOverrideColor,
|
const nscolor* const aDecorationOverrideColor,
|
||||||
gfxTextContextPaint* aContextPaint,
|
gfxTextObjectPaint* aObjectPaint,
|
||||||
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
||||||
{
|
{
|
||||||
const gfxFloat app = aTextStyle.PresContext()->AppUnitsPerDevPixel();
|
const gfxFloat app = aTextStyle.PresContext()->AppUnitsPerDevPixel();
|
||||||
@@ -6010,7 +6010,7 @@ nsTextFrame::DrawTextRunAndDecorations(
|
|||||||
// CSS 2.1 mandates that text be painted after over/underlines, and *then*
|
// CSS 2.1 mandates that text be painted after over/underlines, and *then*
|
||||||
// line-throughs
|
// line-throughs
|
||||||
DrawTextRun(aCtx, aTextBaselinePt, aOffset, aLength, aProvider, aTextColor,
|
DrawTextRun(aCtx, aTextBaselinePt, aOffset, aLength, aProvider, aTextColor,
|
||||||
aAdvanceWidth, aDrawSoftHyphen, aContextPaint, aCallbacks);
|
aAdvanceWidth, aDrawSoftHyphen, aObjectPaint, aCallbacks);
|
||||||
|
|
||||||
// Line-throughs
|
// Line-throughs
|
||||||
for (uint32_t i = aDecorations.mStrikes.Length(); i-- > 0; ) {
|
for (uint32_t i = aDecorations.mStrikes.Length(); i-- > 0; ) {
|
||||||
@@ -6046,7 +6046,7 @@ nsTextFrame::DrawText(
|
|||||||
gfxFloat& aAdvanceWidth,
|
gfxFloat& aAdvanceWidth,
|
||||||
bool aDrawSoftHyphen,
|
bool aDrawSoftHyphen,
|
||||||
const nscolor* const aDecorationOverrideColor,
|
const nscolor* const aDecorationOverrideColor,
|
||||||
gfxTextContextPaint* aContextPaint,
|
gfxTextObjectPaint* aObjectPaint,
|
||||||
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
nsTextFrame::DrawPathCallbacks* aCallbacks)
|
||||||
{
|
{
|
||||||
TextDecorations decorations;
|
TextDecorations decorations;
|
||||||
@@ -6061,10 +6061,10 @@ nsTextFrame::DrawText(
|
|||||||
DrawTextRunAndDecorations(aCtx, aDirtyRect, aFramePt, aTextBaselinePt, aOffset, aLength,
|
DrawTextRunAndDecorations(aCtx, aDirtyRect, aFramePt, aTextBaselinePt, aOffset, aLength,
|
||||||
aProvider, aTextStyle, aTextColor, aClipEdges, aAdvanceWidth,
|
aProvider, aTextStyle, aTextColor, aClipEdges, aAdvanceWidth,
|
||||||
aDrawSoftHyphen, decorations,
|
aDrawSoftHyphen, decorations,
|
||||||
aDecorationOverrideColor, aContextPaint, aCallbacks);
|
aDecorationOverrideColor, aObjectPaint, aCallbacks);
|
||||||
} else {
|
} else {
|
||||||
DrawTextRun(aCtx, aTextBaselinePt, aOffset, aLength, aProvider,
|
DrawTextRun(aCtx, aTextBaselinePt, aOffset, aLength, aProvider,
|
||||||
aTextColor, aAdvanceWidth, aDrawSoftHyphen, aContextPaint, aCallbacks);
|
aTextColor, aAdvanceWidth, aDrawSoftHyphen, aObjectPaint, aCallbacks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ public:
|
|||||||
// context.
|
// context.
|
||||||
void PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
|
void PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
|
||||||
const nsRect& aDirtyRect, const nsCharClipDisplayItem& aItem,
|
const nsRect& aDirtyRect, const nsCharClipDisplayItem& aItem,
|
||||||
gfxTextContextPaint* aContextPaint = nullptr,
|
gfxTextObjectPaint* aObjectPaint = nullptr,
|
||||||
DrawPathCallbacks* aCallbacks = nullptr);
|
DrawPathCallbacks* aCallbacks = nullptr);
|
||||||
// helper: paint text frame when we're impacted by at least one selection.
|
// helper: paint text frame when we're impacted by at least one selection.
|
||||||
// Return false if the text was not painted and we should continue with
|
// Return false if the text was not painted and we should continue with
|
||||||
@@ -388,7 +388,7 @@ public:
|
|||||||
uint32_t aContentLength,
|
uint32_t aContentLength,
|
||||||
nsTextPaintStyle& aTextPaintStyle,
|
nsTextPaintStyle& aTextPaintStyle,
|
||||||
const nsCharClipDisplayItem::ClipEdges& aClipEdges,
|
const nsCharClipDisplayItem::ClipEdges& aClipEdges,
|
||||||
gfxTextContextPaint* aContextPaint,
|
gfxTextObjectPaint* aObjectPaint,
|
||||||
DrawPathCallbacks* aCallbacks);
|
DrawPathCallbacks* aCallbacks);
|
||||||
// helper: paint text with foreground and background colors determined
|
// helper: paint text with foreground and background colors determined
|
||||||
// by selection(s). Also computes a mask of all selection types applying to
|
// by selection(s). Also computes a mask of all selection types applying to
|
||||||
@@ -650,7 +650,7 @@ protected:
|
|||||||
nscolor aTextColor,
|
nscolor aTextColor,
|
||||||
gfxFloat& aAdvanceWidth,
|
gfxFloat& aAdvanceWidth,
|
||||||
bool aDrawSoftHyphen,
|
bool aDrawSoftHyphen,
|
||||||
gfxTextContextPaint* aContextPaint,
|
gfxTextObjectPaint* aObjectPaint,
|
||||||
DrawPathCallbacks* aCallbacks);
|
DrawPathCallbacks* aCallbacks);
|
||||||
|
|
||||||
void DrawTextRunAndDecorations(gfxContext* const aCtx,
|
void DrawTextRunAndDecorations(gfxContext* const aCtx,
|
||||||
@@ -667,7 +667,7 @@ protected:
|
|||||||
bool aDrawSoftHyphen,
|
bool aDrawSoftHyphen,
|
||||||
const TextDecorations& aDecorations,
|
const TextDecorations& aDecorations,
|
||||||
const nscolor* const aDecorationOverrideColor,
|
const nscolor* const aDecorationOverrideColor,
|
||||||
gfxTextContextPaint* aContextPaint,
|
gfxTextObjectPaint* aObjectPaint,
|
||||||
DrawPathCallbacks* aCallbacks);
|
DrawPathCallbacks* aCallbacks);
|
||||||
|
|
||||||
void DrawText(gfxContext* const aCtx,
|
void DrawText(gfxContext* const aCtx,
|
||||||
@@ -683,7 +683,7 @@ protected:
|
|||||||
gfxFloat& aAdvanceWidth,
|
gfxFloat& aAdvanceWidth,
|
||||||
bool aDrawSoftHyphen,
|
bool aDrawSoftHyphen,
|
||||||
const nscolor* const aDecorationOverrideColor = nullptr,
|
const nscolor* const aDecorationOverrideColor = nullptr,
|
||||||
gfxTextContextPaint* aContextPaint = nullptr,
|
gfxTextObjectPaint* aObjectPaint = nullptr,
|
||||||
DrawPathCallbacks* aCallbacks = nullptr);
|
DrawPathCallbacks* aCallbacks = nullptr);
|
||||||
|
|
||||||
// Set non empty rect to aRect, it should be overflow rect or frame rect.
|
// Set non empty rect to aRect, it should be overflow rect or frame rect.
|
||||||
|
|||||||
@@ -1,37 +1,11 @@
|
|||||||
.woff files for SVG-in-OpenType testing
|
Fonts in this directory:
|
||||||
=======================================
|
|
||||||
|
|
||||||
There are three .woff files in this directory:
|
rubbish.woff contains an SVG table with the contents of rubbish.txt. This is
|
||||||
* nosvg.woff
|
not a valid SVG table so no SVG glyphs will be used.
|
||||||
* svg.woff
|
|
||||||
* rubbish.woff
|
|
||||||
|
|
||||||
nosvg.woff
|
nosvg.woff is derived from the "Liberation" font. It contains no SVG table.
|
||||||
----------
|
|
||||||
This font is Liberation Serif with the addition of a glyph with a UVS selector
|
|
||||||
(Liberation fonts do not come with UVS glyphs; one had to be added to test that
|
|
||||||
SVG glyphs work with UVS selectors). It contains no 'SVG ' table.
|
|
||||||
|
|
||||||
svg.woff
|
svg.woff is nosvg.woff with an SVG table added. The
|
||||||
--------
|
table contains the glyph documents glyphs-base.svg, glyphs-invalid.svg,
|
||||||
This font is the same as nosvg.woff above, but with the glyphs-*.svg SVG
|
glyphs-objectcolor.svg, glyphs-objectopacity.svg, glyphs-objectstroke.svg,
|
||||||
documents from this directory embedded in it using the tools described below.
|
glyphs-paintservers.svg and glyphs-transforms.svg.
|
||||||
|
|
||||||
rubbish.woff
|
|
||||||
------------
|
|
||||||
This font is the same as nosvg.woff above, but with the addition of an 'SVG '
|
|
||||||
table with the contents of rubbish.txt. Its purpose is to test that SVG tables
|
|
||||||
without valid XML are ignored.
|
|
||||||
|
|
||||||
Creating the Fonts
|
|
||||||
------------------
|
|
||||||
The tools used here are insertsvg.py from [1] and sfnt2woff from [2].
|
|
||||||
|
|
||||||
svg.woff can be recreated with:
|
|
||||||
|
|
||||||
woff2sfnt nosvg.woff > nosvg.ttf
|
|
||||||
insertsvg.py nosvg.ttf svg.ttf glyphs-*.svg
|
|
||||||
sfnt2woff svg.ttf
|
|
||||||
|
|
||||||
[1] https://github.com/edf825/SVG-OpenType-Utils
|
|
||||||
[2] http://people.mozilla.com/~jkew/woff/
|
|
||||||
|
|||||||
@@ -3,22 +3,22 @@
|
|||||||
Test SVG glyphs for text object pattern inheritance
|
Test SVG glyphs for text object pattern inheritance
|
||||||
Covers glyph ID range 48 (N) to 51 (Q)
|
Covers glyph ID range 48 (N) to 51 (Q)
|
||||||
-->
|
-->
|
||||||
<!-- context-fill, no stroke -->
|
<!-- -moz-objectfill, no stroke -->
|
||||||
<!-- N -->
|
<!-- N -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||||
stroke="none" fill="context-fill" id="glyph48"/>
|
stroke="none" fill="-moz-objectFill" id="glyph48"/>
|
||||||
|
|
||||||
<!-- O -->
|
<!-- O -->
|
||||||
<rect x="50" y="-950" width="900" height="900" stroke-width="100"
|
<rect x="50" y="-950" width="900" height="900" stroke-width="100"
|
||||||
fill="context-fill" stroke="none" id="glyph49"/>
|
fill="-moz-objectFill" stroke="none" id="glyph49"/>
|
||||||
|
|
||||||
<!-- context-stroke -->
|
<!-- -moz-objectstroke -->
|
||||||
<!-- P -->
|
<!-- P -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||||
stroke="context-stroke" fill="burlywood" id="glyph50"/>
|
stroke="-moz-objectStroke" fill="burlywood" id="glyph50"/>
|
||||||
|
|
||||||
<!-- both context-stroke and context-fill (but note swapped usage!) -->
|
<!-- both -moz-objectstroke and -moz-objectfill -->
|
||||||
<!-- Q -->
|
<!-- Q -->
|
||||||
<rect x="50" y="-950" width="900" height="900" stroke-width="100"
|
<rect x="50" y="-950" width="900" height="900" stroke-width="100"
|
||||||
fill="context-stroke" stroke="context-fill" id="glyph51"/>
|
fill="-moz-objectStroke" stroke="-moz-objectFill" id="glyph51"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 841 B After Width: | Height: | Size: 842 B |
@@ -5,47 +5,47 @@
|
|||||||
-->
|
-->
|
||||||
<!-- R -->
|
<!-- R -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||||
fill="context-fill" stroke="context-stroke"
|
fill="-moz-objectFill" stroke="-moz-objectStroke"
|
||||||
fill-opacity="context-fill-opacity"
|
fill-opacity="-moz-objectFillOpacity"
|
||||||
stroke-opacity="context-stroke-opacity" id="glyph52"/>
|
stroke-opacity="-moz-objectStrokeOpacity" id="glyph52"/>
|
||||||
|
|
||||||
<!-- S -->
|
<!-- S -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||||
fill="context-fill" stroke="context-stroke"
|
fill="-moz-objectFill" stroke="-moz-objectStroke"
|
||||||
fill-opacity="context-stroke-opacity"
|
fill-opacity="-moz-objectStrokeOpacity"
|
||||||
stroke-opacity="context-fill-opacity" id="glyph53"/>
|
stroke-opacity="-moz-objectFillOpacity" id="glyph53"/>
|
||||||
|
|
||||||
<!-- T -->
|
<!-- T -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||||
fill="context-stroke" stroke="context-fill"
|
fill="-moz-objectStroke" stroke="-moz-objectFill"
|
||||||
fill-opacity="context-fill-opacity"
|
fill-opacity="-moz-objectFillOpacity"
|
||||||
stroke-opacity="context-stroke-opacity" id="glyph54"/>
|
stroke-opacity="-moz-objectStrokeOpacity" id="glyph54"/>
|
||||||
|
|
||||||
<!-- U -->
|
<!-- U -->
|
||||||
<!-- Test for bug where explicit `inherit' would fail for
|
<!-- Test for bug where explicit `inherit' would fail for
|
||||||
*-opacity="objectStrokeOpacity" or "objectFillOpacity" -->
|
*-opacity="objectStrokeOpacity" or "objectFillOpacity" -->
|
||||||
<g style="fill-opacity : context-stroke-opacity; stroke-opacity : context-fill-opacity">
|
<g style="fill-opacity : -moz-objectStrokeOpacity; stroke-opacity : -moz-objectFillOpacity">
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||||
fill="context-stroke" stroke="context-fill"
|
fill="-moz-objectStroke" stroke="-moz-objectFill"
|
||||||
fill-opacity="inherit" stroke-opacity="inherit" id="glyph55"/>
|
fill-opacity="inherit" stroke-opacity="inherit" id="glyph55"/>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
<!-- W -->
|
<!-- W -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||||
fill="darkorchid" stroke="goldenrod"
|
fill="darkorchid" stroke="goldenrod"
|
||||||
fill-opacity="context-fill-opacity"
|
fill-opacity="-moz-objectFillOpacity"
|
||||||
stroke-opacity="context-stroke-opacity" id="glyph57"/>
|
stroke-opacity="-moz-objectStrokeOpacity" id="glyph57"/>
|
||||||
|
|
||||||
<!-- X -->
|
<!-- X -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
<rect x="100" y="-900" width="800" height="800" stroke-width="50"
|
||||||
fill="darkorchid" stroke="goldenrod"
|
fill="darkorchid" stroke="goldenrod"
|
||||||
fill-opacity="context-stroke-opacity"
|
fill-opacity="-moz-objectStrokeOpacity"
|
||||||
stroke-opacity="context-fill-opacity" id="glyph58"/>
|
stroke-opacity="-moz-objectFillOpacity" id="glyph58"/>
|
||||||
|
|
||||||
<style type="text/css"><![CDATA[
|
<style type="text/css"><![CDATA[
|
||||||
#glyph59 {
|
#glyph59 {
|
||||||
fill-opacity : context-fill-opacity;
|
fill-opacity : -moz-objectFillOpacity;
|
||||||
stroke-opacity : context-stroke-opacity;
|
stroke-opacity : -moz-objectStrokeOpacity;
|
||||||
}
|
}
|
||||||
#ychild {
|
#ychild {
|
||||||
color-interpolation : sRGB;
|
color-interpolation : sRGB;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -11,15 +11,15 @@
|
|||||||
<!-- b -->
|
<!-- b -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke="chartreuse"
|
<rect x="100" y="-900" width="800" height="800" stroke="chartreuse"
|
||||||
stroke-width="50" stroke-dashoffset="35"
|
stroke-width="50" stroke-dashoffset="35"
|
||||||
stroke-dasharray="context-value" id="glyph68" />
|
stroke-dasharray="-moz-objectValue" id="glyph68" />
|
||||||
|
|
||||||
<!-- c -->
|
<!-- c -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke="sienna"
|
<rect x="100" y="-900" width="800" height="800" stroke="sienna"
|
||||||
stroke-width="50" stroke-dasharray="50 50"
|
stroke-width="50" stroke-dasharray="50 50"
|
||||||
stroke-dashoffset="context-value" id="glyph69" />
|
stroke-dashoffset="-moz-objectValue" id="glyph69" />
|
||||||
|
|
||||||
<!-- d -->
|
<!-- d -->
|
||||||
<rect x="100" y="-900" width="800" height="800" stroke="olivedrab"
|
<rect x="100" y="-900" width="800" height="800" stroke="olivedrab"
|
||||||
stroke-width="context-value" stroke-dasharray="context-value"
|
stroke-width="-moz-objectValue" stroke-dasharray="-moz-objectValue"
|
||||||
stroke-dashoffset="context-value" id="glyph70" />
|
stroke-dashoffset="-moz-objectValue" id="glyph70" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 900 B After Width: | Height: | Size: 915 B |
Binary file not shown.
@@ -123,6 +123,11 @@ CSS_KEY(-moz-min-content, _moz_min_content)
|
|||||||
CSS_KEY(-moz-myanmar, _moz_myanmar)
|
CSS_KEY(-moz-myanmar, _moz_myanmar)
|
||||||
CSS_KEY(-moz-nativehyperlinktext, _moz_nativehyperlinktext)
|
CSS_KEY(-moz-nativehyperlinktext, _moz_nativehyperlinktext)
|
||||||
CSS_KEY(-moz-none, _moz_none)
|
CSS_KEY(-moz-none, _moz_none)
|
||||||
|
CSS_KEY(-moz-objectfill, _moz_objectfill)
|
||||||
|
CSS_KEY(-moz-objectfillopacity, _moz_objectfillopacity)
|
||||||
|
CSS_KEY(-moz-objectstroke, _moz_objectstroke)
|
||||||
|
CSS_KEY(-moz-objectstrokeopacity, _moz_objectstrokeopacity)
|
||||||
|
CSS_KEY(-moz-objectvalue, _moz_objectvalue)
|
||||||
CSS_KEY(-moz-oddtreerow, _moz_oddtreerow)
|
CSS_KEY(-moz-oddtreerow, _moz_oddtreerow)
|
||||||
CSS_KEY(-moz-oriya, _moz_oriya)
|
CSS_KEY(-moz-oriya, _moz_oriya)
|
||||||
CSS_KEY(-moz-persian, _moz_persian)
|
CSS_KEY(-moz-persian, _moz_persian)
|
||||||
@@ -218,12 +223,7 @@ CSS_KEY(column-reverse, column_reverse)
|
|||||||
CSS_KEY(condensed, condensed)
|
CSS_KEY(condensed, condensed)
|
||||||
CSS_KEY(contain, contain)
|
CSS_KEY(contain, contain)
|
||||||
CSS_KEY(content-box, content_box)
|
CSS_KEY(content-box, content_box)
|
||||||
CSS_KEY(context-fill, context_fill)
|
|
||||||
CSS_KEY(context-fill-opacity, context_fill_opacity)
|
|
||||||
CSS_KEY(context-menu, context_menu)
|
CSS_KEY(context-menu, context_menu)
|
||||||
CSS_KEY(context-stroke, context_stroke)
|
|
||||||
CSS_KEY(context-stroke-opacity, context_stroke_opacity)
|
|
||||||
CSS_KEY(context-value, context_value)
|
|
||||||
CSS_KEY(continuous, continuous)
|
CSS_KEY(continuous, continuous)
|
||||||
CSS_KEY(contrast, contrast)
|
CSS_KEY(contrast, contrast)
|
||||||
CSS_KEY(copy, copy)
|
CSS_KEY(copy, copy)
|
||||||
|
|||||||
@@ -4984,8 +4984,7 @@ CSSParserImpl::TranslateDimension(nsCSSValue& aValue,
|
|||||||
VARIANT_GRADIENT | \
|
VARIANT_GRADIENT | \
|
||||||
VARIANT_TIMING_FUNCTION | \
|
VARIANT_TIMING_FUNCTION | \
|
||||||
VARIANT_ALL | \
|
VARIANT_ALL | \
|
||||||
VARIANT_CALC | \
|
VARIANT_CALC
|
||||||
VARIANT_OPENTYPE_SVG_KEYWORD
|
|
||||||
|
|
||||||
// Note that callers passing VARIANT_CALC in aVariantMask will get
|
// Note that callers passing VARIANT_CALC in aVariantMask will get
|
||||||
// full-range parsing inside the calc() expression, and the code that
|
// full-range parsing inside the calc() expression, and the code that
|
||||||
@@ -5134,18 +5133,6 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((aVariantMask & VARIANT_OPENTYPE_SVG_KEYWORD) != 0) {
|
|
||||||
static bool sOpentypeSVGEnabled;
|
|
||||||
static bool sOpentypeSVGEnabledCached = false;
|
|
||||||
if (!sOpentypeSVGEnabledCached) {
|
|
||||||
sOpentypeSVGEnabledCached = true;
|
|
||||||
Preferences::AddBoolVarCache(&sOpentypeSVGEnabled,
|
|
||||||
"gfx.font_rendering.opentype_svg.enabled");
|
|
||||||
}
|
|
||||||
if (sOpentypeSVGEnabled) {
|
|
||||||
aVariantMask |= VARIANT_KEYWORD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((aVariantMask & VARIANT_KEYWORD) != 0) {
|
if ((aVariantMask & VARIANT_KEYWORD) != 0) {
|
||||||
int32_t value;
|
int32_t value;
|
||||||
if (nsCSSProps::FindKeyword(keyword, aKeywordTable, value)) {
|
if (nsCSSProps::FindKeyword(keyword, aKeywordTable, value)) {
|
||||||
@@ -10852,10 +10839,8 @@ bool
|
|||||||
CSSParserImpl::ParsePaint(nsCSSProperty aPropID)
|
CSSParserImpl::ParsePaint(nsCSSProperty aPropID)
|
||||||
{
|
{
|
||||||
nsCSSValue x, y;
|
nsCSSValue x, y;
|
||||||
|
if (!ParseVariant(x, VARIANT_HCK | VARIANT_NONE | VARIANT_URL,
|
||||||
if (!ParseVariant(x, VARIANT_HC | VARIANT_NONE | VARIANT_URL |
|
nsCSSProps::kObjectPatternKTable)) {
|
||||||
VARIANT_OPENTYPE_SVG_KEYWORD,
|
|
||||||
nsCSSProps::kContextPatternKTable)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10882,10 +10867,8 @@ bool
|
|||||||
CSSParserImpl::ParseDasharray()
|
CSSParserImpl::ParseDasharray()
|
||||||
{
|
{
|
||||||
nsCSSValue value;
|
nsCSSValue value;
|
||||||
|
if (ParseVariant(value, VARIANT_HK | VARIANT_NONE,
|
||||||
if (ParseVariant(value, VARIANT_INHERIT | VARIANT_NONE |
|
nsCSSProps::kStrokeObjectValueKTable)) {
|
||||||
VARIANT_OPENTYPE_SVG_KEYWORD,
|
|
||||||
nsCSSProps::kStrokeContextValueKTable)) {
|
|
||||||
// 'inherit', 'initial', and 'none' are only allowed on their own
|
// 'inherit', 'initial', and 'none' are only allowed on their own
|
||||||
if (!ExpectEndProperty()) {
|
if (!ExpectEndProperty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -3342,7 +3342,7 @@ CSS_PROP_SVG(
|
|||||||
CSS_PROPERTY_PARSE_FUNCTION,
|
CSS_PROPERTY_PARSE_FUNCTION,
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
kContextPatternKTable,
|
kObjectPatternKTable,
|
||||||
offsetof(nsStyleSVG, mFill),
|
offsetof(nsStyleSVG, mFill),
|
||||||
eStyleAnimType_PaintServer)
|
eStyleAnimType_PaintServer)
|
||||||
CSS_PROP_SVG(
|
CSS_PROP_SVG(
|
||||||
@@ -3351,8 +3351,8 @@ CSS_PROP_SVG(
|
|||||||
FillOpacity,
|
FillOpacity,
|
||||||
CSS_PROPERTY_PARSE_VALUE,
|
CSS_PROPERTY_PARSE_VALUE,
|
||||||
"",
|
"",
|
||||||
VARIANT_HN | VARIANT_OPENTYPE_SVG_KEYWORD,
|
VARIANT_HN | VARIANT_KEYWORD,
|
||||||
kContextOpacityKTable,
|
kObjectOpacityKTable,
|
||||||
offsetof(nsStyleSVG, mFillOpacity),
|
offsetof(nsStyleSVG, mFillOpacity),
|
||||||
eStyleAnimType_float)
|
eStyleAnimType_float)
|
||||||
CSS_PROP_SVG(
|
CSS_PROP_SVG(
|
||||||
@@ -3508,7 +3508,7 @@ CSS_PROP_SVG(
|
|||||||
CSS_PROPERTY_PARSE_FUNCTION,
|
CSS_PROPERTY_PARSE_FUNCTION,
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
kContextPatternKTable,
|
kObjectPatternKTable,
|
||||||
offsetof(nsStyleSVG, mStroke),
|
offsetof(nsStyleSVG, mStroke),
|
||||||
eStyleAnimType_PaintServer)
|
eStyleAnimType_PaintServer)
|
||||||
CSS_PROP_SVG(
|
CSS_PROP_SVG(
|
||||||
@@ -3520,7 +3520,7 @@ CSS_PROP_SVG(
|
|||||||
// NOTE: Internal values have range restrictions.
|
// NOTE: Internal values have range restrictions.
|
||||||
"",
|
"",
|
||||||
0,
|
0,
|
||||||
kStrokeContextValueKTable,
|
kStrokeObjectValueKTable,
|
||||||
CSS_PROP_NO_OFFSET, /* property stored in 2 separate members */
|
CSS_PROP_NO_OFFSET, /* property stored in 2 separate members */
|
||||||
eStyleAnimType_Custom)
|
eStyleAnimType_Custom)
|
||||||
CSS_PROP_SVG(
|
CSS_PROP_SVG(
|
||||||
@@ -3529,8 +3529,8 @@ CSS_PROP_SVG(
|
|||||||
StrokeDashoffset,
|
StrokeDashoffset,
|
||||||
CSS_PROPERTY_PARSE_VALUE,
|
CSS_PROPERTY_PARSE_VALUE,
|
||||||
"",
|
"",
|
||||||
VARIANT_HLPN | VARIANT_OPENTYPE_SVG_KEYWORD,
|
VARIANT_HLPN | VARIANT_KEYWORD,
|
||||||
kStrokeContextValueKTable,
|
kStrokeObjectValueKTable,
|
||||||
offsetof(nsStyleSVG, mStrokeDashoffset),
|
offsetof(nsStyleSVG, mStrokeDashoffset),
|
||||||
eStyleAnimType_Coord)
|
eStyleAnimType_Coord)
|
||||||
CSS_PROP_SVG(
|
CSS_PROP_SVG(
|
||||||
@@ -3570,8 +3570,8 @@ CSS_PROP_SVG(
|
|||||||
StrokeOpacity,
|
StrokeOpacity,
|
||||||
CSS_PROPERTY_PARSE_VALUE,
|
CSS_PROPERTY_PARSE_VALUE,
|
||||||
"",
|
"",
|
||||||
VARIANT_HN | VARIANT_OPENTYPE_SVG_KEYWORD,
|
VARIANT_HN | VARIANT_KEYWORD,
|
||||||
kContextOpacityKTable,
|
kObjectOpacityKTable,
|
||||||
offsetof(nsStyleSVG, mStrokeOpacity),
|
offsetof(nsStyleSVG, mStrokeOpacity),
|
||||||
eStyleAnimType_float)
|
eStyleAnimType_float)
|
||||||
CSS_PROP_SVG(
|
CSS_PROP_SVG(
|
||||||
@@ -3581,8 +3581,8 @@ CSS_PROP_SVG(
|
|||||||
CSS_PROPERTY_PARSE_VALUE |
|
CSS_PROPERTY_PARSE_VALUE |
|
||||||
CSS_PROPERTY_VALUE_NONNEGATIVE,
|
CSS_PROPERTY_VALUE_NONNEGATIVE,
|
||||||
"",
|
"",
|
||||||
VARIANT_HLPN | VARIANT_OPENTYPE_SVG_KEYWORD,
|
VARIANT_HLPN | VARIANT_KEYWORD,
|
||||||
kStrokeContextValueKTable,
|
kStrokeObjectValueKTable,
|
||||||
offsetof(nsStyleSVG, mStrokeWidth),
|
offsetof(nsStyleSVG, mStrokeWidth),
|
||||||
eStyleAnimType_Coord)
|
eStyleAnimType_Coord)
|
||||||
CSS_PROP_SVG(
|
CSS_PROP_SVG(
|
||||||
|
|||||||
@@ -793,7 +793,7 @@ const int32_t nsCSSProps::kClearKTable[] = {
|
|||||||
eCSSKeyword_UNKNOWN,-1
|
eCSSKeyword_UNKNOWN,-1
|
||||||
};
|
};
|
||||||
|
|
||||||
// See also kContextPatternKTable for SVG paint-specific values
|
// See also kObjectPatternKTable for SVG paint-specific values
|
||||||
const int32_t nsCSSProps::kColorKTable[] = {
|
const int32_t nsCSSProps::kColorKTable[] = {
|
||||||
eCSSKeyword_activeborder, LookAndFeel::eColorID_activeborder,
|
eCSSKeyword_activeborder, LookAndFeel::eColorID_activeborder,
|
||||||
eCSSKeyword_activecaption, LookAndFeel::eColorID_activecaption,
|
eCSSKeyword_activecaption, LookAndFeel::eColorID_activecaption,
|
||||||
@@ -1268,15 +1268,15 @@ const int32_t nsCSSProps::kListStyleKTable[] = {
|
|||||||
eCSSKeyword_UNKNOWN,-1
|
eCSSKeyword_UNKNOWN,-1
|
||||||
};
|
};
|
||||||
|
|
||||||
const int32_t nsCSSProps::kContextOpacityKTable[] = {
|
const int32_t nsCSSProps::kObjectOpacityKTable[] = {
|
||||||
eCSSKeyword_context_fill_opacity, NS_STYLE_CONTEXT_FILL_OPACITY,
|
eCSSKeyword__moz_objectfillopacity, NS_STYLE_OBJECT_FILL_OPACITY,
|
||||||
eCSSKeyword_context_stroke_opacity, NS_STYLE_CONTEXT_STROKE_OPACITY,
|
eCSSKeyword__moz_objectstrokeopacity, NS_STYLE_OBJECT_STROKE_OPACITY,
|
||||||
eCSSKeyword_UNKNOWN,-1
|
eCSSKeyword_UNKNOWN,-1
|
||||||
};
|
};
|
||||||
|
|
||||||
const int32_t nsCSSProps::kContextPatternKTable[] = {
|
const int32_t nsCSSProps::kObjectPatternKTable[] = {
|
||||||
eCSSKeyword_context_fill, NS_COLOR_CONTEXT_FILL,
|
eCSSKeyword__moz_objectfill, NS_COLOR_OBJECTFILL,
|
||||||
eCSSKeyword_context_stroke, NS_COLOR_CONTEXT_STROKE,
|
eCSSKeyword__moz_objectstroke, NS_COLOR_OBJECTSTROKE,
|
||||||
eCSSKeyword_UNKNOWN,-1
|
eCSSKeyword_UNKNOWN,-1
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1746,8 +1746,8 @@ const int32_t nsCSSProps::kStrokeLinejoinKTable[] = {
|
|||||||
|
|
||||||
// Lookup table to store the sole objectValue keyword to let SVG glyphs inherit
|
// Lookup table to store the sole objectValue keyword to let SVG glyphs inherit
|
||||||
// certain stroke-* properties from the outer text object
|
// certain stroke-* properties from the outer text object
|
||||||
const int32_t nsCSSProps::kStrokeContextValueKTable[] = {
|
const int32_t nsCSSProps::kStrokeObjectValueKTable[] = {
|
||||||
eCSSKeyword_context_value, NS_STYLE_STROKE_PROP_CONTEXT_VALUE,
|
eCSSKeyword__moz_objectvalue, NS_STYLE_STROKE_PROP_OBJECTVALUE,
|
||||||
eCSSKeyword_UNKNOWN, -1
|
eCSSKeyword_UNKNOWN, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,6 @@
|
|||||||
#define VARIANT_ELEMENT 0x08000000 // eCSSUnit_Element
|
#define VARIANT_ELEMENT 0x08000000 // eCSSUnit_Element
|
||||||
#define VARIANT_POSITIVE_DIMENSION 0x10000000 // Only lengths greater than 0.0
|
#define VARIANT_POSITIVE_DIMENSION 0x10000000 // Only lengths greater than 0.0
|
||||||
#define VARIANT_NONNEGATIVE_DIMENSION 0x20000000 // Only lengths greater than or equal to 0.0
|
#define VARIANT_NONNEGATIVE_DIMENSION 0x20000000 // Only lengths greater than or equal to 0.0
|
||||||
// Keyword used iff gfx.font_rendering.opentype_svg.enabled is true:
|
|
||||||
#define VARIANT_OPENTYPE_SVG_KEYWORD 0x40000000
|
|
||||||
|
|
||||||
// Common combinations of variants
|
// Common combinations of variants
|
||||||
#define VARIANT_AL (VARIANT_AUTO | VARIANT_LENGTH)
|
#define VARIANT_AL (VARIANT_AUTO | VARIANT_LENGTH)
|
||||||
@@ -458,7 +456,7 @@ public:
|
|||||||
static const int32_t kShapeRenderingKTable[];
|
static const int32_t kShapeRenderingKTable[];
|
||||||
static const int32_t kStrokeLinecapKTable[];
|
static const int32_t kStrokeLinecapKTable[];
|
||||||
static const int32_t kStrokeLinejoinKTable[];
|
static const int32_t kStrokeLinejoinKTable[];
|
||||||
static const int32_t kStrokeContextValueKTable[];
|
static const int32_t kStrokeObjectValueKTable[];
|
||||||
static const int32_t kVectorEffectKTable[];
|
static const int32_t kVectorEffectKTable[];
|
||||||
static const int32_t kTextAnchorKTable[];
|
static const int32_t kTextAnchorKTable[];
|
||||||
static const int32_t kTextRenderingKTable[];
|
static const int32_t kTextRenderingKTable[];
|
||||||
@@ -507,8 +505,8 @@ public:
|
|||||||
static const int32_t kListStylePositionKTable[];
|
static const int32_t kListStylePositionKTable[];
|
||||||
static const int32_t kListStyleKTable[];
|
static const int32_t kListStyleKTable[];
|
||||||
static const int32_t kMaskTypeKTable[];
|
static const int32_t kMaskTypeKTable[];
|
||||||
static const int32_t kContextOpacityKTable[];
|
static const int32_t kObjectOpacityKTable[];
|
||||||
static const int32_t kContextPatternKTable[];
|
static const int32_t kObjectPatternKTable[];
|
||||||
static const int32_t kOrientKTable[];
|
static const int32_t kOrientKTable[];
|
||||||
static const int32_t kOutlineStyleKTable[];
|
static const int32_t kOutlineStyleKTable[];
|
||||||
static const int32_t kOutlineColorKTable[];
|
static const int32_t kOutlineColorKTable[];
|
||||||
|
|||||||
@@ -4294,14 +4294,14 @@ nsComputedDOMStyle::GetSVGPaintFor(bool aFill)
|
|||||||
SetToRGBAColor(fallback, paint->mFallbackColor);
|
SetToRGBAColor(fallback, paint->mFallbackColor);
|
||||||
return valueList;
|
return valueList;
|
||||||
}
|
}
|
||||||
case eStyleSVGPaintType_ContextFill:
|
case eStyleSVGPaintType_ObjectFill:
|
||||||
{
|
{
|
||||||
val->SetIdent(eCSSKeyword_context_fill);
|
val->SetIdent(eCSSKeyword__moz_objectfill);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eStyleSVGPaintType_ContextStroke:
|
case eStyleSVGPaintType_ObjectStroke:
|
||||||
{
|
{
|
||||||
val->SetIdent(eCSSKeyword_context_stroke);
|
val->SetIdent(eCSSKeyword__moz_objectstroke);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7420,11 +7420,11 @@ SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint,
|
|||||||
} else if (pair.mXValue.GetUnit() == eCSSUnit_Enumerated) {
|
} else if (pair.mXValue.GetUnit() == eCSSUnit_Enumerated) {
|
||||||
|
|
||||||
switch (pair.mXValue.GetIntValue()) {
|
switch (pair.mXValue.GetIntValue()) {
|
||||||
case NS_COLOR_CONTEXT_FILL:
|
case NS_COLOR_OBJECTFILL:
|
||||||
aResult.SetType(eStyleSVGPaintType_ContextFill);
|
aResult.SetType(eStyleSVGPaintType_ObjectFill);
|
||||||
break;
|
break;
|
||||||
case NS_COLOR_CONTEXT_STROKE:
|
case NS_COLOR_OBJECTSTROKE:
|
||||||
aResult.SetType(eStyleSVGPaintType_ContextStroke);
|
aResult.SetType(eStyleSVGPaintType_ObjectStroke);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NS_NOTREACHED("unknown keyword as paint server value");
|
NS_NOTREACHED("unknown keyword as paint server value");
|
||||||
@@ -7456,11 +7456,11 @@ SetSVGOpacity(const nsCSSValue& aValue,
|
|||||||
{
|
{
|
||||||
if (eCSSUnit_Enumerated == aValue.GetUnit()) {
|
if (eCSSUnit_Enumerated == aValue.GetUnit()) {
|
||||||
switch (aValue.GetIntValue()) {
|
switch (aValue.GetIntValue()) {
|
||||||
case NS_STYLE_CONTEXT_FILL_OPACITY:
|
case NS_STYLE_OBJECT_FILL_OPACITY:
|
||||||
aOpacityTypeField = eStyleSVGOpacitySource_ContextFillOpacity;
|
aOpacityTypeField = eStyleSVGOpacitySource_ObjectFillOpacity;
|
||||||
break;
|
break;
|
||||||
case NS_STYLE_CONTEXT_STROKE_OPACITY:
|
case NS_STYLE_OBJECT_STROKE_OPACITY:
|
||||||
aOpacityTypeField = eStyleSVGOpacitySource_ContextStrokeOpacity;
|
aOpacityTypeField = eStyleSVGOpacitySource_ObjectStrokeOpacity;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NS_NOTREACHED("SetSVGOpacity: Unknown keyword");
|
NS_NOTREACHED("SetSVGOpacity: Unknown keyword");
|
||||||
@@ -7480,10 +7480,10 @@ SetSVGOpacity(const nsCSSValue& aValue,
|
|||||||
|
|
||||||
template <typename FieldT, typename T>
|
template <typename FieldT, typename T>
|
||||||
static bool
|
static bool
|
||||||
SetTextContextValue(const nsCSSValue& aValue, FieldT& aField, T aFallbackValue)
|
SetTextObjectValue(const nsCSSValue& aValue, FieldT& aField, T aFallbackValue)
|
||||||
{
|
{
|
||||||
if (aValue.GetUnit() != eCSSUnit_Enumerated ||
|
if (aValue.GetUnit() != eCSSUnit_Enumerated ||
|
||||||
aValue.GetIntValue() != NS_STYLE_STROKE_PROP_CONTEXT_VALUE) {
|
aValue.GetIntValue() != NS_STYLE_STROKE_PROP_OBJECTVALUE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
aField = aFallbackValue;
|
aField = aFallbackValue;
|
||||||
@@ -7523,13 +7523,12 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
|||||||
parentSVG->mFill, mPresContext, aContext,
|
parentSVG->mFill, mPresContext, aContext,
|
||||||
svg->mFill, eStyleSVGPaintType_Color, canStoreInRuleTree);
|
svg->mFill, eStyleSVGPaintType_Color, canStoreInRuleTree);
|
||||||
|
|
||||||
// fill-opacity: factor, inherit, initial,
|
// fill-opacity: factor, inherit, initial, objectFillOpacity, objectStrokeOpacity
|
||||||
// context-fill-opacity, context-stroke-opacity
|
nsStyleSVGOpacitySource objectFillOpacity = svg->mFillOpacitySource;
|
||||||
nsStyleSVGOpacitySource contextFillOpacity = svg->mFillOpacitySource;
|
|
||||||
SetSVGOpacity(*aRuleData->ValueForFillOpacity(),
|
SetSVGOpacity(*aRuleData->ValueForFillOpacity(),
|
||||||
svg->mFillOpacity, contextFillOpacity, canStoreInRuleTree,
|
svg->mFillOpacity, objectFillOpacity, canStoreInRuleTree,
|
||||||
parentSVG->mFillOpacity, parentSVG->mFillOpacitySource);
|
parentSVG->mFillOpacity, parentSVG->mFillOpacitySource);
|
||||||
svg->mFillOpacitySource = contextFillOpacity;
|
svg->mFillOpacitySource = objectFillOpacity;
|
||||||
|
|
||||||
// fill-rule: enum, inherit, initial
|
// fill-rule: enum, inherit, initial
|
||||||
SetDiscrete(*aRuleData->ValueForFillRule(),
|
SetDiscrete(*aRuleData->ValueForFillRule(),
|
||||||
@@ -7616,7 +7615,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
|||||||
parentSVG->mStroke, mPresContext, aContext,
|
parentSVG->mStroke, mPresContext, aContext,
|
||||||
svg->mStroke, eStyleSVGPaintType_None, canStoreInRuleTree);
|
svg->mStroke, eStyleSVGPaintType_None, canStoreInRuleTree);
|
||||||
|
|
||||||
// stroke-dasharray: <dasharray>, none, inherit, context-value
|
// stroke-dasharray: <dasharray>, none, inherit, -moz-objectValue
|
||||||
const nsCSSValue* strokeDasharrayValue = aRuleData->ValueForStrokeDasharray();
|
const nsCSSValue* strokeDasharrayValue = aRuleData->ValueForStrokeDasharray();
|
||||||
switch (strokeDasharrayValue->GetUnit()) {
|
switch (strokeDasharrayValue->GetUnit()) {
|
||||||
case eCSSUnit_Null:
|
case eCSSUnit_Null:
|
||||||
@@ -7643,7 +7642,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
|||||||
|
|
||||||
case eCSSUnit_Enumerated:
|
case eCSSUnit_Enumerated:
|
||||||
NS_ABORT_IF_FALSE(strokeDasharrayValue->GetIntValue() ==
|
NS_ABORT_IF_FALSE(strokeDasharrayValue->GetIntValue() ==
|
||||||
NS_STYLE_STROKE_PROP_CONTEXT_VALUE,
|
NS_STYLE_STROKE_PROP_OBJECTVALUE,
|
||||||
"Unknown keyword for stroke-dasharray");
|
"Unknown keyword for stroke-dasharray");
|
||||||
svg->mStrokeDasharrayFromObject = true;
|
svg->mStrokeDasharrayFromObject = true;
|
||||||
delete [] svg->mStrokeDasharray;
|
delete [] svg->mStrokeDasharray;
|
||||||
@@ -7698,9 +7697,9 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
|||||||
aRuleData->ValueForStrokeDashoffset();
|
aRuleData->ValueForStrokeDashoffset();
|
||||||
svg->mStrokeDashoffsetFromObject =
|
svg->mStrokeDashoffsetFromObject =
|
||||||
strokeDashoffsetValue->GetUnit() == eCSSUnit_Enumerated &&
|
strokeDashoffsetValue->GetUnit() == eCSSUnit_Enumerated &&
|
||||||
strokeDashoffsetValue->GetIntValue() == NS_STYLE_STROKE_PROP_CONTEXT_VALUE;
|
strokeDashoffsetValue->GetIntValue() == NS_STYLE_STROKE_PROP_OBJECTVALUE;
|
||||||
if (svg->mStrokeDashoffsetFromObject) {
|
if (svg->mStrokeDashoffsetFromObject) {
|
||||||
svg->mStrokeDashoffset.SetCoordValue(0);
|
svg->mStrokeDashoffset.SetIntValue(0, eStyleUnit_Integer);
|
||||||
} else {
|
} else {
|
||||||
SetCoord(*aRuleData->ValueForStrokeDashoffset(),
|
SetCoord(*aRuleData->ValueForStrokeDashoffset(),
|
||||||
svg->mStrokeDashoffset, parentSVG->mStrokeDashoffset,
|
svg->mStrokeDashoffset, parentSVG->mStrokeDashoffset,
|
||||||
@@ -7727,18 +7726,18 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
|||||||
parentSVG->mStrokeMiterlimit, 4.0f);
|
parentSVG->mStrokeMiterlimit, 4.0f);
|
||||||
|
|
||||||
// stroke-opacity:
|
// stroke-opacity:
|
||||||
nsStyleSVGOpacitySource contextStrokeOpacity = svg->mStrokeOpacitySource;
|
nsStyleSVGOpacitySource objectStrokeOpacity = svg->mStrokeOpacitySource;
|
||||||
SetSVGOpacity(*aRuleData->ValueForStrokeOpacity(),
|
SetSVGOpacity(*aRuleData->ValueForStrokeOpacity(),
|
||||||
svg->mStrokeOpacity, contextStrokeOpacity, canStoreInRuleTree,
|
svg->mStrokeOpacity, objectStrokeOpacity, canStoreInRuleTree,
|
||||||
parentSVG->mStrokeOpacity, parentSVG->mStrokeOpacitySource);
|
parentSVG->mStrokeOpacity, parentSVG->mStrokeOpacitySource);
|
||||||
svg->mStrokeOpacitySource = contextStrokeOpacity;
|
svg->mStrokeOpacitySource = objectStrokeOpacity;
|
||||||
|
|
||||||
// stroke-width:
|
// stroke-width:
|
||||||
const nsCSSValue* strokeWidthValue = aRuleData->ValueForStrokeWidth();
|
const nsCSSValue* strokeWidthValue = aRuleData->ValueForStrokeWidth();
|
||||||
switch (strokeWidthValue->GetUnit()) {
|
switch (strokeWidthValue->GetUnit()) {
|
||||||
case eCSSUnit_Enumerated:
|
case eCSSUnit_Enumerated:
|
||||||
NS_ABORT_IF_FALSE(strokeWidthValue->GetIntValue() ==
|
NS_ABORT_IF_FALSE(strokeWidthValue->GetIntValue() ==
|
||||||
NS_STYLE_STROKE_PROP_CONTEXT_VALUE,
|
NS_STYLE_STROKE_PROP_OBJECTVALUE,
|
||||||
"Unrecognized keyword for stroke-width");
|
"Unrecognized keyword for stroke-width");
|
||||||
svg->mStrokeWidthFromObject = true;
|
svg->mStrokeWidthFromObject = true;
|
||||||
svg->mStrokeWidth.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(1));
|
svg->mStrokeWidth.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(1));
|
||||||
|
|||||||
@@ -3433,11 +3433,11 @@ nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty,
|
|||||||
eUnit_CSSValuePair);
|
eUnit_CSSValuePair);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (paint.mType == eStyleSVGPaintType_ContextFill ||
|
if (paint.mType == eStyleSVGPaintType_ObjectFill ||
|
||||||
paint.mType == eStyleSVGPaintType_ContextStroke) {
|
paint.mType == eStyleSVGPaintType_ObjectStroke) {
|
||||||
nsAutoPtr<nsCSSValuePair> pair(new nsCSSValuePair);
|
nsAutoPtr<nsCSSValuePair> pair(new nsCSSValuePair);
|
||||||
pair->mXValue.SetIntValue(paint.mType == eStyleSVGPaintType_ContextFill ?
|
pair->mXValue.SetIntValue(paint.mType == eStyleSVGPaintType_ObjectFill ?
|
||||||
NS_COLOR_CONTEXT_FILL : NS_COLOR_CONTEXT_STROKE,
|
NS_COLOR_OBJECTFILL : NS_COLOR_OBJECTSTROKE,
|
||||||
eCSSUnit_Enumerated);
|
eCSSUnit_Enumerated);
|
||||||
pair->mYValue.SetColorValue(paint.mFallbackColor);
|
pair->mYValue.SetColorValue(paint.mFallbackColor);
|
||||||
aComputedValue.SetAndAdoptCSSValuePairValue(pair.forget(),
|
aComputedValue.SetAndAdoptCSSValuePairValue(pair.forget(),
|
||||||
|
|||||||
@@ -208,8 +208,8 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
|||||||
#define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -5
|
#define NS_COLOR_MOZ_VISITEDHYPERLINKTEXT -5
|
||||||
#define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -6
|
#define NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT -6
|
||||||
// Only valid as paints in SVG glyphs
|
// Only valid as paints in SVG glyphs
|
||||||
#define NS_COLOR_CONTEXT_FILL -7
|
#define NS_COLOR_OBJECTFILL -7
|
||||||
#define NS_COLOR_CONTEXT_STROKE -8
|
#define NS_COLOR_OBJECTSTROKE -8
|
||||||
|
|
||||||
// See nsStyleDisplay
|
// See nsStyleDisplay
|
||||||
#define NS_STYLE_ANIMATION_DIRECTION_NORMAL 0
|
#define NS_STYLE_ANIMATION_DIRECTION_NORMAL 0
|
||||||
@@ -914,7 +914,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
|||||||
#define NS_STYLE_STROKE_LINEJOIN_BEVEL 2
|
#define NS_STYLE_STROKE_LINEJOIN_BEVEL 2
|
||||||
|
|
||||||
// stroke-dasharray, stroke-dashoffset, stroke-width
|
// stroke-dasharray, stroke-dashoffset, stroke-width
|
||||||
#define NS_STYLE_STROKE_PROP_CONTEXT_VALUE 0
|
#define NS_STYLE_STROKE_PROP_OBJECTVALUE 0
|
||||||
|
|
||||||
// text-anchor
|
// text-anchor
|
||||||
#define NS_STYLE_TEXT_ANCHOR_START 0
|
#define NS_STYLE_TEXT_ANCHOR_START 0
|
||||||
@@ -943,9 +943,9 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
|||||||
#define NS_STYLE_TRANSFORM_STYLE_FLAT 0
|
#define NS_STYLE_TRANSFORM_STYLE_FLAT 0
|
||||||
#define NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D 1
|
#define NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D 1
|
||||||
|
|
||||||
// object {fill,stroke}-opacity inherited from context for SVG glyphs
|
// object {fill,stroke}-opacity for SVG glyphs
|
||||||
#define NS_STYLE_CONTEXT_FILL_OPACITY 0
|
#define NS_STYLE_OBJECT_FILL_OPACITY 0
|
||||||
#define NS_STYLE_CONTEXT_STROKE_OPACITY 1
|
#define NS_STYLE_OBJECT_STROKE_OPACITY 1
|
||||||
|
|
||||||
// blending
|
// blending
|
||||||
#define NS_STYLE_BLEND_NORMAL 0
|
#define NS_STYLE_BLEND_NORMAL 0
|
||||||
|
|||||||
@@ -2280,14 +2280,14 @@ enum nsStyleSVGPaintType {
|
|||||||
eStyleSVGPaintType_None = 1,
|
eStyleSVGPaintType_None = 1,
|
||||||
eStyleSVGPaintType_Color,
|
eStyleSVGPaintType_Color,
|
||||||
eStyleSVGPaintType_Server,
|
eStyleSVGPaintType_Server,
|
||||||
eStyleSVGPaintType_ContextFill,
|
eStyleSVGPaintType_ObjectFill,
|
||||||
eStyleSVGPaintType_ContextStroke
|
eStyleSVGPaintType_ObjectStroke
|
||||||
};
|
};
|
||||||
|
|
||||||
enum nsStyleSVGOpacitySource {
|
enum nsStyleSVGOpacitySource {
|
||||||
eStyleSVGOpacitySource_Normal,
|
eStyleSVGOpacitySource_Normal,
|
||||||
eStyleSVGOpacitySource_ContextFillOpacity,
|
eStyleSVGOpacitySource_ObjectFillOpacity,
|
||||||
eStyleSVGOpacitySource_ContextStrokeOpacity
|
eStyleSVGOpacitySource_ObjectStrokeOpacity
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nsStyleSVGPaint
|
struct nsStyleSVGPaint
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ MOCHITEST_FILES = test_acid3_test46.html \
|
|||||||
test_bug716226.html \
|
test_bug716226.html \
|
||||||
test_bug765590.html \
|
test_bug765590.html \
|
||||||
test_bug798567.html \
|
test_bug798567.html \
|
||||||
test_bug798843_pref.html \
|
|
||||||
test_bug829816.html \
|
test_bug829816.html \
|
||||||
file_bug829816.css \
|
file_bug829816.css \
|
||||||
test_bug887741_at-rules_in_declaration_lists.html \
|
test_bug887741_at-rules_in_declaration_lists.html \
|
||||||
|
|||||||
@@ -3479,14 +3479,14 @@ var gCSSProperties = {
|
|||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
prerequisites: { "color": "blue" },
|
prerequisites: { "color": "blue" },
|
||||||
initial_values: [ "black", "#000", "#000000", "rgb(0,0,0)", "rgba(0,0,0,1)" ],
|
initial_values: [ "black", "#000", "#000000", "rgb(0,0,0)", "rgba(0,0,0,1)" ],
|
||||||
other_values: [ "green", "#fc3", "url('#myserver')", "url(foo.svg#myserver)", 'url("#myserver") green', "none", "currentColor", "context-fill", "context-stroke" ],
|
other_values: [ "green", "#fc3", "url('#myserver')", "url(foo.svg#myserver)", 'url("#myserver") green', "none", "currentColor", "-moz-objectFill", "-moz-objectStroke" ],
|
||||||
invalid_values: [ "000000", "ff00ff" ]
|
invalid_values: [ "000000", "ff00ff" ]
|
||||||
},
|
},
|
||||||
"fill-opacity": {
|
"fill-opacity": {
|
||||||
domProp: "fillOpacity",
|
domProp: "fillOpacity",
|
||||||
inherited: true,
|
inherited: true,
|
||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
initial_values: [ "1", "2.8", "1.000", "context-fill-opacity", "context-stroke-opacity" ],
|
initial_values: [ "1", "2.8", "1.000", "-moz-objectFillOpacity", "-moz-objectStrokeOpacity" ],
|
||||||
other_values: [ "0", "0.3", "-7.3" ],
|
other_values: [ "0", "0.3", "-7.3" ],
|
||||||
invalid_values: []
|
invalid_values: []
|
||||||
},
|
},
|
||||||
@@ -3611,14 +3611,14 @@ var gCSSProperties = {
|
|||||||
inherited: true,
|
inherited: true,
|
||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
initial_values: [ "none" ],
|
initial_values: [ "none" ],
|
||||||
other_values: [ "black", "#000", "#000000", "rgb(0,0,0)", "rgba(0,0,0,1)", "green", "#fc3", "url('#myserver')", "url(foo.svg#myserver)", 'url("#myserver") green', "currentColor", "context-fill", "context-stroke" ],
|
other_values: [ "black", "#000", "#000000", "rgb(0,0,0)", "rgba(0,0,0,1)", "green", "#fc3", "url('#myserver')", "url(foo.svg#myserver)", 'url("#myserver") green', "currentColor", "-moz-objectFill", "-moz-objectStroke" ],
|
||||||
invalid_values: [ "000000", "ff00ff" ]
|
invalid_values: [ "000000", "ff00ff" ]
|
||||||
},
|
},
|
||||||
"stroke-dasharray": {
|
"stroke-dasharray": {
|
||||||
domProp: "strokeDasharray",
|
domProp: "strokeDasharray",
|
||||||
inherited: true,
|
inherited: true,
|
||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
initial_values: [ "none", "context-value" ],
|
initial_values: [ "none", "-moz-objectValue" ],
|
||||||
other_values: [ "5px,3px,2px", "5px 3px 2px", " 5px ,3px , 2px ", "1px", "5%", "3em" ],
|
other_values: [ "5px,3px,2px", "5px 3px 2px", " 5px ,3px , 2px ", "1px", "5%", "3em" ],
|
||||||
invalid_values: [ "-5px,3px,2px", "5px,3px,-2px" ]
|
invalid_values: [ "-5px,3px,2px", "5px,3px,-2px" ]
|
||||||
},
|
},
|
||||||
@@ -3626,7 +3626,7 @@ var gCSSProperties = {
|
|||||||
domProp: "strokeDashoffset",
|
domProp: "strokeDashoffset",
|
||||||
inherited: true,
|
inherited: true,
|
||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
initial_values: [ "0", "-0px", "0em", "context-value" ],
|
initial_values: [ "0", "-0px", "0em", "-moz-objectValue" ],
|
||||||
other_values: [ "3px", "3%", "1em" ],
|
other_values: [ "3px", "3%", "1em" ],
|
||||||
invalid_values: []
|
invalid_values: []
|
||||||
},
|
},
|
||||||
@@ -3658,7 +3658,7 @@ var gCSSProperties = {
|
|||||||
domProp: "strokeOpacity",
|
domProp: "strokeOpacity",
|
||||||
inherited: true,
|
inherited: true,
|
||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
initial_values: [ "1", "2.8", "1.000", "context-fill-opacity", "context-stroke-opacity" ],
|
initial_values: [ "1", "2.8", "1.000", "-moz-objectFillOpacity", "-moz-objectStrokeOpacity" ],
|
||||||
other_values: [ "0", "0.3", "-7.3" ],
|
other_values: [ "0", "0.3", "-7.3" ],
|
||||||
invalid_values: []
|
invalid_values: []
|
||||||
},
|
},
|
||||||
@@ -3666,7 +3666,7 @@ var gCSSProperties = {
|
|||||||
domProp: "strokeWidth",
|
domProp: "strokeWidth",
|
||||||
inherited: true,
|
inherited: true,
|
||||||
type: CSS_TYPE_LONGHAND,
|
type: CSS_TYPE_LONGHAND,
|
||||||
initial_values: [ "1px", "context-value" ],
|
initial_values: [ "1px", "-moz-objectValue" ],
|
||||||
other_values: [ "0", "0px", "-0em", "17px", "0.2em" ],
|
other_values: [ "0", "0px", "-0em", "17px", "0.2em" ],
|
||||||
invalid_values: [ "-0.1px", "-3px" ]
|
invalid_values: [ "-0.1px", "-3px" ]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<!--
|
|
||||||
Make sure that the SVG glyph context-* values are not considered real values
|
|
||||||
when gfx.font_rendering.opentype_svg.enabled is pref'ed off.
|
|
||||||
-->
|
|
||||||
<head>
|
|
||||||
<title>Test that SVG glyph context-* values can be pref'ed off</title>
|
|
||||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
var props = {
|
|
||||||
"fill" : "context-stroke none",
|
|
||||||
"stroke" : "context-fill none",
|
|
||||||
"fillOpacity" : "context-stroke-opacity",
|
|
||||||
"strokeOpacity" : "context-fill-opacity",
|
|
||||||
"strokeDasharray" : "context-value",
|
|
||||||
"strokeDashoffset" : "context-value",
|
|
||||||
"strokeWidth" : "context-value"
|
|
||||||
};
|
|
||||||
|
|
||||||
function testDisabled() {
|
|
||||||
for (var p in props) {
|
|
||||||
document.body.style[p] = props[p];
|
|
||||||
is(document.body.style[p], "", p + " not settable to " + props[p]);
|
|
||||||
document.body.style[p] = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function testEnabled() {
|
|
||||||
for (var p in props) {
|
|
||||||
document.body.style[p] = props[p];
|
|
||||||
is(document.body.style[p], props[p], p + " settable to " + props[p]);
|
|
||||||
document.body.style[p] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
SpecialPowers.pushPrefEnv(
|
|
||||||
{'set': [['gfx.font_rendering.opentype_svg.enabled', false]]},
|
|
||||||
testDisabled
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
SpecialPowers.pushPrefEnv(
|
|
||||||
{'set': [['gfx.font_rendering.opentype_svg.enabled', true]]},
|
|
||||||
testEnabled
|
|
||||||
);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -416,11 +416,11 @@ nsSVGGlyphFrame::PaintSVG(nsRenderingContext *aContext,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxTextContextPaint *outerContextPaint =
|
gfxTextObjectPaint *outerObjectPaint =
|
||||||
(gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey);
|
(gfxTextObjectPaint*)aContext->GetUserData(&gfxTextObjectPaint::sUserDataKey);
|
||||||
|
|
||||||
nsAutoPtr<gfxTextContextPaint> objectPaint;
|
nsAutoPtr<gfxTextObjectPaint> objectPaint;
|
||||||
DrawMode drawMode = SetupCairoState(gfx, outerContextPaint, getter_Transfers(objectPaint));
|
DrawMode drawMode = SetupCairoState(gfx, outerObjectPaint, getter_Transfers(objectPaint));
|
||||||
|
|
||||||
if (drawMode) {
|
if (drawMode) {
|
||||||
DrawCharacters(&iter, gfx, drawMode, objectPaint);
|
DrawCharacters(&iter, gfx, drawMode, objectPaint);
|
||||||
@@ -587,7 +587,7 @@ void
|
|||||||
nsSVGGlyphFrame::DrawCharacters(CharacterIterator *aIter,
|
nsSVGGlyphFrame::DrawCharacters(CharacterIterator *aIter,
|
||||||
gfxContext *aContext,
|
gfxContext *aContext,
|
||||||
DrawMode aDrawMode,
|
DrawMode aDrawMode,
|
||||||
gfxTextContextPaint *aContextPaint)
|
gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
if (aDrawMode & gfxFont::GLYPH_STROKE) {
|
if (aDrawMode & gfxFont::GLYPH_STROKE) {
|
||||||
aIter->SetLineWidthAndDashesForDrawing(aContext);
|
aIter->SetLineWidthAndDashesForDrawing(aContext);
|
||||||
@@ -595,7 +595,7 @@ nsSVGGlyphFrame::DrawCharacters(CharacterIterator *aIter,
|
|||||||
|
|
||||||
if (aIter->SetupForDirectTextRunDrawing(aContext)) {
|
if (aIter->SetupForDirectTextRunDrawing(aContext)) {
|
||||||
mTextRun->Draw(aContext, gfxPoint(0, 0), aDrawMode, 0,
|
mTextRun->Draw(aContext, gfxPoint(0, 0), aDrawMode, 0,
|
||||||
mTextRun->GetLength(), nullptr, nullptr, aContextPaint);
|
mTextRun->GetLength(), nullptr, nullptr, aObjectPaint);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ nsSVGGlyphFrame::DrawCharacters(CharacterIterator *aIter,
|
|||||||
while ((i = aIter->NextCluster()) != aIter->InvalidCluster()) {
|
while ((i = aIter->NextCluster()) != aIter->InvalidCluster()) {
|
||||||
aIter->SetupForDrawing(aContext);
|
aIter->SetupForDrawing(aContext);
|
||||||
mTextRun->Draw(aContext, gfxPoint(0, 0), aDrawMode, i,
|
mTextRun->Draw(aContext, gfxPoint(0, 0), aDrawMode, i,
|
||||||
aIter->ClusterLength(), nullptr, nullptr, aContextPaint);
|
aIter->ClusterLength(), nullptr, nullptr, aObjectPaint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,17 +929,17 @@ nsSVGGlyphFrame::GetBaselineOffset(float aMetricsScale)
|
|||||||
|
|
||||||
DrawMode
|
DrawMode
|
||||||
nsSVGGlyphFrame::SetupCairoState(gfxContext *aContext,
|
nsSVGGlyphFrame::SetupCairoState(gfxContext *aContext,
|
||||||
gfxTextContextPaint *aOuterContextPaint,
|
gfxTextObjectPaint *aOuterObjectPaint,
|
||||||
gfxTextContextPaint **aThisContextPaint)
|
gfxTextObjectPaint **aThisObjectPaint)
|
||||||
{
|
{
|
||||||
DrawMode toDraw = DrawMode(0);
|
DrawMode toDraw = DrawMode(0);
|
||||||
SVGTextContextPaint *thisContextPaint = new SVGTextContextPaint();
|
SVGTextObjectPaint *thisObjectPaint = new SVGTextObjectPaint();
|
||||||
|
|
||||||
if (SetupCairoStroke(aContext, aOuterContextPaint, thisContextPaint)) {
|
if (SetupCairoStroke(aContext, aOuterObjectPaint, thisObjectPaint)) {
|
||||||
toDraw = DrawMode(toDraw | gfxFont::GLYPH_STROKE);
|
toDraw = DrawMode(toDraw | gfxFont::GLYPH_STROKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetupCairoFill(aContext, aOuterContextPaint, thisContextPaint)) {
|
if (SetupCairoFill(aContext, aOuterObjectPaint, thisObjectPaint)) {
|
||||||
toDraw = DrawMode(toDraw | gfxFont::GLYPH_FILL);
|
toDraw = DrawMode(toDraw | gfxFont::GLYPH_FILL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -957,55 +957,55 @@ nsSVGGlyphFrame::SetupCairoState(gfxContext *aContext,
|
|||||||
paintOrder >>= NS_STYLE_PAINT_ORDER_BITWIDTH;
|
paintOrder >>= NS_STYLE_PAINT_ORDER_BITWIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
*aThisContextPaint = thisContextPaint;
|
*aThisObjectPaint = thisObjectPaint;
|
||||||
|
|
||||||
return toDraw;
|
return toDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGGlyphFrame::SetupCairoStroke(gfxContext *aContext,
|
nsSVGGlyphFrame::SetupCairoStroke(gfxContext *aContext,
|
||||||
gfxTextContextPaint *aOuterContextPaint,
|
gfxTextObjectPaint *aOuterObjectPaint,
|
||||||
SVGTextContextPaint *aThisContextPaint)
|
SVGTextObjectPaint *aThisObjectPaint)
|
||||||
{
|
{
|
||||||
if (!nsSVGUtils::HasStroke(this, aOuterContextPaint)) {
|
if (!nsSVGUtils::HasStroke(this, aOuterObjectPaint)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nsStyleSVG *style = StyleSVG();
|
const nsStyleSVG *style = StyleSVG();
|
||||||
nsSVGUtils::SetupCairoStrokeGeometry(this, aContext, aOuterContextPaint);
|
nsSVGUtils::SetupCairoStrokeGeometry(this, aContext, aOuterObjectPaint);
|
||||||
float opacity = nsSVGUtils::GetOpacity(style->mStrokeOpacitySource,
|
float opacity = nsSVGUtils::GetOpacity(style->mStrokeOpacitySource,
|
||||||
style->mStrokeOpacity,
|
style->mStrokeOpacity,
|
||||||
aOuterContextPaint);
|
aOuterObjectPaint);
|
||||||
|
|
||||||
SetupInheritablePaint(aContext, opacity, aOuterContextPaint,
|
SetupInheritablePaint(aContext, opacity, aOuterObjectPaint,
|
||||||
aThisContextPaint->mStrokePaint, &nsStyleSVG::mStroke,
|
aThisObjectPaint->mStrokePaint, &nsStyleSVG::mStroke,
|
||||||
nsSVGEffects::StrokeProperty());
|
nsSVGEffects::StrokeProperty());
|
||||||
|
|
||||||
aThisContextPaint->SetStrokeOpacity(opacity);
|
aThisObjectPaint->SetStrokeOpacity(opacity);
|
||||||
|
|
||||||
return opacity != 0.0f;
|
return opacity != 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGGlyphFrame::SetupCairoFill(gfxContext *aContext,
|
nsSVGGlyphFrame::SetupCairoFill(gfxContext *aContext,
|
||||||
gfxTextContextPaint *aOuterContextPaint,
|
gfxTextObjectPaint *aOuterObjectPaint,
|
||||||
SVGTextContextPaint *aThisContextPaint)
|
SVGTextObjectPaint *aThisObjectPaint)
|
||||||
{
|
{
|
||||||
const nsStyleSVG *style = StyleSVG();
|
const nsStyleSVG *style = StyleSVG();
|
||||||
if (style->mFill.mType == eStyleSVGPaintType_None) {
|
if (style->mFill.mType == eStyleSVGPaintType_None) {
|
||||||
aThisContextPaint->SetFillOpacity(0.0f);
|
aThisObjectPaint->SetFillOpacity(0.0f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float opacity = nsSVGUtils::GetOpacity(style->mFillOpacitySource,
|
float opacity = nsSVGUtils::GetOpacity(style->mFillOpacitySource,
|
||||||
style->mFillOpacity,
|
style->mFillOpacity,
|
||||||
aOuterContextPaint);
|
aOuterObjectPaint);
|
||||||
|
|
||||||
SetupInheritablePaint(aContext, opacity, aOuterContextPaint,
|
SetupInheritablePaint(aContext, opacity, aOuterObjectPaint,
|
||||||
aThisContextPaint->mFillPaint, &nsStyleSVG::mFill,
|
aThisObjectPaint->mFillPaint, &nsStyleSVG::mFill,
|
||||||
nsSVGEffects::FillProperty());
|
nsSVGEffects::FillProperty());
|
||||||
|
|
||||||
aThisContextPaint->SetFillOpacity(opacity);
|
aThisObjectPaint->SetFillOpacity(opacity);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1013,8 +1013,8 @@ nsSVGGlyphFrame::SetupCairoFill(gfxContext *aContext,
|
|||||||
void
|
void
|
||||||
nsSVGGlyphFrame::SetupInheritablePaint(gfxContext *aContext,
|
nsSVGGlyphFrame::SetupInheritablePaint(gfxContext *aContext,
|
||||||
float& aOpacity,
|
float& aOpacity,
|
||||||
gfxTextContextPaint *aOuterContextPaint,
|
gfxTextObjectPaint *aOuterObjectPaint,
|
||||||
SVGTextContextPaint::Paint& aTargetPaint,
|
SVGTextObjectPaint::Paint& aTargetPaint,
|
||||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||||
const FramePropertyDescriptor *aProperty)
|
const FramePropertyDescriptor *aProperty)
|
||||||
{
|
{
|
||||||
@@ -1024,8 +1024,8 @@ nsSVGGlyphFrame::SetupInheritablePaint(gfxContext *aContext,
|
|||||||
|
|
||||||
if (ps && ps->SetupPaintServer(aContext, this, aFillOrStroke, aOpacity)) {
|
if (ps && ps->SetupPaintServer(aContext, this, aFillOrStroke, aOpacity)) {
|
||||||
aTargetPaint.SetPaintServer(this, aContext->CurrentMatrix(), ps);
|
aTargetPaint.SetPaintServer(this, aContext->CurrentMatrix(), ps);
|
||||||
} else if (SetupContextPaint(aContext, aFillOrStroke, aOpacity, aOuterContextPaint)) {
|
} else if (SetupObjectPaint(aContext, aFillOrStroke, aOpacity, aOuterObjectPaint)) {
|
||||||
aTargetPaint.SetContextPaint(aOuterContextPaint, (style->*aFillOrStroke).mType);
|
aTargetPaint.SetObjectPaint(aOuterObjectPaint, (style->*aFillOrStroke).mType);
|
||||||
} else {
|
} else {
|
||||||
nscolor color = nsSVGUtils::GetFallbackOrPaintColor(aContext,
|
nscolor color = nsSVGUtils::GetFallbackOrPaintColor(aContext,
|
||||||
StyleContext(),
|
StyleContext(),
|
||||||
@@ -1043,12 +1043,12 @@ nsSVGGlyphFrame::SetupInheritablePaint(gfxContext *aContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGGlyphFrame::SetupContextPaint(gfxContext *aContext,
|
nsSVGGlyphFrame::SetupObjectPaint(gfxContext *aContext,
|
||||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||||
float& aOpacity,
|
float& aOpacity,
|
||||||
gfxTextContextPaint *aOuterContextPaint)
|
gfxTextObjectPaint *aOuterObjectPaint)
|
||||||
{
|
{
|
||||||
if (!aOuterContextPaint) {
|
if (!aOuterObjectPaint) {
|
||||||
NS_WARNING("Outer object paint value used outside SVG glyph");
|
NS_WARNING("Outer object paint value used outside SVG glyph");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1056,16 +1056,16 @@ nsSVGGlyphFrame::SetupContextPaint(gfxContext *aContext,
|
|||||||
const nsStyleSVG *style = StyleSVG();
|
const nsStyleSVG *style = StyleSVG();
|
||||||
const nsStyleSVGPaint &paint = style->*aFillOrStroke;
|
const nsStyleSVGPaint &paint = style->*aFillOrStroke;
|
||||||
|
|
||||||
if (paint.mType != eStyleSVGPaintType_ContextFill &&
|
if (paint.mType != eStyleSVGPaintType_ObjectFill &&
|
||||||
paint.mType != eStyleSVGPaintType_ContextStroke) {
|
paint.mType != eStyleSVGPaintType_ObjectStroke) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxMatrix current = aContext->CurrentMatrix();
|
gfxMatrix current = aContext->CurrentMatrix();
|
||||||
nsRefPtr<gfxPattern> pattern =
|
nsRefPtr<gfxPattern> pattern =
|
||||||
paint.mType == eStyleSVGPaintType_ContextFill ?
|
paint.mType == eStyleSVGPaintType_ObjectFill ?
|
||||||
aOuterContextPaint->GetFillPattern(aOpacity, current) :
|
aOuterObjectPaint->GetFillPattern(aOpacity, current) :
|
||||||
aOuterContextPaint->GetStrokePattern(aOpacity, current);
|
aOuterObjectPaint->GetStrokePattern(aOpacity, current);
|
||||||
if (!pattern) {
|
if (!pattern) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1075,24 +1075,24 @@ nsSVGGlyphFrame::SetupContextPaint(gfxContext *aContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// SVGTextContextPaint methods:
|
// SVGTextObjectPaint methods:
|
||||||
|
|
||||||
already_AddRefed<gfxPattern>
|
already_AddRefed<gfxPattern>
|
||||||
mozilla::SVGTextContextPaint::GetFillPattern(float aOpacity,
|
mozilla::SVGTextObjectPaint::GetFillPattern(float aOpacity,
|
||||||
const gfxMatrix& aCTM)
|
const gfxMatrix& aCTM)
|
||||||
{
|
{
|
||||||
return mFillPaint.GetPattern(aOpacity, &nsStyleSVG::mFill, aCTM);
|
return mFillPaint.GetPattern(aOpacity, &nsStyleSVG::mFill, aCTM);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<gfxPattern>
|
already_AddRefed<gfxPattern>
|
||||||
mozilla::SVGTextContextPaint::GetStrokePattern(float aOpacity,
|
mozilla::SVGTextObjectPaint::GetStrokePattern(float aOpacity,
|
||||||
const gfxMatrix& aCTM)
|
const gfxMatrix& aCTM)
|
||||||
{
|
{
|
||||||
return mStrokePaint.GetPattern(aOpacity, &nsStyleSVG::mStroke, aCTM);
|
return mStrokePaint.GetPattern(aOpacity, &nsStyleSVG::mStroke, aCTM);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<gfxPattern>
|
already_AddRefed<gfxPattern>
|
||||||
mozilla::SVGTextContextPaint::Paint::GetPattern(float aOpacity,
|
mozilla::SVGTextObjectPaint::Paint::GetPattern(float aOpacity,
|
||||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||||
const gfxMatrix& aCTM)
|
const gfxMatrix& aCTM)
|
||||||
{
|
{
|
||||||
@@ -1132,14 +1132,14 @@ mozilla::SVGTextContextPaint::Paint::GetPattern(float aOpacity,
|
|||||||
}
|
}
|
||||||
pattern->SetMatrix(aCTM * mPatternMatrix);
|
pattern->SetMatrix(aCTM * mPatternMatrix);
|
||||||
break;
|
break;
|
||||||
case eStyleSVGPaintType_ContextFill:
|
case eStyleSVGPaintType_ObjectFill:
|
||||||
pattern = mPaintDefinition.mContextPaint->GetFillPattern(aOpacity, aCTM);
|
pattern = mPaintDefinition.mObjectPaint->GetFillPattern(aOpacity, aCTM);
|
||||||
// Don't cache this. mContextPaint will have cached it anyway. If we
|
// Don't cache this. mObjectPaint will have cached it anyway. If we
|
||||||
// cache it, we'll have to compute mPatternMatrix, which is annoying.
|
// cache it, we'll have to compute mPatternMatrix, which is annoying.
|
||||||
return pattern.forget();
|
return pattern.forget();
|
||||||
case eStyleSVGPaintType_ContextStroke:
|
case eStyleSVGPaintType_ObjectStroke:
|
||||||
pattern = mPaintDefinition.mContextPaint->GetStrokePattern(aOpacity, aCTM);
|
pattern = mPaintDefinition.mObjectPaint->GetStrokePattern(aOpacity, aCTM);
|
||||||
// Don't cache this. mContextPaint will have cached it anyway. If we
|
// Don't cache this. mObjectPaint will have cached it anyway. If we
|
||||||
// cache it, we'll have to compute mPatternMatrix, which is annoying.
|
// cache it, we'll have to compute mPatternMatrix, which is annoying.
|
||||||
return pattern.forget();
|
return pattern.forget();
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class nsRenderingContext;
|
|||||||
class nsSVGGlyphFrame;
|
class nsSVGGlyphFrame;
|
||||||
class nsSVGTextFrame;
|
class nsSVGTextFrame;
|
||||||
class nsSVGTextPathFrame;
|
class nsSVGTextPathFrame;
|
||||||
class gfxTextContextPaint;
|
class gfxTextObjectPaint;
|
||||||
|
|
||||||
struct CharacterPosition;
|
struct CharacterPosition;
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ class SVGIRect;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Slightly horrible callback for deferring application of opacity
|
// Slightly horrible callback for deferring application of opacity
|
||||||
struct SVGTextContextPaint : public gfxTextContextPaint {
|
struct SVGTextObjectPaint : public gfxTextObjectPaint {
|
||||||
already_AddRefed<gfxPattern> GetFillPattern(float aOpacity,
|
already_AddRefed<gfxPattern> GetFillPattern(float aOpacity,
|
||||||
const gfxMatrix& aCTM) MOZ_OVERRIDE;
|
const gfxMatrix& aCTM) MOZ_OVERRIDE;
|
||||||
already_AddRefed<gfxPattern> GetStrokePattern(float aOpacity,
|
already_AddRefed<gfxPattern> GetStrokePattern(float aOpacity,
|
||||||
@@ -61,18 +61,18 @@ struct SVGTextContextPaint : public gfxTextContextPaint {
|
|||||||
mPaintDefinition.mColor = aColor;
|
mPaintDefinition.mColor = aColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetContextPaint(gfxTextContextPaint *aContextPaint,
|
void SetObjectPaint(gfxTextObjectPaint *aObjectPaint,
|
||||||
nsStyleSVGPaintType aPaintType) {
|
nsStyleSVGPaintType aPaintType) {
|
||||||
NS_ASSERTION(aPaintType == eStyleSVGPaintType_ContextFill ||
|
NS_ASSERTION(aPaintType == eStyleSVGPaintType_ObjectFill ||
|
||||||
aPaintType == eStyleSVGPaintType_ContextStroke,
|
aPaintType == eStyleSVGPaintType_ObjectStroke,
|
||||||
"Invalid context paint type");
|
"Invalid object paint type");
|
||||||
mPaintType = aPaintType;
|
mPaintType = aPaintType;
|
||||||
mPaintDefinition.mContextPaint = aContextPaint;
|
mPaintDefinition.mObjectPaint = aObjectPaint;
|
||||||
}
|
}
|
||||||
|
|
||||||
union {
|
union {
|
||||||
nsSVGPaintServerFrame *mPaintServerFrame;
|
nsSVGPaintServerFrame *mPaintServerFrame;
|
||||||
gfxTextContextPaint *mContextPaint;
|
gfxTextObjectPaint *mObjectPaint;
|
||||||
nscolor mColor;
|
nscolor mColor;
|
||||||
} mPaintDefinition;
|
} mPaintDefinition;
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ private:
|
|||||||
void DrawCharacters(CharacterIterator *aIter,
|
void DrawCharacters(CharacterIterator *aIter,
|
||||||
gfxContext *aContext,
|
gfxContext *aContext,
|
||||||
DrawMode aDrawMode,
|
DrawMode aDrawMode,
|
||||||
gfxTextContextPaint *aContextPaint = nullptr);
|
gfxTextObjectPaint *aObjectPaint = nullptr);
|
||||||
|
|
||||||
void NotifyGlyphMetricsChange();
|
void NotifyGlyphMetricsChange();
|
||||||
void SetupGlobalTransform(gfxContext *aContext, uint32_t aFor,
|
void SetupGlobalTransform(gfxContext *aContext, uint32_t aFor,
|
||||||
@@ -340,40 +340,40 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DrawMode SetupCairoState(gfxContext *aContext,
|
DrawMode SetupCairoState(gfxContext *aContext,
|
||||||
gfxTextContextPaint *aOuterContextPaint,
|
gfxTextObjectPaint *aOuterObjectPaint,
|
||||||
gfxTextContextPaint **aThisContextPaint);
|
gfxTextObjectPaint **aThisObjectPaint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the stroke style in |aContext| and stores stroke pattern
|
* Sets up the stroke style in |aContext| and stores stroke pattern
|
||||||
* information in |aThisContextPaint|.
|
* information in |aThisObjectPaint|.
|
||||||
*/
|
*/
|
||||||
bool SetupCairoStroke(gfxContext *aContext,
|
bool SetupCairoStroke(gfxContext *aContext,
|
||||||
gfxTextContextPaint *aOuterContextPaint,
|
gfxTextObjectPaint *aOuterObjectPaint,
|
||||||
SVGTextContextPaint *aThisContextPaint);
|
SVGTextObjectPaint *aThisObjectPaint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the fill style in |aContext| and stores fill pattern information
|
* Sets up the fill style in |aContext| and stores fill pattern information
|
||||||
* in |aThisContextPaint|.
|
* in |aThisObjectPaint|.
|
||||||
*/
|
*/
|
||||||
bool SetupCairoFill(gfxContext *aContext,
|
bool SetupCairoFill(gfxContext *aContext,
|
||||||
gfxTextContextPaint *aOuterContextPaint,
|
gfxTextObjectPaint *aOuterObjectPaint,
|
||||||
SVGTextContextPaint *aThisContextPaint);
|
SVGTextObjectPaint *aThisObjectPaint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current pattern to the fill or stroke style of the outer text
|
* Sets the current pattern to the fill or stroke style of the outer text
|
||||||
* context. Will also set the paint opacity to transparent if the paint is set
|
* object. Will also set the paint opacity to transparent if the paint is set
|
||||||
* to "none".
|
* to "none".
|
||||||
*/
|
*/
|
||||||
bool SetupContextPaint(gfxContext *aContext,
|
bool SetupObjectPaint(gfxContext *aContext,
|
||||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||||
float& aOpacity,
|
float& aOpacity,
|
||||||
gfxTextContextPaint *aContextPaint);
|
gfxTextObjectPaint *aObjectPaint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores in |aTargetPaint| information on how to reconstruct the current
|
* Stores in |aTargetPaint| information on how to reconstruct the current
|
||||||
* fill or stroke pattern. Will also set the paint opacity to transparent if
|
* fill or stroke pattern. Will also set the paint opacity to transparent if
|
||||||
* the paint is set to "none".
|
* the paint is set to "none".
|
||||||
* @param aOuterContextPaint pattern information from the outer text context
|
* @param aOuterObjectPaint pattern information from the outer text object
|
||||||
* @param aTargetPaint where to store the current pattern information
|
* @param aTargetPaint where to store the current pattern information
|
||||||
* @param aFillOrStroke member pointer to the paint we are setting up
|
* @param aFillOrStroke member pointer to the paint we are setting up
|
||||||
* @param aProperty the frame property descriptor of the fill or stroke paint
|
* @param aProperty the frame property descriptor of the fill or stroke paint
|
||||||
@@ -381,8 +381,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
void SetupInheritablePaint(gfxContext *aContext,
|
void SetupInheritablePaint(gfxContext *aContext,
|
||||||
float& aOpacity,
|
float& aOpacity,
|
||||||
gfxTextContextPaint *aOuterContextPaint,
|
gfxTextObjectPaint *aOuterObjectPaint,
|
||||||
SVGTextContextPaint::Paint& aTargetPaint,
|
SVGTextObjectPaint::Paint& aTargetPaint,
|
||||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||||
const FramePropertyDescriptor *aProperty);
|
const FramePropertyDescriptor *aProperty);
|
||||||
|
|
||||||
|
|||||||
@@ -610,16 +610,16 @@ nsSVGPathGeometryFrame::Render(nsRenderingContext *aContext,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxTextContextPaint *contextPaint =
|
gfxTextObjectPaint *objectPaint =
|
||||||
(gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey);
|
(gfxTextObjectPaint*)aContext->GetUserData(&gfxTextObjectPaint::sUserDataKey);
|
||||||
|
|
||||||
if ((aRenderComponents & eRenderFill) &&
|
if ((aRenderComponents & eRenderFill) &&
|
||||||
nsSVGUtils::SetupCairoFillPaint(this, gfx, contextPaint)) {
|
nsSVGUtils::SetupCairoFillPaint(this, gfx, objectPaint)) {
|
||||||
gfx->Fill();
|
gfx->Fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((aRenderComponents & eRenderStroke) &&
|
if ((aRenderComponents & eRenderStroke) &&
|
||||||
nsSVGUtils::SetupCairoStroke(this, gfx, contextPaint)) {
|
nsSVGUtils::SetupCairoStroke(this, gfx, objectPaint)) {
|
||||||
gfx->Stroke();
|
gfx->Stroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,14 +653,14 @@ nsSVGPathGeometryFrame::GeneratePath(gfxContext* aContext,
|
|||||||
void
|
void
|
||||||
nsSVGPathGeometryFrame::PaintMarkers(nsRenderingContext* aContext)
|
nsSVGPathGeometryFrame::PaintMarkers(nsRenderingContext* aContext)
|
||||||
{
|
{
|
||||||
gfxTextContextPaint *contextPaint =
|
gfxTextObjectPaint *objectPaint =
|
||||||
(gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey);
|
(gfxTextObjectPaint*)aContext->GetUserData(&gfxTextObjectPaint::sUserDataKey);
|
||||||
|
|
||||||
if (static_cast<nsSVGPathGeometryElement*>(mContent)->IsMarkable()) {
|
if (static_cast<nsSVGPathGeometryElement*>(mContent)->IsMarkable()) {
|
||||||
MarkerProperties properties = GetMarkerProperties(this);
|
MarkerProperties properties = GetMarkerProperties(this);
|
||||||
|
|
||||||
if (properties.MarkersExist()) {
|
if (properties.MarkersExist()) {
|
||||||
float strokeWidth = nsSVGUtils::GetStrokeWidth(this, contextPaint);
|
float strokeWidth = nsSVGUtils::GetStrokeWidth(this, objectPaint);
|
||||||
|
|
||||||
nsTArray<nsSVGMark> marks;
|
nsTArray<nsSVGMark> marks;
|
||||||
static_cast<nsSVGPathGeometryElement*>
|
static_cast<nsSVGPathGeometryElement*>
|
||||||
|
|||||||
@@ -3525,13 +3525,13 @@ nsSVGTextFrame2::PaintSVG(nsRenderingContext* aContext,
|
|||||||
SVGCharClipDisplayItem item(run);
|
SVGCharClipDisplayItem item(run);
|
||||||
|
|
||||||
// Set up the fill and stroke so that SVG glyphs can get painted correctly
|
// Set up the fill and stroke so that SVG glyphs can get painted correctly
|
||||||
// when they use context-fill etc.
|
// when they use -moz-objectFill values etc.
|
||||||
gfx->SetMatrix(initialMatrix);
|
gfx->SetMatrix(initialMatrix);
|
||||||
gfxTextContextPaint *outerContextPaint =
|
gfxTextObjectPaint *outerObjectPaint =
|
||||||
(gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey);
|
(gfxTextObjectPaint*)aContext->GetUserData(&gfxTextObjectPaint::sUserDataKey);
|
||||||
|
|
||||||
nsAutoPtr<gfxTextContextPaint> contextPaint;
|
nsAutoPtr<gfxTextObjectPaint> objectPaint;
|
||||||
SetupCairoState(gfx, frame, outerContextPaint, getter_Transfers(contextPaint));
|
SetupCairoState(gfx, frame, outerObjectPaint, getter_Transfers(objectPaint));
|
||||||
|
|
||||||
// Set up the transform for painting the text frame for the substring
|
// Set up the transform for painting the text frame for the substring
|
||||||
// indicated by the run.
|
// indicated by the run.
|
||||||
@@ -3546,10 +3546,10 @@ nsSVGTextFrame2::PaintSVG(nsRenderingContext* aContext,
|
|||||||
SVGTextDrawPathCallbacks callbacks(aContext, frame, matrixForPaintServers,
|
SVGTextDrawPathCallbacks callbacks(aContext, frame, matrixForPaintServers,
|
||||||
paintSVGGlyphs);
|
paintSVGGlyphs);
|
||||||
frame->PaintText(aContext, nsPoint(), frameRect, item,
|
frame->PaintText(aContext, nsPoint(), frameRect, item,
|
||||||
contextPaint, &callbacks);
|
objectPaint, &callbacks);
|
||||||
} else {
|
} else {
|
||||||
frame->PaintText(aContext, nsPoint(), frameRect, item,
|
frame->PaintText(aContext, nsPoint(), frameRect, item,
|
||||||
contextPaint, nullptr);
|
objectPaint, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame == caretFrame && ShouldPaintCaret(run, caret)) {
|
if (frame == caretFrame && ShouldPaintCaret(run, caret)) {
|
||||||
@@ -5389,21 +5389,21 @@ nsSVGTextFrame2::TransformFrameRectFromTextChild(const nsRect& aRect,
|
|||||||
gfxFont::DrawMode
|
gfxFont::DrawMode
|
||||||
nsSVGTextFrame2::SetupCairoState(gfxContext* aContext,
|
nsSVGTextFrame2::SetupCairoState(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
gfxTextContextPaint* aOuterContextPaint,
|
gfxTextObjectPaint* aOuterObjectPaint,
|
||||||
gfxTextContextPaint** aThisContextPaint)
|
gfxTextObjectPaint** aThisObjectPaint)
|
||||||
{
|
{
|
||||||
gfxFont::DrawMode toDraw = gfxFont::DrawMode(0);
|
gfxFont::DrawMode toDraw = gfxFont::DrawMode(0);
|
||||||
SVGTextContextPaint *thisContextPaint = new SVGTextContextPaint();
|
SVGTextObjectPaint *thisObjectPaint = new SVGTextObjectPaint();
|
||||||
|
|
||||||
if (SetupCairoStroke(aContext, aFrame, aOuterContextPaint, thisContextPaint)) {
|
if (SetupCairoStroke(aContext, aFrame, aOuterObjectPaint, thisObjectPaint)) {
|
||||||
toDraw = gfxFont::DrawMode(toDraw | gfxFont::GLYPH_STROKE);
|
toDraw = gfxFont::DrawMode(toDraw | gfxFont::GLYPH_STROKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SetupCairoFill(aContext, aFrame, aOuterContextPaint, thisContextPaint)) {
|
if (SetupCairoFill(aContext, aFrame, aOuterObjectPaint, thisObjectPaint)) {
|
||||||
toDraw = gfxFont::DrawMode(toDraw | gfxFont::GLYPH_FILL);
|
toDraw = gfxFont::DrawMode(toDraw | gfxFont::GLYPH_FILL);
|
||||||
}
|
}
|
||||||
|
|
||||||
*aThisContextPaint = thisContextPaint;
|
*aThisObjectPaint = thisObjectPaint;
|
||||||
|
|
||||||
return toDraw;
|
return toDraw;
|
||||||
}
|
}
|
||||||
@@ -5411,25 +5411,25 @@ nsSVGTextFrame2::SetupCairoState(gfxContext* aContext,
|
|||||||
bool
|
bool
|
||||||
nsSVGTextFrame2::SetupCairoStroke(gfxContext* aContext,
|
nsSVGTextFrame2::SetupCairoStroke(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
gfxTextContextPaint* aOuterContextPaint,
|
gfxTextObjectPaint* aOuterObjectPaint,
|
||||||
SVGTextContextPaint* aThisContextPaint)
|
SVGTextObjectPaint* aThisObjectPaint)
|
||||||
{
|
{
|
||||||
const nsStyleSVG *style = aFrame->StyleSVG();
|
const nsStyleSVG *style = aFrame->StyleSVG();
|
||||||
if (style->mStroke.mType == eStyleSVGPaintType_None) {
|
if (style->mStroke.mType == eStyleSVGPaintType_None) {
|
||||||
aThisContextPaint->SetStrokeOpacity(0.0f);
|
aThisObjectPaint->SetStrokeOpacity(0.0f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSVGUtils::SetupCairoStrokeGeometry(aFrame, aContext, aOuterContextPaint);
|
nsSVGUtils::SetupCairoStrokeGeometry(aFrame, aContext, aOuterObjectPaint);
|
||||||
float opacity = nsSVGUtils::GetOpacity(style->mStrokeOpacitySource,
|
float opacity = nsSVGUtils::GetOpacity(style->mStrokeOpacitySource,
|
||||||
style->mStrokeOpacity,
|
style->mStrokeOpacity,
|
||||||
aOuterContextPaint);
|
aOuterObjectPaint);
|
||||||
|
|
||||||
SetupInheritablePaint(aContext, aFrame, opacity, aOuterContextPaint,
|
SetupInheritablePaint(aContext, aFrame, opacity, aOuterObjectPaint,
|
||||||
aThisContextPaint->mStrokePaint, &nsStyleSVG::mStroke,
|
aThisObjectPaint->mStrokePaint, &nsStyleSVG::mStroke,
|
||||||
nsSVGEffects::StrokeProperty());
|
nsSVGEffects::StrokeProperty());
|
||||||
|
|
||||||
aThisContextPaint->SetStrokeOpacity(opacity);
|
aThisObjectPaint->SetStrokeOpacity(opacity);
|
||||||
|
|
||||||
return opacity != 0.0f;
|
return opacity != 0.0f;
|
||||||
}
|
}
|
||||||
@@ -5437,24 +5437,24 @@ nsSVGTextFrame2::SetupCairoStroke(gfxContext* aContext,
|
|||||||
bool
|
bool
|
||||||
nsSVGTextFrame2::SetupCairoFill(gfxContext* aContext,
|
nsSVGTextFrame2::SetupCairoFill(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
gfxTextContextPaint* aOuterContextPaint,
|
gfxTextObjectPaint* aOuterObjectPaint,
|
||||||
SVGTextContextPaint* aThisContextPaint)
|
SVGTextObjectPaint* aThisObjectPaint)
|
||||||
{
|
{
|
||||||
const nsStyleSVG *style = aFrame->StyleSVG();
|
const nsStyleSVG *style = aFrame->StyleSVG();
|
||||||
if (style->mFill.mType == eStyleSVGPaintType_None) {
|
if (style->mFill.mType == eStyleSVGPaintType_None) {
|
||||||
aThisContextPaint->SetFillOpacity(0.0f);
|
aThisObjectPaint->SetFillOpacity(0.0f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float opacity = nsSVGUtils::GetOpacity(style->mFillOpacitySource,
|
float opacity = nsSVGUtils::GetOpacity(style->mFillOpacitySource,
|
||||||
style->mFillOpacity,
|
style->mFillOpacity,
|
||||||
aOuterContextPaint);
|
aOuterObjectPaint);
|
||||||
|
|
||||||
SetupInheritablePaint(aContext, aFrame, opacity, aOuterContextPaint,
|
SetupInheritablePaint(aContext, aFrame, opacity, aOuterObjectPaint,
|
||||||
aThisContextPaint->mFillPaint, &nsStyleSVG::mFill,
|
aThisObjectPaint->mFillPaint, &nsStyleSVG::mFill,
|
||||||
nsSVGEffects::FillProperty());
|
nsSVGEffects::FillProperty());
|
||||||
|
|
||||||
aThisContextPaint->SetFillOpacity(opacity);
|
aThisObjectPaint->SetFillOpacity(opacity);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -5463,8 +5463,8 @@ void
|
|||||||
nsSVGTextFrame2::SetupInheritablePaint(gfxContext* aContext,
|
nsSVGTextFrame2::SetupInheritablePaint(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
float& aOpacity,
|
float& aOpacity,
|
||||||
gfxTextContextPaint* aOuterContextPaint,
|
gfxTextObjectPaint* aOuterObjectPaint,
|
||||||
SVGTextContextPaint::Paint& aTargetPaint,
|
SVGTextObjectPaint::Paint& aTargetPaint,
|
||||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||||
const FramePropertyDescriptor* aProperty)
|
const FramePropertyDescriptor* aProperty)
|
||||||
{
|
{
|
||||||
@@ -5474,8 +5474,8 @@ nsSVGTextFrame2::SetupInheritablePaint(gfxContext* aContext,
|
|||||||
|
|
||||||
if (ps && ps->SetupPaintServer(aContext, aFrame, aFillOrStroke, aOpacity)) {
|
if (ps && ps->SetupPaintServer(aContext, aFrame, aFillOrStroke, aOpacity)) {
|
||||||
aTargetPaint.SetPaintServer(aFrame, aContext->CurrentMatrix(), ps);
|
aTargetPaint.SetPaintServer(aFrame, aContext->CurrentMatrix(), ps);
|
||||||
} else if (SetupContextPaint(aContext, aFrame, aFillOrStroke, aOpacity, aOuterContextPaint)) {
|
} else if (SetupObjectPaint(aContext, aFrame, aFillOrStroke, aOpacity, aOuterObjectPaint)) {
|
||||||
aTargetPaint.SetContextPaint(aOuterContextPaint, (style->*aFillOrStroke).mType);
|
aTargetPaint.SetObjectPaint(aOuterObjectPaint, (style->*aFillOrStroke).mType);
|
||||||
} else {
|
} else {
|
||||||
nscolor color = nsSVGUtils::GetFallbackOrPaintColor(aContext,
|
nscolor color = nsSVGUtils::GetFallbackOrPaintColor(aContext,
|
||||||
aFrame->StyleContext(),
|
aFrame->StyleContext(),
|
||||||
@@ -5492,29 +5492,29 @@ nsSVGTextFrame2::SetupInheritablePaint(gfxContext* aContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGTextFrame2::SetupContextPaint(gfxContext* aContext,
|
nsSVGTextFrame2::SetupObjectPaint(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||||
float& aOpacity,
|
float& aOpacity,
|
||||||
gfxTextContextPaint* aOuterContextPaint)
|
gfxTextObjectPaint* aOuterObjectPaint)
|
||||||
{
|
{
|
||||||
if (!aOuterContextPaint) {
|
if (!aOuterObjectPaint) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nsStyleSVG *style = aFrame->StyleSVG();
|
const nsStyleSVG *style = aFrame->StyleSVG();
|
||||||
const nsStyleSVGPaint &paint = style->*aFillOrStroke;
|
const nsStyleSVGPaint &paint = style->*aFillOrStroke;
|
||||||
|
|
||||||
if (paint.mType != eStyleSVGPaintType_ContextFill &&
|
if (paint.mType != eStyleSVGPaintType_ObjectFill &&
|
||||||
paint.mType != eStyleSVGPaintType_ContextStroke) {
|
paint.mType != eStyleSVGPaintType_ObjectStroke) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxMatrix current = aContext->CurrentMatrix();
|
gfxMatrix current = aContext->CurrentMatrix();
|
||||||
nsRefPtr<gfxPattern> pattern =
|
nsRefPtr<gfxPattern> pattern =
|
||||||
paint.mType == eStyleSVGPaintType_ContextFill ?
|
paint.mType == eStyleSVGPaintType_ObjectFill ?
|
||||||
aOuterContextPaint->GetFillPattern(aOpacity, current) :
|
aOuterObjectPaint->GetFillPattern(aOpacity, current) :
|
||||||
aOuterContextPaint->GetStrokePattern(aOpacity, current);
|
aOuterObjectPaint->GetStrokePattern(aOpacity, current);
|
||||||
if (!pattern) {
|
if (!pattern) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "gfxRect.h"
|
#include "gfxRect.h"
|
||||||
#include "gfxSVGGlyphs.h"
|
#include "gfxSVGGlyphs.h"
|
||||||
#include "nsStubMutationObserver.h"
|
#include "nsStubMutationObserver.h"
|
||||||
#include "nsSVGGlyphFrame.h" // for SVGTextContextPaint
|
#include "nsSVGGlyphFrame.h" // for SVGTextObjectPaint
|
||||||
#include "nsSVGTextContainerFrame.h"
|
#include "nsSVGTextContainerFrame.h"
|
||||||
|
|
||||||
class nsDisplaySVGText;
|
class nsDisplaySVGText;
|
||||||
@@ -523,43 +523,43 @@ private:
|
|||||||
|
|
||||||
gfxFont::DrawMode SetupCairoState(gfxContext* aContext,
|
gfxFont::DrawMode SetupCairoState(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
gfxTextContextPaint* aOuterContextPaint,
|
gfxTextObjectPaint* aOuterObjectPaint,
|
||||||
gfxTextContextPaint** aThisContextPaint);
|
gfxTextObjectPaint** aThisObjectPaint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the stroke style for |aFrame| in |aContext| and stores stroke
|
* Sets up the stroke style for |aFrame| in |aContext| and stores stroke
|
||||||
* pattern information in |aThisContextPaint|.
|
* pattern information in |aThisObjectPaint|.
|
||||||
*/
|
*/
|
||||||
bool SetupCairoStroke(gfxContext* aContext,
|
bool SetupCairoStroke(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
gfxTextContextPaint* aOuterContextPaint,
|
gfxTextObjectPaint* aOuterObjectPaint,
|
||||||
SVGTextContextPaint* aThisContextPaint);
|
SVGTextObjectPaint* aThisObjectPaint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the fill style for |aFrame| in |aContext| and stores fill pattern
|
* Sets up the fill style for |aFrame| in |aContext| and stores fill pattern
|
||||||
* information in |aThisContextPaint|.
|
* information in |aThisObjectPaint|.
|
||||||
*/
|
*/
|
||||||
bool SetupCairoFill(gfxContext* aContext,
|
bool SetupCairoFill(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
gfxTextContextPaint* aOuterContextPaint,
|
gfxTextObjectPaint* aOuterObjectPaint,
|
||||||
SVGTextContextPaint* aThisContextPaint);
|
SVGTextObjectPaint* aThisObjectPaint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current pattern for |aFrame| to the fill or stroke style of the
|
* Sets the current pattern for |aFrame| to the fill or stroke style of the
|
||||||
* outer text context. Will also set the paint opacity to transparent if the
|
* outer text object. Will also set the paint opacity to transparent if the
|
||||||
* paint is set to "none".
|
* paint is set to "none".
|
||||||
*/
|
*/
|
||||||
bool SetupContextPaint(gfxContext* aContext,
|
bool SetupObjectPaint(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||||
float& aOpacity,
|
float& aOpacity,
|
||||||
gfxTextContextPaint* aContextPaint);
|
gfxTextObjectPaint* aObjectPaint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores in |aTargetPaint| information on how to reconstruct the current
|
* Stores in |aTargetPaint| information on how to reconstruct the current
|
||||||
* fill or stroke pattern. Will also set the paint opacity to transparent if
|
* fill or stroke pattern. Will also set the paint opacity to transparent if
|
||||||
* the paint is set to "none".
|
* the paint is set to "none".
|
||||||
* @param aOuterContextPaint pattern information from the outer text context
|
* @param aOuterObjectPaint pattern information from the outer text object
|
||||||
* @param aTargetPaint where to store the current pattern information
|
* @param aTargetPaint where to store the current pattern information
|
||||||
* @param aFillOrStroke member pointer to the paint we are setting up
|
* @param aFillOrStroke member pointer to the paint we are setting up
|
||||||
* @param aProperty the frame property descriptor of the fill or stroke paint
|
* @param aProperty the frame property descriptor of the fill or stroke paint
|
||||||
@@ -568,8 +568,8 @@ private:
|
|||||||
void SetupInheritablePaint(gfxContext* aContext,
|
void SetupInheritablePaint(gfxContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
float& aOpacity,
|
float& aOpacity,
|
||||||
gfxTextContextPaint* aOuterContextPaint,
|
gfxTextObjectPaint* aOuterObjectPaint,
|
||||||
SVGTextContextPaint::Paint& aTargetPaint,
|
SVGTextObjectPaint::Paint& aTargetPaint,
|
||||||
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
||||||
const FramePropertyDescriptor* aProperty);
|
const FramePropertyDescriptor* aProperty);
|
||||||
|
|
||||||
|
|||||||
@@ -1436,8 +1436,8 @@ nsSVGUtils::GetFallbackOrPaintColor(gfxContext *aContext, nsStyleContext *aStyle
|
|||||||
const nsStyleSVGPaint &paint = aStyleContext->StyleSVG()->*aFillOrStroke;
|
const nsStyleSVGPaint &paint = aStyleContext->StyleSVG()->*aFillOrStroke;
|
||||||
nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
|
nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
|
||||||
bool isServer = paint.mType == eStyleSVGPaintType_Server ||
|
bool isServer = paint.mType == eStyleSVGPaintType_Server ||
|
||||||
paint.mType == eStyleSVGPaintType_ContextFill ||
|
paint.mType == eStyleSVGPaintType_ObjectFill ||
|
||||||
paint.mType == eStyleSVGPaintType_ContextStroke;
|
paint.mType == eStyleSVGPaintType_ObjectStroke;
|
||||||
nscolor color = isServer ? paint.mFallbackColor : paint.mPaint.mColor;
|
nscolor color = isServer ? paint.mFallbackColor : paint.mPaint.mColor;
|
||||||
if (styleIfVisited) {
|
if (styleIfVisited) {
|
||||||
const nsStyleSVGPaint &paintIfVisited =
|
const nsStyleSVGPaint &paintIfVisited =
|
||||||
@@ -1484,23 +1484,23 @@ MaybeOptimizeOpacity(nsIFrame *aFrame, float aFillOrStrokeOpacity)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
nsSVGUtils::SetupContextPaint(gfxContext *aContext,
|
nsSVGUtils::SetupObjectPaint(gfxContext *aContext,
|
||||||
gfxTextContextPaint *aContextPaint,
|
gfxTextObjectPaint *aObjectPaint,
|
||||||
const nsStyleSVGPaint &aPaint,
|
const nsStyleSVGPaint &aPaint,
|
||||||
float aOpacity)
|
float aOpacity)
|
||||||
{
|
{
|
||||||
nsRefPtr<gfxPattern> pattern;
|
nsRefPtr<gfxPattern> pattern;
|
||||||
|
|
||||||
if (!aContextPaint) {
|
if (!aObjectPaint) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (aPaint.mType) {
|
switch (aPaint.mType) {
|
||||||
case eStyleSVGPaintType_ContextFill:
|
case eStyleSVGPaintType_ObjectFill:
|
||||||
pattern = aContextPaint->GetFillPattern(aOpacity, aContext->CurrentMatrix());
|
pattern = aObjectPaint->GetFillPattern(aOpacity, aContext->CurrentMatrix());
|
||||||
break;
|
break;
|
||||||
case eStyleSVGPaintType_ContextStroke:
|
case eStyleSVGPaintType_ObjectStroke:
|
||||||
pattern = aContextPaint->GetStrokePattern(aOpacity, aContext->CurrentMatrix());
|
pattern = aObjectPaint->GetStrokePattern(aOpacity, aContext->CurrentMatrix());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@@ -1517,7 +1517,7 @@ nsSVGUtils::SetupContextPaint(gfxContext *aContext,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGUtils::SetupCairoFillPaint(nsIFrame *aFrame, gfxContext* aContext,
|
nsSVGUtils::SetupCairoFillPaint(nsIFrame *aFrame, gfxContext* aContext,
|
||||||
gfxTextContextPaint *aContextPaint)
|
gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
const nsStyleSVG* style = aFrame->StyleSVG();
|
const nsStyleSVG* style = aFrame->StyleSVG();
|
||||||
if (style->mFill.mType == eStyleSVGPaintType_None)
|
if (style->mFill.mType == eStyleSVGPaintType_None)
|
||||||
@@ -1531,13 +1531,13 @@ nsSVGUtils::SetupCairoFillPaint(nsIFrame *aFrame, gfxContext* aContext,
|
|||||||
float opacity = MaybeOptimizeOpacity(aFrame,
|
float opacity = MaybeOptimizeOpacity(aFrame,
|
||||||
GetOpacity(style->mFillOpacitySource,
|
GetOpacity(style->mFillOpacitySource,
|
||||||
style->mFillOpacity,
|
style->mFillOpacity,
|
||||||
aContextPaint));
|
aObjectPaint));
|
||||||
nsSVGPaintServerFrame *ps =
|
nsSVGPaintServerFrame *ps =
|
||||||
nsSVGEffects::GetPaintServer(aFrame, &style->mFill, nsSVGEffects::FillProperty());
|
nsSVGEffects::GetPaintServer(aFrame, &style->mFill, nsSVGEffects::FillProperty());
|
||||||
if (ps && ps->SetupPaintServer(aContext, aFrame, &nsStyleSVG::mFill, opacity))
|
if (ps && ps->SetupPaintServer(aContext, aFrame, &nsStyleSVG::mFill, opacity))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (SetupContextPaint(aContext, aContextPaint, style->mFill, opacity)) {
|
if (SetupObjectPaint(aContext, aObjectPaint, style->mFill, opacity)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1552,7 +1552,7 @@ nsSVGUtils::SetupCairoFillPaint(nsIFrame *aFrame, gfxContext* aContext,
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGUtils::SetupCairoStrokePaint(nsIFrame *aFrame, gfxContext* aContext,
|
nsSVGUtils::SetupCairoStrokePaint(nsIFrame *aFrame, gfxContext* aContext,
|
||||||
gfxTextContextPaint *aContextPaint)
|
gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
const nsStyleSVG* style = aFrame->StyleSVG();
|
const nsStyleSVG* style = aFrame->StyleSVG();
|
||||||
if (style->mStroke.mType == eStyleSVGPaintType_None)
|
if (style->mStroke.mType == eStyleSVGPaintType_None)
|
||||||
@@ -1561,14 +1561,14 @@ nsSVGUtils::SetupCairoStrokePaint(nsIFrame *aFrame, gfxContext* aContext,
|
|||||||
float opacity = MaybeOptimizeOpacity(aFrame,
|
float opacity = MaybeOptimizeOpacity(aFrame,
|
||||||
GetOpacity(style->mStrokeOpacitySource,
|
GetOpacity(style->mStrokeOpacitySource,
|
||||||
style->mStrokeOpacity,
|
style->mStrokeOpacity,
|
||||||
aContextPaint));
|
aObjectPaint));
|
||||||
|
|
||||||
nsSVGPaintServerFrame *ps =
|
nsSVGPaintServerFrame *ps =
|
||||||
nsSVGEffects::GetPaintServer(aFrame, &style->mStroke, nsSVGEffects::StrokeProperty());
|
nsSVGEffects::GetPaintServer(aFrame, &style->mStroke, nsSVGEffects::StrokeProperty());
|
||||||
if (ps && ps->SetupPaintServer(aContext, aFrame, &nsStyleSVG::mStroke, opacity))
|
if (ps && ps->SetupPaintServer(aContext, aFrame, &nsStyleSVG::mStroke, opacity))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (SetupContextPaint(aContext, aContextPaint, style->mStroke, opacity)) {
|
if (SetupObjectPaint(aContext, aObjectPaint, style->mStroke, opacity)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1584,25 +1584,25 @@ nsSVGUtils::SetupCairoStrokePaint(nsIFrame *aFrame, gfxContext* aContext,
|
|||||||
/* static */ float
|
/* static */ float
|
||||||
nsSVGUtils::GetOpacity(nsStyleSVGOpacitySource aOpacityType,
|
nsSVGUtils::GetOpacity(nsStyleSVGOpacitySource aOpacityType,
|
||||||
const float& aOpacity,
|
const float& aOpacity,
|
||||||
gfxTextContextPaint *aOuterContextPaint)
|
gfxTextObjectPaint *aOuterObjectPaint)
|
||||||
{
|
{
|
||||||
float opacity = 1.0f;
|
float opacity = 1.0f;
|
||||||
switch (aOpacityType) {
|
switch (aOpacityType) {
|
||||||
case eStyleSVGOpacitySource_Normal:
|
case eStyleSVGOpacitySource_Normal:
|
||||||
opacity = aOpacity;
|
opacity = aOpacity;
|
||||||
break;
|
break;
|
||||||
case eStyleSVGOpacitySource_ContextFillOpacity:
|
case eStyleSVGOpacitySource_ObjectFillOpacity:
|
||||||
if (aOuterContextPaint) {
|
if (aOuterObjectPaint) {
|
||||||
opacity = aOuterContextPaint->GetFillOpacity();
|
opacity = aOuterObjectPaint->GetFillOpacity();
|
||||||
} else {
|
} else {
|
||||||
NS_WARNING("context-fill-opacity used outside of an SVG glyph");
|
NS_WARNING("objectFillOpacity used outside of an SVG glyph");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case eStyleSVGOpacitySource_ContextStrokeOpacity:
|
case eStyleSVGOpacitySource_ObjectStrokeOpacity:
|
||||||
if (aOuterContextPaint) {
|
if (aOuterObjectPaint) {
|
||||||
opacity = aOuterContextPaint->GetStrokeOpacity();
|
opacity = aOuterObjectPaint->GetStrokeOpacity();
|
||||||
} else {
|
} else {
|
||||||
NS_WARNING("context-stroke-opacity used outside of an SVG glyph");
|
NS_WARNING("objectStrokeOpacity used outside of an SVG glyph");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -1612,20 +1612,20 @@ nsSVGUtils::GetOpacity(nsStyleSVGOpacitySource aOpacityType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGUtils::HasStroke(nsIFrame* aFrame, gfxTextContextPaint *aContextPaint)
|
nsSVGUtils::HasStroke(nsIFrame* aFrame, gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
const nsStyleSVG *style = aFrame->StyleSVG();
|
const nsStyleSVG *style = aFrame->StyleSVG();
|
||||||
return style->mStroke.mType != eStyleSVGPaintType_None &&
|
return style->mStroke.mType != eStyleSVGPaintType_None &&
|
||||||
style->mStrokeOpacity > 0 &&
|
style->mStrokeOpacity > 0 &&
|
||||||
GetStrokeWidth(aFrame, aContextPaint) > 0;
|
GetStrokeWidth(aFrame, aObjectPaint) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, gfxTextContextPaint *aContextPaint)
|
nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
const nsStyleSVG *style = aFrame->StyleSVG();
|
const nsStyleSVG *style = aFrame->StyleSVG();
|
||||||
if (aContextPaint && style->mStrokeWidthFromObject) {
|
if (aObjectPaint && style->mStrokeWidthFromObject) {
|
||||||
return aContextPaint->GetStrokeWidth();
|
return aObjectPaint->GetStrokeWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIContent* content = aFrame->GetContent();
|
nsIContent* content = aFrame->GetContent();
|
||||||
@@ -1642,9 +1642,9 @@ nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, gfxTextContextPaint *aContextPaint)
|
|||||||
void
|
void
|
||||||
nsSVGUtils::SetupCairoStrokeBBoxGeometry(nsIFrame* aFrame,
|
nsSVGUtils::SetupCairoStrokeBBoxGeometry(nsIFrame* aFrame,
|
||||||
gfxContext *aContext,
|
gfxContext *aContext,
|
||||||
gfxTextContextPaint *aContextPaint)
|
gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
float width = GetStrokeWidth(aFrame, aContextPaint);
|
float width = GetStrokeWidth(aFrame, aObjectPaint);
|
||||||
if (width <= 0)
|
if (width <= 0)
|
||||||
return;
|
return;
|
||||||
aContext->SetLineWidth(width);
|
aContext->SetLineWidth(width);
|
||||||
@@ -1685,7 +1685,7 @@ static bool
|
|||||||
GetStrokeDashData(nsIFrame* aFrame,
|
GetStrokeDashData(nsIFrame* aFrame,
|
||||||
FallibleTArray<gfxFloat>& aDashes,
|
FallibleTArray<gfxFloat>& aDashes,
|
||||||
gfxFloat* aDashOffset,
|
gfxFloat* aDashOffset,
|
||||||
gfxTextContextPaint *aContextPaint)
|
gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
const nsStyleSVG* style = aFrame->StyleSVG();
|
const nsStyleSVG* style = aFrame->StyleSVG();
|
||||||
nsPresContext *presContext = aFrame->PresContext();
|
nsPresContext *presContext = aFrame->PresContext();
|
||||||
@@ -1695,8 +1695,8 @@ GetStrokeDashData(nsIFrame* aFrame,
|
|||||||
content->GetParent() : content);
|
content->GetParent() : content);
|
||||||
|
|
||||||
gfxFloat totalLength = 0.0;
|
gfxFloat totalLength = 0.0;
|
||||||
if (aContextPaint && style->mStrokeDasharrayFromObject) {
|
if (aObjectPaint && style->mStrokeDasharrayFromObject) {
|
||||||
aDashes = aContextPaint->GetStrokeDashArray();
|
aDashes = aObjectPaint->GetStrokeDashArray();
|
||||||
|
|
||||||
for (uint32_t i = 0; i < aDashes.Length(); i++) {
|
for (uint32_t i = 0; i < aDashes.Length(); i++) {
|
||||||
if (aDashes[i] < 0.0) {
|
if (aDashes[i] < 0.0) {
|
||||||
@@ -1734,8 +1734,8 @@ GetStrokeDashData(nsIFrame* aFrame,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aContextPaint && style->mStrokeDashoffsetFromObject) {
|
if (aObjectPaint && style->mStrokeDashoffsetFromObject) {
|
||||||
*aDashOffset = aContextPaint->GetStrokeDashOffset();
|
*aDashOffset = aObjectPaint->GetStrokeDashOffset();
|
||||||
} else {
|
} else {
|
||||||
*aDashOffset = nsSVGUtils::CoordToFloat(presContext,
|
*aDashOffset = nsSVGUtils::CoordToFloat(presContext,
|
||||||
ctx,
|
ctx,
|
||||||
@@ -1747,13 +1747,13 @@ GetStrokeDashData(nsIFrame* aFrame,
|
|||||||
|
|
||||||
void
|
void
|
||||||
nsSVGUtils::SetupCairoStrokeGeometry(nsIFrame* aFrame, gfxContext* aContext,
|
nsSVGUtils::SetupCairoStrokeGeometry(nsIFrame* aFrame, gfxContext* aContext,
|
||||||
gfxTextContextPaint *aContextPaint)
|
gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
SetupCairoStrokeBBoxGeometry(aFrame, aContext, aContextPaint);
|
SetupCairoStrokeBBoxGeometry(aFrame, aContext, aObjectPaint);
|
||||||
|
|
||||||
AutoFallibleTArray<gfxFloat, 10> dashes;
|
AutoFallibleTArray<gfxFloat, 10> dashes;
|
||||||
gfxFloat dashOffset;
|
gfxFloat dashOffset;
|
||||||
if (GetStrokeDashData(aFrame, dashes, &dashOffset, aContextPaint)) {
|
if (GetStrokeDashData(aFrame, dashes, &dashOffset, aObjectPaint)) {
|
||||||
aContext->SetDash(dashes.Elements(), dashes.Length(), dashOffset);
|
aContext->SetDash(dashes.Elements(), dashes.Length(), dashOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1819,20 +1819,20 @@ nsSVGUtils::GetGeometryHitTestFlags(nsIFrame* aFrame)
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGUtils::SetupCairoStroke(nsIFrame* aFrame, gfxContext* aContext,
|
nsSVGUtils::SetupCairoStroke(nsIFrame* aFrame, gfxContext* aContext,
|
||||||
gfxTextContextPaint *aContextPaint)
|
gfxTextObjectPaint *aObjectPaint)
|
||||||
{
|
{
|
||||||
if (!HasStroke(aFrame, aContextPaint)) {
|
if (!HasStroke(aFrame, aObjectPaint)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SetupCairoStrokeGeometry(aFrame, aContext, aContextPaint);
|
SetupCairoStrokeGeometry(aFrame, aContext, aObjectPaint);
|
||||||
|
|
||||||
return SetupCairoStrokePaint(aFrame, aContext, aContextPaint);
|
return SetupCairoStrokePaint(aFrame, aContext, aObjectPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
|
nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
|
||||||
gfxFont::DrawMode aDrawMode,
|
gfxFont::DrawMode aDrawMode,
|
||||||
gfxTextContextPaint* aContextPaint)
|
gfxTextObjectPaint* aObjectPaint)
|
||||||
{
|
{
|
||||||
nsIFrame* frame = aElement->GetPrimaryFrame();
|
nsIFrame* frame = aElement->GetPrimaryFrame();
|
||||||
nsISVGChildFrame* svgFrame = do_QueryFrame(frame);
|
nsISVGChildFrame* svgFrame = do_QueryFrame(frame);
|
||||||
@@ -1841,7 +1841,7 @@ nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
|
|||||||
}
|
}
|
||||||
nsRenderingContext context;
|
nsRenderingContext context;
|
||||||
context.Init(frame->PresContext()->DeviceContext(), aContext);
|
context.Init(frame->PresContext()->DeviceContext(), aContext);
|
||||||
context.AddUserData(&gfxTextContextPaint::sUserDataKey, aContextPaint, nullptr);
|
context.AddUserData(&gfxTextObjectPaint::sUserDataKey, aObjectPaint, nullptr);
|
||||||
svgFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
|
svgFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
|
||||||
nsresult rv = svgFrame->PaintSVG(&context, nullptr, frame);
|
nsresult rv = svgFrame->PaintSVG(&context, nullptr, frame);
|
||||||
return NS_SUCCEEDED(rv);
|
return NS_SUCCEEDED(rv);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class nsSVGLength2;
|
|||||||
class nsSVGOuterSVGFrame;
|
class nsSVGOuterSVGFrame;
|
||||||
class nsSVGPathGeometryFrame;
|
class nsSVGPathGeometryFrame;
|
||||||
class nsTextFrame;
|
class nsTextFrame;
|
||||||
class gfxTextContextPaint;
|
class gfxTextObjectPaint;
|
||||||
|
|
||||||
struct nsStyleSVG;
|
struct nsStyleSVG;
|
||||||
struct nsStyleSVGPaint;
|
struct nsStyleSVGPaint;
|
||||||
@@ -608,8 +608,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Set up cairo context with an object pattern
|
* Set up cairo context with an object pattern
|
||||||
*/
|
*/
|
||||||
static bool SetupContextPaint(gfxContext *aContext,
|
static bool SetupObjectPaint(gfxContext *aContext,
|
||||||
gfxTextContextPaint *aContextPaint,
|
gfxTextObjectPaint *aObjectPaint,
|
||||||
const nsStyleSVGPaint& aPaint,
|
const nsStyleSVGPaint& aPaint,
|
||||||
float aOpacity);
|
float aOpacity);
|
||||||
|
|
||||||
@@ -618,48 +618,48 @@ public:
|
|||||||
* for the given frame.
|
* for the given frame.
|
||||||
*/
|
*/
|
||||||
static bool SetupCairoFillPaint(nsIFrame* aFrame, gfxContext* aContext,
|
static bool SetupCairoFillPaint(nsIFrame* aFrame, gfxContext* aContext,
|
||||||
gfxTextContextPaint *aContextPaint = nullptr);
|
gfxTextObjectPaint *aObjectPaint = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current paint on the specified gfxContent to be the SVG 'stroke'
|
* Sets the current paint on the specified gfxContent to be the SVG 'stroke'
|
||||||
* for the given frame.
|
* for the given frame.
|
||||||
*/
|
*/
|
||||||
static bool SetupCairoStrokePaint(nsIFrame* aFrame, gfxContext* aContext,
|
static bool SetupCairoStrokePaint(nsIFrame* aFrame, gfxContext* aContext,
|
||||||
gfxTextContextPaint *aContextPaint = nullptr);
|
gfxTextObjectPaint *aObjectPaint = nullptr);
|
||||||
|
|
||||||
static float GetOpacity(nsStyleSVGOpacitySource aOpacityType,
|
static float GetOpacity(nsStyleSVGOpacitySource aOpacityType,
|
||||||
const float& aOpacity,
|
const float& aOpacity,
|
||||||
gfxTextContextPaint *aOuterContextPaint);
|
gfxTextObjectPaint *aOuterObjectPaint);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @return false if there is no stroke
|
* @return false if there is no stroke
|
||||||
*/
|
*/
|
||||||
static bool HasStroke(nsIFrame* aFrame,
|
static bool HasStroke(nsIFrame* aFrame,
|
||||||
gfxTextContextPaint *aContextPaint = nullptr);
|
gfxTextObjectPaint *aObjectPaint = nullptr);
|
||||||
|
|
||||||
static float GetStrokeWidth(nsIFrame* aFrame,
|
static float GetStrokeWidth(nsIFrame* aFrame,
|
||||||
gfxTextContextPaint *aContextPaint = nullptr);
|
gfxTextObjectPaint *aObjectPaint = nullptr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up a cairo context for measuring the bounding box of a stroked path.
|
* Set up a cairo context for measuring the bounding box of a stroked path.
|
||||||
*/
|
*/
|
||||||
static void SetupCairoStrokeBBoxGeometry(nsIFrame* aFrame,
|
static void SetupCairoStrokeBBoxGeometry(nsIFrame* aFrame,
|
||||||
gfxContext *aContext,
|
gfxContext *aContext,
|
||||||
gfxTextContextPaint *aContextPaint = nullptr);
|
gfxTextObjectPaint *aObjectPaint = nullptr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up a cairo context for a stroked path (including any dashing that
|
* Set up a cairo context for a stroked path (including any dashing that
|
||||||
* applies).
|
* applies).
|
||||||
*/
|
*/
|
||||||
static void SetupCairoStrokeGeometry(nsIFrame* aFrame, gfxContext *aContext,
|
static void SetupCairoStrokeGeometry(nsIFrame* aFrame, gfxContext *aContext,
|
||||||
gfxTextContextPaint *aContextPaint = nullptr);
|
gfxTextObjectPaint *aObjectPaint = nullptr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up a cairo context for stroking, including setting up any stroke-related
|
* Set up a cairo context for stroking, including setting up any stroke-related
|
||||||
* properties such as dashing and setting the current paint on the gfxContext.
|
* properties such as dashing and setting the current paint on the gfxContext.
|
||||||
*/
|
*/
|
||||||
static bool SetupCairoStroke(nsIFrame* aFrame, gfxContext *aContext,
|
static bool SetupCairoStroke(nsIFrame* aFrame, gfxContext *aContext,
|
||||||
gfxTextContextPaint *aContextPaint = nullptr);
|
gfxTextObjectPaint *aObjectPaint = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns a set of bit flags indicating which parts of the
|
* This function returns a set of bit flags indicating which parts of the
|
||||||
@@ -678,7 +678,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
static bool PaintSVGGlyph(Element* aElement, gfxContext* aContext,
|
static bool PaintSVGGlyph(Element* aElement, gfxContext* aContext,
|
||||||
gfxFont::DrawMode aDrawMode,
|
gfxFont::DrawMode aDrawMode,
|
||||||
gfxTextContextPaint* aContextPaint);
|
gfxTextObjectPaint* aObjectPaint);
|
||||||
/**
|
/**
|
||||||
* Get the extents of a SVG glyph.
|
* Get the extents of a SVG glyph.
|
||||||
* @param aElement the SVG glyph element
|
* @param aElement the SVG glyph element
|
||||||
|
|||||||
Reference in New Issue
Block a user