aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-12-22 21:58:38 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-12-22 21:58:38 +0530
commit9306be60c23bdb828dc41f3379e77781d3eafff7 (patch)
tree7bb3b1f9fd241377d69a0d6694bcb4ba06c7cf13 /components/script
parent48388ad0369368f2d8a631a3fb1cf46892434130 (diff)
parent7a2b3535f9a326fd13500b2553c2bcd0d162e145 (diff)
downloadservo-9306be60c23bdb828dc41f3379e77781d3eafff7.tar.gz
servo-9306be60c23bdb828dc41f3379e77781d3eafff7.zip
Auto merge of #9048 - frewsxcv:precompute-iframe, r=Ms2ger
Precompute width & height attribute values on <iframe> <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9048) <!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/htmliframeelement.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 172a6b1fbd6..8b3def1c7cb 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -35,8 +35,7 @@ use std::cell::Cell;
use string_cache::Atom;
use url::Url;
use util::prefs;
-use util::str::DOMString;
-use util::str::{self, LengthOrPercentageOrAuto};
+use util::str::{DOMString, LengthOrPercentageOrAuto};
pub fn mozbrowser_enabled() -> bool {
prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false)
@@ -239,7 +238,8 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(), &atom!("width"))
- .map(|attribute| str::parse_length(&attribute))
+ .map(AttrValue::as_dimension)
+ .cloned()
.unwrap_or(LengthOrPercentageOrAuto::Auto)
}
}
@@ -249,7 +249,8 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
unsafe {
(*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(), &atom!("height"))
- .map(|attribute| str::parse_length(&attribute))
+ .map(AttrValue::as_dimension)
+ .cloned()
.unwrap_or(LengthOrPercentageOrAuto::Auto)
}
}
@@ -423,12 +424,12 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
// https://html.spec.whatwg.org/multipage/#dom-dim-width
make_getter!(Width, "width");
// https://html.spec.whatwg.org/multipage/#dom-dim-width
- make_setter!(SetWidth, "width");
+ make_dimension_setter!(SetWidth, "width");
// https://html.spec.whatwg.org/multipage/#dom-dim-height
make_getter!(Height, "height");
// https://html.spec.whatwg.org/multipage/#dom-dim-height
- make_setter!(SetHeight, "height");
+ make_dimension_setter!(SetHeight, "height");
}
impl VirtualMethods for HTMLIFrameElement {
@@ -470,6 +471,8 @@ impl VirtualMethods for HTMLIFrameElement {
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
match name {
&atom!("sandbox") => AttrValue::from_serialized_tokenlist(value),
+ &atom!("width") => AttrValue::from_dimension(value),
+ &atom!("height") => AttrValue::from_dimension(value),
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
}
}