Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flex formatting context triggered unexpected assert initial_box_size.y < 0 #640

Closed
AdjWang opened this issue Jul 24, 2024 · 2 comments
Closed
Labels
layout Layout engine issues and enhancements

Comments

@AdjWang
Copy link

AdjWang commented Jul 24, 2024

Hi, I encountered an assertion stops interpreting the flex style, I'm not sure whether this is a bug.

Here's a minimal code snippet to reproduce the issue. Replace Samples\tutorial\template\data\tutorial.rml content as follow:

<rml>
<head>
	<title>Window</title>
	<style>
		body {
			font-family: LatoLatin;
			left: 0;
			top: 0;
			height: 768px;
			width: 100%;
		}
		#dialog {
			display: flex;
			width: 100%;
			height: 100%;
			justify-content: space-between;
		}
		#background {
			flex-direction: column;
			flex-grow: 1;
			width: 100%;
			height: 100%;
			border: 1px;
		}
		#sidebar {
			position: relative;
			width: 100px;
			height: 100vh;
			display: flex;
			flex-direction: column;
			border: 1px;
		}
		#temp-img {
			width: 10px;
		}
	</style>
</head>
<body>
	<div id="dialog">
		<div id="background">bkg</div>
		<div id="sidebar">
			<img id="temp-img" src="../../../assets/alien_small.tga" />
		</div>
	</div>
</body>
</rml>

The rmlui_tutorial_template.exe triggeres an assertion RMLUI_ASSERT(initial_box_size.y < 0.f);

RMLUI_ASSERT(initial_box_size.y < 0.f);

Delete this line seems work.

The git node:

git log -1
commit 51af29b1b34c3d8c6b1790385e6584f004cfe3a9 (HEAD -> master, origin/master, origin/HEAD)
Author: Michael Ragazzon <michael.ragazzon@gmail.com>
Date:   Sun Jul 14 18:24:36 2024 +0200

    Defer scroll offset clamping to after layout, fixes #452
@mikke89 mikke89 added the layout Layout engine issues and enhancements label Jul 24, 2024
@mikke89
Copy link
Owner

mikke89 commented Jul 24, 2024

Hi, and thanks for reporting.

This assertion shouldn't trigger during normal layouting, so it looks like a bug. I will take a look at it. If the layout looks right, then I don't think this particular one should cause any other issues though.

@mikke89
Copy link
Owner

mikke89 commented Jul 25, 2024

I believe I found a fix for this. This had to do with us not considering the intrinsic aspect ratio of the image used as a flex item. Let me know how it goes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
layout Layout engine issues and enhancements
Projects
None yet
Development

No branches or pull requests

2 participants