aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2015-11-14 16:56:42 -0800
committerJosh Matthews <josh@joshmatthews.net>2016-02-25 14:04:06 -0500
commit7b671d13a02a8d26f7d7769a6d2d62b2be8df5ac (patch)
tree85eec1c9631f7568453a1bc358a6a68882d27c3b /components/script/dom/element.rs
parentb188cb542e92f3490b049e8db8473c7e2acf6dc9 (diff)
downloadservo-7b671d13a02a8d26f7d7769a6d2d62b2be8df5ac.tar.gz
servo-7b671d13a02a8d26f7d7769a6d2d62b2be8df5ac.zip
Use presentation hints correctly for the dimensions of `<img>`.
Mostly straightforward; includes some extra fixes to make `<canvas>` work the same way as `<img>` for reflow.
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index c1a60c3c2e5..98c0a8eb799 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -43,6 +43,7 @@ use dom::htmlfieldsetelement::HTMLFieldSetElement;
use dom::htmlfontelement::{HTMLFontElement, HTMLFontElementLayoutHelpers};
use dom::htmlhrelement::{HTMLHRElement, HTMLHRLayoutHelpers};
use dom::htmliframeelement::{HTMLIFrameElement, HTMLIFrameElementLayoutMethods};
+use dom::htmlimageelement::{HTMLImageElement, LayoutHTMLImageElementHelpers};
use dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
use dom::htmllabelelement::HTMLLabelElement;
use dom::htmllegendelement::HTMLLegendElement;
@@ -392,6 +393,8 @@ impl LayoutElementHelpers for LayoutJS<Element> {
let width = if let Some(this) = self.downcast::<HTMLIFrameElement>() {
this.get_width()
+ } else if let Some(this) = self.downcast::<HTMLImageElement>() {
+ this.get_width()
} else if let Some(this) = self.downcast::<HTMLTableElement>() {
this.get_width()
} else if let Some(this) = self.downcast::<HTMLTableCellElement>() {
@@ -422,6 +425,8 @@ impl LayoutElementHelpers for LayoutJS<Element> {
let height = if let Some(this) = self.downcast::<HTMLIFrameElement>() {
this.get_height()
+ } else if let Some(this) = self.downcast::<HTMLImageElement>() {
+ this.get_height()
} else {
LengthOrPercentageOrAuto::Auto
};