Merge pull request #1977 from lightpanda-io/check_dirty_once
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / wba-demo-scripts (push) Has been cancelled
e2e-test / wba-test (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig fmt (push) Has been cancelled
zig-test / zig test using v8 in debug mode (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled

Only check StyleSheet dirty flag at the start (once) of operation
This commit is contained in:
Adrià Arrufat
2026-03-24 09:12:10 +09:00
committed by GitHub

View File

@@ -199,6 +199,8 @@ fn rebuildIfDirty(self: *StyleManager) !void {
// 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 {
self.rebuildIfDirty() catch return false;
var current: ?*Element = el;
while (current) |elem| {
@@ -283,8 +285,6 @@ fn isElementHidden(self: *StyleManager, el: *Element, options: CheckVisibilityOp
return false;
}
self.rebuildIfDirty() catch return false;
// Helper to check a single rule
const Ctx = struct {
display_none: *?bool,
@@ -378,6 +378,8 @@ fn isElementHidden(self: *StyleManager, el: *Element, options: CheckVisibilityOp
/// Checks inline style first - if set, skips stylesheet lookup.
/// Walks up the tree to check ancestors.
pub fn hasPointerEventsNone(self: *StyleManager, el: *Element, cache: ?*PointerEventsCache) bool {
self.rebuildIfDirty() catch return false;
var current: ?*Element = el;
while (current) |elem| {
@@ -417,9 +419,6 @@ fn elementHasPointerEventsNone(self: *StyleManager, el: *Element) bool {
return false;
}
// Check stylesheet rules
self.rebuildIfDirty() catch return false;
var result: ?bool = null;
var best_priority: u64 = 0;