aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 940f98fc8fd..71547c860bc 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -526,10 +526,13 @@ impl Node {
/// Returns the rendered bounding content box if the element is rendered,
/// and none otherwise.
- pub fn bounding_content_box(&self) -> Rect<Au> {
+ pub fn bounding_content_box(&self) -> Option<Rect<Au>> {
window_from_node(self)
.content_box_query(self.to_trusted_node_address())
- .unwrap_or_else(Rect::zero)
+ }
+
+ pub fn bounding_content_box_or_zero(&self) -> Rect<Au> {
+ self.bounding_content_box().unwrap_or_else(Rect::zero)
}
pub fn content_boxes(&self) -> Vec<Rect<Au>> {