Browse Source

Make the font-effect property inherited

Michael Ragazzon 6 years ago
parent
commit
01b3af99f2

+ 1 - 1
Include/RmlUi/Core/FontEffectInstancer.h

@@ -55,7 +55,7 @@ public:
 	virtual ~FontEffectInstancer();
 	virtual ~FontEffectInstancer();
 
 
 	/// Instances a font effect given the property tag and attributes from the RCSS file.
 	/// Instances a font effect given the property tag and attributes from the RCSS file.
-	/// @param[in] name The type of font effect desired. For example, "title-font-effect: outline;" is declared as type "outline".
+	/// @param[in] name The type of font effect desired. For example, "font-effect: outline(1px black);" is declared as type "outline".
 	/// @param[in] properties All RCSS properties associated with the font effect.
 	/// @param[in] properties All RCSS properties associated with the font effect.
 	/// @param[in] interface An interface for querying the active style sheet.
 	/// @param[in] interface An interface for querying the active style sheet.
 	/// @return A shared_ptr to the font-effect if it was instanced successfully.
 	/// @return A shared_ptr to the font-effect if it was instanced successfully.

+ 2 - 3
Samples/assets/invader.rcss

@@ -244,9 +244,8 @@ input.submit
 button:focus,
 button:focus,
 input.submit:focus
 input.submit:focus
 {
 {
-    font-weight: bold;
-    
-    font-effect: shadow(1px 1px black);
+	font-weight: bold;
+	font-effect: shadow(1px 1px black);
 }
 }
 
 
 button:hover,
 button:hover,

+ 2 - 0
Source/Core/ElementStyle.cpp

@@ -635,6 +635,8 @@ DirtyPropertyList ElementStyle::ComputeValues(Style::ComputedValues& values, con
 		values.focus = parent_values->focus;
 		values.focus = parent_values->focus;
 
 
 		values.pointer_events = parent_values->pointer_events;
 		values.pointer_events = parent_values->pointer_events;
+		
+		values.font_effect = parent_values->font_effect;
 	}
 	}
 
 
 
 

+ 2 - 2
Source/Core/ElementTextDefault.cpp

@@ -382,8 +382,8 @@ bool ElementTextDefault::UpdateFontConfiguration()
 
 
 	static const FontEffectList empty_font_effects;
 	static const FontEffectList empty_font_effects;
 
 
-	// Our parent defines the font-effect for this text element
-	const FontEffectList* font_effects = parent->GetComputedValues().font_effect.get();
+	// Fetch the font-effect for this text element
+	const FontEffectList* font_effects = GetComputedValues().font_effect.get();
 	if (!font_effects)
 	if (!font_effects)
 		font_effects = &empty_font_effects;
 		font_effects = &empty_font_effects;
 
 

+ 1 - 1
Source/Core/StyleSheetSpecification.cpp

@@ -378,7 +378,7 @@ void StyleSheetSpecification::RegisterDefaultProperties()
 	RegisterProperty(PropertyId::Animation, ANIMATION, "none", false, false).AddParser(ANIMATION);
 	RegisterProperty(PropertyId::Animation, ANIMATION, "none", false, false).AddParser(ANIMATION);
 
 
 	RegisterProperty(PropertyId::Decorator, "decorator", "", false, false).AddParser("string");
 	RegisterProperty(PropertyId::Decorator, "decorator", "", false, false).AddParser("string");
-	RegisterProperty(PropertyId::FontEffect, "font-effect", "", false, false).AddParser("string");
+	RegisterProperty(PropertyId::FontEffect, "font-effect", "", true, false).AddParser("string");
 
 
 	instance->properties.property_map.AssertAllInserted(PropertyId::NumDefinedIds);
 	instance->properties.property_map.AssertAllInserted(PropertyId::NumDefinedIds);
 	instance->properties.shorthand_map.AssertAllInserted(ShorthandId::NumDefinedIds);
 	instance->properties.shorthand_map.AssertAllInserted(ShorthandId::NumDefinedIds);

+ 1 - 1
readme.md

@@ -137,7 +137,7 @@ font-effect: outline( 5px #f66 );
 font-effect: shadow( 2px 2px #333 );
 font-effect: shadow( 2px 2px #333 );
 ```
 ```
 
 
-The `font-effect` property follows the normal cascading rules, is non-inherited (subject to feedback), and has the default value `none` which specifies no font-effect on the element. Unlike in libRocket, font-effects can now be set on the element's style, although we recommend declaring them in style sheets for performance reasons.
+The `font-effect` property follows the normal cascading rules, is inherited, and has the default value `none` which specifies no font-effect on the element. Unlike in libRocket, font-effects can now be set on the element's style, although we recommend declaring them in style sheets for performance reasons.
 
 
 Furthermore, multiple font-effects can be specified on any element by a comma-separated list of font-effects.
 Furthermore, multiple font-effects can be specified on any element by a comma-separated list of font-effects.
 ```CSS
 ```CSS