1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_KeyframeEffectParams_h 8 #define mozilla_KeyframeEffectParams_h 9 10 #include "nsCSSProps.h" 11 #include "nsString.h" 12 // X11 has a #define for None 13 #ifdef None 14 #undef None 15 #endif 16 #include "mozilla/dom/KeyframeEffectBinding.h" // IterationCompositeOperation 17 18 namespace mozilla { 19 20 class ErrorResult; 21 22 enum class SpacingMode 23 { 24 distribute, 25 paced 26 }; 27 28 struct KeyframeEffectParams 29 { GetSpacingAsStringKeyframeEffectParams30 void GetSpacingAsString(nsAString& aSpacing) const 31 { 32 if (mSpacingMode == SpacingMode::distribute) { 33 aSpacing.AssignLiteral("distribute"); 34 } else { 35 aSpacing.AssignLiteral("paced("); 36 aSpacing.AppendASCII(nsCSSProps::GetStringValue(mPacedProperty).get()); 37 aSpacing.AppendLiteral(")"); 38 } 39 } 40 41 /** 42 * Parse spacing string. 43 * 44 * @param aSpacing The input spacing string. 45 * @param [out] aSpacingMode The parsed spacing mode. 46 * @param [out] aPacedProperty The parsed CSS property if using paced spacing. 47 * @param [out] aInvalidPacedProperty A string that, if we parsed a string of 48 * the form 'paced(<ident>)' where <ident> 49 * is not a recognized animatable property, 50 * will be set to <ident>. 51 * @param [out] aRv The error result. 52 */ 53 static void ParseSpacing(const nsAString& aSpacing, 54 SpacingMode& aSpacingMode, 55 nsCSSPropertyID& aPacedProperty, 56 nsAString& aInvalidPacedProperty, 57 ErrorResult& aRv); 58 59 dom::IterationCompositeOperation mIterationComposite = 60 dom::IterationCompositeOperation::Replace; 61 // FIXME: Bug 1216844: Add CompositeOperation 62 SpacingMode mSpacingMode = SpacingMode::distribute; 63 nsCSSPropertyID mPacedProperty = eCSSProperty_UNKNOWN; 64 }; 65 66 } // namespace mozilla 67 68 #endif // mozilla_KeyframeEffectParams_h 69