| OLD | NEW |
| 1 library layout; | 1 library layout; |
| 2 | 2 |
| 3 // This version of layout.dart is a shim version of layout2.dart that is backed
using CSS and <div>s. | 3 // This version of layout.dart is a shim version of layout2.dart that is backed
using CSS and <div>s. |
| 4 | 4 |
| 5 import 'node.dart'; | 5 import 'node.dart'; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 // UTILS | 9 // UTILS |
| 10 | 10 |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 assert(before._skyElement.parentNode == _skyElement); | 327 assert(before._skyElement.parentNode == _skyElement); |
| 328 } | 328 } |
| 329 super.add(child, before: before); | 329 super.add(child, before: before); |
| 330 if (before != null) { | 330 if (before != null) { |
| 331 before._skyElement.insertBefore([child._skyElement]); | 331 before._skyElement.insertBefore([child._skyElement]); |
| 332 assert(child._skyElement.parentNode != null); | 332 assert(child._skyElement.parentNode != null); |
| 333 assert(child._skyElement.parentNode == _skyElement); | 333 assert(child._skyElement.parentNode == _skyElement); |
| 334 assert(child._skyElement.parentNode == before._skyElement.parentNode); | 334 assert(child._skyElement.parentNode == before._skyElement.parentNode); |
| 335 } else { | 335 } else { |
| 336 _skyElement.appendChild(child._skyElement); | 336 _skyElement.appendChild(child._skyElement); |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 void remove(RenderCSS child) { | 339 void remove(RenderCSS child) { |
| 340 child._skyElement.remove(); | 340 child._skyElement.remove(); |
| 341 super.remove(child); | 341 super.remove(child); |
| 342 } | 342 } |
| 343 | 343 |
| 344 } | 344 } |
| 345 | 345 |
| 346 class FlexBoxParentData extends CSSParentData { | 346 class FlexBoxParentData extends CSSParentData { |
| 347 int flex; | 347 int flex; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 370 child.parentData = new FlexBoxParentData(); | 370 child.parentData = new FlexBoxParentData(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 static final Style _displayFlex = new Style._addToCache('display:flex'); | 373 static final Style _displayFlex = new Style._addToCache('display:flex'); |
| 374 static final Style _displayFlexRow = new Style._addToCache('flex-direction:row
'); | 374 static final Style _displayFlexRow = new Style._addToCache('flex-direction:row
'); |
| 375 static final Style _displayFlexColumn = new Style._addToCache('flex-direction:
column'); | 375 static final Style _displayFlexColumn = new Style._addToCache('flex-direction:
column'); |
| 376 | 376 |
| 377 String stylesToClasses(List<Style> styles) { | 377 String stylesToClasses(List<Style> styles) { |
| 378 var settings = _displayFlex._className; | 378 var settings = _displayFlex._className; |
| 379 switch (_direction) { | 379 switch (_direction) { |
| 380 case FlexDirection.horizontal: settings += ' ' + _displayFlexRow._classNam
e; break; | 380 case FlexDirection.Row: settings += ' ' + _displayFlexRow._className; brea
k; |
| 381 case FlexDirection.vertical: settings += ' ' + _displayFlexColumn._classNa
me; break; | 381 case FlexDirection.Column: settings += ' ' + _displayFlexColumn._className
; break; |
| 382 } | 382 } |
| 383 return super.stylesToClasses(styles) + ' ' + settings; | 383 return super.stylesToClasses(styles) + ' ' + settings; |
| 384 } | 384 } |
| 385 | 385 |
| 386 void markNeedsLayout() { | 386 void markNeedsLayout() { |
| 387 super.markNeedsLayout(); | 387 super.markNeedsLayout(); |
| 388 | 388 |
| 389 // pretend we did the layout: | 389 // pretend we did the layout: |
| 390 RenderCSS child = _firstChild; | 390 RenderCSS child = _firstChild; |
| 391 while (child != null) { | 391 while (child != null) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 print(prefix + node.toString() + _attributes(node)); | 553 print(prefix + node.toString() + _attributes(node)); |
| 554 var children = node.getChildNodes(); | 554 var children = node.getChildNodes(); |
| 555 prefix = prefix + ' '; | 555 prefix = prefix + ' '; |
| 556 for (var child in children) | 556 for (var child in children) |
| 557 _serialiseDOM(child, prefix); | 557 _serialiseDOM(child, prefix); |
| 558 } | 558 } |
| 559 | 559 |
| 560 void dumpState() { | 560 void dumpState() { |
| 561 _serialiseDOM(sky.document); | 561 _serialiseDOM(sky.document); |
| 562 } | 562 } |
| OLD | NEW |