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,507 @@
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
+ //! Servo-specific logic for [`Device`].
6
+
7
+ use crate::color::AbsoluteColor;
8
+ use crate::context::QuirksMode;
9
+ use crate::custom_properties::CssEnvironment;
10
+ use crate::font_metrics::FontMetrics;
11
+ use crate::logical_geometry::WritingMode;
12
+ use crate::media_queries::MediaType;
13
+ use crate::properties::style_structs::Font;
14
+ use crate::properties::ComputedValues;
15
+ use crate::queries::values::PrefersColorScheme;
16
+ use crate::servo::media_features::PointerCapabilities;
17
+ use crate::values::computed::font::GenericFontFamily;
18
+ use crate::values::computed::{
19
+ CSSPixelLength, Length, LineHeight, LinkParameters, NonNegativeLength,
20
+ };
21
+ use crate::values::specified::color::{ColorSchemeFlags, ForcedColors, SystemColor};
22
+ use crate::values::specified::font::{
23
+ QueryFontMetricsFlags, FONT_MEDIUM_CAP_PX, FONT_MEDIUM_CH_PX, FONT_MEDIUM_EX_PX,
24
+ FONT_MEDIUM_IC_PX, FONT_MEDIUM_LINE_HEIGHT_PX, FONT_MEDIUM_PX,
25
+ };
26
+ use crate::values::specified::ViewportVariant;
27
+ use crate::values::KeyframesName;
28
+ use app_units::{Au, AU_PER_PX};
29
+ use euclid::default::Size2D as UntypedSize2D;
30
+ use euclid::{Scale, SideOffsets2D, Size2D};
31
+ use malloc_size_of_derive::MallocSizeOf;
32
+ use mime::Mime;
33
+ use parking_lot::RwLock;
34
+ use servo_arc::Arc;
35
+ use std::fmt::Debug;
36
+ use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
37
+ use style_traits::{CSSPixel, DevicePixel};
38
+
39
+ use crate::device::Device;
40
+
41
+ /// A trait used to query font metrics in clients of Stylo. This is used by Device to
42
+ /// query font metrics in a way that is specific to the client using Stylo.
43
+ pub trait FontMetricsProvider: Debug + Sync {
44
+ /// Query the font metrics for the given font and the given base font size.
45
+ fn query_font_metrics(
46
+ &self,
47
+ vertical: bool,
48
+ font: &Font,
49
+ base_size: CSSPixelLength,
50
+ flags: QueryFontMetricsFlags,
51
+ ) -> FontMetrics;
52
+ /// Gets the base size given a generic font family.
53
+ fn base_size_for_generic(&self, generic: GenericFontFamily) -> Length;
54
+ }
55
+
56
+ #[derive(Debug, MallocSizeOf)]
57
+ pub(super) struct ExtraDeviceData {
58
+ /// The current media type used by de device.
59
+ media_type: MediaType,
60
+ /// The current viewport size, in CSS pixels.
61
+ viewport_size: Size2D<f32, CSSPixel>,
62
+ /// The current screen size, in device pixels.
63
+ device_size: Size2D<f32, DevicePixel>,
64
+ /// The current device pixel ratio, from CSS pixels to device pixels.
65
+ device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>,
66
+ /// The current quirks mode.
67
+ #[ignore_malloc_size_of = "Pure stack type"]
68
+ quirks_mode: QuirksMode,
69
+ /// Whether the user prefers light mode or dark mode
70
+ #[ignore_malloc_size_of = "Pure stack type"]
71
+ prefers_color_scheme: PrefersColorScheme,
72
+ /// The capabilities of the primary pointer input
73
+ #[ignore_malloc_size_of = "Pure stack type"]
74
+ primary_pointer_capabilities: PointerCapabilities,
75
+ /// The union of the capabilities of all pointer inputs
76
+ #[ignore_malloc_size_of = "Pure stack type"]
77
+ all_pointer_capabilities: PointerCapabilities,
78
+ /// An implementation of a trait which implements support for querying font metrics.
79
+ #[ignore_malloc_size_of = "Owned by embedder"]
80
+ font_metrics_provider: Box<dyn FontMetricsProvider>,
81
+ }
82
+
83
+ impl Device {
84
+ /// Trivially construct a new `Device`.
85
+ pub fn new(
86
+ media_type: MediaType,
87
+ quirks_mode: QuirksMode,
88
+ viewport_size: Size2D<f32, CSSPixel>,
89
+ device_size: Size2D<f32, DevicePixel>,
90
+ device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>,
91
+ font_metrics_provider: Box<dyn FontMetricsProvider>,
92
+ default_values: Arc<ComputedValues>,
93
+ prefers_color_scheme: PrefersColorScheme,
94
+ primary_pointer_capabilities: PointerCapabilities,
95
+ all_pointer_capabilities: PointerCapabilities,
96
+ ) -> Device {
97
+ let root_style = RwLock::new(Arc::clone(&default_values));
98
+ Device {
99
+ root_style,
100
+ root_font_size: AtomicU32::new(FONT_MEDIUM_PX.to_bits()),
101
+ root_line_height: AtomicU32::new(FONT_MEDIUM_LINE_HEIGHT_PX.to_bits()),
102
+ root_font_metrics_ex: AtomicU32::new(FONT_MEDIUM_EX_PX.to_bits()),
103
+ root_font_metrics_cap: AtomicU32::new(FONT_MEDIUM_CAP_PX.to_bits()),
104
+ root_font_metrics_ch: AtomicU32::new(FONT_MEDIUM_CH_PX.to_bits()),
105
+ root_font_metrics_ic: AtomicU32::new(FONT_MEDIUM_IC_PX.to_bits()),
106
+ used_root_font_size: AtomicBool::new(false),
107
+ used_root_line_height: AtomicBool::new(false),
108
+ used_root_font_metrics: RwLock::new(false),
109
+ used_font_metrics: AtomicBool::new(false),
110
+ used_viewport_size: AtomicBool::new(false),
111
+ used_dynamic_viewport_size: AtomicBool::new(false),
112
+ environment: CssEnvironment,
113
+ default_values,
114
+ body_text_color: RwLock::new(AbsoluteColor::BLACK),
115
+ extra: ExtraDeviceData {
116
+ media_type,
117
+ viewport_size,
118
+ device_size,
119
+ device_pixel_ratio,
120
+ quirks_mode,
121
+ prefers_color_scheme,
122
+ primary_pointer_capabilities,
123
+ all_pointer_capabilities,
124
+ font_metrics_provider,
125
+ },
126
+ }
127
+ }
128
+
129
+ /// Returns the computed line-height for the font in a given computed values instance.
130
+ ///
131
+ /// If you pass down an element, then the used line-height is returned.
132
+ pub fn calc_line_height(
133
+ &self,
134
+ font: &crate::properties::style_structs::Font,
135
+ _writing_mode: WritingMode,
136
+ _element: Option<()>,
137
+ ) -> NonNegativeLength {
138
+ (match font.line_height {
139
+ // TODO: compute `normal` from the font metrics
140
+ LineHeight::Normal => CSSPixelLength::new(0.),
141
+ LineHeight::Number(number) => font.font_size.computed_size() * number.0,
142
+ LineHeight::Length(length) => length.0,
143
+ })
144
+ .into()
145
+ }
146
+
147
+ /// Get the quirks mode of the current device.
148
+ pub fn quirks_mode(&self) -> QuirksMode {
149
+ self.extra.quirks_mode
150
+ }
151
+
152
+ /// Gets the base size given a generic font family.
153
+ pub fn base_size_for_generic(&self, generic: GenericFontFamily) -> Length {
154
+ self.extra
155
+ .font_metrics_provider
156
+ .base_size_for_generic(generic)
157
+ }
158
+
159
+ /// Whether a given animation name may be referenced from style.
160
+ pub fn animation_name_may_be_referenced(&self, _: &KeyframesName) -> bool {
161
+ // Assume it is, since we don't have any good way to prove it's not.
162
+ true
163
+ }
164
+
165
+ /// Get the viewport size on this [`Device`].
166
+ pub fn viewport_size(&self) -> Size2D<f32, CSSPixel> {
167
+ self.extra.viewport_size
168
+ }
169
+
170
+ /// Set the viewport size on this [`Device`].
171
+ ///
172
+ /// Note that this does not update any associated `Stylist`. For this you must call
173
+ /// `Stylist::media_features_change_changed_style` and
174
+ /// `Stylist::force_stylesheet_origins_dirty`.
175
+ pub fn set_viewport_size(&mut self, viewport_size: Size2D<f32, CSSPixel>) {
176
+ self.extra.viewport_size = viewport_size;
177
+ }
178
+
179
+ /// Returns the viewport size of the current device in app units, needed,
180
+ /// among other things, to resolve viewport units.
181
+ #[inline]
182
+ pub fn au_viewport_size(&self) -> UntypedSize2D<Au> {
183
+ Size2D::new(
184
+ Au::from_f32_px(self.extra.viewport_size.width),
185
+ Au::from_f32_px(self.extra.viewport_size.height),
186
+ )
187
+ }
188
+
189
+ /// Like the above, but records that we've used viewport units.
190
+ pub fn au_viewport_size_for_viewport_unit_resolution(
191
+ &self,
192
+ _: ViewportVariant,
193
+ ) -> UntypedSize2D<Au> {
194
+ self.used_viewport_size.store(true, Ordering::Relaxed);
195
+ // Servo doesn't have dynamic UA interfaces that affect the viewport,
196
+ // so we can just ignore the ViewportVariant.
197
+ self.au_viewport_size()
198
+ }
199
+
200
+ /// Returns the number of app units per device pixel we're using currently.
201
+ pub fn app_units_per_device_pixel(&self) -> i32 {
202
+ (AU_PER_PX as f32 / self.extra.device_pixel_ratio.0) as i32
203
+ }
204
+
205
+ /// Returns the device pixel ratio, ignoring the full zoom factor.
206
+ pub fn device_pixel_ratio_ignoring_full_zoom(&self) -> Scale<f32, CSSPixel, DevicePixel> {
207
+ self.extra.device_pixel_ratio
208
+ }
209
+
210
+ /// Returns the device pixel ratio.
211
+ pub fn device_pixel_ratio(&self) -> Scale<f32, CSSPixel, DevicePixel> {
212
+ self.extra.device_pixel_ratio
213
+ }
214
+
215
+ /// Set a new device pixel ratio on this [`Device`].
216
+ ///
217
+ /// Note that this does not update any associated `Stylist`. For this you must call
218
+ /// `Stylist::media_features_change_changed_style` and
219
+ /// `Stylist::force_stylesheet_origins_dirty`.
220
+ pub fn set_device_pixel_ratio(
221
+ &mut self,
222
+ device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>,
223
+ ) {
224
+ self.extra.device_pixel_ratio = device_pixel_ratio;
225
+ }
226
+
227
+ /// Set the device size on this [`Device`] (e.g. the available screen dimensions).
228
+ ///
229
+ /// Note that this does not update any associated `Stylist`. For this you must call
230
+ /// `Stylist::media_features_change_changed_style` and
231
+ /// `Stylist::force_stylesheet_origins_dirty`.
232
+ pub fn set_device_size(&mut self, device_size: Size2D<f32, DevicePixel>) {
233
+ self.extra.device_size = device_size;
234
+ }
235
+
236
+ /// Returns the screen size of the current device in app units.
237
+ #[inline]
238
+ pub fn device_size(&self) -> Size2D<f32, DevicePixel> {
239
+ self.extra.device_size
240
+ }
241
+
242
+ /// Gets the size of the scrollbar in CSS pixels.
243
+ pub fn scrollbar_inline_size(&self) -> CSSPixelLength {
244
+ // TODO: implement this.
245
+ CSSPixelLength::new(0.0)
246
+ }
247
+
248
+ /// Queries font metrics using the [`FontMetricsProvider`] interface.
249
+ pub fn query_font_metrics(
250
+ &self,
251
+ vertical: bool,
252
+ font: &Font,
253
+ base_size: CSSPixelLength,
254
+ flags: QueryFontMetricsFlags,
255
+ track_usage: bool,
256
+ ) -> FontMetrics {
257
+ if track_usage {
258
+ self.used_font_metrics.store(true, Ordering::Relaxed);
259
+ }
260
+ self.extra
261
+ .font_metrics_provider
262
+ .query_font_metrics(vertical, font, base_size, flags)
263
+ }
264
+
265
+ /// Set the media type on this [`Device`].
266
+ ///
267
+ /// Note that this does not update any associated `Stylist`. For this you must call
268
+ /// `Stylist::media_features_change_changed_style` and
269
+ /// `Stylist::force_stylesheet_origins_dirty`.
270
+ pub fn set_media_type(&mut self, media_type: MediaType) {
271
+ self.extra.media_type = media_type;
272
+ }
273
+
274
+ /// Return the media type of the current device.
275
+ pub fn media_type(&self) -> MediaType {
276
+ self.extra.media_type.clone()
277
+ }
278
+
279
+ /// Returns whether document colors are enabled.
280
+ pub fn forced_colors(&self) -> ForcedColors {
281
+ ForcedColors::None
282
+ }
283
+
284
+ /// Returns the default background color.
285
+ pub fn default_background_color(&self) -> AbsoluteColor {
286
+ AbsoluteColor::WHITE
287
+ }
288
+
289
+ /// Returns the default foreground color.
290
+ pub fn default_color(&self) -> AbsoluteColor {
291
+ AbsoluteColor::BLACK
292
+ }
293
+
294
+ /// Set the [`PrefersColorScheme`] value on this [`Device`].
295
+ ///
296
+ /// Note that this does not update any associated `Stylist`. For this you must call
297
+ /// `Stylist::media_features_change_changed_style` and
298
+ /// `Stylist::force_stylesheet_origins_dirty`.
299
+ pub fn set_color_scheme(&mut self, new_color_scheme: PrefersColorScheme) {
300
+ self.extra.prefers_color_scheme = new_color_scheme;
301
+ }
302
+
303
+ /// Returns the color scheme of this [`Device`].
304
+ pub fn color_scheme(&self) -> PrefersColorScheme {
305
+ self.extra.prefers_color_scheme
306
+ }
307
+
308
+ /// Set the [`PointerCapbabilities`] value for the primary pointer on this [`Device`]
309
+ ///
310
+ /// Note that this does not update any associated `Stylist`. For this you must call
311
+ /// `Stylist::media_features_change_changed_style` and
312
+ /// `Stylist::force_stylesheet_origins_dirty`.
313
+ pub fn set_primary_pointer_capabilities(&mut self, capabilities: PointerCapabilities) {
314
+ self.extra.primary_pointer_capabilities = capabilities;
315
+ }
316
+
317
+ /// Returns the pointer capabilities of this [`Device`].
318
+ pub fn primary_pointer_capabilities(&self) -> PointerCapabilities {
319
+ self.extra.primary_pointer_capabilities
320
+ }
321
+
322
+ /// Set the [`PointerCapbabilities`] value for all pointers on this [`Device`]
323
+ ///
324
+ /// Note that this does not update any associated `Stylist`. For this you must call
325
+ /// `Stylist::media_features_change_changed_style` and
326
+ /// `Stylist::force_stylesheet_origins_dirty`.
327
+ pub fn set_all_pointer_capabilities(&mut self, capabilities: PointerCapabilities) {
328
+ self.extra.all_pointer_capabilities = capabilities;
329
+ }
330
+
331
+ /// Returns the pointer capabilities of this [`Device`].
332
+ pub fn all_pointer_capabilities(&self) -> PointerCapabilities {
333
+ self.extra.all_pointer_capabilities
334
+ }
335
+
336
+ pub(crate) fn is_dark_color_scheme(&self, color_scheme_flags: ColorSchemeFlags) -> bool {
337
+ // Inspired by
338
+ // https://searchfox.org/firefox-main/rev/0a7f146ccac85b8f413264042dcd764028d419ec/widget/nsXPLookAndFeel.cpp#1296
339
+ let supports_dark_mode = color_scheme_flags.contains(ColorSchemeFlags::DARK);
340
+ let supports_light_mode = color_scheme_flags.contains(ColorSchemeFlags::LIGHT);
341
+
342
+ // If only one is supported, then use dark mode if it was the supported one.
343
+ if supports_dark_mode != supports_light_mode {
344
+ return supports_dark_mode;
345
+ }
346
+
347
+ // If either both or none are supported, then use the preferred color scheme
348
+ // to determine whether the user wants dark mode.
349
+ return self.color_scheme() == PrefersColorScheme::Dark;
350
+ }
351
+
352
+ pub(crate) fn system_color(
353
+ &self,
354
+ system_color: SystemColor,
355
+ color_scheme_flags: ColorSchemeFlags,
356
+ ) -> AbsoluteColor {
357
+ fn srgb(r: u8, g: u8, b: u8) -> AbsoluteColor {
358
+ AbsoluteColor::srgb_legacy(r, g, b, 1f32)
359
+ }
360
+
361
+ // Refer to spec
362
+ // <https://www.w3.org/TR/css-color-4/#css-system-colors>
363
+ if self.is_dark_color_scheme(color_scheme_flags) {
364
+ match system_color {
365
+ SystemColor::Accentcolor => srgb(10, 132, 255),
366
+ SystemColor::Accentcolortext => srgb(255, 255, 255),
367
+ SystemColor::Activetext => srgb(255, 0, 0),
368
+ SystemColor::Linktext => srgb(158, 158, 255),
369
+ SystemColor::Visitedtext => srgb(208, 173, 240),
370
+ SystemColor::Buttonborder
371
+ // Deprecated system colors (CSS Color 4) mapped to Buttonborder.
372
+ | SystemColor::Activeborder
373
+ | SystemColor::Inactiveborder
374
+ | SystemColor::Threeddarkshadow
375
+ | SystemColor::Threedshadow
376
+ | SystemColor::Windowframe => srgb(255, 255, 255),
377
+ SystemColor::Buttonface
378
+ // Deprecated system colors (CSS Color 4) mapped to Buttonface.
379
+ | SystemColor::Buttonhighlight
380
+ | SystemColor::Buttonshadow
381
+ | SystemColor::Threedface
382
+ | SystemColor::Threedhighlight
383
+ | SystemColor::Threedlightshadow => srgb(107, 107, 107),
384
+ SystemColor::Buttontext => srgb(245, 245, 245),
385
+ SystemColor::Canvas
386
+ // Deprecated system colors (CSS Color 4) mapped to Canvas.
387
+ | SystemColor::Activecaption
388
+ | SystemColor::Appworkspace
389
+ | SystemColor::Background
390
+ | SystemColor::Inactivecaption
391
+ | SystemColor::Infobackground
392
+ | SystemColor::Menu
393
+ | SystemColor::Scrollbar
394
+ | SystemColor::Window => srgb(30, 30, 30),
395
+ SystemColor::Canvastext
396
+ // Deprecated system colors (CSS Color 4) mapped to Canvastext.
397
+ | SystemColor::Captiontext
398
+ | SystemColor::Infotext
399
+ | SystemColor::Menutext
400
+ | SystemColor::Windowtext => srgb(232, 232, 232),
401
+ SystemColor::Field => srgb(45, 45, 45),
402
+ SystemColor::Fieldtext => srgb(240, 240, 240),
403
+ SystemColor::Graytext
404
+ // Deprecated system colors (CSS Color 4) mapped to Graytext.
405
+ | SystemColor::Inactivecaptiontext => srgb(155, 155, 155),
406
+ SystemColor::Highlight => srgb(38, 79, 120),
407
+ SystemColor::Highlighttext => srgb(255, 255, 255),
408
+ SystemColor::Mark => srgb(102, 92, 0),
409
+ SystemColor::Marktext => srgb(255, 255, 255),
410
+ SystemColor::Selecteditem => srgb(153, 200, 255),
411
+ SystemColor::Selecteditemtext => srgb(59, 59, 59),
412
+ }
413
+ } else {
414
+ match system_color {
415
+ SystemColor::Accentcolor => srgb(0, 102, 204),
416
+ SystemColor::Accentcolortext => srgb(255, 255, 255),
417
+ SystemColor::Activetext => srgb(238, 0, 0),
418
+ SystemColor::Linktext => srgb(0, 0, 238),
419
+ SystemColor::Visitedtext => srgb(85, 26, 139),
420
+ SystemColor::Buttonborder
421
+ // Deprecated system colors (CSS Color 4) mapped to Buttonborder.
422
+ | SystemColor::Activeborder
423
+ | SystemColor::Inactiveborder
424
+ | SystemColor::Threeddarkshadow
425
+ | SystemColor::Threedshadow
426
+ | SystemColor::Windowframe => srgb(169, 169, 169),
427
+ SystemColor::Buttonface
428
+ // Deprecated system colors (CSS Color 4) mapped to Buttonface.
429
+ | SystemColor::Buttonhighlight
430
+ | SystemColor::Buttonshadow
431
+ | SystemColor::Threedface
432
+ | SystemColor::Threedhighlight
433
+ | SystemColor::Threedlightshadow => srgb(220, 220, 220),
434
+ SystemColor::Buttontext => srgb(0, 0, 0),
435
+ SystemColor::Canvas
436
+ // Deprecated system colors (CSS Color 4) mapped to Canvas.
437
+ | SystemColor::Activecaption
438
+ | SystemColor::Appworkspace
439
+ | SystemColor::Background
440
+ | SystemColor::Inactivecaption
441
+ | SystemColor::Infobackground
442
+ | SystemColor::Menu
443
+ | SystemColor::Scrollbar
444
+ | SystemColor::Window => srgb(255, 255, 255),
445
+ SystemColor::Canvastext
446
+ // Deprecated system colors (CSS Color 4) mapped to Canvastext.
447
+ | SystemColor::Captiontext
448
+ | SystemColor::Infotext
449
+ | SystemColor::Menutext
450
+ | SystemColor::Windowtext => srgb(0, 0, 0),
451
+ SystemColor::Field => srgb(255, 255, 255),
452
+ SystemColor::Fieldtext => srgb(0, 0, 0),
453
+ SystemColor::Graytext
454
+ // Deprecated system colors (CSS Color 4) mapped to Graytext.
455
+ | SystemColor::Inactivecaptiontext => srgb(109, 109, 109),
456
+ SystemColor::Highlight => srgb(0, 65, 198),
457
+ SystemColor::Highlighttext => srgb(0, 0, 0),
458
+ SystemColor::Mark => srgb(255, 235, 59),
459
+ SystemColor::Marktext => srgb(0, 0, 0),
460
+ SystemColor::Selecteditem => srgb(0, 102, 204),
461
+ SystemColor::Selecteditemtext => srgb(255, 255, 255),
462
+ }
463
+ }
464
+ }
465
+
466
+ /// Returns the current effective text zoom.
467
+ #[inline]
468
+ pub(super) fn text_zoom(&self) -> f32 {
469
+ // (Servo doesn't do text-zoom)
470
+ 1.
471
+ }
472
+
473
+ /// Returns safe area insets
474
+ pub fn safe_area_insets(&self) -> SideOffsets2D<f32, CSSPixel> {
475
+ SideOffsets2D::zero()
476
+ }
477
+
478
+ /// Returns true if the given MIME type is supported
479
+ pub fn is_supported_mime_type(&self, mime_type: &str) -> bool {
480
+ match mime_type.parse::<Mime>() {
481
+ Ok(m) => {
482
+ // Keep this in sync with 'image_classifer' from
483
+ // components/net/mime_classifier.rs
484
+ m == mime::IMAGE_BMP
485
+ || m == mime::IMAGE_GIF
486
+ || m == mime::IMAGE_PNG
487
+ || m == mime::IMAGE_JPEG
488
+ || m == "image/x-icon"
489
+ || m == "image/webp"
490
+ },
491
+ _ => false,
492
+ }
493
+ }
494
+
495
+ /// Return whether the document is a chrome document.
496
+ #[inline]
497
+ pub fn chrome_rules_enabled_for_document(&self) -> bool {
498
+ false
499
+ }
500
+
501
+ /// Returns the link-parameters that have been set for this document.
502
+ /// <https://drafts.csswg.org/css-link-params-1/>
503
+ #[inline]
504
+ pub fn link_parameters(&self) -> Option<&LinkParameters> {
505
+ None
506
+ }
507
+ }