diff options
-rw-r--r-- | components/script/devtools.rs | 2 | ||||
-rw-r--r-- | components/script/dom/document.rs | 2 | ||||
-rw-r--r-- | components/script/dom/element.rs | 16 | ||||
-rw-r--r-- | components/script/dom/htmlcollection.rs | 4 | ||||
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 4 | ||||
-rw-r--r-- | components/script/dom/node.rs | 30 | ||||
-rw-r--r-- | components/script/dom/window.rs | 2 | ||||
-rw-r--r-- | components/script/script_thread.rs | 2 | ||||
-rw-r--r-- | components/script/webdriver_handlers.rs | 8 |
9 files changed, 35 insertions, 35 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs index a1f5f21573c..70bda654b80 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -91,7 +91,7 @@ fn find_node_by_unique_id(page: &Rc<Page>, pipeline: PipelineId, node_id: String let node = document.upcast::<Node>(); for candidate in node.traverse_preorder() { - if candidate.get_unique_id() == node_id { + if candidate.unique_id() == node_id { return candidate; } } diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 12b47cf4d96..eb7e0da8a1b 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -356,7 +356,7 @@ impl Document { // that workable. match self.GetDocumentElement() { Some(root) => { - root.upcast::<Node>().get_has_dirty_descendants() || + root.upcast::<Node>().has_dirty_descendants() || !self.modified_elements.borrow().is_empty() } None => false, diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 677f9acda0e..42fab95947a 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -1431,7 +1431,7 @@ impl ElementMethods for Element { // https://drafts.csswg.org/cssom-view/#dom-element-getclientrects fn GetClientRects(&self) -> Root<DOMRectList> { let win = window_from_node(self); - let raw_rects = self.upcast::<Node>().get_content_boxes(); + let raw_rects = self.upcast::<Node>().content_boxes(); let rects = raw_rects.iter().map(|rect| { DOMRect::new(GlobalRef::Window(win.r()), rect.origin.x.to_f64_px(), @@ -1445,7 +1445,7 @@ impl ElementMethods for Element { // https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect fn GetBoundingClientRect(&self) -> Root<DOMRect> { let win = window_from_node(self); - let rect = self.upcast::<Node>().get_bounding_content_box(); + let rect = self.upcast::<Node>().bounding_content_box(); DOMRect::new(GlobalRef::Window(win.r()), rect.origin.x.to_f64_px(), rect.origin.y.to_f64_px(), @@ -1455,32 +1455,32 @@ impl ElementMethods for Element { // https://drafts.csswg.org/cssom-view/#dom-element-scrollwidth fn ScrollWidth(&self) -> i32 { - self.upcast::<Node>().get_scroll_area().size.width + self.upcast::<Node>().scroll_area().size.width } // https://drafts.csswg.org/cssom-view/#dom-element-scrollheight fn ScrollHeight(&self) -> i32 { - self.upcast::<Node>().get_scroll_area().size.height + self.upcast::<Node>().scroll_area().size.height } // https://drafts.csswg.org/cssom-view/#dom-element-clienttop fn ClientTop(&self) -> i32 { - self.upcast::<Node>().get_client_rect().origin.y + self.upcast::<Node>().client_rect().origin.y } // https://drafts.csswg.org/cssom-view/#dom-element-clientleft fn ClientLeft(&self) -> i32 { - self.upcast::<Node>().get_client_rect().origin.x + self.upcast::<Node>().client_rect().origin.x } // https://drafts.csswg.org/cssom-view/#dom-element-clientwidth fn ClientWidth(&self) -> i32 { - self.upcast::<Node>().get_client_rect().size.width + self.upcast::<Node>().client_rect().size.width } // https://drafts.csswg.org/cssom-view/#dom-element-clientheight fn ClientHeight(&self) -> i32 { - self.upcast::<Node>().get_client_rect().size.height + self.upcast::<Node>().client_rect().size.height } /// https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index 25e17586f9b..a7bf82ae50e 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -72,7 +72,7 @@ impl HTMLCollection { root: JS::from_ref(root), filter: filter, // Default values for the cache - cached_version: Cell::new(root.get_inclusive_descendants_version()), + cached_version: Cell::new(root.inclusive_descendants_version()), cached_cursor_element: MutNullableHeap::new(None), cached_cursor_index: Cell::new(OptionU32::none()), cached_length: Cell::new(OptionU32::none()), @@ -93,7 +93,7 @@ impl HTMLCollection { fn validate_cache(&self) { // Clear the cache if the root version is different from our cached version let cached_version = self.cached_version.get(); - let curr_version = self.root.get_inclusive_descendants_version(); + let curr_version = self.root.inclusive_descendants_version(); if curr_version != cached_version { // Default values for the cache self.cached_version.set(curr_version); diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index b6a43ad164f..73046e5230d 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -236,7 +236,7 @@ impl HTMLImageElementMethods for HTMLImageElement { // https://html.spec.whatwg.org/multipage/#dom-img-width fn Width(&self) -> u32 { let node = self.upcast::<Node>(); - let rect = node.get_bounding_content_box(); + let rect = node.bounding_content_box(); rect.size.width.to_px() as u32 } @@ -248,7 +248,7 @@ impl HTMLImageElementMethods for HTMLImageElement { // https://html.spec.whatwg.org/multipage/#dom-img-height fn Height(&self) -> u32 { let node = self.upcast::<Node>(); - let rect = node.get_bounding_content_box(); + let rect = node.bounding_content_box(); rect.size.height.to_px() as u32 } diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 730f69f24cd..39ad21a46b6 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -420,7 +420,7 @@ impl Node { self.flags.set(flags); } - pub fn get_has_changed(&self) -> bool { + pub fn has_changed(&self) -> bool { self.get_flag(HAS_CHANGED) } @@ -428,7 +428,7 @@ impl Node { self.set_flag(HAS_CHANGED, state) } - pub fn get_is_dirty(&self) -> bool { + pub fn is_dirty(&self) -> bool { self.get_flag(IS_DIRTY) } @@ -436,7 +436,7 @@ impl Node { self.set_flag(IS_DIRTY, state) } - pub fn get_has_dirty_descendants(&self) -> bool { + pub fn has_dirty_descendants(&self) -> bool { self.get_flag(HAS_DIRTY_DESCENDANTS) } @@ -454,7 +454,7 @@ impl Node { // the document's version, but we do have to deal with the case where the node has moved // document, so may have a higher version count than its owning document. let doc: Root<Node> = Root::upcast(self.owner_doc()); - let version = max(self.get_inclusive_descendants_version(), doc.get_inclusive_descendants_version()) + 1; + let version = max(self.inclusive_descendants_version(), doc.inclusive_descendants_version()) + 1; for ancestor in self.inclusive_ancestors() { ancestor.inclusive_descendants_version.set(version); } @@ -475,14 +475,14 @@ impl Node { NodeDamage::OtherNodeDamage => self.set_has_changed(true), } - if self.get_is_dirty() && !force_ancestors { + if self.is_dirty() && !force_ancestors { return } // 2. Dirty descendants. fn dirty_subtree(node: &Node) { // Stop if this subtree is already dirty. - if node.get_is_dirty() { return } + if node.is_dirty() { return } node.set_flag(IS_DIRTY | HAS_DIRTY_DESCENDANTS, true); @@ -495,13 +495,13 @@ impl Node { // 4. Dirty ancestors. for ancestor in self.ancestors() { - if !force_ancestors && ancestor.get_has_dirty_descendants() { break } + if !force_ancestors && ancestor.has_dirty_descendants() { break } ancestor.set_has_dirty_descendants(true); } } /// The maximum version number of this node's descendants, including itself - pub fn get_inclusive_descendants_version(&self) -> u64 { + pub fn inclusive_descendants_version(&self) -> u64 { self.inclusive_descendants_version.get() } @@ -570,15 +570,15 @@ impl Node { TrustedNodeAddress(&*self as *const Node as *const libc::c_void) } - pub fn get_bounding_content_box(&self) -> Rect<Au> { + pub fn bounding_content_box(&self) -> Rect<Au> { window_from_node(self).content_box_query(self.to_trusted_node_address()) } - pub fn get_content_boxes(&self) -> Vec<Rect<Au>> { + pub fn content_boxes(&self) -> Vec<Rect<Au>> { window_from_node(self).content_boxes_query(self.to_trusted_node_address()) } - pub fn get_client_rect(&self) -> Rect<i32> { + pub fn client_rect(&self) -> Rect<i32> { window_from_node(self).client_rect_query(self.to_trusted_node_address()) } @@ -586,7 +586,7 @@ impl Node { // https://drafts.csswg.org/cssom-view/#dom-element-scrollheight // https://drafts.csswg.org/cssom-view/#dom-element-scrolltop // https://drafts.csswg.org/cssom-view/#dom-element-scrollleft - pub fn get_scroll_area(&self) -> Rect<i32> { + pub fn scroll_area(&self) -> Rect<i32> { // Step 1 let document = self.owner_doc(); // Step 3 @@ -798,15 +798,15 @@ impl Node { } } - pub fn get_unique_id(&self) -> String { + pub fn unique_id(&self) -> String { self.unique_id.borrow().to_simple_string() } pub fn summarize(&self) -> NodeInfo { NodeInfo { - uniqueId: self.get_unique_id(), + uniqueId: self.unique_id(), baseURI: String::from(self.BaseURI()), - parent: self.GetParentNode().map_or("".to_owned(), |node| node.get_unique_id()), + parent: self.GetParentNode().map_or("".to_owned(), |node| node.unique_id()), nodeType: self.NodeType(), namespaceURI: String::new(), //FIXME nodeName: String::from(self.NodeName()), diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index a8b55cf8c06..3884a42b8b7 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -890,7 +890,7 @@ impl Window { let body = self.Document().GetBody(); let (x, y) = match body { Some(e) => { - let content_size = e.upcast::<Node>().get_bounding_content_box(); + let content_size = e.upcast::<Node>().bounding_content_box(); let content_height = content_size.size.height.to_f64_px(); let content_width = content_size.size.width.to_f64_px(); (xfinite.max(0.0f64).min(content_width - width), diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 1f6adc177c1..b24af89193e 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -1843,7 +1843,7 @@ impl ScriptThread { // Really what needs to happen is that this needs to go through layout to ask which // layer the element belongs to, and have it send the scroll message to the // compositor. - let rect = element.upcast::<Node>().get_bounding_content_box(); + let rect = element.upcast::<Node>().bounding_content_box(); // In order to align with element edges, we snap to unscaled pixel boundaries, since the // paint thread currently does the same for drawing elements. This is important for pages diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index e51a2e23804..acd375b6690 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -40,7 +40,7 @@ use util::str::DOMString; fn find_node_by_unique_id(page: &Rc<Page>, pipeline: PipelineId, node_id: String) -> Option<Root<Node>> { let page = get_page(&*page, pipeline); let document = page.document(); - document.upcast::<Node>().traverse_preorder().find(|candidate| candidate.get_unique_id() == node_id) + document.upcast::<Node>().traverse_preorder().find(|candidate| candidate.unique_id() == node_id) } #[allow(unsafe_code)] @@ -124,7 +124,7 @@ pub fn handle_find_element_css(page: &Rc<Page>, _pipeline: PipelineId, selector: reply: IpcSender<Result<Option<String>, ()>>) { reply.send(match page.document().QuerySelector(DOMString::from(selector)) { Ok(node) => { - Ok(node.map(|x| x.upcast::<Node>().get_unique_id())) + Ok(node.map(|x| x.upcast::<Node>().unique_id())) } Err(_) => Err(()) }).unwrap(); @@ -139,7 +139,7 @@ pub fn handle_find_elements_css(page: &Rc<Page>, let mut result = Vec::with_capacity(nodes.Length() as usize); for i in 0..nodes.Length() { if let Some(ref node) = nodes.Item(i) { - result.push(node.get_unique_id()); + result.push(node.unique_id()); } } Ok(result) @@ -173,7 +173,7 @@ pub fn handle_get_active_element(page: &Rc<Page>, _pipeline: PipelineId, reply: IpcSender<Option<String>>) { reply.send(page.document().GetActiveElement().map( - |elem| elem.upcast::<Node>().get_unique_id())).unwrap(); + |elem| elem.upcast::<Node>().unique_id())).unwrap(); } pub fn handle_get_title(page: &Rc<Page>, _pipeline: PipelineId, reply: IpcSender<String>) { |