OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #library("view"); | 5 #library("view"); |
6 | 6 |
7 #import('dart:html'); | 7 #import('dart:html'); |
8 #import('../base/base.dart'); | 8 #import('../base/base.dart'); |
9 #import('../observable/observable.dart'); | 9 #import('../observable/observable.dart'); |
10 #import('../touch/touch.dart'); | 10 #import('../touch/touch.dart'); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 /** Gets whether this View has already been rendered or not. */ | 101 /** Gets whether this View has already been rendered or not. */ |
102 bool get isRendered() { | 102 bool get isRendered() { |
103 return _node !== null; | 103 return _node !== null; |
104 } | 104 } |
105 | 105 |
106 /** | 106 /** |
107 * Gets whether this View (or one of its parents) has been added to the | 107 * Gets whether this View (or one of its parents) has been added to the |
108 * document or not. | 108 * document or not. |
109 */ | 109 */ |
110 bool get isInDocument() { | 110 bool get isInDocument() { |
111 return _node !== null && node.document.contains(node); | 111 return _node !== null && node.document.body.contains(node); |
112 } | 112 } |
113 | 113 |
114 /** | 114 /** |
115 * Adds this view to the document as a child of the given node. This should | 115 * Adds this view to the document as a child of the given node. This should |
116 * generally only be called once for the top-level view. | 116 * generally only be called once for the top-level view. |
117 */ | 117 */ |
118 void addToDocument(Element parentNode) { | 118 void addToDocument(Element parentNode) { |
119 assert(!isInDocument); | 119 assert(!isInDocument); |
120 | 120 |
121 _render(); | 121 _render(); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 } | 362 } |
363 } | 363 } |
364 | 364 |
365 void _applyLayout() { | 365 void _applyLayout() { |
366 if (_layout != null) { | 366 if (_layout != null) { |
367 _layout.applyLayout(); | 367 _layout.applyLayout(); |
368 } | 368 } |
369 _applyLayoutToChildren(); | 369 _applyLayoutToChildren(); |
370 } | 370 } |
371 } | 371 } |
OLD | NEW |