diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index dac4b40e6c37..ca1853a88125 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -70,6 +70,7 @@ use std::sync::{Arc, Mutex, MutexGuard}; use std::thread; use style::computed_values::{filter, mix_blend_mode}; use style::media_queries::{MediaType, MediaQueryList, Device}; +use style::properties::style_structs; use style::selector_matching::Stylist; use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt}; use url::Url; @@ -126,7 +127,7 @@ pub struct LayoutTaskData { /// A queued response for the content boxes of a node. pub content_boxes_response: Vec>, - /// A queued response for the client {top, left, width, height} of a node. + /// A queued response for the client {top, left, width, height} of a node in pixels. pub client_rect_response: Rect, /// The list of currently-running animations. @@ -1436,11 +1437,13 @@ impl FragmentLocatingFragmentIterator { impl FragmentBorderBoxIterator for FragmentLocatingFragmentIterator { fn process(&mut self, fragment: &Fragment, border_box: &Rect) { - let border_style_struct = fragment.style.get_border(); - let top_width = border_style_struct.border_top_width; - let right_width = border_style_struct.border_right_width; - let bottom_width = border_style_struct.border_bottom_width; - let left_width = border_style_struct.border_left_width; + let style_structs::Border { + border_top_width: top_width, + border_right_width: right_width, + border_bottom_width: bottom_width, + border_left_width: left_width, + .. + } = *fragment.style.get_border(); self.client_rect.origin.y = top_width.to_px(); self.client_rect.origin.x = left_width.to_px(); self.client_rect.size.width = (border_box.size.width - left_width - right_width).to_px(); diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs index 60270a80c4b0..1d5cdba2827c 100644 --- a/components/script/layout_interface.rs +++ b/components/script/layout_interface.rs @@ -95,7 +95,7 @@ pub trait LayoutRPC { fn content_box(&self) -> ContentBoxResponse; /// Requests the dimensions of all the content boxes, as in the `getClientRects()` call. fn content_boxes(&self) -> ContentBoxesResponse; - /// Requests the clientTop. + /// Requests the geometry of this node. Used by APIs such as `clientTop`. fn node_geometry(&self) -> NodeGeometryResponse; /// Requests the node containing the point of interest fn hit_test(&self, node: TrustedNodeAddress, point: Point2D) -> Result; diff --git a/tests/wpt/mozilla/tests/mozilla/client-top-left-height-width.html b/tests/wpt/mozilla/tests/mozilla/client-top-left-height-width.html index 9c22cac1109a..480ad34c9c1f 100644 --- a/tests/wpt/mozilla/tests/mozilla/client-top-left-height-width.html +++ b/tests/wpt/mozilla/tests/mozilla/client-top-left-height-width.html @@ -76,17 +76,13 @@
my div
my div
-
-
- X -
-
+ X
rotated
inline-block
display-none