Skip to content

Commit 3fde349

Browse files
committed
webapi): reorder css function params and merge pointer events
1 parent 55a9976 commit 3fde349

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/SemanticTree.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn walk(self: @This(), node: *Node, xpath_buffer: *std.ArrayList(u8), parent_nam
9494
if (tag == .datalist or tag == .option or tag == .optgroup) return;
9595

9696
// Check visibility using the engine's checkVisibility which handles CSS display: none
97-
if (!el.checkVisibilityCached(self.page, css_cache)) {
97+
if (!el.checkVisibilityCached(css_cache, self.page)) {
9898
return;
9999
}
100100

src/browser/interactive.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ pub fn classifyInteractivity(
218218
listener_targets: ListenerTargetMap,
219219
cache: ?*Element.CssCache,
220220
) ?InteractivityType {
221-
if (el.hasPointerEventsNoneCached(page, cache)) return null;
221+
if (el.hasPointerEventsNone(cache, page)) return null;
222222

223223
// 1. Native interactive by tag
224224
switch (el.getTag()) {

src/browser/webapi/Element.zig

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ pub const CssProperties = struct {
10531053

10541054
pub const CssCache = std.AutoHashMapUnmanaged(*Element, CssProperties);
10551055

1056-
fn getCssProperties(el: *Element, page: *Page, doc_sheets: ?*StyleSheetList, cache: ?*CssCache) CssProperties {
1056+
fn getCssProperties(el: *Element, doc_sheets: ?*StyleSheetList, cache: ?*CssCache, page: *Page) CssProperties {
10571057
if (cache) |c| {
10581058
if (c.get(el)) |props| return props;
10591059
}
@@ -1144,27 +1144,23 @@ fn getCssProperties(el: *Element, page: *Page, doc_sheets: ?*StyleSheetList, cac
11441144
return props;
11451145
}
11461146

1147-
pub fn hasPointerEventsNoneCached(self: *Element, page: *Page, cache: ?*CssCache) bool {
1147+
pub fn hasPointerEventsNone(self: *Element, cache: ?*CssCache, page: *Page) bool {
11481148
const doc_sheets = page.document.getStyleSheets(page) catch null;
11491149
var current: ?*Element = self;
11501150
while (current) |el| {
1151-
const props = el.getCssProperties(page, doc_sheets, cache);
1151+
const props = el.getCssProperties(doc_sheets, cache, page);
11521152
if (props.pointer_events_none) return true;
11531153
current = el.parentElement();
11541154
}
11551155
return false;
11561156
}
11571157

1158-
pub fn hasPointerEventsNone(self: *Element, page: *Page) bool {
1159-
return self.hasPointerEventsNoneCached(page, null);
1160-
}
1161-
1162-
pub fn checkVisibilityCached(self: *Element, page: *Page, cache: ?*CssCache) bool {
1158+
pub fn checkVisibilityCached(self: *Element, cache: ?*CssCache, page: *Page) bool {
11631159
const doc_sheets = page.document.getStyleSheets(page) catch null;
11641160
var current: ?*Element = self;
11651161

11661162
while (current) |el| {
1167-
const props = getCssProperties(el, page, doc_sheets, cache);
1163+
const props = getCssProperties(el, doc_sheets, cache, page);
11681164
if (props.display_none or props.visibility_hidden or props.opacity_zero) return false;
11691165
current = el.parentElement();
11701166
}
@@ -1173,7 +1169,7 @@ pub fn checkVisibilityCached(self: *Element, page: *Page, cache: ?*CssCache) boo
11731169
}
11741170

11751171
pub fn checkVisibility(self: *Element, page: *Page) bool {
1176-
return self.checkVisibilityCached(page, null);
1172+
return self.checkVisibilityCached(null, page);
11771173
}
11781174

11791175
fn getElementDimensions(self: *Element, page: *Page) struct { width: f64, height: f64 } {

0 commit comments

Comments
 (0)