Browse Source

Ignore dirtied layout during document formatting. Layouting must not require re-iteration.

Previously it could be dirtied when enabling scrollbars, but this case is already handled in the layout engine. This resulted in layouting being done twice with no effect.
Michael Ragazzon 5 years ago
parent
commit
f3287b50bb
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Source/Core/ElementDocument.cpp

+ 4 - 2
Source/Core/ElementDocument.cpp

@@ -370,13 +370,15 @@ void ElementDocument::UpdateLayout()
 		RMLUI_ZoneScoped;
 		RMLUI_ZoneText(source_url.c_str(), source_url.size());
 
-		layout_dirty = false;
-
 		Vector2f containing_block(0, 0);
 		if (GetParentNode() != nullptr)
 			containing_block = GetParentNode()->GetBox().GetSize();
 
 		LayoutEngine::FormatElement(this, containing_block);
+
+		// Ignore dirtied layout during document formatting. Layouting must not require re-iteration.
+		// In particular, scrollbars being enabled may set the dirty flag, but this case is already handled within the layout engine.
+		layout_dirty = false;
 	}
 }