Bug 1842999 - Part 12: Inline ResizableTypedArray getters in CacheIR. r=jandem
[gecko.git] / gfx / cairo / 11-quartz-surface-tags.patch
blob7f73d388ea8ce9b9603ef68420abdbde5cf31ca7
1 diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
2 --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
3 +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
4 @@ -48,6 +48,7 @@
5 #include "cairo-surface-backend-private.h"
6 #include "cairo-surface-clipper-private.h"
7 #include "cairo-recording-surface-private.h"
8 +#include "cairo-tag-attributes-private.h"
10 #include <dlfcn.h>
12 @@ -2313,6 +2314,70 @@ static cairo_status_t
13 return CAIRO_STATUS_SUCCESS;
16 +static cairo_int_status_t
17 +_cairo_quartz_surface_tag (void *abstract_surface,
18 + cairo_bool_t begin,
19 + const char *tag_name,
20 + const char *attributes,
21 + const cairo_pattern_t *source,
22 + const cairo_stroke_style_t *style,
23 + const cairo_matrix_t *ctm,
24 + const cairo_matrix_t *ctm_inverse,
25 + const cairo_clip_t *clip)
27 + cairo_link_attrs_t link_attrs;
28 + cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
29 + int i, num_rects;
30 + cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface;
32 + /* Currently the only tag we support is "Link" */
33 + if (strcmp (tag_name, "Link"))
34 + return CAIRO_INT_STATUS_UNSUPPORTED;
36 + /* We only process the 'begin' tag, and expect a rect attribute;
37 + using the extents of the drawing operations enclosed by the begin/end
38 + link tags to define the clickable area is not implemented. */
39 + if (!begin)
40 + return status;
42 + status = _cairo_tag_parse_link_attributes (attributes, &link_attrs);
43 + if (unlikely (status))
44 + return status;
46 + num_rects = _cairo_array_num_elements (&link_attrs.rects);
47 + if (num_rects > 0) {
48 + CFURLRef url = CFURLCreateWithBytes (NULL,
49 + (const UInt8 *) link_attrs.uri,
50 + strlen (link_attrs.uri),
51 + kCFStringEncodingUTF8,
52 + NULL);
54 + for (i = 0; i < num_rects; i++) {
55 + CGRect link_rect;
56 + cairo_rectangle_t rectf;
58 + _cairo_array_copy_element (&link_attrs.rects, i, &rectf);
60 + link_rect =
61 + CGRectMake (rectf.x,
62 + surface->extents.height - rectf.y - rectf.height,
63 + rectf.width,
64 + rectf.height);
66 + CGPDFContextSetURLForRect (surface->cgContext, url, link_rect);
67 + }
69 + CFRelease (url);
70 + }
72 + _cairo_array_fini (&link_attrs.rects);
73 + free (link_attrs.dest);
74 + free (link_attrs.uri);
75 + free (link_attrs.file);
77 + return status;
80 // XXXtodo implement show_page; need to figure out how to handle begin/end
82 static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
83 @@ -2346,6 +2411,11 @@ static const struct _cairo_surface_backe
84 _cairo_quartz_surface_fill,
85 NULL, /* fill-stroke */
86 _cairo_quartz_surface_glyphs,
88 + NULL, /* has_show_text_glyphs */
89 + NULL, /* show_text_glyphs */
90 + NULL, /* get_supported_mime_types */
91 + _cairo_quartz_surface_tag /* tag */
94 cairo_quartz_surface_t *