diff --git a/src/SemanticTree.zig b/src/SemanticTree.zig index ad224bab9..20f6010ab 100644 --- a/src/SemanticTree.zig +++ b/src/SemanticTree.zig @@ -131,7 +131,7 @@ fn walk( if (tag == .datalist or tag == .option or tag == .optgroup) return; // Check visibility using the engine's checkVisibility which handles CSS display: none - if (!el.checkVisibilityCached(ctx.visibility_cache, self.frame)) { + if (!el.checkVisibilityCached(ctx.visibility_cache, self.frame, .scan)) { return; } diff --git a/src/browser/StyleManager.zig b/src/browser/StyleManager.zig index b633d2204..6f377a5ac 100644 --- a/src/browser/StyleManager.zig +++ b/src/browser/StyleManager.zig @@ -33,7 +33,6 @@ const SelectorList = @import("webapi/selector/List.zig"); const CSSStyleRule = @import("webapi/css/CSSStyleRule.zig"); const CSSStyleSheet = @import("webapi/css/CSSStyleSheet.zig"); const CSSStyleProperties = @import("webapi/css/CSSStyleProperties.zig"); -const CSSStyleProperty = @import("webapi/css/CSSStyleDeclaration.zig").Property; const log = lp.log; const String = lp.String; @@ -573,7 +572,7 @@ fn rebuildIfDirty(self: *StyleManager) !void { // Check if an element is hidden based on options. // By default only checks display:none. // Walks up the tree to check ancestors. -pub fn isHidden(self: *StyleManager, el: *Element, cache: ?*VisibilityCache, options: CheckVisibilityOptions) bool { +pub fn isHidden(self: *StyleManager, el: *Element, cache: ?*VisibilityCache, options: CheckVisibilityOptions, comptime access: InlineAccess) bool { self.rebuildIfDirty() catch return false; var current: ?*Element = el; @@ -590,7 +589,7 @@ pub fn isHidden(self: *StyleManager, el: *Element, cache: ?*VisibilityCache, opt } } - const hidden = self.isElementHidden(elem, options); + const hidden = self.isElementHidden(elem, options, access); // Store in cache if (cache) |c| { @@ -611,18 +610,18 @@ pub fn isHidden(self: *StyleManager, el: *Element, cache: ?*VisibilityCache, opt /// Computed display:none for a single element (own property, no ancestor walk). /// Honors the UA stylesheet rules per HTML Rendering §15.3.1 "Hidden elements" /// via `isElementHidden`. -pub fn hasDisplayNone(self: *StyleManager, el: *Element) bool { +pub fn hasDisplayNone(self: *StyleManager, el: *Element, comptime access: InlineAccess) bool { self.rebuildIfDirty() catch return false; - return self.isElementHidden(el, .{}); + return self.isElementHidden(el, .{}, access); } /// Computed display:none coming only from inline style or an author stylesheet /// rule — the UA stylesheet's hidden elements (,