Changeset 143506 in webkit


Ignore:
Timestamp:
Feb 20, 2013 2:16:55 PM (11 years ago)
Author:
hyatt@apple.com
Message:

[New Multicolumn] Resize RenderMultiColumnSets around their columns.
https://bugs.webkit.org/show_bug.cgi?id=110378.

Reviewed by Dirk Schulze.

Source/WebCore:

Test: fast/multicol/newmulticol/positioned-with-constrained-height.html.

  • rendering/RenderBlock.h:

(RenderBlock):
Make computeOverflow public so that RenderMultiColumnFlowThread can
access it.

  • rendering/RenderMultiColumnFlowThread.cpp:

(WebCore::RenderMultiColumnFlowThread::layout):
Subclass layout to recompute the overflow for RenderMultiColumnBlock
after the flow thread has finished layout. This way it can account
for changes in RenderMultiColumnSets without having to do a second
layout pass.

  • rendering/RenderMultiColumnFlowThread.h:

(RenderMultiColumnFlowThread):
Override layout().

  • rendering/RenderMultiColumnSet.cpp:

(WebCore::RenderMultiColumnSet::columnCount):
Clean up a comment that referred to portions as region rects still.

(WebCore::RenderMultiColumnSet::setFlowThreadPortionRect):

  • rendering/RenderMultiColumnSet.h:
  • rendering/RenderRegion.h:

(WebCore::RenderRegion::setFlowThreadPortionRect):
Make setFlowThreadPortionRect virtual and actually mutate the size
and position of RenderMultiColumnSets so that they enclose their
column rects.

LayoutTests:

  • fast/multicol/newmulticol/positioned-with-constrained-height-expected.html: Added.
  • fast/multicol/newmulticol/positioned-with-constrained-height.html: Added.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r143505 r143506  
     12013-02-20  David Hyatt  <hyatt@apple.com>
     2
     3        [New Multicolumn] Resize RenderMultiColumnSets around their columns.
     4        https://bugs.webkit.org/show_bug.cgi?id=110378.
     5
     6        Reviewed by Dirk Schulze.
     7
     8        * fast/multicol/newmulticol/positioned-with-constrained-height-expected.html: Added.
     9        * fast/multicol/newmulticol/positioned-with-constrained-height.html: Added.
     10
    1112013-02-20  Dirk Schulze  <krit@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r143505 r143506  
     12013-02-20  David Hyatt  <hyatt@apple.com>
     2
     3        [New Multicolumn] Resize RenderMultiColumnSets around their columns.
     4        https://bugs.webkit.org/show_bug.cgi?id=110378.
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Test: fast/multicol/newmulticol/positioned-with-constrained-height.html.
     9
     10        * rendering/RenderBlock.h:
     11        (RenderBlock):
     12        Make computeOverflow public so that RenderMultiColumnFlowThread can
     13        access it.
     14
     15        * rendering/RenderMultiColumnFlowThread.cpp:
     16        (WebCore::RenderMultiColumnFlowThread::layout):
     17        Subclass layout to recompute the overflow for RenderMultiColumnBlock
     18        after the flow thread has finished layout. This way it can account
     19        for changes in RenderMultiColumnSets without having to do a second
     20        layout pass.
     21
     22        * rendering/RenderMultiColumnFlowThread.h:
     23        (RenderMultiColumnFlowThread):
     24        Override layout().
     25
     26        * rendering/RenderMultiColumnSet.cpp:
     27        (WebCore::RenderMultiColumnSet::columnCount):
     28        Clean up a comment that referred to portions as region rects still.
     29
     30        (WebCore::RenderMultiColumnSet::setFlowThreadPortionRect):
     31        * rendering/RenderMultiColumnSet.h:
     32        * rendering/RenderRegion.h:
     33        (WebCore::RenderRegion::setFlowThreadPortionRect):
     34        Make setFlowThreadPortionRect virtual and actually mutate the size
     35        and position of RenderMultiColumnSets so that they enclose their
     36        column rects.
     37
    1382013-02-20  Dirk Schulze  <krit@webkit.org>
    239
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r143294 r143506  
    526526    void setDesiredColumnCountAndWidth(int, LayoutUnit);
    527527
     528public:
    528529    void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false);
     530protected:
    529531    virtual void addOverflowFromChildren();
    530532    void addOverflowFromFloats();
  • trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp

    r140244 r143506  
    2727#include "RenderMultiColumnFlowThread.h"
    2828
     29#include "RenderMultiColumnBlock.h"
     30
    2931namespace WebCore {
    3032
     
    5052}
    5153
     54void RenderMultiColumnFlowThread::layout()
     55{
     56    RenderFlowThread::layout();
     57   
     58    // Now that flow thread portions have been determined, we may have changed the dimensions of some of our multi-column sets.
     59    // We need to make the RenderMultiColumnBlock recompute its overflow because some of these sets may be spilling out of the
     60    // block.
     61    RenderMultiColumnBlock* colBlock = toRenderMultiColumnBlock(parent());
     62    if (!colBlock)
     63        return;
     64    colBlock->computeOverflow(colBlock->clientLogicalBottom());
    5265}
     66
     67}
  • trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h

    r140244 r143506  
    3939private:
    4040    virtual const char* renderName() const OVERRIDE;
     41    virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
    4142   
    42     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
     43    virtual void layout() OVERRIDE;
    4344};
    4445
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp

    r143484 r143506  
    3232#include "RenderMultiColumnFlowThread.h"
    3333
    34 using std::min;
    35 using std::max;
     34using namespace std;
    3635
    3736namespace WebCore {
     
    112111        return 0;
    113112   
    114     // Our region rect determines our column count. We have as many columns as needed to fit all the content.
     113    // Our portion rect determines our column count. We have as many columns as needed to fit all the content.
    115114    LayoutUnit logicalHeightInColumns = flowThread()->isHorizontalWritingMode() ? flowThreadPortionRect().height() : flowThreadPortionRect().width();
    116115    return ceil(static_cast<float>(logicalHeightInColumns) / computedColumnHeight());
     
    211210}
    212211
     212void RenderMultiColumnSet::setFlowThreadPortionRect(const LayoutRect& rect)
     213{
     214    RenderRegion::setFlowThreadPortionRect(rect);
     215   
     216    // Mutate the dimensions of the column set once our flow portion is set if the flow portion has more columns
     217    // than can fit inside our current dimensions.
     218    unsigned colCount = columnCount();
     219    if (!colCount)
     220        return;
     221   
     222    LayoutUnit colGap = columnGap();
     223    LayoutUnit minimumContentLogicalWidth = colCount * computedColumnWidth() + (colCount - 1) * colGap;
     224    LayoutUnit currentContentLogicalWidth = contentLogicalWidth();
     225    LayoutUnit delta = max(LayoutUnit(), minimumContentLogicalWidth - currentContentLogicalWidth);
     226    if (!delta)
     227        return;
     228
     229    // Increase our logical width by the delta.
     230    setLogicalWidth(logicalWidth() + delta);
     231   
     232    // Shift our position left by the delta if we are RTL.
     233    if (!style()->isLeftToRightDirection())
     234        setLogicalLeft(logicalLeft() - delta);
     235}
     236
    213237void RenderMultiColumnSet::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
    214238{
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.h

    r143484 r143506  
    119119    LayoutRect flowThreadPortionRectAt(unsigned index) const;
    120120    LayoutRect flowThreadPortionOverflowRect(const LayoutRect& flowThreadPortion, unsigned index, unsigned colCount, LayoutUnit colGap) const;
     121    virtual void setFlowThreadPortionRect(const LayoutRect&) OVERRIDE;
    121122   
    122123    unsigned columnIndexAtOffset(LayoutUnit) const;
  • trunk/Source/WebCore/rendering/RenderRegion.h

    r142984 r143506  
    5151    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
    5252
    53     void setFlowThreadPortionRect(const LayoutRect& rect) { m_flowThreadPortionRect = rect; }
     53    virtual void setFlowThreadPortionRect(const LayoutRect& rect) { m_flowThreadPortionRect = rect; }
    5454    LayoutRect flowThreadPortionRect() const { return m_flowThreadPortionRect; }
    5555    LayoutRect flowThreadPortionOverflowRect() const;
Note: See TracChangeset for help on using the changeset viewer.