mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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>
This commit is contained in:
parent
946fa9cdee
commit
7d931e673a
133 changed files with 1479 additions and 1438 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue