yass-css 0.2.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +11 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Cargo.lock +1447 -0
- data/Cargo.toml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +139 -0
- data/Rakefile +130 -0
- data/codegen/ruby_module_tree.rb +178 -0
- data/codegen/rust_file_set.rb +84 -0
- data/codegen/utils.rb +27 -0
- data/dockerfiles/windows.dockerfile +3 -0
- data/examples/basic_example.rb +32 -0
- data/examples/font_example.rb +19 -0
- data/examples/media_example.rb +31 -0
- data/examples/visitor_example.rb +41 -0
- data/ext/.DS_Store +0 -0
- data/ext/yass/Cargo.toml +24 -0
- data/ext/yass/extconf.rb +6 -0
- data/ext/yass/src/.DS_Store +0 -0
- data/ext/yass/src/cached_value.rs +48 -0
- data/ext/yass/src/cached_value_list.rs +63 -0
- data/ext/yass/src/declarations/.DS_Store +0 -0
- data/ext/yass/src/declarations/align_content.rs +19 -0
- data/ext/yass/src/declarations/align_flags.rs +26 -0
- data/ext/yass/src/declarations/align_items.rs +37 -0
- data/ext/yass/src/declarations/align_self.rs +19 -0
- data/ext/yass/src/declarations/alignment_baseline.rs +27 -0
- data/ext/yass/src/declarations/angle.rs +25 -0
- data/ext/yass/src/declarations/animation/auto.rs +8 -0
- data/ext/yass/src/declarations/animation/init.rs +40 -0
- data/ext/yass/src/declarations/animation/inset.rs +50 -0
- data/ext/yass/src/declarations/animation/length_auto.rs +8 -0
- data/ext/yass/src/declarations/animation/mod.rs +11 -0
- data/ext/yass/src/declarations/animation/range_value.rs +47 -0
- data/ext/yass/src/declarations/animation/scroll_axis.rs +22 -0
- data/ext/yass/src/declarations/animation/scroll_function.rs +40 -0
- data/ext/yass/src/declarations/animation/scroller.rs +21 -0
- data/ext/yass/src/declarations/animation/timeline_name.rs +16 -0
- data/ext/yass/src/declarations/animation/timing_function/cubic_bezier.rs +60 -0
- data/ext/yass/src/declarations/animation/timing_function/init.rs +29 -0
- data/ext/yass/src/declarations/animation/timing_function/keyword.rs +23 -0
- data/ext/yass/src/declarations/animation/timing_function/mod.rs +5 -0
- data/ext/yass/src/declarations/animation/timing_function/piecewise_linear_function.rs +49 -0
- data/ext/yass/src/declarations/animation/timing_function/steps.rs +30 -0
- data/ext/yass/src/declarations/animation/view_function.rs +40 -0
- data/ext/yass/src/declarations/animation_composition.rs +29 -0
- data/ext/yass/src/declarations/animation_delay.rs +30 -0
- data/ext/yass/src/declarations/animation_direction.rs +30 -0
- data/ext/yass/src/declarations/animation_duration.rs +67 -0
- data/ext/yass/src/declarations/animation_fill_mode.rs +30 -0
- data/ext/yass/src/declarations/animation_iteration_count.rs +33 -0
- data/ext/yass/src/declarations/animation_name.rs +23 -0
- data/ext/yass/src/declarations/animation_play_state.rs +28 -0
- data/ext/yass/src/declarations/animation_range_end.rs +30 -0
- data/ext/yass/src/declarations/animation_range_start.rs +30 -0
- data/ext/yass/src/declarations/animation_timeline.rs +42 -0
- data/ext/yass/src/declarations/animation_timing_function.rs +46 -0
- data/ext/yass/src/declarations/aspect_ratio.rs +43 -0
- data/ext/yass/src/declarations/backdrop_filter.rs +30 -0
- data/ext/yass/src/declarations/backface_visibility.rs +20 -0
- data/ext/yass/src/declarations/background_attachment.rs +25 -0
- data/ext/yass/src/declarations/background_blend_mode.rs +42 -0
- data/ext/yass/src/declarations/background_clip.rs +25 -0
- data/ext/yass/src/declarations/background_color.rs +30 -0
- data/ext/yass/src/declarations/background_image.rs +30 -0
- data/ext/yass/src/declarations/background_origin.rs +29 -0
- data/ext/yass/src/declarations/background_position_x.rs +30 -0
- data/ext/yass/src/declarations/background_position_y.rs +30 -0
- data/ext/yass/src/declarations/background_repeat.rs +58 -0
- data/ext/yass/src/declarations/background_size.rs +120 -0
- data/ext/yass/src/declarations/baseline_shift.rs +63 -0
- data/ext/yass/src/declarations/baseline_source.rs +21 -0
- data/ext/yass/src/declarations/block_size.rs +30 -0
- data/ext/yass/src/declarations/border_block_end_color.rs +30 -0
- data/ext/yass/src/declarations/border_block_end_style.rs +19 -0
- data/ext/yass/src/declarations/border_block_end_width.rs +24 -0
- data/ext/yass/src/declarations/border_block_start_color.rs +30 -0
- data/ext/yass/src/declarations/border_block_start_style.rs +19 -0
- data/ext/yass/src/declarations/border_block_start_width.rs +24 -0
- data/ext/yass/src/declarations/border_bottom_color.rs +30 -0
- data/ext/yass/src/declarations/border_bottom_left_radius.rs +40 -0
- data/ext/yass/src/declarations/border_bottom_right_radius.rs +40 -0
- data/ext/yass/src/declarations/border_bottom_style.rs +19 -0
- data/ext/yass/src/declarations/border_bottom_width.rs +24 -0
- data/ext/yass/src/declarations/border_collapse.rs +20 -0
- data/ext/yass/src/declarations/border_end_end_radius.rs +40 -0
- data/ext/yass/src/declarations/border_end_start_radius.rs +40 -0
- data/ext/yass/src/declarations/border_image_outset.rs +73 -0
- data/ext/yass/src/declarations/border_image_repeat.rs +30 -0
- data/ext/yass/src/declarations/border_image_slice.rs +78 -0
- data/ext/yass/src/declarations/border_image_source.rs +28 -0
- data/ext/yass/src/declarations/border_image_width.rs +85 -0
- data/ext/yass/src/declarations/border_inline_end_color.rs +30 -0
- data/ext/yass/src/declarations/border_inline_end_style.rs +19 -0
- data/ext/yass/src/declarations/border_inline_end_width.rs +24 -0
- data/ext/yass/src/declarations/border_inline_start_color.rs +30 -0
- data/ext/yass/src/declarations/border_inline_start_style.rs +19 -0
- data/ext/yass/src/declarations/border_inline_start_width.rs +24 -0
- data/ext/yass/src/declarations/border_left_color.rs +30 -0
- data/ext/yass/src/declarations/border_left_style.rs +19 -0
- data/ext/yass/src/declarations/border_left_width.rs +24 -0
- data/ext/yass/src/declarations/border_right_color.rs +30 -0
- data/ext/yass/src/declarations/border_right_style.rs +19 -0
- data/ext/yass/src/declarations/border_right_width.rs +24 -0
- data/ext/yass/src/declarations/border_spacing.rs +51 -0
- data/ext/yass/src/declarations/border_start_end_radius.rs +40 -0
- data/ext/yass/src/declarations/border_start_start_radius.rs +40 -0
- data/ext/yass/src/declarations/border_style.rs +17 -0
- data/ext/yass/src/declarations/border_top_color.rs +30 -0
- data/ext/yass/src/declarations/border_top_left_radius.rs +40 -0
- data/ext/yass/src/declarations/border_top_right_radius.rs +40 -0
- data/ext/yass/src/declarations/border_top_style.rs +19 -0
- data/ext/yass/src/declarations/border_top_width.rs +24 -0
- data/ext/yass/src/declarations/bottom.rs +28 -0
- data/ext/yass/src/declarations/box_shadow.rs +113 -0
- data/ext/yass/src/declarations/box_sizing.rs +20 -0
- data/ext/yass/src/declarations/calc/abs.rs +32 -0
- data/ext/yass/src/declarations/calc/anchor_function.rs +96 -0
- data/ext/yass/src/declarations/calc/anchor_size_function.rs +84 -0
- data/ext/yass/src/declarations/calc/clamp.rs +58 -0
- data/ext/yass/src/declarations/calc/hypot.rs +30 -0
- data/ext/yass/src/declarations/calc/init.rs +72 -0
- data/ext/yass/src/declarations/calc/invert.rs +32 -0
- data/ext/yass/src/declarations/calc/leaf.rs +36 -0
- data/ext/yass/src/declarations/calc/min_max.rs +40 -0
- data/ext/yass/src/declarations/calc/mod.rs +118 -0
- data/ext/yass/src/declarations/calc/mod_rem.rs +57 -0
- data/ext/yass/src/declarations/calc/negate.rs +32 -0
- data/ext/yass/src/declarations/calc/product.rs +30 -0
- data/ext/yass/src/declarations/calc/round.rs +59 -0
- data/ext/yass/src/declarations/calc/sign.rs +32 -0
- data/ext/yass/src/declarations/calc/sum.rs +30 -0
- data/ext/yass/src/declarations/caption_side.rs +20 -0
- data/ext/yass/src/declarations/caret_color.rs +32 -0
- data/ext/yass/src/declarations/channel_keyword.rs +31 -0
- data/ext/yass/src/declarations/clear.rs +24 -0
- data/ext/yass/src/declarations/clip.rs +135 -0
- data/ext/yass/src/declarations/clip_path/circle_ellipse.rs +168 -0
- data/ext/yass/src/declarations/clip_path/init.rs +267 -0
- data/ext/yass/src/declarations/clip_path/mod.rs +419 -0
- data/ext/yass/src/declarations/clip_path/path.rs +734 -0
- data/ext/yass/src/declarations/clip_path/rect.rs +288 -0
- data/ext/yass/src/declarations/clip_path/shape.rs +672 -0
- data/ext/yass/src/declarations/clip_path/shape_box.rs +71 -0
- data/ext/yass/src/declarations/color/absolute.rs +46 -0
- data/ext/yass/src/declarations/color/absolute_color.rs +53 -0
- data/ext/yass/src/declarations/color/auto.rs +8 -0
- data/ext/yass/src/declarations/color/color.rs +38 -0
- data/ext/yass/src/declarations/color/color_components.rs +25 -0
- data/ext/yass/src/declarations/color/color_function.rs +151 -0
- data/ext/yass/src/declarations/color/color_function_component.rs +61 -0
- data/ext/yass/src/declarations/color/color_interpolation_method.rs +29 -0
- data/ext/yass/src/declarations/color/color_mix.rs +60 -0
- data/ext/yass/src/declarations/color/color_mix_item.rs +43 -0
- data/ext/yass/src/declarations/color/current_color.rs +8 -0
- data/ext/yass/src/declarations/color/init.rs +60 -0
- data/ext/yass/src/declarations/color/light_dark.rs +43 -0
- data/ext/yass/src/declarations/color/mod.rs +69 -0
- data/ext/yass/src/declarations/color/stored_color_function_component.rs +70 -0
- data/ext/yass/src/declarations/color/system_color.rs +60 -0
- data/ext/yass/src/declarations/color_scheme.rs +26 -0
- data/ext/yass/src/declarations/column_count.rs +37 -0
- data/ext/yass/src/declarations/column_gap.rs +74 -0
- data/ext/yass/src/declarations/column_span.rs +20 -0
- data/ext/yass/src/declarations/column_width.rs +70 -0
- data/ext/yass/src/declarations/contain.rs +106 -0
- data/ext/yass/src/declarations/container_name.rs +32 -0
- data/ext/yass/src/declarations/container_type.rs +52 -0
- data/ext/yass/src/declarations/content.rs +309 -0
- data/ext/yass/src/declarations/counter_increment.rs +60 -0
- data/ext/yass/src/declarations/counter_reset.rs +60 -0
- data/ext/yass/src/declarations/csswide_keyword.rs +28 -0
- data/ext/yass/src/declarations/cursor.rs +125 -0
- data/ext/yass/src/declarations/custom.rs +108 -0
- data/ext/yass/src/declarations/declaration.rs +716 -0
- data/ext/yass/src/declarations/direction.rs +20 -0
- data/ext/yass/src/declarations/display.rs +74 -0
- data/ext/yass/src/declarations/empty_cells.rs +20 -0
- data/ext/yass/src/declarations/filter/blur.rs +28 -0
- data/ext/yass/src/declarations/filter/brightness.rs +30 -0
- data/ext/yass/src/declarations/filter/contrast.rs +30 -0
- data/ext/yass/src/declarations/filter/drop_shadow.rs +68 -0
- data/ext/yass/src/declarations/filter/grayscale.rs +30 -0
- data/ext/yass/src/declarations/filter/hue_rotate.rs +28 -0
- data/ext/yass/src/declarations/filter/init.rs +43 -0
- data/ext/yass/src/declarations/filter/invert.rs +30 -0
- data/ext/yass/src/declarations/filter/mod.rs +80 -0
- data/ext/yass/src/declarations/filter/opacity.rs +30 -0
- data/ext/yass/src/declarations/filter/saturate.rs +30 -0
- data/ext/yass/src/declarations/filter/sepia.rs +30 -0
- data/ext/yass/src/declarations/flex_basis.rs +71 -0
- data/ext/yass/src/declarations/flex_direction.rs +22 -0
- data/ext/yass/src/declarations/flex_grow.rs +30 -0
- data/ext/yass/src/declarations/flex_shrink.rs +30 -0
- data/ext/yass/src/declarations/flex_wrap.rs +21 -0
- data/ext/yass/src/declarations/float.rs +23 -0
- data/ext/yass/src/declarations/font_family.rs +28 -0
- data/ext/yass/src/declarations/font_language_override.rs +30 -0
- data/ext/yass/src/declarations/font_optical_sizing.rs +20 -0
- data/ext/yass/src/declarations/font_size.rs +126 -0
- data/ext/yass/src/declarations/font_stretch.rs +102 -0
- data/ext/yass/src/declarations/font_style.rs +101 -0
- data/ext/yass/src/declarations/font_synthesis_weight.rs +20 -0
- data/ext/yass/src/declarations/font_variant_caps.rs +20 -0
- data/ext/yass/src/declarations/font_variation_settings.rs +54 -0
- data/ext/yass/src/declarations/font_weight.rs +85 -0
- data/ext/yass/src/declarations/grid_auto_columns.rs +32 -0
- data/ext/yass/src/declarations/grid_auto_flow.rs +35 -0
- data/ext/yass/src/declarations/grid_auto_rows.rs +33 -0
- data/ext/yass/src/declarations/grid_column_end.rs +39 -0
- data/ext/yass/src/declarations/grid_column_start.rs +39 -0
- data/ext/yass/src/declarations/grid_row_end.rs +39 -0
- data/ext/yass/src/declarations/grid_row_start.rs +39 -0
- data/ext/yass/src/declarations/grid_template.rs +355 -0
- data/ext/yass/src/declarations/grid_template_areas.rs +131 -0
- data/ext/yass/src/declarations/grid_template_columns.rs +31 -0
- data/ext/yass/src/declarations/grid_template_rows.rs +31 -0
- data/ext/yass/src/declarations/height.rs +30 -0
- data/ext/yass/src/declarations/horizontal_position_component.rs +93 -0
- data/ext/yass/src/declarations/image_rendering.rs +21 -0
- data/ext/yass/src/declarations/images/angle_or_percentage.rs +35 -0
- data/ext/yass/src/declarations/images/circle.rs +72 -0
- data/ext/yass/src/declarations/images/conic_gradient.rs +80 -0
- data/ext/yass/src/declarations/images/cross_fade.rs +33 -0
- data/ext/yass/src/declarations/images/cross_fade_element.rs +44 -0
- data/ext/yass/src/declarations/images/cross_fade_image.rs +68 -0
- data/ext/yass/src/declarations/images/ellipse.rs +67 -0
- data/ext/yass/src/declarations/images/ending_shape.rs +38 -0
- data/ext/yass/src/declarations/images/gradient_angle_or_percentage_item.rs +103 -0
- data/ext/yass/src/declarations/images/gradient_length_percentage_item.rs +106 -0
- data/ext/yass/src/declarations/images/image_set.rs +30 -0
- data/ext/yass/src/declarations/images/image_set_item.rs +53 -0
- data/ext/yass/src/declarations/images/init.rs +145 -0
- data/ext/yass/src/declarations/images/light_dark.rs +40 -0
- data/ext/yass/src/declarations/images/line_direction.rs +100 -0
- data/ext/yass/src/declarations/images/linear_gradient.rs +75 -0
- data/ext/yass/src/declarations/images/mod.rs +93 -0
- data/ext/yass/src/declarations/images/none.rs +8 -0
- data/ext/yass/src/declarations/images/position.rs +40 -0
- data/ext/yass/src/declarations/images/radial_gradient.rs +86 -0
- data/ext/yass/src/declarations/images/url.rs +28 -0
- data/ext/yass/src/declarations/init.rs +1620 -0
- data/ext/yass/src/declarations/inline_size.rs +30 -0
- data/ext/yass/src/declarations/inset.rs +114 -0
- data/ext/yass/src/declarations/inset_block_end.rs +28 -0
- data/ext/yass/src/declarations/inset_block_start.rs +28 -0
- data/ext/yass/src/declarations/inset_inline_end.rs +28 -0
- data/ext/yass/src/declarations/inset_inline_start.rs +28 -0
- data/ext/yass/src/declarations/isolation.rs +20 -0
- data/ext/yass/src/declarations/justify_content.rs +19 -0
- data/ext/yass/src/declarations/justify_items.rs +37 -0
- data/ext/yass/src/declarations/justify_self.rs +19 -0
- data/ext/yass/src/declarations/left.rs +28 -0
- data/ext/yass/src/declarations/length.rs +230 -0
- data/ext/yass/src/declarations/letter_spacing.rs +47 -0
- data/ext/yass/src/declarations/line_break.rs +23 -0
- data/ext/yass/src/declarations/line_height.rs +51 -0
- data/ext/yass/src/declarations/list_style_image.rs +28 -0
- data/ext/yass/src/declarations/list_style_position.rs +20 -0
- data/ext/yass/src/declarations/list_style_type.rs +132 -0
- data/ext/yass/src/declarations/margin.rs +103 -0
- data/ext/yass/src/declarations/margin_block_end.rs +28 -0
- data/ext/yass/src/declarations/margin_block_start.rs +28 -0
- data/ext/yass/src/declarations/margin_bottom.rs +28 -0
- data/ext/yass/src/declarations/margin_inline_end.rs +28 -0
- data/ext/yass/src/declarations/margin_inline_start.rs +28 -0
- data/ext/yass/src/declarations/margin_left.rs +28 -0
- data/ext/yass/src/declarations/margin_right.rs +28 -0
- data/ext/yass/src/declarations/margin_top.rs +28 -0
- data/ext/yass/src/declarations/mask_image.rs +30 -0
- data/ext/yass/src/declarations/max_block_size.rs +30 -0
- data/ext/yass/src/declarations/max_height.rs +30 -0
- data/ext/yass/src/declarations/max_inline_size.rs +30 -0
- data/ext/yass/src/declarations/max_width.rs +30 -0
- data/ext/yass/src/declarations/min_block_size.rs +30 -0
- data/ext/yass/src/declarations/min_height.rs +30 -0
- data/ext/yass/src/declarations/min_inline_size.rs +30 -0
- data/ext/yass/src/declarations/min_width.rs +30 -0
- data/ext/yass/src/declarations/mix_blend_mode.rs +35 -0
- data/ext/yass/src/declarations/mod.rs +257 -0
- data/ext/yass/src/declarations/number.rs +16 -0
- data/ext/yass/src/declarations/object_fit.rs +23 -0
- data/ext/yass/src/declarations/object_position.rs +40 -0
- data/ext/yass/src/declarations/offset_path.rs +275 -0
- data/ext/yass/src/declarations/opacity.rs +39 -0
- data/ext/yass/src/declarations/order.rs +17 -0
- data/ext/yass/src/declarations/outline_color.rs +30 -0
- data/ext/yass/src/declarations/outline_offset.rs +22 -0
- data/ext/yass/src/declarations/outline_style.rs +22 -0
- data/ext/yass/src/declarations/outline_width.rs +24 -0
- data/ext/yass/src/declarations/overflow.rs +12 -0
- data/ext/yass/src/declarations/overflow_block.rs +19 -0
- data/ext/yass/src/declarations/overflow_clip_margin.rs +40 -0
- data/ext/yass/src/declarations/overflow_inline.rs +19 -0
- data/ext/yass/src/declarations/overflow_wrap.rs +21 -0
- data/ext/yass/src/declarations/overflow_x.rs +19 -0
- data/ext/yass/src/declarations/overflow_y.rs +19 -0
- data/ext/yass/src/declarations/padding_block_end.rs +30 -0
- data/ext/yass/src/declarations/padding_block_start.rs +30 -0
- data/ext/yass/src/declarations/padding_bottom.rs +30 -0
- data/ext/yass/src/declarations/padding_inline_end.rs +30 -0
- data/ext/yass/src/declarations/padding_inline_start.rs +30 -0
- data/ext/yass/src/declarations/padding_left.rs +30 -0
- data/ext/yass/src/declarations/padding_right.rs +30 -0
- data/ext/yass/src/declarations/padding_top.rs +30 -0
- data/ext/yass/src/declarations/percentage.rs +16 -0
- data/ext/yass/src/declarations/perspective.rs +72 -0
- data/ext/yass/src/declarations/perspective_origin.rs +41 -0
- data/ext/yass/src/declarations/pointer_events.rs +20 -0
- data/ext/yass/src/declarations/position.rs +23 -0
- data/ext/yass/src/declarations/position_area.rs +82 -0
- data/ext/yass/src/declarations/position_try_fallbacks.rs +175 -0
- data/ext/yass/src/declarations/quotes.rs +107 -0
- data/ext/yass/src/declarations/resolution.rs +17 -0
- data/ext/yass/src/declarations/right.rs +28 -0
- data/ext/yass/src/declarations/rotate.rs +103 -0
- data/ext/yass/src/declarations/row_gap.rs +74 -0
- data/ext/yass/src/declarations/scale.rs +90 -0
- data/ext/yass/src/declarations/servo_overflow_clip_box.rs +20 -0
- data/ext/yass/src/declarations/servo_top_layer.rs +20 -0
- data/ext/yass/src/declarations/size/anchor_max_size_function.rs +53 -0
- data/ext/yass/src/declarations/size/anchor_size_function.rs +56 -0
- data/ext/yass/src/declarations/size/anchor_size_keyword.rs +25 -0
- data/ext/yass/src/declarations/size/init.rs +45 -0
- data/ext/yass/src/declarations/size/mod.rs +227 -0
- data/ext/yass/src/declarations/table_layout.rs +20 -0
- data/ext/yass/src/declarations/text_align.rs +31 -0
- data/ext/yass/src/declarations/text_align_last.rs +25 -0
- data/ext/yass/src/declarations/text_decoration_color.rs +30 -0
- data/ext/yass/src/declarations/text_decoration_line.rs +77 -0
- data/ext/yass/src/declarations/text_decoration_style.rs +24 -0
- data/ext/yass/src/declarations/text_indent.rs +40 -0
- data/ext/yass/src/declarations/text_justify.rs +22 -0
- data/ext/yass/src/declarations/text_overflow.rs +86 -0
- data/ext/yass/src/declarations/text_rendering.rs +22 -0
- data/ext/yass/src/declarations/text_shadow.rs +98 -0
- data/ext/yass/src/declarations/text_transform.rs +50 -0
- data/ext/yass/src/declarations/text_wrap_mode.rs +20 -0
- data/ext/yass/src/declarations/time.rs +21 -0
- data/ext/yass/src/declarations/top.rs +28 -0
- data/ext/yass/src/declarations/track_breadth.rs +88 -0
- data/ext/yass/src/declarations/track_size.rs +71 -0
- data/ext/yass/src/declarations/transform.rs +844 -0
- data/ext/yass/src/declarations/transform_origin.rs +99 -0
- data/ext/yass/src/declarations/transform_style.rs +20 -0
- data/ext/yass/src/declarations/transition_behavior.rs +28 -0
- data/ext/yass/src/declarations/transition_delay.rs +30 -0
- data/ext/yass/src/declarations/transition_duration.rs +30 -0
- data/ext/yass/src/declarations/transition_property.rs +122 -0
- data/ext/yass/src/declarations/transition_timing_function.rs +46 -0
- data/ext/yass/src/declarations/translate.rs +84 -0
- data/ext/yass/src/declarations/unicode_bidi.rs +24 -0
- data/ext/yass/src/declarations/vertical_position_component.rs +93 -0
- data/ext/yass/src/declarations/view_transition_class.rs +31 -0
- data/ext/yass/src/declarations/view_transition_name.rs +18 -0
- data/ext/yass/src/declarations/visibility.rs +21 -0
- data/ext/yass/src/declarations/webkit_text_security.rs +22 -0
- data/ext/yass/src/declarations/white_space_collapse.rs +22 -0
- data/ext/yass/src/declarations/width.rs +30 -0
- data/ext/yass/src/declarations/will_change.rs +83 -0
- data/ext/yass/src/declarations/with_variables.rs +35 -0
- data/ext/yass/src/declarations/word_break.rs +21 -0
- data/ext/yass/src/declarations/word_spacing.rs +47 -0
- data/ext/yass/src/declarations/writing_mode.rs +21 -0
- data/ext/yass/src/declarations/xlang.rs +21 -0
- data/ext/yass/src/declarations/zindex.rs +61 -0
- data/ext/yass/src/declarations/zoom.rs +87 -0
- data/ext/yass/src/general/init.rs +15 -0
- data/ext/yass/src/general/mod.rs +43 -0
- data/ext/yass/src/lib.rs +72 -0
- data/ext/yass/src/optional_cached_value.rs +33 -0
- data/ext/yass/src/rules/font_face_rule.rs +206 -0
- data/ext/yass/src/rules/fonts/family.rs +98 -0
- data/ext/yass/src/rules/fonts/init.rs +81 -0
- data/ext/yass/src/rules/fonts/metrics.rs +26 -0
- data/ext/yass/src/rules/fonts/mod.rs +7 -0
- data/ext/yass/src/rules/fonts/source.rs +126 -0
- data/ext/yass/src/rules/fonts/stretch.rs +96 -0
- data/ext/yass/src/rules/fonts/style.rs +59 -0
- data/ext/yass/src/rules/fonts/weight.rs +74 -0
- data/ext/yass/src/rules/init.rs +89 -0
- data/ext/yass/src/rules/media_rule.rs +474 -0
- data/ext/yass/src/rules/mod.rs +6 -0
- data/ext/yass/src/rules/rule.rs +33 -0
- data/ext/yass/src/rules/style_rule.rs +82 -0
- data/ext/yass/src/selectors/an_plus_b.rs +21 -0
- data/ext/yass/src/selectors/attribute_in_no_namespace.rs +34 -0
- data/ext/yass/src/selectors/attribute_in_no_namespace_exists.rs +16 -0
- data/ext/yass/src/selectors/attribute_other.rs +41 -0
- data/ext/yass/src/selectors/class.rs +16 -0
- data/ext/yass/src/selectors/combinator.rs +49 -0
- data/ext/yass/src/selectors/default_namespace.rs +16 -0
- data/ext/yass/src/selectors/has.rs +31 -0
- data/ext/yass/src/selectors/host.rs +35 -0
- data/ext/yass/src/selectors/id.rs +16 -0
- data/ext/yass/src/selectors/init.rs +146 -0
- data/ext/yass/src/selectors/is.rs +27 -0
- data/ext/yass/src/selectors/local_name.rs +18 -0
- data/ext/yass/src/selectors/mod.rs +54 -0
- data/ext/yass/src/selectors/namespace.rs +21 -0
- data/ext/yass/src/selectors/negation.rs +27 -0
- data/ext/yass/src/selectors/non_ts_pseudo_class.rs +63 -0
- data/ext/yass/src/selectors/nth.rs +51 -0
- data/ext/yass/src/selectors/nth_of.rs +43 -0
- data/ext/yass/src/selectors/part.rs +22 -0
- data/ext/yass/src/selectors/relative_selector.rs +40 -0
- data/ext/yass/src/selectors/selector.rs +230 -0
- data/ext/yass/src/selectors/selector_child.rs +460 -0
- data/ext/yass/src/selectors/selector_list.rs +27 -0
- data/ext/yass/src/selectors/slotted.rs +28 -0
- data/ext/yass/src/selectors/specific_namespace_constraint.rs +21 -0
- data/ext/yass/src/selectors/unit_selectors.rs +87 -0
- data/ext/yass/src/selectors/where.rs +27 -0
- data/ext/yass/src/sheet.rs +42 -0
- data/ext/yass/src/utils.rs +9 -0
- data/lib/yass/declarations.rb +7975 -0
- data/lib/yass/general.rb +31 -0
- data/lib/yass/node.rb +9 -0
- data/lib/yass/rules.rb +515 -0
- data/lib/yass/selectors.rb +325 -0
- data/lib/yass/stylesheet.rb +13 -0
- data/lib/yass/version.rb +5 -0
- data/lib/yass/visitor.rb +2463 -0
- data/lib/yass.rb +49 -0
- data/scripts/build_all.sh +44 -0
- data/scripts/detect.rb +39 -0
- data/scripts/wpt.rb +20 -0
- metadata +486 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
use magnus::{Ruby, typed_data, value::Id};
|
|
2
|
+
use style::computed_values::white_space_collapse::T;
|
|
3
|
+
|
|
4
|
+
#[magnus::wrap(class = "Yass::Declarations::WhiteSpaceCollapse")]
|
|
5
|
+
pub struct YWhiteSpaceCollapse {
|
|
6
|
+
specified_value: T
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
impl YWhiteSpaceCollapse {
|
|
10
|
+
pub fn new(specified_value: T) -> Self {
|
|
11
|
+
Self { specified_value }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
15
|
+
match rb_self.specified_value {
|
|
16
|
+
T::Collapse => ruby.intern("collapse"),
|
|
17
|
+
T::Preserve => ruby.intern("preserve"),
|
|
18
|
+
T::PreserveBreaks => ruby.intern("preserve_breaks"),
|
|
19
|
+
T::BreakSpaces => ruby.intern("break_spaces"),
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::specified::Size;
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::size::make_size};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Width", mark)]
|
|
8
|
+
pub struct YWidth {
|
|
9
|
+
size: CachedValue<Size>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl YWidth {
|
|
13
|
+
pub fn new(size: Size) -> Self {
|
|
14
|
+
Self {
|
|
15
|
+
size: CachedValue::new(size, |s, ruby| {
|
|
16
|
+
make_size(s, ruby)
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
pub fn size(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
22
|
+
rb_self.size.get(ruby)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
impl DataTypeFunctions for YWidth {
|
|
27
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
28
|
+
self.size.mark(marker);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
use magnus::{Error, RArray, Ruby, typed_data};
|
|
2
|
+
use style::values::computed::WillChange;
|
|
3
|
+
use style::values::specified::WillChangeBits;
|
|
4
|
+
use style_traits::ToCss;
|
|
5
|
+
|
|
6
|
+
#[magnus::wrap(class = "Yass::Declarations::WillChange")]
|
|
7
|
+
pub struct YWillChange {
|
|
8
|
+
will_change: WillChange,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
impl YWillChange {
|
|
12
|
+
pub fn new(will_change: WillChange) -> Self {
|
|
13
|
+
Self { will_change }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
pub fn is_auto(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
17
|
+
rb_self.will_change.to_css_string() == "auto"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
pub fn values(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
21
|
+
if Self::is_auto(ruby, rb_self) {
|
|
22
|
+
return Ok(ruby.ary_new());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let css = rb_self.will_change.to_css_string();
|
|
26
|
+
let values = css
|
|
27
|
+
.split(',')
|
|
28
|
+
.map(str::trim)
|
|
29
|
+
.filter(|value| !value.is_empty())
|
|
30
|
+
.collect::<Vec<_>>();
|
|
31
|
+
let result = ruby.ary_new_capa(values.len());
|
|
32
|
+
|
|
33
|
+
for value in values {
|
|
34
|
+
result.push(ruby.str_new(value))?;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
Ok(result)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
pub fn is_stacking_context_unconditional(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
41
|
+
rb_self.will_change.bits.contains(WillChangeBits::STACKING_CONTEXT_UNCONDITIONAL)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
pub fn is_transform(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
45
|
+
rb_self.will_change.bits.contains(WillChangeBits::TRANSFORM)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
pub fn is_scroll(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
49
|
+
rb_self.will_change.bits.contains(WillChangeBits::SCROLL)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
pub fn is_contain(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
53
|
+
rb_self.will_change.bits.contains(WillChangeBits::CONTAIN)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
pub fn is_opacity(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
57
|
+
rb_self.will_change.bits.contains(WillChangeBits::OPACITY)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
pub fn is_perspective(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
61
|
+
rb_self.will_change.bits.contains(WillChangeBits::PERSPECTIVE)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
pub fn is_z_index(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
65
|
+
rb_self.will_change.bits.contains(WillChangeBits::Z_INDEX)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pub fn is_fixpos_cb_non_svg(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
69
|
+
rb_self.will_change.bits.contains(WillChangeBits::FIXPOS_CB_NON_SVG)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
pub fn is_position(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
73
|
+
rb_self.will_change.bits.contains(WillChangeBits::POSITION)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
pub fn is_view_transition_name(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
77
|
+
rb_self.will_change.bits.contains(WillChangeBits::VIEW_TRANSITION_NAME)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pub fn is_backdrop_root(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
81
|
+
rb_self.will_change.bits.contains(WillChangeBits::BACKDROP_ROOT)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::properties::VariableDeclaration;
|
|
3
|
+
use style_traits::ToCss;
|
|
4
|
+
|
|
5
|
+
use crate::cached_value::CachedValue;
|
|
6
|
+
|
|
7
|
+
fn variable_declaration_to_value(variable_declaration: &VariableDeclaration, ruby: &Ruby) -> Value {
|
|
8
|
+
ruby
|
|
9
|
+
.str_new(&variable_declaration.to_css_string())
|
|
10
|
+
.into_value_with(ruby)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#[derive(TypedData)]
|
|
14
|
+
#[magnus(class = "Yass::Declarations::WithVariables", mark)]
|
|
15
|
+
pub struct YWithVariables {
|
|
16
|
+
value: CachedValue<VariableDeclaration>,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl YWithVariables {
|
|
20
|
+
pub fn new(variable_declaration: VariableDeclaration) -> Self {
|
|
21
|
+
Self {
|
|
22
|
+
value: CachedValue::new(variable_declaration, variable_declaration_to_value),
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
27
|
+
rb_self.value.get(ruby)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
impl DataTypeFunctions for YWithVariables {
|
|
32
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
33
|
+
self.value.mark(marker);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
use magnus::{Ruby, typed_data, value::Id};
|
|
2
|
+
use style::values::computed::WordBreak;
|
|
3
|
+
|
|
4
|
+
#[magnus::wrap(class = "Yass::Declarations::WordBreak")]
|
|
5
|
+
pub struct YWordBreak {
|
|
6
|
+
word_break: WordBreak
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
impl YWordBreak {
|
|
10
|
+
pub fn new(word_break: WordBreak) -> Self {
|
|
11
|
+
Self { word_break }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
15
|
+
match rb_self.word_break {
|
|
16
|
+
WordBreak::Normal => ruby.intern("normal"),
|
|
17
|
+
WordBreak::BreakAll => ruby.intern("break_all"),
|
|
18
|
+
WordBreak::KeepAll => ruby.intern("keep_all"),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc::Marker, typed_data};
|
|
2
|
+
use style::values::specified::WordSpacing;
|
|
3
|
+
use style::values::specified::text::Spacing;
|
|
4
|
+
|
|
5
|
+
use crate::{cached_value::CachedValue, declarations::size::length_percentage_to_value};
|
|
6
|
+
|
|
7
|
+
fn word_spacing_to_value(word_spacing: &WordSpacing, ruby: &Ruby) -> Value {
|
|
8
|
+
match &word_spacing.0 {
|
|
9
|
+
Spacing::Normal => YWordSpacingNormal::new().into_value_with(ruby),
|
|
10
|
+
Spacing::Value(length_percentage) => {
|
|
11
|
+
length_percentage_to_value(length_percentage, ruby)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#[derive(TypedData)]
|
|
17
|
+
#[magnus(class = "Yass::Declarations::WordSpacing", mark)]
|
|
18
|
+
pub struct YWordSpacing {
|
|
19
|
+
value: CachedValue<WordSpacing>,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
impl YWordSpacing {
|
|
23
|
+
pub fn new(word_spacing: WordSpacing) -> Self {
|
|
24
|
+
Self {
|
|
25
|
+
value: CachedValue::new(word_spacing, word_spacing_to_value),
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
30
|
+
rb_self.value.get(ruby)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
impl DataTypeFunctions for YWordSpacing {
|
|
35
|
+
fn mark(&self, marker: &Marker) {
|
|
36
|
+
self.value.mark(marker);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#[magnus::wrap(class = "Yass::Declarations::WordSpacing::Normal")]
|
|
41
|
+
pub struct YWordSpacingNormal {}
|
|
42
|
+
|
|
43
|
+
impl YWordSpacingNormal {
|
|
44
|
+
pub fn new() -> Self {
|
|
45
|
+
Self {}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
use magnus::{Ruby, typed_data, value::Id};
|
|
2
|
+
use style::values::computed::WritingModeProperty;
|
|
3
|
+
|
|
4
|
+
#[magnus::wrap(class = "Yass::Declarations::WritingMode")]
|
|
5
|
+
pub struct YWritingMode {
|
|
6
|
+
writing_mode_property: WritingModeProperty
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
impl YWritingMode {
|
|
10
|
+
pub fn new(writing_mode_property: WritingModeProperty) -> Self {
|
|
11
|
+
Self { writing_mode_property }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
15
|
+
match rb_self.writing_mode_property {
|
|
16
|
+
WritingModeProperty::HorizontalTb => ruby.intern("horizontal_tb"),
|
|
17
|
+
WritingModeProperty::VerticalRl => ruby.intern("vertical_rl"),
|
|
18
|
+
WritingModeProperty::VerticalLr => ruby.intern("vertical_lr"),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
use magnus::{IntoValue, Ruby, Value, typed_data};
|
|
2
|
+
use style::values::computed::XLang;
|
|
3
|
+
|
|
4
|
+
#[magnus::wrap(class = "Yass::Declarations::XLang")]
|
|
5
|
+
pub struct YXLang {
|
|
6
|
+
xlang: XLang
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
impl YXLang {
|
|
10
|
+
pub fn new(xlang: XLang) -> Self {
|
|
11
|
+
Self { xlang }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
15
|
+
ruby.str_from_slice(rb_self.xlang.0.as_bytes()).into_value_with(ruby)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
pub fn is_empty(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
19
|
+
rb_self.xlang.0.as_bytes().is_empty()
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::specified::{Integer, ZIndex};
|
|
3
|
+
|
|
4
|
+
use crate::cached_value::CachedValue;
|
|
5
|
+
|
|
6
|
+
fn make_zindex_value(zindex: &ZIndex, ruby: &Ruby) -> Value {
|
|
7
|
+
match zindex {
|
|
8
|
+
ZIndex::Integer(integer) => YZIndexInteger::new(integer.clone()).into_value_with(ruby),
|
|
9
|
+
ZIndex::Auto => YZIndexAuto::new().into_value_with(ruby),
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#[derive(TypedData)]
|
|
14
|
+
#[magnus(class = "Yass::Declarations::ZIndex", mark)]
|
|
15
|
+
pub struct YZIndex {
|
|
16
|
+
value: CachedValue<ZIndex>,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl YZIndex {
|
|
20
|
+
pub fn new(zindex: ZIndex) -> Self {
|
|
21
|
+
Self {
|
|
22
|
+
value: CachedValue::new(zindex, make_zindex_value),
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
27
|
+
rb_self.value.get(ruby)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
impl DataTypeFunctions for YZIndex {
|
|
32
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
33
|
+
self.value.mark(marker);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[magnus::wrap(class = "Yass::Declarations::ZIndex::Auto")]
|
|
38
|
+
pub struct YZIndexAuto {}
|
|
39
|
+
|
|
40
|
+
impl YZIndexAuto {
|
|
41
|
+
pub fn new() -> Self {
|
|
42
|
+
Self {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#[magnus::wrap(class = "Yass::Declarations::ZIndex::Integer")]
|
|
47
|
+
pub struct YZIndexInteger {
|
|
48
|
+
value: i32,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
impl YZIndexInteger {
|
|
52
|
+
pub fn new(integer: Integer) -> Self {
|
|
53
|
+
Self {
|
|
54
|
+
value: integer.value(),
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
pub fn value(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> i32 {
|
|
59
|
+
rb_self.value
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::{generics::NonNegative, specified::{NumberOrPercentage, Zoom}};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::{number::YNumber, percentage::YPercentage}};
|
|
5
|
+
|
|
6
|
+
fn make_zoom_value(value: &NonNegative<NumberOrPercentage>, ruby: &Ruby) -> Value {
|
|
7
|
+
match value.0 {
|
|
8
|
+
NumberOrPercentage::Number(number) => YNumber::new(number.get()).into_value_with(ruby),
|
|
9
|
+
NumberOrPercentage::Percentage(percentage) => {
|
|
10
|
+
YPercentage::new(percentage.get()).into_value_with(ruby)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
fn make_zoom(zoom: &Zoom, ruby: &Ruby) -> Value {
|
|
16
|
+
match zoom {
|
|
17
|
+
Zoom::Normal => YZoomNormal::new().into_value_with(ruby),
|
|
18
|
+
Zoom::Document => YZoomDocument::new().into_value_with(ruby),
|
|
19
|
+
Zoom::Value(value) => YZoomValue::new(*value).into_value_with(ruby),
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#[derive(TypedData)]
|
|
24
|
+
#[magnus(class = "Yass::Declarations::Zoom", mark)]
|
|
25
|
+
pub struct YZoom {
|
|
26
|
+
zoom: CachedValue<Zoom>,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
impl YZoom {
|
|
30
|
+
pub fn new(zoom: Zoom) -> Self {
|
|
31
|
+
Self {
|
|
32
|
+
zoom: CachedValue::new(zoom, make_zoom),
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
37
|
+
rb_self.zoom.get(ruby)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
impl DataTypeFunctions for YZoom {
|
|
42
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
43
|
+
self.zoom.mark(marker);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#[magnus::wrap(class = "Yass::Declarations::Zoom::Normal")]
|
|
48
|
+
pub struct YZoomNormal {}
|
|
49
|
+
|
|
50
|
+
impl YZoomNormal {
|
|
51
|
+
pub fn new() -> Self {
|
|
52
|
+
Self {}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#[magnus::wrap(class = "Yass::Declarations::Zoom::Document")]
|
|
57
|
+
pub struct YZoomDocument {}
|
|
58
|
+
|
|
59
|
+
impl YZoomDocument {
|
|
60
|
+
pub fn new() -> Self {
|
|
61
|
+
Self {}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#[derive(TypedData)]
|
|
66
|
+
#[magnus(class = "Yass::Declarations::Zoom::Value", mark)]
|
|
67
|
+
pub struct YZoomValue {
|
|
68
|
+
value: CachedValue<NonNegative<NumberOrPercentage>>,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
impl YZoomValue {
|
|
72
|
+
pub fn new(value: NonNegative<NumberOrPercentage>) -> Self {
|
|
73
|
+
Self {
|
|
74
|
+
value: CachedValue::new(value, make_zoom_value),
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
79
|
+
rb_self.value.get(ruby)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
impl DataTypeFunctions for YZoomValue {
|
|
84
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
85
|
+
self.value.mark(marker);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
use magnus::{Error, Module, RModule, Ruby, method};
|
|
2
|
+
|
|
3
|
+
use crate::general::{YSourceLocation, YUnicodeRange};
|
|
4
|
+
|
|
5
|
+
pub fn init(ruby: &Ruby, yass_module: &RModule) -> Result<(), Error> {
|
|
6
|
+
let unicode_range_class = yass_module.define_class("UnicodeRange", ruby.class_object())?;
|
|
7
|
+
unicode_range_class.define_method("start", method!(YUnicodeRange::start, 0))?;
|
|
8
|
+
unicode_range_class.define_method("end", method!(YUnicodeRange::end, 0))?;
|
|
9
|
+
|
|
10
|
+
let source_location_class = yass_module.define_class("SourceLocation", ruby.class_object())?;
|
|
11
|
+
source_location_class.define_method("line", method!(YSourceLocation::line, 0))?;
|
|
12
|
+
source_location_class.define_method("column", method!(YSourceLocation::column, 0))?;
|
|
13
|
+
|
|
14
|
+
Ok(())
|
|
15
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
use magnus::{Ruby, typed_data};
|
|
2
|
+
|
|
3
|
+
pub mod init;
|
|
4
|
+
|
|
5
|
+
#[magnus::wrap(class = "Yass::UnicodeRange")]
|
|
6
|
+
pub struct YUnicodeRange {
|
|
7
|
+
start: u32,
|
|
8
|
+
end: u32,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
impl YUnicodeRange {
|
|
12
|
+
pub fn new(start: u32, end: u32) -> Self {
|
|
13
|
+
Self { start, end }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
pub fn start(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> u32 {
|
|
17
|
+
rb_self.start
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
pub fn end(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> u32 {
|
|
21
|
+
rb_self.end
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[magnus::wrap(class = "Yass::SourceLocation")]
|
|
26
|
+
pub struct YSourceLocation {
|
|
27
|
+
line: u32,
|
|
28
|
+
column: u32,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
impl YSourceLocation {
|
|
32
|
+
pub fn new(line: u32, column: u32) -> Self {
|
|
33
|
+
Self { line, column }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
pub fn line(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> u32 {
|
|
37
|
+
rb_self.line
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
pub fn column(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> u32 {
|
|
41
|
+
rb_self.column
|
|
42
|
+
}
|
|
43
|
+
}
|
data/ext/yass/src/lib.rs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
mod cached_value;
|
|
2
|
+
mod declarations;
|
|
3
|
+
mod general;
|
|
4
|
+
mod rules;
|
|
5
|
+
mod selectors;
|
|
6
|
+
mod sheet;
|
|
7
|
+
mod utils;
|
|
8
|
+
mod cached_value_list;
|
|
9
|
+
mod optional_cached_value;
|
|
10
|
+
|
|
11
|
+
use magnus::{Error, Ruby, function, method, prelude::*};
|
|
12
|
+
use style::context::QuirksMode;
|
|
13
|
+
use style::media_queries::MediaList;
|
|
14
|
+
use style::shared_lock::SharedRwLock;
|
|
15
|
+
use style::servo_arc::Arc;
|
|
16
|
+
use style::stylesheets::{AllowImportRules, Origin, Stylesheet, UrlExtraData};
|
|
17
|
+
use url::Url;
|
|
18
|
+
|
|
19
|
+
use crate::sheet::YSheet;
|
|
20
|
+
|
|
21
|
+
fn parse(css: String) -> YSheet {
|
|
22
|
+
let lock = SharedRwLock::new();
|
|
23
|
+
let base_url = Url::parse("https://example.com/style.css").expect("invalid URL");
|
|
24
|
+
let url_data = UrlExtraData::from(base_url);
|
|
25
|
+
|
|
26
|
+
// `MediaList::empty()` means "applies to all media".
|
|
27
|
+
let media = Arc::new(lock.wrap(MediaList::empty()));
|
|
28
|
+
|
|
29
|
+
let stylesheet = Stylesheet::from_str(
|
|
30
|
+
&css,
|
|
31
|
+
url_data,
|
|
32
|
+
Origin::Author, // stylesheet origin: Author / User / UserAgent
|
|
33
|
+
media,
|
|
34
|
+
lock.clone(),
|
|
35
|
+
None, // no external @import loader
|
|
36
|
+
None, // no error reporter
|
|
37
|
+
QuirksMode::NoQuirks,
|
|
38
|
+
AllowImportRules::Yes,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
YSheet::new(stylesheet)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#[magnus::init]
|
|
45
|
+
fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
46
|
+
<bool as stylo_static_prefs::Preference>::set("layout.unimplemented", true);
|
|
47
|
+
<bool as stylo_static_prefs::Preference>::set(
|
|
48
|
+
"layout.css.backdrop-filter.enabled",
|
|
49
|
+
true,
|
|
50
|
+
);
|
|
51
|
+
<bool as stylo_static_prefs::Preference>::set("layout.variable_fonts.enabled", true);
|
|
52
|
+
<bool as stylo_static_prefs::Preference>::set("layout.css.font-variations.enabled", true);
|
|
53
|
+
<bool as stylo_static_prefs::Preference>::set("layout.container-queries.enabled", true);
|
|
54
|
+
<bool as stylo_static_prefs::Preference>::set("layout.columns.enabled", true);
|
|
55
|
+
<bool as stylo_static_prefs::Preference>::set("layout.grid.enabled", true);
|
|
56
|
+
<bool as stylo_static_prefs::Preference>::set("layout.writing-mode.enabled", true);
|
|
57
|
+
|
|
58
|
+
let yass_module = ruby.define_module("Yass")?;
|
|
59
|
+
|
|
60
|
+
let parser_module = yass_module.define_module("Parser")?;
|
|
61
|
+
parser_module.define_singleton_method("parse", function!(parse, 1))?;
|
|
62
|
+
|
|
63
|
+
let stylesheet_class = yass_module.define_class("Stylesheet", ruby.class_object())?;
|
|
64
|
+
stylesheet_class.define_method("rules", method!(YSheet::rules, 0))?;
|
|
65
|
+
|
|
66
|
+
general::init::init(ruby, &yass_module)?;
|
|
67
|
+
declarations::init::init(ruby, &yass_module)?;
|
|
68
|
+
rules::init::init(ruby, &yass_module)?;
|
|
69
|
+
selectors::init::init(ruby, &yass_module)?;
|
|
70
|
+
|
|
71
|
+
Ok(())
|
|
72
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
use magnus::{IntoValue, Ruby, Value, gc};
|
|
2
|
+
|
|
3
|
+
use crate::cached_value::CachedValue;
|
|
4
|
+
|
|
5
|
+
type OptionalTransform<T> = fn(&(Option<T>, fn(&T, &Ruby) -> Value), &Ruby) -> Value;
|
|
6
|
+
|
|
7
|
+
pub struct OptionalCachedValue<T> {
|
|
8
|
+
cached_value: CachedValue<(Option<T>, fn(&T, &Ruby) -> Value), OptionalTransform<T>>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
impl<T> OptionalCachedValue<T> {
|
|
12
|
+
pub fn new(value: Option<T>, cb: fn(&T, &Ruby) -> Value) -> Self {
|
|
13
|
+
let transform: OptionalTransform<T> = |(value, cb), ruby| {
|
|
14
|
+
if let Some(v) = value {
|
|
15
|
+
cb(v, ruby)
|
|
16
|
+
} else {
|
|
17
|
+
ruby.qnil().into_value_with(ruby)
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Self {
|
|
22
|
+
cached_value: CachedValue::new((value, cb), transform)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
pub fn get(&self, ruby: &Ruby) -> Value {
|
|
27
|
+
self.cached_value.get(ruby)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
pub fn mark(&self, marker: &gc::Marker) {
|
|
31
|
+
self.cached_value.mark(marker);
|
|
32
|
+
}
|
|
33
|
+
}
|