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

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

Issue 8416010: Further code review changes for issue 8341027. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add DOMWrapperBase._empty. 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
Index: client/html/src/DocumentFragmentWrappingImplementation.dart
diff --git a/client/html/src/DocumentFragmentWrappingImplementation.dart b/client/html/src/DocumentFragmentWrappingImplementation.dart
index 54b9644270c644e46ebb47b3d345c6e82aae628b..4b7667d42feeb821d61155ab9cb2536aa0f5914a 100644
--- a/client/html/src/DocumentFragmentWrappingImplementation.dart
+++ b/client/html/src/DocumentFragmentWrappingImplementation.dart
@@ -108,8 +108,17 @@ class FilteredElementList implements ElementList {
class EmptyStyleDeclaration extends CSSStyleDeclarationWrappingImplementation {
// This can't call super(), since that's a factory constructor
- EmptyStyleDeclaration()
- : super._wrap(dom.document.createElement('div').style);
+ const EmptyStyleDeclaration() : super._empty();
+
+ String get cssText() => "";
+ int get length() => 0;
+ CSSRule get parentRule() => null;
+ CSSValue getPropertyCSSValue(String propertyName) => null;
+ String getPropertyPriority(String propertyName) => "";
+ String getPropertyShorthand(String propertyName) => null;
+ String getPropertyValue(String propertyName) => null;
+ bool isPropertyImplicit(String propertyName) => false;
+ String item(int index) => "";
void set cssText(String value) {
throw new UnsupportedOperationException(
@@ -138,6 +147,8 @@ class EmptyClientRect implements ClientRect {
class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation implements DocumentFragment {
ElementList _elements;
+ CSSStyleDeclaration _style;
+ ClientRect _clientRect;
DocumentFragmentWrappingImplementation._wrap(ptr) : super._wrap(ptr) {}
@@ -228,6 +239,16 @@ class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation
ElementList queryAll(String selectors) =>
LevelDom.wrapElementList(_ptr.querySelectorAll(selectors));
+ CSSStyleDeclaration get style() {
+ if (_style == null) _style = const EmptyStyleDeclaration();
+ return _style;
+ }
+
+ ClientRect getBoundingClientRect() {
+ if (_clientRect == null) _clientRect = new EmptyClientRect();
+ return _clientRect;
+ }
+
// 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.
@@ -263,8 +284,6 @@ class DocumentFragmentWrappingImplementation extends NodeWrappingImplementation
// Issue 174: this should be a const set.
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 [];
bool matchesSelector([String selectors]) => false;

Powered by Google App Engine
This is Rietveld 408576698