Skip to content

Lightpanda: the headless browser designed for AI and automation

intern "popover"

Karl Seguina8802bffe1a3
diff --git a/src/browser/StyleManager.zig b/src/browser/StyleManager.zig
index 05e237cb4..7aca392dd 100644
--- a/src/browser/StyleManager.zig
+++ b/src/browser/StyleManager.zig
@@ -1021,12 +1021,13 @@ fn matchesUaDisplayNoneRule(el: *Element, frame: *Frame) bool {
}
}
- // dialog:not([open]) { display: none }
- if (tag == .dialog and !el.hasAttributeSafe(comptime .wrap("open"))) return true;
-
- // [popover]:not(:popover-open):not(dialog[open]) { display: none }
- if (el.hasAttributeSafe(comptime .wrap("popover")) and !popover.isOpen(el, frame)) {
- if (tag != .dialog) return true;
+ if (tag == .dialog) {
+ // dialog:not([open]) { display: none }
+ // dialog:popover-open { display: block }
+ if (!el.hasAttributeSafe(comptime .wrap("open")) and !popover.isOpen(el, frame)) return true;
+ } else if (el.hasAttributeInterned("popover") and !popover.isOpen(el, frame)) {
+ // [popover]:not(:popover-open):not(dialog[open]) { display: none }
+ return true;
}
// details:not([open]) > *:not(summary) { display: none }
diff --git a/src/browser/tests/element/check_visibility.html b/src/browser/tests/element/check_visibility.html
index 081e8135d..fa584d96b 100644
--- a/src/browser/tests/element/check_visibility.html
+++ b/src/browser/tests/element/check_visibility.html
@@ -329,6 +329,14 @@
dialog.show();
testing.expectEqual(true, dialog.checkVisibility());
+ dialog.close();
+ testing.expectEqual(false, dialog.checkVisibility());
+ // dialog:popover-open { display: block } overrides dialog:not([open]).
+ dialog.showPopover();
+ testing.expectEqual(true, dialog.checkVisibility());
+ dialog.hidePopover();
+ testing.expectEqual(false, dialog.checkVisibility());
+
dialog.remove();
pop.remove();
}
diff --git a/src/string.zig b/src/string.zig
index 32a953647..9e8837c26 100644
--- a/src/string.zig
+++ b/src/string.zig
@@ -325,6 +325,7 @@ pub const String = extern struct {
asUint("charset") => return "charset",
asUint("checked") => return "checked",
asUint("loading") => return "loading",
+ asUint("popover") => return "popover",
else => {},
},
8 => switch (@as(u64, @bitCast(input[0..8].*))) {