mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
script: Use &mut JSContext in HTMLMapElement&HTMLImageElement (#43284)
I just want to be part of the campaign. Testing: It compiles. --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> Co-authored-by: Sam <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
@@ -1937,9 +1937,9 @@ impl HTMLImageElementMethods<crate::DomTypeHolder> for HTMLImageElement {
|
||||
make_setter!(SetReferrerPolicy, "referrerpolicy");
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-img-decode>
|
||||
fn Decode(&self, can_gc: CanGc) -> Rc<Promise> {
|
||||
fn Decode(&self, cx: &mut JSContext) -> Rc<Promise> {
|
||||
// Step 1. Let promise be a new promise.
|
||||
let promise = Promise::new(&self.global(), can_gc);
|
||||
let promise = Promise::new2(cx, &self.global());
|
||||
|
||||
// Step 2. Queue a microtask to perform the following steps:
|
||||
let task = ImageElementMicrotask::Decode {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix};
|
||||
use js::context::JSContext;
|
||||
use js::rust::HandleObject;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLMapElementBinding::HTMLMapElementMethods;
|
||||
@@ -67,7 +68,7 @@ impl HTMLMapElementMethods<crate::DomTypeHolder> for HTMLMapElement {
|
||||
make_atomic_setter!(SetName, "name");
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-map-areas>
|
||||
fn Areas(&self, can_gc: CanGc) -> DomRoot<HTMLCollection> {
|
||||
fn Areas(&self, cx: &mut JSContext) -> DomRoot<HTMLCollection> {
|
||||
// The areas attribute must return an HTMLCollection rooted at the map element, whose filter
|
||||
// matches only area elements.
|
||||
self.areas.or_init(|| {
|
||||
@@ -75,7 +76,7 @@ impl HTMLMapElementMethods<crate::DomTypeHolder> for HTMLMapElement {
|
||||
&self.owner_window(),
|
||||
self.upcast(),
|
||||
|element, _| element.is::<HTMLAreaElement>(),
|
||||
can_gc,
|
||||
CanGc::from_cx(cx),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -477,8 +477,7 @@ DOMInterfaces = {
|
||||
},
|
||||
|
||||
'HTMLImageElement': {
|
||||
'canGc': ['Decode'],
|
||||
'cx': ['Image', 'ReportValidity', 'SetCrossOrigin'],
|
||||
'cx': ['Decode', 'Image', 'ReportValidity', 'SetCrossOrigin'],
|
||||
},
|
||||
|
||||
'HTMLInputElement': {
|
||||
@@ -492,7 +491,7 @@ DOMInterfaces = {
|
||||
},
|
||||
|
||||
'HTMLMapElement': {
|
||||
'canGc': ['Areas'],
|
||||
'cx': ['Areas'],
|
||||
},
|
||||
|
||||
'HTMLMediaElement': {
|
||||
|
||||
Reference in New Issue
Block a user