| OLD | NEW | 
|---|
| 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. All rights reserv
      ed. | 6  * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
      ed. | 
| 7  * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7  * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 
| 8  * | 8  * | 
| 9  * This library is free software; you can redistribute it and/or | 9  * This library is free software; you can redistribute it and/or | 
| 10  * modify it under the terms of the GNU Library General Public | 10  * modify it under the terms of the GNU Library General Public | 
| (...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2020     LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth, 
      marginStart, marginEnd); | 2020     LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth, 
      marginStart, marginEnd); | 
| 2021 | 2021 | 
| 2022     if (shrinkToAvoidFloats() && cb->isRenderBlockFlow() && toRenderBlockFlow(cb
      )->containsFloats()) | 2022     if (shrinkToAvoidFloats() && cb->isRenderBlockFlow() && toRenderBlockFlow(cb
      )->containsFloats()) | 
| 2023         logicalWidthResult = std::min(logicalWidthResult, shrinkLogicalWidthToAv
      oidFloats(marginStart, marginEnd, toRenderBlockFlow(cb))); | 2023         logicalWidthResult = std::min(logicalWidthResult, shrinkLogicalWidthToAv
      oidFloats(marginStart, marginEnd, toRenderBlockFlow(cb))); | 
| 2024 | 2024 | 
| 2025     if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(logica
      lWidth)) | 2025     if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(logica
      lWidth)) | 
| 2026         return std::max(minPreferredLogicalWidth(), std::min(maxPreferredLogical
      Width(), logicalWidthResult)); | 2026         return std::max(minPreferredLogicalWidth(), std::min(maxPreferredLogical
      Width(), logicalWidthResult)); | 
| 2027     return logicalWidthResult; | 2027     return logicalWidthResult; | 
| 2028 } | 2028 } | 
| 2029 | 2029 | 
| 2030 static bool flexItemHasStretchAlignment(const RenderObject* flexitem) | 2030 static bool columnFlexItemHasStretchAlignment(const RenderObject* flexitem) | 
| 2031 { | 2031 { | 
| 2032     RenderObject* parent = flexitem->parent(); | 2032     RenderObject* parent = flexitem->parent(); | 
| 2033     // auto margins mean we don't stretch. | 2033     // auto margins mean we don't stretch. Note that this function will only be 
      used for | 
| 2034     if (parent->style()->isColumnFlexDirection()) { | 2034     // widths, so we don't have to check marginBefore/marginAfter. | 
| 2035         if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marg
      inEnd().isAuto()) | 2035     ASSERT(parent->style()->isColumnFlexDirection()); | 
| 2036             return false; | 2036     if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
      d().isAuto()) | 
| 2037     } else { | 2037         return false; | 
| 2038         if (flexitem->style()->marginBefore().isAuto() || flexitem->style()->mar
      ginAfter().isAuto()) |  | 
| 2039             return false; |  | 
| 2040     } |  | 
| 2041     return flexitem->style()->alignSelf() == ItemPositionStretch || (flexitem->s
      tyle()->alignSelf() == ItemPositionAuto && parent->style()->alignItems() == Item
      PositionStretch); | 2038     return flexitem->style()->alignSelf() == ItemPositionStretch || (flexitem->s
      tyle()->alignSelf() == ItemPositionAuto && parent->style()->alignItems() == Item
      PositionStretch); | 
| 2042 } | 2039 } | 
| 2043 | 2040 | 
| 2044 static bool isStretchingColumnFlexItem(const RenderObject* flexitem) | 2041 static bool isStretchingColumnFlexItem(const RenderObject* flexitem) | 
| 2045 { | 2042 { | 
| 2046     RenderObject* parent = flexitem->parent(); | 2043     RenderObject* parent = flexitem->parent(); | 
| 2047     if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
      TICAL && parent->style()->boxAlign() == BSTRETCH) | 2044     if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
      TICAL && parent->style()->boxAlign() == BSTRETCH) | 
| 2048         return true; | 2045         return true; | 
| 2049 | 2046 | 
| 2050     // We don't stretch multiline flexboxes because they need to apply line spac
      ing (align-content) first. | 2047     // We don't stretch multiline flexboxes because they need to apply line spac
      ing (align-content) first. | 
| 2051     if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap && 
      parent->style()->isColumnFlexDirection() && flexItemHasStretchAlignment(flexitem
      )) | 2048     if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap && 
      parent->style()->isColumnFlexDirection() && columnFlexItemHasStretchAlignment(fl
      exitem)) | 
| 2052         return true; | 2049         return true; | 
| 2053     return false; | 2050     return false; | 
| 2054 } | 2051 } | 
| 2055 | 2052 | 
| 2056 bool RenderBox::sizesLogicalWidthToFitContent(const Length& logicalWidth) const | 2053 bool RenderBox::sizesLogicalWidthToFitContent(const Length& logicalWidth) const | 
| 2057 { | 2054 { | 
| 2058     // Marquees in WinIE are like a mixture of blocks and inline-blocks.  They s
      ize as though they're blocks, | 2055     // Marquees in WinIE are like a mixture of blocks and inline-blocks.  They s
      ize as though they're blocks, | 
| 2059     // but they allow text to sit on the same line as the marquee. | 2056     // but they allow text to sit on the same line as the marquee. | 
| 2060     if (isFloating() || (isInlineBlockOrInlineTable() && !isMarquee())) | 2057     if (isFloating() || (isInlineBlockOrInlineTable() && !isMarquee())) | 
| 2061         return true; | 2058         return true; | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 2074             return true; | 2071             return true; | 
| 2075     } | 2072     } | 
| 2076 | 2073 | 
| 2077     // Flexible box items should shrink wrap, so we lay them out at their intrin
      sic widths. | 2074     // Flexible box items should shrink wrap, so we lay them out at their intrin
      sic widths. | 
| 2078     // In the case of columns that have a stretch alignment, we go ahead and lay
      out at the | 2075     // In the case of columns that have a stretch alignment, we go ahead and lay
      out at the | 
| 2079     // stretched size to avoid an extra layout when applying alignment. | 2076     // stretched size to avoid an extra layout when applying alignment. | 
| 2080     if (parent()->isFlexibleBox()) { | 2077     if (parent()->isFlexibleBox()) { | 
| 2081         // For multiline columns, we need to apply align-content first, so we ca
      n't stretch now. | 2078         // For multiline columns, we need to apply align-content first, so we ca
      n't stretch now. | 
| 2082         if (!parent()->style()->isColumnFlexDirection() || parent()->style()->fl
      exWrap() != FlexNoWrap) | 2079         if (!parent()->style()->isColumnFlexDirection() || parent()->style()->fl
      exWrap() != FlexNoWrap) | 
| 2083             return true; | 2080             return true; | 
| 2084         if (!flexItemHasStretchAlignment(this)) | 2081         if (!columnFlexItemHasStretchAlignment(this)) | 
| 2085             return true; | 2082             return true; | 
| 2086     } | 2083     } | 
| 2087 | 2084 | 
| 2088     // Flexible horizontal boxes lay out children at their intrinsic widths.  Al
      so vertical boxes | 2085     // Flexible horizontal boxes lay out children at their intrinsic widths.  Al
      so vertical boxes | 
| 2089     // that don't stretch their kids lay out their children at their intrinsic w
      idths. | 2086     // that don't stretch their kids lay out their children at their intrinsic w
      idths. | 
| 2090     // FIXME: Think about block-flow here. | 2087     // FIXME: Think about block-flow here. | 
| 2091     // https://bugs.webkit.org/show_bug.cgi?id=46473 | 2088     // https://bugs.webkit.org/show_bug.cgi?id=46473 | 
| 2092     if (parent()->isDeprecatedFlexibleBox() && (parent()->style()->boxOrient() =
      = HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH)) | 2089     if (parent()->isDeprecatedFlexibleBox() && (parent()->style()->boxOrient() =
      = HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH)) | 
| 2093         return true; | 2090         return true; | 
| 2094 | 2091 | 
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2378     cb->addPercentHeightDescendant(const_cast<RenderBox*>(this)); | 2375     cb->addPercentHeightDescendant(const_cast<RenderBox*>(this)); | 
| 2379 | 2376 | 
| 2380     RenderStyle* cbstyle = cb->style(); | 2377     RenderStyle* cbstyle = cb->style(); | 
| 2381 | 2378 | 
| 2382     // A positioned element that specified both top/bottom or that specifies hei
      ght should be treated as though it has a height | 2379     // A positioned element that specified both top/bottom or that specifies hei
      ght should be treated as though it has a height | 
| 2383     // explicitly specified that can be used for any percentage computations. | 2380     // explicitly specified that can be used for any percentage computations. | 
| 2384     bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() 
      && (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c
      bstyle->logicalBottom().isAuto())); | 2381     bool isOutOfFlowPositionedWithSpecifiedHeight = cb->isOutOfFlowPositioned() 
      && (!cbstyle->logicalHeight().isAuto() || (!cbstyle->logicalTop().isAuto() && !c
      bstyle->logicalBottom().isAuto())); | 
| 2385 | 2382 | 
| 2386     bool includeBorderPadding = isTable(); | 2383     bool includeBorderPadding = isTable(); | 
| 2387 | 2384 | 
| 2388     if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) { | 2385     if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) | 
| 2389         availableHeight = containingBlockChild->containingBlockLogicalWidthForCo
      ntent(); | 2386         availableHeight = containingBlockChild->containingBlockLogicalWidthForCo
      ntent(); | 
| 2390     } else if (hasOverrideContainingBlockLogicalHeight()) { | 2387     else if (hasOverrideContainingBlockLogicalHeight()) | 
| 2391         availableHeight = overrideContainingBlockContentLogicalHeight(); | 2388         availableHeight = overrideContainingBlockContentLogicalHeight(); | 
| 2392     } else if (cb->isFlexItem() && flexItemHasStretchAlignment(cb) && cb->hasOve
      rrideHeight()) { | 2389     else if (cb->isTableCell()) { | 
| 2393         availableHeight = cb->overrideLogicalContentHeight(); |  | 
| 2394     } else if (cb->isTableCell()) { |  | 
| 2395         if (!skippedAutoHeightContainingBlock) { | 2390         if (!skippedAutoHeightContainingBlock) { | 
| 2396             // Table cells violate what the CSS spec says to do with heights. Ba
      sically we | 2391             // Table cells violate what the CSS spec says to do with heights. Ba
      sically we | 
| 2397             // don't care if the cell specified a height or not. We just always 
      make ourselves | 2392             // don't care if the cell specified a height or not. We just always 
      make ourselves | 
| 2398             // be a percentage of the cell's current content height. | 2393             // be a percentage of the cell's current content height. | 
| 2399             if (!cb->hasOverrideHeight()) { | 2394             if (!cb->hasOverrideHeight()) { | 
| 2400                 // Normally we would let the cell size intrinsically, but scroll
      ing overflow has to be | 2395                 // Normally we would let the cell size intrinsically, but scroll
      ing overflow has to be | 
| 2401                 // treated differently, since WinIE lets scrolled overflow regio
      ns shrink as needed. | 2396                 // treated differently, since WinIE lets scrolled overflow regio
      ns shrink as needed. | 
| 2402                 // While we can't get all cases right, we can at least detect wh
      en the cell has a specified | 2397                 // While we can't get all cases right, we can at least detect wh
      en the cell has a specified | 
| 2403                 // height or when the table has a specified height. In these cas
      es we want to initially have | 2398                 // height or when the table has a specified height. In these cas
      es we want to initially have | 
| 2404                 // no size and allow the flexing of the table or the cell to its
       specified height to cause us | 2399                 // no size and allow the flexing of the table or the cell to its
       specified height to cause us | 
| (...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4528     ASSERT(style()->hasBackground() || style()->hasBoxDecorations()); | 4523     ASSERT(style()->hasBackground() || style()->hasBoxDecorations()); | 
| 4529 | 4524 | 
| 4530     if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1) | 4525     if (m_rareData && m_rareData->m_previousBorderBoxSize.width() != -1) | 
| 4531         return m_rareData->m_previousBorderBoxSize; | 4526         return m_rareData->m_previousBorderBoxSize; | 
| 4532 | 4527 | 
| 4533     // We didn't save the old border box size because it was the same as the siz
      e of oldBounds. | 4528     // We didn't save the old border box size because it was the same as the siz
      e of oldBounds. | 
| 4534     return previousBoundsSize; | 4529     return previousBoundsSize; | 
| 4535 } | 4530 } | 
| 4536 | 4531 | 
| 4537 } // namespace blink | 4532 } // namespace blink | 
| OLD | NEW | 
|---|