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

Side by Side Diff: sky/engine/core/rendering/RenderFlexibleBox.cpp

Issue 693353003: Fix margins and paddings on flex boxes. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 430
431 LayoutUnit RenderFlexibleBox::flowAwareBorderBefore() const 431 LayoutUnit RenderFlexibleBox::flowAwareBorderBefore() const
432 { 432 {
433 // FIXME(sky): Remove 433 // FIXME(sky): Remove
434 return borderTop(); 434 return borderTop();
435 } 435 }
436 436
437 LayoutUnit RenderFlexibleBox::flowAwareBorderAfter() const 437 LayoutUnit RenderFlexibleBox::flowAwareBorderAfter() const
438 { 438 {
439 // FIXME(sky): Remove 439 // FIXME(sky): Remove
440 return borderTop(); 440 return borderBottom();
441 } 441 }
442 442
443 LayoutUnit RenderFlexibleBox::flowAwarePaddingStart() const 443 LayoutUnit RenderFlexibleBox::flowAwarePaddingStart() const
444 { 444 {
445 if (isHorizontalFlow()) 445 if (isHorizontalFlow())
446 return isLeftToRightFlow() ? paddingLeft() : paddingRight(); 446 return isLeftToRightFlow() ? paddingLeft() : paddingRight();
447 return isLeftToRightFlow() ? paddingTop() : paddingBottom(); 447 return isLeftToRightFlow() ? paddingTop() : paddingBottom();
448 } 448 }
449 449
450 LayoutUnit RenderFlexibleBox::flowAwarePaddingEnd() const 450 LayoutUnit RenderFlexibleBox::flowAwarePaddingEnd() const
451 { 451 {
452 if (isHorizontalFlow()) 452 if (isHorizontalFlow())
453 return isLeftToRightFlow() ? paddingRight() : paddingLeft(); 453 return isLeftToRightFlow() ? paddingRight() : paddingLeft();
454 return isLeftToRightFlow() ? paddingBottom() : paddingTop(); 454 return isLeftToRightFlow() ? paddingBottom() : paddingTop();
455 } 455 }
456 456
457 LayoutUnit RenderFlexibleBox::flowAwarePaddingBefore() const 457 LayoutUnit RenderFlexibleBox::flowAwarePaddingBefore() const
458 { 458 {
459 // FIXME(sky): Remove 459 // FIXME(sky): Remove
460 return paddingTop(); 460 return paddingTop();
461 } 461 }
462 462
463 LayoutUnit RenderFlexibleBox::flowAwarePaddingAfter() const 463 LayoutUnit RenderFlexibleBox::flowAwarePaddingAfter() const
464 { 464 {
465 // FIXME(sky): Remove 465 // FIXME(sky): Remove
466 return paddingTop(); 466 return paddingBottom();
467 } 467 }
468 468
469 LayoutUnit RenderFlexibleBox::flowAwareMarginStartForChild(RenderBox* child) con st 469 LayoutUnit RenderFlexibleBox::flowAwareMarginStartForChild(RenderBox* child) con st
470 { 470 {
471 if (isHorizontalFlow()) 471 if (isHorizontalFlow())
472 return isLeftToRightFlow() ? child->marginLeft() : child->marginRight(); 472 return isLeftToRightFlow() ? child->marginLeft() : child->marginRight();
473 return isLeftToRightFlow() ? child->marginTop() : child->marginBottom(); 473 return isLeftToRightFlow() ? child->marginTop() : child->marginBottom();
474 } 474 }
475 475
476 LayoutUnit RenderFlexibleBox::flowAwareMarginEndForChild(RenderBox* child) const 476 LayoutUnit RenderFlexibleBox::flowAwareMarginEndForChild(RenderBox* child) const
477 { 477 {
478 if (isHorizontalFlow()) 478 if (isHorizontalFlow())
479 return isLeftToRightFlow() ? child->marginRight() : child->marginLeft(); 479 return isLeftToRightFlow() ? child->marginRight() : child->marginLeft();
480 return isLeftToRightFlow() ? child->marginBottom() : child->marginTop(); 480 return isLeftToRightFlow() ? child->marginBottom() : child->marginTop();
481 } 481 }
482 482
483 LayoutUnit RenderFlexibleBox::flowAwareMarginBeforeForChild(RenderBox* child) co nst 483 LayoutUnit RenderFlexibleBox::flowAwareMarginBeforeForChild(RenderBox* child) co nst
484 { 484 {
485 // FIXME(sky): Remove 485 // FIXME(sky): Remove
486 return marginTop(); 486 return child->marginTop();
487 } 487 }
488 488
489 LayoutUnit RenderFlexibleBox::crossAxisMarginExtentForChild(RenderBox* child) co nst 489 LayoutUnit RenderFlexibleBox::crossAxisMarginExtentForChild(RenderBox* child) co nst
490 { 490 {
491 return isHorizontalFlow() ? child->marginHeight() : child->marginWidth(); 491 return isHorizontalFlow() ? child->marginHeight() : child->marginWidth();
492 } 492 }
493 493
494 LayoutPoint RenderFlexibleBox::flowAwareLocationForChild(RenderBox* child) const 494 LayoutPoint RenderFlexibleBox::flowAwareLocationForChild(RenderBox* child) const
495 { 495 {
496 return isHorizontalFlow() ? child->location() : child->location().transposed Point(); 496 return isHorizontalFlow() ? child->location() : child->location().transposed Point();
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 ASSERT(child); 1302 ASSERT(child);
1303 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1303 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1304 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1304 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1305 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1305 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1306 adjustAlignmentForChild(child, newOffset - originalOffset); 1306 adjustAlignmentForChild(child, newOffset - originalOffset);
1307 } 1307 }
1308 } 1308 }
1309 } 1309 }
1310 1310
1311 } 1311 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698