Changeset 68917 in webkit


Ignore:
Timestamp:
Oct 1, 2010 12:59:48 PM (14 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=46642, make replaced elements work with block-flow. This patch changes
all of the computeReplacedLogicalWidth and comuteReplacedLogicalHeight functions (and their helpers) to use logical width
and logical height instead.

Reviewed by Darin Adler.

Added fast/blockflow/block-level-images.html

WebCore:

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computeLogicalWidth):
(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalWidth):
(WebCore::RenderBox::computeReplacedLogicalWidthUsing):
(WebCore::RenderBox::computeReplacedLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
(WebCore::RenderBox::computePositionedLogicalWidthReplaced):
(WebCore::RenderBox::computePositionedLogicalHeightReplaced):

  • rendering/RenderBox.h:

(WebCore::RenderBox::intrinsicLogicalWidth):
(WebCore::RenderBox::intrinsicLogicalHeight):

  • rendering/RenderImage.cpp:

(WebCore::RenderImage::isLogicalWidthSpecified):
(WebCore::RenderImage::isLogicalHeightSpecified):
(WebCore::RenderImage::computeReplacedLogicalWidth):
(WebCore::RenderImage::computeReplacedLogicalHeight):
(WebCore::RenderImage::calcAspectRatioLogicalWidth):
(WebCore::RenderImage::calcAspectRatioLogicalHeight):

  • rendering/RenderImage.h:
  • rendering/RenderReplaced.cpp:

(WebCore::RenderReplaced::layout):
(WebCore::RenderReplaced::computeReplacedLogicalWidth):
(WebCore::RenderReplaced::computeReplacedLogicalHeight):
(WebCore::RenderReplaced::calcAspectRatioLogicalWidth):
(WebCore::RenderReplaced::calcAspectRatioLogicalHeight):
(WebCore::RenderReplaced::computePreferredLogicalWidths):

  • rendering/RenderReplaced.h:
  • rendering/RenderSVGRoot.cpp:

(WebCore::RenderSVGRoot::computePreferredLogicalWidths):
(WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
(WebCore::RenderSVGRoot::computeReplacedLogicalHeight):

  • rendering/RenderSVGRoot.h:
  • rendering/RenderVideo.cpp:

(WebCore::RenderVideo::computeReplacedLogicalWidth):
(WebCore::RenderVideo::computeReplacedLogicalHeight):

  • rendering/RenderVideo.h:

LayoutTests:

  • fast/blockflow/block-level-images.html: Added.
  • fast/blockflow/resources: Added.
  • fast/blockflow/resources/circle.svg: Added.
  • fast/blockflow/resources/oval.png: Added.
  • platform/mac/fast/blockflow/block-level-images-expected.checksum: Added.
  • platform/mac/fast/blockflow/block-level-images-expected.png: Added.
  • platform/mac/fast/blockflow/block-level-images-expected.txt: Added.
Location:
trunk
Files:
7 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r68914 r68917  
     12010-10-01  David Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=46642, make replaced elements work with block-flow.  This patch changes
     6        all of the computeReplacedLogicalWidth and comuteReplacedLogicalHeight functions (and their helpers) to use logical width
     7        and logical height instead.
     8
     9        Added fast/blockflow/block-level-images.html
     10
     11        * fast/blockflow/block-level-images.html: Added.
     12        * fast/blockflow/resources: Added.
     13        * fast/blockflow/resources/circle.svg: Added.
     14        * fast/blockflow/resources/oval.png: Added.
     15        * platform/mac/fast/blockflow/block-level-images-expected.checksum: Added.
     16        * platform/mac/fast/blockflow/block-level-images-expected.png: Added.
     17        * platform/mac/fast/blockflow/block-level-images-expected.txt: Added.
     18
    1192010-09-30  Adam Barth  <abarth@webkit.org>
    220
  • trunk/WebCore/ChangeLog

    r68916 r68917  
     12010-10-01  David Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=46642, make replaced elements work with block-flow.  This patch changes
     6        all of the computeReplacedLogicalWidth and comuteReplacedLogicalHeight functions (and their helpers) to use logical width
     7        and logical height instead.
     8
     9        Added fast/blockflow/block-level-images.html
     10
     11        * rendering/RenderBox.cpp:
     12        (WebCore::RenderBox::computeLogicalWidth):
     13        (WebCore::RenderBox::computeLogicalHeight):
     14        (WebCore::RenderBox::computeReplacedLogicalWidth):
     15        (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
     16        (WebCore::RenderBox::computeReplacedLogicalHeight):
     17        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
     18        (WebCore::RenderBox::computePositionedLogicalWidthReplaced):
     19        (WebCore::RenderBox::computePositionedLogicalHeightReplaced):
     20        * rendering/RenderBox.h:
     21        (WebCore::RenderBox::intrinsicLogicalWidth):
     22        (WebCore::RenderBox::intrinsicLogicalHeight):
     23        * rendering/RenderImage.cpp:
     24        (WebCore::RenderImage::isLogicalWidthSpecified):
     25        (WebCore::RenderImage::isLogicalHeightSpecified):
     26        (WebCore::RenderImage::computeReplacedLogicalWidth):
     27        (WebCore::RenderImage::computeReplacedLogicalHeight):
     28        (WebCore::RenderImage::calcAspectRatioLogicalWidth):
     29        (WebCore::RenderImage::calcAspectRatioLogicalHeight):
     30        * rendering/RenderImage.h:
     31        * rendering/RenderReplaced.cpp:
     32        (WebCore::RenderReplaced::layout):
     33        (WebCore::RenderReplaced::computeReplacedLogicalWidth):
     34        (WebCore::RenderReplaced::computeReplacedLogicalHeight):
     35        (WebCore::RenderReplaced::calcAspectRatioLogicalWidth):
     36        (WebCore::RenderReplaced::calcAspectRatioLogicalHeight):
     37        (WebCore::RenderReplaced::computePreferredLogicalWidths):
     38        * rendering/RenderReplaced.h:
     39        * rendering/RenderSVGRoot.cpp:
     40        (WebCore::RenderSVGRoot::computePreferredLogicalWidths):
     41        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
     42        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
     43        * rendering/RenderSVGRoot.h:
     44        * rendering/RenderVideo.cpp:
     45        (WebCore::RenderVideo::computeReplacedLogicalWidth):
     46        (WebCore::RenderVideo::computeReplacedLogicalHeight):
     47        * rendering/RenderVideo.h:
     48
    1492010-10-01  Nate Chapin  <japhet@chromium.org>
    250
  • trunk/WebCore/rendering/RenderBox.cpp

    r68897 r68917  
    14401440    bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !stretching);
    14411441
    1442     Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedWidth(), Fixed) : style()->logicalWidth();
     1442    Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedLogicalWidth(), Fixed) : style()->logicalWidth();
    14431443
    14441444    RenderBlock* cb = containingBlock();
     
    16461646            h = Length(overrideSize() - borderAndPaddingLogicalHeight(), Fixed);
    16471647        else if (treatAsReplaced)
    1648             h = Length(computeReplacedHeight(), Fixed);
     1648            h = Length(computeReplacedLogicalHeight(), Fixed);
    16491649        else {
    16501650            h = style()->logicalHeight();
     
    18111811}
    18121812
    1813 int RenderBox::computeReplacedWidth(bool includeMaxWidth) const
    1814 {
    1815     int width = computeReplacedWidthUsing(style()->width());
    1816     int minW = computeReplacedWidthUsing(style()->minWidth());
    1817     int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth());
    1818 
    1819     return max(minW, min(width, maxW));
    1820 }
    1821 
    1822 int RenderBox::computeReplacedWidthUsing(Length width) const
    1823 {
    1824     switch (width.type()) {
     1813int RenderBox::computeReplacedLogicalWidth(bool includeMaxWidth) const
     1814{
     1815    int logicalWidth = computeReplacedLogicalWidthUsing(style()->logicalWidth());
     1816    int minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth());
     1817    int maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());
     1818
     1819    return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth));
     1820}
     1821
     1822int RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const
     1823{
     1824    switch (logicalWidth.type()) {
    18251825        case Fixed:
    1826             return computeContentBoxLogicalWidth(width.value());
     1826            return computeContentBoxLogicalWidth(logicalWidth.value());
    18271827        case Percent: {
    18281828            // FIXME: containingBlockLogicalWidthForContent() is wrong if the replaced element's block-flow is perpendicular to the
     
    18311831            const int cw = isPositioned() ? containingBlockWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();
    18321832            if (cw > 0)
    1833                 return computeContentBoxLogicalWidth(width.calcMinValue(cw));
     1833                return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw));
    18341834        }
    18351835        // fall through
    18361836        default:
    1837             return intrinsicSize().width();
     1837            return intrinsicLogicalWidth();
    18381838     }
    18391839}
    18401840
    1841 int RenderBox::computeReplacedHeight() const
    1842 {
    1843     int height = computeReplacedHeightUsing(style()->height());
    1844     int minH = computeReplacedHeightUsing(style()->minHeight());
    1845     int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight());
    1846 
    1847     return max(minH, min(height, maxH));
    1848 }
    1849 
    1850 int RenderBox::computeReplacedHeightUsing(Length height) const
    1851 {
    1852     switch (height.type()) {
     1841int RenderBox::computeReplacedLogicalHeight() const
     1842{
     1843    int logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
     1844    int minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());
     1845    int maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());
     1846
     1847    return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight));
     1848}
     1849
     1850int RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const
     1851{
     1852    switch (logicalHeight.type()) {
    18531853        case Fixed:
    1854             return computeContentBoxLogicalHeight(height.value());
     1854            return computeContentBoxLogicalHeight(logicalHeight.value());
    18551855        case Percent:
    18561856        {
     
    18611861            }
    18621862
     1863            // FIXME: This calculation is not patched for block-flow yet.
     1864            // https://bugs.webkit.org/show_bug.cgi?id=46500
    18631865            if (cb->isPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) {
    18641866                ASSERT(cb->isRenderBlock());
     
    18681870                int newHeight = block->computeContentBoxLogicalHeight(block->contentHeight());
    18691871                block->setHeight(oldHeight);
    1870                 return computeContentBoxLogicalHeight(height.calcValue(newHeight));
     1872                return computeContentBoxLogicalHeight(logicalHeight.calcValue(newHeight));
    18711873            }
    18721874           
     1875            // FIXME: availableLogicalHeight() is wrong if the replaced element's block-flow is perpendicular to the
     1876            // containing block's block-flow.
     1877            // https://bugs.webkit.org/show_bug.cgi?id=46496
    18731878            int availableHeight = isPositioned() ? containingBlockHeightForPositioned(toRenderBoxModelObject(cb)) : toRenderBox(cb)->availableLogicalHeight();
    18741879
     
    18761881            // box model.  This is essential for sizing inside
    18771882            // table cells using percentage heights.
    1878             if (cb->isTableCell() && (cb->style()->height().isAuto() || cb->style()->height().isPercent())) {
     1883            // FIXME: This needs to be made block-flow-aware.  If the cell and image are perpendicular block-flows, this isn't right.
     1884            // https://bugs.webkit.org/show_bug.cgi?id=46997
     1885            if (cb->isTableCell() && (cb->style()->logicalHeight().isAuto() || cb->style()->logicalHeight().isPercent())) {
    18791886                // Don't let table cells squeeze percent-height replaced elements
    18801887                // <http://bugs.webkit.org/show_bug.cgi?id=15359>
    1881                 availableHeight = max(availableHeight, intrinsicSize().height());
    1882                 return height.calcValue(availableHeight - borderAndPaddingHeight());
     1888                availableHeight = max(availableHeight, intrinsicLogicalHeight());
     1889                return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());
    18831890            }
    18841891
    1885             return computeContentBoxLogicalHeight(height.calcValue(availableHeight));
     1892            return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight));
    18861893        }
    18871894        default:
    1888             return intrinsicSize().height();
     1895            return intrinsicLogicalHeight();
    18891896    }
    18901897}
     
    25792586    // are dealt with in computeReplacedWidth().  This means that the steps to produce
    25802587    // correct max/min in the non-replaced version, are not necessary.
    2581     setWidth(computeReplacedWidth() + borderAndPaddingWidth());
     2588    setWidth(computeReplacedLogicalWidth() + borderAndPaddingWidth());
    25822589    const int availableSpace = containerWidth - width();
    25832590
     
    27522759    // are dealt with in computeReplacedHeight().  This means that the steps to produce
    27532760    // correct max/min in the non-replaced version, are not necessary.
    2754     setHeight(computeReplacedHeight() + borderAndPaddingHeight());
     2761    setHeight(computeReplacedLogicalHeight() + borderAndPaddingHeight());
    27552762    const int availableSpace = containerHeight - height();
    27562763
  • trunk/WebCore/rendering/RenderBox.h

    r68842 r68917  
    277277
    278278    virtual IntSize intrinsicSize() const { return IntSize(); }
     279    int intrinsicLogicalWidth() const { return style()->isVerticalBlockFlow() ? intrinsicSize().width() : intrinsicSize().height(); }
     280    int intrinsicLogicalHeight() const { return style()->isVerticalBlockFlow() ? intrinsicSize().height() : intrinsicSize().width(); }
    279281
    280282    // Whether or not the element shrinks to its intrinsic width (rather than filling the width
     
    285287    int computeLogicalWidthUsing(LogicalWidthType, int availableLogicalWidth);
    286288    int computeLogicalHeightUsing(const Length& height);
    287     int computeReplacedWidthUsing(Length width) const;
    288     int computeReplacedHeightUsing(Length height) const;
    289 
    290     virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
    291     virtual int computeReplacedHeight() const;
     289    int computeReplacedLogicalWidthUsing(Length width) const;
     290    int computeReplacedLogicalHeightUsing(Length height) const;
     291
     292    virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     293    virtual int computeReplacedLogicalHeight() const;
    292294
    293295    int computePercentageLogicalHeight(const Length& height);
  • trunk/WebCore/rendering/RenderImage.cpp

    r68475 r68917  
    396396}
    397397
    398 bool RenderImage::isWidthSpecified() const
    399 {
    400     switch (style()->width().type()) {
     398bool RenderImage::isLogicalWidthSpecified() const
     399{
     400    switch (style()->logicalWidth().type()) {
    401401        case Fixed:
    402402        case Percent:
     
    413413}
    414414
    415 bool RenderImage::isHeightSpecified() const
    416 {
    417     switch (style()->height().type()) {
     415bool RenderImage::isLogicalHeightSpecified() const
     416{
     417    switch (style()->logicalHeight().type()) {
    418418        case Fixed:
    419419        case Percent:
     
    430430}
    431431
    432 int RenderImage::computeReplacedWidth(bool includeMaxWidth) const
     432int RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const
    433433{
    434434    if (m_imageResource->imageHasRelativeWidth())
     
    438438        }
    439439
    440     int width;
    441     if (isWidthSpecified())
    442         width = computeReplacedWidthUsing(style()->width());
    443     else if (m_imageResource->usesImageContainerSize())
    444         width = m_imageResource->imageSize(style()->effectiveZoom()).width();
    445     else if (m_imageResource->imageHasRelativeWidth())
    446         width = 0; // If the image is relatively-sized, set the width to 0 until there is a set container size.
     440    int logicalWidth;
     441    if (isLogicalWidthSpecified())
     442        logicalWidth = computeReplacedLogicalWidthUsing(style()->logicalWidth());
     443    else if (m_imageResource->usesImageContainerSize()) {
     444        IntSize size = m_imageResource->imageSize(style()->effectiveZoom());
     445        logicalWidth = style()->isVerticalBlockFlow() ? size.width() : size.height();
     446    } else if (m_imageResource->imageHasRelativeWidth())
     447        logicalWidth = 0; // If the image is relatively-sized, set the width to 0 until there is a set container size.
    447448    else
    448         width = calcAspectRatioWidth();
    449 
    450     int minW = computeReplacedWidthUsing(style()->minWidth());
    451     int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth());
    452 
    453     return max(minW, min(width, maxW));
    454 }
    455 
    456 int RenderImage::computeReplacedHeight() const
    457 {
    458     int height;
    459     if (isHeightSpecified())
    460         height = computeReplacedHeightUsing(style()->height());
    461     else if (m_imageResource->usesImageContainerSize())
    462         height = m_imageResource->imageSize(style()->effectiveZoom()).height();
    463     else if (m_imageResource->imageHasRelativeHeight())
    464         height = 0; // If the image is relatively-sized, set the height to 0 until there is a set container size.
     449        logicalWidth = calcAspectRatioLogicalWidth();
     450
     451    int minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth());
     452    int maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());
     453
     454    return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth));
     455}
     456
     457int RenderImage::computeReplacedLogicalHeight() const
     458{
     459    int logicalHeight;
     460    if (isLogicalHeightSpecified())
     461        logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
     462    else if (m_imageResource->usesImageContainerSize()) {
     463        IntSize size = m_imageResource->imageSize(style()->effectiveZoom());
     464        logicalHeight = style()->isVerticalBlockFlow() ? size.height() : size.width();
     465    } else if (m_imageResource->imageHasRelativeHeight())
     466        logicalHeight = 0; // If the image is relatively-sized, set the height to 0 until there is a set container size.
    465467    else
    466         height = calcAspectRatioHeight();
    467 
    468     int minH = computeReplacedHeightUsing(style()->minHeight());
    469     int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight());
    470 
    471     return max(minH, min(height, maxH));
    472 }
    473 
    474 int RenderImage::calcAspectRatioWidth() const
    475 {
    476     IntSize size = intrinsicSize();
    477     if (!size.height())
     468        logicalHeight = calcAspectRatioLogicalHeight();
     469
     470    int minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());
     471    int maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());
     472
     473    return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight));
     474}
     475
     476int RenderImage::calcAspectRatioLogicalWidth() const
     477{
     478    int intrinsicWidth = intrinsicLogicalWidth();
     479    int intrinsicHeight = intrinsicLogicalHeight();
     480    if (!intrinsicHeight)
    478481        return 0;
    479482    if (!m_imageResource->hasImage() || m_imageResource->errorOccurred())
    480         return size.width(); // Don't bother scaling.
    481     return RenderBox::computeReplacedHeight() * size.width() / size.height();
    482 }
    483 
    484 int RenderImage::calcAspectRatioHeight() const
    485 {
    486     IntSize size = intrinsicSize();
    487     if (!size.width())
     483        return intrinsicWidth; // Don't bother scaling.
     484    return RenderBox::computeReplacedLogicalHeight() * intrinsicWidth / intrinsicHeight;
     485}
     486
     487int RenderImage::calcAspectRatioLogicalHeight() const
     488{
     489    int intrinsicWidth = intrinsicLogicalWidth();
     490    int intrinsicHeight = intrinsicLogicalHeight();
     491    if (!intrinsicWidth)
    488492        return 0;
    489493    if (!m_imageResource->hasImage() || m_imageResource->errorOccurred())
    490         return size.height(); // Don't bother scaling.
    491     return RenderBox::computeReplacedWidth() * size.height() / size.width();
     494        return intrinsicHeight; // Don't bother scaling.
     495    return RenderBox::computeReplacedLogicalWidth() * intrinsicHeight / intrinsicWidth;
    492496}
    493497
  • trunk/WebCore/rendering/RenderImage.h

    r68239 r68917  
    5959    virtual void paint(PaintInfo&, int tx, int ty);
    6060
    61     bool isWidthSpecified() const;
    62     bool isHeightSpecified() const;
     61    bool isLogicalWidthSpecified() const;
     62    bool isLogicalHeightSpecified() const;
    6363
    6464    virtual void intrinsicSizeChanged()
     
    8181    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
    8282
    83     virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
    84     virtual int computeReplacedHeight() const;
     83    virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     84    virtual int computeReplacedLogicalHeight() const;
    8585
    86     int calcAspectRatioWidth() const;
    87     int calcAspectRatioHeight() const;
     86    int calcAspectRatioLogicalWidth() const;
     87    int calcAspectRatioLogicalHeight() const;
    8888
    8989private:
  • trunk/WebCore/rendering/RenderReplaced.cpp

    r68276 r68917  
    5858}
    5959
    60 void RenderReplaced::setStyle(PassRefPtr<RenderStyle> newStyle)
    61 {
    62     if (newStyle->blockFlow() != TopToBottomBlockFlow)
    63         newStyle->setBlockFlow(TopToBottomBlockFlow);
    64     RenderBox::setStyle(newStyle);
    65 }
    66 
    6760void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
    6861{
     
    8982    addShadowOverflow();
    9083   
    91     repainter.repaintAfterLayout();   
    92 
     84    repainter.repaintAfterLayout();
    9385    setNeedsLayout(false);
    9486}
     
    208200}
    209201
    210 int RenderReplaced::computeReplacedWidth(bool includeMaxWidth) const
    211 {
    212     int width;
     202int RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) const
     203{
     204    int logicalWidth;
    213205    if (lengthIsSpecified(style()->width()))
    214         width = computeReplacedWidthUsing(style()->width());
     206        logicalWidth = computeReplacedLogicalWidthUsing(style()->logicalWidth());
    215207    else if (m_hasIntrinsicSize)
    216         width = calcAspectRatioWidth();
     208        logicalWidth = calcAspectRatioLogicalWidth();
    217209    else
    218         width = intrinsicSize().width();
    219 
    220     int minW = computeReplacedWidthUsing(style()->minWidth());
    221     int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth());
    222 
    223     return max(minW, min(width, maxW));
    224 }
    225 
    226 int RenderReplaced::computeReplacedHeight() const
    227 {
    228     int height;
    229     if (lengthIsSpecified(style()->height()))
    230         height = computeReplacedHeightUsing(style()->height());
     210        logicalWidth = intrinsicLogicalWidth();
     211
     212    int minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth());
     213    int maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());
     214
     215    return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth));
     216}
     217
     218int RenderReplaced::computeReplacedLogicalHeight() const
     219{
     220    int logicalHeight;
     221    if (lengthIsSpecified(style()->logicalHeight()))
     222        logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
    231223    else if (m_hasIntrinsicSize)
    232         height = calcAspectRatioHeight();
     224        logicalHeight = calcAspectRatioLogicalHeight();
    233225    else
    234         height = intrinsicSize().height();
    235 
    236     int minH = computeReplacedHeightUsing(style()->minHeight());
    237     int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight());
    238 
    239     return max(minH, min(height, maxH));
    240 }
    241 
    242 int RenderReplaced::calcAspectRatioWidth() const
    243 {
    244     int intrinsicWidth = intrinsicSize().width();
    245     int intrinsicHeight = intrinsicSize().height();
     226        logicalHeight = intrinsicLogicalHeight();
     227
     228    int minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());
     229    int maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());
     230
     231    return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight));
     232}
     233
     234int RenderReplaced::calcAspectRatioLogicalWidth() const
     235{
     236    int intrinsicWidth = intrinsicLogicalWidth();
     237    int intrinsicHeight = intrinsicLogicalHeight();
    246238    if (!intrinsicHeight)
    247239        return 0;
    248     return RenderBox::computeReplacedHeight() * intrinsicWidth / intrinsicHeight;
    249 }
    250 
    251 int RenderReplaced::calcAspectRatioHeight() const
    252 {
    253     int intrinsicWidth = intrinsicSize().width();
    254     int intrinsicHeight = intrinsicSize().height();
     240    return RenderBox::computeReplacedLogicalHeight() * intrinsicWidth / intrinsicHeight;
     241}
     242
     243int RenderReplaced::calcAspectRatioLogicalHeight() const
     244{
     245    int intrinsicWidth = intrinsicLogicalWidth();
     246    int intrinsicHeight = intrinsicLogicalHeight();
    255247    if (!intrinsicWidth)
    256248        return 0;
    257     return RenderBox::computeReplacedWidth() * intrinsicHeight / intrinsicWidth;
     249    return RenderBox::computeReplacedLogicalWidth() * intrinsicHeight / intrinsicWidth;
    258250}
    259251
     
    263255
    264256    int borderAndPadding = borderAndPaddingWidth();
    265     m_maxPreferredLogicalWidth = computeReplacedWidth(false) + borderAndPadding;
     257    m_maxPreferredLogicalWidth = computeReplacedLogicalWidth(false) + borderAndPadding;
    266258
    267259    if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength)
  • trunk/WebCore/rendering/RenderReplaced.h

    r68276 r68917  
    3333    virtual ~RenderReplaced();
    3434
    35     virtual void setStyle(PassRefPtr<RenderStyle>);
    36 
    3735protected:
    3836    virtual void layout();
     
    4038    virtual IntSize intrinsicSize() const;
    4139
    42     virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
    43     virtual int computeReplacedHeight() const;
     40    virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     41    virtual int computeReplacedLogicalHeight() const;
    4442    virtual int minimumReplacedHeight() const { return 0; }
    4543
     
    6866    virtual void computePreferredLogicalWidths();
    6967
    70     int calcAspectRatioWidth() const;
    71     int calcAspectRatioHeight() const;
     68    int calcAspectRatioLogicalWidth() const;
     69    int calcAspectRatioLogicalHeight() const;
    7270
    7371    virtual void paintReplaced(PaintInfo&, int /*tx*/, int /*ty*/) { }
  • trunk/WebCore/rendering/RenderSVGRoot.cpp

    r68444 r68917  
    6969
    7070    int borderAndPadding = borderAndPaddingWidth();
    71     int width = computeReplacedWidth(false) + borderAndPadding;
     71    int width = computeReplacedLogicalWidth(false) + borderAndPadding;
    7272
    7373    if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength)
     
    8383}
    8484
    85 int RenderSVGRoot::computeReplacedWidth(bool includeMaxWidth) const
    86 {
    87     int replacedWidth = RenderBox::computeReplacedWidth(includeMaxWidth);
    88     if (!style()->width().isPercent())
     85int RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const
     86{
     87    int replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth);
     88    if (!style()->logicalWidth().isPercent())
    8989        return replacedWidth;
    9090
     
    9494}
    9595
    96 int RenderSVGRoot::computeReplacedHeight() const
    97 {
    98     int replacedHeight = RenderBox::computeReplacedHeight();
    99     if (!style()->height().isPercent())
     96int RenderSVGRoot::computeReplacedLogicalHeight() const
     97{
     98    int replacedHeight = RenderBox::computeReplacedLogicalHeight();
     99    if (!style()->logicalHeight().isPercent())
    100100        return replacedHeight;
    101101
  • trunk/WebCore/rendering/RenderSVGRoot.h

    r68276 r68917  
    5555    virtual int baselinePosition(bool b, bool isRootLineBox = false) const;
    5656    virtual void computePreferredLogicalWidths();
    57     virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
    58     virtual int computeReplacedHeight() const;
     57    virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     58    virtual int computeReplacedLogicalHeight() const;
    5959    virtual void layout();
    6060    virtual void paint(PaintInfo&, int parentX, int parentY);
  • trunk/WebCore/rendering/RenderVideo.cpp

    r68276 r68917  
    247247}
    248248
    249 int RenderVideo::computeReplacedWidth(bool includeMaxWidth) const
    250 {
    251     return RenderReplaced::computeReplacedWidth(includeMaxWidth);
    252 }
    253 
    254 int RenderVideo::computeReplacedHeight() const
    255 {
    256     return RenderReplaced::computeReplacedHeight();
     249int RenderVideo::computeReplacedLogicalWidth(bool includeMaxWidth) const
     250{
     251    return RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth);
     252}
     253
     254int RenderVideo::computeReplacedLogicalHeight() const
     255{
     256    return RenderReplaced::computeReplacedLogicalHeight();
    257257}
    258258
  • trunk/WebCore/rendering/RenderVideo.h

    r68239 r68917  
    7171    virtual void layout();
    7272
    73     virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
    74     virtual int computeReplacedHeight() const;
     73    virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     74    virtual int computeReplacedLogicalHeight() const;
    7575    virtual int minimumReplacedHeight() const;
    7676
Note: See TracChangeset for help on using the changeset viewer.