mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-28 22:53:28 +00:00
make getComptedStyle return an empty CSSStyleDeclaration
This commit is contained in:
@@ -33,6 +33,11 @@ pub const CSSStyleDeclaration = struct {
|
||||
store: std.StringHashMapUnmanaged(Property),
|
||||
order: std.ArrayListUnmanaged([]const u8),
|
||||
|
||||
pub const empty: CSSStyleDeclaration = .{
|
||||
.store = .empty,
|
||||
.order = .empty,
|
||||
};
|
||||
|
||||
const Property = struct {
|
||||
value: []const u8,
|
||||
priority: bool,
|
||||
|
||||
@@ -109,10 +109,7 @@ pub const HTMLElement = struct {
|
||||
pub const prototype = *Element;
|
||||
pub const subtype = .node;
|
||||
|
||||
style: CSSStyleDeclaration = .{
|
||||
.store = .{},
|
||||
.order = .{},
|
||||
},
|
||||
style: CSSStyleDeclaration = .empty,
|
||||
|
||||
pub fn get_style(e: *parser.ElementHTML, state: *SessionState) !*CSSStyleDeclaration {
|
||||
const self = try state.getOrCreateNodeWrapper(HTMLElement, @ptrCast(e));
|
||||
|
||||
@@ -31,6 +31,7 @@ const Console = @import("../console/console.zig").Console;
|
||||
const EventTarget = @import("../dom/event_target.zig").EventTarget;
|
||||
const MediaQueryList = @import("media_query_list.zig").MediaQueryList;
|
||||
const Performance = @import("performance.zig").Performance;
|
||||
const CSSStyleDeclaration = @import("../cssom/css_style_declaration.zig").CSSStyleDeclaration;
|
||||
|
||||
const storage = @import("../storage/storage.zig");
|
||||
|
||||
@@ -237,13 +238,13 @@ pub const Window = struct {
|
||||
return timer_id;
|
||||
}
|
||||
|
||||
// NOT IMPLEMENTED - This is a dummy implementation that always returns null to deter PlayWright from using this path to solve click.js.
|
||||
// returns an object containing the values of all CSS properties of an element, after applying active stylesheets and resolving any basic computation those values may contain.
|
||||
pub fn _getComputedStyle(_: *Window, element: *parser.Element, pseudo_element: ?[]const u8) !?void {
|
||||
// TODO: getComputedStyle should return a read-only CSSStyleDeclaration.
|
||||
// We currently don't have a read-only one, so we return a new instance on
|
||||
// each call.
|
||||
pub fn _getComputedStyle(_: *Window, element: *parser.Element, pseudo_element: ?[]const u8) !CSSStyleDeclaration {
|
||||
_ = element;
|
||||
_ = pseudo_element;
|
||||
log.warn("Not implemented function getComputedStyle called, null returned", .{});
|
||||
return null;
|
||||
return .empty;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user