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.
- package/LICENSE +21 -0
- package/README.md +355 -2
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/assets/icon.svg +4 -0
- package/dist/api.d.ts +7 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +46 -0
- package/dist/api.js.map +1 -0
- package/dist/assets.d.ts +7 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +52 -0
- package/dist/assets.js.map +1 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +3 -0
- package/dist/browser.js.map +1 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +10 -0
- package/dist/node.js.map +1 -0
- package/dist/options.d.ts +24 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +135 -0
- package/dist/options.js.map +1 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/examples/bun.ts +8 -0
- package/examples/german-invoice/README.md +70 -0
- package/examples/german-invoice/data.mjs +83 -0
- package/examples/german-invoice/invoice.css +59 -0
- package/examples/german-invoice/template.mjs +49 -0
- package/examples/german-invoice.mjs +20 -0
- package/examples/invoice.html +29 -0
- package/examples/node.mjs +8 -0
- package/examples/pagination.html +40 -0
- package/examples/pagination.mjs +8 -0
- package/licenses/DejaVu.txt +187 -0
- package/licenses/RUST_DEPENDENCIES.txt +11577 -0
- package/package.json +89 -4
- package/src/api.ts +44 -0
- package/src/assets.ts +43 -0
- package/src/browser.ts +6 -0
- package/src/node.ts +12 -0
- package/src/options.ts +101 -0
- package/src/types.ts +49 -0
- package/vendor/README.md +17 -0
- package/vendor/stylo/.cargo-ok +1 -0
- package/vendor/stylo/.cargo_vcs_info.json +6 -0
- package/vendor/stylo/Cargo.lock +1485 -0
- package/vendor/stylo/Cargo.toml +274 -0
- package/vendor/stylo/LICENSE +373 -0
- package/vendor/stylo/README.md +6 -0
- package/vendor/stylo/applicable_declarations.rs +328 -0
- package/vendor/stylo/author_styles.rs +79 -0
- package/vendor/stylo/bezier.rs +176 -0
- package/vendor/stylo/bloom.rs +414 -0
- package/vendor/stylo/build.rs +91 -0
- package/vendor/stylo/build_gecko.rs +393 -0
- package/vendor/stylo/color/color_function.rs +601 -0
- package/vendor/stylo/color/component.rs +207 -0
- package/vendor/stylo/color/convert.rs +935 -0
- package/vendor/stylo/color/gamut/raytrace.rs +265 -0
- package/vendor/stylo/color/gamut.rs +227 -0
- package/vendor/stylo/color/mix.rs +645 -0
- package/vendor/stylo/color/mod.rs +750 -0
- package/vendor/stylo/color/parsing.rs +770 -0
- package/vendor/stylo/color/to_css.rs +297 -0
- package/vendor/stylo/context.rs +716 -0
- package/vendor/stylo/counter_style/mod.rs +754 -0
- package/vendor/stylo/counter_style/predefined.rs +61 -0
- package/vendor/stylo/counter_style/update_predefined.py +35 -0
- package/vendor/stylo/custom_properties.rs +2023 -0
- package/vendor/stylo/custom_properties_map.rs +220 -0
- package/vendor/stylo/data.rs +693 -0
- package/vendor/stylo/device/gecko.rs +486 -0
- package/vendor/stylo/device/mod.rs +304 -0
- package/vendor/stylo/device/servo.rs +507 -0
- package/vendor/stylo/dom.rs +1164 -0
- package/vendor/stylo/dom_apis.rs +937 -0
- package/vendor/stylo/driver.rs +172 -0
- package/vendor/stylo/error_reporting.rs +484 -0
- package/vendor/stylo/font_face.rs +558 -0
- package/vendor/stylo/font_metrics.rs +124 -0
- package/vendor/stylo/gecko/anon_boxes.toml +113 -0
- package/vendor/stylo/gecko/arc_types.rs +211 -0
- package/vendor/stylo/gecko/conversions.rs +59 -0
- package/vendor/stylo/gecko/data.rs +222 -0
- package/vendor/stylo/gecko/media_features.rs +971 -0
- package/vendor/stylo/gecko/mod.rs +20 -0
- package/vendor/stylo/gecko/non_ts_pseudo_class_list.rs +119 -0
- package/vendor/stylo/gecko/pseudo_element.rs +640 -0
- package/vendor/stylo/gecko/pseudo_element_definition.mako.rs +298 -0
- package/vendor/stylo/gecko/pseudo_elements.py +137 -0
- package/vendor/stylo/gecko/pseudo_elements.toml +197 -0
- package/vendor/stylo/gecko/regen_pseudo_elements.py +33 -0
- package/vendor/stylo/gecko/restyle_damage.rs +127 -0
- package/vendor/stylo/gecko/selector_parser.rs +627 -0
- package/vendor/stylo/gecko/snapshot.rs +202 -0
- package/vendor/stylo/gecko/snapshot_helpers.rs +334 -0
- package/vendor/stylo/gecko/traversal.rs +52 -0
- package/vendor/stylo/gecko/wrapper.rs +2258 -0
- package/vendor/stylo/gecko_bindings/mod.rs +34 -0
- package/vendor/stylo/gecko_bindings/sugar/mod.rs +12 -0
- package/vendor/stylo/gecko_bindings/sugar/ns_com_ptr.rs +15 -0
- package/vendor/stylo/gecko_bindings/sugar/ns_compatibility.rs +19 -0
- package/vendor/stylo/gecko_bindings/sugar/ns_style_auto_array.rs +111 -0
- package/vendor/stylo/gecko_bindings/sugar/origin_flags.rs +31 -0
- package/vendor/stylo/gecko_bindings/sugar/ownership.rs +70 -0
- package/vendor/stylo/gecko_bindings/sugar/refptr.rs +299 -0
- package/vendor/stylo/gecko_string_cache/mod.rs +543 -0
- package/vendor/stylo/gecko_string_cache/namespace.rs +106 -0
- package/vendor/stylo/global_style_data.rs +224 -0
- package/vendor/stylo/invalidation/element/document_state.rs +156 -0
- package/vendor/stylo/invalidation/element/element_wrapper.rs +432 -0
- package/vendor/stylo/invalidation/element/invalidation_map.rs +1631 -0
- package/vendor/stylo/invalidation/element/invalidator.rs +1470 -0
- package/vendor/stylo/invalidation/element/mod.rs +13 -0
- package/vendor/stylo/invalidation/element/relative_selector.rs +1399 -0
- package/vendor/stylo/invalidation/element/restyle_hints.rs +226 -0
- package/vendor/stylo/invalidation/element/state_and_attributes.rs +756 -0
- package/vendor/stylo/invalidation/media_queries.rs +144 -0
- package/vendor/stylo/invalidation/mod.rs +10 -0
- package/vendor/stylo/invalidation/stylesheets.rs +745 -0
- package/vendor/stylo/invalidation/viewport_units.rs +71 -0
- package/vendor/stylo/lib.rs +336 -0
- package/vendor/stylo/logical_geometry.rs +1684 -0
- package/vendor/stylo/macros.rs +70 -0
- package/vendor/stylo/matching.rs +1226 -0
- package/vendor/stylo/media_queries/media_list.rs +168 -0
- package/vendor/stylo/media_queries/media_query.rs +190 -0
- package/vendor/stylo/media_queries/mod.rs +13 -0
- package/vendor/stylo/parallel.rs +205 -0
- package/vendor/stylo/parser.rs +276 -0
- package/vendor/stylo/piecewise_linear.rs +282 -0
- package/vendor/stylo/prefs.rs +33 -0
- package/vendor/stylo/properties/build.py +119 -0
- package/vendor/stylo/properties/cascade.rs +2704 -0
- package/vendor/stylo/properties/computed_value_flags.rs +206 -0
- package/vendor/stylo/properties/counted_unknown_properties.py +104 -0
- package/vendor/stylo/properties/counter_style_descriptors.toml +45 -0
- package/vendor/stylo/properties/data.py +1375 -0
- package/vendor/stylo/properties/declaration_block.rs +1788 -0
- package/vendor/stylo/properties/font_face_descriptors.toml +50 -0
- package/vendor/stylo/properties/gecko.mako.rs +1555 -0
- package/vendor/stylo/properties/helpers/animated_properties.mako.rs +800 -0
- package/vendor/stylo/properties/helpers.mako.rs +812 -0
- package/vendor/stylo/properties/longhands.toml +4305 -0
- package/vendor/stylo/properties/mod.rs +1857 -0
- package/vendor/stylo/properties/properties.html.mako +31 -0
- package/vendor/stylo/properties/properties.mako.rs +3103 -0
- package/vendor/stylo/properties/property_descriptors.toml +18 -0
- package/vendor/stylo/properties/shorthands.rs +4241 -0
- package/vendor/stylo/properties/shorthands.toml +575 -0
- package/vendor/stylo/properties/vendored_python/mako-1.3.10-py3-none-any.whl +0 -0
- package/vendor/stylo/properties/vendored_python/markupsafe/LICENSE.txt +28 -0
- package/vendor/stylo/properties/vendored_python/markupsafe/__init__.py +384 -0
- package/vendor/stylo/properties/vendored_python/toml-0.10.2-py2.py3-none-any.whl +0 -0
- package/vendor/stylo/properties/view_transition_descriptors.toml +11 -0
- package/vendor/stylo/properties_and_values/mod.rs +12 -0
- package/vendor/stylo/properties_and_values/registry.rs +65 -0
- package/vendor/stylo/properties_and_values/rule.rs +331 -0
- package/vendor/stylo/properties_and_values/syntax/ascii.rs +60 -0
- package/vendor/stylo/properties_and_values/syntax/data_type.rs +146 -0
- package/vendor/stylo/properties_and_values/syntax/mod.rs +437 -0
- package/vendor/stylo/properties_and_values/value.rs +758 -0
- package/vendor/stylo/queries/condition.rs +996 -0
- package/vendor/stylo/queries/feature.rs +199 -0
- package/vendor/stylo/queries/feature_expression.rs +1170 -0
- package/vendor/stylo/queries/mod.rs +19 -0
- package/vendor/stylo/queries/values.rs +46 -0
- package/vendor/stylo/rule_cache.rs +267 -0
- package/vendor/stylo/rule_collector.rs +554 -0
- package/vendor/stylo/rule_tree/core.rs +787 -0
- package/vendor/stylo/rule_tree/level.rs +396 -0
- package/vendor/stylo/rule_tree/map.rs +201 -0
- package/vendor/stylo/rule_tree/mod.rs +427 -0
- package/vendor/stylo/rule_tree/source.rs +80 -0
- package/vendor/stylo/rule_tree/unsafe_box.rs +78 -0
- package/vendor/stylo/scoped_tls.rs +80 -0
- package/vendor/stylo/selector_map.rs +1050 -0
- package/vendor/stylo/selector_parser.rs +305 -0
- package/vendor/stylo/servo/animation.rs +1922 -0
- package/vendor/stylo/servo/attr.rs +714 -0
- package/vendor/stylo/servo/encoding_support.rs +81 -0
- package/vendor/stylo/servo/media_features.rs +254 -0
- package/vendor/stylo/servo/mod.rs +16 -0
- package/vendor/stylo/servo/restyle_damage.rs +215 -0
- package/vendor/stylo/servo/selector_parser.rs +1036 -0
- package/vendor/stylo/servo/shadow_parts.rs +207 -0
- package/vendor/stylo/shared_lock.rs +271 -0
- package/vendor/stylo/sharing/checks.rs +281 -0
- package/vendor/stylo/sharing/mod.rs +1000 -0
- package/vendor/stylo/simple_buckets_map.rs +52 -0
- package/vendor/stylo/str.rs +168 -0
- package/vendor/stylo/style_adjuster.rs +1086 -0
- package/vendor/stylo/style_resolver.rs +658 -0
- package/vendor/stylo/stylesheet_set.rs +658 -0
- package/vendor/stylo/stylesheets/appearance_base_rule.rs +51 -0
- package/vendor/stylo/stylesheets/container_rule.rs +769 -0
- package/vendor/stylo/stylesheets/counter_style_rule.rs +7 -0
- package/vendor/stylo/stylesheets/document_rule.rs +272 -0
- package/vendor/stylo/stylesheets/font_face_rule.rs +7 -0
- package/vendor/stylo/stylesheets/font_feature_values_rule.rs +481 -0
- package/vendor/stylo/stylesheets/font_palette_values_rule.rs +304 -0
- package/vendor/stylo/stylesheets/import_rule.rs +259 -0
- package/vendor/stylo/stylesheets/keyframes_rule.rs +733 -0
- package/vendor/stylo/stylesheets/layer_rule.rs +221 -0
- package/vendor/stylo/stylesheets/loader.rs +29 -0
- package/vendor/stylo/stylesheets/margin_rule.rs +190 -0
- package/vendor/stylo/stylesheets/media_rule.rs +191 -0
- package/vendor/stylo/stylesheets/mod.rs +918 -0
- package/vendor/stylo/stylesheets/namespace_rule.rs +43 -0
- package/vendor/stylo/stylesheets/nested_declarations_rule.rs +51 -0
- package/vendor/stylo/stylesheets/origin.rs +249 -0
- package/vendor/stylo/stylesheets/page_rule.rs +354 -0
- package/vendor/stylo/stylesheets/position_try_rule.rs +68 -0
- package/vendor/stylo/stylesheets/property_rule.rs +5 -0
- package/vendor/stylo/stylesheets/rule_list.rs +167 -0
- package/vendor/stylo/stylesheets/rule_parser.rs +1189 -0
- package/vendor/stylo/stylesheets/rules_iterator.rs +397 -0
- package/vendor/stylo/stylesheets/scope_rule.rs +511 -0
- package/vendor/stylo/stylesheets/starting_style_rule.rs +54 -0
- package/vendor/stylo/stylesheets/style_rule.rs +80 -0
- package/vendor/stylo/stylesheets/stylesheet.rs +570 -0
- package/vendor/stylo/stylesheets/supports_rule.rs +486 -0
- package/vendor/stylo/stylesheets/view_transition_rule.rs +81 -0
- package/vendor/stylo/stylist.rs +5076 -0
- package/vendor/stylo/thread_state.rs +87 -0
- package/vendor/stylo/traversal.rs +765 -0
- package/vendor/stylo/traversal_flags.rs +68 -0
- package/vendor/stylo/typed_om/mod.rs +981 -0
- package/vendor/stylo/typed_om/numeric.rs +128 -0
- package/vendor/stylo/typed_om/numeric_declaration.rs +93 -0
- package/vendor/stylo/typed_om/numeric_type.rs +640 -0
- package/vendor/stylo/typed_om/sum_value.rs +426 -0
- package/vendor/stylo/url/gecko.rs +367 -0
- package/vendor/stylo/url/mod.rs +71 -0
- package/vendor/stylo/url/servo.rs +239 -0
- package/vendor/stylo/use_counters/mod.rs +137 -0
- package/vendor/stylo/values/animated/color.rs +103 -0
- package/vendor/stylo/values/animated/effects.rs +26 -0
- package/vendor/stylo/values/animated/font.rs +37 -0
- package/vendor/stylo/values/animated/grid.rs +161 -0
- package/vendor/stylo/values/animated/lists.rs +141 -0
- package/vendor/stylo/values/animated/mod.rs +550 -0
- package/vendor/stylo/values/animated/svg.rs +46 -0
- package/vendor/stylo/values/animated/text.rs +58 -0
- package/vendor/stylo/values/animated/transform.rs +1592 -0
- package/vendor/stylo/values/computed/align.rs +90 -0
- package/vendor/stylo/values/computed/angle.rs +130 -0
- package/vendor/stylo/values/computed/animation.rs +124 -0
- package/vendor/stylo/values/computed/background.rs +13 -0
- package/vendor/stylo/values/computed/basic_shape.rs +267 -0
- package/vendor/stylo/values/computed/border.rs +163 -0
- package/vendor/stylo/values/computed/box.rs +267 -0
- package/vendor/stylo/values/computed/calc.rs +334 -0
- package/vendor/stylo/values/computed/color.rs +161 -0
- package/vendor/stylo/values/computed/column.rs +11 -0
- package/vendor/stylo/values/computed/corner_shape.rs +155 -0
- package/vendor/stylo/values/computed/counters.rs +26 -0
- package/vendor/stylo/values/computed/easing.rs +109 -0
- package/vendor/stylo/values/computed/effects.rs +30 -0
- package/vendor/stylo/values/computed/flex.rs +19 -0
- package/vendor/stylo/values/computed/font.rs +1517 -0
- package/vendor/stylo/values/computed/image.rs +273 -0
- package/vendor/stylo/values/computed/length.rs +576 -0
- package/vendor/stylo/values/computed/length_percentage.rs +1055 -0
- package/vendor/stylo/values/computed/list.rs +16 -0
- package/vendor/stylo/values/computed/mod.rs +1141 -0
- package/vendor/stylo/values/computed/motion.rs +73 -0
- package/vendor/stylo/values/computed/outline.rs +7 -0
- package/vendor/stylo/values/computed/page.rs +77 -0
- package/vendor/stylo/values/computed/param.rs +9 -0
- package/vendor/stylo/values/computed/percentage.rs +143 -0
- package/vendor/stylo/values/computed/position.rs +273 -0
- package/vendor/stylo/values/computed/ratio.rs +88 -0
- package/vendor/stylo/values/computed/rect.rs +19 -0
- package/vendor/stylo/values/computed/resolution.rs +76 -0
- package/vendor/stylo/values/computed/svg.rs +66 -0
- package/vendor/stylo/values/computed/table.rs +7 -0
- package/vendor/stylo/values/computed/text.rs +199 -0
- package/vendor/stylo/values/computed/time.rs +83 -0
- package/vendor/stylo/values/computed/transform.rs +559 -0
- package/vendor/stylo/values/computed/tree_counting.rs +30 -0
- package/vendor/stylo/values/computed/ui.rs +23 -0
- package/vendor/stylo/values/computed/url.rs +12 -0
- package/vendor/stylo/values/distance.rs +139 -0
- package/vendor/stylo/values/generics/animation.rs +363 -0
- package/vendor/stylo/values/generics/background.rs +65 -0
- package/vendor/stylo/values/generics/basic_shape.rs +1389 -0
- package/vendor/stylo/values/generics/border.rs +303 -0
- package/vendor/stylo/values/generics/box.rs +552 -0
- package/vendor/stylo/values/generics/calc.rs +2986 -0
- package/vendor/stylo/values/generics/color.rs +318 -0
- package/vendor/stylo/values/generics/column.rs +44 -0
- package/vendor/stylo/values/generics/counters.rs +320 -0
- package/vendor/stylo/values/generics/easing.rs +132 -0
- package/vendor/stylo/values/generics/effects.rs +131 -0
- package/vendor/stylo/values/generics/flex.rs +34 -0
- package/vendor/stylo/values/generics/font.rs +376 -0
- package/vendor/stylo/values/generics/grid.rs +962 -0
- package/vendor/stylo/values/generics/image.rs +653 -0
- package/vendor/stylo/values/generics/length.rs +656 -0
- package/vendor/stylo/values/generics/mod.rs +303 -0
- package/vendor/stylo/values/generics/motion.rs +274 -0
- package/vendor/stylo/values/generics/page.rs +167 -0
- package/vendor/stylo/values/generics/position.rs +669 -0
- package/vendor/stylo/values/generics/ratio.rs +88 -0
- package/vendor/stylo/values/generics/rect.rs +147 -0
- package/vendor/stylo/values/generics/size.rs +102 -0
- package/vendor/stylo/values/generics/svg.rs +226 -0
- package/vendor/stylo/values/generics/text.rs +268 -0
- package/vendor/stylo/values/generics/transform.rs +1157 -0
- package/vendor/stylo/values/generics/ui.rs +147 -0
- package/vendor/stylo/values/generics/url.rs +51 -0
- package/vendor/stylo/values/mod.rs +820 -0
- package/vendor/stylo/values/resolved/animation.rs +33 -0
- package/vendor/stylo/values/resolved/color.rs +53 -0
- package/vendor/stylo/values/resolved/counters.rs +45 -0
- package/vendor/stylo/values/resolved/mod.rs +316 -0
- package/vendor/stylo/values/specified/align.rs +711 -0
- package/vendor/stylo/values/specified/angle.rs +407 -0
- package/vendor/stylo/values/specified/animation.rs +921 -0
- package/vendor/stylo/values/specified/background.rs +270 -0
- package/vendor/stylo/values/specified/basic_shape.rs +986 -0
- package/vendor/stylo/values/specified/border.rs +430 -0
- package/vendor/stylo/values/specified/box.rs +2231 -0
- package/vendor/stylo/values/specified/calc.rs +1657 -0
- package/vendor/stylo/values/specified/color.rs +1210 -0
- package/vendor/stylo/values/specified/column.rs +11 -0
- package/vendor/stylo/values/specified/corner_shape.rs +152 -0
- package/vendor/stylo/values/specified/counters.rs +242 -0
- package/vendor/stylo/values/specified/easing.rs +225 -0
- package/vendor/stylo/values/specified/effects.rs +421 -0
- package/vendor/stylo/values/specified/flex.rs +42 -0
- package/vendor/stylo/values/specified/font.rs +2103 -0
- package/vendor/stylo/values/specified/frequency.rs +39 -0
- package/vendor/stylo/values/specified/grid.rs +407 -0
- package/vendor/stylo/values/specified/image.rs +1385 -0
- package/vendor/stylo/values/specified/intersection_observer.rs +80 -0
- package/vendor/stylo/values/specified/length.rs +2024 -0
- package/vendor/stylo/values/specified/list.rs +190 -0
- package/vendor/stylo/values/specified/mod.rs +531 -0
- package/vendor/stylo/values/specified/motion.rs +316 -0
- package/vendor/stylo/values/specified/number.rs +603 -0
- package/vendor/stylo/values/specified/outline.rs +69 -0
- package/vendor/stylo/values/specified/page.rs +94 -0
- package/vendor/stylo/values/specified/param.rs +121 -0
- package/vendor/stylo/values/specified/percentage.rs +364 -0
- package/vendor/stylo/values/specified/position.rs +2247 -0
- package/vendor/stylo/values/specified/ratio.rs +29 -0
- package/vendor/stylo/values/specified/rect.rs +28 -0
- package/vendor/stylo/values/specified/resolution.rs +237 -0
- package/vendor/stylo/values/specified/source_size_list.rs +135 -0
- package/vendor/stylo/values/specified/svg.rs +427 -0
- package/vendor/stylo/values/specified/svg_path.rs +1115 -0
- package/vendor/stylo/values/specified/table.rs +38 -0
- package/vendor/stylo/values/specified/text.rs +1561 -0
- package/vendor/stylo/values/specified/time.rs +313 -0
- package/vendor/stylo/values/specified/transform.rs +599 -0
- package/vendor/stylo/values/specified/tree_counting.rs +32 -0
- package/vendor/stylo/values/specified/ui.rs +344 -0
- package/vendor/stylo/values/specified/url.rs +12 -0
- package/vendor/stylo/values/tagged_numeric.rs +253 -0
- package/wasm/blitz_pdf.d.ts +67 -0
- package/wasm/blitz_pdf.js +699 -0
- package/wasm/blitz_pdf_bg.wasm +0 -0
- package/wasm/blitz_pdf_bg.wasm.d.ts +20 -0
|
@@ -0,0 +1,298 @@
|
|
|
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
|
+
use crate::derives::*;
|
|
6
|
+
|
|
7
|
+
type AtomThinVec = thin_vec::ThinVec<Atom>;
|
|
8
|
+
|
|
9
|
+
/// Gecko's pseudo-element definition.
|
|
10
|
+
///
|
|
11
|
+
/// We intentionally double-box legacy ::-moz-tree pseudo-elements to keep the
|
|
12
|
+
/// size of PseudoElement (and thus selector components) small.
|
|
13
|
+
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)]
|
|
14
|
+
#[repr(u8)]
|
|
15
|
+
pub enum PseudoElement {
|
|
16
|
+
% for pseudo in PSEUDOS:
|
|
17
|
+
/// ${pseudo.name}
|
|
18
|
+
% if pseudo.argument:
|
|
19
|
+
${pseudo.capitalized}(${pseudo.argument}),
|
|
20
|
+
% else:
|
|
21
|
+
${pseudo.capitalized},
|
|
22
|
+
% endif
|
|
23
|
+
% endfor
|
|
24
|
+
/// ::-webkit-* that we don't recognize
|
|
25
|
+
/// https://github.com/whatwg/compat/issues/103
|
|
26
|
+
UnknownWebkit(Atom),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
<% EAGER_PSEUDOS = list(filter(lambda p: getattr(p, 'is_eager', False), PSEUDOS)) %>
|
|
30
|
+
|
|
31
|
+
/// The number of eager pseudo-elements.
|
|
32
|
+
pub const EAGER_PSEUDO_COUNT: usize = ${len(EAGER_PSEUDOS)};
|
|
33
|
+
|
|
34
|
+
/// The number of all pseudo-elements.
|
|
35
|
+
pub const PSEUDO_COUNT: usize = ${len(PSEUDOS)};
|
|
36
|
+
|
|
37
|
+
/// The list of eager pseudos.
|
|
38
|
+
pub const EAGER_PSEUDOS: [PseudoElement; EAGER_PSEUDO_COUNT] = [
|
|
39
|
+
% for eager_pseudo in EAGER_PSEUDOS:
|
|
40
|
+
PseudoElement::${eager_pseudo.capitalized},
|
|
41
|
+
% endfor
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
<%def name="pseudo_element_variant(pseudo, arg='..')">\
|
|
45
|
+
PseudoElement::${pseudo.capitalized}${"({})".format(arg) if pseudo.argument else ""}\
|
|
46
|
+
</%def>
|
|
47
|
+
|
|
48
|
+
impl PseudoElement {
|
|
49
|
+
/// Whether this pseudo-element is tree pseudo-element.
|
|
50
|
+
#[inline]
|
|
51
|
+
pub fn is_tree_pseudo_element(&self) -> bool {
|
|
52
|
+
matches!(
|
|
53
|
+
*self,
|
|
54
|
+
${" | ".join(capture(pseudo_element_variant, pseudo) for pseudo in PSEUDOS if pseudo.name.startswith("-moz-tree-"))}
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#[inline]
|
|
59
|
+
fn flags_for_index(i: usize) -> PseudoStyleTypeFlags {
|
|
60
|
+
static FLAGS: [PseudoStyleTypeFlags; PSEUDO_COUNT + 1] = [
|
|
61
|
+
% for pseudo in PSEUDOS:
|
|
62
|
+
PseudoStyleTypeFlags::from_bits_truncate(${' | '.join(f"PseudoStyleTypeFlags::{flag}.bits()" for flag in pseudo.flags())}), // ${pseudo.name}
|
|
63
|
+
% endfor
|
|
64
|
+
// Unknown ::-webkit-* pseudos allow user-action state pseudo-classes.
|
|
65
|
+
PseudoStyleTypeFlags::from_bits_truncate(
|
|
66
|
+
PseudoStyleTypeFlags::IS_PSEUDO_ELEMENT.bits() |
|
|
67
|
+
PseudoStyleTypeFlags::SUPPORTS_USER_ACTION_STATE.bits()
|
|
68
|
+
),
|
|
69
|
+
];
|
|
70
|
+
FLAGS[i]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/// Gets the flags associated to this pseudo-element or anon box.
|
|
74
|
+
#[inline]
|
|
75
|
+
pub fn flags(&self) -> PseudoStyleTypeFlags {
|
|
76
|
+
Self::flags_for_index(self.index())
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/// If this pseudo is pref-gated, returns the pref value, otherwise false.
|
|
80
|
+
pub fn type_enabled_in_content(ty: PseudoStyleType) -> bool {
|
|
81
|
+
let flags = Self::flags_for_index(ty as usize);
|
|
82
|
+
// Common path, not enabled explicitly in UA sheets (note that chrome implies UA), and not
|
|
83
|
+
// pref-gated.
|
|
84
|
+
if !flags.intersects(PseudoStyleTypeFlags::ENABLED_IN_UA | PseudoStyleTypeFlags::ENABLED_BY_PREF) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
if !flags.intersects(PseudoStyleTypeFlags::ENABLED_BY_PREF) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
match ty {
|
|
91
|
+
% for pseudo in PSEUDOS:
|
|
92
|
+
% if pseudo.pref:
|
|
93
|
+
PseudoStyleType::${pseudo.capitalized} => pref!("${pseudo.pref}"),
|
|
94
|
+
% endif
|
|
95
|
+
% endfor
|
|
96
|
+
_ => false,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/// Returns the current value of the `enabled_domains_pref` pref for this
|
|
101
|
+
/// pseudo, if it has one. The value is a list of the only domains for
|
|
102
|
+
/// which this pseudo should be enabled, or "*" for "every domain" (see
|
|
103
|
+
/// `nsContentUtils::IsURIInList` for the format).
|
|
104
|
+
pub fn enabled_domains(&self) -> Option<nsstring::nsCString> {
|
|
105
|
+
match *self {
|
|
106
|
+
% for pseudo in PSEUDOS:
|
|
107
|
+
% if pseudo.is_pseudo_element() and pseudo.enabled_domains_pref:
|
|
108
|
+
${pseudo_element_variant(pseudo)} => Some(pref!("${pseudo.enabled_domains_pref}")),
|
|
109
|
+
% endif
|
|
110
|
+
% endfor
|
|
111
|
+
_ => None,
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/// Construct a pseudo-element from a `PseudoStyleType`.
|
|
116
|
+
#[inline]
|
|
117
|
+
pub fn from_pseudo_type(type_: PseudoStyleType, functional_pseudo_parameter: Option<AtomIdent>) -> Option<Self> {
|
|
118
|
+
match type_ {
|
|
119
|
+
% for pseudo in PSEUDOS:
|
|
120
|
+
% if not pseudo.argument:
|
|
121
|
+
PseudoStyleType::${pseudo.capitalized} => {
|
|
122
|
+
debug_assert!(functional_pseudo_parameter.is_none());
|
|
123
|
+
Some(${pseudo_element_variant(pseudo)})
|
|
124
|
+
},
|
|
125
|
+
% elif pseudo.argument == "AtomThinVec":
|
|
126
|
+
PseudoStyleType::${pseudo.capitalized} => {
|
|
127
|
+
debug_assert!(functional_pseudo_parameter.is_none());
|
|
128
|
+
Some(${pseudo_element_variant(pseudo, "Default::default()")})
|
|
129
|
+
},
|
|
130
|
+
% elif pseudo.argument == "PtNameAndClassSelector":
|
|
131
|
+
PseudoStyleType::${pseudo.capitalized} => functional_pseudo_parameter.map(|p| {
|
|
132
|
+
PseudoElement::${pseudo.capitalized}(PtNameAndClassSelector::from_name(p.0))
|
|
133
|
+
}),
|
|
134
|
+
% else:
|
|
135
|
+
<% assert pseudo.argument == "AtomIdent", f"Unhandled argument type {pseudo.argument}" %>
|
|
136
|
+
PseudoStyleType::${pseudo.capitalized} => {
|
|
137
|
+
functional_pseudo_parameter.map(PseudoElement::${pseudo.capitalized})
|
|
138
|
+
},
|
|
139
|
+
% endif
|
|
140
|
+
% endfor
|
|
141
|
+
_ => None,
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/// Construct a `PseudoStyleType`.
|
|
146
|
+
#[inline]
|
|
147
|
+
pub fn pseudo_type(&self) -> PseudoStyleType {
|
|
148
|
+
// SAFETY: PseudoStyleType has the same variants as PseudoElement
|
|
149
|
+
unsafe { std::mem::transmute::<u8, PseudoStyleType>(self.discriminant()) }
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/// Returns the relevant PseudoStyleType, and an atom as an argument, if any.
|
|
153
|
+
/// FIXME: we probably have to return the arguments of -moz-tree. However, they are multiple
|
|
154
|
+
/// names, so we skip them for now (until we really need them).
|
|
155
|
+
#[inline]
|
|
156
|
+
pub fn pseudo_type_and_argument(&self) -> (PseudoStyleType, Option<&Atom>) {
|
|
157
|
+
let ty = self.pseudo_type();
|
|
158
|
+
let arg = match *self {
|
|
159
|
+
% for pseudo in PSEUDOS:
|
|
160
|
+
% if pseudo.argument == "PtNameAndClassSelector":
|
|
161
|
+
PseudoElement::${pseudo.capitalized}(ref val) => Some(val.name()),
|
|
162
|
+
% elif pseudo.argument == "AtomIdent":
|
|
163
|
+
PseudoElement::${pseudo.capitalized}(ref val) => Some(&val.0),
|
|
164
|
+
% endif
|
|
165
|
+
% endfor
|
|
166
|
+
_ => None,
|
|
167
|
+
};
|
|
168
|
+
(ty, arg)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/// Get the argument list of a tree pseudo-element.
|
|
172
|
+
#[inline]
|
|
173
|
+
pub fn tree_pseudo_args(&self) -> &[Atom] {
|
|
174
|
+
match *self {
|
|
175
|
+
% for pseudo in PSEUDOS:
|
|
176
|
+
% if pseudo.name.startswith("-moz-tree-"):
|
|
177
|
+
PseudoElement::${pseudo.capitalized}(ref args) => args,
|
|
178
|
+
% endif
|
|
179
|
+
% endfor
|
|
180
|
+
_ => &[],
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/// Constructs a pseudo-element from a string of text.
|
|
185
|
+
///
|
|
186
|
+
/// Returns `None` if the pseudo-element is not recognised.
|
|
187
|
+
#[inline]
|
|
188
|
+
pub fn from_slice(name: &str) -> Option<Self> {
|
|
189
|
+
// We don't need to support tree pseudos because functional
|
|
190
|
+
// pseudo-elements needs arguments, and thus should be created
|
|
191
|
+
// via other methods.
|
|
192
|
+
cssparser::ascii_case_insensitive_phf_map! {
|
|
193
|
+
pseudo -> PseudoElement = {
|
|
194
|
+
% for pseudo in PSEUDOS:
|
|
195
|
+
% if not pseudo.argument:
|
|
196
|
+
"${pseudo.name}" => ${pseudo_element_variant(pseudo)},
|
|
197
|
+
% endif
|
|
198
|
+
% endfor
|
|
199
|
+
// Alias some legacy prefixed pseudos to their standardized name at parse time:
|
|
200
|
+
"-moz-selection" => PseudoElement::Selection,
|
|
201
|
+
"-moz-placeholder" => PseudoElement::Placeholder,
|
|
202
|
+
"-moz-list-bullet" => PseudoElement::Marker,
|
|
203
|
+
"-moz-list-number" => PseudoElement::Marker,
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if let Some(p) = pseudo::get(name) {
|
|
207
|
+
return Some(p.clone());
|
|
208
|
+
}
|
|
209
|
+
if starts_with_ignore_ascii_case(name, "-moz-tree-") {
|
|
210
|
+
return PseudoElement::tree_pseudo_element(name, Default::default())
|
|
211
|
+
}
|
|
212
|
+
None
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/// Produces an `UnknownWebkit` pseudo-element for any `-webkit-*` name.
|
|
216
|
+
#[inline]
|
|
217
|
+
pub fn unknown_webkit_from_name(name: &str) -> Option<Self> {
|
|
218
|
+
const WEBKIT_PREFIX: &str = "-webkit-";
|
|
219
|
+
if !starts_with_ignore_ascii_case(name, WEBKIT_PREFIX) {
|
|
220
|
+
return None;
|
|
221
|
+
}
|
|
222
|
+
let part = string_as_ascii_lowercase(&name[WEBKIT_PREFIX.len()..]);
|
|
223
|
+
Some(PseudoElement::UnknownWebkit(part.into()))
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/// Constructs a tree pseudo-element from the given name and arguments.
|
|
227
|
+
/// "name" must start with "-moz-tree-".
|
|
228
|
+
///
|
|
229
|
+
/// Returns `None` if the pseudo-element is not recognized.
|
|
230
|
+
#[inline]
|
|
231
|
+
pub fn tree_pseudo_element(name: &str, args: thin_vec::ThinVec<Atom>) -> Option<Self> {
|
|
232
|
+
debug_assert!(starts_with_ignore_ascii_case(name, "-moz-tree-"));
|
|
233
|
+
let tree_part = &name[10..];
|
|
234
|
+
% for pseudo in PSEUDOS:
|
|
235
|
+
% if pseudo.name.startswith("-moz-tree-"):
|
|
236
|
+
if tree_part.eq_ignore_ascii_case("${pseudo.name[10:]}") {
|
|
237
|
+
return Some(${pseudo_element_variant(pseudo, "args")});
|
|
238
|
+
}
|
|
239
|
+
% endif
|
|
240
|
+
% endfor
|
|
241
|
+
None
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/// Returns true if this pseudo-element matches the given selector.
|
|
245
|
+
pub fn matches(
|
|
246
|
+
&self,
|
|
247
|
+
pseudo_selector: &PseudoElement,
|
|
248
|
+
element: &super::wrapper::GeckoElement,
|
|
249
|
+
) -> bool {
|
|
250
|
+
if *self == *pseudo_selector {
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if std::mem::discriminant(self) != std::mem::discriminant(pseudo_selector) {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Check named view transition pseudo-elements.
|
|
259
|
+
self.matches_named_view_transition_pseudo_element(pseudo_selector, element)
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
impl ToCss for PseudoElement {
|
|
264
|
+
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
|
265
|
+
match *self {
|
|
266
|
+
% for pseudo in PSEUDOS:
|
|
267
|
+
% if pseudo.argument == "AtomThinVec":
|
|
268
|
+
${pseudo_element_variant(pseudo, "ref args")} => {
|
|
269
|
+
dest.write_str("::${pseudo.name}")?;
|
|
270
|
+
let mut iter = args.iter();
|
|
271
|
+
if let Some(first) = iter.next() {
|
|
272
|
+
dest.write_char('(')?;
|
|
273
|
+
serialize_atom_identifier(first, dest)?;
|
|
274
|
+
for item in iter {
|
|
275
|
+
dest.write_str(", ")?;
|
|
276
|
+
serialize_atom_identifier(item, dest)?;
|
|
277
|
+
}
|
|
278
|
+
dest.write_char(')')?;
|
|
279
|
+
}
|
|
280
|
+
Ok(())
|
|
281
|
+
},
|
|
282
|
+
% elif pseudo.argument:
|
|
283
|
+
PseudoElement::${pseudo.capitalized}(ref arg) => {
|
|
284
|
+
dest.write_str("::${pseudo.name}(")?;
|
|
285
|
+
arg.to_css(dest)?;
|
|
286
|
+
dest.write_char(')')
|
|
287
|
+
}
|
|
288
|
+
% else:
|
|
289
|
+
${pseudo_element_variant(pseudo)} => dest.write_str("::${pseudo.name}"),
|
|
290
|
+
% endif
|
|
291
|
+
% endfor
|
|
292
|
+
PseudoElement::UnknownWebkit(ref atom) => {
|
|
293
|
+
dest.write_str("::-webkit-")?;
|
|
294
|
+
serialize_atom_identifier(atom, dest)
|
|
295
|
+
},
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
import toml
|
|
11
|
+
|
|
12
|
+
THIS_DIR = os.path.dirname(__file__)
|
|
13
|
+
sys.path.insert(0, os.path.join(os.path.dirname(THIS_DIR), "properties"))
|
|
14
|
+
|
|
15
|
+
import data
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Pseudo(object):
|
|
19
|
+
def __init__(self, name, argument, enabled_in, pref):
|
|
20
|
+
self.name = name
|
|
21
|
+
self.camel = data.to_camel_case(name)
|
|
22
|
+
self.capitalized = self.camel[0].upper() + self.camel[1:]
|
|
23
|
+
self.argument = argument
|
|
24
|
+
self.enabled_in = enabled_in
|
|
25
|
+
self.pref = pref
|
|
26
|
+
|
|
27
|
+
def is_pseudo_element(self):
|
|
28
|
+
return isinstance(self, PseudoElement)
|
|
29
|
+
|
|
30
|
+
def is_anon_box(self):
|
|
31
|
+
return isinstance(self, AnonBox)
|
|
32
|
+
|
|
33
|
+
def is_non_inheriting_anon_box(self):
|
|
34
|
+
return isinstance(self, AnonBox) and not self.inherits
|
|
35
|
+
|
|
36
|
+
def is_inheriting_anon_box(self):
|
|
37
|
+
return isinstance(self, AnonBox) and self.inherits
|
|
38
|
+
|
|
39
|
+
def flags(self):
|
|
40
|
+
flags = []
|
|
41
|
+
if self.enabled_in == "ua":
|
|
42
|
+
flags.append("ENABLED_IN_UA")
|
|
43
|
+
elif self.enabled_in == "chrome":
|
|
44
|
+
flags.append("ENABLED_IN_UA")
|
|
45
|
+
flags.append("ENABLED_IN_CHROME")
|
|
46
|
+
if self.pref:
|
|
47
|
+
flags.append("ENABLED_BY_PREF")
|
|
48
|
+
if self.argument:
|
|
49
|
+
flags.append("HAS_ARGUMENT")
|
|
50
|
+
if isinstance(self, PseudoElement):
|
|
51
|
+
flags.append("IS_PSEUDO_ELEMENT")
|
|
52
|
+
if self.is_css2:
|
|
53
|
+
flags.append("IS_CSS2")
|
|
54
|
+
if self.is_eager:
|
|
55
|
+
flags.append("IS_EAGER")
|
|
56
|
+
if self.is_js_created_nac:
|
|
57
|
+
flags.append("IS_JS_CREATED_NAC")
|
|
58
|
+
if self.is_flex_or_grid_item:
|
|
59
|
+
flags.append("IS_FLEX_OR_GRID_ITEM")
|
|
60
|
+
if self.is_element_backed:
|
|
61
|
+
flags.append("IS_ELEMENT_BACKED")
|
|
62
|
+
if self.is_tree_abiding:
|
|
63
|
+
flags.append("IS_TREE_ABIDING")
|
|
64
|
+
if self.parses_as_element_backed:
|
|
65
|
+
flags.append("PARSES_AS_ELEMENT_BACKED")
|
|
66
|
+
if self.supports_user_action_state:
|
|
67
|
+
flags.append("SUPPORTS_USER_ACTION_STATE")
|
|
68
|
+
if isinstance(self, AnonBox):
|
|
69
|
+
if self.inherits:
|
|
70
|
+
flags.append("IS_INHERITING_ANON_BOX")
|
|
71
|
+
else:
|
|
72
|
+
flags.append("IS_NON_INHERITING_ANON_BOX")
|
|
73
|
+
if self.wrapper:
|
|
74
|
+
flags.append("IS_WRAPPER_ANON_BOX")
|
|
75
|
+
return flags
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class AnonBox(Pseudo):
|
|
79
|
+
def __init__(self, name, wrapper=False, inherits=True):
|
|
80
|
+
super().__init__(name, argument=None, enabled_in="ua", pref=None)
|
|
81
|
+
self.wrapper = wrapper
|
|
82
|
+
self.inherits = inherits
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class PseudoElement(Pseudo):
|
|
86
|
+
def __init__(
|
|
87
|
+
self,
|
|
88
|
+
name,
|
|
89
|
+
enabled_in="content",
|
|
90
|
+
is_css2=False,
|
|
91
|
+
is_eager=False,
|
|
92
|
+
is_js_created_nac=False,
|
|
93
|
+
is_flex_or_grid_item=False,
|
|
94
|
+
is_element_backed=False,
|
|
95
|
+
is_tree_abiding=False,
|
|
96
|
+
parses_as_element_backed=None,
|
|
97
|
+
supports_user_action_state=False,
|
|
98
|
+
enabled_domains_pref=None,
|
|
99
|
+
pref=None,
|
|
100
|
+
argument=None,
|
|
101
|
+
):
|
|
102
|
+
super().__init__(name, argument=argument, enabled_in=enabled_in, pref=pref)
|
|
103
|
+
self.is_css2 = is_css2
|
|
104
|
+
self.is_eager = is_eager
|
|
105
|
+
self.is_js_created_nac = is_js_created_nac
|
|
106
|
+
self.is_flex_or_grid_item = is_flex_or_grid_item
|
|
107
|
+
self.is_element_backed = is_element_backed
|
|
108
|
+
self.is_tree_abiding = is_element_backed or is_tree_abiding
|
|
109
|
+
self.parses_as_element_backed = (
|
|
110
|
+
parses_as_element_backed
|
|
111
|
+
if parses_as_element_backed is not None
|
|
112
|
+
else is_element_backed
|
|
113
|
+
)
|
|
114
|
+
self.supports_user_action_state = supports_user_action_state
|
|
115
|
+
self.enabled_domains_pref = enabled_domains_pref
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class PseudoElementData:
|
|
119
|
+
def __init__(self):
|
|
120
|
+
this_dir = os.path.dirname(__file__)
|
|
121
|
+
pseudo_elements_toml = os.path.join(this_dir, "pseudo_elements.toml")
|
|
122
|
+
anon_boxes_toml = os.path.join(this_dir, "anon_boxes.toml")
|
|
123
|
+
self.anon_boxes = sorted(
|
|
124
|
+
(
|
|
125
|
+
AnonBox(name, **val)
|
|
126
|
+
for name, val in toml.loads(open(anon_boxes_toml).read()).items()
|
|
127
|
+
),
|
|
128
|
+
key=lambda n: n.inherits,
|
|
129
|
+
)
|
|
130
|
+
self.pseudo_elements = [
|
|
131
|
+
PseudoElement(name, **val)
|
|
132
|
+
for name, val in toml.loads(open(pseudo_elements_toml).read()).items()
|
|
133
|
+
]
|
|
134
|
+
self.path_dependencies = [pseudo_elements_toml, anon_boxes_toml]
|
|
135
|
+
|
|
136
|
+
def all_pseudos(self):
|
|
137
|
+
return self.anon_boxes + self.pseudo_elements
|
|
@@ -0,0 +1,197 @@
|
|
|
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 http://mozilla.org/MPL/2.0/.
|
|
4
|
+
#
|
|
5
|
+
# This file contains the list of support CSS pseudo-elements and some flags.
|
|
6
|
+
#
|
|
7
|
+
# Each pseudo element has its own section, with the following keys:
|
|
8
|
+
#
|
|
9
|
+
# enabled_in - Same semantics as longhands.toml
|
|
10
|
+
# is_css2 - Default false, whether this is a css2 pseudo-element, and can be
|
|
11
|
+
# parsed only with one colon.
|
|
12
|
+
# is_eager - Whether the pseudo-element is eagerly cascaded by the style
|
|
13
|
+
# system during traversal. This should generally only be used for
|
|
14
|
+
# pseudo-elements that apply to most elements.
|
|
15
|
+
# is_js_created_nac - True if this pseudo-element can be created by JS.
|
|
16
|
+
# is_flex_or_grid_item - True if display item fixup for flex / grid should
|
|
17
|
+
# happen for this pseudo
|
|
18
|
+
# is_element_backed - whether this is an element-backed pseudo-element
|
|
19
|
+
# https://drafts.csswg.org/css-pseudo-4/#element-like
|
|
20
|
+
# supports_user_action_state - true if this pseudo supports :hover etc.
|
|
21
|
+
# enabled_domains_pref - name of a pref (`DataMutexString`,
|
|
22
|
+
# `mirror: always`, `rust: true`) listing the only
|
|
23
|
+
# domains for which this pseudo-element should be
|
|
24
|
+
# enabled. An empty value means no domain, "*" means
|
|
25
|
+
# every domain.
|
|
26
|
+
# See `nsContentUtils::IsURIInList` for the value
|
|
27
|
+
# format.
|
|
28
|
+
# argument - If provided, the argument this functional pseudo takes.
|
|
29
|
+
# pref - Same semantics as gecko_pref in longhands.toml
|
|
30
|
+
#
|
|
31
|
+
# When adding a pseudo-element, you also need to add the relevant atom to
|
|
32
|
+
# StaticAtoms.py, with the camel-case name of the pseudo-element.
|
|
33
|
+
[after]
|
|
34
|
+
is_css2 = true
|
|
35
|
+
is_eager = true
|
|
36
|
+
is_flex_or_grid_item = true
|
|
37
|
+
is_tree_abiding = true
|
|
38
|
+
[before]
|
|
39
|
+
is_css2 = true
|
|
40
|
+
is_eager = true
|
|
41
|
+
is_flex_or_grid_item = true
|
|
42
|
+
is_tree_abiding = true
|
|
43
|
+
[marker]
|
|
44
|
+
is_tree_abiding = true
|
|
45
|
+
[backdrop]
|
|
46
|
+
[cue]
|
|
47
|
+
is_js_created_nac = true
|
|
48
|
+
[first-letter]
|
|
49
|
+
is_css2 = true
|
|
50
|
+
is_eager = true
|
|
51
|
+
[first-line]
|
|
52
|
+
is_css2 = true
|
|
53
|
+
is_eager = true
|
|
54
|
+
[highlight]
|
|
55
|
+
argument = "AtomIdent"
|
|
56
|
+
[selection]
|
|
57
|
+
[target-text]
|
|
58
|
+
[view-transition]
|
|
59
|
+
[view-transition-group]
|
|
60
|
+
argument = "PtNameAndClassSelector"
|
|
61
|
+
is_element_backed = true
|
|
62
|
+
[view-transition-image-pair]
|
|
63
|
+
is_element_backed = true
|
|
64
|
+
argument = "PtNameAndClassSelector"
|
|
65
|
+
[view-transition-old]
|
|
66
|
+
is_element_backed = true
|
|
67
|
+
argument = "PtNameAndClassSelector"
|
|
68
|
+
[view-transition-new]
|
|
69
|
+
is_element_backed = true
|
|
70
|
+
argument = "PtNameAndClassSelector"
|
|
71
|
+
# The internal implementation usage for View transition to create the snapshot
|
|
72
|
+
# containing block concept.
|
|
73
|
+
[-moz-snapshot-containing-block]
|
|
74
|
+
enabled_in = "ua"
|
|
75
|
+
[picker]
|
|
76
|
+
enabled_in = "ua"
|
|
77
|
+
pref = "dom.select.customizable_select.enabled"
|
|
78
|
+
argument = "AtomIdent"
|
|
79
|
+
is_element_backed = true
|
|
80
|
+
[checkmark]
|
|
81
|
+
pref = "dom.select.customizable_select.enabled"
|
|
82
|
+
is_tree_abiding = true
|
|
83
|
+
|
|
84
|
+
# HTML5 Forms pseudo elements
|
|
85
|
+
[-moz-number-spin-box]
|
|
86
|
+
supports_user_action_state = true
|
|
87
|
+
enabled_in = "chrome"
|
|
88
|
+
[-moz-number-spin-down]
|
|
89
|
+
supports_user_action_state = true
|
|
90
|
+
enabled_in = "chrome"
|
|
91
|
+
[-moz-number-spin-up]
|
|
92
|
+
supports_user_action_state = true
|
|
93
|
+
enabled_in = "chrome"
|
|
94
|
+
[-moz-search-clear-button]
|
|
95
|
+
supports_user_action_state = true
|
|
96
|
+
enabled_in = "chrome"
|
|
97
|
+
# The selected label of a <select>
|
|
98
|
+
[-moz-select-content]
|
|
99
|
+
enabled_in = "chrome"
|
|
100
|
+
is_element_backed = true
|
|
101
|
+
# The menulist button of a <select>
|
|
102
|
+
[picker-icon]
|
|
103
|
+
enabled_in = "chrome"
|
|
104
|
+
pref = "dom.select.customizable_select.enabled"
|
|
105
|
+
is_tree_abiding = true
|
|
106
|
+
[-moz-progress-bar]
|
|
107
|
+
supports_user_action_state = true
|
|
108
|
+
[-moz-range-track]
|
|
109
|
+
supports_user_action_state = true
|
|
110
|
+
[-moz-range-progress]
|
|
111
|
+
supports_user_action_state = true
|
|
112
|
+
[-moz-range-thumb]
|
|
113
|
+
supports_user_action_state = true
|
|
114
|
+
[-moz-meter-bar]
|
|
115
|
+
supports_user_action_state = true
|
|
116
|
+
[placeholder]
|
|
117
|
+
supports_user_action_state = true
|
|
118
|
+
is_element_backed = true
|
|
119
|
+
parses_as_element_backed = false
|
|
120
|
+
[-moz-color-swatch]
|
|
121
|
+
supports_user_action_state = true
|
|
122
|
+
# The root of the text value anonymous content inside an <input> or <textarea>.
|
|
123
|
+
[-moz-text-control-editing-root]
|
|
124
|
+
enabled_in = "ua"
|
|
125
|
+
is_element_backed = true
|
|
126
|
+
# The element that shows the autofill value.
|
|
127
|
+
[-moz-text-control-preview]
|
|
128
|
+
enabled_in = "ua"
|
|
129
|
+
is_element_backed = true
|
|
130
|
+
# The Reveal Password button for <input type=password>.
|
|
131
|
+
[-moz-reveal]
|
|
132
|
+
supports_user_action_state = true
|
|
133
|
+
enabled_in = "ua"
|
|
134
|
+
# The button in an <input type=file>
|
|
135
|
+
[file-selector-button]
|
|
136
|
+
supports_user_action_state = true
|
|
137
|
+
is_tree_abiding = true
|
|
138
|
+
# The cropped label in a file input.
|
|
139
|
+
[-moz-file-content]
|
|
140
|
+
enabled_in = "chrome"
|
|
141
|
+
# Standard progress/meter/range pseudo-elements.
|
|
142
|
+
[slider-track]
|
|
143
|
+
supports_user_action_state = true
|
|
144
|
+
enabled_in = "chrome"
|
|
145
|
+
pref = "layout.css.modern-range-pseudos.enabled"
|
|
146
|
+
[slider-thumb]
|
|
147
|
+
supports_user_action_state = true
|
|
148
|
+
enabled_in = "chrome"
|
|
149
|
+
pref = "layout.css.modern-range-pseudos.enabled"
|
|
150
|
+
[slider-fill]
|
|
151
|
+
supports_user_action_state = true
|
|
152
|
+
enabled_in = "chrome"
|
|
153
|
+
pref = "layout.css.modern-range-pseudos.enabled"
|
|
154
|
+
# The content in a <details> element that is shown when the element is open.
|
|
155
|
+
[details-content]
|
|
156
|
+
supports_user_action_state = true
|
|
157
|
+
enabled_in = "chrome"
|
|
158
|
+
pref = "layout.css.details-content.enabled"
|
|
159
|
+
is_element_backed = true
|
|
160
|
+
[-webkit-scrollbar]
|
|
161
|
+
pref = "layout.css.fake-webkit-scrollbar.enabled"
|
|
162
|
+
enabled_domains_pref = "layout.css.fake-webkit-scrollbar.enabled-domains"
|
|
163
|
+
|
|
164
|
+
# Tree pseudo-elements
|
|
165
|
+
[-moz-tree-column]
|
|
166
|
+
enabled_in = "chrome"
|
|
167
|
+
argument = "AtomThinVec"
|
|
168
|
+
[-moz-tree-row]
|
|
169
|
+
enabled_in = "chrome"
|
|
170
|
+
argument = "AtomThinVec"
|
|
171
|
+
[-moz-tree-separator]
|
|
172
|
+
enabled_in = "chrome"
|
|
173
|
+
argument = "AtomThinVec"
|
|
174
|
+
[-moz-tree-cell]
|
|
175
|
+
enabled_in = "chrome"
|
|
176
|
+
argument = "AtomThinVec"
|
|
177
|
+
[-moz-tree-indentation]
|
|
178
|
+
enabled_in = "chrome"
|
|
179
|
+
argument = "AtomThinVec"
|
|
180
|
+
[-moz-tree-line]
|
|
181
|
+
enabled_in = "chrome"
|
|
182
|
+
argument = "AtomThinVec"
|
|
183
|
+
[-moz-tree-twisty]
|
|
184
|
+
enabled_in = "chrome"
|
|
185
|
+
argument = "AtomThinVec"
|
|
186
|
+
[-moz-tree-image]
|
|
187
|
+
enabled_in = "chrome"
|
|
188
|
+
argument = "AtomThinVec"
|
|
189
|
+
[-moz-tree-cell-text]
|
|
190
|
+
enabled_in = "chrome"
|
|
191
|
+
argument = "AtomThinVec"
|
|
192
|
+
[-moz-tree-checkbox]
|
|
193
|
+
enabled_in = "chrome"
|
|
194
|
+
argument = "AtomThinVec"
|
|
195
|
+
[-moz-tree-drop-feedback]
|
|
196
|
+
enabled_in = "chrome"
|
|
197
|
+
argument = "AtomThinVec"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
from pseudo_elements import PseudoElementData
|
|
11
|
+
|
|
12
|
+
import build
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def generate_pseudo_elements(out):
|
|
16
|
+
data = PseudoElementData()
|
|
17
|
+
pseudo_definition_template = os.path.join(
|
|
18
|
+
os.path.dirname(__file__), "pseudo_element_definition.mako.rs"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
print(f"cargo:rerun-if-changed={pseudo_definition_template}")
|
|
22
|
+
for f in data.path_dependencies:
|
|
23
|
+
print(f"cargo:rerun-if-changed={f}")
|
|
24
|
+
|
|
25
|
+
target = os.path.join(out, "pseudo_element_definition.rs")
|
|
26
|
+
build.write(out, "pseudo_element_definition.rs", build.render(pseudo_definition_template, PSEUDOS=data.all_pseudos()))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
if len(sys.argv) != 2:
|
|
31
|
+
print("Usage: {} out".format(sys.argv[0]))
|
|
32
|
+
exit(2)
|
|
33
|
+
generate_pseudo_elements(sys.argv[1])
|