Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | diff --git a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp |
michael@0 | 2 | --- a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp |
michael@0 | 3 | +++ b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp |
michael@0 | 4 | @@ -582,22 +582,37 @@ _cairo_dwrite_scaled_font_init_glyph_met |
michael@0 | 5 | DWRITE_FONT_METRICS fontMetrics; |
michael@0 | 6 | font_face->dwriteface->GetMetrics(&fontMetrics); |
michael@0 | 7 | HRESULT hr = font_face->dwriteface->GetDesignGlyphMetrics(&charIndex, 1, &metrics); |
michael@0 | 8 | if (FAILED(hr)) { |
michael@0 | 9 | return CAIRO_INT_STATUS_UNSUPPORTED; |
michael@0 | 10 | } |
michael@0 | 11 | |
michael@0 | 12 | // TODO: Treat swap_xy. |
michael@0 | 13 | - extents.width = (FLOAT)(metrics.advanceWidth - metrics.leftSideBearing - metrics.rightSideBearing) / fontMetrics.designUnitsPerEm; |
michael@0 | 14 | - extents.height = (FLOAT)(metrics.advanceHeight - metrics.topSideBearing - metrics.bottomSideBearing) / fontMetrics.designUnitsPerEm; |
michael@0 | 15 | + extents.width = (FLOAT)(metrics.advanceWidth - metrics.leftSideBearing - metrics.rightSideBearing) / |
michael@0 | 16 | + fontMetrics.designUnitsPerEm; |
michael@0 | 17 | + extents.height = (FLOAT)(metrics.advanceHeight - metrics.topSideBearing - metrics.bottomSideBearing) / |
michael@0 | 18 | + fontMetrics.designUnitsPerEm; |
michael@0 | 19 | extents.x_advance = (FLOAT)metrics.advanceWidth / fontMetrics.designUnitsPerEm; |
michael@0 | 20 | extents.x_bearing = (FLOAT)metrics.leftSideBearing / fontMetrics.designUnitsPerEm; |
michael@0 | 21 | extents.y_advance = 0.0; |
michael@0 | 22 | - extents.y_bearing = (FLOAT)(metrics.topSideBearing - metrics.verticalOriginY) / fontMetrics.designUnitsPerEm; |
michael@0 | 23 | + extents.y_bearing = (FLOAT)(metrics.topSideBearing - metrics.verticalOriginY) / |
michael@0 | 24 | + fontMetrics.designUnitsPerEm; |
michael@0 | 25 | + |
michael@0 | 26 | + // We pad the extents here because GetDesignGlyphMetrics returns "ideal" metrics |
michael@0 | 27 | + // for the glyph outline, without accounting for hinting/gridfitting/antialiasing, |
michael@0 | 28 | + // and therefore it does not always cover all pixels that will actually be touched. |
michael@0 | 29 | + if (scaled_font->base.options.antialias != CAIRO_ANTIALIAS_NONE && |
michael@0 | 30 | + extents.width > 0 && extents.height > 0) { |
michael@0 | 31 | + extents.width += scaled_font->mat_inverse.xx * 2; |
michael@0 | 32 | + extents.x_bearing -= scaled_font->mat_inverse.xx; |
michael@0 | 33 | + extents.height += scaled_font->mat_inverse.yy * 2; |
michael@0 | 34 | + extents.y_bearing -= scaled_font->mat_inverse.yy; |
michael@0 | 35 | + } |
michael@0 | 36 | + |
michael@0 | 37 | _cairo_scaled_glyph_set_metrics (scaled_glyph, |
michael@0 | 38 | &scaled_font->base, |
michael@0 | 39 | &extents); |
michael@0 | 40 | return CAIRO_INT_STATUS_SUCCESS; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Stack-based helper implementing IDWriteGeometrySink. |