mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-28 15:40:04 +00:00
Only check StyleSheet dirty flag at the start (once) of operation
This commit is contained in:
@@ -199,6 +199,8 @@ fn rebuildIfDirty(self: *StyleManager) !void {
|
|||||||
// By default only checks display:none.
|
// By default only checks display:none.
|
||||||
// Walks up the tree to check ancestors.
|
// 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) bool {
|
||||||
|
self.rebuildIfDirty() catch return false;
|
||||||
|
|
||||||
var current: ?*Element = el;
|
var current: ?*Element = el;
|
||||||
|
|
||||||
while (current) |elem| {
|
while (current) |elem| {
|
||||||
@@ -283,8 +285,6 @@ fn isElementHidden(self: *StyleManager, el: *Element, options: CheckVisibilityOp
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.rebuildIfDirty() catch return false;
|
|
||||||
|
|
||||||
// Helper to check a single rule
|
// Helper to check a single rule
|
||||||
const Ctx = struct {
|
const Ctx = struct {
|
||||||
display_none: *?bool,
|
display_none: *?bool,
|
||||||
@@ -378,6 +378,8 @@ fn isElementHidden(self: *StyleManager, el: *Element, options: CheckVisibilityOp
|
|||||||
/// Checks inline style first - if set, skips stylesheet lookup.
|
/// Checks inline style first - if set, skips stylesheet lookup.
|
||||||
/// Walks up the tree to check ancestors.
|
/// Walks up the tree to check ancestors.
|
||||||
pub fn hasPointerEventsNone(self: *StyleManager, el: *Element, cache: ?*PointerEventsCache) bool {
|
pub fn hasPointerEventsNone(self: *StyleManager, el: *Element, cache: ?*PointerEventsCache) bool {
|
||||||
|
self.rebuildIfDirty() catch return false;
|
||||||
|
|
||||||
var current: ?*Element = el;
|
var current: ?*Element = el;
|
||||||
|
|
||||||
while (current) |elem| {
|
while (current) |elem| {
|
||||||
@@ -417,9 +419,6 @@ fn elementHasPointerEventsNone(self: *StyleManager, el: *Element) bool {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check stylesheet rules
|
|
||||||
self.rebuildIfDirty() catch return false;
|
|
||||||
|
|
||||||
var result: ?bool = null;
|
var result: ?bool = null;
|
||||||
var best_priority: u64 = 0;
|
var best_priority: u64 = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user