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,276 @@
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
+ //! The context within which CSS code is parsed.
6
+
7
+ use crate::context::QuirksMode;
8
+ use crate::custom_properties::{AttrTaint, AttrTaintedRange};
9
+ use crate::error_reporting::{ContextualParseError, ParseErrorReporter};
10
+ use crate::stylesheets::{CssRuleType, CssRuleTypes, Namespaces, Origin, UrlExtraData};
11
+ use crate::use_counters::UseCounters;
12
+ use cssparser::{Parser, SourceLocation, UnicodeRange};
13
+ use selectors::parser::ParseRelative;
14
+ use std::borrow::Cow;
15
+ use style_traits::{OneOrMoreSeparated, ParseError, ParsingMode, Separator};
16
+
17
+ /// Nesting context for parsing rules.
18
+ #[derive(Clone, Copy)]
19
+ pub struct NestingContext {
20
+ /// All rule types we've nested into, if any.
21
+ pub rule_types: CssRuleTypes,
22
+ /// Whether or not parsing relative selector syntax should be allowed.
23
+ pub parse_relative: ParseRelative,
24
+ }
25
+
26
+ impl NestingContext {
27
+ fn parse_relative_for(rule_type: CssRuleType) -> ParseRelative {
28
+ match rule_type {
29
+ CssRuleType::Scope => ParseRelative::ForScope,
30
+ CssRuleType::Style => ParseRelative::ForNesting,
31
+ _ => ParseRelative::No,
32
+ }
33
+ }
34
+
35
+ /// Create a new nesting context.
36
+ pub fn new(rule_types: CssRuleTypes, parse_nested_rule_type: Option<CssRuleType>) -> Self {
37
+ Self {
38
+ rule_types,
39
+ parse_relative: parse_nested_rule_type
40
+ .map_or(ParseRelative::No, Self::parse_relative_for),
41
+ }
42
+ }
43
+
44
+ /// Create a new nesting context based on the given rule.
45
+ pub fn new_from_rule(rule_type: Option<CssRuleType>) -> Self {
46
+ Self {
47
+ rule_types: rule_type.map(CssRuleTypes::from).unwrap_or_default(),
48
+ parse_relative: rule_type
49
+ .map(Self::parse_relative_for)
50
+ .unwrap_or(ParseRelative::No),
51
+ }
52
+ }
53
+
54
+ /// Save the current nesting context.
55
+ pub fn save(&mut self, rule_type: CssRuleType) -> Self {
56
+ let old = *self;
57
+ self.rule_types.insert(rule_type);
58
+ let new_parse_relative = Self::parse_relative_for(rule_type);
59
+ if new_parse_relative != ParseRelative::No {
60
+ self.parse_relative = new_parse_relative;
61
+ }
62
+ old
63
+ }
64
+
65
+ /// Load the saved nesting context.
66
+ pub fn restore(&mut self, saved: Self) {
67
+ *self = saved;
68
+ }
69
+ }
70
+
71
+ /// The data that the parser needs from outside in order to parse a stylesheet.
72
+ pub struct ParserContext<'a> {
73
+ /// The `Origin` of the stylesheet, whether it's a user, author or
74
+ /// user-agent stylesheet.
75
+ pub stylesheet_origin: Origin,
76
+ /// The extra data we need for resolving url values.
77
+ pub url_data: &'a UrlExtraData,
78
+ /// The mode to use when parsing.
79
+ pub parsing_mode: ParsingMode,
80
+ /// The quirks mode of this stylesheet.
81
+ pub quirks_mode: QuirksMode,
82
+ /// The active error reporter, or none if error reporting is disabled.
83
+ error_reporter: Option<&'a dyn ParseErrorReporter>,
84
+ /// The currently active namespaces.
85
+ pub namespaces: Cow<'a, Namespaces>,
86
+ /// The use counters we want to record while parsing style rules, if any.
87
+ pub use_counters: Option<&'a UseCounters>,
88
+ /// Current nesting context.
89
+ pub nesting_context: NestingContext,
90
+ /// The relevant regions in the input that have been tainted by attr() if relevant.
91
+ pub attr_tainted_regions: AttrTaint,
92
+ }
93
+
94
+ impl<'a> ParserContext<'a> {
95
+ /// Create a parser context.
96
+ #[inline]
97
+ pub fn new(
98
+ stylesheet_origin: Origin,
99
+ url_data: &'a UrlExtraData,
100
+ rule_type: Option<CssRuleType>,
101
+ parsing_mode: ParsingMode,
102
+ quirks_mode: QuirksMode,
103
+ namespaces: Cow<'a, Namespaces>,
104
+ error_reporter: Option<&'a dyn ParseErrorReporter>,
105
+ use_counters: Option<&'a UseCounters>,
106
+ attr_tainted_regions: AttrTaint,
107
+ ) -> Self {
108
+ Self {
109
+ stylesheet_origin,
110
+ url_data,
111
+ parsing_mode,
112
+ quirks_mode,
113
+ error_reporter,
114
+ namespaces,
115
+ use_counters,
116
+ nesting_context: NestingContext::new_from_rule(rule_type),
117
+ attr_tainted_regions,
118
+ }
119
+ }
120
+
121
+ /// Temporarily sets the rule_type and executes the callback function, returning its result.
122
+ pub fn nest_for_rule<R>(
123
+ &mut self,
124
+ rule_type: CssRuleType,
125
+ cb: impl FnOnce(&mut Self) -> R,
126
+ ) -> R {
127
+ let old = self.nesting_context.save(rule_type);
128
+ let r = cb(self);
129
+ self.nesting_context.restore(old);
130
+ r
131
+ }
132
+
133
+ /// Temporarily adds a parsing mode flag and executes the callback, returning its result.
134
+ pub fn with_parsing_mode<R>(&mut self, mode: ParsingMode, cb: impl FnOnce(&Self) -> R) -> R {
135
+ let old = self.parsing_mode;
136
+ self.parsing_mode |= mode;
137
+ let r = cb(self);
138
+ self.parsing_mode = old;
139
+ r
140
+ }
141
+
142
+ /// Whether we're in a @page rule.
143
+ #[inline]
144
+ pub fn in_page_rule(&self) -> bool {
145
+ self.nesting_context.rule_types.contains(CssRuleType::Page)
146
+ }
147
+
148
+ /// Returns whether !important declarations are forbidden.
149
+ #[inline]
150
+ pub fn allows_important_declarations(&self) -> bool {
151
+ !self
152
+ .nesting_context
153
+ .rule_types
154
+ .intersects(CssRuleTypes::IMPORTANT_FORBIDDEN)
155
+ }
156
+
157
+ /// Returns whether we can parse element-dependent values.
158
+ #[inline]
159
+ pub fn has_element_context(&self) -> bool {
160
+ if self
161
+ .nesting_context
162
+ .rule_types
163
+ .intersects(CssRuleTypes::WITHOUT_ELEMENT_CONTEXT)
164
+ {
165
+ return false;
166
+ }
167
+
168
+ if self
169
+ .parsing_mode
170
+ .intersects(ParsingMode::MEDIA_QUERY_CONDITION)
171
+ {
172
+ return false;
173
+ }
174
+
175
+ true
176
+ }
177
+
178
+ /// Get the rule type, which assumes that one is available.
179
+ pub fn rule_types(&self) -> CssRuleTypes {
180
+ self.nesting_context.rule_types
181
+ }
182
+
183
+ /// Returns whether CSS error reporting is enabled.
184
+ #[inline]
185
+ pub fn error_reporting_enabled(&self) -> bool {
186
+ self.error_reporter.is_some()
187
+ }
188
+
189
+ /// Record a CSS parse error with this context’s error reporting.
190
+ pub fn log_css_error(&self, location: SourceLocation, error: ContextualParseError) {
191
+ let error_reporter = match self.error_reporter {
192
+ Some(r) => r,
193
+ None => return,
194
+ };
195
+
196
+ error_reporter.report_error(self.url_data, location, error)
197
+ }
198
+
199
+ /// Whether we're in a user-agent stylesheet.
200
+ #[inline]
201
+ pub fn in_ua_sheet(&self) -> bool {
202
+ self.stylesheet_origin == Origin::UserAgent
203
+ }
204
+
205
+ /// Returns whether chrome-only rules should be parsed.
206
+ #[inline]
207
+ pub fn chrome_rules_enabled(&self) -> bool {
208
+ self.url_data.chrome_rules_enabled() || self.stylesheet_origin != Origin::Author
209
+ }
210
+
211
+ /// Whether the parsing mode allows units or functions that are not computationally independent.
212
+ #[inline]
213
+ pub fn allows_computational_dependence(&self) -> bool {
214
+ self.parsing_mode.allows_computational_dependence()
215
+ }
216
+
217
+ /// Whether any `<url>` over this `range` is disallowed due to attr()-tainting.
218
+ pub fn disallow_urls_in_range(&self, range: &AttrTaintedRange) -> bool {
219
+ self.attr_tainted_regions
220
+ .should_disallow_urls_in_range(range)
221
+ }
222
+ }
223
+
224
+ /// A trait to abstract parsing of a specified value given a `ParserContext` and
225
+ /// CSS input.
226
+ ///
227
+ /// This can be derived on keywords with `#[derive(Parse)]`.
228
+ ///
229
+ /// The derive code understands the following attributes on each of the variants:
230
+ ///
231
+ /// * `#[parse(aliases = "foo,bar")]` can be used to alias a value with another
232
+ /// at parse-time.
233
+ ///
234
+ /// * `#[parse(condition = "function")]` can be used to make the parsing of the
235
+ /// value conditional on `function`, which needs to fulfill
236
+ /// `fn(&ParserContext) -> bool`.
237
+ ///
238
+ /// * `#[parse(parse_fn = "function")]` can be used to specify a function other than Parser::parse
239
+ /// for a particular variant.
240
+ pub trait Parse: Sized {
241
+ /// Parse a value of this type.
242
+ ///
243
+ /// Returns an error on failure.
244
+ fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ParseError>;
245
+ }
246
+
247
+ impl<T> Parse for Vec<T>
248
+ where
249
+ T: Parse + OneOrMoreSeparated,
250
+ <T as OneOrMoreSeparated>::S: Separator,
251
+ {
252
+ fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ParseError> {
253
+ <T as OneOrMoreSeparated>::S::parse(input, |i| T::parse(context, i))
254
+ }
255
+ }
256
+
257
+ impl<T> Parse for Box<T>
258
+ where
259
+ T: Parse,
260
+ {
261
+ fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ParseError> {
262
+ T::parse(context, input).map(Box::new)
263
+ }
264
+ }
265
+
266
+ impl Parse for crate::OwnedStr {
267
+ fn parse(_: &ParserContext, input: &mut Parser) -> Result<Self, ParseError> {
268
+ Ok(input.expect_string()?.as_ref().to_owned().into())
269
+ }
270
+ }
271
+
272
+ impl Parse for UnicodeRange {
273
+ fn parse(_: &ParserContext, input: &mut Parser) -> Result<Self, ParseError> {
274
+ Ok(UnicodeRange::parse(input)?)
275
+ }
276
+ }
@@ -0,0 +1,282 @@
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 piecewise linear function, following CSS linear easing
6
+ use crate::derives::*;
7
+ use crate::values::computed::Percentage;
8
+ use core::slice::Iter;
9
+ /// draft as in https://github.com/w3c/csswg-drafts/pull/6533.
10
+ use euclid::approxeq::ApproxEq;
11
+ use itertools::Itertools;
12
+ use std::fmt::{self, Write};
13
+ use style_traits::{CssWriter, ToCss};
14
+
15
+ use crate::values::CSSFloat;
16
+
17
+ type ValueType = CSSFloat;
18
+ /// a single entry in a piecewise linear function.
19
+ #[allow(missing_docs)]
20
+ #[derive(
21
+ Clone,
22
+ Copy,
23
+ Debug,
24
+ MallocSizeOf,
25
+ PartialEq,
26
+ SpecifiedValueInfo,
27
+ ToResolvedValue,
28
+ ToShmem,
29
+ Serialize,
30
+ Deserialize,
31
+ )]
32
+ #[repr(C)]
33
+ pub struct PiecewiseLinearFunctionEntry {
34
+ pub x: ValueType,
35
+ pub y: ValueType,
36
+ }
37
+
38
+ impl ToCss for PiecewiseLinearFunctionEntry {
39
+ fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
40
+ where
41
+ W: fmt::Write,
42
+ {
43
+ self.y.to_css(dest)?;
44
+ dest.write_char(' ')?;
45
+ Percentage(self.x).to_css(dest)
46
+ }
47
+ }
48
+
49
+ /// Representation of a piecewise linear function, a series of linear functions.
50
+ #[derive(
51
+ Default,
52
+ Clone,
53
+ Debug,
54
+ MallocSizeOf,
55
+ PartialEq,
56
+ SpecifiedValueInfo,
57
+ ToResolvedValue,
58
+ ToCss,
59
+ ToShmem,
60
+ Serialize,
61
+ Deserialize,
62
+ )]
63
+ #[repr(C)]
64
+ #[css(comma)]
65
+ pub struct PiecewiseLinearFunction {
66
+ #[css(iterable)]
67
+ #[ignore_malloc_size_of = "Arc"]
68
+ #[shmem(field_bound)]
69
+ entries: crate::ArcSlice<PiecewiseLinearFunctionEntry>,
70
+ }
71
+
72
+ /// Parameters to define one linear stop.
73
+ pub type PiecewiseLinearFunctionBuildParameters = (CSSFloat, Option<CSSFloat>);
74
+
75
+ impl PiecewiseLinearFunction {
76
+ /// Interpolate y value given x and two points. The linear function will be rooted at the asymptote.
77
+ fn interpolate(
78
+ x: ValueType,
79
+ prev: PiecewiseLinearFunctionEntry,
80
+ next: PiecewiseLinearFunctionEntry,
81
+ asymptote: &PiecewiseLinearFunctionEntry,
82
+ ) -> ValueType {
83
+ // Short circuit if the x is on prev or next.
84
+ // `next` point is preferred as per spec.
85
+ if x.approx_eq(&next.x) {
86
+ return next.y;
87
+ }
88
+ if x.approx_eq(&prev.x) {
89
+ return prev.y;
90
+ }
91
+ // Avoid division by zero.
92
+ if prev.x.approx_eq(&next.x) {
93
+ return next.y;
94
+ }
95
+ let slope = (next.y - prev.y) / (next.x - prev.x);
96
+ slope * (x - asymptote.x) + asymptote.y
97
+ }
98
+
99
+ /// Get the y value of the piecewise linear function given the x value, as per
100
+ /// https://drafts.csswg.org/css-easing-2/#linear-easing-function-output
101
+ pub fn at(&self, x: ValueType) -> ValueType {
102
+ if !x.is_finite() {
103
+ return if x > 0.0 { 1.0 } else { 0.0 };
104
+ }
105
+ if self.entries.is_empty() {
106
+ // Implied y = x, as per spec.
107
+ return x;
108
+ }
109
+ if self.entries.len() == 1 {
110
+ // Implied y = <constant>, as per spec.
111
+ return self.entries[0].y;
112
+ }
113
+ // Spec dictates the valid input domain is [0, 1]. Outside of this range, the output
114
+ // should be calculated as if the slopes at start and end extend to infinity. However, if the
115
+ // start/end have two points of the same position, the line should extend along the x-axis.
116
+ // The function doesn't have to cover the input domain, in which case the extension logic
117
+ // applies even if the input falls in the input domain.
118
+ // Also, we're guaranteed to have at least two elements at this point.
119
+ if x < self.entries[0].x {
120
+ return Self::interpolate(x, self.entries[0], self.entries[1], &self.entries[0]);
121
+ }
122
+ let mut rev_iter = self.entries.iter().rev();
123
+ let last = rev_iter.next().unwrap();
124
+ if x >= last.x {
125
+ let second_last = rev_iter.next().unwrap();
126
+ return Self::interpolate(x, *second_last, *last, last);
127
+ }
128
+
129
+ // Now we know the input sits within the domain explicitly defined by our function.
130
+ for (point_b, point_a) in self.entries.iter().rev().tuple_windows() {
131
+ // Need to let point A be the _last_ point where its x is less than the input x,
132
+ // hence the reverse traversal.
133
+ if x < point_a.x {
134
+ continue;
135
+ }
136
+ return Self::interpolate(x, *point_a, *point_b, point_a);
137
+ }
138
+ unreachable!("Input is supposed to be within the entries' min & max!");
139
+ }
140
+
141
+ #[allow(missing_docs)]
142
+ pub fn iter(&self) -> Iter<'_, PiecewiseLinearFunctionEntry> {
143
+ self.entries.iter()
144
+ }
145
+ }
146
+
147
+ /// Entry of a piecewise linear function while building, where the calculation of x value can be deferred.
148
+ #[derive(Clone, Copy)]
149
+ struct BuildEntry {
150
+ x: Option<ValueType>,
151
+ y: ValueType,
152
+ }
153
+
154
+ /// Builder object to generate a linear function.
155
+ #[derive(Default)]
156
+ pub struct PiecewiseLinearFunctionBuilder {
157
+ largest_x: Option<ValueType>,
158
+ smallest_x: Option<ValueType>,
159
+ entries: Vec<BuildEntry>,
160
+ }
161
+
162
+ impl PiecewiseLinearFunctionBuilder {
163
+ /// Create a builder for a known amount of linear stop entries.
164
+ pub fn with_capacity(len: usize) -> Self {
165
+ PiecewiseLinearFunctionBuilder {
166
+ largest_x: None,
167
+ smallest_x: None,
168
+ entries: Vec::with_capacity(len),
169
+ }
170
+ }
171
+
172
+ fn create_entry(&mut self, y: ValueType, x: Option<ValueType>) {
173
+ let x = match x {
174
+ Some(x) if x.is_finite() => x,
175
+ _ if self.entries.is_empty() => 0.0, // First x is 0 if not specified (Or not finite)
176
+ _ => {
177
+ self.entries.push(BuildEntry { x: None, y });
178
+ return;
179
+ },
180
+ };
181
+ // Specified x value cannot regress, as per spec.
182
+ let x = match self.largest_x {
183
+ Some(largest_x) => x.max(largest_x),
184
+ None => x,
185
+ };
186
+ self.largest_x = Some(x);
187
+ // Whatever we see the earliest is the smallest value.
188
+ if self.smallest_x.is_none() {
189
+ self.smallest_x = Some(x);
190
+ }
191
+ self.entries.push(BuildEntry { x: Some(x), y });
192
+ }
193
+
194
+ /// Add a new entry into the piecewise linear function with specified y value.
195
+ /// If the start x value is given, that is where the x value will be. Otherwise,
196
+ /// the x value is calculated later. If the end x value is specified, a flat segment
197
+ /// is generated. If start x value is not specified but end x is, it is treated as
198
+ /// start x.
199
+ pub fn push(&mut self, y: CSSFloat, x_start: Option<CSSFloat>) {
200
+ self.create_entry(y, x_start)
201
+ }
202
+
203
+ /// Finish building the piecewise linear function by resolving all undefined x values,
204
+ /// then return the result.
205
+ pub fn build(mut self) -> PiecewiseLinearFunction {
206
+ if self.entries.is_empty() {
207
+ return PiecewiseLinearFunction::default();
208
+ }
209
+ if self.entries.len() == 1 {
210
+ // Don't bother resolving anything.
211
+ return PiecewiseLinearFunction {
212
+ entries: crate::ArcSlice::from_iter(std::iter::once(
213
+ PiecewiseLinearFunctionEntry {
214
+ x: 0.,
215
+ y: self.entries[0].y,
216
+ },
217
+ )),
218
+ };
219
+ }
220
+ // Guaranteed at least two elements.
221
+ // Start element's x value should've been assigned when the first value was pushed.
222
+ debug_assert!(
223
+ self.entries[0].x.is_some(),
224
+ "Expected an entry with x defined!"
225
+ );
226
+ // Spec asserts that if the last entry does not have an x value, it is assigned the largest seen x value.
227
+ self.entries
228
+ .last_mut()
229
+ .unwrap()
230
+ .x
231
+ .get_or_insert(self.largest_x.filter(|x| x > &1.0).unwrap_or(1.0));
232
+ // Now we have at least two elements with x values, with start & end x values guaranteed.
233
+
234
+ let mut result = Vec::with_capacity(self.entries.len());
235
+ result.push(PiecewiseLinearFunctionEntry {
236
+ x: self.entries[0].x.unwrap(),
237
+ y: self.entries[0].y,
238
+ });
239
+ for (i, e) in self.entries.iter().enumerate().skip(1) {
240
+ if e.x.is_none() {
241
+ // Need to calculate x values by first finding an entry with the first
242
+ // defined x value (Guaranteed to exist as the list end has it defined).
243
+ continue;
244
+ }
245
+ // x is defined for this element.
246
+ let divisor = i - result.len() + 1;
247
+ // Any element(s) with undefined x to assign?
248
+ if divisor != 1 {
249
+ // Have at least one element in result at all times.
250
+ let start_x = result.last().unwrap().x;
251
+ let increment = (e.x.unwrap() - start_x) / divisor as ValueType;
252
+ // Grab every element with undefined x to this point, which starts at the end of the result
253
+ // array, and ending right before the current index. Then, assigned the evenly divided
254
+ // x values.
255
+ result.extend(
256
+ self.entries[result.len()..i]
257
+ .iter()
258
+ .enumerate()
259
+ .map(|(j, e)| {
260
+ debug_assert!(e.x.is_none(), "Expected an entry with x undefined!");
261
+ PiecewiseLinearFunctionEntry {
262
+ x: increment * (j + 1) as ValueType + start_x,
263
+ y: e.y,
264
+ }
265
+ }),
266
+ );
267
+ }
268
+ result.push(PiecewiseLinearFunctionEntry {
269
+ x: e.x.unwrap(),
270
+ y: e.y,
271
+ });
272
+ }
273
+ debug_assert_eq!(
274
+ result.len(),
275
+ self.entries.len(),
276
+ "Should've mapped one-to-one!"
277
+ );
278
+ PiecewiseLinearFunction {
279
+ entries: crate::ArcSlice::from_iter(result.into_iter()),
280
+ }
281
+ }
282
+ }
@@ -0,0 +1,33 @@
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
+ //! Macro helpers to get preference values.
6
+
7
+ /// Returns the value of a preference exposed to the style crate.
8
+ /// It allows overriding the result for either Gecko or Servo, which is
9
+ /// useful when the preference only exists for one of them.
10
+ #[macro_export]
11
+ #[cfg(feature = "gecko")]
12
+ macro_rules! pref {
13
+ ($string:tt $(, servo = $_:tt)?) => {
14
+ static_prefs::pref!($string)
15
+ };
16
+ ($string:tt, gecko = $value:tt) => {
17
+ $value
18
+ };
19
+ }
20
+
21
+ /// Returns the value of a preference exposed to the style crate.
22
+ /// It allows overriding the result for either Gecko or Servo, which is
23
+ /// useful when the preference only exists for one of them.
24
+ #[macro_export]
25
+ #[cfg(feature = "servo")]
26
+ macro_rules! pref {
27
+ ($string:tt $(, gecko = $_:tt)?) => {
28
+ static_prefs::pref!($string)
29
+ };
30
+ ($string:tt, servo = $value:tt) => {
31
+ $value
32
+ };
33
+ }