diff --git a/components/style/dom.rs b/components/style/dom.rs index dd32dac6f0f..e89c662f89c 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -944,7 +944,7 @@ pub trait TElement: -> &::BorrowedNamespaceUrl; /// Returns the size of the primary box of the element. - fn primary_box_size(&self) -> euclid::default::Size2D; + fn primary_content_box_size(&self) -> euclid::default::Size2D; } /// TNode and TElement aren't Send because we want to be careful and explicit diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 92a532907f7..86a8d31d1d1 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1041,7 +1041,7 @@ impl<'le> TElement for GeckoElement<'le> { } #[inline] - fn primary_box_size(&self) -> Size2D { + fn primary_content_box_size(&self) -> Size2D { if !self.as_node().is_connected() { return Size2D::zero(); } @@ -1058,7 +1058,10 @@ impl<'le> TElement for GeckoElement<'le> { if frame.is_null() { return Size2D::zero(); } - Size2D::new(Au((**frame).mRect.width), Au((**frame).mRect.height)) + let mut width = 0; + let mut height = 0; + bindings::Gecko_ContentSize(*frame, &mut width, &mut height); + Size2D::new(Au(width), Au(height)) } } diff --git a/components/style/stylesheets/container_rule.rs b/components/style/stylesheets/container_rule.rs index 2d7356cf351..9c12043b789 100644 --- a/components/style/stylesheets/container_rule.rs +++ b/components/style/stylesheets/container_rule.rs @@ -201,7 +201,7 @@ impl ContainerCondition { } } - let size = potential_container.primary_box_size(); + let size = potential_container.primary_content_box_size(); let style = style.clone(); TraversalResult::Done(ContainerLookupResult { element: potential_container, @@ -464,7 +464,7 @@ impl<'a> ContainerSizeQuery<'a> { let box_style = style.get_box(); let container_type = box_style.clone_container_type(); - let size = e.primary_box_size(); + let size = e.primary_content_box_size(); match container_type { ContainerType::Size=> { TraversalResult::Done(