mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb+IDLGenerators: Support nullable union types
This commit is contained in:
Notes:
github-actions[bot]
2026-03-25 13:21:41 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/cfd795f907f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8534 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/tcl3
@@ -14,8 +14,10 @@
|
||||
|
||||
namespace Web::IntersectionObserver {
|
||||
|
||||
using NullableIntersectionObserverRoot = Variant<GC::Root<DOM::Element>, GC::Root<DOM::Document>, Empty>;
|
||||
|
||||
struct IntersectionObserverInit {
|
||||
Optional<Variant<GC::Root<DOM::Element>, GC::Root<DOM::Document>>> root;
|
||||
NullableIntersectionObserverRoot root { Empty {} };
|
||||
String root_margin { "0px"_string };
|
||||
String scroll_margin { "0px"_string };
|
||||
Variant<double, Vector<double>> threshold { 0 };
|
||||
@@ -42,7 +44,7 @@ public:
|
||||
|
||||
Vector<GC::Ref<DOM::Element>> const& observation_targets() const { return m_observation_targets; }
|
||||
|
||||
Variant<GC::Root<DOM::Element>, GC::Root<DOM::Document>, Empty> root() const;
|
||||
NullableIntersectionObserverRoot root() const;
|
||||
String root_margin() const;
|
||||
String scroll_margin() const;
|
||||
Vector<CSS::LengthPercentage> const& scroll_margin_values() const { return m_scroll_margin; }
|
||||
@@ -60,7 +62,7 @@ public:
|
||||
WebIDL::CallbackType& callback() { return *m_callback; }
|
||||
|
||||
private:
|
||||
explicit IntersectionObserver(JS::Realm&, GC::Ptr<WebIDL::CallbackType> callback, Optional<Variant<GC::Root<DOM::Element>, GC::Root<DOM::Document>>> const& root, Vector<CSS::LengthPercentage> root_margin, Vector<CSS::LengthPercentage> scroll_margin, Vector<double>&& thresholds, double debug, bool track_visibility);
|
||||
explicit IntersectionObserver(JS::Realm&, GC::Ptr<WebIDL::CallbackType> callback, NullableIntersectionObserverRoot const& root, Vector<CSS::LengthPercentage> root_margin, Vector<CSS::LengthPercentage> scroll_margin, Vector<double>&& thresholds, double debug, bool track_visibility);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
Reference in New Issue
Block a user