فهرست منبع

Rename method `Element::UpdateOffset` for clarity

Now use: `Element::UpdateRelativeOffsetFromInsetConstraints`
Michael Ragazzon 6 ماه پیش
والد
کامیت
854d283e8f
4فایلهای تغییر یافته به همراه9 افزوده شده و 7 حذف شده
  1. 2 1
      Include/RmlUi/Core/Element.h
  2. 4 4
      Source/Core/Element.cpp
  3. 2 1
      Source/Core/ElementHandle.cpp
  4. 1 1
      Source/Core/Layout/ContainerBox.cpp

+ 2 - 1
Include/RmlUi/Core/Element.h

@@ -690,7 +690,7 @@ private:
 	void DirtyAbsoluteOffset();
 	void DirtyAbsoluteOffset();
 	void DirtyAbsoluteOffsetRecursive();
 	void DirtyAbsoluteOffsetRecursive();
 	void UpdateAbsoluteOffsetAndRenderBoxData();
 	void UpdateAbsoluteOffsetAndRenderBoxData();
-	void UpdateOffset();
+	void UpdateRelativeOffsetFromInsetConstraints();
 	void SetBaseline(float baseline);
 	void SetBaseline(float baseline);
 
 
 	void BuildLocalStackingContext();
 	void BuildLocalStackingContext();
@@ -818,6 +818,7 @@ private:
 	friend class Rml::ReplacedBox;
 	friend class Rml::ReplacedBox;
 	friend class Rml::LayoutEngine;
 	friend class Rml::LayoutEngine;
 	friend class Rml::ElementScroll;
 	friend class Rml::ElementScroll;
+	friend class Rml::ElementDocument; // TODO: Remove
 	friend RMLUICORE_API void Rml::ReleaseFontResources();
 	friend RMLUICORE_API void Rml::ReleaseFontResources();
 };
 };
 
 

+ 4 - 4
Source/Core/Element.cpp

@@ -358,7 +358,7 @@ void Element::SetOffset(Vector2f offset, Element* _offset_parent, bool _offset_f
 		relative_offset_base = offset;
 		relative_offset_base = offset;
 		offset_fixed = _offset_fixed;
 		offset_fixed = _offset_fixed;
 		offset_parent = _offset_parent;
 		offset_parent = _offset_parent;
-		UpdateOffset();
+		UpdateRelativeOffsetFromInsetConstraints();
 		DirtyAbsoluteOffset();
 		DirtyAbsoluteOffset();
 	}
 	}
 
 
@@ -369,7 +369,7 @@ void Element::SetOffset(Vector2f offset, Element* _offset_parent, bool _offset_f
 		const Vector2f old_base = relative_offset_base;
 		const Vector2f old_base = relative_offset_base;
 		const Vector2f old_position = relative_offset_position;
 		const Vector2f old_position = relative_offset_position;
 
 
-		UpdateOffset();
+		UpdateRelativeOffsetFromInsetConstraints();
 
 
 		if (old_base != relative_offset_base || old_position != relative_offset_position)
 		if (old_base != relative_offset_base || old_position != relative_offset_position)
 			DirtyAbsoluteOffset();
 			DirtyAbsoluteOffset();
@@ -1834,7 +1834,7 @@ void Element::OnPropertyChange(const PropertyIdSet& changed_properties)
 	// Update the position.
 	// Update the position.
 	if (top_right_bottom_left_changed)
 	if (top_right_bottom_left_changed)
 	{
 	{
-		UpdateOffset();
+		UpdateRelativeOffsetFromInsetConstraints();
 		DirtyAbsoluteOffset();
 		DirtyAbsoluteOffset();
 	}
 	}
 
 
@@ -2206,7 +2206,7 @@ void Element::DirtyAbsoluteOffsetRecursive()
 		children[i]->DirtyAbsoluteOffsetRecursive();
 		children[i]->DirtyAbsoluteOffsetRecursive();
 }
 }
 
 
-void Element::UpdateOffset()
+void Element::UpdateRelativeOffsetFromInsetConstraints()
 {
 {
 	using namespace Style;
 	using namespace Style;
 	const auto& computed = meta->computed_values;
 	const auto& computed = meta->computed_values;

+ 2 - 1
Source/Core/ElementHandle.cpp

@@ -170,7 +170,8 @@ private:
 		return fallback_func();
 		return fallback_func();
 	}
 	}
 
 
-	// The following is derived at by solving the expressions in 'Element::UpdateOffset' for the computed top/left/bottom/right values.
+	// The following is derived at by solving the expressions in 'Element::UpdateRelativeOffsetFromInsetConstraints' for the computed
+	// top/left/bottom/right values.
 	float GetPositionTop() const
 	float GetPositionTop() const
 	{
 	{
 		return ResolveValueOrInvoke(computed.top(), containing_block.y, position, [&] {
 		return ResolveValueOrInvoke(computed.top(), containing_block.y, position, [&] {

+ 1 - 1
Source/Core/Layout/ContainerBox.cpp

@@ -127,7 +127,7 @@ void ContainerBox::ClosePositionedElements()
 	// updated to reflect changes to the size of this block box. Update relative offsets before handling absolute
 	// updated to reflect changes to the size of this block box. Update relative offsets before handling absolute
 	// elements, as this may affect the resolved static position of the absolute elements.
 	// elements, as this may affect the resolved static position of the absolute elements.
 	for (Element* child : relative_elements)
 	for (Element* child : relative_elements)
-		child->UpdateOffset();
+		child->UpdateRelativeOffsetFromInsetConstraints();
 
 
 	relative_elements.clear();
 	relative_elements.clear();