mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Replace CanGc::note() calls with arguments in components/script/dom
(#33692)
* Replace CanGc::note() calls with arguments in components/script/dom Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Add methods to Bindings.conf Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Modify existing interface sections Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Resolve conflicts Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> --------- Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
This commit is contained in:
parent
38c5ebbf8e
commit
39133a5478
8 changed files with 53 additions and 31 deletions
|
@ -23,7 +23,7 @@ DOMInterfaces = {
|
|||
},
|
||||
|
||||
'BaseAudioContext': {
|
||||
'inRealms': ['DecodeAudioData', 'Resume'],
|
||||
'inRealms': ['DecodeAudioData', 'Resume', 'ParseFromString', 'GetBounds', 'GetClientRects'],
|
||||
},
|
||||
|
||||
'Blob': {
|
||||
|
@ -71,7 +71,7 @@ DOMInterfaces = {
|
|||
},
|
||||
|
||||
'Element': {
|
||||
'canGc': ['InsertAdjacentHTML', 'SetInnerHTML', 'SetOuterHTML'],
|
||||
'canGc': ['SetInnerHTML', 'SetOuterHTML', 'InsertAdjacentHTML', 'GetClientRects', 'GetBoundingClientRect'],
|
||||
},
|
||||
|
||||
'EventSource': {
|
||||
|
@ -118,7 +118,7 @@ DOMInterfaces = {
|
|||
},
|
||||
|
||||
'MediaDevices': {
|
||||
'inRealms': ['GetUserMedia'],
|
||||
'inRealms': ['GetUserMedia', 'GetClientRects', 'GetBoundingClientRect'],
|
||||
},
|
||||
|
||||
'MediaQueryList': {
|
||||
|
|
|
@ -90,7 +90,7 @@ impl DOMParserMethods for DOMParser {
|
|||
Default::default(),
|
||||
can_gc,
|
||||
);
|
||||
ServoParser::parse_html_document(&document, Some(s), url, CanGc::note());
|
||||
ServoParser::parse_html_document(&document, Some(s), url, can_gc);
|
||||
document.set_ready_state(DocumentReadyState::Complete);
|
||||
Ok(document)
|
||||
},
|
||||
|
@ -112,7 +112,7 @@ impl DOMParserMethods for DOMParser {
|
|||
Default::default(),
|
||||
can_gc,
|
||||
);
|
||||
ServoParser::parse_xml_document(&document, Some(s), url, CanGc::note());
|
||||
ServoParser::parse_xml_document(&document, Some(s), url, can_gc);
|
||||
document.set_ready_state(DocumentReadyState::Complete);
|
||||
Ok(document)
|
||||
},
|
||||
|
|
|
@ -162,6 +162,13 @@ impl DOMQuadMethods for DOMQuad {
|
|||
.max(self.p3.Y())
|
||||
.max(self.p4.Y());
|
||||
|
||||
DOMRect::new(&self.global(), left, top, right - left, bottom - top)
|
||||
DOMRect::new(
|
||||
&self.global(),
|
||||
left,
|
||||
top,
|
||||
right - left,
|
||||
bottom - top,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,15 @@ impl DOMRect {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, x: f64, y: f64, width: f64, height: f64) -> DomRoot<DOMRect> {
|
||||
Self::new_with_proto(global, None, x, y, width, height, CanGc::note())
|
||||
pub fn new(
|
||||
global: &GlobalScope,
|
||||
x: f64,
|
||||
y: f64,
|
||||
width: f64,
|
||||
height: f64,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<DOMRect> {
|
||||
Self::new_with_proto(global, None, x, y, width, height, can_gc)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
|
|
|
@ -2341,7 +2341,7 @@ impl ElementMethods for Element {
|
|||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#dom-element-getclientrects
|
||||
fn GetClientRects(&self) -> Vec<DomRoot<DOMRect>> {
|
||||
fn GetClientRects(&self, can_gc: CanGc) -> Vec<DomRoot<DOMRect>> {
|
||||
let win = window_from_node(self);
|
||||
let raw_rects = self.upcast::<Node>().content_boxes();
|
||||
raw_rects
|
||||
|
@ -2353,13 +2353,14 @@ impl ElementMethods for Element {
|
|||
rect.origin.y.to_f64_px(),
|
||||
rect.size.width.to_f64_px(),
|
||||
rect.size.height.to_f64_px(),
|
||||
can_gc,
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect
|
||||
fn GetBoundingClientRect(&self) -> DomRoot<DOMRect> {
|
||||
fn GetBoundingClientRect(&self, can_gc: CanGc) -> DomRoot<DOMRect> {
|
||||
let win = window_from_node(self);
|
||||
let rect = self.upcast::<Node>().bounding_content_box_or_zero();
|
||||
DOMRect::new(
|
||||
|
@ -2368,6 +2369,7 @@ impl ElementMethods for Element {
|
|||
rect.origin.y.to_f64_px(),
|
||||
rect.size.width.to_f64_px(),
|
||||
rect.size.height.to_f64_px(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1823,7 +1823,9 @@ impl VirtualMethods for HTMLImageElement {
|
|||
mouse_event.ClientX().to_f32().unwrap(),
|
||||
mouse_event.ClientY().to_f32().unwrap(),
|
||||
);
|
||||
let bcr = self.upcast::<Element>().GetBoundingClientRect();
|
||||
let bcr = self
|
||||
.upcast::<Element>()
|
||||
.GetBoundingClientRect(CanGc::note());
|
||||
let bcr_p = Point2D::new(bcr.X() as f32, bcr.Y() as f32);
|
||||
|
||||
// Walk HTMLAreaElements
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue