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,81 @@
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
+ //! Parsing stylesheets from bytes (not `&str`).
6
+
7
+ use crate::context::QuirksMode;
8
+ use crate::error_reporting::ParseErrorReporter;
9
+ use crate::media_queries::MediaList;
10
+ use crate::shared_lock::{Locked, SharedRwLock};
11
+ use crate::stylesheets::{AllowImportRules, Origin, Stylesheet, StylesheetLoader, UrlExtraData};
12
+ use cssparser::{stylesheet_encoding, EncodingSupport};
13
+ use servo_arc::Arc;
14
+ use std::borrow::Cow;
15
+ use std::str;
16
+
17
+ struct EncodingRs;
18
+
19
+ impl EncodingSupport for EncodingRs {
20
+ type Encoding = &'static encoding_rs::Encoding;
21
+
22
+ fn utf8() -> Self::Encoding {
23
+ encoding_rs::UTF_8
24
+ }
25
+
26
+ fn is_utf16_be_or_le(encoding: &Self::Encoding) -> bool {
27
+ *encoding == encoding_rs::UTF_16LE || *encoding == encoding_rs::UTF_16BE
28
+ }
29
+
30
+ fn from_label(ascii_label: &[u8]) -> Option<Self::Encoding> {
31
+ encoding_rs::Encoding::for_label(ascii_label)
32
+ }
33
+ }
34
+
35
+ fn decode_stylesheet_bytes<'a>(
36
+ css: &'a [u8],
37
+ protocol_encoding_label: Option<&str>,
38
+ environment_encoding: Option<&'static encoding_rs::Encoding>,
39
+ ) -> Cow<'a, str> {
40
+ let fallback_encoding = stylesheet_encoding::<EncodingRs>(
41
+ css,
42
+ protocol_encoding_label.map(str::as_bytes),
43
+ environment_encoding,
44
+ );
45
+ let (result, _used_encoding, _) = fallback_encoding.decode(&css);
46
+ // FIXME record used encoding for environment encoding of @import
47
+ result
48
+ }
49
+
50
+ impl Stylesheet {
51
+ /// Parse a stylesheet from a set of bytes, potentially received over the
52
+ /// network.
53
+ ///
54
+ /// Takes care of decoding the network bytes and forwards the resulting
55
+ /// string to `Stylesheet::from_str`.
56
+ pub fn from_bytes(
57
+ bytes: &[u8],
58
+ url_data: UrlExtraData,
59
+ protocol_encoding_label: Option<&str>,
60
+ environment_encoding: Option<&'static encoding_rs::Encoding>,
61
+ origin: Origin,
62
+ media: Arc<Locked<MediaList>>,
63
+ shared_lock: SharedRwLock,
64
+ stylesheet_loader: Option<&dyn StylesheetLoader>,
65
+ error_reporter: Option<&dyn ParseErrorReporter>,
66
+ quirks_mode: QuirksMode,
67
+ ) -> Stylesheet {
68
+ let string = decode_stylesheet_bytes(bytes, protocol_encoding_label, environment_encoding);
69
+ Stylesheet::from_str(
70
+ &string,
71
+ url_data,
72
+ origin,
73
+ media,
74
+ shared_lock,
75
+ stylesheet_loader,
76
+ error_reporter,
77
+ quirks_mode,
78
+ AllowImportRules::Yes,
79
+ )
80
+ }
81
+ }
@@ -0,0 +1,254 @@
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's media feature list and evaluator.
6
+
7
+ use crate::derives::*;
8
+ use crate::queries::feature::{AllowsRanges, Evaluator, FeatureFlags, QueryFeatureDescription};
9
+ use crate::queries::values::{Orientation, PrefersColorScheme};
10
+ use crate::values::computed::{CSSPixelLength, Context, Ratio, Resolution};
11
+ use std::fmt::Debug;
12
+
13
+ /// https://drafts.csswg.org/mediaqueries-4/#width
14
+ fn eval_width(context: &Context) -> CSSPixelLength {
15
+ CSSPixelLength::new(context.device().au_viewport_size().width.to_f32_px())
16
+ }
17
+
18
+ /// https://drafts.csswg.org/mediaqueries-4/#height
19
+ fn eval_height(context: &Context) -> CSSPixelLength {
20
+ CSSPixelLength::new(context.device().au_viewport_size().height.to_f32_px())
21
+ }
22
+
23
+ /// https://drafts.csswg.org/mediaqueries-4/#device-width
24
+ fn eval_device_width(context: &Context) -> CSSPixelLength {
25
+ let device = context.device();
26
+ let scaled = device.device_size() / device.device_pixel_ratio();
27
+ CSSPixelLength::new(scaled.width)
28
+ }
29
+
30
+ /// https://drafts.csswg.org/mediaqueries-4/#device-height
31
+ fn eval_device_height(context: &Context) -> CSSPixelLength {
32
+ let device = context.device();
33
+ let scaled = device.device_size() / device.device_pixel_ratio();
34
+ CSSPixelLength::new(scaled.height)
35
+ }
36
+
37
+ /// https://drafts.csswg.org/mediaqueries-4/#orientation
38
+ fn eval_orientation(context: &Context, value: Option<Orientation>) -> bool {
39
+ Orientation::eval(context.device().au_viewport_size(), value)
40
+ }
41
+
42
+ #[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
43
+ #[repr(u8)]
44
+ enum Scan {
45
+ Progressive,
46
+ Interlace,
47
+ }
48
+
49
+ /// https://drafts.csswg.org/mediaqueries-4/#scan
50
+ fn eval_scan(_: &Context, _: Option<Scan>) -> bool {
51
+ // Since we doesn't support the 'tv' media type, the 'scan' feature never
52
+ // matches.
53
+ false
54
+ }
55
+
56
+ /// https://drafts.csswg.org/mediaqueries-4/#resolution
57
+ fn eval_resolution(context: &Context) -> Resolution {
58
+ Resolution::from_dppx(context.device().device_pixel_ratio().0)
59
+ }
60
+
61
+ /// https://compat.spec.whatwg.org/#css-media-queries-webkit-device-pixel-ratio
62
+ fn eval_device_pixel_ratio(context: &Context) -> f32 {
63
+ eval_resolution(context).dppx()
64
+ }
65
+
66
+ fn eval_prefers_color_scheme(context: &Context, query_value: Option<PrefersColorScheme>) -> bool {
67
+ match query_value {
68
+ Some(v) => context.device().color_scheme() == v,
69
+ None => true,
70
+ }
71
+ }
72
+
73
+ bitflags! {
74
+ /// https://drafts.csswg.org/mediaqueries-4/#mf-interaction
75
+ #[derive(Debug, Clone, Copy)]
76
+ pub struct PointerCapabilities: u8 {
77
+ /// The input mechanism includes a pointing device of limited accuracy, such as a finger on a touchscreen.
78
+ const COARSE = 0b001;
79
+ /// The input mechanism includes an accurate pointing device, such as a mouse.
80
+ const FINE = 0b010;
81
+ /// The input mechanism can conveniently hover over elements.
82
+ const HOVER = 0b100;
83
+ }
84
+ }
85
+
86
+ impl Default for PointerCapabilities {
87
+ #[cfg(any(target_os = "ios", target_os = "android", target_env = "ohos"))]
88
+ fn default() -> Self {
89
+ PointerCapabilities::COARSE
90
+ }
91
+ #[cfg(not(any(target_os = "ios", target_os = "android", target_env = "ohos")))]
92
+ fn default() -> Self {
93
+ PointerCapabilities::FINE | PointerCapabilities::HOVER
94
+ }
95
+ }
96
+
97
+ #[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
98
+ #[repr(u8)]
99
+ enum Pointer {
100
+ None,
101
+ Coarse,
102
+ Fine,
103
+ }
104
+
105
+ fn eval_pointer_capabilities(
106
+ query_value: Option<Pointer>,
107
+ pointer_capabilities: PointerCapabilities,
108
+ ) -> bool {
109
+ match query_value {
110
+ None => !pointer_capabilities.is_empty(),
111
+ Some(Pointer::None) => pointer_capabilities.is_empty(),
112
+ Some(Pointer::Coarse) => pointer_capabilities.intersects(PointerCapabilities::COARSE),
113
+ Some(Pointer::Fine) => pointer_capabilities.intersects(PointerCapabilities::FINE),
114
+ }
115
+ }
116
+
117
+ /// https://drafts.csswg.org/mediaqueries-4/#pointer
118
+ fn eval_pointer(context: &Context, query_value: Option<Pointer>) -> bool {
119
+ eval_pointer_capabilities(query_value, context.device().primary_pointer_capabilities())
120
+ }
121
+
122
+ /// https://drafts.csswg.org/mediaqueries-4/#descdef-media-any-pointer
123
+ fn eval_any_pointer(context: &Context, query_value: Option<Pointer>) -> bool {
124
+ eval_pointer_capabilities(query_value, context.device().all_pointer_capabilities())
125
+ }
126
+
127
+ #[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
128
+ #[repr(u8)]
129
+ enum Hover {
130
+ None,
131
+ Hover,
132
+ }
133
+
134
+ fn eval_hover_capabilities(
135
+ query_value: Option<Hover>,
136
+ pointer_capabilities: PointerCapabilities,
137
+ ) -> bool {
138
+ let can_hover = pointer_capabilities.intersects(PointerCapabilities::HOVER);
139
+ match query_value {
140
+ Some(Hover::None) => !can_hover,
141
+ Some(Hover::Hover) => can_hover,
142
+ None => return can_hover,
143
+ }
144
+ }
145
+
146
+ /// https://drafts.csswg.org/mediaqueries-4/#hover
147
+ fn eval_hover(context: &Context, query_value: Option<Hover>) -> bool {
148
+ eval_hover_capabilities(query_value, context.device().primary_pointer_capabilities())
149
+ }
150
+
151
+ /// https://drafts.csswg.org/mediaqueries-4/#descdef-media-any-hover
152
+ fn eval_any_hover(context: &Context, query_value: Option<Hover>) -> bool {
153
+ eval_hover_capabilities(query_value, context.device().all_pointer_capabilities())
154
+ }
155
+
156
+ /// <https://drafts.csswg.org/mediaqueries-4/#aspect-ratio>
157
+ fn eval_aspect_ratio(context: &Context) -> Ratio {
158
+ let size = context.device().au_viewport_size();
159
+ Ratio::new(size.width.0 as f32, size.height.0 as f32)
160
+ }
161
+
162
+ /// A list with all the media features that Servo supports.
163
+ pub static MEDIA_FEATURES: [QueryFeatureDescription; 15] = [
164
+ feature!(
165
+ atom!("width"),
166
+ AllowsRanges::Yes,
167
+ Evaluator::Length(eval_width),
168
+ FeatureFlags::VIEWPORT_DEPENDENT,
169
+ ),
170
+ feature!(
171
+ atom!("height"),
172
+ AllowsRanges::Yes,
173
+ Evaluator::Length(eval_height),
174
+ FeatureFlags::VIEWPORT_DEPENDENT,
175
+ ),
176
+ feature!(
177
+ atom!("orientation"),
178
+ AllowsRanges::No,
179
+ keyword_evaluator!(eval_orientation, Orientation),
180
+ FeatureFlags::VIEWPORT_DEPENDENT,
181
+ ),
182
+ feature!(
183
+ atom!("pointer"),
184
+ AllowsRanges::No,
185
+ keyword_evaluator!(eval_pointer, Pointer),
186
+ FeatureFlags::empty(),
187
+ ),
188
+ feature!(
189
+ atom!("any-pointer"),
190
+ AllowsRanges::No,
191
+ keyword_evaluator!(eval_any_pointer, Pointer),
192
+ FeatureFlags::empty(),
193
+ ),
194
+ feature!(
195
+ atom!("hover"),
196
+ AllowsRanges::No,
197
+ keyword_evaluator!(eval_hover, Hover),
198
+ FeatureFlags::empty(),
199
+ ),
200
+ feature!(
201
+ atom!("any-hover"),
202
+ AllowsRanges::No,
203
+ keyword_evaluator!(eval_any_hover, Hover),
204
+ FeatureFlags::empty(),
205
+ ),
206
+ feature!(
207
+ atom!("aspect-ratio"),
208
+ AllowsRanges::Yes,
209
+ Evaluator::NumberRatio(eval_aspect_ratio),
210
+ FeatureFlags::VIEWPORT_DEPENDENT,
211
+ ),
212
+ feature!(
213
+ atom!("device-width"),
214
+ AllowsRanges::Yes,
215
+ Evaluator::Length(eval_device_width),
216
+ FeatureFlags::empty(),
217
+ ),
218
+ feature!(
219
+ atom!("device-height"),
220
+ AllowsRanges::Yes,
221
+ Evaluator::Length(eval_device_height),
222
+ FeatureFlags::empty(),
223
+ ),
224
+ feature!(
225
+ atom!("scan"),
226
+ AllowsRanges::No,
227
+ keyword_evaluator!(eval_scan, Scan),
228
+ FeatureFlags::empty(),
229
+ ),
230
+ feature!(
231
+ atom!("resolution"),
232
+ AllowsRanges::Yes,
233
+ Evaluator::Resolution(eval_resolution),
234
+ FeatureFlags::empty(),
235
+ ),
236
+ feature!(
237
+ atom!("device-pixel-ratio"),
238
+ AllowsRanges::Yes,
239
+ Evaluator::Float(eval_device_pixel_ratio),
240
+ FeatureFlags::WEBKIT_PREFIX,
241
+ ),
242
+ feature!(
243
+ atom!("-moz-device-pixel-ratio"),
244
+ AllowsRanges::Yes,
245
+ Evaluator::Float(eval_device_pixel_ratio),
246
+ FeatureFlags::empty(),
247
+ ),
248
+ feature!(
249
+ atom!("prefers-color-scheme"),
250
+ AllowsRanges::No,
251
+ keyword_evaluator!(eval_prefers_color_scheme, PrefersColorScheme),
252
+ FeatureFlags::empty(),
253
+ ),
254
+ ];
@@ -0,0 +1,16 @@
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 bits of the style system.
6
+ //!
7
+ //! These get compiled out on a Gecko build.
8
+
9
+ pub mod animation;
10
+ #[allow(missing_docs)] // TODO.
11
+ pub mod attr;
12
+ mod encoding_support;
13
+ pub mod media_features;
14
+ pub mod restyle_damage;
15
+ pub mod selector_parser;
16
+ mod shadow_parts;
@@ -0,0 +1,215 @@
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 restyle damage is a hint that tells layout which kind of operations may
6
+ //! be needed in presence of incremental style changes.
7
+
8
+ use bitflags::Flags;
9
+
10
+ use crate::computed_values::isolation::T as Isolation;
11
+ use crate::computed_values::mix_blend_mode::T as MixBlendMode;
12
+ use crate::computed_values::transform_style::T as TransformStyle;
13
+ use crate::dom::TElement;
14
+ use crate::matching::{StyleChange, StyleDifference};
15
+ use crate::properties::{
16
+ restyle_damage_rebuild_box, restyle_damage_rebuild_stacking_context,
17
+ restyle_damage_recalculate_overflow, restyle_damage_repaint, style_structs, ComputedValues,
18
+ };
19
+ use crate::values::computed::basic_shape::ClipPath;
20
+ use crate::values::computed::Perspective;
21
+ use crate::values::generics::transform::{GenericRotate, GenericScale, GenericTranslate};
22
+ use std::fmt;
23
+
24
+ bitflags! {
25
+ /// Major phases of layout that need to be run due to the damage to a node during restyling. In
26
+ /// addition to the 4 bytes used for that, the rest of the `u16` is exposed as an extension point
27
+ /// for users of the crate to add their own custom types of damage that correspond to the
28
+ /// layout system they are implementing.
29
+ #[derive(Clone, Copy, Debug, Eq, PartialEq)]
30
+ pub struct ServoRestyleDamage: u16 {
31
+ /// Repaint the node itself.
32
+ ///
33
+ /// Propagates both up and down the flow tree.
34
+ const REPAINT = 0b0001;
35
+
36
+ /// Rebuilds the stacking contexts.
37
+ ///
38
+ /// Propagates both up and down the flow tree.
39
+ const REBUILD_STACKING_CONTEXT = 0b0011;
40
+
41
+ /// Recalculates the scrollable overflow.
42
+ ///
43
+ /// Propagates both up and down the flow tree.
44
+ const RECALCULATE_OVERFLOW = 0b0111;
45
+
46
+ /// Any other type of damage, which requires running layout again.
47
+ ///
48
+ /// Propagates both up and down the flow tree.
49
+ const RELAYOUT = 0b1111;
50
+ }
51
+ }
52
+
53
+ malloc_size_of::malloc_size_of_is_0!(ServoRestyleDamage);
54
+
55
+ impl ServoRestyleDamage {
56
+ /// Compute the `StyleDifference` (including the appropriate restyle damage)
57
+ /// for a given style change between `old` and `new`.
58
+ pub fn compute_style_difference<E: TElement>(
59
+ old: &ComputedValues,
60
+ new: &ComputedValues,
61
+ ) -> StyleDifference {
62
+ if std::ptr::eq(old, new) {
63
+ return StyleDifference {
64
+ damage: ServoRestyleDamage::empty(),
65
+ change: StyleChange::Unchanged,
66
+ };
67
+ }
68
+
69
+ let mut damage = compute_damage(old, new);
70
+ if damage.contains(ServoRestyleDamage::RELAYOUT) {
71
+ damage |= E::compute_layout_damage(old, new);
72
+ }
73
+
74
+ let mut any_style_changed = !damage.is_empty();
75
+ // FIXME(emilio): Differentiate between reset and inherited
76
+ // properties here, and set `reset_only` appropriately so the
77
+ // optimization to skip the cascade in those cases applies.
78
+ let mut reset_only = !any_style_changed;
79
+
80
+ let old_custom_props = old.custom_properties();
81
+ let new_custom_props = new.custom_properties();
82
+ let mut custom_properties_changed = false;
83
+ if old_custom_props.inherited != new_custom_props.inherited {
84
+ any_style_changed = true;
85
+ custom_properties_changed = true;
86
+ reset_only = false;
87
+ } else if old_custom_props.non_inherited != new_custom_props.non_inherited {
88
+ any_style_changed = true;
89
+ custom_properties_changed = true;
90
+ };
91
+ if custom_properties_changed {
92
+ // Paint worklets may depend on custom properties, so if they have changed we should repaint.
93
+ damage.insert(ServoRestyleDamage::REPAINT);
94
+ }
95
+
96
+ let change = if any_style_changed {
97
+ StyleChange::Changed {
98
+ reset_only,
99
+ custom_properties_changed,
100
+ }
101
+ } else {
102
+ StyleChange::Unchanged
103
+ };
104
+
105
+ StyleDifference { damage, change }
106
+ }
107
+
108
+ /// Returns a bitmask indicating that the frame needs to be reconstructed.
109
+ pub fn reconstruct() -> ServoRestyleDamage {
110
+ // There's no way of knowing what kind of damage system the embedder will use, but part of
111
+ // this interface is that a fully saturated restyle damage means to rebuild everything.
112
+ ServoRestyleDamage::from_bits_retain(<ServoRestyleDamage as Flags>::Bits::MAX)
113
+ }
114
+ }
115
+
116
+ impl Default for ServoRestyleDamage {
117
+ fn default() -> Self {
118
+ Self::empty()
119
+ }
120
+ }
121
+
122
+ impl fmt::Display for ServoRestyleDamage {
123
+ fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
124
+ let mut first_elem = true;
125
+
126
+ let to_iter = [
127
+ (ServoRestyleDamage::REPAINT, "Repaint"),
128
+ (
129
+ ServoRestyleDamage::REBUILD_STACKING_CONTEXT,
130
+ "Rebuild stacking context",
131
+ ),
132
+ (
133
+ ServoRestyleDamage::RECALCULATE_OVERFLOW,
134
+ "Recalculate overflow",
135
+ ),
136
+ (ServoRestyleDamage::RELAYOUT, "Relayout"),
137
+ ];
138
+
139
+ for &(damage, damage_str) in &to_iter {
140
+ if self.contains(damage) {
141
+ if !first_elem {
142
+ write!(f, " | ")?;
143
+ }
144
+ write!(f, "{}", damage_str)?;
145
+ first_elem = false;
146
+ }
147
+ }
148
+
149
+ if first_elem {
150
+ write!(f, "NoDamage")?;
151
+ }
152
+
153
+ Ok(())
154
+ }
155
+ }
156
+
157
+ fn augmented_restyle_damage_rebuild_box(old: &ComputedValues, new: &ComputedValues) -> bool {
158
+ let old_box = old.get_box();
159
+ let new_box = new.get_box();
160
+ restyle_damage_rebuild_box(old, new)
161
+ || old_box.original_display != new_box.original_display
162
+ || old_box.has_transform_or_perspective() != new_box.has_transform_or_perspective()
163
+ || old.get_effects().filter.0.is_empty() != new.get_effects().filter.0.is_empty()
164
+ }
165
+
166
+ fn augmented_restyle_damage_rebuild_stacking_context(
167
+ old: &ComputedValues,
168
+ new: &ComputedValues,
169
+ ) -> bool {
170
+ restyle_damage_rebuild_stacking_context(old, new)
171
+ || old.guarantees_stacking_context() != new.guarantees_stacking_context()
172
+ }
173
+
174
+ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDamage {
175
+ // Damage flags higher up the if-else chain imply damage flags lower down the if-else chain,
176
+ // so we can skip the diffing process for later flags if an earlier flag is true
177
+ if augmented_restyle_damage_rebuild_box(old, new) {
178
+ ServoRestyleDamage::RELAYOUT
179
+ } else if restyle_damage_recalculate_overflow(old, new) {
180
+ ServoRestyleDamage::RECALCULATE_OVERFLOW
181
+ } else if augmented_restyle_damage_rebuild_stacking_context(old, new) {
182
+ ServoRestyleDamage::REBUILD_STACKING_CONTEXT
183
+ } else if restyle_damage_repaint(old, new) {
184
+ ServoRestyleDamage::REPAINT
185
+ } else {
186
+ ServoRestyleDamage::empty()
187
+ }
188
+ }
189
+
190
+ impl ComputedValues {
191
+ /// Some properties establish a stacking context when they are set to a non-initial value.
192
+ /// In that case, the damage is only set to `ServoRestyleDamage::REPAINT` because we don't
193
+ /// need to rebuild stacking contexts when the style changes between different non-initial
194
+ /// values. This function checks whether any of these properties is set to a value that
195
+ /// guarantees a stacking context, so that we only do the work when this changes.
196
+ /// Note that it's still possible to establish a stacking context when this returns false.
197
+ pub fn guarantees_stacking_context(&self) -> bool {
198
+ self.get_effects().opacity != 1.0
199
+ || self.get_effects().mix_blend_mode != MixBlendMode::Normal
200
+ || self.get_svg().clip_path != ClipPath::None
201
+ || self.get_box().isolation == Isolation::Isolate
202
+ }
203
+ }
204
+
205
+ impl style_structs::Box {
206
+ /// Whether there is a non-default transform or perspective style set
207
+ pub fn has_transform_or_perspective(&self) -> bool {
208
+ !self.transform.0.is_empty()
209
+ || self.scale != GenericScale::None
210
+ || self.rotate != GenericRotate::None
211
+ || self.translate != GenericTranslate::None
212
+ || self.perspective != Perspective::None
213
+ || self.transform_style == TransformStyle::Preserve3d
214
+ }
215
+ }