mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-06-05 04:56:31 +03:00
Optimizing CSS vars
This commit is contained in:
@@ -15,7 +15,7 @@ namespace EE { namespace UI { namespace CSS {
|
||||
class EE_API AnimationDefinition {
|
||||
public:
|
||||
static std::unordered_map<std::string, AnimationDefinition>
|
||||
parseAnimationProperties( const std::vector<StyleSheetProperty>& stylesheetProperties );
|
||||
parseAnimationProperties( const std::vector<const StyleSheetProperty*>& stylesheetProperties );
|
||||
|
||||
/* https://developer.mozilla.org/en-US/docs/Web/CSS/animation-direction */
|
||||
enum AnimationDirection {
|
||||
|
||||
@@ -25,6 +25,11 @@ namespace EE { namespace UI { namespace CSS {
|
||||
class PropertyDefinition;
|
||||
class ShorthandDefinition;
|
||||
|
||||
struct VariableFunctionCache {
|
||||
std::string definition;
|
||||
std::vector<std::string> variableList;
|
||||
};
|
||||
|
||||
class EE_API StyleSheetProperty {
|
||||
public:
|
||||
StyleSheetProperty();
|
||||
@@ -167,6 +172,8 @@ class EE_API StyleSheetProperty {
|
||||
|
||||
const Uint32& getValueHash() const;
|
||||
|
||||
const std::vector<VariableFunctionCache>& getVarCache() const;
|
||||
|
||||
protected:
|
||||
std::string mName;
|
||||
Uint32 mNameHash;
|
||||
@@ -180,6 +187,7 @@ class EE_API StyleSheetProperty {
|
||||
const PropertyDefinition* mPropertyDefinition;
|
||||
const ShorthandDefinition* mShorthandDefinition;
|
||||
std::vector<StyleSheetProperty> mIndexedProperty;
|
||||
std::vector<VariableFunctionCache> mVarCache;
|
||||
|
||||
explicit StyleSheetProperty( const bool& isVolatile, const PropertyDefinition* definition,
|
||||
const std::string& value, const Uint32& specificity = 0,
|
||||
@@ -188,6 +196,8 @@ class EE_API StyleSheetProperty {
|
||||
void cleanValue();
|
||||
void checkImportant();
|
||||
void createIndexed();
|
||||
void checkVars();
|
||||
std::vector<VariableFunctionCache> checkVars( const std::string& value );
|
||||
};
|
||||
|
||||
typedef std::map<Uint32, StyleSheetProperty> StyleSheetProperties;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace EE { namespace UI { namespace CSS {
|
||||
class EE_API TransitionDefinition {
|
||||
public:
|
||||
static std::map<std::string, TransitionDefinition>
|
||||
parseTransitionProperties( const std::vector<StyleSheetProperty>& styleSheetProperties );
|
||||
parseTransitionProperties( const std::vector<const StyleSheetProperty*>& styleSheetProperties );
|
||||
|
||||
TransitionDefinition() : timingFunction( Ease::Linear ) {}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ class EE_API UIStyle : public UIState {
|
||||
void setDisableAnimations( bool disableAnimations );
|
||||
|
||||
const bool& isStructurallyVolatile() const;
|
||||
|
||||
protected:
|
||||
UIWidget* mWidget;
|
||||
CSS::StyleSheetStyleVector mCacheableStyles;
|
||||
@@ -71,8 +72,8 @@ class EE_API UIStyle : public UIState {
|
||||
CSS::StyleSheetStyle mElementStyle;
|
||||
CSS::StyleSheetProperties mProperties;
|
||||
CSS::StyleSheetVariables mVariables;
|
||||
std::vector<CSS::StyleSheetProperty> mTransitionProperties;
|
||||
std::vector<CSS::StyleSheetProperty> mAnimationProperties;
|
||||
std::vector<const CSS::StyleSheetProperty*> mTransitionProperties;
|
||||
std::vector<const CSS::StyleSheetProperty*> mAnimationProperties;
|
||||
CSS::TransitionsMap mTransitions;
|
||||
CSS::AnimationsMap mAnimations;
|
||||
std::set<UIWidget*> mRelatedWidgets;
|
||||
@@ -117,8 +118,6 @@ class EE_API UIStyle : public UIState {
|
||||
|
||||
void removeAnimation( const CSS::PropertyDefinition* propertyDefinition,
|
||||
const Uint32& propertyIndex );
|
||||
|
||||
std::string varToVal( const std::string& varDef );
|
||||
};
|
||||
|
||||
}} // namespace EE::UI
|
||||
|
||||
Reference in New Issue
Block a user