mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-07-31 09:46:05 -04:00
Merge pull request #2844 from lightpanda-io/inline_style_optimization
perf: Skip CSSStyleProperty creation if there is no style attribute
This commit is contained in:
@@ -864,6 +864,10 @@ const CheckVisibilityOptions = struct {
|
||||
const INLINE_PRIORITY: u64 = std.math.maxInt(u64);
|
||||
|
||||
fn getInlineStyleProperty(el: *Element, property_name: String, frame: *Frame) ?*CSSStyleProperty {
|
||||
if (!el.hasAttributeSafe(comptime .wrap("style"))) {
|
||||
// cheap guard to avoid creating the CSSStyleProperty if there is no style attribute
|
||||
return null;
|
||||
}
|
||||
const style = el.getOrCreateStyle(frame) catch |err| {
|
||||
log.err(.browser, "StyleManager getOrCreateStyle", .{ .err = err });
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user