blitz-pdf 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +391 -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,113 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
4
|
+
|
|
5
|
+
# This file contains the list of anonymous boxes and some flags, much like
|
|
6
|
+
# longhands.toml and pseudo_elements.toml.
|
|
7
|
+
#
|
|
8
|
+
# Each anon box has its own section, with the following keys:
|
|
9
|
+
# inherits - whether the anon box inherits from its parent or not. Defaults to true.
|
|
10
|
+
# wrapper - whether the anon box is a wrapper around other frames during
|
|
11
|
+
# frame tree fix-up (e.g. table anonymous boxes, ruby anonymous boxes, anonymous
|
|
12
|
+
# flex item blocks, etc). Defaults to false.
|
|
13
|
+
#
|
|
14
|
+
# When adding an anon box, you also need to add the relevant atom to
|
|
15
|
+
# StaticAtoms.py, with the camel-case name of the anon box, in the same order as
|
|
16
|
+
# this file.
|
|
17
|
+
|
|
18
|
+
[-moz-oof-placeholder]
|
|
19
|
+
inherits = false
|
|
20
|
+
# Framesets
|
|
21
|
+
[-moz-hframeset-border]
|
|
22
|
+
inherits = false
|
|
23
|
+
[-moz-vframeset-border]
|
|
24
|
+
inherits = false
|
|
25
|
+
[-moz-frameset-blank]
|
|
26
|
+
inherits = false
|
|
27
|
+
|
|
28
|
+
# Table
|
|
29
|
+
[-moz-table-column-group]
|
|
30
|
+
inherits = false
|
|
31
|
+
[-moz-table-column]
|
|
32
|
+
inherits = false
|
|
33
|
+
|
|
34
|
+
[-moz-page]
|
|
35
|
+
inherits = false
|
|
36
|
+
[-moz-page-break]
|
|
37
|
+
inherits = false
|
|
38
|
+
[-moz-page-content]
|
|
39
|
+
inherits = false
|
|
40
|
+
[-moz-printed-sheet]
|
|
41
|
+
inherits = false
|
|
42
|
+
|
|
43
|
+
# Applies to blocks that wrap contiguous runs of "column-span: all" elements in
|
|
44
|
+
# multi-column subtrees, or the wrappers themselves, all the way up to the
|
|
45
|
+
# column set wrappers.
|
|
46
|
+
[-moz-column-span-wrapper]
|
|
47
|
+
inherits = false
|
|
48
|
+
|
|
49
|
+
# ::-moz-text, ::-moz-oof-placeholder, and ::-moz-first-letter-continuation are
|
|
50
|
+
# non-elements which no rule will match.
|
|
51
|
+
[-moz-text]
|
|
52
|
+
# nsFirstLetterFrames for content outside the ::first-letter.
|
|
53
|
+
[-moz-first-letter-continuation]
|
|
54
|
+
|
|
55
|
+
[-moz-block-inside-inline-wrapper]
|
|
56
|
+
[-moz-mathml-anonymous-block]
|
|
57
|
+
wrapper = true
|
|
58
|
+
[-moz-line-frame]
|
|
59
|
+
|
|
60
|
+
[-moz-cell-content]
|
|
61
|
+
[-moz-fieldset-content]
|
|
62
|
+
[-moz-html-canvas-content]
|
|
63
|
+
|
|
64
|
+
[-moz-inline-table]
|
|
65
|
+
wrapper = true
|
|
66
|
+
[-moz-table]
|
|
67
|
+
wrapper = true
|
|
68
|
+
[-moz-table-cell]
|
|
69
|
+
wrapper = true
|
|
70
|
+
[-moz-table-wrapper]
|
|
71
|
+
[-moz-table-row-group]
|
|
72
|
+
wrapper = true
|
|
73
|
+
[-moz-table-row]
|
|
74
|
+
wrapper = true
|
|
75
|
+
|
|
76
|
+
[-moz-canvas]
|
|
77
|
+
inherits = false
|
|
78
|
+
[-moz-page-sequence]
|
|
79
|
+
[-moz-scrolled-content]
|
|
80
|
+
|
|
81
|
+
# A column set is a set of columns inside of ColumnSetWrapperFrame, which
|
|
82
|
+
# applies to nsColumnSetFrame. It doesn't contain any column-span elements.
|
|
83
|
+
[-moz-column-set]
|
|
84
|
+
[-moz-column-content]
|
|
85
|
+
|
|
86
|
+
# The root (viewport) frame
|
|
87
|
+
[-moz-viewport]
|
|
88
|
+
inherits = false
|
|
89
|
+
# The root scrollframe.
|
|
90
|
+
[-moz-viewport-scroll]
|
|
91
|
+
inherits = false
|
|
92
|
+
|
|
93
|
+
# Inside a flex/grid/-moz-box container, a contiguous run of text gets wrapped
|
|
94
|
+
# in an anonymous block, which is then treated as a flex item.
|
|
95
|
+
[-moz-anonymous-item]
|
|
96
|
+
wrapper = true
|
|
97
|
+
|
|
98
|
+
[-moz-block-ruby-content]
|
|
99
|
+
[-moz-ruby]
|
|
100
|
+
wrapper = true
|
|
101
|
+
[-moz-ruby-base]
|
|
102
|
+
wrapper = true
|
|
103
|
+
[-moz-ruby-base-container]
|
|
104
|
+
wrapper = true
|
|
105
|
+
[-moz-ruby-text]
|
|
106
|
+
wrapper = true
|
|
107
|
+
[-moz-ruby-text-container]
|
|
108
|
+
wrapper = true
|
|
109
|
+
|
|
110
|
+
[-moz-svg-marker-anon-child]
|
|
111
|
+
[-moz-svg-outer-svg-anon-child]
|
|
112
|
+
[-moz-svg-foreign-content]
|
|
113
|
+
[-moz-svg-text]
|
|
@@ -0,0 +1,211 @@
|
|
|
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
|
+
//! This file lists all arc FFI types and defines corresponding addref and release functions. This
|
|
6
|
+
//! list loosely corresponds to ServoLockedArcTypeList.inc file in Gecko.
|
|
7
|
+
|
|
8
|
+
#![allow(non_snake_case, missing_docs)]
|
|
9
|
+
|
|
10
|
+
use crate::media_queries::MediaList;
|
|
11
|
+
use crate::properties::animated_properties::AnimationValue;
|
|
12
|
+
use crate::properties::{ComputedValues, PropertyDeclarationBlock};
|
|
13
|
+
use crate::shared_lock::Locked;
|
|
14
|
+
use crate::stylesheets::keyframes_rule::Keyframe;
|
|
15
|
+
use crate::stylesheets::{
|
|
16
|
+
AppearanceBaseRule, ContainerRule, CssRules, CustomMediaRule, DocumentRule,
|
|
17
|
+
FontFeatureValuesRule, FontPaletteValuesRule, LayerBlockRule, LayerStatementRule, MarginRule,
|
|
18
|
+
MediaRule, NamespaceRule, PropertyRule, ScopeRule, StartingStyleRule, StylesheetContents,
|
|
19
|
+
SupportsRule, ViewTransitionRule,
|
|
20
|
+
};
|
|
21
|
+
pub use crate::stylesheets::{
|
|
22
|
+
LockedCounterStyleRule, LockedFontFaceRule, LockedImportRule, LockedKeyframesRule,
|
|
23
|
+
LockedNestedDeclarationsRule, LockedPageRule, LockedPositionTryRule, LockedStyleRule,
|
|
24
|
+
};
|
|
25
|
+
use crate::url::gecko::CssUrlData;
|
|
26
|
+
use servo_arc::Arc;
|
|
27
|
+
|
|
28
|
+
macro_rules! impl_simple_arc_ffi {
|
|
29
|
+
($ty:ty, $addref:ident, $release:ident) => {
|
|
30
|
+
#[unsafe(no_mangle)]
|
|
31
|
+
pub unsafe extern "C" fn $addref(obj: *const $ty) {
|
|
32
|
+
unsafe {
|
|
33
|
+
std::mem::forget(Arc::from_raw_addrefed(obj));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[unsafe(no_mangle)]
|
|
38
|
+
pub unsafe extern "C" fn $release(obj: *const $ty) {
|
|
39
|
+
unsafe {
|
|
40
|
+
let _ = Arc::from_raw(obj);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
macro_rules! impl_locked_arc_ffi {
|
|
47
|
+
($servo_type:ty, $alias:ident, $addref:ident, $release:ident) => {
|
|
48
|
+
/// A simple alias for a locked type.
|
|
49
|
+
pub type $alias = Locked<$servo_type>;
|
|
50
|
+
impl_simple_arc_ffi!($alias, $addref, $release);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
impl_locked_arc_ffi!(
|
|
55
|
+
CssRules,
|
|
56
|
+
LockedCssRules,
|
|
57
|
+
Servo_CssRules_AddRef,
|
|
58
|
+
Servo_CssRules_Release
|
|
59
|
+
);
|
|
60
|
+
impl_locked_arc_ffi!(
|
|
61
|
+
PropertyDeclarationBlock,
|
|
62
|
+
LockedDeclarationBlock,
|
|
63
|
+
Servo_DeclarationBlock_AddRef,
|
|
64
|
+
Servo_DeclarationBlock_Release
|
|
65
|
+
);
|
|
66
|
+
impl_simple_arc_ffi!(
|
|
67
|
+
LockedStyleRule,
|
|
68
|
+
Servo_StyleRule_AddRef,
|
|
69
|
+
Servo_StyleRule_Release
|
|
70
|
+
);
|
|
71
|
+
impl_simple_arc_ffi!(
|
|
72
|
+
LockedImportRule,
|
|
73
|
+
Servo_ImportRule_AddRef,
|
|
74
|
+
Servo_ImportRule_Release
|
|
75
|
+
);
|
|
76
|
+
impl_locked_arc_ffi!(
|
|
77
|
+
Keyframe,
|
|
78
|
+
LockedKeyframe,
|
|
79
|
+
Servo_Keyframe_AddRef,
|
|
80
|
+
Servo_Keyframe_Release
|
|
81
|
+
);
|
|
82
|
+
impl_simple_arc_ffi!(
|
|
83
|
+
LockedKeyframesRule,
|
|
84
|
+
Servo_KeyframesRule_AddRef,
|
|
85
|
+
Servo_KeyframesRule_Release
|
|
86
|
+
);
|
|
87
|
+
impl_simple_arc_ffi!(
|
|
88
|
+
LayerBlockRule,
|
|
89
|
+
Servo_LayerBlockRule_AddRef,
|
|
90
|
+
Servo_LayerBlockRule_Release
|
|
91
|
+
);
|
|
92
|
+
impl_simple_arc_ffi!(
|
|
93
|
+
LayerStatementRule,
|
|
94
|
+
Servo_LayerStatementRule_AddRef,
|
|
95
|
+
Servo_LayerStatementRule_Release
|
|
96
|
+
);
|
|
97
|
+
impl_locked_arc_ffi!(
|
|
98
|
+
MediaList,
|
|
99
|
+
LockedMediaList,
|
|
100
|
+
Servo_MediaList_AddRef,
|
|
101
|
+
Servo_MediaList_Release
|
|
102
|
+
);
|
|
103
|
+
impl_simple_arc_ffi!(MediaRule, Servo_MediaRule_AddRef, Servo_MediaRule_Release);
|
|
104
|
+
impl_simple_arc_ffi!(
|
|
105
|
+
CustomMediaRule,
|
|
106
|
+
Servo_CustomMediaRule_AddRef,
|
|
107
|
+
Servo_CustomMediaRule_Release
|
|
108
|
+
);
|
|
109
|
+
impl_simple_arc_ffi!(
|
|
110
|
+
NamespaceRule,
|
|
111
|
+
Servo_NamespaceRule_AddRef,
|
|
112
|
+
Servo_NamespaceRule_Release
|
|
113
|
+
);
|
|
114
|
+
impl_simple_arc_ffi!(
|
|
115
|
+
MarginRule,
|
|
116
|
+
Servo_MarginRule_AddRef,
|
|
117
|
+
Servo_MarginRule_Release
|
|
118
|
+
);
|
|
119
|
+
impl_simple_arc_ffi!(
|
|
120
|
+
LockedPageRule,
|
|
121
|
+
Servo_PageRule_AddRef,
|
|
122
|
+
Servo_PageRule_Release
|
|
123
|
+
);
|
|
124
|
+
impl_simple_arc_ffi!(
|
|
125
|
+
PropertyRule,
|
|
126
|
+
Servo_PropertyRule_AddRef,
|
|
127
|
+
Servo_PropertyRule_Release
|
|
128
|
+
);
|
|
129
|
+
impl_simple_arc_ffi!(
|
|
130
|
+
SupportsRule,
|
|
131
|
+
Servo_SupportsRule_AddRef,
|
|
132
|
+
Servo_SupportsRule_Release
|
|
133
|
+
);
|
|
134
|
+
impl_simple_arc_ffi!(
|
|
135
|
+
ContainerRule,
|
|
136
|
+
Servo_ContainerRule_AddRef,
|
|
137
|
+
Servo_ContainerRule_Release
|
|
138
|
+
);
|
|
139
|
+
impl_simple_arc_ffi!(
|
|
140
|
+
DocumentRule,
|
|
141
|
+
Servo_DocumentRule_AddRef,
|
|
142
|
+
Servo_DocumentRule_Release
|
|
143
|
+
);
|
|
144
|
+
impl_simple_arc_ffi!(
|
|
145
|
+
FontFeatureValuesRule,
|
|
146
|
+
Servo_FontFeatureValuesRule_AddRef,
|
|
147
|
+
Servo_FontFeatureValuesRule_Release
|
|
148
|
+
);
|
|
149
|
+
impl_simple_arc_ffi!(
|
|
150
|
+
FontPaletteValuesRule,
|
|
151
|
+
Servo_FontPaletteValuesRule_AddRef,
|
|
152
|
+
Servo_FontPaletteValuesRule_Release
|
|
153
|
+
);
|
|
154
|
+
impl_simple_arc_ffi!(
|
|
155
|
+
LockedFontFaceRule,
|
|
156
|
+
Servo_FontFaceRule_AddRef,
|
|
157
|
+
Servo_FontFaceRule_Release
|
|
158
|
+
);
|
|
159
|
+
impl_simple_arc_ffi!(
|
|
160
|
+
LockedCounterStyleRule,
|
|
161
|
+
Servo_CounterStyleRule_AddRef,
|
|
162
|
+
Servo_CounterStyleRule_Release
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
impl_simple_arc_ffi!(
|
|
166
|
+
StylesheetContents,
|
|
167
|
+
Servo_StyleSheetContents_AddRef,
|
|
168
|
+
Servo_StyleSheetContents_Release
|
|
169
|
+
);
|
|
170
|
+
impl_simple_arc_ffi!(
|
|
171
|
+
CssUrlData,
|
|
172
|
+
Servo_CssUrlData_AddRef,
|
|
173
|
+
Servo_CssUrlData_Release
|
|
174
|
+
);
|
|
175
|
+
impl_simple_arc_ffi!(
|
|
176
|
+
ComputedValues,
|
|
177
|
+
Servo_ComputedStyle_AddRef,
|
|
178
|
+
Servo_ComputedStyle_Release
|
|
179
|
+
);
|
|
180
|
+
impl_simple_arc_ffi!(
|
|
181
|
+
AnimationValue,
|
|
182
|
+
Servo_AnimationValue_AddRef,
|
|
183
|
+
Servo_AnimationValue_Release
|
|
184
|
+
);
|
|
185
|
+
impl_simple_arc_ffi!(ScopeRule, Servo_ScopeRule_AddRef, Servo_ScopeRule_Release);
|
|
186
|
+
impl_simple_arc_ffi!(
|
|
187
|
+
StartingStyleRule,
|
|
188
|
+
Servo_StartingStyleRule_AddRef,
|
|
189
|
+
Servo_StartingStyleRule_Release
|
|
190
|
+
);
|
|
191
|
+
impl_simple_arc_ffi!(
|
|
192
|
+
AppearanceBaseRule,
|
|
193
|
+
Servo_AppearanceBaseRule_AddRef,
|
|
194
|
+
Servo_AppearanceBaseRule_Release
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
impl_simple_arc_ffi!(
|
|
198
|
+
LockedPositionTryRule,
|
|
199
|
+
Servo_PositionTryRule_AddRef,
|
|
200
|
+
Servo_PositionTryRule_Release
|
|
201
|
+
);
|
|
202
|
+
impl_simple_arc_ffi!(
|
|
203
|
+
LockedNestedDeclarationsRule,
|
|
204
|
+
Servo_NestedDeclarationsRule_AddRef,
|
|
205
|
+
Servo_NestedDeclarationsRule_Release
|
|
206
|
+
);
|
|
207
|
+
impl_simple_arc_ffi!(
|
|
208
|
+
ViewTransitionRule,
|
|
209
|
+
Servo_ViewTransitionRule_AddRef,
|
|
210
|
+
Servo_ViewTransitionRule_Release
|
|
211
|
+
);
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
//! This module contains conversion helpers between Servo and Gecko types
|
|
6
|
+
//! Ideally, it would be in geckolib itself, but coherence
|
|
7
|
+
//! forces us to keep the traits and implementations here
|
|
8
|
+
//!
|
|
9
|
+
//! FIXME(emilio): This file should generally just die.
|
|
10
|
+
|
|
11
|
+
#![allow(unsafe_code)]
|
|
12
|
+
|
|
13
|
+
use crate::gecko_bindings::structs::{nsresult, Matrix4x4Components};
|
|
14
|
+
use crate::stylesheets::RulesMutateError;
|
|
15
|
+
use crate::values::computed::transform::Matrix3D;
|
|
16
|
+
|
|
17
|
+
impl From<RulesMutateError> for nsresult {
|
|
18
|
+
fn from(other: RulesMutateError) -> Self {
|
|
19
|
+
match other {
|
|
20
|
+
RulesMutateError::Syntax => nsresult::NS_ERROR_DOM_SYNTAX_ERR,
|
|
21
|
+
RulesMutateError::IndexSize => nsresult::NS_ERROR_DOM_INDEX_SIZE_ERR,
|
|
22
|
+
RulesMutateError::HierarchyRequest => nsresult::NS_ERROR_DOM_HIERARCHY_REQUEST_ERR,
|
|
23
|
+
RulesMutateError::InvalidState => nsresult::NS_ERROR_DOM_INVALID_STATE_ERR,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
impl<'a> From<&'a Matrix4x4Components> for Matrix3D {
|
|
29
|
+
fn from(m: &'a Matrix4x4Components) -> Matrix3D {
|
|
30
|
+
Matrix3D {
|
|
31
|
+
m11: m[0],
|
|
32
|
+
m12: m[1],
|
|
33
|
+
m13: m[2],
|
|
34
|
+
m14: m[3],
|
|
35
|
+
m21: m[4],
|
|
36
|
+
m22: m[5],
|
|
37
|
+
m23: m[6],
|
|
38
|
+
m24: m[7],
|
|
39
|
+
m31: m[8],
|
|
40
|
+
m32: m[9],
|
|
41
|
+
m33: m[10],
|
|
42
|
+
m34: m[11],
|
|
43
|
+
m41: m[12],
|
|
44
|
+
m42: m[13],
|
|
45
|
+
m43: m[14],
|
|
46
|
+
m44: m[15],
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
impl From<Matrix3D> for Matrix4x4Components {
|
|
52
|
+
fn from(matrix: Matrix3D) -> Self {
|
|
53
|
+
[
|
|
54
|
+
matrix.m11, matrix.m12, matrix.m13, matrix.m14, matrix.m21, matrix.m22, matrix.m23,
|
|
55
|
+
matrix.m24, matrix.m31, matrix.m32, matrix.m33, matrix.m34, matrix.m41, matrix.m42,
|
|
56
|
+
matrix.m43, matrix.m44,
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
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
|
+
//! Data needed to style a Gecko document.
|
|
6
|
+
|
|
7
|
+
use crate::derives::*;
|
|
8
|
+
use crate::device::Device;
|
|
9
|
+
use crate::gecko_bindings::bindings;
|
|
10
|
+
use crate::gecko_bindings::structs::{
|
|
11
|
+
self, ServoStyleSetSizes, StyleSheet as DomStyleSheet, StyleSheetInfo,
|
|
12
|
+
};
|
|
13
|
+
use crate::invalidation::stylesheets::StylesheetInvalidationSet;
|
|
14
|
+
use crate::media_queries::MediaList;
|
|
15
|
+
use crate::properties::ComputedValues;
|
|
16
|
+
use crate::shared_lock::{SharedRwLockReadGuard, StylesheetGuards};
|
|
17
|
+
use crate::stylesheets::scope_rule::ImplicitScopeRoot;
|
|
18
|
+
use crate::stylesheets::{StylesheetContents, StylesheetInDocument};
|
|
19
|
+
use crate::stylist::Stylist;
|
|
20
|
+
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
|
21
|
+
use malloc_size_of::MallocSizeOfOps;
|
|
22
|
+
use selectors::Element;
|
|
23
|
+
use servo_arc::Arc;
|
|
24
|
+
use std::fmt;
|
|
25
|
+
|
|
26
|
+
use super::wrapper::GeckoElement;
|
|
27
|
+
|
|
28
|
+
/// Little wrapper to a Gecko style sheet.
|
|
29
|
+
#[derive(Eq, PartialEq)]
|
|
30
|
+
pub struct GeckoStyleSheet(*const DomStyleSheet);
|
|
31
|
+
|
|
32
|
+
// NOTE(emilio): These are kind of a lie. We allow to make these Send + Sync so that other data
|
|
33
|
+
// structures can also be Send and Sync, but Gecko's stylesheets are main-thread-reference-counted.
|
|
34
|
+
//
|
|
35
|
+
// We assert that we reference-count in the right thread (in the Addref/Release implementations).
|
|
36
|
+
// Sending these to a different thread can't really happen (it could theoretically really happen if
|
|
37
|
+
// we allowed @import rules inside a nested style rule, but that can't happen per spec and would be
|
|
38
|
+
// a parser bug, caught by the asserts).
|
|
39
|
+
unsafe impl Send for GeckoStyleSheet {}
|
|
40
|
+
unsafe impl Sync for GeckoStyleSheet {}
|
|
41
|
+
|
|
42
|
+
impl fmt::Debug for GeckoStyleSheet {
|
|
43
|
+
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
|
44
|
+
let contents = self.raw_contents();
|
|
45
|
+
formatter
|
|
46
|
+
.debug_struct("GeckoStyleSheet")
|
|
47
|
+
.field("origin", &contents.origin)
|
|
48
|
+
.field("url_data", &contents.url_data)
|
|
49
|
+
.finish()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
impl GeckoStyleSheet {
|
|
54
|
+
/// Create a `GeckoStyleSheet` from a raw `DomStyleSheet` pointer.
|
|
55
|
+
#[inline]
|
|
56
|
+
pub unsafe fn new(s: *const DomStyleSheet) -> Self {
|
|
57
|
+
unsafe {
|
|
58
|
+
debug_assert!(!s.is_null());
|
|
59
|
+
bindings::Gecko_StyleSheet_AddRef(s);
|
|
60
|
+
Self::from_addrefed(s)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/// Create a `GeckoStyleSheet` from a raw `DomStyleSheet` pointer that
|
|
65
|
+
/// already holds a strong reference.
|
|
66
|
+
#[inline]
|
|
67
|
+
pub unsafe fn from_addrefed(s: *const DomStyleSheet) -> Self {
|
|
68
|
+
assert!(!s.is_null());
|
|
69
|
+
GeckoStyleSheet(s)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// HACK(emilio): This is so that we can avoid crashing release due to
|
|
73
|
+
/// bug 1719963 and can hopefully get a useful report from fuzzers.
|
|
74
|
+
#[inline]
|
|
75
|
+
pub fn hack_is_null(&self) -> bool {
|
|
76
|
+
self.0.is_null()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/// Get the raw `StyleSheet` that we're wrapping.
|
|
80
|
+
pub fn raw(&self) -> &DomStyleSheet {
|
|
81
|
+
unsafe { &*self.0 }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
fn inner(&self) -> &StyleSheetInfo {
|
|
85
|
+
unsafe { &*(self.raw().mInner as *const StyleSheetInfo) }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
fn raw_contents(&self) -> &StylesheetContents {
|
|
89
|
+
debug_assert!(!self.inner().mContents.mRawPtr.is_null());
|
|
90
|
+
unsafe { &*self.inner().mContents.mRawPtr }
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
impl Drop for GeckoStyleSheet {
|
|
95
|
+
fn drop(&mut self) {
|
|
96
|
+
unsafe { bindings::Gecko_StyleSheet_Release(self.0) };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
impl Clone for GeckoStyleSheet {
|
|
101
|
+
fn clone(&self) -> Self {
|
|
102
|
+
unsafe { bindings::Gecko_StyleSheet_AddRef(self.0) };
|
|
103
|
+
GeckoStyleSheet(self.0)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
impl StylesheetInDocument for GeckoStyleSheet {
|
|
108
|
+
fn media<'a>(&'a self, guard: &'a SharedRwLockReadGuard) -> Option<&'a MediaList> {
|
|
109
|
+
use crate::gecko_bindings::structs::mozilla::dom::MediaList as DomMediaList;
|
|
110
|
+
unsafe {
|
|
111
|
+
let dom_media_list = self.raw().mMedia.mRawPtr as *const DomMediaList;
|
|
112
|
+
if dom_media_list.is_null() {
|
|
113
|
+
return None;
|
|
114
|
+
}
|
|
115
|
+
let list = &*(*dom_media_list).mRawList.mRawPtr;
|
|
116
|
+
Some(list.read_with(guard))
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// All the stylesheets Servo knows about are enabled, because that state is
|
|
121
|
+
// handled externally by Gecko.
|
|
122
|
+
#[inline]
|
|
123
|
+
fn enabled(&self) -> bool {
|
|
124
|
+
true
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
#[inline]
|
|
128
|
+
fn contents<'a>(&'a self, _: &'a SharedRwLockReadGuard) -> &'a StylesheetContents {
|
|
129
|
+
self.raw_contents()
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
fn implicit_scope_root(&self) -> Option<ImplicitScopeRoot> {
|
|
133
|
+
unsafe {
|
|
134
|
+
let result = bindings::Gecko_StyleSheet_ImplicitScopeRoot(self.0);
|
|
135
|
+
if result.mRoot.is_null() {
|
|
136
|
+
return if result.mConstructed {
|
|
137
|
+
Some(ImplicitScopeRoot::Constructed)
|
|
138
|
+
} else {
|
|
139
|
+
// Could be genuinely not attached, like user stylesheet.
|
|
140
|
+
None
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
let root = GeckoElement(result.mRoot.as_ref().unwrap()).opaque();
|
|
145
|
+
Some(if !result.mHost.is_null() {
|
|
146
|
+
let host = GeckoElement(result.mHost.as_ref().unwrap()).opaque();
|
|
147
|
+
if host == root {
|
|
148
|
+
ImplicitScopeRoot::ShadowHost(root)
|
|
149
|
+
} else {
|
|
150
|
+
ImplicitScopeRoot::InShadowTree(root)
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
ImplicitScopeRoot::InLightTree(root)
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/// The container for data that a Servo-backed Gecko document needs to style
|
|
160
|
+
/// itself.
|
|
161
|
+
pub struct PerDocumentStyleDataImpl {
|
|
162
|
+
/// Rule processor.
|
|
163
|
+
pub stylist: Stylist,
|
|
164
|
+
|
|
165
|
+
/// A cache from element to resolved style.
|
|
166
|
+
pub undisplayed_style_cache: crate::traversal::UndisplayedStyleCache,
|
|
167
|
+
|
|
168
|
+
/// The generation for which our cache is valid.
|
|
169
|
+
pub undisplayed_style_cache_generation: u64,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/// The data itself is an `AtomicRefCell`, which guarantees the proper semantics
|
|
173
|
+
/// and unexpected races while trying to mutate it.
|
|
174
|
+
#[derive(Deref)]
|
|
175
|
+
pub struct PerDocumentStyleData(AtomicRefCell<PerDocumentStyleDataImpl>);
|
|
176
|
+
|
|
177
|
+
impl PerDocumentStyleData {
|
|
178
|
+
/// Create a `PerDocumentStyleData`.
|
|
179
|
+
pub fn new(document: *const structs::Document) -> Self {
|
|
180
|
+
let device = Device::new(document);
|
|
181
|
+
let quirks_mode = device.document().mCompatMode;
|
|
182
|
+
|
|
183
|
+
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
|
|
184
|
+
stylist: Stylist::new(device, quirks_mode.into()),
|
|
185
|
+
undisplayed_style_cache: Default::default(),
|
|
186
|
+
undisplayed_style_cache_generation: 0,
|
|
187
|
+
}))
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/// Get an immutable reference to this style data.
|
|
191
|
+
pub fn borrow(&self) -> AtomicRef<'_, PerDocumentStyleDataImpl> {
|
|
192
|
+
self.0.borrow()
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/// Get an mutable reference to this style data.
|
|
196
|
+
pub fn borrow_mut(&self) -> AtomicRefMut<'_, PerDocumentStyleDataImpl> {
|
|
197
|
+
self.0.borrow_mut()
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
impl PerDocumentStyleDataImpl {
|
|
202
|
+
/// Recreate the style data if the stylesheets have changed.
|
|
203
|
+
pub fn flush_stylesheets(
|
|
204
|
+
&mut self,
|
|
205
|
+
guard: &SharedRwLockReadGuard,
|
|
206
|
+
) -> StylesheetInvalidationSet {
|
|
207
|
+
self.stylist.flush(&StylesheetGuards::same(guard))
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/// Get the default computed values for this document.
|
|
211
|
+
pub fn default_computed_values(&self) -> &Arc<ComputedValues> {
|
|
212
|
+
self.stylist.device().default_computed_values_arc()
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/// Measure heap usage.
|
|
216
|
+
pub fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) {
|
|
217
|
+
self.stylist.add_size_of(ops, sizes);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/// The gecko-specific AuthorStyles instantiation.
|
|
222
|
+
pub type AuthorStyles = crate::author_styles::AuthorStyles<GeckoStyleSheet>;
|