OLD | NEW |
1 library layout; | 1 library layout; |
2 | 2 |
3 import 'node.dart'; | 3 import 'node.dart'; |
4 import 'dart:sky' as sky; | 4 import 'dart:sky' as sky; |
5 import 'dart:collection'; | 5 import 'dart:collection'; |
6 | 6 |
7 // UTILS | 7 // UTILS |
8 | 8 |
9 // Bridge to legacy CSS-like style specification | 9 // Bridge to legacy CSS-like style specification |
10 // Eventually we'll replace this with something else | 10 // Eventually we'll replace this with something else |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 374 } |
375 | 375 |
376 void markNeedsLayout() { | 376 void markNeedsLayout() { |
377 super.markNeedsLayout(); | 377 super.markNeedsLayout(); |
378 | 378 |
379 // pretend we did the layout: | 379 // pretend we did the layout: |
380 RenderCSS child = _firstChild; | 380 RenderCSS child = _firstChild; |
381 while (child != null) { | 381 while (child != null) { |
382 assert(child.parentData is FlexBoxParentData); | 382 assert(child.parentData is FlexBoxParentData); |
383 if (child.parentData.flex != null) { | 383 if (child.parentData.flex != null) { |
384 child._additionalStylesFromParent = 'flex:${child.parentData.flex};'; | 384 child._additionalStylesFromParent = 'flex:${child.parentData.flex}'; |
385 child._updateInlineStyleAttribute(); | 385 child._updateInlineStyleAttribute(); |
386 } | 386 } |
387 child = child.parentData.nextSibling; | 387 child = child.parentData.nextSibling; |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
391 } | 391 } |
392 | 392 |
393 class RenderCSSText extends RenderCSS { | 393 class RenderCSSText extends RenderCSS { |
394 | 394 |
395 RenderCSSText(debug, String newData) : super(debug) { | 395 RenderCSSText(debug, String newData) : super(debug) { |
396 data = newData; | 396 data = newData; |
397 } | 397 } |
398 | 398 |
399 static final Style _displayParagraph = new Style('display:paragraph'); | 399 static final Style _displayParagraph = new Style('display:paragraph'); |
400 | 400 |
| 401 String stylesToClasses(List<Style> styles) { |
| 402 return super.stylesToClasses(styles) + ' ' + _displayParagraph._className; |
| 403 } |
| 404 |
401 sky.Element createSkyElement() { | 405 sky.Element createSkyElement() { |
402 return sky.document.createElement('div') | 406 return sky.document.createElement('div') |
403 ..setChild(new sky.Text()) | 407 ..setChild(new sky.Text()) |
404 ..setAttribute('class', _displayParagraph._className) | |
405 ..setAttribute('debug', debug.toString()); | 408 ..setAttribute('debug', debug.toString()); |
406 } | 409 } |
407 | 410 |
408 void set data (String value) { | 411 void set data (String value) { |
409 (_skyElement.firstChild as sky.Text).data = value; | 412 (_skyElement.firstChild as sky.Text).data = value; |
410 } | 413 } |
411 | 414 |
412 } | 415 } |
413 | 416 |
414 class RenderCSSImage extends RenderCSS { | 417 class RenderCSSImage extends RenderCSS { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 print(prefix + node.toString() + _attributes(node)); | 474 print(prefix + node.toString() + _attributes(node)); |
472 var children = node.getChildNodes(); | 475 var children = node.getChildNodes(); |
473 prefix = prefix + ' '; | 476 prefix = prefix + ' '; |
474 for (var child in children) | 477 for (var child in children) |
475 _serialiseDOM(child, prefix); | 478 _serialiseDOM(child, prefix); |
476 } | 479 } |
477 | 480 |
478 void dumpState() { | 481 void dumpState() { |
479 _serialiseDOM(sky.document); | 482 _serialiseDOM(sky.document); |
480 } | 483 } |
OLD | NEW |