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,131 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::{computed::GridTemplateAreas, specified::position::{NamedArea, TemplateAreasArc}};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, cached_value_list::CachedValueList};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::GridTemplateAreas", mark)]
|
|
8
|
+
pub struct YGridTemplateAreas {
|
|
9
|
+
areas: CachedValue<GridTemplateAreas>,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl YGridTemplateAreas {
|
|
13
|
+
pub fn new(grid_template_areas: GridTemplateAreas) -> Self {
|
|
14
|
+
Self {
|
|
15
|
+
areas: CachedValue::new(grid_template_areas, make_grid_template_areas_value),
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
pub fn areas(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
20
|
+
rb_self.areas.get(ruby)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
impl DataTypeFunctions for YGridTemplateAreas {
|
|
25
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
26
|
+
self.areas.mark(marker);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
fn make_grid_template_areas_value(grid_template_areas: &GridTemplateAreas, ruby: &Ruby) -> Value {
|
|
31
|
+
match grid_template_areas {
|
|
32
|
+
GridTemplateAreas::None => YGridTemplateAreasNone::new().into_value_with(ruby),
|
|
33
|
+
GridTemplateAreas::Areas(areas) => YGridTemplateAreaList::new(areas.clone()).into_value_with(ruby),
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[magnus::wrap(class = "Yass::Declarations::GridTemplateAreas::None")]
|
|
38
|
+
pub struct YGridTemplateAreasNone {}
|
|
39
|
+
|
|
40
|
+
impl YGridTemplateAreasNone {
|
|
41
|
+
pub fn new() -> Self {
|
|
42
|
+
Self {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#[derive(TypedData)]
|
|
47
|
+
#[magnus(class = "Yass::Declarations::GridTemplateAreas::AreaList", mark)]
|
|
48
|
+
pub struct YGridTemplateAreaList {
|
|
49
|
+
width: u32,
|
|
50
|
+
strings: CachedValueList<String>,
|
|
51
|
+
areas: CachedValueList<NamedArea>,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
impl YGridTemplateAreaList {
|
|
55
|
+
pub fn new(template_areas: TemplateAreasArc) -> Self {
|
|
56
|
+
let areas = &template_areas.0;
|
|
57
|
+
|
|
58
|
+
Self {
|
|
59
|
+
width: areas.width,
|
|
60
|
+
|
|
61
|
+
strings: CachedValueList::new(
|
|
62
|
+
areas.strings.iter().map(|s| s.to_string()).collect(),
|
|
63
|
+
|value, _ctx, ruby| ruby.str_new(value).into_value_with(ruby),
|
|
64
|
+
),
|
|
65
|
+
|
|
66
|
+
areas: CachedValueList::new(areas.areas.to_vec(), |value, _ctx, ruby| {
|
|
67
|
+
YGridTemplateArea::new(value.clone()).into_value_with(ruby)
|
|
68
|
+
}),
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
pub fn width(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> u32 {
|
|
73
|
+
rb_self.width
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
pub fn strings(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
77
|
+
rb_self.strings.to_a(ruby)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pub fn areas(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
81
|
+
rb_self.areas.to_a(ruby)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
impl DataTypeFunctions for YGridTemplateAreaList {
|
|
86
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
87
|
+
self.strings.mark(marker);
|
|
88
|
+
self.areas.mark(marker);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
#[magnus::wrap(class = "Yass::Declarations::GridTemplateAreas::Area")]
|
|
93
|
+
pub struct YGridTemplateArea {
|
|
94
|
+
name: String,
|
|
95
|
+
row_start: u32,
|
|
96
|
+
row_end: u32,
|
|
97
|
+
column_start: u32,
|
|
98
|
+
column_end: u32,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
impl YGridTemplateArea {
|
|
102
|
+
pub fn new(area: NamedArea) -> Self {
|
|
103
|
+
Self {
|
|
104
|
+
name: area.name.to_string(),
|
|
105
|
+
row_start: area.rows.start,
|
|
106
|
+
row_end: area.rows.end,
|
|
107
|
+
column_start: area.columns.start,
|
|
108
|
+
column_end: area.columns.end,
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
pub fn name(ruby: &Ruby, rb_self: &Self) -> Value {
|
|
113
|
+
ruby.str_new(&rb_self.name).into_value_with(ruby)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
pub fn row_start(_ruby: &Ruby, rb_self: &Self) -> u32 {
|
|
117
|
+
rb_self.row_start
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
pub fn row_end(_ruby: &Ruby, rb_self: &Self) -> u32 {
|
|
121
|
+
rb_self.row_end
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
pub fn column_start(_ruby: &Ruby, rb_self: &Self) -> u32 {
|
|
125
|
+
rb_self.column_start
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
pub fn column_end(_ruby: &Ruby, rb_self: &Self) -> u32 {
|
|
129
|
+
rb_self.column_end
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::specified::GridTemplateComponent;
|
|
3
|
+
|
|
4
|
+
use crate::{
|
|
5
|
+
cached_value::CachedValue,
|
|
6
|
+
declarations::grid_template::make_grid_template_component_value,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
#[derive(TypedData)]
|
|
10
|
+
#[magnus(class = "Yass::Declarations::GridTemplateColumns", mark)]
|
|
11
|
+
pub struct YGridTemplateColumns {
|
|
12
|
+
value: CachedValue<GridTemplateComponent>,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
impl YGridTemplateColumns {
|
|
16
|
+
pub fn new(grid_template_component: GridTemplateComponent) -> Self {
|
|
17
|
+
Self {
|
|
18
|
+
value: CachedValue::new(grid_template_component, make_grid_template_component_value),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
23
|
+
rb_self.value.get(ruby)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
impl DataTypeFunctions for YGridTemplateColumns {
|
|
28
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
29
|
+
self.value.mark(marker);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::specified::GridTemplateComponent;
|
|
3
|
+
|
|
4
|
+
use crate::{
|
|
5
|
+
cached_value::CachedValue,
|
|
6
|
+
declarations::grid_template::make_grid_template_component_value,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
#[derive(TypedData)]
|
|
10
|
+
#[magnus(class = "Yass::Declarations::GridTemplateRows", mark)]
|
|
11
|
+
pub struct YGridTemplateRows {
|
|
12
|
+
value: CachedValue<GridTemplateComponent>,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
impl YGridTemplateRows {
|
|
16
|
+
pub fn new(grid_template_component: GridTemplateComponent) -> Self {
|
|
17
|
+
Self {
|
|
18
|
+
value: CachedValue::new(grid_template_component, make_grid_template_component_value),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
23
|
+
rb_self.value.get(ruby)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
impl DataTypeFunctions for YGridTemplateRows {
|
|
28
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
29
|
+
self.value.mark(marker);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -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::Height", mark)]
|
|
8
|
+
pub struct YHeight {
|
|
9
|
+
size: CachedValue<Size>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl YHeight {
|
|
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 YHeight {
|
|
27
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
28
|
+
self.size.mark(marker);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc::Marker, typed_data, value::Id};
|
|
2
|
+
use style::values::specified::{LengthPercentage, position::{HorizontalPositionKeyword, PositionComponent}};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::{images::horizontal_keyword_to_id, size::YLengthPercentage}};
|
|
5
|
+
|
|
6
|
+
pub fn make_horizontal_position_component(component: &PositionComponent<HorizontalPositionKeyword>, ruby: &Ruby) -> Value {
|
|
7
|
+
match component {
|
|
8
|
+
PositionComponent::Center => {
|
|
9
|
+
YCenterHorizontalPositionComponent::new().into_value_with(ruby)
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
PositionComponent::Length(length) => {
|
|
13
|
+
YLengthHorizontalPositionComponent::new(length.clone()).into_value_with(ruby)
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
PositionComponent::Side(keyword, offset) => {
|
|
17
|
+
YSideHorizontalPositionComponent::new(keyword.clone(), offset.clone()).into_value_with(ruby)
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#[magnus::wrap(class = "Yass::Declarations::Image::CenterHorizontalPositionComponent")]
|
|
23
|
+
pub struct YCenterHorizontalPositionComponent {}
|
|
24
|
+
|
|
25
|
+
impl YCenterHorizontalPositionComponent {
|
|
26
|
+
pub fn new() -> Self {
|
|
27
|
+
Self { }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#[derive(magnus::TypedData)]
|
|
32
|
+
#[magnus(class = "Yass::Declarations::Image::LengthHorizontalPositionComponent", mark)]
|
|
33
|
+
pub struct YLengthHorizontalPositionComponent {
|
|
34
|
+
length: CachedValue<LengthPercentage>,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
impl YLengthHorizontalPositionComponent {
|
|
38
|
+
pub fn new(length: LengthPercentage) -> Self {
|
|
39
|
+
Self {
|
|
40
|
+
length: CachedValue::new(length, |length, ruby| {
|
|
41
|
+
YLengthPercentage::new(length.clone()).into_value_with(ruby)
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
pub fn length(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
47
|
+
rb_self.length.get(ruby)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
impl DataTypeFunctions for YLengthHorizontalPositionComponent {
|
|
52
|
+
fn mark(&self, marker: &Marker) {
|
|
53
|
+
self.length.mark(marker);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#[derive(TypedData)]
|
|
58
|
+
#[magnus(class = "Yass::Declarations::Image::SideHorizontalPositionComponent", mark)]
|
|
59
|
+
pub struct YSideHorizontalPositionComponent {
|
|
60
|
+
keyword: HorizontalPositionKeyword,
|
|
61
|
+
offset: CachedValue<Option<LengthPercentage>>,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
impl YSideHorizontalPositionComponent {
|
|
65
|
+
pub fn new(keyword: HorizontalPositionKeyword, offset: Option<LengthPercentage>) -> Self {
|
|
66
|
+
Self {
|
|
67
|
+
keyword,
|
|
68
|
+
offset: CachedValue::new(offset, |offset, ruby| {
|
|
69
|
+
match offset {
|
|
70
|
+
Some(offset) => {
|
|
71
|
+
YLengthPercentage::new(offset.clone()).into_value_with(ruby)
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pub fn side(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
81
|
+
horizontal_keyword_to_id(rb_self.keyword, ruby)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
pub fn offset(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
85
|
+
rb_self.offset.get(ruby)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
impl DataTypeFunctions for YSideHorizontalPositionComponent {
|
|
90
|
+
fn mark(&self, marker: &Marker) {
|
|
91
|
+
self.offset.mark(marker);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
use magnus::{Ruby, typed_data, value::Id};
|
|
2
|
+
use style::values::computed::ImageRendering;
|
|
3
|
+
|
|
4
|
+
#[magnus::wrap(class = "Yass::Declarations::ImageRendering")]
|
|
5
|
+
pub struct YImageRendering {
|
|
6
|
+
image_rendering: ImageRendering
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
impl YImageRendering {
|
|
10
|
+
pub fn new(image_rendering: ImageRendering) -> Self {
|
|
11
|
+
Self { image_rendering }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
15
|
+
match rb_self.image_rendering {
|
|
16
|
+
ImageRendering::Auto => ruby.intern("auto"),
|
|
17
|
+
ImageRendering::CrispEdges => ruby.intern("crisp_edges"),
|
|
18
|
+
ImageRendering::Pixelated => ruby.intern("pixelated"),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::specified::AngleOrPercentage;
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::{angle::YAngle, percentage::YPercentage}};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Image::AngleOrPercentage", mark)]
|
|
8
|
+
pub struct YAngleOrPercentage {
|
|
9
|
+
value: CachedValue<AngleOrPercentage>,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl YAngleOrPercentage {
|
|
13
|
+
pub fn new(value: AngleOrPercentage) -> Self {
|
|
14
|
+
Self {
|
|
15
|
+
value: CachedValue::new(value, |val, ruby| {
|
|
16
|
+
match val {
|
|
17
|
+
AngleOrPercentage::Angle(angle) => YAngle::new(*angle).into_value_with(ruby),
|
|
18
|
+
AngleOrPercentage::Percentage(percentage) => {
|
|
19
|
+
YPercentage::new(percentage.get()).into_value_with(ruby)
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
})
|
|
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 YAngleOrPercentage {
|
|
32
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
33
|
+
self.value.mark(marker);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc::Marker, typed_data, value::Id};
|
|
2
|
+
use style::values::{generics::{NonNegative, image::{Circle, ShapeExtent}}, specified::{Length, NonNegativeLength}};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::{calc::YCalc, length::no_calc_length_to_value}};
|
|
5
|
+
|
|
6
|
+
pub fn make_circle(circle: &Circle<NonNegativeLength>, ruby: &Ruby) -> Value {
|
|
7
|
+
match circle {
|
|
8
|
+
Circle::Radius(length) => {
|
|
9
|
+
YRadiusCircle::new(length.clone()).into_value_with(ruby)
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
Circle::Extent(shape_extent) => {
|
|
13
|
+
YExtentCircle::new(shape_extent.clone()).into_value_with(ruby)
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[derive(TypedData)]
|
|
19
|
+
#[magnus(class = "Yass::Declarations::Image::RadiusCircle", mark)]
|
|
20
|
+
pub struct YRadiusCircle {
|
|
21
|
+
length: CachedValue<NonNegative<Length>>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
impl YRadiusCircle {
|
|
25
|
+
pub fn new(length: NonNegative<Length>) -> Self {
|
|
26
|
+
Self {
|
|
27
|
+
length: CachedValue::new(length, |length, ruby| {
|
|
28
|
+
match &length.0 {
|
|
29
|
+
Length::NoCalc(no_calc_length) => {
|
|
30
|
+
no_calc_length_to_value(no_calc_length, ruby)
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
Length::Calc(calc_length_percentage) => {
|
|
34
|
+
YCalc::new(calc_length_percentage.clone()).into_value_with(ruby)
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
pub fn length(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
42
|
+
rb_self.length.get(ruby)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
impl DataTypeFunctions for YRadiusCircle {
|
|
47
|
+
fn mark(&self, marker: &Marker) {
|
|
48
|
+
self.length.mark(marker);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#[magnus::wrap(class = "Yass::Declarations::Image::ExtentCircle")]
|
|
53
|
+
pub struct YExtentCircle {
|
|
54
|
+
extent: ShapeExtent
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
impl YExtentCircle {
|
|
58
|
+
pub fn new(extent: ShapeExtent) -> Self {
|
|
59
|
+
Self { extent }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
pub fn extent(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
63
|
+
match rb_self.extent {
|
|
64
|
+
ShapeExtent::ClosestSide => ruby.intern("closest_side"),
|
|
65
|
+
ShapeExtent::FarthestSide => ruby.intern("farthest_side"),
|
|
66
|
+
ShapeExtent::ClosestCorner => ruby.intern("closest_corner"),
|
|
67
|
+
ShapeExtent::FarthestCorner => ruby.intern("farthest_corner"),
|
|
68
|
+
ShapeExtent::Contain => ruby.intern("contain"),
|
|
69
|
+
ShapeExtent::Cover => ruby.intern("cover"),
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, Value, gc::Marker, typed_data};
|
|
2
|
+
use style::{color::mix::ColorInterpolationMethod, values::{generics::image::{GradientFlags, GradientItem}, specified::{Angle, AngleOrPercentage, Color, image::Gradient, position::Position}}};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, cached_value_list::CachedValueList, declarations::{angle::YAngle, color::color_interpolation_method::YColorInterpolationMethod, images::{gradient_angle_or_percentage_item, position::YImagePosition}}};
|
|
5
|
+
|
|
6
|
+
#[derive(magnus::TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Image::ConicGradient", mark)]
|
|
8
|
+
pub struct YConicGradient {
|
|
9
|
+
angle: CachedValue<Angle>,
|
|
10
|
+
position: CachedValue<Position>,
|
|
11
|
+
color_interpolation_method: CachedValue<ColorInterpolationMethod>,
|
|
12
|
+
items: CachedValueList<GradientItem<Color, AngleOrPercentage>>,
|
|
13
|
+
repeating: bool,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
impl YConicGradient {
|
|
17
|
+
pub fn new(gradient: Gradient) -> Self {
|
|
18
|
+
match gradient {
|
|
19
|
+
Gradient::Conic {
|
|
20
|
+
angle,
|
|
21
|
+
position,
|
|
22
|
+
color_interpolation_method,
|
|
23
|
+
items,
|
|
24
|
+
flags,
|
|
25
|
+
} => Self {
|
|
26
|
+
angle: CachedValue::new(angle, |angle, ruby| {
|
|
27
|
+
YAngle::new(*angle).into_value_with(ruby)
|
|
28
|
+
}),
|
|
29
|
+
|
|
30
|
+
position: CachedValue::new(position, |position, ruby| {
|
|
31
|
+
YImagePosition::new(position.clone()).into_value_with(ruby)
|
|
32
|
+
}),
|
|
33
|
+
|
|
34
|
+
color_interpolation_method: CachedValue::new(
|
|
35
|
+
color_interpolation_method,
|
|
36
|
+
|method, ruby| {
|
|
37
|
+
YColorInterpolationMethod::new(*method).into_value_with(ruby)
|
|
38
|
+
},
|
|
39
|
+
),
|
|
40
|
+
|
|
41
|
+
items: CachedValueList::new(items.to_vec(), |item, _ctx, ruby| {
|
|
42
|
+
gradient_angle_or_percentage_item::make_gradient_angle_or_percentage_item(item, ruby)
|
|
43
|
+
}),
|
|
44
|
+
|
|
45
|
+
repeating: flags.contains(GradientFlags::REPEATING),
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
_ => unreachable!("expected conic gradient"),
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
pub fn repeating(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
53
|
+
rb_self.repeating
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
pub fn angle(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
57
|
+
rb_self.angle.get(ruby)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
pub fn position(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
61
|
+
rb_self.position.get(ruby)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
pub fn color_interpolation_method(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
65
|
+
rb_self.color_interpolation_method.get(ruby)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pub fn items(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
69
|
+
rb_self.items.to_a(ruby)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
impl DataTypeFunctions for YConicGradient {
|
|
74
|
+
fn mark(&self, marker: &Marker) {
|
|
75
|
+
self.angle.mark(marker);
|
|
76
|
+
self.position.mark(marker);
|
|
77
|
+
self.color_interpolation_method.mark(marker);
|
|
78
|
+
self.items.mark(marker);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, TypedData, gc::Marker, typed_data};
|
|
2
|
+
use style::values::specified::image::{CrossFade, CrossFadeElement};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value_list::CachedValueList, declarations::images::cross_fade_element::YCrossFadeElement};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Image::CrossFade", mark)]
|
|
8
|
+
pub struct YCrossFade {
|
|
9
|
+
elements: CachedValueList<CrossFadeElement>,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl YCrossFade {
|
|
13
|
+
pub fn new(cross_fade: CrossFade) -> Self {
|
|
14
|
+
Self {
|
|
15
|
+
elements: CachedValueList::new(
|
|
16
|
+
cross_fade.elements.to_vec(),
|
|
17
|
+
|element, _ctx, ruby| {
|
|
18
|
+
YCrossFadeElement::new(element.clone()).into_value_with(ruby)
|
|
19
|
+
},
|
|
20
|
+
),
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
pub fn elements(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
25
|
+
rb_self.elements.to_a(ruby)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
impl DataTypeFunctions for YCrossFade {
|
|
30
|
+
fn mark(&self, marker: &Marker) {
|
|
31
|
+
self.elements.mark(marker);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, Value, gc::Marker, typed_data};
|
|
2
|
+
use style::values::specified::{Percentage, image::{CrossFadeElement, CrossFadeImage}};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::{images::cross_fade_image::make_cross_fade_image, percentage::YPercentage}};
|
|
5
|
+
|
|
6
|
+
#[derive(magnus::TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Image::CrossFadeElement", mark)]
|
|
8
|
+
pub struct YCrossFadeElement {
|
|
9
|
+
percent: CachedValue<Option<Percentage>>,
|
|
10
|
+
image: CachedValue<CrossFadeImage>,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
impl YCrossFadeElement {
|
|
14
|
+
pub fn new(element: CrossFadeElement) -> Self {
|
|
15
|
+
Self {
|
|
16
|
+
percent: CachedValue::new(element.percent.into_rust(), |percent, ruby| match percent {
|
|
17
|
+
Some(percent) => {
|
|
18
|
+
YPercentage::new(percent.get()).into_value_with(ruby)
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
22
|
+
}),
|
|
23
|
+
|
|
24
|
+
image: CachedValue::new(element.image, |image, ruby| {
|
|
25
|
+
make_cross_fade_image(image, ruby).into_value_with(ruby)
|
|
26
|
+
}),
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
pub fn percent(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
31
|
+
rb_self.percent.get(ruby)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
pub fn image(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
35
|
+
rb_self.image.get(ruby)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
impl DataTypeFunctions for YCrossFadeElement {
|
|
40
|
+
fn mark(&self, marker: &Marker) {
|
|
41
|
+
self.percent.mark(marker);
|
|
42
|
+
self.image.mark(marker);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc::Marker, typed_data};
|
|
2
|
+
use style::values::specified::{Color, Image, image::CrossFadeImage};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::{color::color::make_color, images::image_to_value}};
|
|
5
|
+
|
|
6
|
+
pub fn make_cross_fade_image(image: &CrossFadeImage, ruby: &Ruby) -> Value {
|
|
7
|
+
match image {
|
|
8
|
+
CrossFadeImage::Image(image) => {
|
|
9
|
+
YCrossFadeImage::new(image.clone()).into_value_with(ruby)
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
CrossFadeImage::Color(color) => {
|
|
13
|
+
YCrossFadeColor::new(color.clone()).into_value_with(ruby)
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[derive(TypedData)]
|
|
19
|
+
#[magnus(class = "Yass::Declarations::Image::CrossFadeImage", mark)]
|
|
20
|
+
pub struct YCrossFadeImage {
|
|
21
|
+
image: CachedValue<Image>,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
impl YCrossFadeImage {
|
|
25
|
+
pub fn new(image: Image) -> Self {
|
|
26
|
+
Self {
|
|
27
|
+
image: CachedValue::new(image, |image, ruby| {
|
|
28
|
+
image_to_value(image, ruby)
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pub fn image(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
34
|
+
rb_self.image.get(ruby)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
impl DataTypeFunctions for YCrossFadeImage {
|
|
39
|
+
fn mark(&self, marker: &Marker) {
|
|
40
|
+
self.image.mark(marker);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#[derive(TypedData)]
|
|
45
|
+
#[magnus(class = "Yass::Declarations::Image::CrossFadeColor", mark)]
|
|
46
|
+
pub struct YCrossFadeColor {
|
|
47
|
+
color: CachedValue<Color>,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
impl YCrossFadeColor {
|
|
51
|
+
pub fn new(color: Color) -> Self {
|
|
52
|
+
Self {
|
|
53
|
+
color: CachedValue::new(color, |color, ruby| {
|
|
54
|
+
make_color(color, ruby)
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
pub fn color(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
60
|
+
rb_self.color.get(ruby)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
impl DataTypeFunctions for YCrossFadeColor {
|
|
65
|
+
fn mark(&self, marker: &Marker) {
|
|
66
|
+
self.color.mark(marker);
|
|
67
|
+
}
|
|
68
|
+
}
|