Changeset 148943 in webkit


Ignore:
Timestamp:
Apr 22, 2013 9:52:56 PM (11 years ago)
Author:
mihnea@adobe.com
Message:

[CSS Regions] Region's float parent doesn't size according to region size but to content node size
https://bugs.webkit.org/show_bug.cgi?id=111332

Reviewed by David Hyatt.

Source/WebCore:

Tests: fast/regions/intrinsic-sized-regions.html

fast/regions/region-with-float-parent.html

The patch ensures that the computation of region's preferred widths
takes into account the region width/min-width if these values are specified.
Also implemented the computation of intrinsic widths for a region,
based on the min/max preferred widths of the associated flow thread.

  • rendering/RenderRegion.cpp:

(WebCore::RenderRegion::computeIntrinsicLogicalWidths):
(WebCore):
(WebCore::RenderRegion::computePreferredLogicalWidths):

  • rendering/RenderRegion.h:

(RenderRegion):

LayoutTests:

Added tests for intrinsic and preferred width computation for region.

  • fast/regions/intrinsic-sized-regions-expected.txt: Added.
  • fast/regions/intrinsic-sized-regions.html: Added.
  • fast/regions/region-with-float-parent-expected.txt: Added.
  • fast/regions/region-with-float-parent.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148939 r148943  
     12013-04-22  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] Region's float parent doesn't size according to region size but to content node size
     4        https://bugs.webkit.org/show_bug.cgi?id=111332
     5
     6        Reviewed by David Hyatt.
     7
     8        Added tests for intrinsic and preferred width computation for region.
     9
     10        * fast/regions/intrinsic-sized-regions-expected.txt: Added.
     11        * fast/regions/intrinsic-sized-regions.html: Added.
     12        * fast/regions/region-with-float-parent-expected.txt: Added.
     13        * fast/regions/region-with-float-parent.html: Added.
     14
    1152013-04-22  Jessie Berlin  <jberlin@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r148933 r148943  
     12013-04-22  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] Region's float parent doesn't size according to region size but to content node size
     4        https://bugs.webkit.org/show_bug.cgi?id=111332
     5
     6        Reviewed by David Hyatt.
     7
     8        Tests: fast/regions/intrinsic-sized-regions.html
     9               fast/regions/region-with-float-parent.html
     10
     11        The patch ensures that the computation of region's preferred widths
     12        takes into account the region width/min-width if these values are specified.
     13        Also implemented the computation of intrinsic widths for a region,
     14        based on the min/max preferred widths of the associated flow thread.
     15
     16        * rendering/RenderRegion.cpp:
     17        (WebCore::RenderRegion::computeIntrinsicLogicalWidths):
     18        (WebCore):
     19        (WebCore::RenderRegion::computePreferredLogicalWidths):
     20        * rendering/RenderRegion.h:
     21        (RenderRegion):
     22
    1232013-04-22  Jessie Berlin  <jberlin@apple.com>
    224
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r148536 r148943  
    598598}
    599599
     600void RenderRegion::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
     601{
     602    if (!isValid()) {
     603        RenderBlock::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth);
     604        return;
     605    }
     606
     607    minLogicalWidth = m_flowThread->minPreferredLogicalWidth();
     608    maxLogicalWidth = m_flowThread->maxPreferredLogicalWidth();
     609}
     610
    600611void RenderRegion::computePreferredLogicalWidths()
    601612{
     
    609620    // FIXME: Currently, the code handles only the <length> case for min-width/max-width.
    610621    // It should also support other values, like percentage, calc or viewport relative.
    611     m_minPreferredLogicalWidth = m_flowThread->minPreferredLogicalWidth();
    612     m_maxPreferredLogicalWidth = m_flowThread->maxPreferredLogicalWidth();
     622    m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0;
    613623
    614624    RenderStyle* styleToUse = style();
     625    if (styleToUse->logicalWidth().isFixed() && styleToUse->logicalWidth().value() > 0)
     626        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalWidth().value());
     627    else
     628        computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth);
     629
     630    if (styleToUse->logicalMinWidth().isFixed() && styleToUse->logicalMinWidth().value() > 0) {
     631        m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value()));
     632        m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMinWidth().value()));
     633    }
     634
    615635    if (styleToUse->logicalMaxWidth().isFixed()) {
     636        m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value()));
    616637        m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value()));
    617         m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(styleToUse->logicalMaxWidth().value()));
    618638    }
    619639
  • trunk/Source/WebCore/rendering/RenderRegion.h

    r148865 r148943  
    100100    LayoutUnit maxPageLogicalHeight() const;
    101101
    102     virtual void computePreferredLogicalWidths() OVERRIDE;
    103    
    104102    LayoutUnit logicalTopOfFlowThreadContentRect(const LayoutRect&) const;
    105103    LayoutUnit logicalBottomOfFlowThreadContentRect(const LayoutRect&) const;
     
    135133    void setRegionObjectsRegionStyle();
    136134    void restoreRegionObjectsOriginalStyle();
     135
     136    virtual void computePreferredLogicalWidths() OVERRIDE;
     137    virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
    137138
    138139    LayoutRect overflowRectForFlowThreadPortion(LayoutRect flowThreadPortionRect, bool isFirstPortion, bool isLastPortion) const;
Note: See TracChangeset for help on using the changeset viewer.