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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 752
753 LayoutUnit LayoutBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, 753 LayoutUnit LayoutBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth,
754 LayoutUnit availableWidth, 754 LayoutUnit availableWidth,
755 LayoutBlock* cb) const { 755 LayoutBlock* cb) const {
756 const ComputedStyle& styleToUse = styleRef(); 756 const ComputedStyle& styleToUse = styleRef();
757 if (!styleToUse.logicalMaxWidth().isMaxSizeNone()) 757 if (!styleToUse.logicalMaxWidth().isMaxSizeNone())
758 logicalWidth = 758 logicalWidth =
759 std::min(logicalWidth, 759 std::min(logicalWidth,
760 computeLogicalWidthUsing(MaxSize, styleToUse.logicalMaxWidth(), 760 computeLogicalWidthUsing(MaxSize, styleToUse.logicalMaxWidth(),
761 availableWidth, cb)); 761 availableWidth, cb));
762 return std::max(logicalWidth, computeLogicalWidthUsing( 762 return std::max(
763 MinSize, styleToUse.logicalMinWidth(), 763 logicalWidth,
764 availableWidth, cb)); 764 computeLogicalWidthUsing(MinSize, styleToUse.logicalMinWidth(),
765 availableWidth, cb));
765 } 766 }
766 767
767 LayoutUnit LayoutBox::constrainLogicalHeightByMinMax( 768 LayoutUnit LayoutBox::constrainLogicalHeightByMinMax(
768 LayoutUnit logicalHeight, 769 LayoutUnit logicalHeight,
769 LayoutUnit intrinsicContentHeight) const { 770 LayoutUnit intrinsicContentHeight) const {
770 const ComputedStyle& styleToUse = styleRef(); 771 const ComputedStyle& styleToUse = styleRef();
771 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) { 772 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) {
772 LayoutUnit maxH = computeLogicalHeightUsing( 773 LayoutUnit maxH = computeLogicalHeightUsing(
773 MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight); 774 MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight);
774 if (maxH != -1) 775 if (maxH != -1)
775 logicalHeight = std::min(logicalHeight, maxH); 776 logicalHeight = std::min(logicalHeight, maxH);
776 } 777 }
777 return std::max(logicalHeight, computeLogicalHeightUsing( 778 return std::max(
778 MinSize, styleToUse.logicalMinHeight(), 779 logicalHeight,
779 intrinsicContentHeight)); 780 computeLogicalHeightUsing(MinSize, styleToUse.logicalMinHeight(),
781 intrinsicContentHeight));
780 } 782 }
781 783
782 LayoutUnit LayoutBox::constrainContentBoxLogicalHeightByMinMax( 784 LayoutUnit LayoutBox::constrainContentBoxLogicalHeightByMinMax(
783 LayoutUnit logicalHeight, 785 LayoutUnit logicalHeight,
784 LayoutUnit intrinsicContentHeight) const { 786 LayoutUnit intrinsicContentHeight) const {
785 // If the min/max height and logical height are both percentages we take 787 // If the min/max height and logical height are both percentages we take
786 // advantage of already knowing the current resolved percentage height 788 // advantage of already knowing the current resolved percentage height
787 // to avoid recursing up through our containing blocks again to determine it. 789 // to avoid recursing up through our containing blocks again to determine it.
788 const ComputedStyle& styleToUse = styleRef(); 790 const ComputedStyle& styleToUse = styleRef();
789 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) { 791 if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) {
790 if (styleToUse.logicalMaxHeight().type() == Percent && 792 if (styleToUse.logicalMaxHeight().type() == Percent &&
791 styleToUse.logicalHeight().type() == Percent) { 793 styleToUse.logicalHeight().type() == Percent) {
792 LayoutUnit availableLogicalHeight( 794 LayoutUnit availableLogicalHeight(
793 logicalHeight / styleToUse.logicalHeight().value() * 100); 795 logicalHeight / styleToUse.logicalHeight().value() * 100);
794 logicalHeight = 796 logicalHeight = std::min(logicalHeight,
795 std::min(logicalHeight, valueForLength(styleToUse.logicalMaxHeight(), 797 valueForLength(styleToUse.logicalMaxHeight(),
796 availableLogicalHeight)); 798 availableLogicalHeight));
797 } else { 799 } else {
798 LayoutUnit maxHeight(computeContentLogicalHeight( 800 LayoutUnit maxHeight(computeContentLogicalHeight(
799 MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight)); 801 MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight));
800 if (maxHeight != -1) 802 if (maxHeight != -1)
801 logicalHeight = std::min(logicalHeight, maxHeight); 803 logicalHeight = std::min(logicalHeight, maxHeight);
802 } 804 }
803 } 805 }
804 806
805 if (styleToUse.logicalMinHeight().type() == Percent && 807 if (styleToUse.logicalMinHeight().type() == Percent &&
806 styleToUse.logicalHeight().type() == Percent) { 808 styleToUse.logicalHeight().type() == Percent) {
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 } 1792 }
1791 1793
1792 LayoutRect LayoutBox::overflowClipRect( 1794 LayoutRect LayoutBox::overflowClipRect(
1793 const LayoutPoint& location, 1795 const LayoutPoint& location,
1794 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const { 1796 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior) const {
1795 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property 1797 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property
1796 // here. 1798 // here.
1797 LayoutRect clipRect = borderBoxRect(); 1799 LayoutRect clipRect = borderBoxRect();
1798 clipRect.setLocation(location + clipRect.location() + 1800 clipRect.setLocation(location + clipRect.location() +
1799 LayoutSize(borderLeft(), borderTop())); 1801 LayoutSize(borderLeft(), borderTop()));
1800 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), 1802 clipRect.setSize(
1801 borderTop() + borderBottom())); 1803 clipRect.size() -
1804 LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
1802 1805
1803 if (hasOverflowClip()) 1806 if (hasOverflowClip())
1804 excludeScrollbars(clipRect, overlayScrollbarClipBehavior); 1807 excludeScrollbars(clipRect, overlayScrollbarClipBehavior);
1805 1808
1806 if (hasControlClip()) 1809 if (hasControlClip())
1807 clipRect.intersect(controlClipRect(location)); 1810 clipRect.intersect(controlClipRect(location));
1808 1811
1809 return clipRect; 1812 return clipRect;
1810 } 1813 }
1811 1814
(...skipping 29 matching lines...) Expand all
1841 size().width() - valueForLength(style()->clipRight(), size().width()), 1844 size().width() - valueForLength(style()->clipRight(), size().width()),
1842 LayoutUnit()); 1845 LayoutUnit());
1843 1846
1844 if (!style()->clipTop().isAuto()) { 1847 if (!style()->clipTop().isAuto()) {
1845 LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height()); 1848 LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height());
1846 clipRect.move(LayoutUnit(), c); 1849 clipRect.move(LayoutUnit(), c);
1847 clipRect.contract(LayoutUnit(), c); 1850 clipRect.contract(LayoutUnit(), c);
1848 } 1851 }
1849 1852
1850 if (!style()->clipBottom().isAuto()) 1853 if (!style()->clipBottom().isAuto())
1851 clipRect.contract(LayoutUnit(), 1854 clipRect.contract(
1852 size().height() - valueForLength(style()->clipBottom(), 1855 LayoutUnit(),
1853 size().height())); 1856 size().height() -
1857 valueForLength(style()->clipBottom(), size().height()));
1854 1858
1855 return clipRect; 1859 return clipRect;
1856 } 1860 }
1857 1861
1858 static LayoutUnit portionOfMarginNotConsumedByFloat(LayoutUnit childMargin, 1862 static LayoutUnit portionOfMarginNotConsumedByFloat(LayoutUnit childMargin,
1859 LayoutUnit contentSide, 1863 LayoutUnit contentSide,
1860 LayoutUnit offset) { 1864 LayoutUnit offset) {
1861 if (childMargin <= 0) 1865 if (childMargin <= 0)
1862 return LayoutUnit(); 1866 return LayoutUnit();
1863 LayoutUnit contentSideWithMargin = contentSide + childMargin; 1867 LayoutUnit contentSideWithMargin = contentSide + childMargin;
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 return computeIntrinsicLogicalWidthUsing( 2683 return computeIntrinsicLogicalWidthUsing(
2680 logicalWidth, availableLogicalWidth, borderAndPaddingLogicalWidth()); 2684 logicalWidth, availableLogicalWidth, borderAndPaddingLogicalWidth());
2681 2685
2682 LayoutUnit marginStart; 2686 LayoutUnit marginStart;
2683 LayoutUnit marginEnd; 2687 LayoutUnit marginEnd;
2684 LayoutUnit logicalWidthResult = 2688 LayoutUnit logicalWidthResult =
2685 fillAvailableMeasure(availableLogicalWidth, marginStart, marginEnd); 2689 fillAvailableMeasure(availableLogicalWidth, marginStart, marginEnd);
2686 2690
2687 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() && 2691 if (shrinkToAvoidFloats() && cb->isLayoutBlockFlow() &&
2688 toLayoutBlockFlow(cb)->containsFloats()) 2692 toLayoutBlockFlow(cb)->containsFloats())
2689 logicalWidthResult = std::min( 2693 logicalWidthResult =
2690 logicalWidthResult, shrinkLogicalWidthToAvoidFloats( 2694 std::min(logicalWidthResult,
2691 marginStart, marginEnd, toLayoutBlockFlow(cb))); 2695 shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd,
2696 toLayoutBlockFlow(cb)));
2692 2697
2693 if (widthType == MainOrPreferredSize && 2698 if (widthType == MainOrPreferredSize &&
2694 sizesLogicalWidthToFitContent(logicalWidth)) 2699 sizesLogicalWidthToFitContent(logicalWidth))
2695 return std::max(minPreferredLogicalWidth(), 2700 return std::max(minPreferredLogicalWidth(),
2696 std::min(maxPreferredLogicalWidth(), logicalWidthResult)); 2701 std::min(maxPreferredLogicalWidth(), logicalWidthResult));
2697 return logicalWidthResult; 2702 return logicalWidthResult;
2698 } 2703 }
2699 2704
2700 bool LayoutBox::columnFlexItemHasStretchAlignment() const { 2705 bool LayoutBox::columnFlexItemHasStretchAlignment() const {
2701 // auto margins mean we don't stretch. Note that this function will only be 2706 // auto margins mean we don't stretch. Note that this function will only be
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2854 marginEnd = std::max(LayoutUnit(), marginEndWidth); 2859 marginEnd = std::max(LayoutUnit(), marginEndWidth);
2855 } 2860 }
2856 } 2861 }
2857 2862
2858 // CSS 2.1 (10.3.3): "If 'width' is not 'auto' and 'border-left-width' + 2863 // CSS 2.1 (10.3.3): "If 'width' is not 'auto' and 'border-left-width' +
2859 // 'padding-left' + 'width' + 'padding-right' + 'border-right-width' (plus any 2864 // 'padding-left' + 'width' + 'padding-right' + 'border-right-width' (plus any
2860 // of 'margin-left' or 'margin-right' that are not 'auto') is larger than the 2865 // of 'margin-left' or 'margin-right' that are not 'auto') is larger than the
2861 // width of the containing block, then any 'auto' values for 'margin-left' or 2866 // width of the containing block, then any 'auto' values for 'margin-left' or
2862 // 'margin-right' are, for the following rules, treated as zero. 2867 // 'margin-right' are, for the following rules, treated as zero.
2863 LayoutUnit marginBoxWidth = 2868 LayoutUnit marginBoxWidth =
2864 childWidth + (!style()->width().isAuto() 2869 childWidth +
2865 ? marginStartWidth + marginEndWidth 2870 (!style()->width().isAuto() ? marginStartWidth + marginEndWidth
2866 : LayoutUnit()); 2871 : LayoutUnit());
2867 2872
2868 if (marginBoxWidth < availableWidth) { 2873 if (marginBoxWidth < availableWidth) {
2869 // CSS 2.1: "If both 'margin-left' and 'margin-right' are 'auto', their used 2874 // CSS 2.1: "If both 'margin-left' and 'margin-right' are 'auto', their used
2870 // values are equal. This horizontally centers the element with respect to 2875 // values are equal. This horizontally centers the element with respect to
2871 // the edges of the containing block." 2876 // the edges of the containing block."
2872 const ComputedStyle& containingBlockStyle = containingBlock->styleRef(); 2877 const ComputedStyle& containingBlockStyle = containingBlock->styleRef();
2873 if ((marginStartLength.isAuto() && marginEndLength.isAuto()) || 2878 if ((marginStartLength.isAuto() && marginEndLength.isAuto()) ||
2874 (!marginStartLength.isAuto() && !marginEndLength.isAuto() && 2879 (!marginStartLength.isAuto() && !marginEndLength.isAuto() &&
2875 containingBlockStyle.textAlign() == ETextAlign::kWebkitCenter)) { 2880 containingBlockStyle.textAlign() == ETextAlign::kWebkitCenter)) {
2876 // Other browsers center the margin box for align=center elements so we 2881 // Other browsers center the margin box for align=center elements so we
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
3255 availableHeight += cb->paddingLogicalHeight(); 3260 availableHeight += cb->paddingLogicalHeight();
3256 3261
3257 LayoutUnit result = valueForLength(height, availableHeight); 3262 LayoutUnit result = valueForLength(height, availableHeight);
3258 // |overrideLogicalContentHeight| is the maximum height made available by the 3263 // |overrideLogicalContentHeight| is the maximum height made available by the
3259 // cell to its percent height children when we decide they can determine the 3264 // cell to its percent height children when we decide they can determine the
3260 // height of the cell. If the percent height child is box-sizing:content-box 3265 // height of the cell. If the percent height child is box-sizing:content-box
3261 // then we must subtract the border and padding from the cell's 3266 // then we must subtract the border and padding from the cell's
3262 // |availableHeight| (given by |overrideLogicalContentHeight|) to arrive 3267 // |availableHeight| (given by |overrideLogicalContentHeight|) to arrive
3263 // at the child's computed height. 3268 // at the child's computed height.
3264 bool subtractBorderAndPadding = 3269 bool subtractBorderAndPadding =
3265 isTable() || (cb->isTableCell() && !skippedAutoHeightContainingBlock && 3270 isTable() ||
3266 cb->hasOverrideLogicalContentHeight() && 3271 (cb->isTableCell() && !skippedAutoHeightContainingBlock &&
3267 style()->boxSizing() == EBoxSizing::kContentBox); 3272 cb->hasOverrideLogicalContentHeight() &&
3273 style()->boxSizing() == EBoxSizing::kContentBox);
3268 if (subtractBorderAndPadding) { 3274 if (subtractBorderAndPadding) {
3269 result -= borderAndPaddingLogicalHeight(); 3275 result -= borderAndPaddingLogicalHeight();
3270 return std::max(LayoutUnit(), result); 3276 return std::max(LayoutUnit(), result);
3271 } 3277 }
3272 return result; 3278 return result;
3273 } 3279 }
3274 3280
3275 LayoutUnit LayoutBox::computeReplacedLogicalWidth( 3281 LayoutUnit LayoutBox::computeReplacedLogicalWidth(
3276 ShouldComputePreferred shouldComputePreferred) const { 3282 ShouldComputePreferred shouldComputePreferred) const {
3277 return computeReplacedLogicalWidthRespectingMinMaxWidth( 3283 return computeReplacedLogicalWidthRespectingMinMaxWidth(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
3329 ? containingBlockLogicalWidthForPositioned( 3335 ? containingBlockLogicalWidthForPositioned(
3330 toLayoutBoxModelObject(container())) 3336 toLayoutBoxModelObject(container()))
3331 : containingBlockLogicalWidthForContent(); 3337 : containingBlockLogicalWidthForContent();
3332 Length containerLogicalWidth = containingBlock()->style()->logicalWidth(); 3338 Length containerLogicalWidth = containingBlock()->style()->logicalWidth();
3333 // FIXME: Handle cases when containing block width is calculated or 3339 // FIXME: Handle cases when containing block width is calculated or
3334 // viewport percent. https://bugs.webkit.org/show_bug.cgi?id=91071 3340 // viewport percent. https://bugs.webkit.org/show_bug.cgi?id=91071
3335 if (logicalWidth.isIntrinsic()) 3341 if (logicalWidth.isIntrinsic())
3336 return computeIntrinsicLogicalWidthUsing( 3342 return computeIntrinsicLogicalWidthUsing(
3337 logicalWidth, cw, borderAndPaddingLogicalWidth()) - 3343 logicalWidth, cw, borderAndPaddingLogicalWidth()) -
3338 borderAndPaddingLogicalWidth(); 3344 borderAndPaddingLogicalWidth();
3339 if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || 3345 if (cw > 0 ||
3340 containerLogicalWidth.isPercentOrCalc()))) 3346 (!cw &&
3347 (containerLogicalWidth.isFixed() ||
3348 containerLogicalWidth.isPercentOrCalc())))
3341 return adjustContentBoxLogicalWidthForBoxSizing( 3349 return adjustContentBoxLogicalWidthForBoxSizing(
3342 minimumValueForLength(logicalWidth, cw)); 3350 minimumValueForLength(logicalWidth, cw));
3343 return LayoutUnit(); 3351 return LayoutUnit();
3344 } 3352 }
3345 case Auto: 3353 case Auto:
3346 case MaxSizeNone: 3354 case MaxSizeNone:
3347 return intrinsicLogicalWidth(); 3355 return intrinsicLogicalWidth();
3348 case ExtendToZoom: 3356 case ExtendToZoom:
3349 case DeviceWidth: 3357 case DeviceWidth:
3350 case DeviceHeight: 3358 case DeviceHeight:
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3542 containingBlockLogicalHeightForPositioned(containingBlock()); 3550 containingBlockLogicalHeightForPositioned(containingBlock());
3543 return adjustContentBoxLogicalHeightForBoxSizing( 3551 return adjustContentBoxLogicalHeightForBoxSizing(
3544 valueForLength(h, availableHeight)); 3552 valueForLength(h, availableHeight));
3545 } 3553 }
3546 3554
3547 // FIXME: Should we pass intrinsicContentLogicalHeight() instead of -1 here? 3555 // FIXME: Should we pass intrinsicContentLogicalHeight() instead of -1 here?
3548 LayoutUnit heightIncludingScrollbar = 3556 LayoutUnit heightIncludingScrollbar =
3549 computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, h, 3557 computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, h,
3550 LayoutUnit(-1)); 3558 LayoutUnit(-1));
3551 if (heightIncludingScrollbar != -1) 3559 if (heightIncludingScrollbar != -1)
3552 return std::max(LayoutUnit(), adjustContentBoxLogicalHeightForBoxSizing( 3560 return std::max(
3553 heightIncludingScrollbar) - 3561 LayoutUnit(),
3554 scrollbarLogicalHeight()); 3562 adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) -
3563 scrollbarLogicalHeight());
3555 3564
3556 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical 3565 // FIXME: Check logicalTop/logicalBottom here to correctly handle vertical
3557 // writing-mode. 3566 // writing-mode.
3558 // https://bugs.webkit.org/show_bug.cgi?id=46500 3567 // https://bugs.webkit.org/show_bug.cgi?id=46500
3559 if (isLayoutBlock() && isOutOfFlowPositioned() && 3568 if (isLayoutBlock() && isOutOfFlowPositioned() &&
3560 style()->height().isAuto() && 3569 style()->height().isAuto() &&
3561 !(style()->top().isAuto() || style()->bottom().isAuto())) { 3570 !(style()->top().isAuto() || style()->bottom().isAuto())) {
3562 LayoutBlock* block = const_cast<LayoutBlock*>(toLayoutBlock(this)); 3571 LayoutBlock* block = const_cast<LayoutBlock*>(toLayoutBlock(this));
3563 LogicalExtentComputedValues computedValues; 3572 LogicalExtentComputedValues computedValues;
3564 block->computeLogicalHeight(block->logicalHeight(), LayoutUnit(), 3573 block->computeLogicalHeight(block->logicalHeight(), LayoutUnit(),
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
4024 // ignore the value for 'left' (in case the 'direction' property of the 4033 // ignore the value for 'left' (in case the 'direction' property of the
4025 // containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') 4034 // containing block is 'rtl') or 'right' (in case 'direction' is 'ltr')
4026 // and solve for that value. 4035 // and solve for that value.
4027 // ------------------------------------------------------------------------- 4036 // -------------------------------------------------------------------------
4028 // NOTE: It is not necessary to solve for 'right' in the over constrained 4037 // NOTE: It is not necessary to solve for 'right' in the over constrained
4029 // case because the value is not used for any further calculations. 4038 // case because the value is not used for any further calculations.
4030 4039
4031 computedValues.m_extent = logicalWidthValue; 4040 computedValues.m_extent = logicalWidthValue;
4032 4041
4033 const LayoutUnit availableSpace = 4042 const LayoutUnit availableSpace =
4034 containerLogicalWidth - (logicalLeftValue + computedValues.m_extent + 4043 containerLogicalWidth -
4035 logicalRightValue + bordersPlusPadding); 4044 (logicalLeftValue + computedValues.m_extent + logicalRightValue +
4045 bordersPlusPadding);
4036 4046
4037 // Margins are now the only unknown 4047 // Margins are now the only unknown
4038 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) { 4048 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
4039 // Both margins auto, solve for equality 4049 // Both margins auto, solve for equality
4040 if (availableSpace >= 0) { 4050 if (availableSpace >= 0) {
4041 marginLogicalLeftValue = availableSpace / 2; // split the difference 4051 marginLogicalLeftValue = availableSpace / 2; // split the difference
4042 marginLogicalRightValue = 4052 marginLogicalRightValue =
4043 availableSpace - 4053 availableSpace -
4044 marginLogicalLeftValue; // account for odd valued differences 4054 marginLogicalLeftValue; // account for odd valued differences
4045 } else { 4055 } else {
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
5714 block->adjustChildDebugRect(rect); 5724 block->adjustChildDebugRect(rect);
5715 5725
5716 return rect; 5726 return rect;
5717 } 5727 }
5718 5728
5719 bool LayoutBox::shouldClipOverflow() const { 5729 bool LayoutBox::shouldClipOverflow() const {
5720 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); 5730 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip();
5721 } 5731 }
5722 5732
5723 } // namespace blink 5733 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698