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

Side by Side Diff: sky/framework/layout.dart

Issue 1128103009: [Effen] Start removing 'position'. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « sky/framework/fn.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 if (child.parentData.flex != null) { 391 if (child.parentData.flex != null) {
392 child._additionalStylesFromParent = 'flex:${child.parentData.flex}'; 392 child._additionalStylesFromParent = 'flex:${child.parentData.flex}';
393 child._updateInlineStyleAttribute(); 393 child._updateInlineStyleAttribute();
394 } 394 }
395 child = child.parentData.nextSibling; 395 child = child.parentData.nextSibling;
396 } 396 }
397 } 397 }
398 398
399 } 399 }
400 400
401 class StackParentData extends CSSParentData {
402 double top;
403 double left;
404 double right;
405 double bottom;
406 void merge(StackParentData other) {
407 if (other.top != null)
408 top = other.top;
409 if (other.left != null)
410 left = other.left;
411 if (other.right != null)
412 right = other.right;
413 if (other.bottom != null)
414 bottom = other.bottom;
415 super.merge(other);
416 }
417 }
418
419 class RenderCSSStack extends RenderCSSContainer {
420
421 RenderCSSStack(debug) : super(debug);
422
423 void setupPos(RenderNode child) {
424 if (child.parentData is! StackParentData)
425 child.parentData = new StackParentData();
426 }
427
428 static final Style _displayPosition = new Style._addToCache('transform:transla teX(0);position:relative');
429
430 String stylesToClasses(List<Style> styles) {
431 return super.stylesToClasses(styles) + ' ' + _displayPosition._className;
432 }
433
434 void markNeedsLayout() {
435 super.markNeedsLayout();
436
437 // pretend we did the layout:
438 RenderCSS child = _firstChild;
439 while (child != null) {
440 assert(child.parentData is StackParentData);
441 var style = 'position:absolute;';
442 if (child.parentData.top != null)
443 style += 'top:${child.parentData.top};';
444 if (child.parentData.left != null)
445 style += 'left:${child.parentData.left};';
446 if (child.parentData.right != null)
447 style += 'right:${child.parentData.right};';
448 if (child.parentData.bottom != null)
449 style += 'bottom:${child.parentData.bottom};';
450 child._additionalStylesFromParent = style;
451 child._updateInlineStyleAttribute();
452 child = child.parentData.nextSibling;
453 }
454 }
455
456 }
457
401 class RenderCSSParagraph extends RenderCSSContainer { 458 class RenderCSSParagraph extends RenderCSSContainer {
402 459
403 RenderCSSParagraph(debug) : super(debug); 460 RenderCSSParagraph(debug) : super(debug);
404 461
405 static final Style _displayParagraph = new Style._addToCache('display:paragrap h'); 462 static final Style _displayParagraph = new Style._addToCache('display:paragrap h');
406 463
407 String stylesToClasses(List<Style> styles) { 464 String stylesToClasses(List<Style> styles) {
408 return super.stylesToClasses(styles) + ' ' + _displayParagraph._className; 465 return super.stylesToClasses(styles) + ' ' + _displayParagraph._className;
409 } 466 }
410 467
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 print(prefix + node.toString() + _attributes(node)); 551 print(prefix + node.toString() + _attributes(node));
495 var children = node.getChildNodes(); 552 var children = node.getChildNodes();
496 prefix = prefix + ' '; 553 prefix = prefix + ' ';
497 for (var child in children) 554 for (var child in children)
498 _serialiseDOM(child, prefix); 555 _serialiseDOM(child, prefix);
499 } 556 }
500 557
501 void dumpState() { 558 void dumpState() {
502 _serialiseDOM(sky.document); 559 _serialiseDOM(sky.document);
503 } 560 }
OLDNEW
« no previous file with comments | « sky/framework/fn.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698