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.

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

mercurial