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,88 @@
|
|
|
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 values related to <ratio>.
|
|
6
|
+
//! https://drafts.csswg.org/css-values/#ratios
|
|
7
|
+
|
|
8
|
+
use crate::derives::*;
|
|
9
|
+
use crate::{One, Zero};
|
|
10
|
+
use std::fmt::{self, Write};
|
|
11
|
+
use style_traits::{CssWriter, ToCss};
|
|
12
|
+
|
|
13
|
+
/// A generic value for the `<ratio>` value.
|
|
14
|
+
#[derive(
|
|
15
|
+
Clone,
|
|
16
|
+
Copy,
|
|
17
|
+
Debug,
|
|
18
|
+
MallocSizeOf,
|
|
19
|
+
PartialEq,
|
|
20
|
+
SpecifiedValueInfo,
|
|
21
|
+
ToAnimatedValue,
|
|
22
|
+
ToComputedValue,
|
|
23
|
+
ToResolvedValue,
|
|
24
|
+
ToShmem,
|
|
25
|
+
)]
|
|
26
|
+
#[repr(C)]
|
|
27
|
+
pub struct Ratio<N>(pub N, pub N);
|
|
28
|
+
|
|
29
|
+
impl<N> ToCss for Ratio<N>
|
|
30
|
+
where
|
|
31
|
+
N: ToCss,
|
|
32
|
+
{
|
|
33
|
+
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
|
34
|
+
where
|
|
35
|
+
W: Write,
|
|
36
|
+
{
|
|
37
|
+
self.0.to_css(dest)?;
|
|
38
|
+
// Even though 1 could be omitted, we don't per
|
|
39
|
+
// https://drafts.csswg.org/css-values-4/#ratio-value:
|
|
40
|
+
//
|
|
41
|
+
// The second <number> is optional, defaulting to 1. However,
|
|
42
|
+
// <ratio> is always serialized with both components.
|
|
43
|
+
//
|
|
44
|
+
// And for compat reasons, see bug 1669742.
|
|
45
|
+
//
|
|
46
|
+
// We serialize with spaces for consistency with all other
|
|
47
|
+
// slash-delimited things, see
|
|
48
|
+
// https://github.com/w3c/csswg-drafts/issues/4282
|
|
49
|
+
dest.write_str(" / ")?;
|
|
50
|
+
self.1.to_css(dest)?;
|
|
51
|
+
Ok(())
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
impl<N> Ratio<N>
|
|
56
|
+
where
|
|
57
|
+
N: Zero + One,
|
|
58
|
+
{
|
|
59
|
+
/// Returns true if this is a degenerate ratio.
|
|
60
|
+
/// https://drafts.csswg.org/css-values/#degenerate-ratio
|
|
61
|
+
#[inline]
|
|
62
|
+
pub fn is_degenerate(&self) -> bool {
|
|
63
|
+
self.0.is_zero() || self.1.is_zero()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/// Returns the used value. A ratio of 0/0 behaves as the ratio 1/0.
|
|
67
|
+
/// https://drafts.csswg.org/css-values-4/#ratios
|
|
68
|
+
pub fn used_value(self) -> Self {
|
|
69
|
+
if self.0.is_zero() && self.1.is_zero() {
|
|
70
|
+
Self(One::one(), Zero::zero())
|
|
71
|
+
} else {
|
|
72
|
+
self
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
impl<N> Zero for Ratio<N>
|
|
78
|
+
where
|
|
79
|
+
N: Zero + One,
|
|
80
|
+
{
|
|
81
|
+
fn zero() -> Self {
|
|
82
|
+
Self(Zero::zero(), One::one())
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
fn is_zero(&self) -> bool {
|
|
86
|
+
self.0.is_zero()
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
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 values that are composed of four sides.
|
|
6
|
+
|
|
7
|
+
use crate::derives::*;
|
|
8
|
+
use crate::parser::{Parse, ParserContext};
|
|
9
|
+
use cssparser::Parser;
|
|
10
|
+
use std::fmt::{self, Write};
|
|
11
|
+
use style_traits::{CssWriter, ParseError, ToCss};
|
|
12
|
+
|
|
13
|
+
/// A CSS value made of four components, where its `ToCss` impl will try to
|
|
14
|
+
/// serialize as few components as possible, like for example in `border-width`.
|
|
15
|
+
#[derive(
|
|
16
|
+
Animate,
|
|
17
|
+
Clone,
|
|
18
|
+
ComputeSquaredDistance,
|
|
19
|
+
Copy,
|
|
20
|
+
Debug,
|
|
21
|
+
Deserialize,
|
|
22
|
+
MallocSizeOf,
|
|
23
|
+
PartialEq,
|
|
24
|
+
SpecifiedValueInfo,
|
|
25
|
+
Serialize,
|
|
26
|
+
ToAnimatedValue,
|
|
27
|
+
ToAnimatedZero,
|
|
28
|
+
ToComputedValue,
|
|
29
|
+
ToResolvedValue,
|
|
30
|
+
ToShmem,
|
|
31
|
+
)]
|
|
32
|
+
#[repr(C)]
|
|
33
|
+
pub struct Rect<T>(pub T, pub T, pub T, pub T);
|
|
34
|
+
|
|
35
|
+
impl<T> Rect<T> {
|
|
36
|
+
/// Returns a new `Rect<T>` value.
|
|
37
|
+
pub fn new(first: T, second: T, third: T, fourth: T) -> Self {
|
|
38
|
+
Rect(first, second, third, fourth)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
impl<T> Rect<T>
|
|
43
|
+
where
|
|
44
|
+
T: Clone,
|
|
45
|
+
{
|
|
46
|
+
/// Returns a rect with all the values equal to `v`.
|
|
47
|
+
pub fn all(v: T) -> Self {
|
|
48
|
+
Rect::new(v.clone(), v.clone(), v.clone(), v)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/// Returns whether all four sides have the same value.
|
|
52
|
+
#[inline]
|
|
53
|
+
pub fn all_sides_equal(&self) -> bool
|
|
54
|
+
where
|
|
55
|
+
T: PartialEq,
|
|
56
|
+
{
|
|
57
|
+
self.0 == self.1 && self.1 == self.2 && self.2 == self.3
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/// Parses a new `Rect<T>` value with the given parse function.
|
|
61
|
+
pub fn parse_with<Parse>(
|
|
62
|
+
context: &ParserContext,
|
|
63
|
+
input: &mut Parser,
|
|
64
|
+
parse: Parse,
|
|
65
|
+
) -> Result<Self, ParseError>
|
|
66
|
+
where
|
|
67
|
+
Parse: Fn(&ParserContext, &mut Parser) -> Result<T, ParseError>,
|
|
68
|
+
{
|
|
69
|
+
let first = parse(context, input)?;
|
|
70
|
+
let Ok(second) = input.try_parse(|i| parse(context, i)) else {
|
|
71
|
+
// <first>
|
|
72
|
+
return Ok(Self::new(
|
|
73
|
+
first.clone(),
|
|
74
|
+
first.clone(),
|
|
75
|
+
first.clone(),
|
|
76
|
+
first,
|
|
77
|
+
));
|
|
78
|
+
};
|
|
79
|
+
let Ok(third) = input.try_parse(|i| parse(context, i)) else {
|
|
80
|
+
// <first> <second>
|
|
81
|
+
return Ok(Self::new(first.clone(), second.clone(), first, second));
|
|
82
|
+
};
|
|
83
|
+
let Ok(fourth) = input.try_parse(|i| parse(context, i)) else {
|
|
84
|
+
// <first> <second> <third>
|
|
85
|
+
return Ok(Self::new(first, second.clone(), third, second));
|
|
86
|
+
};
|
|
87
|
+
// <first> <second> <third> <fourth>
|
|
88
|
+
Ok(Self::new(first, second, third, fourth))
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/// Parses a new `Rect<T>` value which all components must be specified, with the given parse
|
|
92
|
+
/// function.
|
|
93
|
+
pub fn parse_all_components_with<Parse>(
|
|
94
|
+
context: &ParserContext,
|
|
95
|
+
input: &mut Parser,
|
|
96
|
+
parse: Parse,
|
|
97
|
+
) -> Result<Self, ParseError>
|
|
98
|
+
where
|
|
99
|
+
Parse: Fn(&ParserContext, &mut Parser) -> Result<T, ParseError>,
|
|
100
|
+
{
|
|
101
|
+
let first = parse(context, input)?;
|
|
102
|
+
let second = parse(context, input)?;
|
|
103
|
+
let third = parse(context, input)?;
|
|
104
|
+
let fourth = parse(context, input)?;
|
|
105
|
+
// <first> <second> <third> <fourth>
|
|
106
|
+
Ok(Self::new(first, second, third, fourth))
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
impl<T> Parse for Rect<T>
|
|
111
|
+
where
|
|
112
|
+
T: Clone + Parse,
|
|
113
|
+
{
|
|
114
|
+
#[inline]
|
|
115
|
+
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ParseError> {
|
|
116
|
+
Self::parse_with(context, input, T::parse)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
impl<T> ToCss for Rect<T>
|
|
121
|
+
where
|
|
122
|
+
T: PartialEq + ToCss,
|
|
123
|
+
{
|
|
124
|
+
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
|
125
|
+
where
|
|
126
|
+
W: Write,
|
|
127
|
+
{
|
|
128
|
+
self.0.to_css(dest)?;
|
|
129
|
+
let same_vertical = self.0 == self.2;
|
|
130
|
+
let same_horizontal = self.1 == self.3;
|
|
131
|
+
if same_vertical && same_horizontal && self.0 == self.1 {
|
|
132
|
+
return Ok(());
|
|
133
|
+
}
|
|
134
|
+
dest.write_char(' ')?;
|
|
135
|
+
self.1.to_css(dest)?;
|
|
136
|
+
if same_vertical && same_horizontal {
|
|
137
|
+
return Ok(());
|
|
138
|
+
}
|
|
139
|
+
dest.write_char(' ')?;
|
|
140
|
+
self.2.to_css(dest)?;
|
|
141
|
+
if same_horizontal {
|
|
142
|
+
return Ok(());
|
|
143
|
+
}
|
|
144
|
+
dest.write_char(' ')?;
|
|
145
|
+
self.3.to_css(dest)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
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 type for CSS properties that are composed by two dimensions.
|
|
6
|
+
|
|
7
|
+
use crate::derives::*;
|
|
8
|
+
use crate::parser::ParserContext;
|
|
9
|
+
use crate::Zero;
|
|
10
|
+
use cssparser::Parser;
|
|
11
|
+
use std::fmt::{self, Write};
|
|
12
|
+
use style_traits::{CssWriter, ParseError, ToCss};
|
|
13
|
+
|
|
14
|
+
/// A generic size, for `border-*-radius` longhand properties, or
|
|
15
|
+
/// `border-spacing`.
|
|
16
|
+
#[derive(
|
|
17
|
+
Animate,
|
|
18
|
+
Clone,
|
|
19
|
+
ComputeSquaredDistance,
|
|
20
|
+
Copy,
|
|
21
|
+
Debug,
|
|
22
|
+
Deserialize,
|
|
23
|
+
MallocSizeOf,
|
|
24
|
+
PartialEq,
|
|
25
|
+
SpecifiedValueInfo,
|
|
26
|
+
Serialize,
|
|
27
|
+
ToAnimatedZero,
|
|
28
|
+
ToAnimatedValue,
|
|
29
|
+
ToComputedValue,
|
|
30
|
+
ToResolvedValue,
|
|
31
|
+
ToShmem,
|
|
32
|
+
)]
|
|
33
|
+
#[allow(missing_docs)]
|
|
34
|
+
#[repr(C)]
|
|
35
|
+
pub struct Size2D<L> {
|
|
36
|
+
pub width: L,
|
|
37
|
+
pub height: L,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
impl<L> Size2D<L> {
|
|
41
|
+
#[inline]
|
|
42
|
+
/// Create a new `Size2D` for an area of given width and height.
|
|
43
|
+
pub fn new(width: L, height: L) -> Self {
|
|
44
|
+
Self { width, height }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// Returns the width component.
|
|
48
|
+
pub fn width(&self) -> &L {
|
|
49
|
+
&self.width
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// Returns the height component.
|
|
53
|
+
pub fn height(&self) -> &L {
|
|
54
|
+
&self.height
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// Parse a `Size2D` with a given parsing function.
|
|
58
|
+
pub fn parse_with<F>(
|
|
59
|
+
context: &ParserContext,
|
|
60
|
+
input: &mut Parser,
|
|
61
|
+
parse_one: F,
|
|
62
|
+
) -> Result<Self, ParseError>
|
|
63
|
+
where
|
|
64
|
+
L: Clone,
|
|
65
|
+
F: Fn(&ParserContext, &mut Parser) -> Result<L, ParseError>,
|
|
66
|
+
{
|
|
67
|
+
let first = parse_one(context, input)?;
|
|
68
|
+
let second = input
|
|
69
|
+
.try_parse(|i| parse_one(context, i))
|
|
70
|
+
.unwrap_or_else(|_| first.clone());
|
|
71
|
+
Ok(Self::new(first, second))
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
impl<L> ToCss for Size2D<L>
|
|
76
|
+
where
|
|
77
|
+
L: ToCss + PartialEq,
|
|
78
|
+
{
|
|
79
|
+
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
|
80
|
+
where
|
|
81
|
+
W: Write,
|
|
82
|
+
{
|
|
83
|
+
self.width.to_css(dest)?;
|
|
84
|
+
|
|
85
|
+
if self.height != self.width {
|
|
86
|
+
dest.write_char(' ')?;
|
|
87
|
+
self.height.to_css(dest)?;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
Ok(())
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
impl<L: Zero> Zero for Size2D<L> {
|
|
95
|
+
fn zero() -> Self {
|
|
96
|
+
Self::new(L::zero(), L::zero())
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
fn is_zero(&self) -> bool {
|
|
100
|
+
self.width.is_zero() && self.height.is_zero()
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
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 values in SVG
|
|
6
|
+
|
|
7
|
+
use crate::derives::*;
|
|
8
|
+
use crate::parser::{Parse, ParserContext};
|
|
9
|
+
use cssparser::Parser;
|
|
10
|
+
use style_traits::ParseError;
|
|
11
|
+
|
|
12
|
+
/// The fallback of an SVG paint server value.
|
|
13
|
+
#[derive(
|
|
14
|
+
Animate,
|
|
15
|
+
Clone,
|
|
16
|
+
ComputeSquaredDistance,
|
|
17
|
+
Debug,
|
|
18
|
+
MallocSizeOf,
|
|
19
|
+
PartialEq,
|
|
20
|
+
Parse,
|
|
21
|
+
SpecifiedValueInfo,
|
|
22
|
+
ToAnimatedValue,
|
|
23
|
+
ToAnimatedZero,
|
|
24
|
+
ToComputedValue,
|
|
25
|
+
ToCss,
|
|
26
|
+
ToResolvedValue,
|
|
27
|
+
ToShmem,
|
|
28
|
+
)]
|
|
29
|
+
#[repr(C, u8)]
|
|
30
|
+
pub enum GenericSVGPaintFallback<C> {
|
|
31
|
+
/// The `none` keyword.
|
|
32
|
+
None,
|
|
33
|
+
/// A magic value that represents no fallback specified and serializes to
|
|
34
|
+
/// the empty string.
|
|
35
|
+
#[css(skip)]
|
|
36
|
+
Unset,
|
|
37
|
+
/// A color.
|
|
38
|
+
Color(C),
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
pub use self::GenericSVGPaintFallback as SVGPaintFallback;
|
|
42
|
+
|
|
43
|
+
/// An SVG paint value
|
|
44
|
+
///
|
|
45
|
+
/// <https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint>
|
|
46
|
+
#[derive(
|
|
47
|
+
Animate,
|
|
48
|
+
Clone,
|
|
49
|
+
ComputeSquaredDistance,
|
|
50
|
+
Debug,
|
|
51
|
+
MallocSizeOf,
|
|
52
|
+
PartialEq,
|
|
53
|
+
SpecifiedValueInfo,
|
|
54
|
+
ToAnimatedValue,
|
|
55
|
+
ToAnimatedZero,
|
|
56
|
+
ToComputedValue,
|
|
57
|
+
ToCss,
|
|
58
|
+
ToResolvedValue,
|
|
59
|
+
ToShmem,
|
|
60
|
+
ToTyped,
|
|
61
|
+
)]
|
|
62
|
+
#[animation(no_bound(Url))]
|
|
63
|
+
#[repr(C)]
|
|
64
|
+
#[typed(todo_derive_fields)]
|
|
65
|
+
pub struct GenericSVGPaint<Color, Url> {
|
|
66
|
+
/// The paint source.
|
|
67
|
+
pub kind: GenericSVGPaintKind<Color, Url>,
|
|
68
|
+
/// The fallback color.
|
|
69
|
+
pub fallback: GenericSVGPaintFallback<Color>,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
pub use self::GenericSVGPaint as SVGPaint;
|
|
73
|
+
|
|
74
|
+
impl<C, U> Default for SVGPaint<C, U> {
|
|
75
|
+
fn default() -> Self {
|
|
76
|
+
Self {
|
|
77
|
+
kind: SVGPaintKind::None,
|
|
78
|
+
fallback: SVGPaintFallback::Unset,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/// An SVG paint value without the fallback.
|
|
84
|
+
///
|
|
85
|
+
/// Whereas the spec only allows PaintServer to have a fallback, Gecko lets the
|
|
86
|
+
/// context properties have a fallback as well.
|
|
87
|
+
#[derive(
|
|
88
|
+
Animate,
|
|
89
|
+
Clone,
|
|
90
|
+
ComputeSquaredDistance,
|
|
91
|
+
Debug,
|
|
92
|
+
MallocSizeOf,
|
|
93
|
+
PartialEq,
|
|
94
|
+
Parse,
|
|
95
|
+
SpecifiedValueInfo,
|
|
96
|
+
ToAnimatedValue,
|
|
97
|
+
ToAnimatedZero,
|
|
98
|
+
ToComputedValue,
|
|
99
|
+
ToCss,
|
|
100
|
+
ToResolvedValue,
|
|
101
|
+
ToShmem,
|
|
102
|
+
)]
|
|
103
|
+
#[animation(no_bound(U))]
|
|
104
|
+
#[repr(C, u8)]
|
|
105
|
+
pub enum GenericSVGPaintKind<C, U> {
|
|
106
|
+
/// `none`
|
|
107
|
+
#[animation(error)]
|
|
108
|
+
None,
|
|
109
|
+
/// `<color>`
|
|
110
|
+
Color(C),
|
|
111
|
+
/// `url(...)`
|
|
112
|
+
#[animation(error)]
|
|
113
|
+
PaintServer(U),
|
|
114
|
+
/// `context-fill`
|
|
115
|
+
ContextFill,
|
|
116
|
+
/// `context-stroke`
|
|
117
|
+
ContextStroke,
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
pub use self::GenericSVGPaintKind as SVGPaintKind;
|
|
121
|
+
|
|
122
|
+
impl<C: Parse, U: Parse> Parse for SVGPaint<C, U> {
|
|
123
|
+
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ParseError> {
|
|
124
|
+
let kind = SVGPaintKind::parse(context, input)?;
|
|
125
|
+
if matches!(kind, SVGPaintKind::None | SVGPaintKind::Color(..)) {
|
|
126
|
+
return Ok(SVGPaint {
|
|
127
|
+
kind,
|
|
128
|
+
fallback: SVGPaintFallback::Unset,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
let fallback = input
|
|
132
|
+
.try_parse(|i| SVGPaintFallback::parse(context, i))
|
|
133
|
+
.unwrap_or(SVGPaintFallback::Unset);
|
|
134
|
+
Ok(SVGPaint { kind, fallback })
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/// An SVG length value supports `context-value` in addition to length.
|
|
139
|
+
#[derive(
|
|
140
|
+
Animate,
|
|
141
|
+
Clone,
|
|
142
|
+
ComputeSquaredDistance,
|
|
143
|
+
Copy,
|
|
144
|
+
Debug,
|
|
145
|
+
MallocSizeOf,
|
|
146
|
+
PartialEq,
|
|
147
|
+
SpecifiedValueInfo,
|
|
148
|
+
ToAnimatedValue,
|
|
149
|
+
ToAnimatedZero,
|
|
150
|
+
ToComputedValue,
|
|
151
|
+
ToCss,
|
|
152
|
+
ToResolvedValue,
|
|
153
|
+
ToShmem,
|
|
154
|
+
ToTyped,
|
|
155
|
+
)]
|
|
156
|
+
#[repr(C, u8)]
|
|
157
|
+
pub enum GenericSVGLength<L> {
|
|
158
|
+
/// `<length> | <percentage> | <number>`
|
|
159
|
+
LengthPercentage(L),
|
|
160
|
+
/// `context-value`
|
|
161
|
+
#[animation(error)]
|
|
162
|
+
ContextValue,
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
pub use self::GenericSVGLength as SVGLength;
|
|
166
|
+
|
|
167
|
+
/// Generic value for stroke-dasharray.
|
|
168
|
+
#[derive(
|
|
169
|
+
Clone,
|
|
170
|
+
Debug,
|
|
171
|
+
MallocSizeOf,
|
|
172
|
+
PartialEq,
|
|
173
|
+
SpecifiedValueInfo,
|
|
174
|
+
ToAnimatedValue,
|
|
175
|
+
ToAnimatedZero,
|
|
176
|
+
ToComputedValue,
|
|
177
|
+
ToCss,
|
|
178
|
+
ToResolvedValue,
|
|
179
|
+
ToShmem,
|
|
180
|
+
ToTyped,
|
|
181
|
+
)]
|
|
182
|
+
#[repr(C, u8)]
|
|
183
|
+
pub enum GenericSVGStrokeDashArray<L> {
|
|
184
|
+
/// `[ <length> | <percentage> | <number> ]#`
|
|
185
|
+
#[css(comma)]
|
|
186
|
+
#[typed(no_multiple_values)]
|
|
187
|
+
Values(#[css(if_empty = "none", iterable)] crate::OwnedSlice<L>),
|
|
188
|
+
/// `context-value`
|
|
189
|
+
ContextValue,
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
pub use self::GenericSVGStrokeDashArray as SVGStrokeDashArray;
|
|
193
|
+
|
|
194
|
+
/// An SVG opacity value accepts `context-{fill,stroke}-opacity` in
|
|
195
|
+
/// addition to opacity value.
|
|
196
|
+
#[derive(
|
|
197
|
+
Animate,
|
|
198
|
+
Clone,
|
|
199
|
+
ComputeSquaredDistance,
|
|
200
|
+
Copy,
|
|
201
|
+
Debug,
|
|
202
|
+
MallocSizeOf,
|
|
203
|
+
PartialEq,
|
|
204
|
+
Parse,
|
|
205
|
+
SpecifiedValueInfo,
|
|
206
|
+
ToAnimatedValue,
|
|
207
|
+
ToAnimatedZero,
|
|
208
|
+
ToComputedValue,
|
|
209
|
+
ToCss,
|
|
210
|
+
ToResolvedValue,
|
|
211
|
+
ToShmem,
|
|
212
|
+
ToTyped,
|
|
213
|
+
)]
|
|
214
|
+
#[repr(C, u8)]
|
|
215
|
+
pub enum GenericSVGOpacity<OpacityType> {
|
|
216
|
+
/// `<opacity-value>`
|
|
217
|
+
Opacity(OpacityType),
|
|
218
|
+
/// `context-fill-opacity`
|
|
219
|
+
#[animation(error)]
|
|
220
|
+
ContextFillOpacity,
|
|
221
|
+
/// `context-stroke-opacity`
|
|
222
|
+
#[animation(error)]
|
|
223
|
+
ContextStrokeOpacity,
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
pub use self::GenericSVGOpacity as SVGOpacity;
|