blitz-pdf 0.0.0-stage → 0.1.0

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 +355 -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,328 @@
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
+ //! Applicable declarations management.
6
+
7
+ use crate::derives::*;
8
+ use crate::properties::PropertyDeclarationBlock;
9
+ use crate::rule_tree::{CascadeLevel, RuleCascadeFlags, StyleSource};
10
+ use crate::shared_lock::Locked;
11
+ use crate::stylesheets::layer_rule::LayerOrder;
12
+ use servo_arc::Arc;
13
+ use smallvec::SmallVec;
14
+
15
+ /// List of applicable declarations. This is a transient structure that shuttles
16
+ /// declarations between selector matching and inserting into the rule tree, and
17
+ /// therefore we want to avoid heap-allocation where possible.
18
+ ///
19
+ /// In measurements on wikipedia, we pretty much never have more than 8 applicable
20
+ /// declarations, so we could consider making this 8 entries instead of 16.
21
+ /// However, it may depend a lot on workload, and stack space is cheap.
22
+ pub type ApplicableDeclarationList = SmallVec<[ApplicableDeclarationBlock; 16]>;
23
+
24
+ /// Blink uses 18 bits to store source order, and does not check overflow [1].
25
+ /// That's a limit that could be reached in realistic webpages, so we use
26
+ /// 24 bits and enforce defined behavior in the overflow case.
27
+ ///
28
+ /// Note that right now this restriction could be lifted if wanted (because we
29
+ /// no longer stash the cascade level in the remaining bits), but we keep it in
30
+ /// place in case we come up with a use-case for them, lacking reports of the
31
+ /// current limit being too small.
32
+ ///
33
+ /// [1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/css/
34
+ /// RuleSet.h?l=128&rcl=90140ab80b84d0f889abc253410f44ed54ae04f3
35
+ const SOURCE_ORDER_BITS: usize = 24;
36
+ const SOURCE_ORDER_MAX: u32 = (1 << SOURCE_ORDER_BITS) - 1;
37
+ const SOURCE_ORDER_MASK: u32 = SOURCE_ORDER_MAX;
38
+
39
+ /// The cascade-level+layer order of this declaration.
40
+ #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
41
+ pub struct CascadePriority {
42
+ cascade_level: CascadeLevel,
43
+ flags: RuleCascadeFlags,
44
+ layer_order: LayerOrder,
45
+ }
46
+
47
+ const_assert_eq!(
48
+ std::mem::size_of::<CascadePriority>(),
49
+ std::mem::size_of::<u32>()
50
+ );
51
+
52
+ impl PartialOrd for CascadePriority {
53
+ #[inline]
54
+ fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
55
+ Some(self.cmp(other))
56
+ }
57
+ }
58
+
59
+ impl Ord for CascadePriority {
60
+ fn cmp(&self, other: &Self) -> std::cmp::Ordering {
61
+ self.cascade_level.cmp(&other.cascade_level).then_with(|| {
62
+ let ordering = self.layer_order.cmp(&other.layer_order);
63
+ if ordering == std::cmp::Ordering::Equal {
64
+ return ordering;
65
+ }
66
+ // https://drafts.csswg.org/css-cascade-5/#cascade-layering
67
+ //
68
+ // Cascade layers (like declarations) are ordered by order
69
+ // of appearance. When comparing declarations that belong to
70
+ // different layers, then for normal rules the declaration
71
+ // whose cascade layer is last wins, and for important rules
72
+ // the declaration whose cascade layer is first wins.
73
+ //
74
+ // But the style attribute layer for some reason is special.
75
+ if self.cascade_level.is_important()
76
+ && !self.layer_order.is_style_attribute_layer()
77
+ && !other.layer_order.is_style_attribute_layer()
78
+ {
79
+ ordering.reverse()
80
+ } else {
81
+ ordering
82
+ }
83
+ })
84
+ }
85
+ }
86
+
87
+ /// The kind of revert that we're applying.
88
+ #[derive(Clone, Copy, Debug, Eq, PartialEq)]
89
+ pub enum RevertKind {
90
+ /// revert
91
+ Origin,
92
+ /// revert-layer
93
+ Layer,
94
+ /// revert-rule
95
+ Rule,
96
+ }
97
+
98
+ impl CascadePriority {
99
+ /// Construct a new CascadePriority for a given (level, order, flags) triple.
100
+ pub fn new(
101
+ cascade_level: CascadeLevel,
102
+ layer_order: LayerOrder,
103
+ flags: RuleCascadeFlags,
104
+ ) -> Self {
105
+ Self {
106
+ cascade_level,
107
+ flags,
108
+ layer_order,
109
+ }
110
+ }
111
+
112
+ /// Returns the flags.
113
+ #[inline]
114
+ pub fn flags(&self) -> RuleCascadeFlags {
115
+ self.flags
116
+ }
117
+
118
+ /// Set given flags.
119
+ #[inline]
120
+ pub fn set_flags(&mut self, flags: RuleCascadeFlags) {
121
+ self.flags.insert(flags);
122
+ }
123
+
124
+ /// Returns the layer order.
125
+ #[inline]
126
+ pub fn layer_order(&self) -> LayerOrder {
127
+ self.layer_order
128
+ }
129
+
130
+ /// Returns the cascade level.
131
+ #[inline]
132
+ pub fn cascade_level(&self) -> CascadeLevel {
133
+ self.cascade_level
134
+ }
135
+
136
+ /// Whether this declaration should be allowed if `revert` / `revert-layer` / `revert-rule`
137
+ /// have been specified on a given origin.
138
+ ///
139
+ /// `self` is the priority at which the revert has been specified.
140
+ pub fn allows_when_reverted(&self, other: &Self, kind: RevertKind) -> bool {
141
+ match kind {
142
+ RevertKind::Origin => {
143
+ other.cascade_level.origin().origin() < self.cascade_level.origin().origin()
144
+ },
145
+ RevertKind::Layer => other.unimportant() < self.unimportant(),
146
+ // Any other declaration for the same property we apply in the cascade needs to come
147
+ // from another rule effectively.
148
+ RevertKind::Rule => true,
149
+ }
150
+ }
151
+
152
+ /// Convert this priority from "important" to "non-important", if needed.
153
+ pub fn unimportant(&self) -> Self {
154
+ Self {
155
+ cascade_level: self.cascade_level.unimportant(),
156
+ flags: self.flags,
157
+ layer_order: self.layer_order,
158
+ }
159
+ }
160
+
161
+ /// Convert this priority from "non-important" to "important", if needed.
162
+ pub fn important(&self) -> Self {
163
+ Self {
164
+ cascade_level: self.cascade_level.important(),
165
+ flags: self.flags,
166
+ layer_order: self.layer_order,
167
+ }
168
+ }
169
+
170
+ /// The same tree, in author origin, at the root layer.
171
+ pub fn same_tree_author_normal_at_root_layer() -> Self {
172
+ Self::new(
173
+ CascadeLevel::same_tree_author_normal(),
174
+ LayerOrder::root(),
175
+ RuleCascadeFlags::empty(),
176
+ )
177
+ }
178
+ }
179
+
180
+ /// Proximity to the scope root.
181
+ ///
182
+ /// https://drafts.csswg.org/css-cascade-6/#cascade-proximity
183
+ #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
184
+ pub struct ScopeProximity(u16);
185
+
186
+ impl PartialOrd for ScopeProximity {
187
+ #[inline]
188
+ fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
189
+ Some(self.cmp(other))
190
+ }
191
+ }
192
+
193
+ impl Ord for ScopeProximity {
194
+ fn cmp(&self, other: &Self) -> std::cmp::Ordering {
195
+ // Lower proximity to scope root wins
196
+ other.0.cmp(&self.0)
197
+ }
198
+ }
199
+
200
+ /// Sacrifice the largest possible value for infinity. This makes the comparison
201
+ /// trivial.
202
+ const PROXIMITY_INFINITY: u16 = u16::MAX;
203
+
204
+ impl ScopeProximity {
205
+ /// Construct a new scope proximity.
206
+ pub fn new(proximity: usize) -> Self {
207
+ if cfg!(debug_assertions) && proximity >= PROXIMITY_INFINITY as usize {
208
+ warn!("Proximity out of bounds");
209
+ }
210
+ Self(proximity.clamp(0, (PROXIMITY_INFINITY - 1) as usize) as u16)
211
+ }
212
+
213
+ /// Create a scope proximity for delcarations outside of any scope root.
214
+ pub fn infinity() -> Self {
215
+ Self(PROXIMITY_INFINITY)
216
+ }
217
+
218
+ /// If the proximity is finite, get the value.
219
+ pub fn get(&self) -> Option<u16> {
220
+ (self.0 != PROXIMITY_INFINITY).then_some(self.0)
221
+ }
222
+ }
223
+
224
+ /// A property declaration together with its precedence among rules of equal
225
+ /// specificity so that we can sort them.
226
+ ///
227
+ /// This represents the declarations in a given declaration block for a given
228
+ /// importance.
229
+ #[derive(Clone, Debug, MallocSizeOf, PartialEq)]
230
+ pub struct ApplicableDeclarationBlock {
231
+ /// The style source, either a style rule, or a property declaration block.
232
+ #[ignore_malloc_size_of = "Arc"]
233
+ pub source: StyleSource,
234
+ /// Order of appearance in which this rule appears - Set to 0 if not relevant
235
+ /// (e.g. Declaration from `style="/*...*/"`, presentation hints, animations
236
+ /// - See `CascadePriority` instead).
237
+ source_order: u32,
238
+ /// The specificity of the selector.
239
+ pub specificity: u32,
240
+ /// The proximity to the scope root.
241
+ pub scope_proximity: ScopeProximity,
242
+ /// The cascade priority of the rule.
243
+ pub cascade_priority: CascadePriority,
244
+ }
245
+
246
+ impl ApplicableDeclarationBlock {
247
+ /// Constructs an applicable declaration block from a given property
248
+ /// declaration block and importance.
249
+ #[inline]
250
+ pub fn from_declarations(
251
+ declarations: Arc<Locked<PropertyDeclarationBlock>>,
252
+ level: CascadeLevel,
253
+ layer_order: LayerOrder,
254
+ ) -> Self {
255
+ ApplicableDeclarationBlock {
256
+ source: StyleSource::from_declarations(declarations),
257
+ source_order: 0,
258
+ specificity: 0,
259
+ scope_proximity: ScopeProximity::infinity(),
260
+ cascade_priority: CascadePriority::new(level, layer_order, RuleCascadeFlags::empty()),
261
+ }
262
+ }
263
+
264
+ /// Constructs an applicable declaration block from the given components.
265
+ #[inline]
266
+ pub fn new(
267
+ source: StyleSource,
268
+ source_order: u32,
269
+ level: CascadeLevel,
270
+ specificity: u32,
271
+ layer_order: LayerOrder,
272
+ scope_proximity: ScopeProximity,
273
+ flags: RuleCascadeFlags,
274
+ ) -> Self {
275
+ ApplicableDeclarationBlock {
276
+ source,
277
+ source_order: source_order & SOURCE_ORDER_MASK,
278
+ specificity,
279
+ scope_proximity,
280
+ cascade_priority: CascadePriority::new(level, layer_order, flags),
281
+ }
282
+ }
283
+
284
+ /// Returns the source order of the block.
285
+ #[inline]
286
+ pub fn source_order(&self) -> u32 {
287
+ self.source_order
288
+ }
289
+
290
+ /// Returns the cascade level of the block.
291
+ #[inline]
292
+ pub fn level(&self) -> CascadeLevel {
293
+ self.cascade_priority.cascade_level()
294
+ }
295
+
296
+ /// Returns the cascade level of the block.
297
+ #[inline]
298
+ pub fn layer_order(&self) -> LayerOrder {
299
+ self.cascade_priority.layer_order()
300
+ }
301
+
302
+ /// Returns the scope proximity of the block.
303
+ #[inline]
304
+ pub fn scope_proximity(&self) -> ScopeProximity {
305
+ self.scope_proximity
306
+ }
307
+
308
+ /// Convenience method to consume self and return the right thing for the
309
+ /// rule tree to iterate over.
310
+ #[inline]
311
+ pub fn for_rule_tree(self) -> (StyleSource, CascadePriority) {
312
+ (self.source, self.cascade_priority)
313
+ }
314
+
315
+ /// Return the key used to sort applicable declarations.
316
+ #[inline]
317
+ pub fn sort_key(&self) -> (LayerOrder, u32, ScopeProximity, u32) {
318
+ (
319
+ self.layer_order(),
320
+ self.specificity,
321
+ self.scope_proximity(),
322
+ self.source_order(),
323
+ )
324
+ }
325
+ }
326
+
327
+ // Size of this struct determines sorting and selector-matching performance.
328
+ size_of_test!(ApplicableDeclarationBlock, 24);
@@ -0,0 +1,79 @@
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 set of author stylesheets and their computed representation, such as the
6
+ //! ones used for ShadowRoot.
7
+
8
+ use crate::derives::*;
9
+ use crate::invalidation::stylesheets::StylesheetInvalidationSet;
10
+ use crate::shared_lock::SharedRwLockReadGuard;
11
+ use crate::stylesheet_set::AuthorStylesheetSet;
12
+ use crate::stylesheets::StylesheetInDocument;
13
+ use crate::stylist::CascadeData;
14
+ use crate::stylist::Stylist;
15
+ use servo_arc::Arc;
16
+ use std::sync::LazyLock;
17
+
18
+ /// A set of author stylesheets and their computed representation, such as the
19
+ /// ones used for ShadowRoot.
20
+ #[derive(MallocSizeOf)]
21
+ pub struct GenericAuthorStyles<S>
22
+ where
23
+ S: StylesheetInDocument + PartialEq + 'static,
24
+ {
25
+ /// The sheet collection, which holds the sheet pointers, the invalidations,
26
+ /// and all that stuff.
27
+ pub stylesheets: AuthorStylesheetSet<S>,
28
+ /// The actual cascade data computed from the stylesheets.
29
+ #[ignore_malloc_size_of = "Measured as part of the stylist"]
30
+ pub data: Arc<CascadeData>,
31
+ }
32
+
33
+ pub use self::GenericAuthorStyles as AuthorStyles;
34
+
35
+ static EMPTY_CASCADE_DATA: LazyLock<Arc<CascadeData>> =
36
+ LazyLock::new(|| Arc::new_leaked(CascadeData::new()));
37
+
38
+ impl<S> Default for GenericAuthorStyles<S>
39
+ where
40
+ S: StylesheetInDocument + PartialEq + 'static,
41
+ {
42
+ fn default() -> Self {
43
+ Self::new()
44
+ }
45
+ }
46
+
47
+ impl<S> GenericAuthorStyles<S>
48
+ where
49
+ S: StylesheetInDocument + PartialEq + 'static,
50
+ {
51
+ /// Create an empty AuthorStyles.
52
+ #[inline]
53
+ pub fn new() -> Self {
54
+ Self {
55
+ stylesheets: AuthorStylesheetSet::new(),
56
+ data: EMPTY_CASCADE_DATA.clone(),
57
+ }
58
+ }
59
+
60
+ /// Flush the pending sheet changes, updating `data` as appropriate.
61
+ #[inline]
62
+ pub fn flush(
63
+ &mut self,
64
+ stylist: &mut Stylist,
65
+ guard: &SharedRwLockReadGuard,
66
+ ) -> StylesheetInvalidationSet {
67
+ let (flusher, mut invalidations) = self.stylesheets.flush();
68
+ let result = stylist.rebuild_author_data(
69
+ &self.data,
70
+ flusher.sheets,
71
+ guard,
72
+ &mut invalidations.cascade_data_difference,
73
+ );
74
+ if let Ok(Some(new_data)) = result {
75
+ self.data = new_data;
76
+ }
77
+ invalidations
78
+ }
79
+ }
@@ -0,0 +1,176 @@
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
+ //! Parametric Bézier curves.
6
+ //!
7
+ //! This is based on `WebCore/platform/graphics/UnitBezier.h` in WebKit.
8
+
9
+ #![deny(missing_docs)]
10
+
11
+ use crate::values::CSSFloat;
12
+
13
+ const NEWTON_METHOD_ITERATIONS: u8 = 8;
14
+
15
+ /// A unit cubic Bézier curve, used for timing functions in CSS transitions and animations.
16
+ pub struct Bezier {
17
+ ax: f64,
18
+ bx: f64,
19
+ cx: f64,
20
+ ay: f64,
21
+ by: f64,
22
+ cy: f64,
23
+ }
24
+
25
+ impl Bezier {
26
+ /// Calculate the output of a unit cubic Bézier curve from the two middle control points.
27
+ ///
28
+ /// X coordinate is time, Y coordinate is function advancement.
29
+ /// The nominal range for both is 0 to 1.
30
+ ///
31
+ /// The start and end points are always (0, 0) and (1, 1) so that a transition or animation
32
+ /// starts at 0% and ends at 100%.
33
+ pub fn calculate_bezier_output(
34
+ progress: f64,
35
+ epsilon: f64,
36
+ x1: f32,
37
+ y1: f32,
38
+ x2: f32,
39
+ y2: f32,
40
+ ) -> f64 {
41
+ // Check for a linear curve.
42
+ if x1 == y1 && x2 == y2 {
43
+ return progress;
44
+ }
45
+
46
+ // Ensure that we return 0 or 1 on both edges.
47
+ if progress == 0.0 {
48
+ return 0.0;
49
+ }
50
+ if progress == 1.0 {
51
+ return 1.0;
52
+ }
53
+
54
+ // For negative values, try to extrapolate with tangent (p1 - p0) or,
55
+ // if p1 is coincident with p0, with (p2 - p0).
56
+ if progress < 0.0 {
57
+ if x1 > 0.0 {
58
+ return progress * y1 as f64 / x1 as f64;
59
+ }
60
+ if y1 == 0.0 && x2 > 0.0 {
61
+ return progress * y2 as f64 / x2 as f64;
62
+ }
63
+ // If we can't calculate a sensible tangent, don't extrapolate at all.
64
+ return 0.0;
65
+ }
66
+
67
+ // For values greater than 1, try to extrapolate with tangent (p2 - p3) or,
68
+ // if p2 is coincident with p3, with (p1 - p3).
69
+ if progress > 1.0 {
70
+ if x2 < 1.0 {
71
+ return 1.0 + (progress - 1.0) * (y2 as f64 - 1.0) / (x2 as f64 - 1.0);
72
+ }
73
+ if y2 == 1.0 && x1 < 1.0 {
74
+ return 1.0 + (progress - 1.0) * (y1 as f64 - 1.0) / (x1 as f64 - 1.0);
75
+ }
76
+ // If we can't calculate a sensible tangent, don't extrapolate at all.
77
+ return 1.0;
78
+ }
79
+
80
+ Bezier::new(x1, y1, x2, y2).solve(progress, epsilon)
81
+ }
82
+
83
+ #[inline]
84
+ fn new(x1: CSSFloat, y1: CSSFloat, x2: CSSFloat, y2: CSSFloat) -> Bezier {
85
+ let cx = 3. * x1 as f64;
86
+ let bx = 3. * (x2 as f64 - x1 as f64) - cx;
87
+
88
+ let cy = 3. * y1 as f64;
89
+ let by = 3. * (y2 as f64 - y1 as f64) - cy;
90
+
91
+ Bezier {
92
+ ax: 1.0 - cx - bx,
93
+ bx,
94
+ cx,
95
+ ay: 1.0 - cy - by,
96
+ by,
97
+ cy,
98
+ }
99
+ }
100
+
101
+ #[inline]
102
+ fn sample_curve_x(&self, t: f64) -> f64 {
103
+ // ax * t^3 + bx * t^2 + cx * t
104
+ ((self.ax * t + self.bx) * t + self.cx) * t
105
+ }
106
+
107
+ #[inline]
108
+ fn sample_curve_y(&self, t: f64) -> f64 {
109
+ ((self.ay * t + self.by) * t + self.cy) * t
110
+ }
111
+
112
+ #[inline]
113
+ fn sample_curve_derivative_x(&self, t: f64) -> f64 {
114
+ (3.0 * self.ax * t + 2.0 * self.bx) * t + self.cx
115
+ }
116
+
117
+ #[inline]
118
+ fn solve_curve_x(&self, x: f64, epsilon: f64) -> f64 {
119
+ // Fast path: Use Newton's method.
120
+ let mut t = x;
121
+ for _ in 0..NEWTON_METHOD_ITERATIONS {
122
+ let x2 = self.sample_curve_x(t);
123
+ if x2.approx_eq(x, epsilon) {
124
+ return t;
125
+ }
126
+ let dx = self.sample_curve_derivative_x(t);
127
+ if dx.approx_eq(0.0, 1e-6) {
128
+ break;
129
+ }
130
+ t -= (x2 - x) / dx;
131
+ }
132
+
133
+ // Slow path: Use bisection.
134
+ let (mut lo, mut hi, mut t) = (0.0, 1.0, x);
135
+
136
+ if t < lo {
137
+ return lo;
138
+ }
139
+ if t > hi {
140
+ return hi;
141
+ }
142
+
143
+ while lo < hi {
144
+ let x2 = self.sample_curve_x(t);
145
+ if x2.approx_eq(x, epsilon) {
146
+ return t;
147
+ }
148
+ if x > x2 {
149
+ lo = t
150
+ } else {
151
+ hi = t
152
+ }
153
+ t = (hi - lo) / 2.0 + lo
154
+ }
155
+
156
+ t
157
+ }
158
+
159
+ /// Solve the bezier curve for a given `x` and an `epsilon`, that should be
160
+ /// between zero and one.
161
+ #[inline]
162
+ fn solve(&self, x: f64, epsilon: f64) -> f64 {
163
+ self.sample_curve_y(self.solve_curve_x(x, epsilon))
164
+ }
165
+ }
166
+
167
+ trait ApproxEq {
168
+ fn approx_eq(self, value: Self, epsilon: Self) -> bool;
169
+ }
170
+
171
+ impl ApproxEq for f64 {
172
+ #[inline]
173
+ fn approx_eq(self, value: f64, epsilon: f64) -> bool {
174
+ (self - value).abs() < epsilon
175
+ }
176
+ }