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,554 @@
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
+ //! Collects a series of applicable rules for a given element.
6
+
7
+ use crate::applicable_declarations::{ApplicableDeclarationBlock, ApplicableDeclarationList};
8
+ use crate::dom::{TElement, TNode, TShadowRoot};
9
+ use crate::properties::{AnimationDeclarations, PropertyDeclarationBlock};
10
+ use crate::rule_tree::{CascadeLevel, CascadeOrigin, ShadowCascadeOrder};
11
+ use crate::selector_map::SelectorMap;
12
+ use crate::selector_parser::PseudoElement;
13
+ use crate::shared_lock::Locked;
14
+ use crate::stylesheets::{layer_rule::LayerOrder, Origin};
15
+ use crate::stylist::{AuthorStylesEnabled, CascadeData, Rule, RuleInclusion, Stylist};
16
+ use selectors::matching::MatchingContext;
17
+ use servo_arc::ArcBorrow;
18
+ use smallvec::SmallVec;
19
+
20
+ /// This is a bit of a hack so <svg:use> matches the rules of the enclosing
21
+ /// tree.
22
+ ///
23
+ /// This function returns the containing shadow host ignoring <svg:use> shadow
24
+ /// trees, since those match the enclosing tree's rules.
25
+ ///
26
+ /// Only a handful of places need to really care about this. This is not a
27
+ /// problem for invalidation and that kind of stuff because they still don't
28
+ /// match rules based on elements outside of the shadow tree, and because the
29
+ /// <svg:use> subtrees are immutable and recreated each time the source tree
30
+ /// changes.
31
+ ///
32
+ /// We historically allow cross-document <svg:use> to have these rules applied,
33
+ /// but I think that's not great. Gecko is the only engine supporting that.
34
+ ///
35
+ /// See https://github.com/w3c/svgwg/issues/504 for the relevant spec
36
+ /// discussion.
37
+ #[inline]
38
+ pub fn containing_shadow_ignoring_svg_use<E: TElement>(
39
+ element: E,
40
+ ) -> Option<<E::ConcreteNode as TNode>::ConcreteShadowRoot> {
41
+ let mut shadow = element.containing_shadow()?;
42
+ loop {
43
+ let host = shadow.host();
44
+ let host_is_svg_use_element =
45
+ host.is_svg_element() && host.local_name() == &**local_name!("use");
46
+ if !host_is_svg_use_element {
47
+ return Some(shadow);
48
+ }
49
+ debug_assert!(
50
+ shadow.style_data().is_none(),
51
+ "We allow no stylesheets in <svg:use> subtrees"
52
+ );
53
+ shadow = host.containing_shadow()?;
54
+ }
55
+ }
56
+
57
+ /// An object that we use with all the intermediate state needed for the
58
+ /// cascade.
59
+ ///
60
+ /// This is done basically to be able to organize the cascade in smaller
61
+ /// functions, and be able to reason about it easily.
62
+ pub struct RuleCollector<'a, 'b: 'a, E>
63
+ where
64
+ E: TElement,
65
+ {
66
+ element: E,
67
+ rule_hash_target: E,
68
+ stylist: &'a Stylist,
69
+ // NOTE: The pseudo-elements are in reverse order from what you'd see in a selector. E.g. for
70
+ // details::details-content::marker, the list is [::marker, ::details-content], and `element` is
71
+ // the `::marker`.
72
+ pseudo_elements: &'a [PseudoElement],
73
+ style_attribute: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>,
74
+ smil_override: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>,
75
+ animation_declarations: AnimationDeclarations,
76
+ rule_inclusion: RuleInclusion,
77
+ rules: &'a mut ApplicableDeclarationList,
78
+ context: &'a mut MatchingContext<'b, E::Impl>,
79
+ matches_user_and_content_rules: bool,
80
+ matches_document_author_rules: bool,
81
+ in_sort_scope: bool,
82
+ }
83
+
84
+ impl<'a, 'b: 'a, E> RuleCollector<'a, 'b, E>
85
+ where
86
+ E: TElement,
87
+ {
88
+ /// Trivially construct a new collector.
89
+ pub fn new(
90
+ stylist: &'a Stylist,
91
+ element: E,
92
+ rule_hash_target: E,
93
+ pseudo_elements: &'a [PseudoElement],
94
+ style_attribute: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>,
95
+ smil_override: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>,
96
+ animation_declarations: AnimationDeclarations,
97
+ rule_inclusion: RuleInclusion,
98
+ rules: &'a mut ApplicableDeclarationList,
99
+ context: &'a mut MatchingContext<'b, E::Impl>,
100
+ ) -> Self {
101
+ debug_assert_eq!(rule_hash_target, element.ultimate_originating_element());
102
+ debug_assert!(pseudo_elements.iter().all(|p| !p.is_precomputed()));
103
+
104
+ let matches_user_and_content_rules = rule_hash_target.matches_user_and_content_rules();
105
+ Self {
106
+ element,
107
+ rule_hash_target,
108
+ stylist,
109
+ pseudo_elements,
110
+ style_attribute,
111
+ smil_override,
112
+ animation_declarations,
113
+ rule_inclusion,
114
+ context,
115
+ rules,
116
+ matches_user_and_content_rules,
117
+ matches_document_author_rules: matches_user_and_content_rules,
118
+ in_sort_scope: false,
119
+ }
120
+ }
121
+
122
+ /// Sets up the state necessary to collect rules from a given DOM tree
123
+ /// (either the document tree, or a shadow tree).
124
+ ///
125
+ /// All rules in the same tree need to be matched together, and this
126
+ /// function takes care of sorting them by specificity and source order.
127
+ #[inline]
128
+ fn in_tree(&mut self, host: Option<E>, f: impl FnOnce(&mut Self)) {
129
+ debug_assert!(!self.in_sort_scope, "Nested sorting makes no sense");
130
+ let start = self.rules.len();
131
+ self.in_sort_scope = true;
132
+ let old_host = self.context.current_host.take();
133
+ self.context.current_host = host.map(|e| e.opaque());
134
+ f(self);
135
+ if start != self.rules.len() {
136
+ self.rules[start..].sort_unstable_by_key(|block| block.sort_key());
137
+ }
138
+ self.context.current_host = old_host;
139
+ self.in_sort_scope = false;
140
+ }
141
+
142
+ #[inline]
143
+ fn in_shadow_tree(&mut self, host: E, f: impl FnOnce(&mut Self)) {
144
+ self.in_tree(Some(host), f);
145
+ }
146
+
147
+ fn collect_stylist_rules(&mut self, origin: Origin) {
148
+ let cascade_level = match origin {
149
+ Origin::UserAgent => CascadeLevel::new(CascadeOrigin::UA),
150
+ Origin::User => CascadeLevel::new(CascadeOrigin::User),
151
+ Origin::Author => CascadeLevel::same_tree_author_normal(),
152
+ };
153
+
154
+ self.in_tree(None, |collector| {
155
+ let cascade_data = collector.stylist.cascade_data().borrow_for_origin(origin);
156
+ // Element-backed pseudo-elements (e.g. ::picker), also apply UA rules that target
157
+ // underlying element directly (like [popover] rules).
158
+ if origin == Origin::UserAgent && collector.is_element_backed_pseudo_element() {
159
+ if let Some(map) = cascade_data.normal_rules(&[]) {
160
+ collector.collect_rules_in_map_with_target(
161
+ map,
162
+ cascade_level,
163
+ cascade_data,
164
+ collector.element,
165
+ );
166
+ }
167
+ }
168
+ if let Some(map) = cascade_data.normal_rules(collector.pseudo_elements) {
169
+ collector.collect_rules_in_map(map, cascade_level, cascade_data);
170
+ }
171
+ });
172
+ }
173
+
174
+ fn collect_user_agent_rules(&mut self) {
175
+ self.collect_stylist_rules(Origin::UserAgent);
176
+ #[cfg(feature = "gecko")]
177
+ self.collect_view_transition_dynamic_rules();
178
+ }
179
+
180
+ #[cfg(feature = "gecko")]
181
+ fn collect_view_transition_dynamic_rules(&mut self) {
182
+ if !self
183
+ .pseudo_elements
184
+ .first()
185
+ .is_some_and(|p| p.is_named_view_transition())
186
+ {
187
+ return;
188
+ }
189
+ let len_before_vt_rules = self.rules.len();
190
+ self.element
191
+ .synthesize_view_transition_dynamic_rules(self.rules);
192
+ if cfg!(debug_assertions) && self.rules.len() != len_before_vt_rules {
193
+ for declaration in &self.rules[len_before_vt_rules..] {
194
+ assert_eq!(declaration.level(), CascadeLevel::new(CascadeOrigin::UA));
195
+ }
196
+ }
197
+ }
198
+
199
+ fn collect_user_rules(&mut self) {
200
+ if !self.matches_user_and_content_rules {
201
+ return;
202
+ }
203
+
204
+ self.collect_stylist_rules(Origin::User);
205
+ }
206
+
207
+ /// Presentational hints.
208
+ ///
209
+ /// These go before author rules, but after user rules, see:
210
+ /// https://drafts.csswg.org/css-cascade/#preshint
211
+ fn collect_presentational_hints(&mut self) {
212
+ if !self.pseudo_elements.is_empty() {
213
+ return;
214
+ }
215
+
216
+ let length_before_preshints = self.rules.len();
217
+ self.element
218
+ .synthesize_presentational_hints_for_legacy_attributes(
219
+ self.context.visited_handling(),
220
+ self.rules,
221
+ );
222
+ if cfg!(debug_assertions) && self.rules.len() != length_before_preshints {
223
+ for declaration in &self.rules[length_before_preshints..] {
224
+ assert_eq!(
225
+ declaration.level(),
226
+ CascadeLevel::new(CascadeOrigin::PresHints)
227
+ );
228
+ }
229
+ }
230
+ }
231
+
232
+ #[inline]
233
+ fn collect_rules_in_list(
234
+ &mut self,
235
+ part_rules: &[Rule],
236
+ cascade_level: CascadeLevel,
237
+ cascade_data: &CascadeData,
238
+ ) {
239
+ debug_assert!(self.in_sort_scope, "Rules gotta be sorted");
240
+ SelectorMap::get_matching_rules(
241
+ self.element,
242
+ part_rules,
243
+ self.rules,
244
+ self.context,
245
+ cascade_level,
246
+ cascade_data,
247
+ self.stylist,
248
+ );
249
+ }
250
+
251
+ #[inline]
252
+ fn collect_rules_in_map(
253
+ &mut self,
254
+ map: &SelectorMap<Rule>,
255
+ cascade_level: CascadeLevel,
256
+ cascade_data: &CascadeData,
257
+ ) {
258
+ self.collect_rules_in_map_with_target(
259
+ map,
260
+ cascade_level,
261
+ cascade_data,
262
+ self.rule_hash_target,
263
+ );
264
+ }
265
+
266
+ #[inline]
267
+ fn collect_rules_in_map_with_target(
268
+ &mut self,
269
+ map: &SelectorMap<Rule>,
270
+ cascade_level: CascadeLevel,
271
+ cascade_data: &CascadeData,
272
+ rule_hash_target: E,
273
+ ) {
274
+ debug_assert!(self.in_sort_scope, "Rules gotta be sorted");
275
+ map.get_all_matching_rules(
276
+ self.element,
277
+ rule_hash_target,
278
+ self.rules,
279
+ self.context,
280
+ cascade_level,
281
+ cascade_data,
282
+ self.stylist,
283
+ );
284
+ }
285
+
286
+ /// Whether we're styling an element-backed pseudo-element.
287
+ /// TODO: We could support, with some effort, other pseudo-elements attached to the
288
+ /// element-backed pseudo. That'd be more consistent with how ::part() works, but it's a bit
289
+ /// weird.
290
+ #[inline]
291
+ fn is_element_backed_pseudo_element(&self) -> bool {
292
+ self.rule_hash_target != self.element
293
+ && self.pseudo_elements.len() == 1
294
+ && self.pseudo_elements[0].is_element_backed()
295
+ }
296
+
297
+ /// Collects the rules for the ::slotted pseudo-element and the :host pseudo-class.
298
+ fn collect_host_and_slotted_rules(&mut self) {
299
+ let mut slots = SmallVec::<[_; 3]>::new();
300
+ let mut current = self.rule_hash_target.assigned_slot();
301
+ let mut shadow_cascade_order = ShadowCascadeOrder::for_outermost_shadow_tree();
302
+
303
+ while let Some(slot) = current {
304
+ debug_assert!(
305
+ self.matches_user_and_content_rules,
306
+ "We should not slot NAC anywhere"
307
+ );
308
+ slots.push(slot);
309
+ current = slot.assigned_slot();
310
+ shadow_cascade_order.dec();
311
+ }
312
+
313
+ self.collect_host_rules(shadow_cascade_order);
314
+
315
+ // Match slotted rules in reverse order, so that the outer slotted rules
316
+ // come before the inner rules (and thus have less priority).
317
+ for slot in slots.iter().rev() {
318
+ shadow_cascade_order.inc();
319
+
320
+ let shadow = slot.containing_shadow().unwrap();
321
+ let data = match shadow.style_data() {
322
+ Some(d) => d,
323
+ None => continue,
324
+ };
325
+
326
+ let slotted_rules = match data.slotted_rules(self.pseudo_elements) {
327
+ Some(r) => r,
328
+ None => continue,
329
+ };
330
+
331
+ self.in_shadow_tree(shadow.host(), |collector| {
332
+ let cascade_level = CascadeLevel::author_normal(shadow_cascade_order);
333
+ collector.collect_rules_in_map(slotted_rules, cascade_level, data);
334
+ });
335
+ }
336
+ }
337
+
338
+ fn collect_rules_from_containing_shadow_tree(&mut self) {
339
+ if !self.matches_user_and_content_rules {
340
+ return;
341
+ }
342
+
343
+ let containing_shadow = containing_shadow_ignoring_svg_use(self.rule_hash_target);
344
+ let containing_shadow = match containing_shadow {
345
+ Some(s) => s,
346
+ None => return,
347
+ };
348
+
349
+ self.matches_document_author_rules = false;
350
+
351
+ let cascade_data = match containing_shadow.style_data() {
352
+ Some(c) => c,
353
+ None => return,
354
+ };
355
+
356
+ let cascade_level = CascadeLevel::same_tree_author_normal();
357
+ self.in_shadow_tree(containing_shadow.host(), |collector| {
358
+ if let Some(map) = cascade_data.normal_rules(collector.pseudo_elements) {
359
+ collector.collect_rules_in_map(map, cascade_level, cascade_data);
360
+ }
361
+
362
+ // Collect rules from :host::part() and such
363
+ let hash_target = collector.rule_hash_target;
364
+ if !hash_target.has_part_attr() {
365
+ return;
366
+ }
367
+
368
+ let part_rules = match cascade_data.part_rules(collector.pseudo_elements) {
369
+ Some(p) => p,
370
+ None => return,
371
+ };
372
+
373
+ hash_target.each_part(|part| {
374
+ if let Some(part_rules) = part_rules.get(&part.0) {
375
+ collector.collect_rules_in_list(part_rules, cascade_level, cascade_data);
376
+ }
377
+ });
378
+ });
379
+ }
380
+
381
+ /// Collects the rules for the :host pseudo-class.
382
+ fn collect_host_rules(&mut self, shadow_cascade_order: ShadowCascadeOrder) {
383
+ let Some(shadow) = self.rule_hash_target.shadow_root() else {
384
+ return;
385
+ };
386
+ let Some(cascade_data) = shadow.style_data() else {
387
+ return;
388
+ };
389
+ let rule_hash_target = self.rule_hash_target;
390
+ let cascade_level = CascadeLevel::author_normal(shadow_cascade_order);
391
+ self.in_shadow_tree(rule_hash_target, |collector| {
392
+ if let Some(host_rules) = cascade_data.featureless_host_rules(collector.pseudo_elements)
393
+ {
394
+ debug_assert!(!collector.context.featureless(), "How?");
395
+ collector.context.featureless = true;
396
+ collector.collect_rules_in_map(host_rules, cascade_level, cascade_data);
397
+ collector.context.featureless = false;
398
+ }
399
+ // We allow stylesheets in the UA tree style the pseudo-element as the real element as
400
+ // well.
401
+ if collector.is_element_backed_pseudo_element() {
402
+ if let Some(map) = cascade_data.normal_rules(&[]) {
403
+ collector.collect_rules_in_map_with_target(
404
+ map,
405
+ cascade_level,
406
+ cascade_data,
407
+ collector.element,
408
+ );
409
+ }
410
+ }
411
+ });
412
+ }
413
+
414
+ fn collect_document_author_rules(&mut self) {
415
+ if !self.matches_document_author_rules {
416
+ return;
417
+ }
418
+
419
+ self.collect_stylist_rules(Origin::Author);
420
+ }
421
+
422
+ fn collect_part_rules_from_outer_trees(&mut self) {
423
+ if !self.rule_hash_target.has_part_attr() {
424
+ return;
425
+ }
426
+
427
+ let mut inner_shadow = match self.rule_hash_target.containing_shadow() {
428
+ Some(s) => s,
429
+ None => return,
430
+ };
431
+
432
+ let mut shadow_cascade_order = ShadowCascadeOrder::for_innermost_containing_tree();
433
+
434
+ let mut parts = SmallVec::<[_; 3]>::new();
435
+ self.rule_hash_target.each_part(|p| parts.push(p.clone()));
436
+
437
+ loop {
438
+ if parts.is_empty() {
439
+ return;
440
+ }
441
+
442
+ let inner_shadow_host = inner_shadow.host();
443
+ let outer_shadow = inner_shadow_host.containing_shadow();
444
+ let cascade_data = match outer_shadow {
445
+ Some(shadow) => shadow.style_data(),
446
+ None => Some(
447
+ self.stylist
448
+ .cascade_data()
449
+ .borrow_for_origin(Origin::Author),
450
+ ),
451
+ };
452
+
453
+ if let Some(cascade_data) = cascade_data {
454
+ if let Some(part_rules) = cascade_data.part_rules(self.pseudo_elements) {
455
+ let containing_host = outer_shadow.map(|s| s.host());
456
+ let cascade_level = CascadeLevel::author_normal(shadow_cascade_order);
457
+ self.in_tree(containing_host, |collector| {
458
+ for p in &parts {
459
+ if let Some(part_rules) = part_rules.get(&p.0) {
460
+ collector.collect_rules_in_list(
461
+ part_rules,
462
+ cascade_level,
463
+ cascade_data,
464
+ );
465
+ }
466
+ }
467
+ });
468
+ shadow_cascade_order.inc();
469
+ }
470
+ }
471
+
472
+ inner_shadow = match outer_shadow {
473
+ Some(s) => s,
474
+ None => break, // Nowhere to export to.
475
+ };
476
+
477
+ let mut new_parts = SmallVec::new();
478
+ for part in &parts {
479
+ inner_shadow_host.each_exported_part(part, |exported_part| {
480
+ new_parts.push(exported_part.clone());
481
+ });
482
+ }
483
+ parts = new_parts;
484
+ }
485
+ }
486
+
487
+ fn collect_style_attribute(&mut self) {
488
+ if let Some(sa) = self.style_attribute {
489
+ self.rules
490
+ .push(ApplicableDeclarationBlock::from_declarations(
491
+ sa.clone_arc(),
492
+ CascadeLevel::same_tree_author_normal(),
493
+ LayerOrder::style_attribute(),
494
+ ));
495
+ }
496
+ }
497
+
498
+ fn collect_animation_rules(&mut self) {
499
+ if let Some(so) = self.smil_override {
500
+ self.rules
501
+ .push(ApplicableDeclarationBlock::from_declarations(
502
+ so.clone_arc(),
503
+ CascadeLevel::new(CascadeOrigin::SMILOverride),
504
+ LayerOrder::root(),
505
+ ));
506
+ }
507
+
508
+ // The animations sheet (CSS animations, script-generated
509
+ // animations, and CSS transitions that are no longer tied to CSS
510
+ // markup).
511
+ if let Some(anim) = self.animation_declarations.animations.take() {
512
+ self.rules
513
+ .push(ApplicableDeclarationBlock::from_declarations(
514
+ anim,
515
+ CascadeLevel::new(CascadeOrigin::Animations),
516
+ LayerOrder::root(),
517
+ ));
518
+ }
519
+
520
+ // The transitions sheet (CSS transitions that are tied to CSS
521
+ // markup).
522
+ if let Some(anim) = self.animation_declarations.transitions.take() {
523
+ self.rules
524
+ .push(ApplicableDeclarationBlock::from_declarations(
525
+ anim,
526
+ CascadeLevel::new(CascadeOrigin::Transitions),
527
+ LayerOrder::root(),
528
+ ));
529
+ }
530
+ }
531
+
532
+ /// Collects all the rules, leaving the result in `self.rules`.
533
+ ///
534
+ /// Note that `!important` rules are handled during rule tree insertion.
535
+ pub fn collect_all(mut self) {
536
+ self.collect_user_agent_rules();
537
+ self.collect_user_rules();
538
+ if self.rule_inclusion == RuleInclusion::DefaultOnly {
539
+ return;
540
+ }
541
+ self.collect_presentational_hints();
542
+ // FIXME(emilio): Should the author styles enabled stuff avoid the
543
+ // presentational hints from getting pushed? See bug 1505770.
544
+ if self.stylist.author_styles_enabled() == AuthorStylesEnabled::No {
545
+ return;
546
+ }
547
+ self.collect_host_and_slotted_rules();
548
+ self.collect_rules_from_containing_shadow_tree();
549
+ self.collect_document_author_rules();
550
+ self.collect_style_attribute();
551
+ self.collect_part_rules_from_outer_trees();
552
+ self.collect_animation_rules();
553
+ }
554
+ }