blitz-pdf 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +391 -2
  3. package/THIRD_PARTY_NOTICES.md +25 -0
  4. package/assets/icon.svg +4 -0
  5. package/dist/api.d.ts +7 -0
  6. package/dist/api.d.ts.map +1 -0
  7. package/dist/api.js +46 -0
  8. package/dist/api.js.map +1 -0
  9. package/dist/assets.d.ts +7 -0
  10. package/dist/assets.d.ts.map +1 -0
  11. package/dist/assets.js +52 -0
  12. package/dist/assets.js.map +1 -0
  13. package/dist/browser.d.ts +3 -0
  14. package/dist/browser.d.ts.map +1 -0
  15. package/dist/browser.js +3 -0
  16. package/dist/browser.js.map +1 -0
  17. package/dist/node.d.ts +3 -0
  18. package/dist/node.d.ts.map +1 -0
  19. package/dist/node.js +10 -0
  20. package/dist/node.js.map +1 -0
  21. package/dist/options.d.ts +24 -0
  22. package/dist/options.d.ts.map +1 -0
  23. package/dist/options.js +135 -0
  24. package/dist/options.js.map +1 -0
  25. package/dist/types.d.ts +51 -0
  26. package/dist/types.d.ts.map +1 -0
  27. package/dist/types.js +2 -0
  28. package/dist/types.js.map +1 -0
  29. package/examples/bun.ts +8 -0
  30. package/examples/german-invoice/README.md +70 -0
  31. package/examples/german-invoice/data.mjs +83 -0
  32. package/examples/german-invoice/invoice.css +59 -0
  33. package/examples/german-invoice/template.mjs +49 -0
  34. package/examples/german-invoice.mjs +20 -0
  35. package/examples/invoice.html +29 -0
  36. package/examples/node.mjs +8 -0
  37. package/examples/pagination.html +40 -0
  38. package/examples/pagination.mjs +8 -0
  39. package/licenses/DejaVu.txt +187 -0
  40. package/licenses/RUST_DEPENDENCIES.txt +11577 -0
  41. package/package.json +89 -4
  42. package/src/api.ts +44 -0
  43. package/src/assets.ts +43 -0
  44. package/src/browser.ts +6 -0
  45. package/src/node.ts +12 -0
  46. package/src/options.ts +101 -0
  47. package/src/types.ts +49 -0
  48. package/vendor/README.md +17 -0
  49. package/vendor/stylo/.cargo-ok +1 -0
  50. package/vendor/stylo/.cargo_vcs_info.json +6 -0
  51. package/vendor/stylo/Cargo.lock +1485 -0
  52. package/vendor/stylo/Cargo.toml +274 -0
  53. package/vendor/stylo/LICENSE +373 -0
  54. package/vendor/stylo/README.md +6 -0
  55. package/vendor/stylo/applicable_declarations.rs +328 -0
  56. package/vendor/stylo/author_styles.rs +79 -0
  57. package/vendor/stylo/bezier.rs +176 -0
  58. package/vendor/stylo/bloom.rs +414 -0
  59. package/vendor/stylo/build.rs +91 -0
  60. package/vendor/stylo/build_gecko.rs +393 -0
  61. package/vendor/stylo/color/color_function.rs +601 -0
  62. package/vendor/stylo/color/component.rs +207 -0
  63. package/vendor/stylo/color/convert.rs +935 -0
  64. package/vendor/stylo/color/gamut/raytrace.rs +265 -0
  65. package/vendor/stylo/color/gamut.rs +227 -0
  66. package/vendor/stylo/color/mix.rs +645 -0
  67. package/vendor/stylo/color/mod.rs +750 -0
  68. package/vendor/stylo/color/parsing.rs +770 -0
  69. package/vendor/stylo/color/to_css.rs +297 -0
  70. package/vendor/stylo/context.rs +716 -0
  71. package/vendor/stylo/counter_style/mod.rs +754 -0
  72. package/vendor/stylo/counter_style/predefined.rs +61 -0
  73. package/vendor/stylo/counter_style/update_predefined.py +35 -0
  74. package/vendor/stylo/custom_properties.rs +2023 -0
  75. package/vendor/stylo/custom_properties_map.rs +220 -0
  76. package/vendor/stylo/data.rs +693 -0
  77. package/vendor/stylo/device/gecko.rs +486 -0
  78. package/vendor/stylo/device/mod.rs +304 -0
  79. package/vendor/stylo/device/servo.rs +507 -0
  80. package/vendor/stylo/dom.rs +1164 -0
  81. package/vendor/stylo/dom_apis.rs +937 -0
  82. package/vendor/stylo/driver.rs +172 -0
  83. package/vendor/stylo/error_reporting.rs +484 -0
  84. package/vendor/stylo/font_face.rs +558 -0
  85. package/vendor/stylo/font_metrics.rs +124 -0
  86. package/vendor/stylo/gecko/anon_boxes.toml +113 -0
  87. package/vendor/stylo/gecko/arc_types.rs +211 -0
  88. package/vendor/stylo/gecko/conversions.rs +59 -0
  89. package/vendor/stylo/gecko/data.rs +222 -0
  90. package/vendor/stylo/gecko/media_features.rs +971 -0
  91. package/vendor/stylo/gecko/mod.rs +20 -0
  92. package/vendor/stylo/gecko/non_ts_pseudo_class_list.rs +119 -0
  93. package/vendor/stylo/gecko/pseudo_element.rs +640 -0
  94. package/vendor/stylo/gecko/pseudo_element_definition.mako.rs +298 -0
  95. package/vendor/stylo/gecko/pseudo_elements.py +137 -0
  96. package/vendor/stylo/gecko/pseudo_elements.toml +197 -0
  97. package/vendor/stylo/gecko/regen_pseudo_elements.py +33 -0
  98. package/vendor/stylo/gecko/restyle_damage.rs +127 -0
  99. package/vendor/stylo/gecko/selector_parser.rs +627 -0
  100. package/vendor/stylo/gecko/snapshot.rs +202 -0
  101. package/vendor/stylo/gecko/snapshot_helpers.rs +334 -0
  102. package/vendor/stylo/gecko/traversal.rs +52 -0
  103. package/vendor/stylo/gecko/wrapper.rs +2258 -0
  104. package/vendor/stylo/gecko_bindings/mod.rs +34 -0
  105. package/vendor/stylo/gecko_bindings/sugar/mod.rs +12 -0
  106. package/vendor/stylo/gecko_bindings/sugar/ns_com_ptr.rs +15 -0
  107. package/vendor/stylo/gecko_bindings/sugar/ns_compatibility.rs +19 -0
  108. package/vendor/stylo/gecko_bindings/sugar/ns_style_auto_array.rs +111 -0
  109. package/vendor/stylo/gecko_bindings/sugar/origin_flags.rs +31 -0
  110. package/vendor/stylo/gecko_bindings/sugar/ownership.rs +70 -0
  111. package/vendor/stylo/gecko_bindings/sugar/refptr.rs +299 -0
  112. package/vendor/stylo/gecko_string_cache/mod.rs +543 -0
  113. package/vendor/stylo/gecko_string_cache/namespace.rs +106 -0
  114. package/vendor/stylo/global_style_data.rs +224 -0
  115. package/vendor/stylo/invalidation/element/document_state.rs +156 -0
  116. package/vendor/stylo/invalidation/element/element_wrapper.rs +432 -0
  117. package/vendor/stylo/invalidation/element/invalidation_map.rs +1631 -0
  118. package/vendor/stylo/invalidation/element/invalidator.rs +1470 -0
  119. package/vendor/stylo/invalidation/element/mod.rs +13 -0
  120. package/vendor/stylo/invalidation/element/relative_selector.rs +1399 -0
  121. package/vendor/stylo/invalidation/element/restyle_hints.rs +226 -0
  122. package/vendor/stylo/invalidation/element/state_and_attributes.rs +756 -0
  123. package/vendor/stylo/invalidation/media_queries.rs +144 -0
  124. package/vendor/stylo/invalidation/mod.rs +10 -0
  125. package/vendor/stylo/invalidation/stylesheets.rs +745 -0
  126. package/vendor/stylo/invalidation/viewport_units.rs +71 -0
  127. package/vendor/stylo/lib.rs +336 -0
  128. package/vendor/stylo/logical_geometry.rs +1684 -0
  129. package/vendor/stylo/macros.rs +70 -0
  130. package/vendor/stylo/matching.rs +1226 -0
  131. package/vendor/stylo/media_queries/media_list.rs +168 -0
  132. package/vendor/stylo/media_queries/media_query.rs +190 -0
  133. package/vendor/stylo/media_queries/mod.rs +13 -0
  134. package/vendor/stylo/parallel.rs +205 -0
  135. package/vendor/stylo/parser.rs +276 -0
  136. package/vendor/stylo/piecewise_linear.rs +282 -0
  137. package/vendor/stylo/prefs.rs +33 -0
  138. package/vendor/stylo/properties/build.py +119 -0
  139. package/vendor/stylo/properties/cascade.rs +2704 -0
  140. package/vendor/stylo/properties/computed_value_flags.rs +206 -0
  141. package/vendor/stylo/properties/counted_unknown_properties.py +104 -0
  142. package/vendor/stylo/properties/counter_style_descriptors.toml +45 -0
  143. package/vendor/stylo/properties/data.py +1375 -0
  144. package/vendor/stylo/properties/declaration_block.rs +1788 -0
  145. package/vendor/stylo/properties/font_face_descriptors.toml +50 -0
  146. package/vendor/stylo/properties/gecko.mako.rs +1555 -0
  147. package/vendor/stylo/properties/helpers/animated_properties.mako.rs +800 -0
  148. package/vendor/stylo/properties/helpers.mako.rs +812 -0
  149. package/vendor/stylo/properties/longhands.toml +4305 -0
  150. package/vendor/stylo/properties/mod.rs +1857 -0
  151. package/vendor/stylo/properties/properties.html.mako +31 -0
  152. package/vendor/stylo/properties/properties.mako.rs +3103 -0
  153. package/vendor/stylo/properties/property_descriptors.toml +18 -0
  154. package/vendor/stylo/properties/shorthands.rs +4241 -0
  155. package/vendor/stylo/properties/shorthands.toml +575 -0
  156. package/vendor/stylo/properties/vendored_python/mako-1.3.10-py3-none-any.whl +0 -0
  157. package/vendor/stylo/properties/vendored_python/markupsafe/LICENSE.txt +28 -0
  158. package/vendor/stylo/properties/vendored_python/markupsafe/__init__.py +384 -0
  159. package/vendor/stylo/properties/vendored_python/toml-0.10.2-py2.py3-none-any.whl +0 -0
  160. package/vendor/stylo/properties/view_transition_descriptors.toml +11 -0
  161. package/vendor/stylo/properties_and_values/mod.rs +12 -0
  162. package/vendor/stylo/properties_and_values/registry.rs +65 -0
  163. package/vendor/stylo/properties_and_values/rule.rs +331 -0
  164. package/vendor/stylo/properties_and_values/syntax/ascii.rs +60 -0
  165. package/vendor/stylo/properties_and_values/syntax/data_type.rs +146 -0
  166. package/vendor/stylo/properties_and_values/syntax/mod.rs +437 -0
  167. package/vendor/stylo/properties_and_values/value.rs +758 -0
  168. package/vendor/stylo/queries/condition.rs +996 -0
  169. package/vendor/stylo/queries/feature.rs +199 -0
  170. package/vendor/stylo/queries/feature_expression.rs +1170 -0
  171. package/vendor/stylo/queries/mod.rs +19 -0
  172. package/vendor/stylo/queries/values.rs +46 -0
  173. package/vendor/stylo/rule_cache.rs +267 -0
  174. package/vendor/stylo/rule_collector.rs +554 -0
  175. package/vendor/stylo/rule_tree/core.rs +787 -0
  176. package/vendor/stylo/rule_tree/level.rs +396 -0
  177. package/vendor/stylo/rule_tree/map.rs +201 -0
  178. package/vendor/stylo/rule_tree/mod.rs +427 -0
  179. package/vendor/stylo/rule_tree/source.rs +80 -0
  180. package/vendor/stylo/rule_tree/unsafe_box.rs +78 -0
  181. package/vendor/stylo/scoped_tls.rs +80 -0
  182. package/vendor/stylo/selector_map.rs +1050 -0
  183. package/vendor/stylo/selector_parser.rs +305 -0
  184. package/vendor/stylo/servo/animation.rs +1922 -0
  185. package/vendor/stylo/servo/attr.rs +714 -0
  186. package/vendor/stylo/servo/encoding_support.rs +81 -0
  187. package/vendor/stylo/servo/media_features.rs +254 -0
  188. package/vendor/stylo/servo/mod.rs +16 -0
  189. package/vendor/stylo/servo/restyle_damage.rs +215 -0
  190. package/vendor/stylo/servo/selector_parser.rs +1036 -0
  191. package/vendor/stylo/servo/shadow_parts.rs +207 -0
  192. package/vendor/stylo/shared_lock.rs +271 -0
  193. package/vendor/stylo/sharing/checks.rs +281 -0
  194. package/vendor/stylo/sharing/mod.rs +1000 -0
  195. package/vendor/stylo/simple_buckets_map.rs +52 -0
  196. package/vendor/stylo/str.rs +168 -0
  197. package/vendor/stylo/style_adjuster.rs +1086 -0
  198. package/vendor/stylo/style_resolver.rs +658 -0
  199. package/vendor/stylo/stylesheet_set.rs +658 -0
  200. package/vendor/stylo/stylesheets/appearance_base_rule.rs +51 -0
  201. package/vendor/stylo/stylesheets/container_rule.rs +769 -0
  202. package/vendor/stylo/stylesheets/counter_style_rule.rs +7 -0
  203. package/vendor/stylo/stylesheets/document_rule.rs +272 -0
  204. package/vendor/stylo/stylesheets/font_face_rule.rs +7 -0
  205. package/vendor/stylo/stylesheets/font_feature_values_rule.rs +481 -0
  206. package/vendor/stylo/stylesheets/font_palette_values_rule.rs +304 -0
  207. package/vendor/stylo/stylesheets/import_rule.rs +259 -0
  208. package/vendor/stylo/stylesheets/keyframes_rule.rs +733 -0
  209. package/vendor/stylo/stylesheets/layer_rule.rs +221 -0
  210. package/vendor/stylo/stylesheets/loader.rs +29 -0
  211. package/vendor/stylo/stylesheets/margin_rule.rs +190 -0
  212. package/vendor/stylo/stylesheets/media_rule.rs +191 -0
  213. package/vendor/stylo/stylesheets/mod.rs +918 -0
  214. package/vendor/stylo/stylesheets/namespace_rule.rs +43 -0
  215. package/vendor/stylo/stylesheets/nested_declarations_rule.rs +51 -0
  216. package/vendor/stylo/stylesheets/origin.rs +249 -0
  217. package/vendor/stylo/stylesheets/page_rule.rs +354 -0
  218. package/vendor/stylo/stylesheets/position_try_rule.rs +68 -0
  219. package/vendor/stylo/stylesheets/property_rule.rs +5 -0
  220. package/vendor/stylo/stylesheets/rule_list.rs +167 -0
  221. package/vendor/stylo/stylesheets/rule_parser.rs +1189 -0
  222. package/vendor/stylo/stylesheets/rules_iterator.rs +397 -0
  223. package/vendor/stylo/stylesheets/scope_rule.rs +511 -0
  224. package/vendor/stylo/stylesheets/starting_style_rule.rs +54 -0
  225. package/vendor/stylo/stylesheets/style_rule.rs +80 -0
  226. package/vendor/stylo/stylesheets/stylesheet.rs +570 -0
  227. package/vendor/stylo/stylesheets/supports_rule.rs +486 -0
  228. package/vendor/stylo/stylesheets/view_transition_rule.rs +81 -0
  229. package/vendor/stylo/stylist.rs +5076 -0
  230. package/vendor/stylo/thread_state.rs +87 -0
  231. package/vendor/stylo/traversal.rs +765 -0
  232. package/vendor/stylo/traversal_flags.rs +68 -0
  233. package/vendor/stylo/typed_om/mod.rs +981 -0
  234. package/vendor/stylo/typed_om/numeric.rs +128 -0
  235. package/vendor/stylo/typed_om/numeric_declaration.rs +93 -0
  236. package/vendor/stylo/typed_om/numeric_type.rs +640 -0
  237. package/vendor/stylo/typed_om/sum_value.rs +426 -0
  238. package/vendor/stylo/url/gecko.rs +367 -0
  239. package/vendor/stylo/url/mod.rs +71 -0
  240. package/vendor/stylo/url/servo.rs +239 -0
  241. package/vendor/stylo/use_counters/mod.rs +137 -0
  242. package/vendor/stylo/values/animated/color.rs +103 -0
  243. package/vendor/stylo/values/animated/effects.rs +26 -0
  244. package/vendor/stylo/values/animated/font.rs +37 -0
  245. package/vendor/stylo/values/animated/grid.rs +161 -0
  246. package/vendor/stylo/values/animated/lists.rs +141 -0
  247. package/vendor/stylo/values/animated/mod.rs +550 -0
  248. package/vendor/stylo/values/animated/svg.rs +46 -0
  249. package/vendor/stylo/values/animated/text.rs +58 -0
  250. package/vendor/stylo/values/animated/transform.rs +1592 -0
  251. package/vendor/stylo/values/computed/align.rs +90 -0
  252. package/vendor/stylo/values/computed/angle.rs +130 -0
  253. package/vendor/stylo/values/computed/animation.rs +124 -0
  254. package/vendor/stylo/values/computed/background.rs +13 -0
  255. package/vendor/stylo/values/computed/basic_shape.rs +267 -0
  256. package/vendor/stylo/values/computed/border.rs +163 -0
  257. package/vendor/stylo/values/computed/box.rs +267 -0
  258. package/vendor/stylo/values/computed/calc.rs +334 -0
  259. package/vendor/stylo/values/computed/color.rs +161 -0
  260. package/vendor/stylo/values/computed/column.rs +11 -0
  261. package/vendor/stylo/values/computed/corner_shape.rs +155 -0
  262. package/vendor/stylo/values/computed/counters.rs +26 -0
  263. package/vendor/stylo/values/computed/easing.rs +109 -0
  264. package/vendor/stylo/values/computed/effects.rs +30 -0
  265. package/vendor/stylo/values/computed/flex.rs +19 -0
  266. package/vendor/stylo/values/computed/font.rs +1517 -0
  267. package/vendor/stylo/values/computed/image.rs +273 -0
  268. package/vendor/stylo/values/computed/length.rs +576 -0
  269. package/vendor/stylo/values/computed/length_percentage.rs +1055 -0
  270. package/vendor/stylo/values/computed/list.rs +16 -0
  271. package/vendor/stylo/values/computed/mod.rs +1141 -0
  272. package/vendor/stylo/values/computed/motion.rs +73 -0
  273. package/vendor/stylo/values/computed/outline.rs +7 -0
  274. package/vendor/stylo/values/computed/page.rs +77 -0
  275. package/vendor/stylo/values/computed/param.rs +9 -0
  276. package/vendor/stylo/values/computed/percentage.rs +143 -0
  277. package/vendor/stylo/values/computed/position.rs +273 -0
  278. package/vendor/stylo/values/computed/ratio.rs +88 -0
  279. package/vendor/stylo/values/computed/rect.rs +19 -0
  280. package/vendor/stylo/values/computed/resolution.rs +76 -0
  281. package/vendor/stylo/values/computed/svg.rs +66 -0
  282. package/vendor/stylo/values/computed/table.rs +7 -0
  283. package/vendor/stylo/values/computed/text.rs +199 -0
  284. package/vendor/stylo/values/computed/time.rs +83 -0
  285. package/vendor/stylo/values/computed/transform.rs +559 -0
  286. package/vendor/stylo/values/computed/tree_counting.rs +30 -0
  287. package/vendor/stylo/values/computed/ui.rs +23 -0
  288. package/vendor/stylo/values/computed/url.rs +12 -0
  289. package/vendor/stylo/values/distance.rs +139 -0
  290. package/vendor/stylo/values/generics/animation.rs +363 -0
  291. package/vendor/stylo/values/generics/background.rs +65 -0
  292. package/vendor/stylo/values/generics/basic_shape.rs +1389 -0
  293. package/vendor/stylo/values/generics/border.rs +303 -0
  294. package/vendor/stylo/values/generics/box.rs +552 -0
  295. package/vendor/stylo/values/generics/calc.rs +2986 -0
  296. package/vendor/stylo/values/generics/color.rs +318 -0
  297. package/vendor/stylo/values/generics/column.rs +44 -0
  298. package/vendor/stylo/values/generics/counters.rs +320 -0
  299. package/vendor/stylo/values/generics/easing.rs +132 -0
  300. package/vendor/stylo/values/generics/effects.rs +131 -0
  301. package/vendor/stylo/values/generics/flex.rs +34 -0
  302. package/vendor/stylo/values/generics/font.rs +376 -0
  303. package/vendor/stylo/values/generics/grid.rs +962 -0
  304. package/vendor/stylo/values/generics/image.rs +653 -0
  305. package/vendor/stylo/values/generics/length.rs +656 -0
  306. package/vendor/stylo/values/generics/mod.rs +303 -0
  307. package/vendor/stylo/values/generics/motion.rs +274 -0
  308. package/vendor/stylo/values/generics/page.rs +167 -0
  309. package/vendor/stylo/values/generics/position.rs +669 -0
  310. package/vendor/stylo/values/generics/ratio.rs +88 -0
  311. package/vendor/stylo/values/generics/rect.rs +147 -0
  312. package/vendor/stylo/values/generics/size.rs +102 -0
  313. package/vendor/stylo/values/generics/svg.rs +226 -0
  314. package/vendor/stylo/values/generics/text.rs +268 -0
  315. package/vendor/stylo/values/generics/transform.rs +1157 -0
  316. package/vendor/stylo/values/generics/ui.rs +147 -0
  317. package/vendor/stylo/values/generics/url.rs +51 -0
  318. package/vendor/stylo/values/mod.rs +820 -0
  319. package/vendor/stylo/values/resolved/animation.rs +33 -0
  320. package/vendor/stylo/values/resolved/color.rs +53 -0
  321. package/vendor/stylo/values/resolved/counters.rs +45 -0
  322. package/vendor/stylo/values/resolved/mod.rs +316 -0
  323. package/vendor/stylo/values/specified/align.rs +711 -0
  324. package/vendor/stylo/values/specified/angle.rs +407 -0
  325. package/vendor/stylo/values/specified/animation.rs +921 -0
  326. package/vendor/stylo/values/specified/background.rs +270 -0
  327. package/vendor/stylo/values/specified/basic_shape.rs +986 -0
  328. package/vendor/stylo/values/specified/border.rs +430 -0
  329. package/vendor/stylo/values/specified/box.rs +2231 -0
  330. package/vendor/stylo/values/specified/calc.rs +1657 -0
  331. package/vendor/stylo/values/specified/color.rs +1210 -0
  332. package/vendor/stylo/values/specified/column.rs +11 -0
  333. package/vendor/stylo/values/specified/corner_shape.rs +152 -0
  334. package/vendor/stylo/values/specified/counters.rs +242 -0
  335. package/vendor/stylo/values/specified/easing.rs +225 -0
  336. package/vendor/stylo/values/specified/effects.rs +421 -0
  337. package/vendor/stylo/values/specified/flex.rs +42 -0
  338. package/vendor/stylo/values/specified/font.rs +2103 -0
  339. package/vendor/stylo/values/specified/frequency.rs +39 -0
  340. package/vendor/stylo/values/specified/grid.rs +407 -0
  341. package/vendor/stylo/values/specified/image.rs +1385 -0
  342. package/vendor/stylo/values/specified/intersection_observer.rs +80 -0
  343. package/vendor/stylo/values/specified/length.rs +2024 -0
  344. package/vendor/stylo/values/specified/list.rs +190 -0
  345. package/vendor/stylo/values/specified/mod.rs +531 -0
  346. package/vendor/stylo/values/specified/motion.rs +316 -0
  347. package/vendor/stylo/values/specified/number.rs +603 -0
  348. package/vendor/stylo/values/specified/outline.rs +69 -0
  349. package/vendor/stylo/values/specified/page.rs +94 -0
  350. package/vendor/stylo/values/specified/param.rs +121 -0
  351. package/vendor/stylo/values/specified/percentage.rs +364 -0
  352. package/vendor/stylo/values/specified/position.rs +2247 -0
  353. package/vendor/stylo/values/specified/ratio.rs +29 -0
  354. package/vendor/stylo/values/specified/rect.rs +28 -0
  355. package/vendor/stylo/values/specified/resolution.rs +237 -0
  356. package/vendor/stylo/values/specified/source_size_list.rs +135 -0
  357. package/vendor/stylo/values/specified/svg.rs +427 -0
  358. package/vendor/stylo/values/specified/svg_path.rs +1115 -0
  359. package/vendor/stylo/values/specified/table.rs +38 -0
  360. package/vendor/stylo/values/specified/text.rs +1561 -0
  361. package/vendor/stylo/values/specified/time.rs +313 -0
  362. package/vendor/stylo/values/specified/transform.rs +599 -0
  363. package/vendor/stylo/values/specified/tree_counting.rs +32 -0
  364. package/vendor/stylo/values/specified/ui.rs +344 -0
  365. package/vendor/stylo/values/specified/url.rs +12 -0
  366. package/vendor/stylo/values/tagged_numeric.rs +253 -0
  367. package/wasm/blitz_pdf.d.ts +67 -0
  368. package/wasm/blitz_pdf.js +699 -0
  369. package/wasm/blitz_pdf_bg.wasm +0 -0
  370. package/wasm/blitz_pdf_bg.wasm.d.ts +20 -0
@@ -0,0 +1,34 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! Gecko's C++ bindings, along with some rust helpers to ease its use.
6
+
7
+ // FIXME: We allow `improper_ctypes` (for now), because the lint doesn't allow
8
+ // foreign structs to have `PhantomData`. We should remove this once the lint
9
+ // ignores this case.
10
+
11
+ #[allow(unknown_lints)]
12
+ #[allow(
13
+ dead_code,
14
+ improper_ctypes,
15
+ non_camel_case_types,
16
+ non_snake_case,
17
+ non_upper_case_globals,
18
+ missing_docs,
19
+ unnecessary_transmutes,
20
+ unsafe_op_in_unsafe_fn,
21
+ clippy::doc_overindented_list_items,
22
+ clippy::missing_safety_doc,
23
+ clippy::ptr_offset_with_cast,
24
+ clippy::too_many_arguments,
25
+ clippy::transmute_int_to_bool,
26
+ clippy::useless_transmute
27
+ )]
28
+ pub mod structs {
29
+ include!(concat!(env!("OUT_DIR"), "/gecko/structs.rs"));
30
+ }
31
+
32
+ pub use self::structs as bindings;
33
+
34
+ pub mod sugar;
@@ -0,0 +1,12 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! Rust sugar and convenience methods for Gecko types.
6
+
7
+ mod ns_com_ptr;
8
+ mod ns_compatibility;
9
+ mod ns_style_auto_array;
10
+ pub mod origin_flags;
11
+ pub mod ownership;
12
+ pub mod refptr;
@@ -0,0 +1,15 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! Little helpers for `nsCOMPtr`.
6
+
7
+ use crate::gecko_bindings::structs::nsCOMPtr;
8
+
9
+ impl<T> nsCOMPtr<T> {
10
+ /// Get this pointer as a raw pointer.
11
+ #[inline]
12
+ pub fn raw(&self) -> *mut T {
13
+ self.mRawPtr
14
+ }
15
+ }
@@ -0,0 +1,19 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! Little helper for `nsCompatibility`.
6
+
7
+ use crate::context::QuirksMode;
8
+ use crate::gecko_bindings::structs::nsCompatibility;
9
+
10
+ impl From<nsCompatibility> for QuirksMode {
11
+ #[inline]
12
+ fn from(mode: nsCompatibility) -> QuirksMode {
13
+ match mode {
14
+ nsCompatibility::eCompatibility_FullStandards => QuirksMode::NoQuirks,
15
+ nsCompatibility::eCompatibility_AlmostStandards => QuirksMode::LimitedQuirks,
16
+ nsCompatibility::eCompatibility_NavQuirks => QuirksMode::Quirks,
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,111 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! Rust helpers for Gecko's `nsStyleAutoArray`.
6
+
7
+ use crate::gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength;
8
+ use crate::gecko_bindings::bindings::Gecko_EnsureStyleScrollTimelineArrayLength;
9
+ use crate::gecko_bindings::bindings::Gecko_EnsureStyleTransitionArrayLength;
10
+ use crate::gecko_bindings::bindings::Gecko_EnsureStyleViewTimelineArrayLength;
11
+ use crate::gecko_bindings::structs::nsStyleAutoArray;
12
+ use crate::gecko_bindings::structs::{StyleAnimation, StyleTransition};
13
+ use crate::gecko_bindings::structs::{StyleScrollTimeline, StyleViewTimeline};
14
+ use std::iter::{once, Chain, Once};
15
+ use std::ops::{Index, IndexMut};
16
+ use std::slice::{Iter, IterMut};
17
+
18
+ impl<T> Index<usize> for nsStyleAutoArray<T> {
19
+ type Output = T;
20
+ fn index(&self, index: usize) -> &T {
21
+ match index {
22
+ 0 => &self.mFirstElement,
23
+ _ => &self.mOtherElements[index - 1],
24
+ }
25
+ }
26
+ }
27
+
28
+ impl<T> IndexMut<usize> for nsStyleAutoArray<T> {
29
+ fn index_mut(&mut self, index: usize) -> &mut T {
30
+ match index {
31
+ 0 => &mut self.mFirstElement,
32
+ _ => &mut self.mOtherElements[index - 1],
33
+ }
34
+ }
35
+ }
36
+
37
+ impl<T> nsStyleAutoArray<T> {
38
+ /// Mutably iterate over the array elements.
39
+ pub fn iter_mut(&mut self) -> Chain<Once<&mut T>, IterMut<'_, T>> {
40
+ once(&mut self.mFirstElement).chain(self.mOtherElements.iter_mut())
41
+ }
42
+
43
+ /// Iterate over the array elements.
44
+ pub fn iter(&self) -> Chain<Once<&T>, Iter<'_, T>> {
45
+ once(&self.mFirstElement).chain(self.mOtherElements.iter())
46
+ }
47
+
48
+ /// Returns the length of the array.
49
+ ///
50
+ /// Note that often structs containing autoarrays will have additional
51
+ /// member fields that contain the length, which must be kept in sync.
52
+ pub fn len(&self) -> usize {
53
+ 1 + self.mOtherElements.len()
54
+ }
55
+ }
56
+
57
+ impl nsStyleAutoArray<StyleAnimation> {
58
+ /// Ensures that the array has length at least the given length.
59
+ pub fn ensure_len(&mut self, len: usize) {
60
+ unsafe {
61
+ Gecko_EnsureStyleAnimationArrayLength(
62
+ self as *mut nsStyleAutoArray<StyleAnimation> as *mut _,
63
+ len,
64
+ );
65
+ }
66
+ }
67
+ }
68
+
69
+ impl nsStyleAutoArray<StyleTransition> {
70
+ /// Ensures that the array has length at least the given length.
71
+ pub fn ensure_len(&mut self, len: usize) {
72
+ unsafe {
73
+ Gecko_EnsureStyleTransitionArrayLength(
74
+ self as *mut nsStyleAutoArray<StyleTransition> as *mut _,
75
+ len,
76
+ );
77
+ }
78
+ }
79
+ }
80
+
81
+ impl nsStyleAutoArray<StyleViewTimeline> {
82
+ /// Ensures that the array has length at least the given length.
83
+ pub fn ensure_len(&mut self, len: usize) {
84
+ unsafe {
85
+ Gecko_EnsureStyleViewTimelineArrayLength(
86
+ self as *mut nsStyleAutoArray<StyleViewTimeline> as *mut _,
87
+ len,
88
+ );
89
+ }
90
+ }
91
+ }
92
+
93
+ impl nsStyleAutoArray<StyleScrollTimeline> {
94
+ /// Ensures that the array has length at least the given length.
95
+ pub fn ensure_len(&mut self, len: usize) {
96
+ unsafe {
97
+ Gecko_EnsureStyleScrollTimelineArrayLength(
98
+ self as *mut nsStyleAutoArray<StyleScrollTimeline> as *mut _,
99
+ len,
100
+ );
101
+ }
102
+ }
103
+ }
104
+
105
+ impl<'a, T> IntoIterator for &'a mut nsStyleAutoArray<T> {
106
+ type Item = &'a mut T;
107
+ type IntoIter = Chain<Once<&'a mut T>, IterMut<'a, T>>;
108
+ fn into_iter(self) -> Self::IntoIter {
109
+ self.iter_mut()
110
+ }
111
+ }
@@ -0,0 +1,31 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! Helper to iterate over `OriginFlags` bits.
6
+
7
+ use crate::gecko_bindings::structs::OriginFlags;
8
+ use crate::stylesheets::OriginSet;
9
+
10
+ /// Checks that the values for OriginFlags are the ones we expect.
11
+ pub fn assert_flags_match() {
12
+ use crate::stylesheets::origin::*;
13
+ debug_assert_eq!(
14
+ OriginFlags::UserAgent.0,
15
+ OriginSet::ORIGIN_USER_AGENT.bits()
16
+ );
17
+ debug_assert_eq!(OriginFlags::Author.0, OriginSet::ORIGIN_AUTHOR.bits());
18
+ debug_assert_eq!(OriginFlags::User.0, OriginSet::ORIGIN_USER.bits());
19
+ }
20
+
21
+ impl From<OriginFlags> for OriginSet {
22
+ fn from(flags: OriginFlags) -> Self {
23
+ Self::from_bits_retain(flags.0)
24
+ }
25
+ }
26
+
27
+ impl From<OriginSet> for OriginFlags {
28
+ fn from(set: OriginSet) -> Self {
29
+ OriginFlags(set.bits())
30
+ }
31
+ }
@@ -0,0 +1,70 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! Helpers for different FFI pointer kinds that Gecko's FFI layer uses.
6
+
7
+ use crate::gecko_bindings::structs::root::mozilla::detail::CopyablePtr;
8
+ use servo_arc::Arc;
9
+ use std::marker::PhantomData;
10
+ use std::ops::{Deref, DerefMut};
11
+ use std::ptr;
12
+
13
+ /// Gecko-FFI-safe Arc (T is an ArcInner).
14
+ ///
15
+ /// This can be null.
16
+ ///
17
+ /// Leaks on drop. Please don't drop this.
18
+ #[repr(C)]
19
+ pub struct Strong<GeckoType> {
20
+ ptr: *const GeckoType,
21
+ _marker: PhantomData<GeckoType>,
22
+ }
23
+
24
+ impl<T> From<Arc<T>> for Strong<T> {
25
+ fn from(arc: Arc<T>) -> Self {
26
+ Self {
27
+ ptr: Arc::into_raw(arc),
28
+ _marker: PhantomData,
29
+ }
30
+ }
31
+ }
32
+
33
+ impl<T> From<Option<Arc<T>>> for Strong<T> {
34
+ fn from(arc: Option<Arc<T>>) -> Self {
35
+ match arc {
36
+ Some(arc) => arc.into(),
37
+ None => Self::null(),
38
+ }
39
+ }
40
+ }
41
+
42
+ impl<GeckoType> Strong<GeckoType> {
43
+ #[inline]
44
+ /// Returns whether this reference is null.
45
+ pub fn is_null(&self) -> bool {
46
+ self.ptr.is_null()
47
+ }
48
+
49
+ #[inline]
50
+ /// Returns a null pointer
51
+ pub fn null() -> Self {
52
+ Self {
53
+ ptr: ptr::null(),
54
+ _marker: PhantomData,
55
+ }
56
+ }
57
+ }
58
+
59
+ impl<T> Deref for CopyablePtr<T> {
60
+ type Target = T;
61
+ fn deref(&self) -> &Self::Target {
62
+ &self.mPtr
63
+ }
64
+ }
65
+
66
+ impl<T> DerefMut for CopyablePtr<T> {
67
+ fn deref_mut(&mut self) -> &mut T {
68
+ &mut self.mPtr
69
+ }
70
+ }
@@ -0,0 +1,299 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! A rust helper to ease the use of Gecko's refcounted types.
6
+
7
+ use crate::gecko_bindings::{bindings, structs};
8
+ use crate::Atom;
9
+ use servo_arc::Arc;
10
+ use std::fmt::Write;
11
+ use std::marker::PhantomData;
12
+ use std::ops::Deref;
13
+ use std::{fmt, mem, ptr};
14
+
15
+ /// Trait for all objects that have Addref() and Release
16
+ /// methods and can be placed inside RefPtr<T>
17
+ pub unsafe trait RefCounted {
18
+ /// Bump the reference count.
19
+ fn addref(&self);
20
+ /// Decrease the reference count.
21
+ unsafe fn release(&self);
22
+ }
23
+
24
+ /// Trait for types which can be shared across threads in RefPtr.
25
+ pub unsafe trait ThreadSafeRefCounted: RefCounted {}
26
+
27
+ /// A custom RefPtr implementation to take into account Drop semantics and
28
+ /// a bit less-painful memory management.
29
+ pub struct RefPtr<T: RefCounted> {
30
+ ptr: *mut T,
31
+ _marker: PhantomData<T>,
32
+ }
33
+
34
+ impl<T: RefCounted> fmt::Debug for RefPtr<T> {
35
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
36
+ f.write_str("RefPtr { ")?;
37
+ self.ptr.fmt(f)?;
38
+ f.write_char('}')
39
+ }
40
+ }
41
+
42
+ impl<T: RefCounted> RefPtr<T> {
43
+ /// Create a new RefPtr from an already addrefed pointer obtained from FFI.
44
+ ///
45
+ /// The pointer must be valid, non-null and have been addrefed.
46
+ pub unsafe fn from_addrefed(ptr: *mut T) -> Self {
47
+ debug_assert!(!ptr.is_null());
48
+ RefPtr {
49
+ ptr,
50
+ _marker: PhantomData,
51
+ }
52
+ }
53
+
54
+ /// Returns whether the current pointer is null.
55
+ pub fn is_null(&self) -> bool {
56
+ self.ptr.is_null()
57
+ }
58
+
59
+ /// Returns a null pointer.
60
+ pub fn null() -> Self {
61
+ Self {
62
+ ptr: ptr::null_mut(),
63
+ _marker: PhantomData,
64
+ }
65
+ }
66
+
67
+ /// Create a new RefPtr from a pointer obtained from FFI.
68
+ ///
69
+ /// This method calls addref() internally
70
+ pub unsafe fn new(ptr: *mut T) -> Self {
71
+ let ret = RefPtr {
72
+ ptr,
73
+ _marker: PhantomData,
74
+ };
75
+ ret.addref();
76
+ ret
77
+ }
78
+
79
+ /// Produces an FFI-compatible RefPtr that can be stored in style structs.
80
+ ///
81
+ /// structs::RefPtr does not have a destructor, so this may leak
82
+ pub fn forget(self) -> structs::RefPtr<T> {
83
+ let ret = structs::RefPtr {
84
+ mRawPtr: self.ptr,
85
+ _phantom_0: PhantomData,
86
+ };
87
+ mem::forget(self);
88
+ ret
89
+ }
90
+
91
+ /// Returns the raw inner pointer to be fed back into FFI.
92
+ pub fn get(&self) -> *mut T {
93
+ self.ptr
94
+ }
95
+
96
+ /// Addref the inner data, obviously leaky on its own.
97
+ pub fn addref(&self) {
98
+ if !self.ptr.is_null() {
99
+ unsafe {
100
+ (*self.ptr).addref();
101
+ }
102
+ }
103
+ }
104
+
105
+ /// Release the inner data.
106
+ ///
107
+ /// Call only when the data actually needs releasing.
108
+ pub unsafe fn release(&self) {
109
+ unsafe {
110
+ if !self.ptr.is_null() {
111
+ (*self.ptr).release();
112
+ }
113
+ }
114
+ }
115
+ }
116
+
117
+ impl<T: RefCounted> Deref for RefPtr<T> {
118
+ type Target = T;
119
+ fn deref(&self) -> &T {
120
+ debug_assert!(!self.ptr.is_null());
121
+ unsafe { &*self.ptr }
122
+ }
123
+ }
124
+
125
+ impl<T: RefCounted> structs::RefPtr<T> {
126
+ /// Produces a Rust-side RefPtr from an FFI RefPtr, bumping the refcount.
127
+ ///
128
+ /// Must be called on a valid, non-null structs::RefPtr<T>.
129
+ pub unsafe fn to_safe(&self) -> RefPtr<T> {
130
+ let r = RefPtr {
131
+ ptr: self.mRawPtr,
132
+ _marker: PhantomData,
133
+ };
134
+ r.addref();
135
+ r
136
+ }
137
+ /// Produces a Rust-side RefPtr, consuming the existing one (and not bumping
138
+ /// the refcount).
139
+ pub unsafe fn into_safe(self) -> RefPtr<T> {
140
+ debug_assert!(!self.mRawPtr.is_null());
141
+ RefPtr {
142
+ ptr: self.mRawPtr,
143
+ _marker: PhantomData,
144
+ }
145
+ }
146
+
147
+ /// Replace a structs::RefPtr<T> with a different one, appropriately
148
+ /// addref/releasing.
149
+ ///
150
+ /// Both `self` and `other` must be valid, but can be null.
151
+ ///
152
+ /// Safe when called on an aliased pointer because the refcount in that case
153
+ /// needs to be at least two.
154
+ pub unsafe fn set(&mut self, other: &Self) {
155
+ unsafe {
156
+ self.clear();
157
+ if !other.mRawPtr.is_null() {
158
+ *self = other.to_safe().forget();
159
+ }
160
+ }
161
+ }
162
+
163
+ /// Clear an instance of the structs::RefPtr<T>, by releasing
164
+ /// it and setting its contents to null.
165
+ ///
166
+ /// `self` must be valid, but can be null.
167
+ pub unsafe fn clear(&mut self) {
168
+ unsafe {
169
+ if !self.mRawPtr.is_null() {
170
+ (*self.mRawPtr).release();
171
+ self.mRawPtr = ptr::null_mut();
172
+ }
173
+ }
174
+ }
175
+
176
+ /// Replace a `structs::RefPtr<T>` with a `RefPtr<T>`,
177
+ /// consuming the `RefPtr<T>`, and releasing the old
178
+ /// value in `self` if necessary.
179
+ ///
180
+ /// `self` must be valid, possibly null.
181
+ pub fn set_move(&mut self, other: RefPtr<T>) {
182
+ if !self.mRawPtr.is_null() {
183
+ unsafe {
184
+ (*self.mRawPtr).release();
185
+ }
186
+ }
187
+ *self = other.forget();
188
+ }
189
+ }
190
+
191
+ impl<T> structs::RefPtr<T> {
192
+ /// Returns a new, null refptr.
193
+ pub fn null() -> Self {
194
+ Self {
195
+ mRawPtr: ptr::null_mut(),
196
+ _phantom_0: PhantomData,
197
+ }
198
+ }
199
+
200
+ /// Create a new RefPtr from an arc.
201
+ pub fn from_arc(s: Arc<T>) -> Self {
202
+ Self {
203
+ mRawPtr: Arc::into_raw(s) as *mut _,
204
+ _phantom_0: PhantomData,
205
+ }
206
+ }
207
+
208
+ /// Sets the contents to an Arc<T>.
209
+ pub fn set_arc(&mut self, other: Arc<T>) {
210
+ unsafe {
211
+ if !self.mRawPtr.is_null() {
212
+ let _ = Arc::from_raw(self.mRawPtr);
213
+ }
214
+ self.mRawPtr = Arc::into_raw(other) as *mut _;
215
+ }
216
+ }
217
+ }
218
+
219
+ impl<T: RefCounted> Drop for RefPtr<T> {
220
+ fn drop(&mut self) {
221
+ unsafe { self.release() }
222
+ }
223
+ }
224
+
225
+ impl<T: RefCounted> Clone for RefPtr<T> {
226
+ fn clone(&self) -> Self {
227
+ self.addref();
228
+ RefPtr {
229
+ ptr: self.ptr,
230
+ _marker: PhantomData,
231
+ }
232
+ }
233
+ }
234
+
235
+ impl<T: RefCounted> PartialEq for RefPtr<T> {
236
+ fn eq(&self, other: &Self) -> bool {
237
+ self.ptr == other.ptr
238
+ }
239
+ }
240
+
241
+ unsafe impl<T: ThreadSafeRefCounted> Send for RefPtr<T> {}
242
+ unsafe impl<T: ThreadSafeRefCounted> Sync for RefPtr<T> {}
243
+
244
+ macro_rules! impl_refcount {
245
+ ($t:ty, $addref:path, $release:path) => {
246
+ unsafe impl RefCounted for $t {
247
+ #[inline]
248
+ fn addref(&self) {
249
+ unsafe { $addref(self as *const _ as *mut _) }
250
+ }
251
+
252
+ #[inline]
253
+ unsafe fn release(&self) {
254
+ unsafe { $release(self as *const _ as *mut _) }
255
+ }
256
+ }
257
+ };
258
+ }
259
+
260
+ // Companion of NS_DECL_THREADSAFE_FFI_REFCOUNTING.
261
+ //
262
+ // Gets you a free RefCounted impl implemented via FFI.
263
+ macro_rules! impl_threadsafe_refcount {
264
+ ($t:ty, $addref:path, $release:path) => {
265
+ impl_refcount!($t, $addref, $release);
266
+ unsafe impl ThreadSafeRefCounted for $t {}
267
+ };
268
+ }
269
+
270
+ impl_threadsafe_refcount!(
271
+ structs::mozilla::URLExtraData,
272
+ bindings::Gecko_AddRefURLExtraDataArbitraryThread,
273
+ bindings::Gecko_ReleaseURLExtraDataArbitraryThread
274
+ );
275
+ impl_threadsafe_refcount!(
276
+ structs::nsIURI,
277
+ bindings::Gecko_AddRefnsIURIArbitraryThread,
278
+ bindings::Gecko_ReleasensIURIArbitraryThread
279
+ );
280
+ impl_threadsafe_refcount!(
281
+ structs::SheetLoadDataHolder,
282
+ bindings::Gecko_AddRefSheetLoadDataHolderArbitraryThread,
283
+ bindings::Gecko_ReleaseSheetLoadDataHolderArbitraryThread
284
+ );
285
+
286
+ #[inline]
287
+ unsafe fn addref_atom(atom: *mut structs::nsAtom) {
288
+ unsafe {
289
+ mem::forget(Atom::from_raw(atom));
290
+ }
291
+ }
292
+
293
+ #[inline]
294
+ unsafe fn release_atom(atom: *mut structs::nsAtom) {
295
+ unsafe {
296
+ let _ = Atom::from_addrefed(atom);
297
+ }
298
+ }
299
+ impl_threadsafe_refcount!(structs::nsAtom, addref_atom, release_atom);