mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
script: Pass &mut JSContext to DOM apis that call Element::create (#43108)
Testing: No behaviour change, a successful build is enough. Part of #40600 --------- Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix, QualName, local_name, ns};
|
||||
use js::context::JSContext;
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::color::AbsoluteColor;
|
||||
@@ -78,12 +79,13 @@ impl HTMLTableSectionElementMethods<crate::DomTypeHolder> for HTMLTableSectionEl
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-tbody-insertrow>
|
||||
fn InsertRow(&self, index: i32, can_gc: CanGc) -> Fallible<DomRoot<HTMLElement>> {
|
||||
fn InsertRow(&self, cx: &mut JSContext, index: i32) -> Fallible<DomRoot<HTMLElement>> {
|
||||
let node = self.upcast::<Node>();
|
||||
node.insert_cell_or_row(
|
||||
cx,
|
||||
index,
|
||||
|| self.Rows(),
|
||||
|| {
|
||||
|cx| {
|
||||
let row = Element::create(
|
||||
QualName::new(None, ns!(html), local_name!("tr")),
|
||||
None,
|
||||
@@ -91,11 +93,10 @@ impl HTMLTableSectionElementMethods<crate::DomTypeHolder> for HTMLTableSectionEl
|
||||
ElementCreator::ScriptCreated,
|
||||
CustomElementCreationMode::Asynchronous,
|
||||
None,
|
||||
can_gc,
|
||||
CanGc::from_cx(cx),
|
||||
);
|
||||
DomRoot::downcast::<HTMLTableRowElement>(row).unwrap()
|
||||
},
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user