diff options
author | Josh Matthews <josh@joshmatthews.net> | 2024-10-07 21:51:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-08 01:51:58 +0000 |
commit | 7d931e673af2780f3f62d52cb17324ec2cc68c71 (patch) | |
tree | 450d534196e9eb8d0e04db37203b414f5d92420d /components/script/dom/performanceobserver.rs | |
parent | 946fa9cdee68bb834a3b75821e8e7f94cf86d31c (diff) | |
download | servo-7d931e673af2780f3f62d52cb17324ec2cc68c71.tar.gz servo-7d931e673af2780f3f62d52cb17324ec2cc68c71.zip |
script: Include constructors and static methods in generated DOM traits (#33665)
* Add all constructors, special operations, and static methods to generated DOM interface traits.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Move all constructors and static methods defined in bare impl blocks inside FooMethods trait impls.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Add missing doc links.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script/dom/performanceobserver.rs')
-rw-r--r-- | components/script/dom/performanceobserver.rs | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/components/script/dom/performanceobserver.rs b/components/script/dom/performanceobserver.rs index 62499393455..167a997287d 100644 --- a/components/script/dom/performanceobserver.rs +++ b/components/script/dom/performanceobserver.rs @@ -86,22 +86,6 @@ impl PerformanceObserver { reflect_dom_object_with_proto(Box::new(observer), global, proto, can_gc) } - #[allow(non_snake_case)] - pub fn Constructor( - global: &GlobalScope, - proto: Option<HandleObject>, - can_gc: CanGc, - callback: Rc<PerformanceObserverCallback>, - ) -> Fallible<DomRoot<PerformanceObserver>> { - Ok(PerformanceObserver::new_with_proto( - global, - proto, - callback, - Vec::new(), - can_gc, - )) - } - /// Buffer a new performance entry. pub fn queue_entry(&self, entry: &PerformanceEntry) { self.entries.borrow_mut().push(DomRoot::from_ref(entry)); @@ -132,17 +116,32 @@ impl PerformanceObserver { pub fn set_entries(&self, entries: DOMPerformanceEntryList) { *self.entries.borrow_mut() = entries; } +} + +impl PerformanceObserverMethods for PerformanceObserver { + // https://w3c.github.io/performance-timeline/#dom-performanceobserver-constructor + fn Constructor( + global: &GlobalScope, + proto: Option<HandleObject>, + can_gc: CanGc, + callback: Rc<PerformanceObserverCallback>, + ) -> Fallible<DomRoot<PerformanceObserver>> { + Ok(PerformanceObserver::new_with_proto( + global, + proto, + callback, + Vec::new(), + can_gc, + )) + } // https://w3c.github.io/performance-timeline/#supportedentrytypes-attribute - #[allow(non_snake_case)] - pub fn SupportedEntryTypes(cx: JSContext, global: &GlobalScope) -> JSVal { + fn SupportedEntryTypes(cx: JSContext, global: &GlobalScope) -> JSVal { // While this is exposed through a method of PerformanceObserver, // it is specified as associated with the global scope. global.supported_performance_entry_types(cx) } -} -impl PerformanceObserverMethods for PerformanceObserver { // https://w3c.github.io/performance-timeline/#dom-performanceobserver-observe() fn Observe(&self, options: &PerformanceObserverInit) -> Fallible<()> { // Step 1 is self |