Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: client/html/src/DocumentFragmentWrappingImplementation.dart

Issue 8363040: Implement measurement using futures (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove duplicated imports from html.dart Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/html/src/Document.dart ('k') | client/html/src/DocumentWrappingImplementation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/html/src/DocumentFragmentWrappingImplementation.dart
diff --git a/client/html/src/DocumentFragmentWrappingImplementation.dart b/client/html/src/DocumentFragmentWrappingImplementation.dart
index 0417426aa928234d4f206aa1c88b79e901e44d90..c62c2ae8c2ee515433ec261fb98909f05a4e8510 100644
--- a/client/html/src/DocumentFragmentWrappingImplementation.dart
+++ b/client/html/src/DocumentFragmentWrappingImplementation.dart
@@ -131,13 +131,19 @@ class EmptyStyleDeclaration extends CSSStyleDeclarationWrappingImplementation {
}
}
-class EmptyClientRect implements ClientRect {
- num get bottom() => 0;
- num get top() => 0;
- num get left() => 0;
- num get right() => 0;
- num get height() => 0;
- num get width() => 0;
+Future<CSSStyleDeclaration> _emptyStyleFuture() {
+ return _createMeasurementFuture(() => new EmptyStyleDeclaration(),
+ new Completer<CSSStyleDeclaration>());
+}
+
+class EmptyElementRect implements ElementRect {
+ final ClientRect client = const SimpleClientRect(0, 0, 0, 0);
+ final ClientRect offset = const SimpleClientRect(0, 0, 0, 0);
+ final ClientRect scroll = const SimpleClientRect(0, 0, 0, 0);
+ final ClientRect bounding = const SimpleClientRect(0, 0, 0, 0);
+ final List<ClientRect> clientRects = const <ClientRect>[];
+
+ const EmptyElementRect();
}
class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation implements DocumentFragment {
@@ -226,6 +232,11 @@ class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation
return _on;
}
+ Future<ElementRect> get rect() {
+ return _createMeasurementFuture(() => const EmptyElementRect(),
+ new Completer<ElementRect>());
+ }
+
Element query(String selectors) =>
LevelDom.wrapElement(_ptr.querySelector(selectors));
@@ -235,18 +246,6 @@ class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation
// If we can come up with a semi-reasonable default value for an Element
// getter, we'll use it. In general, these return the same values as an
// element that has no parent.
- int get clientHeight() => 0;
- int get clientWidth() => 0;
- int get offsetHeight() => 0;
- int get offsetWidth() => 0;
- int get scrollHeight() => 0;
- int get scrollWidth() => 0;
- int get clientLeft() => 0;
- int get clientTop() => 0;
- int get offsetLeft() => 0;
- int get offsetTop() => 0;
- int get scrollLeft() => 0;
- int get scrollTop() => 0;
String get contentEditable() => "false";
bool get isContentEditable() => false;
bool get draggable() => false;
@@ -268,8 +267,10 @@ class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation
Set<String> get classes() => new Set<String>();
Map<String, String> get dataAttributes() => const {};
CSSStyleDeclaration get style() => new EmptyStyleDeclaration();
- ClientRect getBoundingClientRect() => new EmptyClientRect();
- List<ClientRect> getClientRects() => const [];
+ Future<CSSStyleDeclaration> get computedStyle() =>
+ _emptyStyleFuture();
+ Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) =>
+ _emptyStyleFuture();
bool matchesSelector([String selectors]) => false;
// Imperative Element methods are made into no-ops, as they are on parentless
« no previous file with comments | « client/html/src/Document.dart ('k') | client/html/src/DocumentWrappingImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698