Merge pull request #45 from DrMarcII/master

Minor cleanup.
diff --git a/lib/src/common.dart b/lib/src/common.dart
index 59a4a99..283ac9a 100644
--- a/lib/src/common.dart
+++ b/lib/src/common.dart
@@ -14,27 +14,6 @@
   Future<String> operator [](String name) => _get(name);
 }
 
-class Size {
-  final num height;
-  final num width;
-
-  const Size(this.height, this.width);
-
-  Size.fromJson(Map json) : this(json['height'], json['width']);
-
-  Map<String, num> toJson() => {'height': height, 'width': width};
-
-  @override
-  int get hashCode => height.hashCode * 3 + width.hashCode;
-
-  @override
-  bool operator ==(other) =>
-      other is Size && other.height == this.height && other.width == this.width;
-
-  @override
-  String toString() => 'Size<${height}h X ${width}w>';
-}
-
 abstract class SearchContext {
   WebDriver get driver;
 
diff --git a/lib/src/web_element.dart b/lib/src/web_element.dart
index fa9870e..55310a9 100644
--- a/lib/src/web_element.dart
+++ b/lib/src/web_element.dart
@@ -56,9 +56,10 @@
   }
 
   /// The size of this element.
-  Future<Size> get size async {
+  Future<Rectangle<int>> get size async {
     var size = await _get('size');
-    return new Size.fromJson(size);
+    return new Rectangle<int>(
+        0, 0, size['width'].toInt(), size['height'].toInt());
   }
 
   /// The tag name for this element.
diff --git a/lib/src/window.dart b/lib/src/window.dart
index 49235de..15611a5 100644
--- a/lib/src/window.dart
+++ b/lib/src/window.dart
@@ -12,9 +12,10 @@
         super(driver, 'window/$handle');
 
   /// The size of this window.
-  Future<Size> get size async {
+  Future<Rectangle<int>> get size async {
     var size = await _get('size');
-    return new Size.fromJson(size);
+    return new Rectangle<int>(
+        0, 0, size['width'].toInt(), size['height'].toInt());
   }
 
   /// The location of this window.
@@ -29,13 +30,14 @@
   }
 
   /// Set this window size.
-  Future setSize(Size size) async {
-    await _post('size', size);
+  Future setSize(Rectangle<int> size) async {
+    await _post(
+        'size', {'width': size.width.toInt(), 'height': size.height.toInt()});
   }
 
   /// Set this window location.
   Future setLocation(Point<int> point) async {
-    await _post('position', {'x': point.x, 'y': point.y});
+    await _post('position', {'x': point.x.toInt(), 'y': point.y.toInt()});
   }
 
   @override
diff --git a/lib/webdriver.dart b/lib/webdriver.dart
index 66b242d..00aa2c6 100644
--- a/lib/webdriver.dart
+++ b/lib/webdriver.dart
@@ -8,8 +8,8 @@
 import 'dart:collection';
 import 'dart:convert';
 import 'dart:io';
-import 'dart:math' show Point;
-export 'dart:math' show Point;
+import 'dart:math' show Point, Rectangle;
+export 'dart:math' show Point, Rectangle;
 
 import 'package:crypto/crypto.dart';
 import 'package:matcher/matcher.dart';
diff --git a/test/src/web_element_test.dart b/test/src/web_element_test.dart
index b7c24f9..59c9095 100644
--- a/test/src/web_element_test.dart
+++ b/test/src/web_element_test.dart
@@ -96,14 +96,14 @@
 
     test('size -- table', () async {
       var size = await table.size;
-      expect(size, isSize);
+      expect(size, isRectangle);
       expect(size.width, isNonNegative);
       expect(size.height, isNonNegative);
     });
 
     test('size -- invisible', () async {
       var size = await invisible.size;
-      expect(size, isSize);
+      expect(size, isRectangle);
       // TODO(DrMarcII): I thought these should be 0
       expect(size.width, isNonNegative);
       expect(size.height, isNonNegative);
diff --git a/test/src/window_test.dart b/test/src/window_test.dart
index 80a34b5..482ceeb 100644
--- a/test/src/window_test.dart
+++ b/test/src/window_test.dart
@@ -21,7 +21,7 @@
 
     test('size', () async {
       var window = await driver.window;
-      var size = const Size(400, 600);
+      var size = const Rectangle<int>(0, 0, 600, 400);
       await window.setSize(size);
       expect(await window.size, size);
     });
@@ -36,7 +36,7 @@
     // May not work on some OS/browser combinations (notably Mac OS X).
     skip_test('maximize', () async {
       var window = await driver.window;
-      await window.setSize(const Size(200, 300));
+      await window.setSize(const Rectangle<int>(0, 0, 300, 200));
       await window.setLocation(const Point<int>(100, 200));
       await window.maximize();
 
diff --git a/test/test_util.dart b/test/test_util.dart
index 7219135..c218b0b 100644
--- a/test/test_util.dart
+++ b/test/test_util.dart
@@ -13,7 +13,7 @@
 import 'package:webdriver/webdriver.dart';
 
 final Matcher isWebElement = new isInstanceOf<WebElement>();
-final Matcher isSize = new isInstanceOf<Size>();
+final Matcher isRectangle = new isInstanceOf<Rectangle<int>>();
 final Matcher isPoint = new isInstanceOf<Point<int>>();
 
 bool isRunningOnTravis() => io.Platform.environment['TRAVIS'] == 'true';