Changeset 98594 in webkit
- Timestamp:
- Oct 27, 2011, 10:04:03 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r98593 r98594 1 2011-10-27 Tony Chang <tony@chromium.org> 2 3 use main/cross instead of logical width/height when talking about flow direction 4 https://bugs.webkit.org/show_bug.cgi?id=70977 5 6 Reviewed by Ojan Vafai. 7 8 Flexbox code uses logical in function names to refer to the flow 9 direction. This is confusing because writing mode also uses logical, 10 but this is a diffent usage. To avoid confusion, be explicit about 11 main vs cross axis. Extent is used instead of width/height. 12 13 No new tests, just a refactoring. 14 15 * rendering/RenderFlexibleBox.cpp: 16 (WebCore::RenderFlexibleBox::mainAxisLengthForChild): 17 (WebCore::RenderFlexibleBox::crossAxisLength): 18 (WebCore::RenderFlexibleBox::setCrossExtent): 19 (WebCore::RenderFlexibleBox::crossExtentForChild): 20 (WebCore::RenderFlexibleBox::mainExtentForChild): 21 (WebCore::RenderFlexibleBox::crossAxisExtent): 22 (WebCore::RenderFlexibleBox::mainAxisExtent): 23 (WebCore::RenderFlexibleBox::crossAxisContentExtent): 24 (WebCore::RenderFlexibleBox::mainAxisContentExtent): 25 (WebCore::RenderFlexibleBox::crossAxisBorderAndPaddingExtent): 26 (WebCore::RenderFlexibleBox::crossAxisMarginExtentForChild): 27 (WebCore::RenderFlexibleBox::flowAwareLocationForChild): 28 (WebCore::RenderFlexibleBox::setFlowAwareLocationForChild): 29 (WebCore::RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild): 30 (WebCore::RenderFlexibleBox::mainAxisScrollbarExtentForChild): 31 (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForFlexItem): 32 (WebCore::RenderFlexibleBox::layoutInlineDirection): 33 (WebCore::RenderFlexibleBox::positiveFlexForChild): Since flex only 34 matters in the main axis, there's no reason to deambiguate it here. 35 (WebCore::RenderFlexibleBox::negativeFlexForChild): Ditto. 36 (WebCore::RenderFlexibleBox::availableAlignmentSpaceForChild): Alignment is always 37 in the cross axis direction, so don't include that in the method name. 38 (WebCore::RenderFlexibleBox::marginBoxAscent): 39 (WebCore::RenderFlexibleBox::computePreferredMainAxisExtent): 40 (WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithmInlineDirection): 41 (WebCore::RenderFlexibleBox::layoutAndPlaceChildrenInlineDirection): 42 (WebCore::RenderFlexibleBox::adjustAlignmentForChild): Alignment is always 43 in the cross axis direction, so don't include that in the method name. 44 (WebCore::RenderFlexibleBox::alignChildrenBlockDirection): 45 * rendering/RenderFlexibleBox.h: 46 1 47 2011-10-27 Mark Hahnenberg <mhahnenberg@apple.com> 2 48 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r98373 r98594 229 229 } 230 230 231 Length RenderFlexibleBox:: flowAwareLogicalWidthLengthForChild(RenderBox* child) const231 Length RenderFlexibleBox::mainAxisLengthForChild(RenderBox* child) const 232 232 { 233 233 return isHorizontalFlow() ? child->style()->width() : child->style()->height(); 234 234 } 235 235 236 bool RenderFlexibleBox::isFlowAwareLogicalHeightAuto() const 237 { 238 Length height = isHorizontalFlow() ? style()->height() : style()->width(); 239 return height.isAuto(); 240 } 241 242 void RenderFlexibleBox::setFlowAwareLogicalHeight(LayoutUnit size) 236 Length RenderFlexibleBox::crossAxisLength() const 237 { 238 return isHorizontalFlow() ? style()->height() : style()->width(); 239 } 240 241 void RenderFlexibleBox::setCrossAxisExtent(LayoutUnit extent) 243 242 { 244 243 if (isHorizontalFlow()) 245 setHeight( size);244 setHeight(extent); 246 245 else 247 setWidth( size);248 } 249 250 LayoutUnit RenderFlexibleBox:: flowAwareLogicalHeightForChild(RenderBox* child)246 setWidth(extent); 247 } 248 249 LayoutUnit RenderFlexibleBox::crossAxisExtentForChild(RenderBox* child) 251 250 { 252 251 return isHorizontalFlow() ? child->height() : child->width(); 253 252 } 254 253 255 LayoutUnit RenderFlexibleBox:: flowAwareLogicalWidthForChild(RenderBox* child)254 LayoutUnit RenderFlexibleBox::mainAxisExtentForChild(RenderBox* child) 256 255 { 257 256 return isHorizontalFlow() ? child->width() : child->height(); 258 257 } 259 258 260 LayoutUnit RenderFlexibleBox:: flowAwareLogicalHeight() const259 LayoutUnit RenderFlexibleBox::crossAxisExtent() const 261 260 { 262 261 return isHorizontalFlow() ? height() : width(); 263 262 } 264 263 265 LayoutUnit RenderFlexibleBox:: flowAwareLogicalWidth() const264 LayoutUnit RenderFlexibleBox::mainAxisExtent() const 266 265 { 267 266 return isHorizontalFlow() ? width() : height(); 268 267 } 269 268 270 LayoutUnit RenderFlexibleBox:: flowAwareContentLogicalHeight() const269 LayoutUnit RenderFlexibleBox::crossAxisContentExtent() const 271 270 { 272 271 return isHorizontalFlow() ? contentHeight() : contentWidth(); 273 272 } 274 273 275 LayoutUnit RenderFlexibleBox:: flowAwareContentLogicalWidth() const274 LayoutUnit RenderFlexibleBox::mainAxisContentExtent() const 276 275 { 277 276 return isHorizontalFlow() ? contentWidth() : contentHeight(); … … 335 334 } 336 335 337 LayoutUnit RenderFlexibleBox:: flowAwareBorderAndPaddingLogicalHeight() const336 LayoutUnit RenderFlexibleBox::crossAxisBorderAndPaddingExtent() const 338 337 { 339 338 return isHorizontalFlow() ? borderAndPaddingHeight() : borderAndPaddingWidth(); … … 425 424 } 426 425 427 LayoutUnit RenderFlexibleBox:: flowAwareMarginLogicalHeightForChild(RenderBox* child) const426 LayoutUnit RenderFlexibleBox::crossAxisMarginExtentForChild(RenderBox* child) const 428 427 { 429 428 return isHorizontalFlow() ? child->marginTop() + child->marginBottom() : child->marginLeft() + child->marginRight(); 430 429 } 431 430 432 LayoutPoint RenderFlexibleBox::flowAwareLo gicalLocationForChild(RenderBox* child) const431 LayoutPoint RenderFlexibleBox::flowAwareLocationForChild(RenderBox* child) const 433 432 { 434 433 return isHorizontalFlow() ? child->location() : child->location().transposedPoint(); … … 465 464 } 466 465 467 void RenderFlexibleBox::setFlowAwareLo gicalLocationForChild(RenderBox* child, const LayoutPoint& location)466 void RenderFlexibleBox::setFlowAwareLocationForChild(RenderBox* child, const LayoutPoint& location) 468 467 { 469 468 if (isHorizontalFlow()) … … 473 472 } 474 473 475 LayoutUnit RenderFlexibleBox:: logicalBorderAndPaddingWidthForChild(RenderBox* child) const474 LayoutUnit RenderFlexibleBox::mainAxisBorderAndPaddingExtentForChild(RenderBox* child) const 476 475 { 477 476 return isHorizontalFlow() ? child->borderAndPaddingWidth() : child->borderAndPaddingHeight(); 478 477 } 479 478 480 LayoutUnit RenderFlexibleBox:: logicalScrollbarHeightForChild(RenderBox* child) const479 LayoutUnit RenderFlexibleBox::mainAxisScrollbarExtentForChild(RenderBox* child) const 481 480 { 482 481 return isHorizontalFlow() ? child->verticalScrollbarWidth() : child->horizontalScrollbarHeight(); … … 497 496 } 498 497 499 LayoutUnit RenderFlexibleBox::preferred LogicalContentWidthForFlexItem(RenderBox* child) const500 { 501 Length logicalWidthLength = flowAwareLogicalWidthLengthForChild(child);502 if ( logicalWidthLength.isAuto()) {503 LayoutUnit logicalWidth= hasOrthogonalFlow(child) ? child->logicalHeight() : child->maxPreferredLogicalWidth();504 return logicalWidth - logicalBorderAndPaddingWidthForChild(child) - logicalScrollbarHeightForChild(child);505 } 506 return logicalWidthLength.calcMinValue(flowAwareContentLogicalWidth());498 LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForFlexItem(RenderBox* child) const 499 { 500 Length mainAxisLength = mainAxisLengthForChild(child); 501 if (mainAxisLength.isAuto()) { 502 LayoutUnit mainAxisExtent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->maxPreferredLogicalWidth(); 503 return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child) - mainAxisScrollbarExtentForChild(child); 504 } 505 return mainAxisLength.calcMinValue(mainAxisContentExtent()); 507 506 } 508 507 509 508 void RenderFlexibleBox::layoutInlineDirection(bool relayoutChildren) 510 509 { 511 LayoutUnit preferred LogicalWidth;510 LayoutUnit preferredMainAxisExtent; 512 511 float totalPositiveFlexibility; 513 512 float totalNegativeFlexibility; 514 513 TreeOrderIterator treeIterator(this); 515 514 516 computePreferred LogicalWidth(relayoutChildren, treeIterator, preferredLogicalWidth, totalPositiveFlexibility, totalNegativeFlexibility);517 LayoutUnit availableFreeSpace = flowAwareContentLogicalWidth() - preferredLogicalWidth;515 computePreferredMainAxisExtent(relayoutChildren, treeIterator, preferredMainAxisExtent, totalPositiveFlexibility, totalNegativeFlexibility); 516 LayoutUnit availableFreeSpace = mainAxisContentExtent() - preferredMainAxisExtent; 518 517 519 518 FlexOrderIterator flexIterator(this, treeIterator.flexOrderValues()); … … 528 527 } 529 528 530 float RenderFlexibleBox:: logicalPositiveFlexForChild(RenderBox* child) const529 float RenderFlexibleBox::positiveFlexForChild(RenderBox* child) const 531 530 { 532 531 return isHorizontalFlow() ? child->style()->flexboxWidthPositiveFlex() : child->style()->flexboxHeightPositiveFlex(); 533 532 } 534 533 535 float RenderFlexibleBox:: logicalNegativeFlexForChild(RenderBox* child) const534 float RenderFlexibleBox::negativeFlexForChild(RenderBox* child) const 536 535 { 537 536 return isHorizontalFlow() ? child->style()->flexboxWidthNegativeFlex() : child->style()->flexboxHeightNegativeFlex(); 538 537 } 539 538 540 LayoutUnit RenderFlexibleBox::available LogicalHeightForChild(RenderBox* child)541 { 542 LayoutUnit c ontentLogicalHeight = flowAwareContentLogicalHeight();543 LayoutUnit c urrentChildHeight = flowAwareMarginLogicalHeightForChild(child) + flowAwareLogicalHeightForChild(child);544 return c ontentLogicalHeight - currentChildHeight;539 LayoutUnit RenderFlexibleBox::availableAlignmentSpaceForChild(RenderBox* child) 540 { 541 LayoutUnit crossContentExtent = crossAxisContentExtent(); 542 LayoutUnit childCrossExtent = crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child); 543 return crossContentExtent - childCrossExtent; 545 544 } 546 545 … … 549 548 LayoutUnit ascent = child->firstLineBoxBaseline(); 550 549 if (ascent == -1) 551 ascent = flowAwareLogicalHeightForChild(child) + flowAwareMarginAfterForChild(child);550 ascent = crossAxisExtentForChild(child) + flowAwareMarginAfterForChild(child); 552 551 return ascent + flowAwareMarginBeforeForChild(child); 553 552 } 554 553 555 void RenderFlexibleBox::computePreferred LogicalWidth(bool relayoutChildren, TreeOrderIterator& iterator, LayoutUnit& preferredLogicalWidth, float& totalPositiveFlexibility, float& totalNegativeFlexibility)556 { 557 preferred LogicalWidth= 0;554 void RenderFlexibleBox::computePreferredMainAxisExtent(bool relayoutChildren, TreeOrderIterator& iterator, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalNegativeFlexibility) 555 { 556 preferredMainAxisExtent = 0; 558 557 totalPositiveFlexibility = totalNegativeFlexibility = 0; 559 558 560 LayoutUnit flexboxAvailable LogicalWidth = flowAwareContentLogicalWidth();559 LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); 561 560 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { 562 if ( flowAwareLogicalWidthLengthForChild(child).isAuto()) {561 if (mainAxisLengthForChild(child).isAuto()) { 563 562 child->clearOverrideSize(); 564 563 if (!relayoutChildren) … … 571 570 // computes the start/end margins. 572 571 if (isHorizontalFlow()) { 573 child->setMarginLeft(child->style()->marginLeft().calcMinValue(flexboxAvailable LogicalWidth));574 child->setMarginRight(child->style()->marginRight().calcMinValue(flexboxAvailable LogicalWidth));575 preferred LogicalWidth+= child->marginLeft() + child->marginRight();572 child->setMarginLeft(child->style()->marginLeft().calcMinValue(flexboxAvailableContentExtent)); 573 child->setMarginRight(child->style()->marginRight().calcMinValue(flexboxAvailableContentExtent)); 574 preferredMainAxisExtent += child->marginLeft() + child->marginRight(); 576 575 } else { 577 child->setMarginTop(child->style()->marginTop().calcMinValue(flexboxAvailable LogicalWidth));578 child->setMarginBottom(child->style()->marginBottom().calcMinValue(flexboxAvailable LogicalWidth));579 preferred LogicalWidth+= child->marginTop() + child->marginBottom();576 child->setMarginTop(child->style()->marginTop().calcMinValue(flexboxAvailableContentExtent)); 577 child->setMarginBottom(child->style()->marginBottom().calcMinValue(flexboxAvailableContentExtent)); 578 preferredMainAxisExtent += child->marginTop() + child->marginBottom(); 580 579 } 581 580 582 preferred LogicalWidth += logicalBorderAndPaddingWidthForChild(child);583 preferred LogicalWidth += preferredLogicalContentWidthForFlexItem(child);584 585 totalPositiveFlexibility += logicalPositiveFlexForChild(child);586 totalNegativeFlexibility += logicalNegativeFlexForChild(child);581 preferredMainAxisExtent += mainAxisBorderAndPaddingExtentForChild(child); 582 preferredMainAxisExtent += preferredMainAxisContentExtentForFlexItem(child); 583 584 totalPositiveFlexibility += positiveFlexForChild(child); 585 totalNegativeFlexibility += negativeFlexForChild(child); 587 586 } 588 587 } … … 593 592 childSizes.clear(); 594 593 595 LayoutUnit flexboxAvailable LogicalWidth = flowAwareContentLogicalWidth();594 LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); 596 595 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { 597 596 LayoutUnit childPreferredSize; … … 599 598 childPreferredSize = inflexibleItems.get(child); 600 599 else { 601 childPreferredSize = preferred LogicalContentWidthForFlexItem(child);600 childPreferredSize = preferredMainAxisContentExtentForFlexItem(child); 602 601 if (availableFreeSpace > 0 && totalPositiveFlexibility > 0) { 603 childPreferredSize += lroundf(availableFreeSpace * logicalPositiveFlexForChild(child) / totalPositiveFlexibility);602 childPreferredSize += lroundf(availableFreeSpace * positiveFlexForChild(child) / totalPositiveFlexibility); 604 603 605 604 Length childLogicalMaxWidth = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight(); 606 if (!childLogicalMaxWidth.isUndefined() && childLogicalMaxWidth.isSpecified() && childPreferredSize > childLogicalMaxWidth.calcValue(flexboxAvailable LogicalWidth)) {607 childPreferredSize = childLogicalMaxWidth.calcValue(flexboxAvailable LogicalWidth);608 availableFreeSpace -= childPreferredSize - preferred LogicalContentWidthForFlexItem(child);609 totalPositiveFlexibility -= logicalPositiveFlexForChild(child);605 if (!childLogicalMaxWidth.isUndefined() && childLogicalMaxWidth.isSpecified() && childPreferredSize > childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent)) { 606 childPreferredSize = childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent); 607 availableFreeSpace -= childPreferredSize - preferredMainAxisContentExtentForFlexItem(child); 608 totalPositiveFlexibility -= positiveFlexForChild(child); 610 609 611 610 inflexibleItems.set(child, childPreferredSize); … … 613 612 } 614 613 } else if (availableFreeSpace < 0 && totalNegativeFlexibility > 0) { 615 childPreferredSize += lroundf(availableFreeSpace * logicalNegativeFlexForChild(child) / totalNegativeFlexibility);614 childPreferredSize += lroundf(availableFreeSpace * negativeFlexForChild(child) / totalNegativeFlexibility); 616 615 617 616 Length childLogicalMinWidth = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); 618 if (!childLogicalMinWidth.isUndefined() && childLogicalMinWidth.isSpecified() && childPreferredSize < childLogicalMinWidth.calcValue(flexboxAvailable LogicalWidth)) {619 childPreferredSize = childLogicalMinWidth.calcValue(flexboxAvailable LogicalWidth);620 availableFreeSpace += preferred LogicalContentWidthForFlexItem(child) - childPreferredSize;621 totalNegativeFlexibility -= logicalNegativeFlexForChild(child);617 if (!childLogicalMinWidth.isUndefined() && childLogicalMinWidth.isSpecified() && childPreferredSize < childLogicalMinWidth.calcValue(flexboxAvailableContentExtent)) { 618 childPreferredSize = childLogicalMinWidth.calcValue(flexboxAvailableContentExtent); 619 availableFreeSpace += preferredMainAxisContentExtentForFlexItem(child) - childPreferredSize; 620 totalNegativeFlexibility -= negativeFlexForChild(child); 622 621 623 622 inflexibleItems.set(child, childPreferredSize); … … 657 656 658 657 LayoutUnit logicalTop = flowAwareBorderBefore() + flowAwarePaddingBefore(); 659 LayoutUnit total LogicalWidth = flowAwareLogicalWidth();660 if ( isFlowAwareLogicalHeightAuto())661 set FlowAwareLogicalHeight(0);658 LayoutUnit totalMainExtent = mainAxisExtent(); 659 if (crossAxisLength().isAuto()) 660 setCrossAxisExtent(0); 662 661 LayoutUnit maxAscent = 0, maxDescent = 0; // Used when flex-align: baseline. 663 662 size_t i = 0; 664 663 for (RenderBox* child = iterator.first(); child; child = iterator.next(), ++i) { 665 LayoutUnit childPreferredSize = childSizes[i] + logicalBorderAndPaddingWidthForChild(child);664 LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPaddingExtentForChild(child); 666 665 setLogicalOverrideSize(child, childPreferredSize); 667 666 child->setChildNeedsLayout(true); … … 670 669 if (child->style()->flexAlign() == AlignBaseline) { 671 670 LayoutUnit ascent = marginBoxAscent(child); 672 LayoutUnit descent = ( flowAwareMarginLogicalHeightForChild(child) + flowAwareLogicalHeightForChild(child)) - ascent;671 LayoutUnit descent = (crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child)) - ascent; 673 672 674 673 maxAscent = std::max(maxAscent, ascent); … … 676 675 677 676 // FIXME: add flowAwareScrollbarLogicalHeight. 678 if ( isFlowAwareLogicalHeightAuto())679 set FlowAwareLogicalHeight(std::max(flowAwareLogicalHeight(), flowAwareBorderAndPaddingLogicalHeight() + flowAwareMarginLogicalHeightForChild(child) + maxAscent + maxDescent + scrollbarLogicalHeight()));680 } else if ( isFlowAwareLogicalHeightAuto())681 set FlowAwareLogicalHeight(std::max(flowAwareLogicalHeight(), flowAwareBorderAndPaddingLogicalHeight() + flowAwareMarginLogicalHeightForChild(child) + flowAwareLogicalHeightForChild(child) + scrollbarLogicalHeight()));677 if (crossAxisLength().isAuto()) 678 setCrossAxisExtent(std::max(crossAxisExtent(), crossAxisBorderAndPaddingExtent() + crossAxisMarginExtentForChild(child) + maxAscent + maxDescent + scrollbarLogicalHeight())); 679 } else if (crossAxisLength().isAuto()) 680 setCrossAxisExtent(std::max(crossAxisExtent(), crossAxisBorderAndPaddingExtent() + crossAxisMarginExtentForChild(child) + crossAxisExtentForChild(child) + scrollbarLogicalHeight())); 682 681 683 682 startEdge += flowAwareMarginStartForChild(child); 684 683 685 LayoutUnit child LogicalWidth = flowAwareLogicalWidthForChild(child);684 LayoutUnit childMainExtent = mainAxisExtentForChild(child); 686 685 bool shouldFlipInlineDirection = isColumnFlow() ? true : isLeftToRightFlow(); 687 LayoutUnit logicalLeft = shouldFlipInlineDirection ? startEdge : total LogicalWidth - startEdge - childLogicalWidth;686 LayoutUnit logicalLeft = shouldFlipInlineDirection ? startEdge : totalMainExtent - startEdge - childMainExtent; 688 687 689 688 // FIXME: Supporting layout deltas. 690 setFlowAwareLo gicalLocationForChild(child, IntPoint(logicalLeft, logicalTop + flowAwareMarginBeforeForChild(child)));691 startEdge += child LogicalWidth+ flowAwareMarginEndForChild(child);689 setFlowAwareLocationForChild(child, IntPoint(logicalLeft, logicalTop + flowAwareMarginBeforeForChild(child))); 690 startEdge += childMainExtent + flowAwareMarginEndForChild(child); 692 691 693 692 if (hasPackingSpace(availableFreeSpace, totalPositiveFlexibility) && style()->flexPack() == PackJustify && childSizes.size() > 1) … … 698 697 } 699 698 700 void RenderFlexibleBox::adjust LocationLogicalTopForChild(RenderBox* child, LayoutUnit delta)699 void RenderFlexibleBox::adjustAlignmentForChild(RenderBox* child, LayoutUnit delta) 701 700 { 702 701 LayoutRect oldRect = child->frameRect(); 703 702 704 setFlowAwareLo gicalLocationForChild(child, flowAwareLogicalLocationForChild(child) + LayoutSize(0, delta));703 setFlowAwareLocationForChild(child, flowAwareLocationForChild(child) + LayoutSize(0, delta)); 705 704 706 705 // If the child moved, we have to repaint it as well as any floating/positioned … … 713 712 void RenderFlexibleBox::alignChildrenBlockDirection(FlexOrderIterator& iterator, LayoutUnit maxAscent) 714 713 { 715 LayoutUnit logicalHeight = flowAwareLogicalHeight();714 LayoutUnit crossExtent = crossAxisExtent(); 716 715 717 716 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { 718 717 // direction:rtl + flex-flow:column means the cross-axis direction is flipped. 719 718 if (!style()->isLeftToRightDirection() && isColumnFlow()) { 720 LayoutPoint location = flowAwareLo gicalLocationForChild(child);721 location.setY( logicalHeight - flowAwareLogicalHeightForChild(child) - location.y());722 setFlowAwareLo gicalLocationForChild(child, location);719 LayoutPoint location = flowAwareLocationForChild(child); 720 location.setY(crossExtent - crossAxisExtentForChild(child) - location.y()); 721 setFlowAwareLocationForChild(child, location); 723 722 } 724 723 … … 729 728 if (height.isAuto()) { 730 729 // FIXME: Clamp to max-height once it's spec'ed (should we align towards the start or center?). 731 LayoutUnit stretchedHeight = logicalHeightForChild(child) + RenderFlexibleBox::available LogicalHeightForChild(child);730 LayoutUnit stretchedHeight = logicalHeightForChild(child) + RenderFlexibleBox::availableAlignmentSpaceForChild(child); 732 731 if (isHorizontalFlow()) 733 732 child->setHeight(stretchedHeight); … … 740 739 break; 741 740 case AlignEnd: 742 adjust LocationLogicalTopForChild(child, RenderFlexibleBox::availableLogicalHeightForChild(child));741 adjustAlignmentForChild(child, RenderFlexibleBox::availableAlignmentSpaceForChild(child)); 743 742 break; 744 743 case AlignCenter: 745 adjust LocationLogicalTopForChild(child, RenderFlexibleBox::availableLogicalHeightForChild(child) / 2);744 adjustAlignmentForChild(child, RenderFlexibleBox::availableAlignmentSpaceForChild(child) / 2); 746 745 break; 747 746 case AlignBaseline: { 748 747 LayoutUnit ascent = marginBoxAscent(child); 749 adjust LocationLogicalTopForChild(child, maxAscent - ascent);748 adjustAlignmentForChild(child, maxAscent - ascent); 750 749 break; 751 750 } -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r98373 r98594 58 58 bool isHorizontalFlow() const; 59 59 bool isLeftToRightFlow() const; 60 bool isFlowAwareLogicalHeightAuto() const;61 Length flowAwareLogicalWidthLengthForChild(RenderBox* child) const;62 void set FlowAwareLogicalHeight(LayoutUnit);63 LayoutUnit flowAwareLogicalHeightForChild(RenderBox* child);64 LayoutUnit flowAwareLogicalWidthForChild(RenderBox* child);65 LayoutUnit flowAwareLogicalHeight() const;66 LayoutUnit flowAwareLogicalWidth() const;67 LayoutUnit flowAwareContentLogicalHeight() const;68 LayoutUnit flowAwareContentLogicalWidth() const;60 Length crossAxisLength() const; 61 Length mainAxisLengthForChild(RenderBox* child) const; 62 void setCrossAxisExtent(LayoutUnit); 63 LayoutUnit crossAxisExtentForChild(RenderBox* child); 64 LayoutUnit mainAxisExtentForChild(RenderBox* child); 65 LayoutUnit crossAxisExtent() const; 66 LayoutUnit mainAxisExtent() const; 67 LayoutUnit crossAxisContentExtent() const; 68 LayoutUnit mainAxisContentExtent() const; 69 69 WritingMode transformedWritingMode() const; 70 70 LayoutUnit flowAwareBorderStart() const; 71 71 LayoutUnit flowAwareBorderBefore() const; 72 72 LayoutUnit flowAwareBorderAfter() const; 73 LayoutUnit flowAwareBorderAndPaddingLogicalHeight() const;73 LayoutUnit crossAxisBorderAndPaddingExtent() const; 74 74 LayoutUnit flowAwarePaddingStart() const; 75 75 LayoutUnit flowAwarePaddingBefore() const; … … 79 79 LayoutUnit flowAwareMarginBeforeForChild(RenderBox* child) const; 80 80 LayoutUnit flowAwareMarginAfterForChild(RenderBox* child) const; 81 LayoutUnit flowAwareMarginLogicalHeightForChild(RenderBox* child) const;82 LayoutPoint flowAwareLo gicalLocationForChild(RenderBox* child) const;81 LayoutUnit crossAxisMarginExtentForChild(RenderBox* child) const; 82 LayoutPoint flowAwareLocationForChild(RenderBox* child) const; 83 83 void setFlowAwareMarginStartForChild(RenderBox* child, LayoutUnit); 84 84 void setFlowAwareMarginEndForChild(RenderBox* child, LayoutUnit); 85 85 // FIXME: Supporting layout deltas. 86 void setFlowAwareLo gicalLocationForChild(RenderBox* child, const LayoutPoint&);87 void adjust LocationLogicalTopForChild(RenderBox* child, LayoutUnit);88 LayoutUnit logicalBorderAndPaddingWidthForChild(RenderBox* child) const;89 LayoutUnit logicalScrollbarHeightForChild(RenderBox* child) const;86 void setFlowAwareLocationForChild(RenderBox* child, const LayoutPoint&); 87 void adjustAlignmentForChild(RenderBox* child, LayoutUnit); 88 LayoutUnit mainAxisBorderAndPaddingExtentForChild(RenderBox* child) const; 89 LayoutUnit mainAxisScrollbarExtentForChild(RenderBox* child) const; 90 90 Length marginStartStyleForChild(RenderBox* child) const; 91 91 Length marginEndStyleForChild(RenderBox* child) const; 92 LayoutUnit preferred LogicalContentWidthForFlexItem(RenderBox* child) const;92 LayoutUnit preferredMainAxisContentExtentForFlexItem(RenderBox* child) const; 93 93 94 94 void layoutInlineDirection(bool relayoutChildren); 95 95 96 float logicalPositiveFlexForChild(RenderBox* child) const;97 float logicalNegativeFlexForChild(RenderBox* child) const;96 float positiveFlexForChild(RenderBox* child) const; 97 float negativeFlexForChild(RenderBox* child) const; 98 98 99 LayoutUnit available LogicalHeightForChild(RenderBox*);99 LayoutUnit availableAlignmentSpaceForChild(RenderBox*); 100 100 LayoutUnit marginBoxAscent(RenderBox*); 101 101 102 void computePreferred LogicalWidth(bool relayoutChildren, TreeOrderIterator&, LayoutUnit&, float& totalPositiveFlexibility, float& totalNegativeFlexibility);102 void computePreferredMainAxisExtent(bool relayoutChildren, TreeOrderIterator&, LayoutUnit&, float& totalPositiveFlexibility, float& totalNegativeFlexibility); 103 103 bool runFreeSpaceAllocationAlgorithmInlineDirection(FlexOrderIterator&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes); 104 104 void setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize);
Note:
See TracChangeset
for help on using the changeset viewer.