Browse Source

Minor layout details cleanup

Michael Ragazzon 2 years ago
parent
commit
6cbf961aad
2 changed files with 6 additions and 5 deletions
  1. 4 3
      Source/Core/Layout/LayoutDetails.cpp
  2. 2 2
      Source/Core/Layout/LayoutDetails.h

+ 4 - 3
Source/Core/Layout/LayoutDetails.cpp

@@ -186,10 +186,11 @@ ContainingBlock LayoutDetails::GetContainingBlock(ContainerBox* parent_container
 	{
 		area = BoxArea::Padding;
 
-		auto EstablishesAbsoluteContainingBlock = [](ContainerBox* container) -> bool {
+		auto EstablishesAbsoluteContainingBlock = [](const ContainerBox* container) -> bool {
 			return container->GetPositionProperty() != Position::Static || container->HasLocalTransformOrPerspective();
 		};
-		while (container && container->GetParent() && !EstablishesAbsoluteContainingBlock(container))
+
+		while (!EstablishesAbsoluteContainingBlock(container) && container->GetParent())
 			container = container->GetParent();
 	}
 
@@ -530,7 +531,7 @@ void LayoutDetails::BuildBoxHeight(Box& box, const ComputedValues& computed, flo
 	// If the height is set to auto, we need to calculate the height.
 	if (height_auto)
 	{
-		// If the height is set to auto for a box in normal flow, the height is set to -1.
+		// If the height is set to auto for a box in normal flow, the height is set to -1, representing indefinite height.
 		content_area.y = -1;
 
 		// But if we are dealing with an absolutely positioned element we need to consider if the top and bottom

+ 2 - 2
Source/Core/Layout/LayoutDetails.h

@@ -89,8 +89,8 @@ public:
 
 	/// Returns the containing block for a box.
 	/// @param[in] parent_container The parent container of the current box.
-	/// @param[in] child_position The position property of the current box.
-	/// @return The containing block box and size, possibly indefinite along one or both axes.
+	/// @param[in] position The position property of the current box.
+	/// @return The containing block box and size, possibly indefinite (represented by negative size) along one or both axes.
 	static ContainingBlock GetContainingBlock(ContainerBox* parent_container, Style::Position position);
 
 	/// Builds margins of a Box, and resolves any auto width or height for non-inline elements. The height may be left unresolved if it depends on the