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

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

Issue 1132113007: [Effen] remove more CSS (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: base is now checked in 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/components/scaffold.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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 337
338 class FlexBoxParentData extends CSSParentData { 338 class FlexBoxParentData extends CSSParentData {
339 int flex; 339 int flex;
340 void merge(FlexBoxParentData other) { 340 void merge(FlexBoxParentData other) {
341 if (other.flex != null) 341 if (other.flex != null)
342 flex = other.flex; 342 flex = other.flex;
343 super.merge(other); 343 super.merge(other);
344 } 344 }
345 } 345 }
346 346
347 enum FlexDirection { Row } 347 enum FlexDirection { Row, Column }
348 348
349 class RenderCSSFlex extends RenderCSSContainer { 349 class RenderCSSFlex extends RenderCSSContainer {
350 350
351 RenderCSSFlex(debug, FlexDirection direction) : _direction = direction, super( debug); 351 RenderCSSFlex(debug, FlexDirection direction) : _direction = direction, super( debug);
352 352
353 FlexDirection _direction; 353 FlexDirection _direction;
354 FlexDirection get direction => _direction; 354 FlexDirection get direction => _direction;
355 void set direction (FlexDirection value) { 355 void set direction (FlexDirection value) {
356 _direction = value; 356 _direction = value;
357 markNeedsLayout(); 357 markNeedsLayout();
358 } 358 }
359 359
360 void setupPos(RenderNode child) { 360 void setupPos(RenderNode child) {
361 if (child.parentData is! FlexBoxParentData) 361 if (child.parentData is! FlexBoxParentData)
362 child.parentData = new FlexBoxParentData(); 362 child.parentData = new FlexBoxParentData();
363 } 363 }
364 364
365 static final Style _displayFlex = new Style('display:flex'); 365 static final Style _displayFlex = new Style('display:flex');
366 static final Style _displayFlexRow = new Style('flex-direction:row'); 366 static final Style _displayFlexRow = new Style('flex-direction:row');
367 static final Style _displayFlexColumn = new Style('flex-direction:column');
367 368
368 String stylesToClasses(List<Style> styles) { 369 String stylesToClasses(List<Style> styles) {
369 var settings = _displayFlex._className; 370 var settings = _displayFlex._className;
370 switch (_direction) { 371 switch (_direction) {
371 case FlexDirection.Row: settings += ' ' + _displayFlexRow._className; 372 case FlexDirection.Row: settings += ' ' + _displayFlexRow._className; brea k;
373 case FlexDirection.Column: settings += ' ' + _displayFlexColumn._className ; break;
372 } 374 }
373 return super.stylesToClasses(styles) + ' ' + settings; 375 return super.stylesToClasses(styles) + ' ' + settings;
374 } 376 }
375 377
376 void markNeedsLayout() { 378 void markNeedsLayout() {
377 super.markNeedsLayout(); 379 super.markNeedsLayout();
378 380
379 // pretend we did the layout: 381 // pretend we did the layout:
380 RenderCSS child = _firstChild; 382 RenderCSS child = _firstChild;
381 while (child != null) { 383 while (child != null) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 print(prefix + node.toString() + _attributes(node)); 476 print(prefix + node.toString() + _attributes(node));
475 var children = node.getChildNodes(); 477 var children = node.getChildNodes();
476 prefix = prefix + ' '; 478 prefix = prefix + ' ';
477 for (var child in children) 479 for (var child in children)
478 _serialiseDOM(child, prefix); 480 _serialiseDOM(child, prefix);
479 } 481 }
480 482
481 void dumpState() { 483 void dumpState() {
482 _serialiseDOM(sky.document); 484 _serialiseDOM(sky.document);
483 } 485 }
OLDNEW
« no previous file with comments | « sky/framework/components/scaffold.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698