aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/query.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-11-04 13:32:15 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-11-04 13:32:15 +0530
commitb6850853da5fc677ecfa15d273159371a909ac6c (patch)
tree9f18fd025c9f9ece5c402810b4cb2afb4d387044 /components/layout/query.rs
parent4b9fa13f2f6a1aa38d180367426498f01f6414c9 (diff)
parentd95ca55f2642e9d3433d649c9b6c86c29f45887a (diff)
downloadservo-b6850853da5fc677ecfa15d273159371a909ac6c.tar.gz
servo-b6850853da5fc677ecfa15d273159371a909ac6c.zip
Auto merge of #8202 - dzbarsky:getComputedStyle, r=pcwalton
Allow retrieving width/height for non-positioned elements This was causing a bunch of tests in tests/wpt/web-platform-tests/html/semantics/embedded-content/the-canvas-element/size.attributes* to fail. They were returning "auto" instead of the correct size. They still fail because the returned size is off by a few pixels, not sure why yet. But this is more correct and may fix other failing tests. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8202) <!-- Reviewable:end -->
Diffstat (limited to 'components/layout/query.rs')
-rw-r--r--components/layout/query.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/components/layout/query.rs b/components/layout/query.rs
index d50e150d0ae..562e8f93aef 100644
--- a/components/layout/query.rs
+++ b/components/layout/query.rs
@@ -221,13 +221,14 @@ impl PositionRetrievingFragmentBorderBoxIterator {
}
impl FragmentBorderBoxIterator for PositionRetrievingFragmentBorderBoxIterator {
- fn process(&mut self, _: &Fragment, _: i32, border_box: &Rect<Au>) {
+ fn process(&mut self, fragment: &Fragment, _: i32, border_box: &Rect<Au>) {
+ let border_padding = fragment.border_padding.to_physical(fragment.style.writing_mode);
self.result =
Some(match self.property {
PositionProperty::Left => self.position.x,
PositionProperty::Top => self.position.y,
- PositionProperty::Width => border_box.size.width,
- PositionProperty::Height => border_box.size.height,
+ PositionProperty::Width => border_box.size.width - border_padding.horizontal(),
+ PositionProperty::Height => border_box.size.height - border_padding.vertical(),
// TODO: the following 2 calculations are completely wrong.
// They should return the difference between the parent's and this
// fragment's border boxes.