Skip to content

[pull] main from lightpanda-io:main #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 790 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
790 commits
Select commit Hold shift + click to select a range
79d1425
Reduce info logs of HTTP event
karlseguin May 28, 2025
88df9f0
missing t
sjorsdonkers May 28, 2025
fed37bc
increase max memory threshold to 30
karlseguin May 28, 2025
a1f140a
Merge pull request #718 from lightpanda-io/max_memory_30
karlseguin May 28, 2025
06a33b0
Merge pull request #717 from lightpanda-io/missing-t
karlseguin May 28, 2025
dffbce1
Merge pull request #712 from lightpanda-io/tweak_http_logs
karlseguin May 28, 2025
f49710f
update flake.nix for Zig 0.14.1
mookums May 28, 2025
73d6329
Merge pull request #722 from lightpanda-io/nix
karlseguin May 29, 2025
83da818
run apt-get update before trying to install
karlseguin May 29, 2025
bddb3f0
Merge pull request #724 from lightpanda-io/apt_update
karlseguin May 29, 2025
608e0a0
Skip long setTimeout/setInterval
karlseguin May 28, 2025
58215a4
Implement location.reload(), location.assign() and location setter
karlseguin May 28, 2025
74b36d6
support form.submit()
karlseguin May 28, 2025
0ccd9e0
Merge pull request #716 from lightpanda-io/skip_long_timeouts
karlseguin May 29, 2025
eed4fc7
Load dynamically added <script> tags
karlseguin May 27, 2025
20d0b4a
update libdom dep
karlseguin May 28, 2025
dab59ad
Merge pull request #707 from lightpanda-io/skip_large_headers
karlseguin May 29, 2025
7202d75
Merge pull request #714 from lightpanda-io/live_scripts
karlseguin May 29, 2025
2a4feb7
Fix set_innerHTML, fix HTMLCollection fixed (postAttached) return type
karlseguin May 30, 2025
cfdbd41
Implement named_get and iterator on NamedNodeMap
karlseguin May 30, 2025
8551e05
ci: switch lpd_bench_cdp
krichprollsch May 30, 2025
b7b6768
ci: give time to start services
krichprollsch May 30, 2025
d39cada
support null referene node to Node.insertBefore
karlseguin May 30, 2025
4a6cee0
Fix HTMLImageElement
karlseguin May 30, 2025
ab45b42
Update zig-v8-fork + zig fmt fix
karlseguin May 30, 2025
9a2c006
IntersectionObserver's threshold option should be an union
karlseguin May 30, 2025
0acbb20
Merge pull request #732 from lightpanda-io/intersection_observer_thre…
karlseguin May 30, 2025
b7beb73
Merge pull request #728 from lightpanda-io/e2e-bench
krichprollsch May 30, 2025
5909ab7
Merge pull request #730 from lightpanda-io/fix_html_image
karlseguin May 30, 2025
71b5dc2
Merge pull request #731 from lightpanda-io/minor_chores
karlseguin May 30, 2025
3ef1d8b
Merge pull request #729 from lightpanda-io/fix_node_insert_before_nul…
karlseguin May 30, 2025
6adb46a
Merge pull request #727 from lightpanda-io/named_node_map_named_index…
karlseguin May 30, 2025
2531aed
ci: disable telemetry for 2e2 tests
krichprollsch May 30, 2025
ef64fa3
Execute onload for dynamic script
karlseguin May 29, 2025
0b0b405
Merge pull request #733 from lightpanda-io/e2e-bench
krichprollsch May 30, 2025
c30b424
increase buffer size 1024->4096
karlseguin May 30, 2025
e339ee3
Clean Http Request Shutdown
karlseguin May 28, 2025
f35e3ec
Merge pull request #725 from lightpanda-io/dynamic_script_onload
karlseguin May 30, 2025
f696aa3
Merge pull request #726 from lightpanda-io/fix_set_innerhtml_and_html…
karlseguin May 30, 2025
f2f7a34
Merge pull request #715 from lightpanda-io/location_change
karlseguin May 30, 2025
6ca57c1
Merge pull request #723 from lightpanda-io/form_submit
karlseguin May 30, 2025
e7007b4
fix test
karlseguin May 30, 2025
1869ef0
Merge pull request #734 from lightpanda-io/url_resolve_buffer_size
karlseguin May 30, 2025
527579a
Merge pull request #720 from lightpanda-io/clean_xhr_shutdown
karlseguin May 30, 2025
32dc19c
Run puppeteer-perf using ReleaseFast
karlseguin Jun 1, 2025
747a8ad
Submit input and button submits can now submit forms
karlseguin Jun 2, 2025
4644e55
Do not reset transfer_arena if page navigation results in delayed nav…
karlseguin Jun 2, 2025
e799fcd
xmlserializer for doctype
sjorsdonkers May 28, 2025
1b87f96
remove superflous text
sjorsdonkers Jun 2, 2025
c80deeb
Merge pull request #738 from lightpanda-io/buttons_submit_form
karlseguin Jun 2, 2025
ac75f9b
Fix url constructor
karlseguin Jun 2, 2025
bb465ed
Allow any 2xx status code for scripts
karlseguin Jun 2, 2025
6b1f2c0
Merge pull request #741 from lightpanda-io/2xx_status
karlseguin Jun 2, 2025
2ef7ea6
change stitch alloc default to .always
karlseguin Jun 2, 2025
47da5e0
Merge pull request #737 from lightpanda-io/release_fast
karlseguin Jun 2, 2025
c3f3eea
Improve logging
karlseguin May 31, 2025
6e80b03
Improve script logging
karlseguin May 31, 2025
625fa03
fix tests
karlseguin May 31, 2025
021fc8f
experiment with reducing retained arena size
karlseguin Jun 1, 2025
9e834e0
Revert "experiment with reducing retained arena size"
karlseguin Jun 1, 2025
a000dfe
include stack trace in JS function call log errors
karlseguin Jun 2, 2025
1ac23ce
Merge pull request #735 from lightpanda-io/improved_logging
karlseguin Jun 2, 2025
36f59da
Update zig filename for new pattern used in 0.14.1+
karlseguin Jun 2, 2025
167fe5f
Guard against null object when trying to fetch a function
karlseguin Jun 2, 2025
e3099a1
fix a silly log crash on exit error
karlseguin Jun 2, 2025
bbdb254
Merge pull request #746 from lightpanda-io/null_object_guard
karlseguin Jun 3, 2025
b6a37f6
Merge pull request #747 from lightpanda-io/fix_crash_on_error_exit
karlseguin Jun 3, 2025
12bc540
Merge pull request #744 from lightpanda-io/dockerfile_zig_path_fix
karlseguin Jun 3, 2025
a482d59
Merge pull request #739 from lightpanda-io/url_constructor
karlseguin Jun 3, 2025
e5a76d7
Increase default timeout from 3s to 10s.
karlseguin Jun 2, 2025
4c8e2a1
Setting anchor href should consider document.url
karlseguin Jun 2, 2025
3c63787
Merge pull request #743 from lightpanda-io/default_timeout_10s
karlseguin Jun 3, 2025
9c2e3e2
Merge pull request #740 from lightpanda-io/fix_anchor_href
karlseguin Jun 3, 2025
97b17af
fix leak in test
karlseguin Jun 3, 2025
bde8c54
Merge pull request #748 from lightpanda-io/test_leak
karlseguin Jun 3, 2025
6451065
Poor support for functions/namespaces.
karlseguin Jun 3, 2025
7e8df34
add noop window.scrollTo
karlseguin Jun 3, 2025
69215e7
Merge pull request #751 from lightpanda-io/dummy_window_scroll_to
francisbouvier Jun 3, 2025
13d602a
Rework/fix URLSearchParams
karlseguin Jun 3, 2025
275b979
input element properties
sjorsdonkers May 28, 2025
211ce20
Add document.activeElement and HTMLElement.focus()
karlseguin Jun 2, 2025
19d4084
input prop testing
sjorsdonkers May 31, 2025
18e6f9b
Detached node can't have focus.
karlseguin Jun 2, 2025
7091b37
Make stacktraces available in debug via `page.stackTrace()`
karlseguin Jun 3, 2025
ceb9453
Simplify testing
sjorsdonkers Jun 3, 2025
7da83d2
fix makebuilddev
sjorsdonkers Jun 3, 2025
9f4ee7d
update nixpkgs to 25.05
mookums Jun 3, 2025
6b0c532
Merge pull request #742 from lightpanda-io/focus_and_active_element
karlseguin Jun 4, 2025
d32fbfd
Merge pull request #749 from lightpanda-io/functions
karlseguin Jun 4, 2025
73df41b
Merge pull request #753 from lightpanda-io/console_error_stack_trace
karlseguin Jun 4, 2025
bcd4bdb
Merge pull request #754 from lightpanda-io/fix-makebuilddev
karlseguin Jun 4, 2025
d95a18b
Merge pull request #756 from lightpanda-io/nix-2505
karlseguin Jun 4, 2025
8904afa
Fix crash when event target is the window.
karlseguin Jun 4, 2025
234e7af
Merge pull request #721 from lightpanda-io/HTMLInputElement-properties
karlseguin Jun 4, 2025
9efc1a1
Merge pull request #752 from lightpanda-io/url_search_params
karlseguin Jun 4, 2025
19df737
Improve usability of NodeWrapper
karlseguin Jun 4, 2025
f931026
update libdom with embedder data fix
sjorsdonkers Jun 4, 2025
4165f47
merge all states
karlseguin Jun 4, 2025
8de57ec
Merge pull request #761 from lightpanda-io/pozo_for_custom_state
karlseguin Jun 4, 2025
1090ff0
URL constructor overload support
karlseguin Jun 4, 2025
b35107a
URL stitch avoid double /
karlseguin Jun 4, 2025
b29e07f
expose URLSearchParams toString and URL.toString
karlseguin Jun 4, 2025
4ff978f
Merge pull request #762 from lightpanda-io/url_constructor
karlseguin Jun 4, 2025
fff0a8a
Merge pull request #757 from lightpanda-io/window_target_crash
karlseguin Jun 4, 2025
c758054
URLSearchParam constructor support for object initialization
karlseguin Jun 5, 2025
6df5e55
Optimize the lifecycle of async requests
karlseguin Jun 5, 2025
f436744
Delay requestAnimation
karlseguin Jun 5, 2025
3a5aa87
Optimize the lifecycle of async requests
karlseguin Jun 5, 2025
48c25c3
Removing blocking code async HTTP request
karlseguin Jun 5, 2025
f1672dd
setExtraHTTPHeaders
sjorsdonkers Jun 5, 2025
a5d87ab
Reduce duration of the main request
karlseguin Jun 5, 2025
fdd1a77
Properly drain event loop when navigating between pages
karlseguin Jun 6, 2025
478d919
Merge pull request #765 from lightpanda-io/http_client_optimization
karlseguin Jun 6, 2025
e77d888
Merge pull request #766 from lightpanda-io/slow_down_animation_frame
karlseguin Jun 6, 2025
09466a2
Merge pull request #764 from lightpanda-io/url_search_parmas_from_object
karlseguin Jun 6, 2025
f789c84
Merge pull request #767 from lightpanda-io/unblock_async_http_request
karlseguin Jun 6, 2025
bacef41
extra header feedback
sjorsdonkers Jun 6, 2025
305460d
Merge pull request #768 from lightpanda-io/setExtraHTTPHeaders
karlseguin Jun 6, 2025
2b48902
Emit http_request_fail notification
karlseguin Jun 6, 2025
f12e9b6
use js try for errors
sjorsdonkers Jun 6, 2025
5483c52
Merge pull request #771 from lightpanda-io/http_request_fail
karlseguin Jun 9, 2025
d9ce89a
import html_element
sjorsdonkers Jun 6, 2025
effd07d
Add basic support for key events
karlseguin Jun 9, 2025
3a4bd00
Ignore dead keys
karlseguin Jun 11, 2025
34b4949
Making sure that the optional parameters have defaults
karlseguin Jun 11, 2025
cf39bdc
use inputGetType and add buttonGetType
karlseguin Jun 11, 2025
0de33b3
Merge pull request #773 from lightpanda-io/keydown_handling
karlseguin Jun 12, 2025
97c769e
Rework internal navigation to prevent deadlocking
karlseguin Jun 11, 2025
b1ca242
Terminate execution on internal navigation
karlseguin Jun 12, 2025
872a9d3
Internal navigation should change the CDP loader-id
karlseguin Jun 12, 2025
2788c36
Fix loop run (Page.wait)
karlseguin Jun 12, 2025
582894c
Merge pull request #780 from lightpanda-io/fix_loop_run_wait
krichprollsch Jun 12, 2025
e3afa29
Merge pull request #776 from lightpanda-io/fix_internal_navigation_de…
karlseguin Jun 13, 2025
eadf351
Merge pull request #778 from lightpanda-io/terminate_execution
karlseguin Jun 13, 2025
9bd5ff6
Merge pull request #779 from lightpanda-io/waitForNavigation
karlseguin Jun 13, 2025
0c0ddc1
rename scope jscontext
sjorsdonkers Jun 6, 2025
a8a5605
typo fix
krichprollsch Jun 13, 2025
6354197
handle null scriptname in stack trace
krichprollsch Jun 13, 2025
02c510b
upgrade zig-v8
krichprollsch Jun 13, 2025
faebabe
Merge pull request #781 from lightpanda-io/null-scriptname
karlseguin Jun 16, 2025
eadb5b6
Use css.querySelectorAll to find form elements
karlseguin Jun 16, 2025
237ddcb
Fix non-probing of union array failure
karlseguin Jun 16, 2025
c28d87d
Improve build and test speed
karlseguin Jun 16, 2025
c20052f
Add comment explaining why we're walking the form the way we are
karlseguin Jun 16, 2025
1f45d5b
add CustomElementRegistry
mookums May 29, 2025
f1ff789
implement custom elements - i think/hope
karlseguin Jun 13, 2025
68dfb4e
fix custom elements when minified js is used
karlseguin Jun 14, 2025
26e8642
Merge pull request #782 from lightpanda-io/form_support_dynamic_elements
karlseguin Jun 17, 2025
714e5e0
Merge pull request #785 from lightpanda-io/build_and_test_speed
karlseguin Jun 17, 2025
e9d7a94
Merge pull request #784 from lightpanda-io/union_param_array_fix
karlseguin Jun 17, 2025
7291576
Use css.querySelectorAll to find form elements
karlseguin Jun 16, 2025
efc7b9d
Add comment explaining why we're walking the form the way we are
karlseguin Jun 16, 2025
e2542f4
Improve build and test speed
karlseguin Jun 16, 2025
329bffb
Fix non-probing of union array failure
karlseguin Jun 16, 2025
9f54cb3
remove unused import and debug stmt
karlseguin Jun 17, 2025
9b35736
Merge pull request #786 from lightpanda-io/custom-elements
karlseguin Jun 17, 2025
a6ac7d9
Delay setting the requests' keepalive flag until the request is fully…
karlseguin Jun 17, 2025
6f5141d
browser context proxyServer
sjorsdonkers Jun 17, 2025
223611d
Fix crash when event.currentTarget is used with EventTargetTBase
karlseguin Jun 18, 2025
0c6fc68
deleteCookies
sjorsdonkers Jun 11, 2025
38dee11
setCookies
sjorsdonkers Jun 11, 2025
48c1c05
setCookie
sjorsdonkers Jun 11, 2025
fe16f06
clearRetainingCapacity
sjorsdonkers Jun 11, 2025
18dff84
lower case domain
sjorsdonkers Jun 11, 2025
4965fec
storage cookies
sjorsdonkers Jun 11, 2025
30ee41f
Network.getCookies
sjorsdonkers Jun 12, 2025
3f4338c
wip
sjorsdonkers Jun 13, 2025
74ce7ca
refactor path / domain parsing
sjorsdonkers Jun 13, 2025
270b898
Cleaning up crumbles
sjorsdonkers Jun 13, 2025
da414f7
CDP.Storage cookies tests
sjorsdonkers Jun 13, 2025
073f75e
CDP Network cookie tests
sjorsdonkers Jun 13, 2025
e402998
JS may not set/get HttpOnly cookies
sjorsdonkers Jun 16, 2025
d7656ea
expires dashes and f64
sjorsdonkers Jun 17, 2025
60f4eab
handle no params
sjorsdonkers Jun 17, 2025
8033e41
Merge pull request #788 from lightpanda-io/dont_keepalive_unprocess_r…
karlseguin Jun 18, 2025
d056199
Fixes the scoping of page.current_script
karlseguin Jun 18, 2025
ce98c33
keep EventTargetTBase as the dom_event_target
krichprollsch Jun 18, 2025
833b4d1
add top, left, bottom, right to DOMRect
krichprollsch Jun 18, 2025
c1ffe7f
Merge pull request #791 from lightpanda-io/zig_event_target_fix
krichprollsch Jun 18, 2025
1839b34
Merge pull request #792 from lightpanda-io/fix_current_script_scope
krichprollsch Jun 18, 2025
ac759a6
Merge pull request #793 from lightpanda-io/domrect-bottom
krichprollsch Jun 18, 2025
ba94818
add CSSStyleSheet
mookums Jun 3, 2025
2656cc7
Add basic tests for CSSStyleSheet
mookums Jun 18, 2025
97bc19e
clean up various imports in CSSOM
mookums Jun 18, 2025
269eb7e
add Screen and ScreenOrientation
mookums Jun 18, 2025
0b846b1
Merge pull request #789 from lightpanda-io/browsercontext-proxyServer
karlseguin Jun 19, 2025
54bd55d
fix CSSStyleSheet prototype
karlseguin Jun 19, 2025
2c940d4
browser context proxyServer
sjorsdonkers Jun 17, 2025
c691764
Merge pull request #794 from lightpanda-io/window-screen
karlseguin Jun 19, 2025
ef9f828
Merge pull request #790 from lightpanda-io/css-stylesheet
karlseguin Jun 19, 2025
c5d49a9
Add dummy PerformanceObserver
karlseguin Jun 19, 2025
898b73f
update dockerfile to multi-arch
krichprollsch Jun 19, 2025
5dcc3db
Merge pull request #795 from lightpanda-io/performance_observer
karlseguin Jun 20, 2025
9f1cc09
add HTML Template's content attribute
karlseguin Jun 19, 2025
d8ec503
Fix module loading
karlseguin Jun 20, 2025
9fc2fa5
Merge pull request #797 from lightpanda-io/template_content
karlseguin Jun 23, 2025
bbafb04
Merge pull request #798 from lightpanda-io/module_loading
karlseguin Jun 23, 2025
bdb2338
Merge pull request #796 from lightpanda-io/docker
karlseguin Jun 23, 2025
11fe793
Don't allow timeouts to be registered when shutting down
karlseguin Jun 23, 2025
fe6ccad
loop.run now takes a maximum wait time
karlseguin Jun 23, 2025
55e02f0
fix wpt runner
karlseguin Jun 23, 2025
a01d18a
Fix module caching
karlseguin Jun 23, 2025
3c07c08
improve variable names
karlseguin Jun 23, 2025
2565409
reject long timeouts as we're shutting down
karlseguin Jun 23, 2025
bf296ad
add ErrorEvent webapi
karlseguin Jun 23, 2025
c6f59a7
Merge pull request #804 from lightpanda-io/add_error_event_web_api
karlseguin Jun 24, 2025
cb35b36
Merge pull request #803 from lightpanda-io/inline_module_no_cache
karlseguin Jun 24, 2025
a00c234
Merge pull request #802 from lightpanda-io/endless_loop_fix_and_dot_s…
karlseguin Jun 24, 2025
20aabee
http: send an Accept: */* header
krichprollsch Jun 24, 2025
8a005bc
Merge pull request #808 from lightpanda-io/accept-header
karlseguin Jun 24, 2025
c97a32e
Initial work on CONNECT proxy.
karlseguin Jun 24, 2025
4560f31
basic/bearer proxy authentication
sjorsdonkers Jun 24, 2025
6b651cd
add PerformanceEntry and PerformanceMark
mookums Jun 23, 2025
ce638c3
add AbstractRange and Range
mookums Jun 23, 2025
c0fc3a1
add CSS utility interface
mookums Jun 23, 2025
d9c26bb
return array in crypto.getRandomValues
mookums Jun 24, 2025
997ec7f
Merge pull request #805 from lightpanda-io/performance-mark
karlseguin Jun 24, 2025
269dcf0
Merge pull request #806 from lightpanda-io/document-range
karlseguin Jun 24, 2025
8bd7c8d
Merge pull request #807 from lightpanda-io/css-util-iface
karlseguin Jun 24, 2025
2815f02
Merge pull request #811 from lightpanda-io/crypto-getrandomvalues-return
karlseguin Jun 24, 2025
2aa5eb8
Add element.dataset API
karlseguin Jun 24, 2025
ec92f11
Change dataset to work directly off DOM element
karlseguin Jun 25, 2025
1e7ee4e
proxy_type 'simple' renamed to 'forward'
karlseguin Jun 25, 2025
9c4088b
We cannot have empty Zig structs mapping to JS instances
karlseguin Jun 25, 2025
8d3a042
Crypto.getRandomValues consistency
karlseguin Jun 25, 2025
aea3426
basic/bearer testing
sjorsdonkers Jun 25, 2025
e18c589
Allow root modules to imported modules
karlseguin Jun 25, 2025
e721b0a
Merge pull request #816 from lightpanda-io/connect_proxy
krichprollsch Jun 26, 2025
03e3f95
Merge pull request #810 from lightpanda-io/proxy-authentication
krichprollsch Jun 26, 2025
9ea9859
Merge pull request #809 from lightpanda-io/html_element_dataset
karlseguin Jun 26, 2025
3f9b256
Merge pull request #812 from lightpanda-io/identity_map_collision
karlseguin Jun 26, 2025
0a27e12
Merge pull request #814 from lightpanda-io/root_module_nested_modules
karlseguin Jun 26, 2025
f56b0a5
Merge branch 'main' into crypto_get_random_values_fix
karlseguin Jun 26, 2025
8de27b3
Merge pull request #813 from lightpanda-io/crypto_get_random_values_fix
karlseguin Jun 26, 2025
ed7dfea
dump script tag's text content as-is
karlseguin Jun 26, 2025
343f388
Merge pull request #817 from lightpanda-io/script_tag_dump
krichprollsch Jun 26, 2025
9c75f29
ci: optimize 2e2 build
krichprollsch Jun 27, 2025
ddcb597
ci: use hetzner for 2e2 regression perf
krichprollsch Jun 27, 2025
7a311a1
Merge pull request #820 from lightpanda-io/ci-e2e
krichprollsch Jun 27, 2025
41b7ed6
Upgrade tlz.zig to latest version
karlseguin Jun 26, 2025
08d2ea6
abort controller
karlseguin Jun 27, 2025
7435274
Merge pull request #819 from lightpanda-io/update_tls_lib
karlseguin Jun 27, 2025
476fb7e
DOMException constructor
sjorsdonkers Jun 26, 2025
bbd9e5e
add AbortController API
karlseguin Jun 27, 2025
c9936c2
Add UndefinedOr(T) union
karlseguin Jun 27, 2025
f02b956
add atob and btoa
karlseguin Jun 27, 2025
6937c8e
Merge pull request #823 from lightpanda-io/atob_btoa
krichprollsch Jun 27, 2025
1c6f4a7
Merge pull request #821 from lightpanda-io/abort_controller
karlseguin Jun 28, 2025
fd36606
change field order
karlseguin Jun 28, 2025
c52d33e
Merge pull request #822 from lightpanda-io/undefined_or
karlseguin Jun 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean up various imports in CSSOM
  • Loading branch information
mookums committed Jun 18, 2025
commit 97bc19e4ae9930df49175747cdf03a791b5993be
3 changes: 0 additions & 3 deletions src/browser/cssom/css_rule.zig
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

const std = @import("std");

const Page = @import("../page.zig").Page;

const CSSStyleDeclaration = @import("css_style_declaration.zig").CSSStyleDeclaration;
const CSSStyleSheet = @import("css_stylesheet.zig").CSSStyleSheet;

pub const Interfaces = .{
Expand Down
2 changes: 0 additions & 2 deletions src/browser/cssom/css_rule_list.zig
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

const std = @import("std");

const Page = @import("../page.zig").Page;
const StyleSheet = @import("stylesheet.zig").StyleSheet;

const CSSRule = @import("css_rule.zig").CSSRule;
const CSSImportRule = @import("css_rule.zig").CSSImportRule;

Expand Down
21 changes: 9 additions & 12 deletions src/browser/cssom/css_stylesheet.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ const CSSRuleList = @import("css_rule_list.zig").CSSRuleList;
const CSSImportRule = @import("css_rule.zig").CSSImportRule;

pub const CSSStyleSheet = struct {
pub const prototype = *StyleSheet;

css_rules: *CSSRuleList,
proto: StyleSheet,
css_rules: CSSRuleList,
owner_rule: ?*CSSImportRule,

const CSSStyleSheetOpts = struct {
Expand All @@ -36,23 +35,21 @@ pub const CSSStyleSheet = struct {
disabled: bool = false,
};

pub fn constructor(_opts: ?CSSStyleSheetOpts, page: *Page) !CSSStyleSheet {
pub fn constructor(_opts: ?CSSStyleSheetOpts) !CSSStyleSheet {
const opts = _opts orelse CSSStyleSheetOpts{};
_ = opts;

const arena = page.arena;
const rules = try arena.create(CSSRuleList);
rules.* = .constructor();

return .{ .css_rules = rules, .owner_rule = null };
return .{
.proto = StyleSheet{ .disabled = opts.disabled },
.css_rules = .constructor(),
.owner_rule = null,
};
}

pub fn get_ownerRule(_: *CSSStyleSheet) ?*CSSImportRule {
return null;
}

pub fn get_cssRules(self: *CSSStyleSheet) *CSSRuleList {
return self.css_rules;
return &self.css_rules;
}

pub fn _insertRule(self: *CSSStyleSheet, rule: []const u8, _index: ?usize, page: *Page) !usize {
Expand Down
26 changes: 13 additions & 13 deletions src/browser/cssom/stylesheet.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,36 @@ const parser = @import("../netsurf.zig");

// https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet#specifications
pub const StyleSheet = struct {
disabled: bool,
href: []const u8,
owner_node: *parser.Node,
parent_stylesheet: ?*StyleSheet,
title: []const u8,
type: []const u8,

pub fn get_disabled(self: *StyleSheet) bool {
disabled: bool = false,
href: []const u8 = "",
owner_node: ?*parser.Node = null,
parent_stylesheet: ?*StyleSheet = null,
title: []const u8 = "",
type: []const u8 = "text/css",

pub fn get_disabled(self: *const StyleSheet) bool {
return self.disabled;
}

pub fn get_href(self: *StyleSheet) []const u8 {
pub fn get_href(self: *const StyleSheet) []const u8 {
return self.href;
}

// TODO: media

pub fn get_ownerNode(self: *StyleSheet) *parser.Node {
pub fn get_ownerNode(self: *const StyleSheet) ?*parser.Node {
return self.owner_node;
}

pub fn get_parentStyleSheet(self: *StyleSheet) ?*StyleSheet {
pub fn get_parentStyleSheet(self: *const StyleSheet) ?*StyleSheet {
return self.parent_stylesheet;
}

pub fn get_title(self: *StyleSheet) []const u8 {
pub fn get_title(self: *const StyleSheet) []const u8 {
return self.title;
}

pub fn get_type(self: *StyleSheet) []const u8 {
pub fn get_type(self: *const StyleSheet) []const u8 {
return self.type;
}
};