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,971 @@
|
|
|
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
|
+
//! Gecko's media feature list and evaluator.
|
|
6
|
+
|
|
7
|
+
use crate::derives::*;
|
|
8
|
+
use crate::device::Device;
|
|
9
|
+
use crate::gecko_bindings::bindings;
|
|
10
|
+
use crate::gecko_bindings::structs;
|
|
11
|
+
use crate::media_queries::MediaType;
|
|
12
|
+
use crate::parser::ParserContext;
|
|
13
|
+
use crate::queries::feature::{AllowsRanges, Evaluator, FeatureFlags, QueryFeatureDescription};
|
|
14
|
+
use crate::queries::values::{Orientation, PrefersColorScheme};
|
|
15
|
+
use crate::values::computed::{CSSPixelLength, Context, Ratio, Resolution};
|
|
16
|
+
use crate::values::specified::color::ForcedColors;
|
|
17
|
+
use app_units::Au;
|
|
18
|
+
use euclid::default::Size2D;
|
|
19
|
+
|
|
20
|
+
fn device_size(device: &Device) -> Size2D<Au> {
|
|
21
|
+
let mut width = 0;
|
|
22
|
+
let mut height = 0;
|
|
23
|
+
unsafe {
|
|
24
|
+
bindings::Gecko_MediaFeatures_GetDeviceSize(device.document(), &mut width, &mut height);
|
|
25
|
+
}
|
|
26
|
+
Size2D::new(Au(width), Au(height))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/// https://drafts.csswg.org/mediaqueries-4/#width
|
|
30
|
+
fn eval_width(context: &Context) -> CSSPixelLength {
|
|
31
|
+
CSSPixelLength::new(context.device().au_viewport_size().width.to_f32_px())
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/// https://drafts.csswg.org/mediaqueries-4/#device-width
|
|
35
|
+
fn eval_device_width(context: &Context) -> CSSPixelLength {
|
|
36
|
+
CSSPixelLength::new(device_size(context.device()).width.to_f32_px())
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/// https://drafts.csswg.org/mediaqueries-4/#height
|
|
40
|
+
fn eval_height(context: &Context) -> CSSPixelLength {
|
|
41
|
+
CSSPixelLength::new(context.device().au_viewport_size().height.to_f32_px())
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// https://drafts.csswg.org/mediaqueries-4/#device-height
|
|
45
|
+
fn eval_device_height(context: &Context) -> CSSPixelLength {
|
|
46
|
+
CSSPixelLength::new(device_size(context.device()).height.to_f32_px())
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fn eval_aspect_ratio_for<F>(context: &Context, get_size: F) -> Ratio
|
|
50
|
+
where
|
|
51
|
+
F: FnOnce(&Device) -> Size2D<Au>,
|
|
52
|
+
{
|
|
53
|
+
let size = get_size(context.device());
|
|
54
|
+
Ratio::new(size.width.0 as f32, size.height.0 as f32)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// https://drafts.csswg.org/mediaqueries-4/#aspect-ratio
|
|
58
|
+
fn eval_aspect_ratio(context: &Context) -> Ratio {
|
|
59
|
+
eval_aspect_ratio_for(context, Device::au_viewport_size)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// https://drafts.csswg.org/mediaqueries-4/#device-aspect-ratio
|
|
63
|
+
fn eval_device_aspect_ratio(context: &Context) -> Ratio {
|
|
64
|
+
eval_aspect_ratio_for(context, device_size)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/// https://compat.spec.whatwg.org/#css-media-queries-webkit-device-pixel-ratio
|
|
68
|
+
fn eval_device_pixel_ratio(context: &Context) -> f32 {
|
|
69
|
+
eval_resolution(context).dppx()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// https://drafts.csswg.org/mediaqueries-4/#orientation
|
|
73
|
+
fn eval_orientation(context: &Context, value: Option<Orientation>) -> bool {
|
|
74
|
+
Orientation::eval(context.device().au_viewport_size(), value)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// FIXME: There's no spec for `-moz-device-orientation`.
|
|
78
|
+
fn eval_device_orientation(context: &Context, value: Option<Orientation>) -> bool {
|
|
79
|
+
Orientation::eval(device_size(context.device()), value)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fn document_picture_in_picture_enabled(context: &ParserContext) -> bool {
|
|
83
|
+
crate::pref!("dom.documentpip.enabled") || context.chrome_rules_enabled()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/// Values for the display-mode media feature.
|
|
87
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, ToCss)]
|
|
88
|
+
#[repr(u8)]
|
|
89
|
+
#[allow(missing_docs)]
|
|
90
|
+
pub enum DisplayMode {
|
|
91
|
+
Browser = 0,
|
|
92
|
+
MinimalUi,
|
|
93
|
+
Standalone,
|
|
94
|
+
Fullscreen,
|
|
95
|
+
#[parse(condition = "document_picture_in_picture_enabled")]
|
|
96
|
+
PictureInPicture,
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/// https://w3c.github.io/manifest/#the-display-mode-media-feature
|
|
100
|
+
fn eval_display_mode(context: &Context, query_value: Option<DisplayMode>) -> bool {
|
|
101
|
+
match query_value {
|
|
102
|
+
Some(v) => {
|
|
103
|
+
v == unsafe {
|
|
104
|
+
bindings::Gecko_MediaFeatures_GetDisplayMode(context.device().document())
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
None => true,
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// https://drafts.csswg.org/mediaqueries-4/#grid
|
|
112
|
+
fn eval_grid(_: &Context) -> bool {
|
|
113
|
+
// Gecko doesn't support grid devices (e.g., ttys), so the 'grid' feature
|
|
114
|
+
// is always 0.
|
|
115
|
+
false
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/// https://compat.spec.whatwg.org/#css-media-queries-webkit-transform-3d
|
|
119
|
+
fn eval_transform_3d(_: &Context) -> bool {
|
|
120
|
+
true
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
124
|
+
#[repr(u8)]
|
|
125
|
+
enum Scan {
|
|
126
|
+
Progressive,
|
|
127
|
+
Interlace,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// https://drafts.csswg.org/mediaqueries-4/#scan
|
|
131
|
+
fn eval_scan(_: &Context, _: Option<Scan>) -> bool {
|
|
132
|
+
// Since Gecko doesn't support the 'tv' media type, the 'scan' feature never
|
|
133
|
+
// matches.
|
|
134
|
+
false
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/// https://drafts.csswg.org/mediaqueries-4/#color
|
|
138
|
+
fn eval_color(context: &Context) -> i32 {
|
|
139
|
+
unsafe { bindings::Gecko_MediaFeatures_GetColorDepth(context.device().document()) }
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/// https://drafts.csswg.org/mediaqueries-4/#color-index
|
|
143
|
+
fn eval_color_index(_: &Context) -> i32 {
|
|
144
|
+
// We should return zero if the device does not use a color lookup table.
|
|
145
|
+
0
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/// https://drafts.csswg.org/mediaqueries-4/#monochrome
|
|
149
|
+
fn eval_monochrome(context: &Context) -> i32 {
|
|
150
|
+
// For color devices we should return 0.
|
|
151
|
+
unsafe { bindings::Gecko_MediaFeatures_GetMonochromeBitsPerPixel(context.device().document()) }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/// Values for the color-gamut media feature.
|
|
155
|
+
/// This implements PartialOrd so that lower values will correctly match
|
|
156
|
+
/// higher capabilities.
|
|
157
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, PartialOrd, ToCss)]
|
|
158
|
+
#[repr(u8)]
|
|
159
|
+
pub enum ColorGamut {
|
|
160
|
+
/// The sRGB gamut.
|
|
161
|
+
Srgb,
|
|
162
|
+
/// The gamut specified by the Display P3 Color Space.
|
|
163
|
+
P3,
|
|
164
|
+
/// The gamut specified by the ITU-R Recommendation BT.2020 Color Space.
|
|
165
|
+
Rec2020,
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/// https://drafts.csswg.org/mediaqueries-4/#color-gamut
|
|
169
|
+
fn eval_color_gamut(context: &Context, query_value: Option<ColorGamut>) -> bool {
|
|
170
|
+
let query_value = match query_value {
|
|
171
|
+
Some(v) => v,
|
|
172
|
+
None => return false,
|
|
173
|
+
};
|
|
174
|
+
let color_gamut =
|
|
175
|
+
unsafe { bindings::Gecko_MediaFeatures_ColorGamut(context.device().document()) };
|
|
176
|
+
// Match if our color gamut is at least as wide as the query value
|
|
177
|
+
query_value <= color_gamut
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/// https://drafts.csswg.org/mediaqueries-4/#resolution
|
|
181
|
+
fn eval_resolution(context: &Context) -> Resolution {
|
|
182
|
+
let resolution_dppx =
|
|
183
|
+
unsafe { bindings::Gecko_MediaFeatures_GetResolution(context.device().document()) };
|
|
184
|
+
Resolution::from_dppx(resolution_dppx)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
188
|
+
#[repr(u8)]
|
|
189
|
+
enum PrefersReducedMotion {
|
|
190
|
+
NoPreference,
|
|
191
|
+
Reduce,
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
195
|
+
#[repr(u8)]
|
|
196
|
+
enum PrefersReducedTransparency {
|
|
197
|
+
NoPreference,
|
|
198
|
+
Reduce,
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/// Values for the dynamic-range and video-dynamic-range media features.
|
|
202
|
+
/// https://drafts.csswg.org/mediaqueries-5/#dynamic-range
|
|
203
|
+
/// This implements PartialOrd so that lower values will correctly match
|
|
204
|
+
/// higher capabilities.
|
|
205
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, PartialOrd, ToCss)]
|
|
206
|
+
#[repr(u8)]
|
|
207
|
+
#[allow(missing_docs)]
|
|
208
|
+
pub enum DynamicRange {
|
|
209
|
+
Standard,
|
|
210
|
+
High,
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/// https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-motion
|
|
214
|
+
fn eval_prefers_reduced_motion(
|
|
215
|
+
context: &Context,
|
|
216
|
+
query_value: Option<PrefersReducedMotion>,
|
|
217
|
+
) -> bool {
|
|
218
|
+
let prefers_reduced =
|
|
219
|
+
unsafe { bindings::Gecko_MediaFeatures_PrefersReducedMotion(context.device().document()) };
|
|
220
|
+
let query_value = match query_value {
|
|
221
|
+
Some(v) => v,
|
|
222
|
+
None => return prefers_reduced,
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
match query_value {
|
|
226
|
+
PrefersReducedMotion::NoPreference => !prefers_reduced,
|
|
227
|
+
PrefersReducedMotion::Reduce => prefers_reduced,
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/// https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-transparency
|
|
232
|
+
fn eval_prefers_reduced_transparency(
|
|
233
|
+
context: &Context,
|
|
234
|
+
query_value: Option<PrefersReducedTransparency>,
|
|
235
|
+
) -> bool {
|
|
236
|
+
let prefers_reduced = unsafe {
|
|
237
|
+
bindings::Gecko_MediaFeatures_PrefersReducedTransparency(context.device().document())
|
|
238
|
+
};
|
|
239
|
+
let query_value = match query_value {
|
|
240
|
+
Some(v) => v,
|
|
241
|
+
None => return prefers_reduced,
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
match query_value {
|
|
245
|
+
PrefersReducedTransparency::NoPreference => !prefers_reduced,
|
|
246
|
+
PrefersReducedTransparency::Reduce => prefers_reduced,
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/// Possible values for prefers-contrast media query.
|
|
251
|
+
/// https://drafts.csswg.org/mediaqueries-5/#prefers-contrast
|
|
252
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, ToCss)]
|
|
253
|
+
#[repr(u8)]
|
|
254
|
+
pub enum PrefersContrast {
|
|
255
|
+
/// More contrast is preferred.
|
|
256
|
+
More,
|
|
257
|
+
/// Low contrast is preferred.
|
|
258
|
+
Less,
|
|
259
|
+
/// Custom (not more, not less).
|
|
260
|
+
Custom,
|
|
261
|
+
/// The default value if neither high or low contrast is enabled.
|
|
262
|
+
NoPreference,
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/// https://drafts.csswg.org/mediaqueries-5/#prefers-contrast
|
|
266
|
+
fn eval_prefers_contrast(context: &Context, query_value: Option<PrefersContrast>) -> bool {
|
|
267
|
+
let prefers_contrast =
|
|
268
|
+
unsafe { bindings::Gecko_MediaFeatures_PrefersContrast(context.device().document()) };
|
|
269
|
+
match query_value {
|
|
270
|
+
Some(v) => v == prefers_contrast,
|
|
271
|
+
None => prefers_contrast != PrefersContrast::NoPreference,
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/// https://drafts.csswg.org/mediaqueries-5/#forced-colors
|
|
276
|
+
fn eval_forced_colors(context: &Context, query_value: Option<ForcedColors>) -> bool {
|
|
277
|
+
let forced = context.device().forced_colors();
|
|
278
|
+
match query_value {
|
|
279
|
+
Some(query_value) => query_value == forced,
|
|
280
|
+
None => forced != ForcedColors::None,
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/// Possible values for the inverted-colors media query.
|
|
285
|
+
/// https://drafts.csswg.org/mediaqueries-5/#inverted
|
|
286
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
287
|
+
#[repr(u8)]
|
|
288
|
+
enum InvertedColors {
|
|
289
|
+
/// Colors are displayed normally.
|
|
290
|
+
None,
|
|
291
|
+
/// All pixels within the displayed area have been inverted.
|
|
292
|
+
Inverted,
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/// https://drafts.csswg.org/mediaqueries-5/#inverted
|
|
296
|
+
fn eval_inverted_colors(context: &Context, query_value: Option<InvertedColors>) -> bool {
|
|
297
|
+
let inverted_colors =
|
|
298
|
+
unsafe { bindings::Gecko_MediaFeatures_InvertedColors(context.device().document()) };
|
|
299
|
+
let query_value = match query_value {
|
|
300
|
+
Some(v) => v,
|
|
301
|
+
None => return inverted_colors,
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
match query_value {
|
|
305
|
+
InvertedColors::None => !inverted_colors,
|
|
306
|
+
InvertedColors::Inverted => inverted_colors,
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
311
|
+
#[repr(u8)]
|
|
312
|
+
enum OverflowBlock {
|
|
313
|
+
None,
|
|
314
|
+
Scroll,
|
|
315
|
+
Paged,
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/// https://drafts.csswg.org/mediaqueries-4/#mf-overflow-block
|
|
319
|
+
fn eval_overflow_block(context: &Context, query_value: Option<OverflowBlock>) -> bool {
|
|
320
|
+
// For the time being, assume that printing (including previews)
|
|
321
|
+
// is the only time when we paginate, and we are otherwise always
|
|
322
|
+
// scrolling. This is true at the moment in Firefox, but may need
|
|
323
|
+
// updating in the future (e.g., ebook readers built with Stylo, a
|
|
324
|
+
// billboard mode that doesn't support overflow at all).
|
|
325
|
+
//
|
|
326
|
+
// If this ever changes, don't forget to change eval_overflow_inline too.
|
|
327
|
+
let scrolling = context.device().media_type() != MediaType::print();
|
|
328
|
+
let query_value = match query_value {
|
|
329
|
+
Some(v) => v,
|
|
330
|
+
None => return true,
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
match query_value {
|
|
334
|
+
OverflowBlock::None => false,
|
|
335
|
+
OverflowBlock::Scroll => scrolling,
|
|
336
|
+
OverflowBlock::Paged => !scrolling,
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
341
|
+
#[repr(u8)]
|
|
342
|
+
enum OverflowInline {
|
|
343
|
+
None,
|
|
344
|
+
Scroll,
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/// https://drafts.csswg.org/mediaqueries-4/#mf-overflow-inline
|
|
348
|
+
fn eval_overflow_inline(context: &Context, query_value: Option<OverflowInline>) -> bool {
|
|
349
|
+
// See the note in eval_overflow_block.
|
|
350
|
+
let scrolling = context.device().media_type() != MediaType::print();
|
|
351
|
+
let query_value = match query_value {
|
|
352
|
+
Some(v) => v,
|
|
353
|
+
None => return scrolling,
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
match query_value {
|
|
357
|
+
OverflowInline::None => !scrolling,
|
|
358
|
+
OverflowInline::Scroll => scrolling,
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
363
|
+
#[repr(u8)]
|
|
364
|
+
enum Update {
|
|
365
|
+
None,
|
|
366
|
+
Slow,
|
|
367
|
+
Fast,
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/// https://drafts.csswg.org/mediaqueries-4/#update
|
|
371
|
+
fn eval_update(context: &Context, query_value: Option<Update>) -> bool {
|
|
372
|
+
// This has similar caveats to those described in eval_overflow_block.
|
|
373
|
+
// For now, we report that print (incl. print media simulation,
|
|
374
|
+
// which can in fact update but is limited to the developer tools)
|
|
375
|
+
// is `update: none` and that all other contexts are `update: fast`,
|
|
376
|
+
// which may not be true for future platforms, like e-ink devices.
|
|
377
|
+
let can_update = context.device().media_type() != MediaType::print();
|
|
378
|
+
let query_value = match query_value {
|
|
379
|
+
Some(v) => v,
|
|
380
|
+
None => return can_update,
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
match query_value {
|
|
384
|
+
Update::None => !can_update,
|
|
385
|
+
Update::Slow => false,
|
|
386
|
+
Update::Fast => can_update,
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
fn do_eval_prefers_color_scheme(
|
|
391
|
+
context: &Context,
|
|
392
|
+
use_content: bool,
|
|
393
|
+
query_value: Option<PrefersColorScheme>,
|
|
394
|
+
) -> bool {
|
|
395
|
+
let prefers_color_scheme = unsafe {
|
|
396
|
+
bindings::Gecko_MediaFeatures_PrefersColorScheme(context.device().document(), use_content)
|
|
397
|
+
};
|
|
398
|
+
match query_value {
|
|
399
|
+
Some(v) => prefers_color_scheme == v,
|
|
400
|
+
None => true,
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/// https://drafts.csswg.org/mediaqueries-5/#prefers-color-scheme
|
|
405
|
+
fn eval_prefers_color_scheme(context: &Context, query_value: Option<PrefersColorScheme>) -> bool {
|
|
406
|
+
do_eval_prefers_color_scheme(context, /* use_content = */ false, query_value)
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
fn eval_content_prefers_color_scheme(
|
|
410
|
+
context: &Context,
|
|
411
|
+
query_value: Option<PrefersColorScheme>,
|
|
412
|
+
) -> bool {
|
|
413
|
+
do_eval_prefers_color_scheme(context, /* use_content = */ true, query_value)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/// https://drafts.csswg.org/mediaqueries-5/#dynamic-range
|
|
417
|
+
fn eval_dynamic_range(context: &Context, query_value: Option<DynamicRange>) -> bool {
|
|
418
|
+
let dynamic_range =
|
|
419
|
+
unsafe { bindings::Gecko_MediaFeatures_DynamicRange(context.device().document()) };
|
|
420
|
+
match query_value {
|
|
421
|
+
Some(v) => dynamic_range >= v,
|
|
422
|
+
None => false,
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
/// https://drafts.csswg.org/mediaqueries-5/#video-dynamic-range
|
|
426
|
+
fn eval_video_dynamic_range(context: &Context, query_value: Option<DynamicRange>) -> bool {
|
|
427
|
+
let dynamic_range =
|
|
428
|
+
unsafe { bindings::Gecko_MediaFeatures_VideoDynamicRange(context.device().document()) };
|
|
429
|
+
match query_value {
|
|
430
|
+
Some(v) => dynamic_range >= v,
|
|
431
|
+
None => false,
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
bitflags! {
|
|
436
|
+
/// https://drafts.csswg.org/mediaqueries-4/#mf-interaction
|
|
437
|
+
struct PointerCapabilities: u8 {
|
|
438
|
+
const COARSE = structs::PointerCapabilities_Coarse;
|
|
439
|
+
const FINE = structs::PointerCapabilities_Fine;
|
|
440
|
+
const HOVER = structs::PointerCapabilities_Hover;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
fn primary_pointer_capabilities(context: &Context) -> PointerCapabilities {
|
|
445
|
+
PointerCapabilities::from_bits_truncate(unsafe {
|
|
446
|
+
bindings::Gecko_MediaFeatures_PrimaryPointerCapabilities(context.device().document())
|
|
447
|
+
})
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
fn all_pointer_capabilities(context: &Context) -> PointerCapabilities {
|
|
451
|
+
PointerCapabilities::from_bits_truncate(unsafe {
|
|
452
|
+
bindings::Gecko_MediaFeatures_AllPointerCapabilities(context.device().document())
|
|
453
|
+
})
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
457
|
+
#[repr(u8)]
|
|
458
|
+
enum Pointer {
|
|
459
|
+
None,
|
|
460
|
+
Coarse,
|
|
461
|
+
Fine,
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
fn eval_pointer_capabilities(
|
|
465
|
+
query_value: Option<Pointer>,
|
|
466
|
+
pointer_capabilities: PointerCapabilities,
|
|
467
|
+
) -> bool {
|
|
468
|
+
let query_value = match query_value {
|
|
469
|
+
Some(v) => v,
|
|
470
|
+
None => return !pointer_capabilities.is_empty(),
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
match query_value {
|
|
474
|
+
Pointer::None => pointer_capabilities.is_empty(),
|
|
475
|
+
Pointer::Coarse => pointer_capabilities.intersects(PointerCapabilities::COARSE),
|
|
476
|
+
Pointer::Fine => pointer_capabilities.intersects(PointerCapabilities::FINE),
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/// https://drafts.csswg.org/mediaqueries-4/#pointer
|
|
481
|
+
fn eval_pointer(context: &Context, query_value: Option<Pointer>) -> bool {
|
|
482
|
+
eval_pointer_capabilities(query_value, primary_pointer_capabilities(context))
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/// https://drafts.csswg.org/mediaqueries-4/#descdef-media-any-pointer
|
|
486
|
+
fn eval_any_pointer(context: &Context, query_value: Option<Pointer>) -> bool {
|
|
487
|
+
eval_pointer_capabilities(query_value, all_pointer_capabilities(context))
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
491
|
+
#[repr(u8)]
|
|
492
|
+
enum Hover {
|
|
493
|
+
None,
|
|
494
|
+
Hover,
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
fn eval_hover_capabilities(
|
|
498
|
+
query_value: Option<Hover>,
|
|
499
|
+
pointer_capabilities: PointerCapabilities,
|
|
500
|
+
) -> bool {
|
|
501
|
+
let can_hover = pointer_capabilities.intersects(PointerCapabilities::HOVER);
|
|
502
|
+
let query_value = match query_value {
|
|
503
|
+
Some(v) => v,
|
|
504
|
+
None => return can_hover,
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
match query_value {
|
|
508
|
+
Hover::None => !can_hover,
|
|
509
|
+
Hover::Hover => can_hover,
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/// https://drafts.csswg.org/mediaqueries-4/#hover
|
|
514
|
+
fn eval_hover(context: &Context, query_value: Option<Hover>) -> bool {
|
|
515
|
+
eval_hover_capabilities(query_value, primary_pointer_capabilities(context))
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/// https://drafts.csswg.org/mediaqueries-4/#descdef-media-any-hover
|
|
519
|
+
fn eval_any_hover(context: &Context, query_value: Option<Hover>) -> bool {
|
|
520
|
+
eval_hover_capabilities(query_value, all_pointer_capabilities(context))
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
fn eval_moz_is_glyph(context: &Context) -> bool {
|
|
524
|
+
context.device().document().mIsSVGGlyphsDocument()
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
fn eval_moz_in_android_pip_mode(context: &Context) -> bool {
|
|
528
|
+
unsafe { bindings::Gecko_MediaFeatures_InAndroidPipMode(context.device().document()) }
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
fn eval_moz_print_preview(context: &Context) -> bool {
|
|
532
|
+
let is_print_preview = context.device().is_print_preview();
|
|
533
|
+
if is_print_preview {
|
|
534
|
+
debug_assert_eq!(context.device().media_type(), MediaType::print());
|
|
535
|
+
}
|
|
536
|
+
is_print_preview
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
fn eval_moz_is_resource_document(context: &Context) -> bool {
|
|
540
|
+
unsafe { bindings::Gecko_MediaFeatures_IsResourceDocument(context.device().document()) }
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/// Allows front-end CSS to discern platform via media queries.
|
|
544
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
|
545
|
+
#[repr(u8)]
|
|
546
|
+
pub enum Platform {
|
|
547
|
+
/// Matches any Android version.
|
|
548
|
+
Android,
|
|
549
|
+
/// For our purposes here, "linux" is just "gtk" (so unix-but-not-mac).
|
|
550
|
+
/// There's no need for our front-end code to differentiate between those
|
|
551
|
+
/// platforms and they already use the "linux" string elsewhere (e.g.,
|
|
552
|
+
/// toolkit/themes/linux).
|
|
553
|
+
Linux,
|
|
554
|
+
/// Matches any iOS version.
|
|
555
|
+
Ios,
|
|
556
|
+
/// Matches any macOS version.
|
|
557
|
+
Macos,
|
|
558
|
+
/// Matches any Windows version.
|
|
559
|
+
Windows,
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
fn eval_moz_platform(_: &Context, query_value: Option<Platform>) -> bool {
|
|
563
|
+
let query_value = match query_value {
|
|
564
|
+
Some(v) => v,
|
|
565
|
+
None => return false,
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
unsafe { bindings::Gecko_MediaFeatures_MatchesPlatform(query_value) }
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/// Allows front-end CSS to discern gtk theme via media queries.
|
|
572
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, ToCss)]
|
|
573
|
+
#[repr(u8)]
|
|
574
|
+
pub enum GtkThemeFamily {
|
|
575
|
+
/// Unknown theme family.
|
|
576
|
+
Unknown = 0,
|
|
577
|
+
/// Adwaita, the default GTK theme.
|
|
578
|
+
Adwaita,
|
|
579
|
+
/// Breeze, the default KDE theme.
|
|
580
|
+
Breeze,
|
|
581
|
+
/// Yaru, the default Ubuntu theme.
|
|
582
|
+
Yaru,
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
fn eval_gtk_theme_family(_: &Context, query_value: Option<GtkThemeFamily>) -> bool {
|
|
586
|
+
let family = unsafe { bindings::Gecko_MediaFeatures_GtkThemeFamily() };
|
|
587
|
+
match query_value {
|
|
588
|
+
Some(v) => v == family,
|
|
589
|
+
None => family != GtkThemeFamily::Unknown,
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/// Values for the scripting media feature.
|
|
594
|
+
/// https://drafts.csswg.org/mediaqueries-5/#scripting
|
|
595
|
+
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, ToCss)]
|
|
596
|
+
#[repr(u8)]
|
|
597
|
+
pub enum Scripting {
|
|
598
|
+
/// Scripting is not supported or not enabled
|
|
599
|
+
None,
|
|
600
|
+
/// Scripting is supported and enabled, but only for initial page load
|
|
601
|
+
/// We will never match this value as it is intended for non-browser user agents,
|
|
602
|
+
/// but it is part of the spec so we should still parse it.
|
|
603
|
+
/// See: https://github.com/w3c/csswg-drafts/issues/8621
|
|
604
|
+
InitialOnly,
|
|
605
|
+
/// Scripting is supported and enabled
|
|
606
|
+
Enabled,
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/// https://drafts.csswg.org/mediaqueries-5/#scripting
|
|
610
|
+
fn eval_scripting(context: &Context, query_value: Option<Scripting>) -> bool {
|
|
611
|
+
let scripting = unsafe { bindings::Gecko_MediaFeatures_Scripting(context.device().document()) };
|
|
612
|
+
match query_value {
|
|
613
|
+
Some(v) => v == scripting,
|
|
614
|
+
None => scripting != Scripting::None,
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
fn eval_moz_overlay_scrollbars(context: &Context) -> bool {
|
|
619
|
+
unsafe { bindings::Gecko_MediaFeatures_UseOverlayScrollbars(context.device().document()) }
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
fn eval_moz_mac_rtl(context: &Context) -> bool {
|
|
623
|
+
unsafe { bindings::Gecko_MediaFeatures_MacRTL(context.device().document()) }
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
fn eval_moz_native_theme(context: &Context) -> bool {
|
|
627
|
+
if context.device().document().mForceNonNativeTheme() {
|
|
628
|
+
return false;
|
|
629
|
+
}
|
|
630
|
+
crate::pref!("browser.theme.native-theme")
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
fn get_lnf_int(int_id: i32) -> i32 {
|
|
634
|
+
unsafe { bindings::Gecko_GetLookAndFeelInt(int_id) }
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
fn get_lnf_int_as_bool(int_id: i32) -> bool {
|
|
638
|
+
get_lnf_int(int_id) != 0
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
macro_rules! lnf_int_feature {
|
|
642
|
+
($feature_name:expr, $int_id:ident, $get_value:ident) => {{
|
|
643
|
+
fn __eval(_: &Context) -> bool {
|
|
644
|
+
$get_value(bindings::LookAndFeel_IntID::$int_id as i32)
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
feature!(
|
|
648
|
+
$feature_name,
|
|
649
|
+
AllowsRanges::No,
|
|
650
|
+
Evaluator::BoolInteger(__eval),
|
|
651
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
652
|
+
)
|
|
653
|
+
}};
|
|
654
|
+
($feature_name:expr, $int_id:ident) => {{
|
|
655
|
+
lnf_int_feature!($feature_name, $int_id, get_lnf_int_as_bool)
|
|
656
|
+
}};
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/// Adding new media features requires (1) adding the new feature to this
|
|
660
|
+
/// array, with appropriate entries (and potentially any new code needed
|
|
661
|
+
/// to support new types in these entries and (2) ensuring that either
|
|
662
|
+
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
|
|
663
|
+
/// would be returned by the evaluator function could change.
|
|
664
|
+
pub static MEDIA_FEATURES: [QueryFeatureDescription; 60] = [
|
|
665
|
+
feature!(
|
|
666
|
+
atom!("width"),
|
|
667
|
+
AllowsRanges::Yes,
|
|
668
|
+
Evaluator::Length(eval_width),
|
|
669
|
+
FeatureFlags::VIEWPORT_DEPENDENT,
|
|
670
|
+
),
|
|
671
|
+
feature!(
|
|
672
|
+
atom!("height"),
|
|
673
|
+
AllowsRanges::Yes,
|
|
674
|
+
Evaluator::Length(eval_height),
|
|
675
|
+
FeatureFlags::VIEWPORT_DEPENDENT,
|
|
676
|
+
),
|
|
677
|
+
feature!(
|
|
678
|
+
atom!("aspect-ratio"),
|
|
679
|
+
AllowsRanges::Yes,
|
|
680
|
+
Evaluator::NumberRatio(eval_aspect_ratio),
|
|
681
|
+
FeatureFlags::VIEWPORT_DEPENDENT,
|
|
682
|
+
),
|
|
683
|
+
feature!(
|
|
684
|
+
atom!("orientation"),
|
|
685
|
+
AllowsRanges::No,
|
|
686
|
+
keyword_evaluator!(eval_orientation, Orientation),
|
|
687
|
+
FeatureFlags::VIEWPORT_DEPENDENT,
|
|
688
|
+
),
|
|
689
|
+
feature!(
|
|
690
|
+
atom!("device-width"),
|
|
691
|
+
AllowsRanges::Yes,
|
|
692
|
+
Evaluator::Length(eval_device_width),
|
|
693
|
+
FeatureFlags::empty(),
|
|
694
|
+
),
|
|
695
|
+
feature!(
|
|
696
|
+
atom!("device-height"),
|
|
697
|
+
AllowsRanges::Yes,
|
|
698
|
+
Evaluator::Length(eval_device_height),
|
|
699
|
+
FeatureFlags::empty(),
|
|
700
|
+
),
|
|
701
|
+
feature!(
|
|
702
|
+
atom!("device-aspect-ratio"),
|
|
703
|
+
AllowsRanges::Yes,
|
|
704
|
+
Evaluator::NumberRatio(eval_device_aspect_ratio),
|
|
705
|
+
FeatureFlags::empty(),
|
|
706
|
+
),
|
|
707
|
+
feature!(
|
|
708
|
+
atom!("-moz-device-orientation"),
|
|
709
|
+
AllowsRanges::No,
|
|
710
|
+
keyword_evaluator!(eval_device_orientation, Orientation),
|
|
711
|
+
FeatureFlags::empty(),
|
|
712
|
+
),
|
|
713
|
+
// Webkit extensions that we support for de-facto web compatibility.
|
|
714
|
+
// -webkit-{min|max}-device-pixel-ratio (controlled with its own pref):
|
|
715
|
+
feature!(
|
|
716
|
+
atom!("device-pixel-ratio"),
|
|
717
|
+
AllowsRanges::Yes,
|
|
718
|
+
Evaluator::Float(eval_device_pixel_ratio),
|
|
719
|
+
FeatureFlags::WEBKIT_PREFIX,
|
|
720
|
+
),
|
|
721
|
+
// -webkit-transform-3d.
|
|
722
|
+
feature!(
|
|
723
|
+
atom!("transform-3d"),
|
|
724
|
+
AllowsRanges::No,
|
|
725
|
+
Evaluator::BoolInteger(eval_transform_3d),
|
|
726
|
+
FeatureFlags::WEBKIT_PREFIX,
|
|
727
|
+
),
|
|
728
|
+
feature!(
|
|
729
|
+
atom!("-moz-device-pixel-ratio"),
|
|
730
|
+
AllowsRanges::Yes,
|
|
731
|
+
Evaluator::Float(eval_device_pixel_ratio),
|
|
732
|
+
FeatureFlags::empty(),
|
|
733
|
+
),
|
|
734
|
+
feature!(
|
|
735
|
+
atom!("resolution"),
|
|
736
|
+
AllowsRanges::Yes,
|
|
737
|
+
Evaluator::Resolution(eval_resolution),
|
|
738
|
+
FeatureFlags::empty(),
|
|
739
|
+
),
|
|
740
|
+
feature!(
|
|
741
|
+
atom!("display-mode"),
|
|
742
|
+
AllowsRanges::No,
|
|
743
|
+
keyword_evaluator!(eval_display_mode, DisplayMode),
|
|
744
|
+
FeatureFlags::empty(),
|
|
745
|
+
),
|
|
746
|
+
feature!(
|
|
747
|
+
atom!("grid"),
|
|
748
|
+
AllowsRanges::No,
|
|
749
|
+
Evaluator::BoolInteger(eval_grid),
|
|
750
|
+
FeatureFlags::empty(),
|
|
751
|
+
),
|
|
752
|
+
feature!(
|
|
753
|
+
atom!("scan"),
|
|
754
|
+
AllowsRanges::No,
|
|
755
|
+
keyword_evaluator!(eval_scan, Scan),
|
|
756
|
+
FeatureFlags::empty(),
|
|
757
|
+
),
|
|
758
|
+
feature!(
|
|
759
|
+
atom!("color"),
|
|
760
|
+
AllowsRanges::Yes,
|
|
761
|
+
Evaluator::Integer(eval_color),
|
|
762
|
+
FeatureFlags::empty(),
|
|
763
|
+
),
|
|
764
|
+
feature!(
|
|
765
|
+
atom!("color-index"),
|
|
766
|
+
AllowsRanges::Yes,
|
|
767
|
+
Evaluator::Integer(eval_color_index),
|
|
768
|
+
FeatureFlags::empty(),
|
|
769
|
+
),
|
|
770
|
+
feature!(
|
|
771
|
+
atom!("monochrome"),
|
|
772
|
+
AllowsRanges::Yes,
|
|
773
|
+
Evaluator::Integer(eval_monochrome),
|
|
774
|
+
FeatureFlags::empty(),
|
|
775
|
+
),
|
|
776
|
+
feature!(
|
|
777
|
+
atom!("color-gamut"),
|
|
778
|
+
AllowsRanges::No,
|
|
779
|
+
keyword_evaluator!(eval_color_gamut, ColorGamut),
|
|
780
|
+
FeatureFlags::empty(),
|
|
781
|
+
),
|
|
782
|
+
feature!(
|
|
783
|
+
atom!("prefers-reduced-motion"),
|
|
784
|
+
AllowsRanges::No,
|
|
785
|
+
keyword_evaluator!(eval_prefers_reduced_motion, PrefersReducedMotion),
|
|
786
|
+
FeatureFlags::empty(),
|
|
787
|
+
),
|
|
788
|
+
feature!(
|
|
789
|
+
atom!("prefers-reduced-transparency"),
|
|
790
|
+
AllowsRanges::No,
|
|
791
|
+
keyword_evaluator!(
|
|
792
|
+
eval_prefers_reduced_transparency,
|
|
793
|
+
PrefersReducedTransparency
|
|
794
|
+
),
|
|
795
|
+
FeatureFlags::empty(),
|
|
796
|
+
),
|
|
797
|
+
feature!(
|
|
798
|
+
atom!("prefers-contrast"),
|
|
799
|
+
AllowsRanges::No,
|
|
800
|
+
keyword_evaluator!(eval_prefers_contrast, PrefersContrast),
|
|
801
|
+
FeatureFlags::empty(),
|
|
802
|
+
),
|
|
803
|
+
feature!(
|
|
804
|
+
atom!("forced-colors"),
|
|
805
|
+
AllowsRanges::No,
|
|
806
|
+
keyword_evaluator!(eval_forced_colors, ForcedColors),
|
|
807
|
+
FeatureFlags::empty(),
|
|
808
|
+
),
|
|
809
|
+
feature!(
|
|
810
|
+
atom!("inverted-colors"),
|
|
811
|
+
AllowsRanges::No,
|
|
812
|
+
keyword_evaluator!(eval_inverted_colors, InvertedColors),
|
|
813
|
+
FeatureFlags::empty(),
|
|
814
|
+
),
|
|
815
|
+
feature!(
|
|
816
|
+
atom!("overflow-block"),
|
|
817
|
+
AllowsRanges::No,
|
|
818
|
+
keyword_evaluator!(eval_overflow_block, OverflowBlock),
|
|
819
|
+
FeatureFlags::empty(),
|
|
820
|
+
),
|
|
821
|
+
feature!(
|
|
822
|
+
atom!("overflow-inline"),
|
|
823
|
+
AllowsRanges::No,
|
|
824
|
+
keyword_evaluator!(eval_overflow_inline, OverflowInline),
|
|
825
|
+
FeatureFlags::empty(),
|
|
826
|
+
),
|
|
827
|
+
feature!(
|
|
828
|
+
atom!("update"),
|
|
829
|
+
AllowsRanges::No,
|
|
830
|
+
keyword_evaluator!(eval_update, Update),
|
|
831
|
+
FeatureFlags::empty(),
|
|
832
|
+
),
|
|
833
|
+
feature!(
|
|
834
|
+
atom!("prefers-color-scheme"),
|
|
835
|
+
AllowsRanges::No,
|
|
836
|
+
keyword_evaluator!(eval_prefers_color_scheme, PrefersColorScheme),
|
|
837
|
+
FeatureFlags::empty(),
|
|
838
|
+
),
|
|
839
|
+
feature!(
|
|
840
|
+
atom!("dynamic-range"),
|
|
841
|
+
AllowsRanges::No,
|
|
842
|
+
keyword_evaluator!(eval_dynamic_range, DynamicRange),
|
|
843
|
+
FeatureFlags::empty(),
|
|
844
|
+
),
|
|
845
|
+
feature!(
|
|
846
|
+
atom!("video-dynamic-range"),
|
|
847
|
+
AllowsRanges::No,
|
|
848
|
+
keyword_evaluator!(eval_video_dynamic_range, DynamicRange),
|
|
849
|
+
FeatureFlags::empty(),
|
|
850
|
+
),
|
|
851
|
+
feature!(
|
|
852
|
+
atom!("scripting"),
|
|
853
|
+
AllowsRanges::No,
|
|
854
|
+
keyword_evaluator!(eval_scripting, Scripting),
|
|
855
|
+
FeatureFlags::empty(),
|
|
856
|
+
),
|
|
857
|
+
// Evaluates to the preferred color scheme for content. Only useful in
|
|
858
|
+
// chrome context, where the chrome color-scheme and the content
|
|
859
|
+
// color-scheme might differ.
|
|
860
|
+
feature!(
|
|
861
|
+
atom!("-moz-content-prefers-color-scheme"),
|
|
862
|
+
AllowsRanges::No,
|
|
863
|
+
keyword_evaluator!(eval_content_prefers_color_scheme, PrefersColorScheme),
|
|
864
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
865
|
+
),
|
|
866
|
+
feature!(
|
|
867
|
+
atom!("pointer"),
|
|
868
|
+
AllowsRanges::No,
|
|
869
|
+
keyword_evaluator!(eval_pointer, Pointer),
|
|
870
|
+
FeatureFlags::empty(),
|
|
871
|
+
),
|
|
872
|
+
feature!(
|
|
873
|
+
atom!("any-pointer"),
|
|
874
|
+
AllowsRanges::No,
|
|
875
|
+
keyword_evaluator!(eval_any_pointer, Pointer),
|
|
876
|
+
FeatureFlags::empty(),
|
|
877
|
+
),
|
|
878
|
+
feature!(
|
|
879
|
+
atom!("hover"),
|
|
880
|
+
AllowsRanges::No,
|
|
881
|
+
keyword_evaluator!(eval_hover, Hover),
|
|
882
|
+
FeatureFlags::empty(),
|
|
883
|
+
),
|
|
884
|
+
feature!(
|
|
885
|
+
atom!("any-hover"),
|
|
886
|
+
AllowsRanges::No,
|
|
887
|
+
keyword_evaluator!(eval_any_hover, Hover),
|
|
888
|
+
FeatureFlags::empty(),
|
|
889
|
+
),
|
|
890
|
+
// Internal -moz-is-glyph media feature: applies only inside SVG glyphs.
|
|
891
|
+
// Internal because it is really only useful in the user agent anyway
|
|
892
|
+
// and therefore not worth standardizing.
|
|
893
|
+
feature!(
|
|
894
|
+
atom!("-moz-is-glyph"),
|
|
895
|
+
AllowsRanges::No,
|
|
896
|
+
Evaluator::BoolInteger(eval_moz_is_glyph),
|
|
897
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
898
|
+
),
|
|
899
|
+
feature!(
|
|
900
|
+
atom!("-moz-in-android-pip-mode"),
|
|
901
|
+
AllowsRanges::No,
|
|
902
|
+
Evaluator::BoolInteger(eval_moz_in_android_pip_mode),
|
|
903
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
904
|
+
),
|
|
905
|
+
feature!(
|
|
906
|
+
atom!("-moz-is-resource-document"),
|
|
907
|
+
AllowsRanges::No,
|
|
908
|
+
Evaluator::BoolInteger(eval_moz_is_resource_document),
|
|
909
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
910
|
+
),
|
|
911
|
+
feature!(
|
|
912
|
+
atom!("-moz-platform"),
|
|
913
|
+
AllowsRanges::No,
|
|
914
|
+
keyword_evaluator!(eval_moz_platform, Platform),
|
|
915
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
916
|
+
),
|
|
917
|
+
feature!(
|
|
918
|
+
atom!("-moz-gtk-theme-family"),
|
|
919
|
+
AllowsRanges::No,
|
|
920
|
+
keyword_evaluator!(eval_gtk_theme_family, GtkThemeFamily),
|
|
921
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
922
|
+
),
|
|
923
|
+
feature!(
|
|
924
|
+
atom!("-moz-print-preview"),
|
|
925
|
+
AllowsRanges::No,
|
|
926
|
+
Evaluator::BoolInteger(eval_moz_print_preview),
|
|
927
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
928
|
+
),
|
|
929
|
+
feature!(
|
|
930
|
+
atom!("-moz-overlay-scrollbars"),
|
|
931
|
+
AllowsRanges::No,
|
|
932
|
+
Evaluator::BoolInteger(eval_moz_overlay_scrollbars),
|
|
933
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
934
|
+
),
|
|
935
|
+
lnf_int_feature!(atom!("-moz-menubar-drag"), MenuBarDrag),
|
|
936
|
+
lnf_int_feature!(atom!("-moz-mac-big-sur-theme"), MacBigSurTheme),
|
|
937
|
+
lnf_int_feature!(atom!("-moz-mac-tahoe-theme"), MacTahoeTheme),
|
|
938
|
+
feature!(
|
|
939
|
+
atom!("-moz-mac-rtl"),
|
|
940
|
+
AllowsRanges::No,
|
|
941
|
+
Evaluator::BoolInteger(eval_moz_mac_rtl),
|
|
942
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
943
|
+
),
|
|
944
|
+
feature!(
|
|
945
|
+
atom!("-moz-native-theme"),
|
|
946
|
+
AllowsRanges::No,
|
|
947
|
+
Evaluator::BoolInteger(eval_moz_native_theme),
|
|
948
|
+
FeatureFlags::CHROME_AND_UA_ONLY,
|
|
949
|
+
),
|
|
950
|
+
lnf_int_feature!(
|
|
951
|
+
atom!("-moz-windows-accent-color-in-titlebar"),
|
|
952
|
+
WindowsAccentColorInTitlebar
|
|
953
|
+
),
|
|
954
|
+
lnf_int_feature!(atom!("-moz-windows-mica"), WindowsMica),
|
|
955
|
+
lnf_int_feature!(atom!("-moz-windows-mica-popups"), WindowsMicaPopups),
|
|
956
|
+
lnf_int_feature!(atom!("-moz-swipe-animation-enabled"), SwipeAnimationEnabled),
|
|
957
|
+
lnf_int_feature!(atom!("-moz-gtk-csd-available"), GTKCSDAvailable),
|
|
958
|
+
lnf_int_feature!(
|
|
959
|
+
atom!("-moz-gtk-csd-transparency-available"),
|
|
960
|
+
GTKCSDTransparencyAvailable
|
|
961
|
+
),
|
|
962
|
+
lnf_int_feature!(atom!("-moz-gtk-csd-minimize-button"), GTKCSDMinimizeButton),
|
|
963
|
+
lnf_int_feature!(atom!("-moz-gtk-csd-maximize-button"), GTKCSDMaximizeButton),
|
|
964
|
+
lnf_int_feature!(atom!("-moz-gtk-csd-close-button"), GTKCSDCloseButton),
|
|
965
|
+
lnf_int_feature!(
|
|
966
|
+
atom!("-moz-gtk-csd-reversed-placement"),
|
|
967
|
+
GTKCSDReversedPlacement
|
|
968
|
+
),
|
|
969
|
+
lnf_int_feature!(atom!("-moz-system-dark-theme"), SystemUsesDarkTheme),
|
|
970
|
+
lnf_int_feature!(atom!("-moz-panel-animations"), PanelAnimations),
|
|
971
|
+
];
|