Browse Source

Fix some warnings

Michael Ragazzon 6 years ago
parent
commit
5f9323a85d

+ 4 - 4
Samples/basic/demo/data/demo.rml

@@ -217,9 +217,9 @@ p.emojis
 .fit-cover      { decorator: image( icon-invader cover      ); }
 .fit-cover      { decorator: image( icon-invader cover      ); }
 .fit-scale-none { decorator: image( icon-invader scale-none ); }
 .fit-scale-none { decorator: image( icon-invader scale-none ); }
 .fit-scale-down { decorator: image( icon-invader scale-down ); }
 .fit-scale-down { decorator: image( icon-invader scale-down ); }
-.orientation-vertical   { decorator: image( icon-invader flip-vertical   scale-none bottom ); }
-.orientation-horizontal { decorator: image( icon-invader flip-horizontal scale-none bottom ); }
-.orientation-rotate     { decorator: image( icon-invader rotate-180      scale-none bottom ); }
+.orientation-vertical   { decorator: image( icon-invader flip-vertical   scale-none ); }
+.orientation-horizontal { decorator: image( icon-invader flip-horizontal scale-none ); }
+.orientation-rotate     { decorator: image( icon-invader rotate-180      scale-none ); }
 
 
 
 
 /***  Animations  ***/
 /***  Animations  ***/
@@ -452,7 +452,7 @@ form h2
 	</div>
 	</div>
 	
 	
 	<h1>Image decorator</h1>
 	<h1>Image decorator</h1>
-	<p>The 'image' decorator applies and image to the background of an element. By default it stretches the image to the size of the element, but this behavior can be controlled as seen later on.</p>
+	<p>The 'image' decorator applies an image to the background of an element. By default it stretches the image to the size of the element, but this behavior can be controlled as seen later on.</p>
 	<div class="center">
 	<div class="center">
 		<div class="side-by-side">
 		<div class="side-by-side">
 			<div class="image-alien clickable" onclick="change_color"/>
 			<div class="image-alien clickable" onclick="change_color"/>

+ 1 - 2
Source/Core/Element.cpp

@@ -105,8 +105,7 @@ static Pool< ElementMeta > element_meta_chunk_pool(200, true);
 
 
 /// Constructs a new RmlUi element.
 /// Constructs a new RmlUi element.
 Element::Element(const String& tag) : tag(tag), relative_offset_base(0, 0), relative_offset_position(0, 0), absolute_offset(0, 0), scroll_offset(0, 0), content_offset(0, 0), content_box(0, 0), 
 Element::Element(const String& tag) : tag(tag), relative_offset_base(0, 0), relative_offset_position(0, 0), absolute_offset(0, 0), scroll_offset(0, 0), content_offset(0, 0), content_box(0, 0), 
-transform_state(), dirty_transform(false), dirty_perspective(false), dirty_animation(false), dirty_transition(false),
-EnableObserverPtr<Element>()
+transform_state(), dirty_transform(false), dirty_perspective(false), dirty_animation(false), dirty_transition(false)
 {
 {
 	RMLUI_ASSERT(tag == StringUtilities::ToLower(tag));
 	RMLUI_ASSERT(tag == StringUtilities::ToLower(tag));
 	parent = nullptr;
 	parent = nullptr;

+ 0 - 2
Source/Core/ElementAnimation.cpp

@@ -221,7 +221,6 @@ static PrepareTransformResult PrepareTransformPair(Transform& t0, Transform& t1,
 		for (size_t i_small = 0; i_small < small.size(); i_small++)
 		for (size_t i_small = 0; i_small < small.size(); i_small++)
 		{
 		{
 			match_success = false;
 			match_success = false;
-			auto small_type = small[i_small].primitive.type;
 
 
 			for (; i_big < big.size(); i_big++)
 			for (; i_big < big.size(); i_big++)
 			{
 			{
@@ -297,7 +296,6 @@ static bool PrepareTransforms(std::vector<AnimationKey>& keys, Element& element,
 	// Prepare each transform individually.
 	// Prepare each transform individually.
 	for (int i = start_index; i < (int)keys.size(); i++)
 	for (int i = start_index; i < (int)keys.size(); i++)
 	{
 	{
-		AnimationKey& key = keys[i];
 		Property& property = keys[i].property;
 		Property& property = keys[i].property;
 
 
 		if (!property.value.GetReference<TransformPtr>())
 		if (!property.value.GetReference<TransformPtr>())

+ 11 - 17
Source/Core/StyleSheetNode.cpp

@@ -36,24 +36,21 @@
 namespace Rml {
 namespace Rml {
 namespace Core {
 namespace Core {
 
 
-StyleSheetNode::StyleSheetNode() : parent(nullptr), child_combinator(false)
+StyleSheetNode::StyleSheetNode()
 {
 {
-	specificity = CalculateSpecificity();
-	is_structurally_volatile = true;
+	CalculateAndSetSpecificity();
 }
 }
 
 
 StyleSheetNode::StyleSheetNode(StyleSheetNode* parent, const String& tag, const String& id, const StringList& classes, const StringList& pseudo_classes, const StructuralSelectorList& structural_selectors, bool child_combinator)
 StyleSheetNode::StyleSheetNode(StyleSheetNode* parent, const String& tag, const String& id, const StringList& classes, const StringList& pseudo_classes, const StructuralSelectorList& structural_selectors, bool child_combinator)
 	: parent(parent), tag(tag), id(id), class_names(classes), pseudo_class_names(pseudo_classes), structural_selectors(structural_selectors), child_combinator(child_combinator)
 	: parent(parent), tag(tag), id(id), class_names(classes), pseudo_class_names(pseudo_classes), structural_selectors(structural_selectors), child_combinator(child_combinator)
 {
 {
-	specificity = CalculateSpecificity();
-	is_structurally_volatile = true;
+	CalculateAndSetSpecificity();
 }
 }
 
 
 StyleSheetNode::StyleSheetNode(StyleSheetNode* parent, String&& tag, String&& id, StringList&& classes, StringList&& pseudo_classes, StructuralSelectorList&& structural_selectors, bool child_combinator)
 StyleSheetNode::StyleSheetNode(StyleSheetNode* parent, String&& tag, String&& id, StringList&& classes, StringList&& pseudo_classes, StructuralSelectorList&& structural_selectors, bool child_combinator)
 	: parent(parent), tag(std::move(tag)), id(std::move(id)), class_names(std::move(classes)), pseudo_class_names(std::move(pseudo_classes)), structural_selectors(std::move(structural_selectors)), child_combinator(child_combinator)
 	: parent(parent), tag(std::move(tag)), id(std::move(id)), class_names(std::move(classes)), pseudo_class_names(std::move(pseudo_classes)), structural_selectors(std::move(structural_selectors)), child_combinator(child_combinator)
 {
 {
-	specificity = CalculateSpecificity();
-	is_structurally_volatile = true;
+	CalculateAndSetSpecificity();
 }
 }
 
 
 StyleSheetNode* StyleSheetNode::GetOrCreateChildNode(const StyleSheetNode& other)
 StyleSheetNode* StyleSheetNode::GetOrCreateChildNode(const StyleSheetNode& other)
@@ -312,28 +309,25 @@ bool StyleSheetNode::IsStructurallyVolatile() const
 }
 }
 
 
 
 
-int StyleSheetNode::CalculateSpecificity()
+void StyleSheetNode::CalculateAndSetSpecificity()
 {
 {
 	// Calculate the specificity of just this node; tags are worth 10,000, IDs 1,000,000 and other specifiers (classes
 	// Calculate the specificity of just this node; tags are worth 10,000, IDs 1,000,000 and other specifiers (classes
 	// and pseudo-classes) 100,000.
 	// and pseudo-classes) 100,000.
-
-	int specificity = 0;
+	specificity = 0;
 
 
 	if (!tag.empty())
 	if (!tag.empty())
-		specificity += 10000;
+		specificity += 10'000;
 
 
 	if (!id.empty())
 	if (!id.empty())
-		specificity += 1000000;
+		specificity += 1'000'000;
 
 
-	specificity += 100000*(int)class_names.size();
-	specificity += 100000*(int)pseudo_class_names.size();
-	specificity += 100000*(int)structural_selectors.size();
+	specificity += 100'000*(int)class_names.size();
+	specificity += 100'000*(int)pseudo_class_names.size();
+	specificity += 100'000*(int)structural_selectors.size();
 
 
 	// Add our parent's specificity onto ours.
 	// Add our parent's specificity onto ours.
 	if (parent)
 	if (parent)
 		specificity += parent->specificity;
 		specificity += parent->specificity;
-
-	return specificity;
 }
 }
 
 
 }
 }

+ 5 - 5
Source/Core/StyleSheetNode.h

@@ -100,7 +100,7 @@ private:
 	// Returns true if the requirements of this node equals the given arguments.
 	// Returns true if the requirements of this node equals the given arguments.
 	bool EqualRequirements(const String& tag, const String& id, const StringList& classes, const StringList& pseudo_classes, const StructuralSelectorList& structural_pseudo_classes, bool child_combinator) const;
 	bool EqualRequirements(const String& tag, const String& id, const StringList& classes, const StringList& pseudo_classes, const StructuralSelectorList& structural_pseudo_classes, bool child_combinator) const;
 
 
-	int CalculateSpecificity();
+	void CalculateAndSetSpecificity();
 
 
 	// Match an element to the local node requirements.
 	// Match an element to the local node requirements.
 	inline bool Match(const Element* element) const;
 	inline bool Match(const Element* element) const;
@@ -108,7 +108,7 @@ private:
 	inline bool MatchStructuralSelector(const Element* element) const;
 	inline bool MatchStructuralSelector(const Element* element) const;
 
 
 	// The parent of this node; is nullptr for the root node.
 	// The parent of this node; is nullptr for the root node.
-	StyleSheetNode* parent;
+	StyleSheetNode* parent = nullptr;
 
 
 	// Node requirements
 	// Node requirements
 	String tag;
 	String tag;
@@ -116,14 +116,14 @@ private:
 	StringList class_names;
 	StringList class_names;
 	StringList pseudo_class_names;
 	StringList pseudo_class_names;
 	StructuralSelectorList structural_selectors; // Represents structural pseudo classes
 	StructuralSelectorList structural_selectors; // Represents structural pseudo classes
-	bool child_combinator; // The '>' combinator: This node only matches if the element is a parent of the previous matching element.
+	bool child_combinator = false; // The '>' combinator: This node only matches if the element is a parent of the previous matching element.
 
 
 	// True if any ancestor, descendent, or self is a structural pseudo class.
 	// True if any ancestor, descendent, or self is a structural pseudo class.
-	bool is_structurally_volatile;
+	bool is_structurally_volatile = true;
 
 
 	// A measure of specificity of this node; the attribute in a node with a higher value will override those of a
 	// A measure of specificity of this node; the attribute in a node with a higher value will override those of a
 	// node with a lower value.
 	// node with a lower value.
-	int specificity;
+	int specificity = 0;
 
 
 	PropertyDictionary properties;
 	PropertyDictionary properties;