From 6be8482eeffeb585756b35797106341b0e32da77 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 13 Dec 2013 15:17:07 -0800 Subject: [PATCH] layout: Stop going to the DOM to guess width. --- src/components/main/layout/box.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/main/layout/box.rs b/src/components/main/layout/box.rs index 79293d85730..f745b0148b1 100644 --- a/src/components/main/layout/box.rs +++ b/src/components/main/layout/box.rs @@ -284,9 +284,12 @@ impl Box { } } + /// Returns the shared part of the width for computation of minimum and preferred width per + /// CSS 2.1. fn guess_width(&self) -> Au { - if !self.node.is_element() { - return Au(0) + match self.specific { + GenericBox | ImageBox(_) => {} + ScannedTextBox(_) | UnscannedTextBox(_) => return Au(0), } let style = self.style();