| OLD | NEW |
| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 370 } |
| 371 | 371 |
| 372 Length RenderFlexibleBox::flexBasisForChild(RenderBox* child) const | 372 Length RenderFlexibleBox::flexBasisForChild(RenderBox* child) const |
| 373 { | 373 { |
| 374 Length flexLength = child->style()->flexBasis(); | 374 Length flexLength = child->style()->flexBasis(); |
| 375 if (flexLength.isAuto()) | 375 if (flexLength.isAuto()) |
| 376 flexLength = isHorizontalFlow() ? child->style()->width() : child->style
()->height(); | 376 flexLength = isHorizontalFlow() ? child->style()->width() : child->style
()->height(); |
| 377 return flexLength; | 377 return flexLength; |
| 378 } | 378 } |
| 379 | 379 |
| 380 void RenderFlexibleBox::setCrossAxisExtent(LayoutUnit extent) | |
| 381 { | |
| 382 if (isHorizontalFlow()) | |
| 383 setHeight(extent); | |
| 384 else | |
| 385 setWidth(extent); | |
| 386 } | |
| 387 | |
| 388 LayoutUnit RenderFlexibleBox::crossAxisExtentForChild(RenderBox* child) const | 380 LayoutUnit RenderFlexibleBox::crossAxisExtentForChild(RenderBox* child) const |
| 389 { | 381 { |
| 390 return isHorizontalFlow() ? child->height() : child->width(); | 382 return isHorizontalFlow() ? child->height() : child->width(); |
| 391 } | 383 } |
| 392 | 384 |
| 393 LayoutUnit RenderFlexibleBox::mainAxisExtentForChild(RenderBox* child) const | 385 LayoutUnit RenderFlexibleBox::mainAxisExtentForChild(RenderBox* child) const |
| 394 { | 386 { |
| 395 return isHorizontalFlow() ? child->width() : child->height(); | 387 return isHorizontalFlow() ? child->width() : child->height(); |
| 396 } | 388 } |
| 397 | 389 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 return child->marginBottom(); | 563 return child->marginBottom(); |
| 572 case LeftToRightWritingMode: | 564 case LeftToRightWritingMode: |
| 573 return child->marginLeft(); | 565 return child->marginLeft(); |
| 574 case RightToLeftWritingMode: | 566 case RightToLeftWritingMode: |
| 575 return child->marginRight(); | 567 return child->marginRight(); |
| 576 } | 568 } |
| 577 ASSERT_NOT_REACHED(); | 569 ASSERT_NOT_REACHED(); |
| 578 return marginTop(); | 570 return marginTop(); |
| 579 } | 571 } |
| 580 | 572 |
| 581 LayoutUnit RenderFlexibleBox::flowAwareMarginAfterForChild(RenderBox* child) con
st | |
| 582 { | |
| 583 switch (transformedWritingMode()) { | |
| 584 case TopToBottomWritingMode: | |
| 585 return child->marginBottom(); | |
| 586 case BottomToTopWritingMode: | |
| 587 return child->marginTop(); | |
| 588 case LeftToRightWritingMode: | |
| 589 return child->marginRight(); | |
| 590 case RightToLeftWritingMode: | |
| 591 return child->marginLeft(); | |
| 592 } | |
| 593 ASSERT_NOT_REACHED(); | |
| 594 return marginBottom(); | |
| 595 } | |
| 596 | |
| 597 LayoutUnit RenderFlexibleBox::crossAxisMarginExtentForChild(RenderBox* child) co
nst | 573 LayoutUnit RenderFlexibleBox::crossAxisMarginExtentForChild(RenderBox* child) co
nst |
| 598 { | 574 { |
| 599 return isHorizontalFlow() ? child->marginHeight() : child->marginWidth(); | 575 return isHorizontalFlow() ? child->marginHeight() : child->marginWidth(); |
| 600 } | 576 } |
| 601 | 577 |
| 602 LayoutUnit RenderFlexibleBox::crossAxisScrollbarExtent() const | 578 LayoutUnit RenderFlexibleBox::crossAxisScrollbarExtent() const |
| 603 { | 579 { |
| 604 return isHorizontalFlow() ? horizontalScrollbarHeight() : verticalScrollbarW
idth(); | 580 return isHorizontalFlow() ? horizontalScrollbarHeight() : verticalScrollbarW
idth(); |
| 605 } | 581 } |
| 606 | 582 |
| 607 LayoutPoint RenderFlexibleBox::flowAwareLocationForChild(RenderBox* child) const | 583 LayoutPoint RenderFlexibleBox::flowAwareLocationForChild(RenderBox* child) const |
| 608 { | 584 { |
| 609 return isHorizontalFlow() ? child->location() : child->location().transposed
Point(); | 585 return isHorizontalFlow() ? child->location() : child->location().transposed
Point(); |
| 610 } | 586 } |
| 611 | 587 |
| 612 void RenderFlexibleBox::setFlowAwareLocationForChild(RenderBox* child, const Lay
outPoint& location) | 588 void RenderFlexibleBox::setFlowAwareLocationForChild(RenderBox* child, const Lay
outPoint& location) |
| 613 { | 589 { |
| 614 if (isHorizontalFlow()) | 590 if (isHorizontalFlow()) |
| 615 child->setLocation(location); | 591 child->setLocation(location); |
| 616 else | 592 else |
| 617 child->setLocation(location.transposedPoint()); | 593 child->setLocation(location.transposedPoint()); |
| 618 } | 594 } |
| 619 | 595 |
| 620 LayoutUnit RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild(RenderBox*
child) const | 596 LayoutUnit RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild(RenderBox*
child) const |
| 621 { | 597 { |
| 622 return isHorizontalFlow() ? child->borderAndPaddingWidth() : child->borderAn
dPaddingHeight(); | 598 return isHorizontalFlow() ? child->borderAndPaddingWidth() : child->borderAn
dPaddingHeight(); |
| 623 } | 599 } |
| 624 | 600 |
| 625 LayoutUnit RenderFlexibleBox::mainAxisScrollbarExtentForChild(RenderBox* child)
const | |
| 626 { | |
| 627 return isHorizontalFlow() ? child->verticalScrollbarWidth() : child->horizon
talScrollbarHeight(); | |
| 628 } | |
| 629 | |
| 630 static inline bool preferredMainAxisExtentDependsOnLayout(const Length& flexBasi
s, bool hasInfiniteLineLength) | 601 static inline bool preferredMainAxisExtentDependsOnLayout(const Length& flexBasi
s, bool hasInfiniteLineLength) |
| 631 { | 602 { |
| 632 return flexBasis.isAuto() || (flexBasis.isFixed() && !flexBasis.value() && h
asInfiniteLineLength); | 603 return flexBasis.isAuto() || (flexBasis.isFixed() && !flexBasis.value() && h
asInfiniteLineLength); |
| 633 } | 604 } |
| 634 | 605 |
| 635 bool RenderFlexibleBox::childPreferredMainAxisContentExtentRequiresLayout(Render
Box* child, bool hasInfiniteLineLength) const | 606 bool RenderFlexibleBox::childPreferredMainAxisContentExtentRequiresLayout(Render
Box* child, bool hasInfiniteLineLength) const |
| 636 { | 607 { |
| 637 return preferredMainAxisExtentDependsOnLayout(flexBasisForChild(child), hasI
nfiniteLineLength) && hasOrthogonalFlow(child); | 608 return preferredMainAxisExtentDependsOnLayout(flexBasisForChild(child), hasI
nfiniteLineLength) && hasOrthogonalFlow(child); |
| 638 } | 609 } |
| 639 | 610 |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 ASSERT(child); | 1366 ASSERT(child); |
| 1396 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1367 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1397 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1368 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1398 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1369 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1399 adjustAlignmentForChild(child, newOffset - originalOffset); | 1370 adjustAlignmentForChild(child, newOffset - originalOffset); |
| 1400 } | 1371 } |
| 1401 } | 1372 } |
| 1402 } | 1373 } |
| 1403 | 1374 |
| 1404 } | 1375 } |
| OLD | NEW |