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,309 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, RString, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::counter_style::{CounterStyle, Symbol, Symbols, SymbolsType};
|
|
3
|
+
use style::values::generics::counters::GenericContentItem;
|
|
4
|
+
use style::values::specified::Content;
|
|
5
|
+
use style::values::specified::image::Image as SpecifiedImage;
|
|
6
|
+
|
|
7
|
+
use crate::{
|
|
8
|
+
cached_value::CachedValue,
|
|
9
|
+
cached_value_list::CachedValueList,
|
|
10
|
+
declarations::images::image_to_value,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
#[derive(TypedData)]
|
|
14
|
+
#[magnus(class = "Yass::Declarations::Content", mark)]
|
|
15
|
+
pub struct YContent {
|
|
16
|
+
value: CachedValue<Content>,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl YContent {
|
|
20
|
+
pub fn new(content: Content) -> Self {
|
|
21
|
+
Self {
|
|
22
|
+
value: CachedValue::new(content, |content, ruby| {
|
|
23
|
+
make_content(content, ruby)
|
|
24
|
+
}),
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
29
|
+
rb_self.value.get(ruby)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
impl DataTypeFunctions for YContent {
|
|
34
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
35
|
+
self.value.mark(marker);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#[magnus::wrap(class = "Yass::Declarations::Content::Normal")]
|
|
40
|
+
pub struct YContentNormal {}
|
|
41
|
+
|
|
42
|
+
impl YContentNormal {
|
|
43
|
+
pub fn new() -> Self {
|
|
44
|
+
Self {}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#[magnus::wrap(class = "Yass::Declarations::Content::None")]
|
|
49
|
+
pub struct YContentNone {}
|
|
50
|
+
|
|
51
|
+
impl YContentNone {
|
|
52
|
+
pub fn new() -> Self {
|
|
53
|
+
Self {}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
fn make_content(content: &Content, ruby: &Ruby) -> Value {
|
|
58
|
+
match content {
|
|
59
|
+
Content::Normal => YContentNormal::new().into_value_with(ruby),
|
|
60
|
+
Content::None => YContentNone::new().into_value_with(ruby),
|
|
61
|
+
Content::Items(items) => {
|
|
62
|
+
YContentItems::new(items.clone()).into_value_with(ruby)
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
#[derive(TypedData)]
|
|
68
|
+
#[magnus(class = "Yass::Declarations::Content::Items", mark)]
|
|
69
|
+
pub struct YContentItems {
|
|
70
|
+
items: CachedValueList<GenericContentItem<SpecifiedImage>>,
|
|
71
|
+
alt_start: usize,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
impl YContentItems {
|
|
75
|
+
pub fn new(content_items: style::values::generics::counters::GenericContentItems<SpecifiedImage>) -> Self {
|
|
76
|
+
Self {
|
|
77
|
+
items: CachedValueList::new(content_items.items.to_vec(), |item, _ctx, ruby| {
|
|
78
|
+
make_content_item_value(item, ruby)
|
|
79
|
+
}),
|
|
80
|
+
|
|
81
|
+
alt_start: content_items.alt_start,
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
pub fn items(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
86
|
+
rb_self.items.to_a(ruby)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
pub fn alt_start(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> usize {
|
|
90
|
+
rb_self.alt_start
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
impl DataTypeFunctions for YContentItems {
|
|
95
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
96
|
+
self.items.mark(marker);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
fn make_content_item_value(item: &GenericContentItem<SpecifiedImage>, ruby: &Ruby) -> Value {
|
|
101
|
+
match item {
|
|
102
|
+
GenericContentItem::String(s) => {
|
|
103
|
+
YContentItemString::new((&**s).to_owned()).into_value_with(ruby)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
GenericContentItem::Counter(name, style) => {
|
|
107
|
+
YContentItemCounter::new((&*name.0).to_owned(), style.clone())
|
|
108
|
+
.into_value_with(ruby)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
GenericContentItem::Counters(name, separator, style) => {
|
|
112
|
+
YContentItemCounters::new(
|
|
113
|
+
(&*name.0).to_owned(),
|
|
114
|
+
(&**separator).to_owned(),
|
|
115
|
+
style.clone(),
|
|
116
|
+
)
|
|
117
|
+
.into_value_with(ruby)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
GenericContentItem::OpenQuote => ruby.to_symbol("open_quote").into_value_with(ruby),
|
|
121
|
+
GenericContentItem::CloseQuote => ruby.to_symbol("close_quote").into_value_with(ruby),
|
|
122
|
+
GenericContentItem::NoOpenQuote => ruby.to_symbol("no_open_quote").into_value_with(ruby),
|
|
123
|
+
GenericContentItem::NoCloseQuote => ruby.to_symbol("no_close_quote").into_value_with(ruby),
|
|
124
|
+
GenericContentItem::Attr(attr) => {
|
|
125
|
+
YContentItemAttr::new(
|
|
126
|
+
(&**attr.namespace_prefix).to_owned(),
|
|
127
|
+
(&**attr.namespace_url).to_owned(),
|
|
128
|
+
(&*attr.attribute).to_owned(),
|
|
129
|
+
(&**attr.fallback).to_owned(),
|
|
130
|
+
).into_value_with(ruby)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
GenericContentItem::Image(image) => {
|
|
134
|
+
YContentItemImage::new(image.clone()).into_value_with(ruby)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
#[magnus::wrap(class = "Yass::Declarations::Content::Item::String")]
|
|
140
|
+
pub struct YContentItemString {
|
|
141
|
+
value: String,
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
impl YContentItemString {
|
|
145
|
+
pub fn new(value: String) -> Self {
|
|
146
|
+
Self { value }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
pub fn value(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
150
|
+
ruby.str_new(&rb_self.value)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
#[magnus::wrap(class = "Yass::Declarations::Content::Item::Counter")]
|
|
155
|
+
pub struct YContentItemCounter {
|
|
156
|
+
name: String,
|
|
157
|
+
style: CounterStyle,
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
impl YContentItemCounter {
|
|
161
|
+
pub fn new(name: String, style: CounterStyle) -> Self {
|
|
162
|
+
Self { name, style }
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
pub fn name(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
166
|
+
ruby.str_new(&rb_self.name)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
pub fn style(ruby: &Ruby, rb_self: &Self) -> Value {
|
|
170
|
+
make_counter_style_value(&rb_self.style, ruby)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
#[magnus::wrap(class = "Yass::Declarations::Content::Item::Counters")]
|
|
175
|
+
pub struct YContentItemCounters {
|
|
176
|
+
name: String,
|
|
177
|
+
separator: String,
|
|
178
|
+
style: CounterStyle,
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
impl YContentItemCounters {
|
|
182
|
+
pub fn new(name: String, separator: String, style: CounterStyle) -> Self {
|
|
183
|
+
Self { name, separator, style }
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
pub fn name(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
187
|
+
ruby.str_new(&rb_self.name)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
pub fn separator(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
191
|
+
ruby.str_new(&rb_self.separator)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
pub fn style(ruby: &Ruby, rb_self: &Self) -> Value {
|
|
195
|
+
make_counter_style_value(&rb_self.style, ruby)
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
fn make_counter_style_value(style: &CounterStyle, ruby: &Ruby) -> Value {
|
|
200
|
+
match style {
|
|
201
|
+
CounterStyle::None => ruby.intern("none").into_value_with(ruby),
|
|
202
|
+
CounterStyle::Name(name) => ruby.intern(&name.0.to_string()).into_value_with(ruby),
|
|
203
|
+
CounterStyle::String(value) => ruby.str_new(value).into_value_with(ruby),
|
|
204
|
+
CounterStyle::Symbols { ty, symbols } => {
|
|
205
|
+
YContentCounterStyleSymbols::new(*ty, symbols.clone()).into_value_with(ruby)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
#[magnus::wrap(class = "Yass::Declarations::Content::CounterStyle::Symbols")]
|
|
211
|
+
pub struct YContentCounterStyleSymbols {
|
|
212
|
+
kind: SymbolsType,
|
|
213
|
+
symbols: Vec<String>,
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
impl YContentCounterStyleSymbols {
|
|
217
|
+
pub fn new(kind: SymbolsType, symbols: Symbols) -> Self {
|
|
218
|
+
Self {
|
|
219
|
+
kind,
|
|
220
|
+
symbols: symbols
|
|
221
|
+
.0
|
|
222
|
+
.iter()
|
|
223
|
+
.map(|symbol| match symbol {
|
|
224
|
+
Symbol::String(value) => (&**value).to_owned(),
|
|
225
|
+
Symbol::Ident(ident) => ident.0.to_string(),
|
|
226
|
+
})
|
|
227
|
+
.collect(),
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
pub fn kind(ruby: &Ruby, rb_self: &Self) -> Value {
|
|
232
|
+
ruby.intern(symbols_type_name(rb_self.kind)).into_value_with(ruby)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
pub fn symbols(ruby: &Ruby, rb_self: &Self) -> Result<RArray, Error> {
|
|
236
|
+
let array = ruby.ary_new_capa(rb_self.symbols.len());
|
|
237
|
+
|
|
238
|
+
for symbol in rb_self.symbols.iter() {
|
|
239
|
+
array.push(ruby.str_new(symbol))?;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
Ok(array)
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
fn symbols_type_name(symbols_type: SymbolsType) -> &'static str {
|
|
247
|
+
match symbols_type {
|
|
248
|
+
SymbolsType::Cyclic => "cyclic",
|
|
249
|
+
SymbolsType::Numeric => "numeric",
|
|
250
|
+
SymbolsType::Alphabetic => "alphabetic",
|
|
251
|
+
SymbolsType::Symbolic => "symbolic",
|
|
252
|
+
SymbolsType::Fixed => "fixed",
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
#[magnus::wrap(class = "Yass::Declarations::Content::Item::Attr")]
|
|
257
|
+
pub struct YContentItemAttr {
|
|
258
|
+
namespace_prefix: String,
|
|
259
|
+
namespace_url: String,
|
|
260
|
+
attribute: String,
|
|
261
|
+
fallback: String,
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
impl YContentItemAttr {
|
|
265
|
+
pub fn new(namespace_prefix: String, namespace_url: String, attribute: String, fallback: String) -> Self {
|
|
266
|
+
Self { namespace_prefix, namespace_url, attribute, fallback }
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
pub fn namespace_prefix(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
270
|
+
ruby.str_new(&rb_self.namespace_prefix)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
pub fn namespace_url(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
274
|
+
ruby.str_new(&rb_self.namespace_url)
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
pub fn attribute(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
278
|
+
ruby.str_new(&rb_self.attribute)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
pub fn fallback(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
282
|
+
ruby.str_new(&rb_self.fallback)
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
#[derive(TypedData)]
|
|
287
|
+
#[magnus(class = "Yass::Declarations::Content::Item::Image", mark)]
|
|
288
|
+
pub struct YContentItemImage {
|
|
289
|
+
image: CachedValue<SpecifiedImage>,
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
impl YContentItemImage {
|
|
293
|
+
pub fn new(image: SpecifiedImage) -> Self {
|
|
294
|
+
Self {
|
|
295
|
+
image: CachedValue::new(image, |img, ruby| image_to_value(img, ruby)),
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
pub fn image(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
300
|
+
rb_self.image.get(ruby)
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
impl DataTypeFunctions for YContentItemImage {
|
|
305
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
306
|
+
self.image.mark(marker);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, RString, Ruby, TypedData, gc, typed_data};
|
|
2
|
+
use style::values::generics::counters::CounterPair;
|
|
3
|
+
use style::values::specified::{CounterIncrement, Integer};
|
|
4
|
+
|
|
5
|
+
use crate::cached_value_list::CachedValueList;
|
|
6
|
+
|
|
7
|
+
#[derive(TypedData)]
|
|
8
|
+
#[magnus(class = "Yass::Declarations::CounterIncrement", mark)]
|
|
9
|
+
pub struct YCounterIncrement {
|
|
10
|
+
values: CachedValueList<CounterPair<Integer>>,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
impl YCounterIncrement {
|
|
14
|
+
pub fn new(counter_increment: CounterIncrement) -> Self {
|
|
15
|
+
Self {
|
|
16
|
+
values: CachedValueList::new(counter_increment.to_vec(), |counter, _ctx, ruby| {
|
|
17
|
+
YCounterIncrementCounter::new(counter.clone()).into_value_with(ruby)
|
|
18
|
+
}),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
pub fn values(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
23
|
+
rb_self.values.to_a(ruby)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
impl DataTypeFunctions for YCounterIncrement {
|
|
28
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
29
|
+
self.values.mark(marker);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#[magnus::wrap(class = "Yass::Declarations::CounterIncrement::Counter")]
|
|
34
|
+
pub struct YCounterIncrementCounter {
|
|
35
|
+
name: String,
|
|
36
|
+
value: i32,
|
|
37
|
+
is_reversed: bool,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
impl YCounterIncrementCounter {
|
|
41
|
+
pub fn new(counter: CounterPair<Integer>) -> Self {
|
|
42
|
+
Self {
|
|
43
|
+
name: counter.name.0.to_string(),
|
|
44
|
+
value: counter.value.value(),
|
|
45
|
+
is_reversed: counter.is_reversed,
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
pub fn name(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
50
|
+
ruby.str_new(&rb_self.name)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
pub fn value(_ruby: &Ruby, rb_self: &Self) -> i32 {
|
|
54
|
+
rb_self.value
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
pub fn reversed(_ruby: &Ruby, rb_self: &Self) -> bool {
|
|
58
|
+
rb_self.is_reversed
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, RString, Ruby, TypedData, gc, typed_data};
|
|
2
|
+
use style::values::generics::counters::CounterPair;
|
|
3
|
+
use style::values::specified::{CounterReset, Integer};
|
|
4
|
+
|
|
5
|
+
use crate::cached_value_list::CachedValueList;
|
|
6
|
+
|
|
7
|
+
#[derive(TypedData)]
|
|
8
|
+
#[magnus(class = "Yass::Declarations::CounterReset", mark)]
|
|
9
|
+
pub struct YCounterReset {
|
|
10
|
+
values: CachedValueList<CounterPair<Integer>>,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
impl YCounterReset {
|
|
14
|
+
pub fn new(counter_reset: CounterReset) -> Self {
|
|
15
|
+
Self {
|
|
16
|
+
values: CachedValueList::new(counter_reset.to_vec(), |counter, _ctx, ruby| {
|
|
17
|
+
YCounterResetCounter::new(counter.clone()).into_value_with(ruby)
|
|
18
|
+
}),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
pub fn values(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
23
|
+
rb_self.values.to_a(ruby)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
impl DataTypeFunctions for YCounterReset {
|
|
28
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
29
|
+
self.values.mark(marker);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#[magnus::wrap(class = "Yass::Declarations::CounterReset::Counter")]
|
|
34
|
+
pub struct YCounterResetCounter {
|
|
35
|
+
name: String,
|
|
36
|
+
value: i32,
|
|
37
|
+
is_reversed: bool,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
impl YCounterResetCounter {
|
|
41
|
+
pub fn new(counter: CounterPair<Integer>) -> Self {
|
|
42
|
+
Self {
|
|
43
|
+
name: counter.name.0.to_string(),
|
|
44
|
+
value: counter.value.value(),
|
|
45
|
+
is_reversed: counter.is_reversed,
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
pub fn name(ruby: &Ruby, rb_self: &Self) -> RString {
|
|
50
|
+
ruby.str_new(&rb_self.name)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
pub fn value(_ruby: &Ruby, rb_self: &Self) -> i32 {
|
|
54
|
+
rb_self.value
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
pub fn reversed(_ruby: &Ruby, rb_self: &Self) -> bool {
|
|
58
|
+
rb_self.is_reversed
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
use magnus::{Ruby, typed_data, value::Id};
|
|
2
|
+
use style::properties::{CSSWideKeyword, WideKeywordDeclaration};
|
|
3
|
+
|
|
4
|
+
pub fn css_wide_keyword_to_id(ruby: &Ruby, keyword: CSSWideKeyword) -> Id {
|
|
5
|
+
match keyword {
|
|
6
|
+
CSSWideKeyword::Initial => ruby.intern("initial"),
|
|
7
|
+
CSSWideKeyword::Inherit => ruby.intern("inherit"),
|
|
8
|
+
CSSWideKeyword::Unset => ruby.intern("unset"),
|
|
9
|
+
CSSWideKeyword::Revert => ruby.intern("revert"),
|
|
10
|
+
CSSWideKeyword::RevertLayer => ruby.intern("revert_layer"),
|
|
11
|
+
CSSWideKeyword::RevertRule => ruby.intern("revert_rule"),
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#[magnus::wrap(class = "Yass::Declarations::CSSWideKeyword")]
|
|
16
|
+
pub struct YCSSWideKeyword {
|
|
17
|
+
wide_keyword_declaration: WideKeywordDeclaration
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
impl YCSSWideKeyword {
|
|
21
|
+
pub fn new(wide_keyword_declaration: WideKeywordDeclaration) -> Self {
|
|
22
|
+
Self { wide_keyword_declaration }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
26
|
+
css_wide_keyword_to_id(ruby, rb_self.wide_keyword_declaration.keyword)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, TypedData, Value, gc, typed_data, value::Id};
|
|
2
|
+
use style::values::specified::{Cursor, ui::{CursorImage, CursorKind}};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, cached_value_list::CachedValueList, declarations::{images::image_to_value, number::YNumber}};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Cursor", mark)]
|
|
8
|
+
pub struct YCursor {
|
|
9
|
+
images: CachedValueList<CursorImage>,
|
|
10
|
+
keyword: CursorKind,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
impl YCursor {
|
|
14
|
+
pub fn new(cursor: Cursor) -> Self {
|
|
15
|
+
Self {
|
|
16
|
+
images: CachedValueList::new(cursor.images.to_vec(), |image, _ctx, ruby| {
|
|
17
|
+
YCursorImage::new(image.clone()).into_value_with(ruby)
|
|
18
|
+
}),
|
|
19
|
+
keyword: cursor.keyword,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
pub fn images(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
24
|
+
rb_self.images.to_a(ruby)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
pub fn keyword(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
28
|
+
cursor_kind_to_id(rb_self.keyword, ruby)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
impl DataTypeFunctions for YCursor {
|
|
33
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
34
|
+
self.images.mark(marker);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#[derive(TypedData)]
|
|
39
|
+
#[magnus(class = "Yass::Declarations::Cursor::Image", mark)]
|
|
40
|
+
pub struct YCursorImage {
|
|
41
|
+
image: CachedValue<style::values::specified::image::Image>,
|
|
42
|
+
has_hotspot: bool,
|
|
43
|
+
hotspot_x: CachedValue<style::values::specified::Number>,
|
|
44
|
+
hotspot_y: CachedValue<style::values::specified::Number>,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
impl YCursorImage {
|
|
48
|
+
pub fn new(cursor_image: CursorImage) -> Self {
|
|
49
|
+
Self {
|
|
50
|
+
image: CachedValue::new(cursor_image.image, |image, ruby| image_to_value(image, ruby)),
|
|
51
|
+
has_hotspot: cursor_image.has_hotspot,
|
|
52
|
+
hotspot_x: CachedValue::new(cursor_image.hotspot_x, |hotspot_x, ruby| {
|
|
53
|
+
YNumber::new(hotspot_x.get()).into_value_with(ruby)
|
|
54
|
+
}),
|
|
55
|
+
hotspot_y: CachedValue::new(cursor_image.hotspot_y, |hotspot_y, ruby| {
|
|
56
|
+
YNumber::new(hotspot_y.get()).into_value_with(ruby)
|
|
57
|
+
}),
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
pub fn image(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
62
|
+
rb_self.image.get(ruby)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
pub fn has_hotspot(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
66
|
+
rb_self.has_hotspot
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
pub fn hotspot_x(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
70
|
+
rb_self.hotspot_x.get(ruby)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub fn hotspot_y(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
74
|
+
rb_self.hotspot_y.get(ruby)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
impl DataTypeFunctions for YCursorImage {
|
|
79
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
80
|
+
self.image.mark(marker);
|
|
81
|
+
self.hotspot_x.mark(marker);
|
|
82
|
+
self.hotspot_y.mark(marker);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
fn cursor_kind_to_id(cursor_kind: CursorKind, ruby: &Ruby) -> Id {
|
|
87
|
+
match cursor_kind {
|
|
88
|
+
CursorKind::None => ruby.intern("none"),
|
|
89
|
+
CursorKind::Default => ruby.intern("default"),
|
|
90
|
+
CursorKind::Pointer => ruby.intern("pointer"),
|
|
91
|
+
CursorKind::ContextMenu => ruby.intern("context_menu"),
|
|
92
|
+
CursorKind::Help => ruby.intern("help"),
|
|
93
|
+
CursorKind::Progress => ruby.intern("progress"),
|
|
94
|
+
CursorKind::Wait => ruby.intern("wait"),
|
|
95
|
+
CursorKind::Cell => ruby.intern("cell"),
|
|
96
|
+
CursorKind::Crosshair => ruby.intern("crosshair"),
|
|
97
|
+
CursorKind::Text => ruby.intern("text"),
|
|
98
|
+
CursorKind::VerticalText => ruby.intern("vertical_text"),
|
|
99
|
+
CursorKind::Alias => ruby.intern("alias"),
|
|
100
|
+
CursorKind::Copy => ruby.intern("copy"),
|
|
101
|
+
CursorKind::Move => ruby.intern("move"),
|
|
102
|
+
CursorKind::NoDrop => ruby.intern("no_drop"),
|
|
103
|
+
CursorKind::NotAllowed => ruby.intern("not_allowed"),
|
|
104
|
+
CursorKind::Grab => ruby.intern("grab"),
|
|
105
|
+
CursorKind::Grabbing => ruby.intern("grabbing"),
|
|
106
|
+
CursorKind::EResize => ruby.intern("e_resize"),
|
|
107
|
+
CursorKind::NResize => ruby.intern("n_resize"),
|
|
108
|
+
CursorKind::NeResize => ruby.intern("ne_resize"),
|
|
109
|
+
CursorKind::NwResize => ruby.intern("nw_resize"),
|
|
110
|
+
CursorKind::SResize => ruby.intern("s_resize"),
|
|
111
|
+
CursorKind::SeResize => ruby.intern("se_resize"),
|
|
112
|
+
CursorKind::SwResize => ruby.intern("sw_resize"),
|
|
113
|
+
CursorKind::WResize => ruby.intern("w_resize"),
|
|
114
|
+
CursorKind::EwResize => ruby.intern("ew_resize"),
|
|
115
|
+
CursorKind::NsResize => ruby.intern("ns_resize"),
|
|
116
|
+
CursorKind::NeswResize => ruby.intern("nesw_resize"),
|
|
117
|
+
CursorKind::NwseResize => ruby.intern("nwse_resize"),
|
|
118
|
+
CursorKind::ColResize => ruby.intern("col_resize"),
|
|
119
|
+
CursorKind::RowResize => ruby.intern("row_resize"),
|
|
120
|
+
CursorKind::AllScroll => ruby.intern("all_scroll"),
|
|
121
|
+
CursorKind::ZoomIn => ruby.intern("zoom_in"),
|
|
122
|
+
CursorKind::ZoomOut => ruby.intern("zoom_out"),
|
|
123
|
+
CursorKind::Auto => ruby.intern("auto"),
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc, typed_data, value::Id};
|
|
2
|
+
use style::{
|
|
3
|
+
custom_properties::SpecifiedValue as CustomSpecifiedValue,
|
|
4
|
+
properties::{CSSWideKeyword, CustomDeclaration, CustomDeclarationValue},
|
|
5
|
+
properties_and_values::value::SpecifiedValue as RegisteredCustomSpecifiedValue,
|
|
6
|
+
};
|
|
7
|
+
use style_traits::ToCss;
|
|
8
|
+
|
|
9
|
+
use crate::{cached_value::CachedValue, declarations::csswide_keyword::css_wide_keyword_to_id};
|
|
10
|
+
|
|
11
|
+
#[derive(TypedData)]
|
|
12
|
+
#[magnus(class = "Yass::Declarations::Custom", mark)]
|
|
13
|
+
pub struct YCustom {
|
|
14
|
+
name: CachedValue<String>,
|
|
15
|
+
value: CachedValue<CustomDeclarationValue>,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
impl YCustom {
|
|
19
|
+
pub fn new(custom_declaration: CustomDeclaration) -> Self {
|
|
20
|
+
Self {
|
|
21
|
+
name: CachedValue::new(custom_declaration.name.to_string(), |name, ruby| {
|
|
22
|
+
ruby.str_new(name).into_value_with(ruby)
|
|
23
|
+
}),
|
|
24
|
+
|
|
25
|
+
value: CachedValue::new(custom_declaration.value, |value, ruby| {
|
|
26
|
+
make_custom_value(value, ruby)
|
|
27
|
+
}),
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
pub fn name(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
32
|
+
rb_self.name.get(ruby)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
36
|
+
rb_self.value.get(ruby)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
impl DataTypeFunctions for YCustom {
|
|
41
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
42
|
+
self.name.mark(marker);
|
|
43
|
+
self.value.mark(marker);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#[magnus::wrap(class = "Yass::Declarations::Custom::Unparsed")]
|
|
48
|
+
pub struct YCustomValueUnparsed {
|
|
49
|
+
value: CustomSpecifiedValue,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
impl YCustomValueUnparsed {
|
|
53
|
+
pub fn new(value: CustomSpecifiedValue) -> Self {
|
|
54
|
+
Self { value }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
pub fn value(ruby: &Ruby, rb_self: &Self) -> Value {
|
|
58
|
+
ruby.str_new(&rb_self.value.css).into_value_with(ruby)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#[magnus::wrap(class = "Yass::Declarations::Custom::Parsed")]
|
|
63
|
+
pub struct YCustomValueParsed {
|
|
64
|
+
value: RegisteredCustomSpecifiedValue,
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
impl YCustomValueParsed {
|
|
68
|
+
pub fn new(value: RegisteredCustomSpecifiedValue) -> Self {
|
|
69
|
+
Self { value }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
pub fn value(ruby: &Ruby, rb_self: &Self) -> Value {
|
|
73
|
+
ruby
|
|
74
|
+
.str_new(&rb_self.value.to_css_string())
|
|
75
|
+
.into_value_with(ruby)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#[magnus::wrap(class = "Yass::Declarations::Custom::CSSWideKeyword")]
|
|
80
|
+
pub struct YCustomValueCSSWideKeyword {
|
|
81
|
+
value: CSSWideKeyword,
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
impl YCustomValueCSSWideKeyword {
|
|
85
|
+
pub fn new(value: CSSWideKeyword) -> Self {
|
|
86
|
+
Self { value }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
pub fn value(ruby: &Ruby, rb_self: &Self) -> Id {
|
|
90
|
+
css_wide_keyword_to_id(ruby, rb_self.value)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
pub fn make_custom_value(value: &CustomDeclarationValue, ruby: &Ruby) -> Value {
|
|
95
|
+
match value {
|
|
96
|
+
CustomDeclarationValue::Unparsed(value) => {
|
|
97
|
+
YCustomValueUnparsed::new((**value).clone()).into_value_with(ruby)
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
CustomDeclarationValue::Parsed(value) => {
|
|
101
|
+
YCustomValueParsed::new((**value).clone()).into_value_with(ruby)
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
CustomDeclarationValue::CSSWideKeyword(value) => {
|
|
105
|
+
YCustomValueCSSWideKeyword::new(*value).into_value_with(ruby)
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
}
|