| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 library fn; | 5 library fn; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:sky' as sky; | 9 import 'dart:sky' as sky; |
| 10 import 'reflect.dart' as reflect; | 10 import 'reflect.dart' as reflect; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 StyleNode(UINode content, this.style): super(content); | 150 StyleNode(UINode content, this.style): super(content); |
| 151 } | 151 } |
| 152 | 152 |
| 153 class ParentDataNode extends ContentNode { | 153 class ParentDataNode extends ContentNode { |
| 154 final ParentData parentData; | 154 final ParentData parentData; |
| 155 | 155 |
| 156 ParentDataNode(UINode content, this.parentData): super(content); | 156 ParentDataNode(UINode content, this.parentData): super(content); |
| 157 } | 157 } |
| 158 | 158 |
| 159 /* | 159 /* |
| 160 * SkyNodeWrappers correspond to a desired state of a RenderCSS. They are fully | 160 * RenderNodeWrappers correspond to a desired state of a RenderCSS. |
| 161 * immutable, with one exception: A UINode which is a Component which lives with
in | 161 * They are fully immutable, with one exception: A UINode which is a |
| 162 * an SkyElementWrapper's children list, may be replaced with the "old" instance
if it | 162 * Component which lives within an OneChildListRenderNodeWrapper's |
| 163 * has become stateful. | 163 * children list, may be replaced with the "old" instance if it has |
| 164 * become stateful. |
| 164 */ | 165 */ |
| 165 abstract class SkyNodeWrapper extends UINode { | 166 abstract class RenderNodeWrapper extends UINode { |
| 166 | 167 |
| 167 static final Map<RenderCSS, SkyNodeWrapper> _nodeMap = | 168 static final Map<RenderCSS, RenderNodeWrapper> _nodeMap = |
| 168 new HashMap<RenderCSS, SkyNodeWrapper>(); | 169 new HashMap<RenderCSS, RenderNodeWrapper>(); |
| 169 | 170 |
| 170 static SkyNodeWrapper _getMounted(RenderCSS node) => _nodeMap[node]; | 171 static RenderNodeWrapper _getMounted(RenderCSS node) => _nodeMap[node]; |
| 171 | 172 |
| 172 SkyNodeWrapper({ Object key }) : super(key: key); | 173 RenderNodeWrapper({ Object key }) : super(key: key); |
| 173 | 174 |
| 174 SkyNodeWrapper get _emptyNode; | 175 RenderNodeWrapper get _emptyNode; |
| 175 | 176 |
| 176 RenderCSS _createNode(); | 177 RenderCSS _createNode(); |
| 177 | 178 |
| 178 void _sync(UINode old, RenderCSSContainer host, RenderCSS insertBefore) { | 179 void _sync(UINode old, RenderCSSContainer host, RenderCSS insertBefore) { |
| 179 if (old == null) { | 180 if (old == null) { |
| 180 _root = _createNode(); | 181 _root = _createNode(); |
| 181 assert(_root != null); | 182 assert(_root != null); |
| 182 host.add(_root, before: insertBefore); | 183 host.add(_root, before: insertBefore); |
| 183 old = _emptyNode; | 184 old = _emptyNode; |
| 184 } else { | 185 } else { |
| 185 _root = old._root; | 186 _root = old._root; |
| 186 assert(_root != null); | 187 assert(_root != null); |
| 187 } | 188 } |
| 188 | 189 |
| 189 _nodeMap[_root] = this; | 190 _nodeMap[_root] = this; |
| 190 _syncNode(old); | 191 _syncNode(old); |
| 191 } | 192 } |
| 192 | 193 |
| 193 void _syncNode(SkyNodeWrapper old); | 194 void _syncNode(RenderNodeWrapper old); |
| 194 | 195 |
| 195 void _removeChild(UINode node) { | 196 void _removeChild(UINode node) { |
| 196 assert(_root is RenderCSSContainer); | 197 assert(_root is RenderCSSContainer); |
| 197 _root.remove(node._root); | 198 _root.remove(node._root); |
| 198 super._removeChild(node); | 199 super._removeChild(node); |
| 199 } | 200 } |
| 200 | 201 |
| 201 void _remove() { | 202 void _remove() { |
| 202 assert(_root != null); | 203 assert(_root != null); |
| 203 _nodeMap.remove(_root); | 204 _nodeMap.remove(_root); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 super(content); | 289 super(content); |
| 289 | 290 |
| 290 void _handleEvent(sky.Event e) { | 291 void _handleEvent(sky.Event e) { |
| 291 sky.EventListener listener = listeners[e.type]; | 292 sky.EventListener listener = listeners[e.type]; |
| 292 if (listener != null) { | 293 if (listener != null) { |
| 293 listener(e); | 294 listener(e); |
| 294 } | 295 } |
| 295 } | 296 } |
| 296 | 297 |
| 297 static void _dispatchEvent(sky.Event e) { | 298 static void _dispatchEvent(sky.Event e) { |
| 298 UINode target = SkyNodeWrapper._getMounted(bridgeEventTargetToRenderNode(e.t
arget)); | 299 UINode target = RenderNodeWrapper._getMounted(bridgeEventTargetToRenderNode(
e.target)); |
| 299 | 300 |
| 300 // TODO(rafaelw): StopPropagation? | 301 // TODO(rafaelw): StopPropagation? |
| 301 while (target != null) { | 302 while (target != null) { |
| 302 if (target is EventListenerNode) { | 303 if (target is EventListenerNode) { |
| 303 target._handleEvent(e); | 304 target._handleEvent(e); |
| 304 } | 305 } |
| 305 | 306 |
| 306 target = target._parent; | 307 target = target._parent; |
| 307 } | 308 } |
| 308 } | 309 } |
| 309 | 310 |
| 310 static void _ensureDocumentListener(String eventType) { | 311 static void _ensureDocumentListener(String eventType) { |
| 311 if (_registeredEvents.add(eventType)) { | 312 if (_registeredEvents.add(eventType)) { |
| 312 sky.document.addEventListener(eventType, _dispatchEvent); | 313 sky.document.addEventListener(eventType, _dispatchEvent); |
| 313 } | 314 } |
| 314 } | 315 } |
| 315 | 316 |
| 316 void _sync(UINode old, RenderCSSContainer host, RenderCSS insertBefore) { | 317 void _sync(UINode old, RenderCSSContainer host, RenderCSS insertBefore) { |
| 317 for (var type in listeners.keys) { | 318 for (var type in listeners.keys) { |
| 318 _ensureDocumentListener(type); | 319 _ensureDocumentListener(type); |
| 319 } | 320 } |
| 320 | 321 |
| 321 super._sync(old, host, insertBefore); | 322 super._sync(old, host, insertBefore); |
| 322 } | 323 } |
| 323 } | 324 } |
| 324 | 325 |
| 325 final List<UINode> _emptyList = new List<UINode>(); | 326 final List<UINode> _emptyList = new List<UINode>(); |
| 326 | 327 |
| 327 abstract class SkyElementWrapper extends SkyNodeWrapper { | 328 abstract class OneChildListRenderNodeWrapper extends RenderNodeWrapper { |
| 328 | 329 |
| 329 final List<UINode> children; | 330 final List<UINode> children; |
| 330 final Style style; | 331 final Style style; |
| 331 final String inlineStyle; | 332 final String inlineStyle; |
| 332 | 333 |
| 333 SkyElementWrapper({ | 334 OneChildListRenderNodeWrapper({ |
| 334 Object key, | 335 Object key, |
| 335 List<UINode> children, | 336 List<UINode> children, |
| 336 this.style, | 337 this.style, |
| 337 this.inlineStyle | 338 this.inlineStyle |
| 338 }) : this.children = children == null ? _emptyList : children, | 339 }) : this.children = children == null ? _emptyList : children, |
| 339 super(key: key) { | 340 super(key: key) { |
| 340 | 341 |
| 341 assert(!_debugHasDuplicateIds()); | 342 assert(!_debugHasDuplicateIds()); |
| 342 } | 343 } |
| 343 | 344 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 359 | 360 |
| 360 if (!idSet.add(child._key)) { | 361 if (!idSet.add(child._key)) { |
| 361 throw '''If multiple non-interchangeable nodes of the same type exist as
children | 362 throw '''If multiple non-interchangeable nodes of the same type exist as
children |
| 362 of another node, they must have unique keys. | 363 of another node, they must have unique keys. |
| 363 Duplicate: "${child._key}"'''; | 364 Duplicate: "${child._key}"'''; |
| 364 } | 365 } |
| 365 } | 366 } |
| 366 return false; | 367 return false; |
| 367 } | 368 } |
| 368 | 369 |
| 369 void _syncNode(SkyNodeWrapper old) { | 370 void _syncNode(RenderNodeWrapper old) { |
| 370 SkyElementWrapper oldSkyElementWrapper = old as SkyElementWrapper; | 371 OneChildListRenderNodeWrapper oldOneChildListRenderNodeWrapper = old as OneC
hildListRenderNodeWrapper; |
| 371 | 372 |
| 372 List<Style> styles = new List<Style>(); | 373 List<Style> styles = new List<Style>(); |
| 373 if (style != null) | 374 if (style != null) |
| 374 styles.add(style); | 375 styles.add(style); |
| 375 ParentData parentData = null; | 376 ParentData parentData = null; |
| 376 UINode parent = _parent; | 377 UINode parent = _parent; |
| 377 while (parent != null && parent is! SkyNodeWrapper) { | 378 while (parent != null && parent is! RenderNodeWrapper) { |
| 378 if (parent is StyleNode && parent.style != null) | 379 if (parent is StyleNode && parent.style != null) |
| 379 styles.add(parent.style); | 380 styles.add(parent.style); |
| 380 else | 381 else |
| 381 if (parent is ParentDataNode && parent.parentData != null) { | 382 if (parent is ParentDataNode && parent.parentData != null) { |
| 382 if (parentData != null) | 383 if (parentData != null) |
| 383 parentData.merge(parent.parentData); // this will throw if the types a
ren't the same | 384 parentData.merge(parent.parentData); // this will throw if the types a
ren't the same |
| 384 else | 385 else |
| 385 parentData = parent.parentData; | 386 parentData = parent.parentData; |
| 386 } | 387 } |
| 387 parent = parent._parent; | 388 parent = parent._parent; |
| 388 } | 389 } |
| 389 _root.updateStyles(styles); | 390 _root.updateStyles(styles); |
| 390 if (parentData != null) { | 391 if (parentData != null) { |
| 391 assert(_root.parentData != null); | 392 assert(_root.parentData != null); |
| 392 _root.parentData.merge(parentData); // this will throw if the types aren't
approriate | 393 _root.parentData.merge(parentData); // this will throw if the types aren't
approriate |
| 393 assert(parent != null); | 394 assert(parent != null); |
| 394 assert(parent._root != null); | 395 assert(parent._root != null); |
| 395 parent._root.markNeedsLayout(); | 396 parent._root.markNeedsLayout(); |
| 396 } | 397 } |
| 397 _root.updateInlineStyle(inlineStyle); | 398 _root.updateInlineStyle(inlineStyle); |
| 398 | 399 |
| 399 _syncChildren(oldSkyElementWrapper); | 400 _syncChildren(oldOneChildListRenderNodeWrapper); |
| 400 } | 401 } |
| 401 | 402 |
| 402 void _syncChildren(SkyElementWrapper oldSkyElementWrapper) { | 403 void _syncChildren(OneChildListRenderNodeWrapper oldOneChildListRenderNodeWrap
per) { |
| 403 if (_root is! RenderCSSContainer) | 404 if (_root is! RenderCSSContainer) |
| 404 return; | 405 return; |
| 405 | 406 |
| 406 var startIndex = 0; | 407 var startIndex = 0; |
| 407 var endIndex = children.length; | 408 var endIndex = children.length; |
| 408 | 409 |
| 409 var oldChildren = oldSkyElementWrapper.children; | 410 var oldChildren = oldOneChildListRenderNodeWrapper.children; |
| 410 var oldStartIndex = 0; | 411 var oldStartIndex = 0; |
| 411 var oldEndIndex = oldChildren.length; | 412 var oldEndIndex = oldChildren.length; |
| 412 | 413 |
| 413 RenderCSS nextSibling = null; | 414 RenderCSS nextSibling = null; |
| 414 UINode currentNode = null; | 415 UINode currentNode = null; |
| 415 UINode oldNode = null; | 416 UINode oldNode = null; |
| 416 | 417 |
| 417 void sync(int atIndex) { | 418 void sync(int atIndex) { |
| 418 children[atIndex] = _syncChild(currentNode, oldNode, _root, nextSibling); | 419 children[atIndex] = _syncChild(currentNode, oldNode, _root, nextSibling); |
| 419 assert(children[atIndex] != null); | 420 assert(children[atIndex] != null); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 return false; // never re-order these nodes | 468 return false; // never re-order these nodes |
| 468 | 469 |
| 469 ensureOldIdMap(); | 470 ensureOldIdMap(); |
| 470 oldNode = oldNodeIdMap[currentNode._key]; | 471 oldNode = oldNodeIdMap[currentNode._key]; |
| 471 if (oldNode == null) | 472 if (oldNode == null) |
| 472 return false; | 473 return false; |
| 473 | 474 |
| 474 oldNodeIdMap[currentNode._key] = null; // mark it reordered | 475 oldNodeIdMap[currentNode._key] = null; // mark it reordered |
| 475 assert(_root is RenderCSSContainer); | 476 assert(_root is RenderCSSContainer); |
| 476 assert(oldNode._root is RenderCSSContainer); | 477 assert(oldNode._root is RenderCSSContainer); |
| 477 oldSkyElementWrapper._root.remove(oldNode._root); | 478 oldOneChildListRenderNodeWrapper._root.remove(oldNode._root); |
| 478 _root.add(oldNode._root, before: nextSibling); | 479 _root.add(oldNode._root, before: nextSibling); |
| 479 return true; | 480 return true; |
| 480 } | 481 } |
| 481 | 482 |
| 482 // Scan forwards, this time we may re-order; | 483 // Scan forwards, this time we may re-order; |
| 483 nextSibling = _root.firstChild; | 484 nextSibling = _root.firstChild; |
| 484 while (startIndex < endIndex && oldStartIndex < oldEndIndex) { | 485 while (startIndex < endIndex && oldStartIndex < oldEndIndex) { |
| 485 currentNode = children[startIndex]; | 486 currentNode = children[startIndex]; |
| 486 oldNode = oldChildren[oldStartIndex]; | 487 oldNode = oldChildren[oldStartIndex]; |
| 487 | 488 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 511 // Removals | 512 // Removals |
| 512 currentNode = null; | 513 currentNode = null; |
| 513 while (oldStartIndex < oldEndIndex) { | 514 while (oldStartIndex < oldEndIndex) { |
| 514 oldNode = oldChildren[oldStartIndex]; | 515 oldNode = oldChildren[oldStartIndex]; |
| 515 _removeChild(oldNode); | 516 _removeChild(oldNode); |
| 516 advanceOldStartIndex(); | 517 advanceOldStartIndex(); |
| 517 } | 518 } |
| 518 } | 519 } |
| 519 } | 520 } |
| 520 | 521 |
| 521 class Container extends SkyElementWrapper { | 522 class Container extends OneChildListRenderNodeWrapper { |
| 522 | 523 |
| 523 RenderCSSContainer _root; | 524 RenderCSSContainer _root; |
| 524 RenderCSSContainer _createNode() => new RenderCSSContainer(this); | 525 RenderCSSContainer _createNode() => new RenderCSSContainer(this); |
| 525 | 526 |
| 526 static final Container _emptyContainer = new Container(); | 527 static final Container _emptyContainer = new Container(); |
| 527 | 528 |
| 528 SkyNodeWrapper get _emptyNode => _emptyContainer; | 529 RenderNodeWrapper get _emptyNode => _emptyContainer; |
| 529 | 530 |
| 530 Container({ | 531 Container({ |
| 531 Object key, | 532 Object key, |
| 532 List<UINode> children, | 533 List<UINode> children, |
| 533 Style style, | 534 Style style, |
| 534 String inlineStyle | 535 String inlineStyle |
| 535 }) : super( | 536 }) : super( |
| 536 key: key, | 537 key: key, |
| 537 children: children, | 538 children: children, |
| 538 style: style, | 539 style: style, |
| 539 inlineStyle: inlineStyle | 540 inlineStyle: inlineStyle |
| 540 ); | 541 ); |
| 541 } | 542 } |
| 542 | 543 |
| 543 class Paragraph extends SkyElementWrapper { | 544 class Paragraph extends OneChildListRenderNodeWrapper { |
| 544 | 545 |
| 545 RenderCSSParagraph _root; | 546 RenderCSSParagraph _root; |
| 546 RenderCSSParagraph _createNode() => new RenderCSSParagraph(this); | 547 RenderCSSParagraph _createNode() => new RenderCSSParagraph(this); |
| 547 | 548 |
| 548 static final Paragraph _emptyContainer = new Paragraph(); | 549 static final Paragraph _emptyContainer = new Paragraph(); |
| 549 | 550 |
| 550 SkyNodeWrapper get _emptyNode => _emptyContainer; | 551 RenderNodeWrapper get _emptyNode => _emptyContainer; |
| 551 | 552 |
| 552 Paragraph({ | 553 Paragraph({ |
| 553 Object key, | 554 Object key, |
| 554 List<UINode> children, | 555 List<UINode> children, |
| 555 Style style, | 556 Style style, |
| 556 String inlineStyle | 557 String inlineStyle |
| 557 }) : super( | 558 }) : super( |
| 558 key: key, | 559 key: key, |
| 559 children: children, | 560 children: children, |
| 560 style: style, | 561 style: style, |
| 561 inlineStyle: inlineStyle | 562 inlineStyle: inlineStyle |
| 562 ); | 563 ); |
| 563 } | 564 } |
| 564 | 565 |
| 565 class FlexContainer extends SkyElementWrapper { | 566 class FlexContainer extends OneChildListRenderNodeWrapper { |
| 566 | 567 |
| 567 RenderCSSFlex _root; | 568 RenderCSSFlex _root; |
| 568 RenderCSSFlex _createNode() => new RenderCSSFlex(this, this.direction); | 569 RenderCSSFlex _createNode() => new RenderCSSFlex(this, this.direction); |
| 569 | 570 |
| 570 static final FlexContainer _emptyContainer = new FlexContainer(); | 571 static final FlexContainer _emptyContainer = new FlexContainer(); |
| 571 // direction doesn't matter if it's empty | 572 // direction doesn't matter if it's empty |
| 572 | 573 |
| 573 SkyNodeWrapper get _emptyNode => _emptyContainer; | 574 RenderNodeWrapper get _emptyNode => _emptyContainer; |
| 574 | 575 |
| 575 final FlexDirection direction; | 576 final FlexDirection direction; |
| 576 | 577 |
| 577 FlexContainer({ | 578 FlexContainer({ |
| 578 Object key, | 579 Object key, |
| 579 List<UINode> children, | 580 List<UINode> children, |
| 580 Style style, | 581 Style style, |
| 581 String inlineStyle, | 582 String inlineStyle, |
| 582 this.direction: FlexDirection.Row | 583 this.direction: FlexDirection.Row |
| 583 }) : super( | 584 }) : super( |
| 584 key: key, | 585 key: key, |
| 585 children: children, | 586 children: children, |
| 586 style: style, | 587 style: style, |
| 587 inlineStyle: inlineStyle | 588 inlineStyle: inlineStyle |
| 588 ); | 589 ); |
| 589 | 590 |
| 590 void _syncNode(UINode old) { | 591 void _syncNode(UINode old) { |
| 591 super._syncNode(old); | 592 super._syncNode(old); |
| 592 _root.direction = direction; | 593 _root.direction = direction; |
| 593 } | 594 } |
| 594 } | 595 } |
| 595 | 596 |
| 596 class FillStackContainer extends SkyElementWrapper { | 597 class FillStackContainer extends OneChildListRenderNodeWrapper { |
| 597 | 598 |
| 598 RenderCSSStack _root; | 599 RenderCSSStack _root; |
| 599 RenderCSSStack _createNode() => new RenderCSSStack(this); | 600 RenderCSSStack _createNode() => new RenderCSSStack(this); |
| 600 | 601 |
| 601 static final FillStackContainer _emptyContainer = new FillStackContainer(); | 602 static final FillStackContainer _emptyContainer = new FillStackContainer(); |
| 602 | 603 |
| 603 SkyNodeWrapper get _emptyNode => _emptyContainer; | 604 RenderNodeWrapper get _emptyNode => _emptyContainer; |
| 604 | 605 |
| 605 FillStackContainer({ | 606 FillStackContainer({ |
| 606 Object key, | 607 Object key, |
| 607 List<UINode> children, | 608 List<UINode> children, |
| 608 Style style, | 609 Style style, |
| 609 String inlineStyle | 610 String inlineStyle |
| 610 }) : super( | 611 }) : super( |
| 611 key: key, | 612 key: key, |
| 612 children: _positionNodesToFill(children), | 613 children: _positionNodesToFill(children), |
| 613 style: style, | 614 style: style, |
| 614 inlineStyle: inlineStyle | 615 inlineStyle: inlineStyle |
| 615 ); | 616 ); |
| 616 | 617 |
| 617 static StackParentData _fillParentData = new StackParentData() | 618 static StackParentData _fillParentData = new StackParentData() |
| 618 ..top = 0.0 | 619 ..top = 0.0 |
| 619 ..left = 0.0 | 620 ..left = 0.0 |
| 620 ..right = 0.0 | 621 ..right = 0.0 |
| 621 ..bottom = 0.0; | 622 ..bottom = 0.0; |
| 622 | 623 |
| 623 static List<UINode> _positionNodesToFill(List<UINode> input) { | 624 static List<UINode> _positionNodesToFill(List<UINode> input) { |
| 624 if (input == null) | 625 if (input == null) |
| 625 return null; | 626 return null; |
| 626 return input.map((node) { | 627 return input.map((node) { |
| 627 return new ParentDataNode(node, _fillParentData); | 628 return new ParentDataNode(node, _fillParentData); |
| 628 }).toList(); | 629 }).toList(); |
| 629 } | 630 } |
| 630 } | 631 } |
| 631 | 632 |
| 632 class TextFragment extends SkyElementWrapper { | 633 class TextFragment extends OneChildListRenderNodeWrapper { |
| 633 | 634 |
| 634 RenderCSSInline _root; | 635 RenderCSSInline _root; |
| 635 RenderCSSInline _createNode() => new RenderCSSInline(this, this.data); | 636 RenderCSSInline _createNode() => new RenderCSSInline(this, this.data); |
| 636 | 637 |
| 637 static final TextFragment _emptyText = new TextFragment(''); | 638 static final TextFragment _emptyText = new TextFragment(''); |
| 638 | 639 |
| 639 SkyNodeWrapper get _emptyNode => _emptyText; | 640 RenderNodeWrapper get _emptyNode => _emptyText; |
| 640 | 641 |
| 641 final String data; | 642 final String data; |
| 642 | 643 |
| 643 TextFragment(this.data, { | 644 TextFragment(this.data, { |
| 644 Object key, | 645 Object key, |
| 645 Style style, | 646 Style style, |
| 646 String inlineStyle | 647 String inlineStyle |
| 647 }) : super( | 648 }) : super( |
| 648 key: key, | 649 key: key, |
| 649 style: style, | 650 style: style, |
| 650 inlineStyle: inlineStyle | 651 inlineStyle: inlineStyle |
| 651 ); | 652 ); |
| 652 | 653 |
| 653 void _syncNode(UINode old) { | 654 void _syncNode(UINode old) { |
| 654 super._syncNode(old); | 655 super._syncNode(old); |
| 655 _root.data = data; | 656 _root.data = data; |
| 656 } | 657 } |
| 657 } | 658 } |
| 658 | 659 |
| 659 class Image extends SkyElementWrapper { | 660 class Image extends OneChildListRenderNodeWrapper { |
| 660 | 661 |
| 661 RenderCSSImage _root; | 662 RenderCSSImage _root; |
| 662 RenderCSSImage _createNode() => new RenderCSSImage(this, this.src, this.width,
this.height); | 663 RenderCSSImage _createNode() => new RenderCSSImage(this, this.src, this.width,
this.height); |
| 663 | 664 |
| 664 static final Image _emptyImage = new Image(); | 665 static final Image _emptyImage = new Image(); |
| 665 | 666 |
| 666 SkyNodeWrapper get _emptyNode => _emptyImage; | 667 RenderNodeWrapper get _emptyNode => _emptyImage; |
| 667 | 668 |
| 668 final String src; | 669 final String src; |
| 669 final int width; | 670 final int width; |
| 670 final int height; | 671 final int height; |
| 671 | 672 |
| 672 Image({ | 673 Image({ |
| 673 Object key, | 674 Object key, |
| 674 Style style, | 675 Style style, |
| 675 String inlineStyle, | 676 String inlineStyle, |
| 676 this.width, | 677 this.width, |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 _sync(null, _host, _root); | 916 _sync(null, _host, _root); |
| 916 } | 917 } |
| 917 } | 918 } |
| 918 | 919 |
| 919 class Text extends Component { | 920 class Text extends Component { |
| 920 Text(this.data) : super(key: '*text*'); | 921 Text(this.data) : super(key: '*text*'); |
| 921 final String data; | 922 final String data; |
| 922 bool get interchangeable => true; | 923 bool get interchangeable => true; |
| 923 UINode build() => new Paragraph(children: [new TextFragment(data)]); | 924 UINode build() => new Paragraph(children: [new TextFragment(data)]); |
| 924 } | 925 } |
| OLD | NEW |