mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-31 01:28:55 +00:00
css: improve CSSOM rule handling and serialization
Refactors `CSSRule` to a union type for better type safety and updates `CSSStyleRule` to use `CSSStyleProperties`. Adds comprehensive tests for `insertRule`, `deleteRule`, and `replaceSync`.
This commit is contained in:
@@ -180,8 +180,6 @@ pub fn getCssText(self: *const CSSStyleDeclaration, page: *Page) ![]const u8 {
|
||||
}
|
||||
|
||||
pub fn setCssText(self: *CSSStyleDeclaration, text: []const u8, page: *Page) !void {
|
||||
if (self._element == null) return;
|
||||
|
||||
// Clear existing properties
|
||||
var node = self._properties.first;
|
||||
while (node) |n| {
|
||||
@@ -197,6 +195,7 @@ pub fn setCssText(self: *CSSStyleDeclaration, text: []const u8, page: *Page) !vo
|
||||
while (it.next()) |declaration| {
|
||||
try self.setPropertyImpl(declaration.name, declaration.value, declaration.important, page);
|
||||
}
|
||||
|
||||
try self.syncStyleAttribute(page);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user