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,303 @@
|
|
|
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
|
+
//! Generic types that share their serialization implementations
|
|
6
|
+
//! for both specified and computed values.
|
|
7
|
+
|
|
8
|
+
use crate::derives::*;
|
|
9
|
+
use crate::Zero;
|
|
10
|
+
use std::ops::Add;
|
|
11
|
+
|
|
12
|
+
pub mod animation;
|
|
13
|
+
pub mod background;
|
|
14
|
+
pub mod basic_shape;
|
|
15
|
+
pub mod border;
|
|
16
|
+
#[path = "box.rs"]
|
|
17
|
+
pub mod box_;
|
|
18
|
+
pub mod calc;
|
|
19
|
+
pub mod color;
|
|
20
|
+
pub mod column;
|
|
21
|
+
pub mod counters;
|
|
22
|
+
pub mod easing;
|
|
23
|
+
pub mod effects;
|
|
24
|
+
pub mod flex;
|
|
25
|
+
pub mod font;
|
|
26
|
+
pub mod grid;
|
|
27
|
+
pub mod image;
|
|
28
|
+
pub mod length;
|
|
29
|
+
pub mod motion;
|
|
30
|
+
pub mod page;
|
|
31
|
+
pub mod position;
|
|
32
|
+
pub mod ratio;
|
|
33
|
+
pub mod rect;
|
|
34
|
+
pub mod size;
|
|
35
|
+
pub mod svg;
|
|
36
|
+
pub mod text;
|
|
37
|
+
pub mod transform;
|
|
38
|
+
pub mod ui;
|
|
39
|
+
pub mod url;
|
|
40
|
+
|
|
41
|
+
/// A wrapper of Non-negative values.
|
|
42
|
+
#[derive(
|
|
43
|
+
Animate,
|
|
44
|
+
Clone,
|
|
45
|
+
ComputeSquaredDistance,
|
|
46
|
+
Copy,
|
|
47
|
+
Debug,
|
|
48
|
+
Deserialize,
|
|
49
|
+
Hash,
|
|
50
|
+
MallocSizeOf,
|
|
51
|
+
PartialEq,
|
|
52
|
+
PartialOrd,
|
|
53
|
+
SpecifiedValueInfo,
|
|
54
|
+
Serialize,
|
|
55
|
+
ToAnimatedZero,
|
|
56
|
+
ToComputedValue,
|
|
57
|
+
ToCss,
|
|
58
|
+
ToResolvedValue,
|
|
59
|
+
ToShmem,
|
|
60
|
+
ToTyped,
|
|
61
|
+
)]
|
|
62
|
+
#[repr(transparent)]
|
|
63
|
+
pub struct NonNegative<T>(pub T);
|
|
64
|
+
|
|
65
|
+
/// A trait to clamp a negative value to another.
|
|
66
|
+
pub trait ClampToNonNegative {
|
|
67
|
+
/// Clamps the value to be non-negative after an animation.
|
|
68
|
+
fn clamp_to_non_negative(self) -> Self;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
impl ClampToNonNegative for f32 {
|
|
72
|
+
fn clamp_to_non_negative(self) -> Self {
|
|
73
|
+
self.max(0.)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
impl<T: Add<Output = T>> Add<NonNegative<T>> for NonNegative<T> {
|
|
78
|
+
type Output = Self;
|
|
79
|
+
|
|
80
|
+
fn add(self, other: Self) -> Self {
|
|
81
|
+
NonNegative(self.0 + other.0)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
impl<T: Zero> Zero for NonNegative<T> {
|
|
86
|
+
fn is_zero(&self) -> bool {
|
|
87
|
+
self.0.is_zero()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
fn zero() -> Self {
|
|
91
|
+
NonNegative(T::zero())
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/// A wrapper of greater-than-or-equal-to-one values.
|
|
96
|
+
#[derive(
|
|
97
|
+
Animate,
|
|
98
|
+
Clone,
|
|
99
|
+
ComputeSquaredDistance,
|
|
100
|
+
Copy,
|
|
101
|
+
Debug,
|
|
102
|
+
Deserialize,
|
|
103
|
+
MallocSizeOf,
|
|
104
|
+
PartialEq,
|
|
105
|
+
PartialOrd,
|
|
106
|
+
Serialize,
|
|
107
|
+
SpecifiedValueInfo,
|
|
108
|
+
ToAnimatedZero,
|
|
109
|
+
ToComputedValue,
|
|
110
|
+
ToCss,
|
|
111
|
+
ToResolvedValue,
|
|
112
|
+
ToShmem,
|
|
113
|
+
)]
|
|
114
|
+
#[repr(transparent)]
|
|
115
|
+
pub struct GreaterThanOrEqualToOne<T>(pub T);
|
|
116
|
+
|
|
117
|
+
/// A wrapper of values between zero and one.
|
|
118
|
+
#[derive(
|
|
119
|
+
Animate,
|
|
120
|
+
Clone,
|
|
121
|
+
ComputeSquaredDistance,
|
|
122
|
+
Copy,
|
|
123
|
+
Debug,
|
|
124
|
+
Deserialize,
|
|
125
|
+
Hash,
|
|
126
|
+
MallocSizeOf,
|
|
127
|
+
PartialEq,
|
|
128
|
+
PartialOrd,
|
|
129
|
+
Serialize,
|
|
130
|
+
SpecifiedValueInfo,
|
|
131
|
+
ToAnimatedZero,
|
|
132
|
+
ToComputedValue,
|
|
133
|
+
ToCss,
|
|
134
|
+
ToResolvedValue,
|
|
135
|
+
ToShmem,
|
|
136
|
+
)]
|
|
137
|
+
#[repr(transparent)]
|
|
138
|
+
pub struct ZeroToOne<T>(pub T);
|
|
139
|
+
|
|
140
|
+
/// A clip rect for clip and image-region
|
|
141
|
+
#[allow(missing_docs)]
|
|
142
|
+
#[derive(
|
|
143
|
+
Clone,
|
|
144
|
+
ComputeSquaredDistance,
|
|
145
|
+
Copy,
|
|
146
|
+
Debug,
|
|
147
|
+
MallocSizeOf,
|
|
148
|
+
PartialEq,
|
|
149
|
+
SpecifiedValueInfo,
|
|
150
|
+
ToAnimatedValue,
|
|
151
|
+
ToAnimatedZero,
|
|
152
|
+
ToComputedValue,
|
|
153
|
+
ToCss,
|
|
154
|
+
ToResolvedValue,
|
|
155
|
+
ToShmem,
|
|
156
|
+
)]
|
|
157
|
+
#[css(function = "rect", comma)]
|
|
158
|
+
#[repr(C)]
|
|
159
|
+
pub struct GenericClipRect<LengthOrAuto> {
|
|
160
|
+
pub top: LengthOrAuto,
|
|
161
|
+
pub right: LengthOrAuto,
|
|
162
|
+
pub bottom: LengthOrAuto,
|
|
163
|
+
pub left: LengthOrAuto,
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
pub use self::GenericClipRect as ClipRect;
|
|
167
|
+
|
|
168
|
+
/// Either a clip-rect or `auto`.
|
|
169
|
+
#[allow(missing_docs)]
|
|
170
|
+
#[derive(
|
|
171
|
+
Animate,
|
|
172
|
+
Clone,
|
|
173
|
+
ComputeSquaredDistance,
|
|
174
|
+
Copy,
|
|
175
|
+
Debug,
|
|
176
|
+
MallocSizeOf,
|
|
177
|
+
Parse,
|
|
178
|
+
PartialEq,
|
|
179
|
+
SpecifiedValueInfo,
|
|
180
|
+
ToAnimatedValue,
|
|
181
|
+
ToAnimatedZero,
|
|
182
|
+
ToComputedValue,
|
|
183
|
+
ToCss,
|
|
184
|
+
ToResolvedValue,
|
|
185
|
+
ToShmem,
|
|
186
|
+
ToTyped,
|
|
187
|
+
)]
|
|
188
|
+
#[repr(C, u8)]
|
|
189
|
+
#[typed(todo_derive_fields)]
|
|
190
|
+
pub enum GenericClipRectOrAuto<R> {
|
|
191
|
+
Auto,
|
|
192
|
+
Rect(R),
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
pub use self::GenericClipRectOrAuto as ClipRectOrAuto;
|
|
196
|
+
|
|
197
|
+
impl<L> ClipRectOrAuto<L> {
|
|
198
|
+
/// Returns the `auto` value.
|
|
199
|
+
#[inline]
|
|
200
|
+
pub fn auto() -> Self {
|
|
201
|
+
ClipRectOrAuto::Auto
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/// Returns whether this value is the `auto` value.
|
|
205
|
+
#[inline]
|
|
206
|
+
pub fn is_auto(&self) -> bool {
|
|
207
|
+
matches!(*self, ClipRectOrAuto::Auto)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
pub use page::PageSize;
|
|
212
|
+
|
|
213
|
+
pub use text::NumberOrAuto;
|
|
214
|
+
|
|
215
|
+
/// An optional value, much like `Option<T>`, but with a defined struct layout
|
|
216
|
+
/// to be able to use it from C++ as well.
|
|
217
|
+
///
|
|
218
|
+
/// Note that this is relatively inefficient, struct-layout-wise, as you have
|
|
219
|
+
/// one byte for the tag, but padding to the alignment of T. If you have
|
|
220
|
+
/// multiple optional values and care about struct compactness, you might be
|
|
221
|
+
/// better off "coalescing" the combinations into a parent enum. But that
|
|
222
|
+
/// shouldn't matter for most use cases.
|
|
223
|
+
#[allow(missing_docs)]
|
|
224
|
+
#[derive(
|
|
225
|
+
Animate,
|
|
226
|
+
Clone,
|
|
227
|
+
ComputeSquaredDistance,
|
|
228
|
+
Copy,
|
|
229
|
+
Debug,
|
|
230
|
+
MallocSizeOf,
|
|
231
|
+
Parse,
|
|
232
|
+
PartialEq,
|
|
233
|
+
SpecifiedValueInfo,
|
|
234
|
+
ToAnimatedValue,
|
|
235
|
+
ToAnimatedZero,
|
|
236
|
+
ToComputedValue,
|
|
237
|
+
ToCss,
|
|
238
|
+
ToResolvedValue,
|
|
239
|
+
ToShmem,
|
|
240
|
+
Serialize,
|
|
241
|
+
Deserialize,
|
|
242
|
+
)]
|
|
243
|
+
#[repr(C, u8)]
|
|
244
|
+
pub enum Optional<T> {
|
|
245
|
+
#[css(skip)]
|
|
246
|
+
None,
|
|
247
|
+
Some(T),
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
impl<T> Optional<T> {
|
|
251
|
+
/// Returns whether this value is present.
|
|
252
|
+
pub fn is_some(&self) -> bool {
|
|
253
|
+
matches!(*self, Self::Some(..))
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/// Returns whether this value is not present.
|
|
257
|
+
pub fn is_none(&self) -> bool {
|
|
258
|
+
matches!(*self, Self::None)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/// Turns this Optional<> into a regular rust Option<>.
|
|
262
|
+
pub fn into_rust(self) -> Option<T> {
|
|
263
|
+
match self {
|
|
264
|
+
Self::Some(v) => Some(v),
|
|
265
|
+
Self::None => None,
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/// Return a reference to the containing value, if any, as a plain rust
|
|
270
|
+
/// Option<>.
|
|
271
|
+
pub fn as_ref(&self) -> Option<&T> {
|
|
272
|
+
match *self {
|
|
273
|
+
Self::Some(ref v) => Some(v),
|
|
274
|
+
Self::None => None,
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/// Return a mutable reference to the containing value, if any, as a plain
|
|
279
|
+
/// rust Option<>.
|
|
280
|
+
pub fn as_mut(&mut self) -> Option<&mut T> {
|
|
281
|
+
match *self {
|
|
282
|
+
Self::Some(ref mut v) => Some(v),
|
|
283
|
+
Self::None => None,
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/// See Option::map.
|
|
288
|
+
pub fn map<U>(self, map: impl FnOnce(T) -> U) -> Optional<U> {
|
|
289
|
+
match self {
|
|
290
|
+
Self::Some(v) => Optional::Some(map(v)),
|
|
291
|
+
Self::None => Optional::None,
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
impl<T> From<Option<T>> for Optional<T> {
|
|
297
|
+
fn from(rust: Option<T>) -> Self {
|
|
298
|
+
match rust {
|
|
299
|
+
Some(t) => Self::Some(t),
|
|
300
|
+
None => Self::None,
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
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
|
+
//! Generic types for CSS Motion Path.
|
|
6
|
+
|
|
7
|
+
use crate::derives::*;
|
|
8
|
+
use crate::values::animated::ToAnimatedZero;
|
|
9
|
+
use crate::values::generics::position::{GenericPosition, GenericPositionOrAuto};
|
|
10
|
+
use crate::values::specified::motion::CoordBox;
|
|
11
|
+
use serde::Deserializer;
|
|
12
|
+
use std::fmt::{self, Write};
|
|
13
|
+
use style_traits::{CssWriter, ToCss};
|
|
14
|
+
|
|
15
|
+
/// The <size> in ray() function.
|
|
16
|
+
///
|
|
17
|
+
/// https://drafts.fxtf.org/motion-1/#valdef-offsetpath-size
|
|
18
|
+
#[allow(missing_docs)]
|
|
19
|
+
#[derive(
|
|
20
|
+
Animate,
|
|
21
|
+
Clone,
|
|
22
|
+
ComputeSquaredDistance,
|
|
23
|
+
Copy,
|
|
24
|
+
Debug,
|
|
25
|
+
Deserialize,
|
|
26
|
+
MallocSizeOf,
|
|
27
|
+
Parse,
|
|
28
|
+
PartialEq,
|
|
29
|
+
Serialize,
|
|
30
|
+
SpecifiedValueInfo,
|
|
31
|
+
ToAnimatedValue,
|
|
32
|
+
ToComputedValue,
|
|
33
|
+
ToCss,
|
|
34
|
+
ToResolvedValue,
|
|
35
|
+
ToShmem,
|
|
36
|
+
)]
|
|
37
|
+
#[repr(u8)]
|
|
38
|
+
pub enum RaySize {
|
|
39
|
+
ClosestSide,
|
|
40
|
+
ClosestCorner,
|
|
41
|
+
FarthestSide,
|
|
42
|
+
FarthestCorner,
|
|
43
|
+
Sides,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// The `ray()` function, `ray( [ <angle> && <size> && contain? && [at <position>]? ] )`
|
|
47
|
+
///
|
|
48
|
+
/// https://drafts.fxtf.org/motion-1/#valdef-offsetpath-ray
|
|
49
|
+
#[derive(
|
|
50
|
+
Animate,
|
|
51
|
+
Clone,
|
|
52
|
+
ComputeSquaredDistance,
|
|
53
|
+
Debug,
|
|
54
|
+
Deserialize,
|
|
55
|
+
MallocSizeOf,
|
|
56
|
+
PartialEq,
|
|
57
|
+
Serialize,
|
|
58
|
+
SpecifiedValueInfo,
|
|
59
|
+
ToAnimatedValue,
|
|
60
|
+
ToComputedValue,
|
|
61
|
+
ToResolvedValue,
|
|
62
|
+
ToShmem,
|
|
63
|
+
)]
|
|
64
|
+
#[repr(C)]
|
|
65
|
+
pub struct GenericRayFunction<Angle, Position> {
|
|
66
|
+
/// The bearing angle with `0deg` pointing up and positive angles
|
|
67
|
+
/// representing clockwise rotation.
|
|
68
|
+
pub angle: Angle,
|
|
69
|
+
/// Decide the path length used when `offset-distance` is expressed
|
|
70
|
+
/// as a percentage.
|
|
71
|
+
pub size: RaySize,
|
|
72
|
+
/// Clamp `offset-distance` so that the box is entirely contained
|
|
73
|
+
/// within the path.
|
|
74
|
+
#[animation(constant)]
|
|
75
|
+
pub contain: bool,
|
|
76
|
+
/// The "at <position>" part. If omitted, we use auto to represent it.
|
|
77
|
+
pub position: GenericPositionOrAuto<Position>,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pub use self::GenericRayFunction as RayFunction;
|
|
81
|
+
|
|
82
|
+
impl<Angle, Position> ToCss for RayFunction<Angle, Position>
|
|
83
|
+
where
|
|
84
|
+
Angle: ToCss,
|
|
85
|
+
Position: ToCss,
|
|
86
|
+
{
|
|
87
|
+
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
|
88
|
+
where
|
|
89
|
+
W: Write,
|
|
90
|
+
{
|
|
91
|
+
self.angle.to_css(dest)?;
|
|
92
|
+
|
|
93
|
+
if !matches!(self.size, RaySize::ClosestSide) {
|
|
94
|
+
dest.write_char(' ')?;
|
|
95
|
+
self.size.to_css(dest)?;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if self.contain {
|
|
99
|
+
dest.write_str(" contain")?;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if !matches!(self.position, GenericPositionOrAuto::Auto) {
|
|
103
|
+
dest.write_str(" at ")?;
|
|
104
|
+
self.position.to_css(dest)?;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
Ok(())
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// Return error if we try to deserialize the url, for Gecko IPC purposes.
|
|
112
|
+
// Note: we cannot use #[serde(skip_deserializing)] variant attribute, which may cause the fatal
|
|
113
|
+
// error when trying to read the parameters because it cannot deserialize the input byte buffer,
|
|
114
|
+
// even if the type of OffsetPathFunction is not an url(), in our tests. This may be an issue of
|
|
115
|
+
// #[serde(skip_deserializing)] on enum, at least in the version (1.0) we are using. So we have to
|
|
116
|
+
// manually implement this deseriailzing function, but return error.
|
|
117
|
+
// FIXME: Bug 1847620, fiure out this is a serde issue or a gecko bug.
|
|
118
|
+
fn deserialize_url<'de, D, T>(_deserializer: D) -> Result<T, D::Error>
|
|
119
|
+
where
|
|
120
|
+
D: Deserializer<'de>,
|
|
121
|
+
{
|
|
122
|
+
use crate::serde::de::Error;
|
|
123
|
+
// Return Err() so the IPC will catch it and assert this as a fetal error.
|
|
124
|
+
Err(<D as Deserializer>::Error::custom(
|
|
125
|
+
"we don't support the deserializing for url",
|
|
126
|
+
))
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// The <offset-path> value.
|
|
130
|
+
/// <offset-path> = <ray()> | <url> | <basic-shape>
|
|
131
|
+
///
|
|
132
|
+
/// https://drafts.fxtf.org/motion-1/#typedef-offset-path
|
|
133
|
+
#[derive(
|
|
134
|
+
Animate,
|
|
135
|
+
Clone,
|
|
136
|
+
ComputeSquaredDistance,
|
|
137
|
+
Debug,
|
|
138
|
+
Deserialize,
|
|
139
|
+
MallocSizeOf,
|
|
140
|
+
PartialEq,
|
|
141
|
+
Serialize,
|
|
142
|
+
SpecifiedValueInfo,
|
|
143
|
+
ToAnimatedValue,
|
|
144
|
+
ToComputedValue,
|
|
145
|
+
ToCss,
|
|
146
|
+
ToResolvedValue,
|
|
147
|
+
ToShmem,
|
|
148
|
+
)]
|
|
149
|
+
#[animation(no_bound(U))]
|
|
150
|
+
#[repr(C, u8)]
|
|
151
|
+
pub enum GenericOffsetPathFunction<Shapes, RayFunction, U> {
|
|
152
|
+
/// ray() function, which defines a path in the polar coordinate system.
|
|
153
|
+
/// Use Box<> to make sure the size of offset-path is not too large.
|
|
154
|
+
#[css(function)]
|
|
155
|
+
Ray(RayFunction),
|
|
156
|
+
/// A URL reference to an SVG shape element. If the URL does not reference a shape element,
|
|
157
|
+
/// this behaves as path("m 0 0") instead.
|
|
158
|
+
#[animation(error)]
|
|
159
|
+
#[serde(deserialize_with = "deserialize_url")]
|
|
160
|
+
#[serde(skip_serializing)]
|
|
161
|
+
Url(U),
|
|
162
|
+
/// The <basic-shape> value.
|
|
163
|
+
Shape(Shapes),
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
pub use self::GenericOffsetPathFunction as OffsetPathFunction;
|
|
167
|
+
|
|
168
|
+
/// The offset-path property.
|
|
169
|
+
/// offset-path: none | <offset-path> || <coord-box>
|
|
170
|
+
///
|
|
171
|
+
/// https://drafts.fxtf.org/motion-1/#offset-path-property
|
|
172
|
+
#[derive(
|
|
173
|
+
Animate,
|
|
174
|
+
Clone,
|
|
175
|
+
ComputeSquaredDistance,
|
|
176
|
+
Debug,
|
|
177
|
+
Deserialize,
|
|
178
|
+
MallocSizeOf,
|
|
179
|
+
PartialEq,
|
|
180
|
+
Serialize,
|
|
181
|
+
SpecifiedValueInfo,
|
|
182
|
+
ToAnimatedValue,
|
|
183
|
+
ToComputedValue,
|
|
184
|
+
ToCss,
|
|
185
|
+
ToResolvedValue,
|
|
186
|
+
ToShmem,
|
|
187
|
+
ToTyped,
|
|
188
|
+
)]
|
|
189
|
+
#[repr(C, u8)]
|
|
190
|
+
#[typed(todo_derive_fields)]
|
|
191
|
+
pub enum GenericOffsetPath<Function> {
|
|
192
|
+
/// <offset-path> || <coord-box>.
|
|
193
|
+
OffsetPath {
|
|
194
|
+
/// <offset-path> part.
|
|
195
|
+
// Note: Use Box<> to make sure the size of this property doesn't go over the threshold.
|
|
196
|
+
path: Box<Function>,
|
|
197
|
+
/// <coord-box> part.
|
|
198
|
+
#[css(skip_if = "CoordBox::is_default")]
|
|
199
|
+
coord_box: CoordBox,
|
|
200
|
+
},
|
|
201
|
+
/// Only <coord-box>. This represents that <offset-path> is omitted, so we use the default
|
|
202
|
+
/// value, inset(0 round X), where X is the value of border-radius on the element that
|
|
203
|
+
/// establishes the containing block for this element.
|
|
204
|
+
CoordBox(CoordBox),
|
|
205
|
+
/// None value.
|
|
206
|
+
#[animation(error)]
|
|
207
|
+
None,
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
pub use self::GenericOffsetPath as OffsetPath;
|
|
211
|
+
|
|
212
|
+
impl<Function> OffsetPath<Function> {
|
|
213
|
+
/// Return None.
|
|
214
|
+
#[inline]
|
|
215
|
+
pub fn none() -> Self {
|
|
216
|
+
OffsetPath::None
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
impl<Function> ToAnimatedZero for OffsetPath<Function> {
|
|
221
|
+
#[inline]
|
|
222
|
+
fn to_animated_zero(&self) -> Result<Self, ()> {
|
|
223
|
+
Err(())
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/// The offset-position property, which specifies the offset starting position that is used by the
|
|
228
|
+
/// <offset-path> functions if they don’t specify their own starting position.
|
|
229
|
+
///
|
|
230
|
+
/// https://drafts.fxtf.org/motion-1/#offset-position-property
|
|
231
|
+
#[derive(
|
|
232
|
+
Animate,
|
|
233
|
+
Clone,
|
|
234
|
+
ComputeSquaredDistance,
|
|
235
|
+
Copy,
|
|
236
|
+
Debug,
|
|
237
|
+
Deserialize,
|
|
238
|
+
MallocSizeOf,
|
|
239
|
+
Parse,
|
|
240
|
+
PartialEq,
|
|
241
|
+
Serialize,
|
|
242
|
+
SpecifiedValueInfo,
|
|
243
|
+
ToAnimatedValue,
|
|
244
|
+
ToAnimatedZero,
|
|
245
|
+
ToComputedValue,
|
|
246
|
+
ToCss,
|
|
247
|
+
ToResolvedValue,
|
|
248
|
+
ToShmem,
|
|
249
|
+
ToTyped,
|
|
250
|
+
)]
|
|
251
|
+
#[repr(C, u8)]
|
|
252
|
+
pub enum GenericOffsetPosition<H, V> {
|
|
253
|
+
/// The element does not have an offset starting position.
|
|
254
|
+
Normal,
|
|
255
|
+
/// The offset starting position is the top-left corner of the box.
|
|
256
|
+
Auto,
|
|
257
|
+
/// The offset starting position is the result of using the <position> to position a 0x0 object
|
|
258
|
+
/// area within the box’s containing block.
|
|
259
|
+
Position(
|
|
260
|
+
#[css(field_bound)]
|
|
261
|
+
#[parse(field_bound)]
|
|
262
|
+
GenericPosition<H, V>,
|
|
263
|
+
),
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
pub use self::GenericOffsetPosition as OffsetPosition;
|
|
267
|
+
|
|
268
|
+
impl<H, V> OffsetPosition<H, V> {
|
|
269
|
+
/// Returns the initial value, normal.
|
|
270
|
+
#[inline]
|
|
271
|
+
pub fn normal() -> Self {
|
|
272
|
+
Self::Normal
|
|
273
|
+
}
|
|
274
|
+
}
|