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

Overflow-y:scroll not working as expected #711

Open
YTN0 opened this issue Nov 28, 2024 · 9 comments
Open

Overflow-y:scroll not working as expected #711

YTN0 opened this issue Nov 28, 2024 · 9 comments

Comments

@YTN0
Copy link

YTN0 commented Nov 28, 2024

I have a div with overflow-y set to scroll, and within it I am generating a list of divs from an array. The problem is the overflow isn't being hidden as expected.

Here's the corresponding rml:

<div style="height:100dp; width:100%; overflow-y:scroll; background-color: #0000FF;">
 <div data-for="name : myArray" onclick="click" style="font-size:16dp; border: 1px; height:50dp; width:100%;">
      {{name}}
  </div>     
</div>

I am attaching screenshots of the results. Any ideas on why the overflow isn't being contained?

Screenshot 2024-11-28 at 2 30 06 AM Screenshot 2024-11-28 at 2 29 53 AM Screenshot 2024-11-28 at 2 29 29 AM
@mikke89
Copy link
Owner

mikke89 commented Nov 28, 2024

Which renderer are you using? Does clipping work at all in other situations?

@YTN0
Copy link
Author

YTN0 commented Nov 28, 2024

@mikke89

I am using my own renderer... and I had assumed clipping had been working, but am not so sure now. I believe it was working previously with the older style RML render interface.

I only have scissor implemented, and not clip masks. I am assuming this relies on scissors?

To clarify how the new render interface works with scissors.... I am assuming the sequence of render calls / events is:

EnableScissorRegion(true)
SetScissorRegion()
RenderGeometry()
EnableScissorRegion(false)... assuming the same scissor isn't used for subsequent renders.

Is that about right?

@mikke89
Copy link
Owner

mikke89 commented Nov 28, 2024

I see. Yeah generally, that should be the order. But please check what you're actually getting through the render interface. If you can test with our built-in backends too (or replicate in our code base), that would be helpful.

There are some situations where clip masks are needed. In particular if you are using any transforms, or border radius combined with hidden overflow. Then your assumptions might not be correct.

@YTN0
Copy link
Author

YTN0 commented Nov 29, 2024

@mikke89 I am not able to (easily) test with the built-in backends without significant work. My renderer and codebase is C#, and I wrote a proxy to bridge my C# code with the RML code.

I did set some breakpoints, and it doesn't look like the scissor methods are being called, so it looks like it's not using a scissor for this. It is breakpointing on the clipmask methods, so it looks like it needs clipmasks to be implemented for this.

Is there a way to force or get it to leverage scissors, or what should I change in my RML to use scissors instead of clipmasks?

I currently don't have support for clipmasks implemented.

@mikke89
Copy link
Owner

mikke89 commented Nov 29, 2024

Sounds interesting with the C# bindings, I understand if you can't easily test that. If you do suspect it's a bug on the RmlUi side, then it would be helpful if you could be able to reproduce it in our code base.

In terms of the rml and clip masks, the main culprits are those mentioned above, border radius with non-visible overflow, and transforms.

@YTN0
Copy link
Author

YTN0 commented Nov 29, 2024

I combed through my RML, and am not seeing use of radius or non-visible overflow anywhere, so can't see why it would attempt to use a clipmask instead of a scissor.

I'll do more digging to see if I can figure out what's going on. Worst case is I'll have to implement clipmasks.

Thanks.

@mikke89
Copy link
Owner

mikke89 commented Nov 30, 2024

Just tested with the RML you posted and got these results (with 10 inner elements):

  Compile geometry: 13
  Render geometry: 13
  Release geometry: 0
  Texture load: 0
  Texture generate: 1
  Texture release: 0
  Scissor enable: 2
  Scissor set: 1
  Clip mask enable: 0
  Clip mask render: 0
  Transform set: 0

So no clip masks here, only a single scissor operation. If you are able to reproduce this in our codebase, I would be able to investigate and be a lot more helpful.

@YTN0
Copy link
Author

YTN0 commented Nov 30, 2024

@mikke89 Thanks for digging into this.

Can you show the entire RML you used so I can test using the exact same thing?

It's possible I have some other RML that's triggering a clip mask instead of scissors.

I'll strip it down to the bare minimum to test.

@mikke89
Copy link
Owner

mikke89 commented Nov 30, 2024

No problem, sounds good. Here is the RML I used:

<rml>
	<head>
		<title>Demo</title>
		<link type="text/rcss" href="/assets/rml.rcss" />
		<style>
			body
			{
				font-family: LatoLatin;
				font-weight: normal;
				font-style: normal;
				font-size: 15dp;
				color: white;
				width: 500dp;
				height: 525dp;
				margin: auto;
			}
		</style>
	</head>
	<body>
<div style="height:100dp; width:100%; overflow-y:scroll; background-color: #0000FF;">
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
	<div style="font-size:16dp; border: 1px; height:50dp; width:100%;">blah</div>
</div>
	</body>
</rml>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants