Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: ppapi/c/private/ppb_pdf.h

Issue 1953053002: Add private PPAPI interfaces for PDFium accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback from Lei Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_C_PRIVATE_PPB_PDF_H_ 5 #ifndef PPAPI_C_PRIVATE_PPB_PDF_H_
6 #define PPAPI_C_PRIVATE_PPB_PDF_H_ 6 #define PPAPI_C_PRIVATE_PPB_PDF_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "ppapi/c/pp_bool.h" 10 #include "ppapi/c/pp_bool.h"
11 #include "ppapi/c/pp_instance.h" 11 #include "ppapi/c/pp_instance.h"
12 #include "ppapi/c/pp_point.h"
13 #include "ppapi/c/pp_rect.h"
12 #include "ppapi/c/pp_resource.h" 14 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_var.h" 15 #include "ppapi/c/pp_var.h"
14 #include "ppapi/c/private/pp_private_font_charset.h" 16 #include "ppapi/c/private/pp_private_font_charset.h"
15 17
16 #define PPB_PDF_INTERFACE "PPB_PDF;1" 18 #define PPB_PDF_INTERFACE "PPB_PDF;1"
17 19
18 typedef enum { 20 typedef enum {
19 PP_PDFFEATURE_HIDPI = 0, 21 PP_PDFFEATURE_HIDPI = 0,
20 PP_PDFFEATURE_PRINTING = 1 22 PP_PDFFEATURE_PRINTING = 1
21 } PP_PDFFeature; 23 } PP_PDFFeature;
22 24
23 struct PP_PrivateFontFileDescription { 25 struct PP_PrivateFontFileDescription {
24 const char* face; 26 const char* face;
25 uint32_t weight; 27 uint32_t weight;
26 bool italic; 28 bool italic;
27 }; 29 };
28 30
29 struct PP_PrivateFindResult { 31 struct PP_PrivateFindResult {
30 int start_index; 32 int start_index;
31 int length; 33 int length;
32 }; 34 };
33 35
36 struct PP_PrivateAccessibilityViewportInfo {
37 double zoom;
38 struct PP_Point scroll;
39 struct PP_Point offset;
40 };
41
42 struct PP_PrivateAccessibilityDocInfo {
43 uint32_t page_count;
44 PP_Bool text_accessible;
45 PP_Bool text_copyable;
46 };
47
48 typedef enum {
49 PP_PRIVATEDIRECTION_NONE = 0,
50 PP_PRIVATEDIRECTION_LTR = 1,
51 PP_PRIVATEDIRECTION_RTL = 2,
52 PP_PRIVATEDIRECTION_TTB = 3,
53 PP_PRIVATEDIRECTION_BTT = 4,
54 PP_PRIVATEDIRECTION_LAST = PP_PRIVATEDIRECTION_BTT
55 } PP_PrivateDirection;
56
57 struct PP_PrivateAccessibilityPageInfo {
58 struct PP_Rect bounds;
59 uint32_t char_count;
60 };
61
62 struct PP_PrivateAccessibilityTextRunInfo {
63 uint32_t len;
64 double font_size;
65 struct PP_FloatRect bounds;
66 PP_PrivateDirection direction;
67 };
68
69 struct PP_PrivateAccessibilityCharInfo {
70 uint32_t unicode_character;
71 double char_width;
72 };
73
34 struct PPB_PDF { 74 struct PPB_PDF {
35 // Returns a resource identifying a font file corresponding to the given font 75 // Returns a resource identifying a font file corresponding to the given font
36 // request after applying the browser-specific fallback. 76 // request after applying the browser-specific fallback.
37 // 77 //
38 // Currently Linux-only. 78 // Currently Linux-only.
39 PP_Resource (*GetFontFileWithFallback)( 79 PP_Resource (*GetFontFileWithFallback)(
40 PP_Instance instance, 80 PP_Instance instance,
41 const struct PP_BrowserFont_Trusted_Description* description, 81 const struct PP_BrowserFont_Trusted_Description* description,
42 PP_PrivateFontCharset charset); 82 PP_PrivateFontCharset charset);
43 83
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Sets the link currently under the cursor. 128 // Sets the link currently under the cursor.
89 void (*SetLinkUnderCursor)(PP_Instance instance, const char* url); 129 void (*SetLinkUnderCursor)(PP_Instance instance, const char* url);
90 130
91 // Gets pointers to both the mmap'd V8 snapshot files and their sizes. 131 // Gets pointers to both the mmap'd V8 snapshot files and their sizes.
92 // This is needed when loading V8's initial snapshot from external files. 132 // This is needed when loading V8's initial snapshot from external files.
93 void (*GetV8ExternalSnapshotData)(PP_Instance instance, 133 void (*GetV8ExternalSnapshotData)(PP_Instance instance,
94 const char** natives_data_out, 134 const char** natives_data_out,
95 int* natives_size_out, 135 int* natives_size_out,
96 const char** snapshot_data_out, 136 const char** snapshot_data_out,
97 int* snapshot_size_out); 137 int* snapshot_size_out);
138
139 // Sends information about the viewport to the renderer for accessibility
140 // support.
141 void (*SetAccessibilityViewportInfo)(
142 PP_Instance instance,
143 struct PP_PrivateAccessibilityViewportInfo* viewport_info);
144
145 // Sends information about the PDF document to the renderer for accessibility
146 // support.
147 void (*SetAccessibilityDocInfo)(
148 PP_Instance instance,
149 struct PP_PrivateAccessibilityDocInfo* doc_info);
150
151 // Sends information about one page in a PDF document to the renderer for
152 // accessibility support.
153 void (*SetAccessibilityPageInfo)(
154 PP_Instance instance,
155 uint32_t page_index,
raymes 2016/05/17 20:38:40 nit: could this go in PP_PrivateAccessibilityPageI
dmazzoni 2016/05/26 21:59:13 Done.
156 struct PP_PrivateAccessibilityPageInfo* page_info);
raymes 2016/05/17 20:38:40 I wonder if it's good enough to put all the text r
dmazzoni 2016/05/17 20:56:58 Actually it just wasn't clear to me how to do this
raymes 2016/05/17 21:58:13 Ah right. Yeah it is a bit of a headache, I agree.
dmazzoni 2016/05/26 21:59:13 Done.
157
158 void (*SetAccessibilityTextRunInfo)(
raymes 2016/05/17 20:38:40 nit: no comment
159 PP_Instance instance,
160 uint32_t page_index,
161 uint32_t text_run_index,
162 struct PP_PrivateAccessibilityTextRunInfo* text_run_info,
163 struct PP_PrivateAccessibilityCharInfo chars[]);
raymes 2016/05/17 20:38:40 nit: could everything go in PP_PrivateAccessibilit
dmazzoni 2016/05/17 20:56:58 Same - if this was C++ that's what I'd do.
98 }; 164 };
99 165
100 #endif // PPAPI_C_PRIVATE_PPB_PDF_H_ 166 #endif // PPAPI_C_PRIVATE_PPB_PDF_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698