mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Implement the rules for parsing integers as defined by HTML, and use them for canvas.
This commit is contained in:
parent
940c013176
commit
e1b5b5183f
2 changed files with 64 additions and 4 deletions
|
@ -19,12 +19,11 @@ use dom::node::{Node, ElementNodeTypeId, window_from_node};
|
|||
use dom::virtualmethods::VirtualMethods;
|
||||
|
||||
use servo_util::atom::Atom;
|
||||
use servo_util::str::DOMString;
|
||||
use servo_util::str::{DOMString, parse_unsigned_integer};
|
||||
|
||||
use geom::size::Size2D;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::num;
|
||||
|
||||
static DefaultWidth: u32 = 300;
|
||||
static DefaultHeight: u32 = 150;
|
||||
|
@ -134,11 +133,11 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLCanvasElement> {
|
|||
|
||||
let recreate = match name.as_slice() {
|
||||
"width" => {
|
||||
self.width.set(num::from_str_radix(value.as_slice(), 10).unwrap());
|
||||
self.width.set(parse_unsigned_integer(value.as_slice().chars()).unwrap());
|
||||
true
|
||||
}
|
||||
"height" => {
|
||||
self.height.set(num::from_str_radix(value.as_slice(), 10).unwrap());
|
||||
self.height.set(parse_unsigned_integer(value.as_slice().chars()).unwrap());
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue