gfx/cairo/xlib-glyph-clip-region.patch

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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-xlib-surface.c b/gfx/cairo/cairo/src/cairo-xlib-surface.c
michael@0 2 --- a/gfx/cairo/cairo/src/cairo-xlib-surface.c
michael@0 3 +++ b/gfx/cairo/cairo/src/cairo-xlib-surface.c
michael@0 4 @@ -4806,30 +4806,30 @@ static cairo_int_status_t
michael@0 5 }
michael@0 6
michael@0 7 X_DEBUG ((display->display, "show_glyphs (dst=%x)", (unsigned int) dst->drawable));
michael@0 8
michael@0 9 if (clip_region != NULL &&
michael@0 10 cairo_region_num_rectangles (clip_region) == 1)
michael@0 11 {
michael@0 12 cairo_rectangle_int_t glyph_extents;
michael@0 13 - const cairo_rectangle_int_t *clip_extents;
michael@0 14 + cairo_rectangle_int_t clip_extents;
michael@0 15
michael@0 16 /* Can we do without the clip?
michael@0 17 * Around 50% of the time the clip is redundant (firefox).
michael@0 18 */
michael@0 19 _cairo_scaled_font_glyph_approximate_extents (scaled_font,
michael@0 20 glyphs, num_glyphs,
michael@0 21 &glyph_extents);
michael@0 22
michael@0 23 - clip_extents = &clip->path->extents;
michael@0 24 - if (clip_extents->x <= glyph_extents.x &&
michael@0 25 - clip_extents->y <= glyph_extents.y &&
michael@0 26 - clip_extents->x + clip_extents->width >= glyph_extents.x + glyph_extents.width &&
michael@0 27 - clip_extents->y + clip_extents->height >= glyph_extents.y + glyph_extents.height)
michael@0 28 + cairo_region_get_extents(clip_region, &clip_extents);
michael@0 29 + if (clip_extents.x <= glyph_extents.x &&
michael@0 30 + clip_extents.y <= glyph_extents.y &&
michael@0 31 + clip_extents.x + clip_extents.width >= glyph_extents.x + glyph_extents.width &&
michael@0 32 + clip_extents.y + clip_extents.height >= glyph_extents.y + glyph_extents.height)
michael@0 33 {
michael@0 34 clip_region = NULL;
michael@0 35 }
michael@0 36 }
michael@0 37
michael@0 38 status = _cairo_xlib_surface_set_clip_region (dst, clip_region);
michael@0 39 if (unlikely (status))
michael@0 40 goto BAIL0;

mercurial