-
-
Notifications
You must be signed in to change notification settings - Fork 65
Fix hidden form inputs #434
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
Conversation
|
This is causing leaks due to elements being outside the tree. We need to find a way to clean them as well. |
fe286f0 to
7fb97b7
Compare
When the current element or a parent has display:none, the display_none flag is set and no new element should be added to the viewport. For form inputs, instead of always adding the Embed to the viewport, we only do it if display_none is not set. The Embed is still registered as an input in the form, so it will continue to send the proper form values to the server. For complex buttons that can contain nested elements inside, we switch to a dummy button that doesn't have a Textbox and rely on the logic at html.cc to avoid creating more child elements until the display_none is unset. Fixes: #433
The display_none flag is only set _after_ the open tag has run, so it will only affect child elements. If the current form input element has a display:none itself, it should be also considered. The new function a_Html_should_display() evaluates both conditions.
When an input element should not be displayed due to display:none, don't allocate the Resource or the Embed directly. It won't be added to the Widget tree either. This prevents allocating Resources that are not tied to a Widget so they are not leaked when the tree is destroyed. The Embed or Resource elements won't be needed as the DilloHtmlInput handles all the form logic.
Managed to avoid creating new Embed and Resource elements, so there is no need to release them. Let's make sure the memory leaks are first detected and then fixed on the CI. |
7fb97b7 to
79c10b3
Compare
|
Fails as expected: https://github.com/dillo-browser/dillo/actions/runs/17344978575/job/49243747678?pr=434
|
|
No leaks detected, seems to be working fine now. |
Handle display:none properly for form elements. This is specially notable in the wikipedia.
Fixes #433