mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:02:44 +00:00 
			
		
		
		
	LibWeb: Add helpers to convert between FillMode and Direction enums
This commit is contained in:
		
							parent
							
								
									c9234f35f1
								
							
						
					
					
						commit
						35859c0467
					
				
					 2 changed files with 38 additions and 2 deletions
				
			
		|  | @ -1,5 +1,5 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org> | ||||
|  * Copyright (c) 2023-2024, Matthew Olsson <mattco@serenityos.org> | ||||
|  * | ||||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
|  | @ -16,6 +16,38 @@ namespace Web::Animations { | |||
| 
 | ||||
| JS_DEFINE_ALLOCATOR(AnimationEffect); | ||||
| 
 | ||||
| Bindings::FillMode css_fill_mode_to_bindings_fill_mode(CSS::AnimationFillMode mode) | ||||
| { | ||||
|     switch (mode) { | ||||
|     case CSS::AnimationFillMode::Backwards: | ||||
|         return Bindings::FillMode::Backwards; | ||||
|     case CSS::AnimationFillMode::Both: | ||||
|         return Bindings::FillMode::Both; | ||||
|     case CSS::AnimationFillMode::Forwards: | ||||
|         return Bindings::FillMode::Forwards; | ||||
|     case CSS::AnimationFillMode::None: | ||||
|         return Bindings::FillMode::None; | ||||
|     default: | ||||
|         VERIFY_NOT_REACHED(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| Bindings::PlaybackDirection css_animation_direction_to_bindings_playback_direction(CSS::AnimationDirection direction) | ||||
| { | ||||
|     switch (direction) { | ||||
|     case CSS::AnimationDirection::Alternate: | ||||
|         return Bindings::PlaybackDirection::Alternate; | ||||
|     case CSS::AnimationDirection::AlternateReverse: | ||||
|         return Bindings::PlaybackDirection::AlternateReverse; | ||||
|     case CSS::AnimationDirection::Normal: | ||||
|         return Bindings::PlaybackDirection::Normal; | ||||
|     case CSS::AnimationDirection::Reverse: | ||||
|         return Bindings::PlaybackDirection::Reverse; | ||||
|     default: | ||||
|         VERIFY_NOT_REACHED(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| JS::NonnullGCPtr<AnimationEffect> AnimationEffect::create(JS::Realm& realm) | ||||
| { | ||||
|     return realm.heap().allocate<AnimationEffect>(realm, realm); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Matthew Olsson
						Matthew Olsson