aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2025-08-24 18:38:20 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2025-08-30 16:08:34 +0200
commit1a630a35c5941e72e3cd78d6c5bf3236c55248fc (patch)
tree6c8d218f796ec1c865537077797ed6e7f0de164f
parent582d27413faef25d9abd4f1f6dfc18f5e9b8cc5c (diff)
Fix button with display:none directly
-rw-r--r--src/form.cc14
-rw-r--r--test/html/render/form-display-none.html1
2 files changed, 9 insertions, 6 deletions
diff --git a/src/form.cc b/src/form.cc
index b96cec4c..fe7376c5 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -953,12 +953,7 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize)
ResourceFactory *factory = HT2LT(html)->getResourceFactory();
- /* If we are inside a display:none container, instead of creating
- * a new hierarchy of elements, add a simple button. */
- if (S_TOP(html)->display_none) {
- Resource *resource = factory->createLabelButtonResource("dummy");
- embed = new Embed(resource);
- } else {
+ if (a_Html_should_display(html)) {
/* We used to have Textblock (prefs.limit_text_width, ...) here,
* but it caused 100% CPU usage.
*/
@@ -969,6 +964,13 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize)
embed = new Embed(resource);
HT2TB(html)->addWidget (embed, html->backgroundStyle ());
S_TOP(html)->textblock = html->dw = page;
+ } else {
+ /* If we are inside a display:none container, instead of
+ * creating a new hierarchy of elements, add a simple button. */
+ Resource *resource = factory->createLabelButtonResource("dummy");
+ embed = new Embed(resource);
+ /* Don't add the embed to the current textblock, it is only
+ * used to hold the name and value below. */
}
/* Always add the input element, so is present in the form */
diff --git a/test/html/render/form-display-none.html b/test/html/render/form-display-none.html
index fec9c96c..4842f1ba 100644
--- a/test/html/render/form-display-none.html
+++ b/test/html/render/form-display-none.html
@@ -40,6 +40,7 @@
<hr>
<p>The ones below are outside the form</p>
<input style="display: none" type="text" name="out-text">
+ <button style="display: none">Look at this <img src="pic.png"> image</button>
<hr>
</body>
</html>