Changeset 154714 in webkit


Ignore:
Timestamp:
Aug 27, 2013 4:17:15 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Improve multicol intrinsic width calculation
https://bugs.webkit.org/show_bug.cgi?id=116677

Patch by Morten Stenshorne <mstensho@opera.com> on 2013-08-27
Reviewed by David Hyatt.

Source/WebCore:

Test: fast/css-intrinsic-dimensions/multicol.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::computeIntrinsicLogicalWidths):
(WebCore::RenderBlock::adjustIntrinsicLogicalWidthsForColumns):

  • rendering/RenderBlock.h:

LayoutTests:

  • css3/unicode-bidi-isolate-basic.html: The expectation seems to

be that the columns should be as many as necessary and narrow as
possible, and that the multicol container's width should be that
of one column. The previous CSS didn't really ask for this,
although that's how it happened to be rendered without this fix.

  • fast/css-intrinsic-dimensions/multicol-expected.txt: Added.
  • fast/css-intrinsic-dimensions/multicol.html: Added.
  • fast/multicol/positioned-with-constrained-height-expected.html: Copied from LayoutTests/fast/multicol/positioned-with-constrained-height.html.
  • fast/multicol/positioned-with-constrained-height.html: Turn into a reftest.
  • platform/efl/fast/multicol/positioned-with-constrained-height-expected.png: Removed.
  • platform/efl/fast/multicol/positioned-with-constrained-height-expected.txt: Removed.
  • platform/gtk/fast/multicol/positioned-with-constrained-height-expected.png: Removed.
  • platform/gtk/fast/multicol/positioned-with-constrained-height-expected.txt: Removed.
  • platform/mac/fast/multicol/positioned-with-constrained-height-expected.png: Removed.
  • platform/mac/fast/multicol/positioned-with-constrained-height-expected.txt: Removed.
  • platform/qt/fast/multicol/positioned-with-constrained-height-expected.png: Removed.
  • platform/qt/fast/multicol/positioned-with-constrained-height-expected.txt: Removed.
Location:
trunk
Files:
2 added
8 deleted
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r154713 r154714  
     12013-08-27  Morten Stenshorne  <mstensho@opera.com>
     2
     3        Improve multicol intrinsic width calculation
     4        https://bugs.webkit.org/show_bug.cgi?id=116677
     5
     6        Reviewed by David Hyatt.
     7
     8        * css3/unicode-bidi-isolate-basic.html: The expectation seems to
     9        be that the columns should be as many as necessary and narrow as
     10        possible, and that the multicol container's width should be that
     11        of one column. The previous CSS didn't really ask for this,
     12        although that's how it happened to be rendered without this fix.
     13        * fast/css-intrinsic-dimensions/multicol-expected.txt: Added.
     14        * fast/css-intrinsic-dimensions/multicol.html: Added.
     15        * fast/multicol/positioned-with-constrained-height-expected.html: Copied from LayoutTests/fast/multicol/positioned-with-constrained-height.html.
     16        * fast/multicol/positioned-with-constrained-height.html: Turn into a reftest.
     17        * platform/efl/fast/multicol/positioned-with-constrained-height-expected.png: Removed.
     18        * platform/efl/fast/multicol/positioned-with-constrained-height-expected.txt: Removed.
     19        * platform/gtk/fast/multicol/positioned-with-constrained-height-expected.png: Removed.
     20        * platform/gtk/fast/multicol/positioned-with-constrained-height-expected.txt: Removed.
     21        * platform/mac/fast/multicol/positioned-with-constrained-height-expected.png: Removed.
     22        * platform/mac/fast/multicol/positioned-with-constrained-height-expected.txt: Removed.
     23        * platform/qt/fast/multicol/positioned-with-constrained-height-expected.png: Removed.
     24        * platform/qt/fast/multicol/positioned-with-constrained-height-expected.txt: Removed.
     25
    1262013-08-27  Rob Buis  <rwlbuis@webkit.org>
    227
  • trunk/LayoutTests/css3/unicode-bidi-isolate-basic.html

    r94775 r154714  
    99    left: 0px;
    1010    -moz-column-width: 13em;
    11     -webkit-column-width: 13em;
    1211    -moz-column-gap: 5em;
     12    -webkit-columns:1 1px; /* Make as many (overflowing) columns as necessary, but keep them as narrow as possible */
    1313    -webkit-column-gap: 5em;
     14    -webkit-column-fill: auto;
     15    columns:1 1px;
     16    column-gap: 5em;
     17    column-fill: auto;
    1418    height: 400px;
    1519}
  • trunk/LayoutTests/fast/multicol/positioned-with-constrained-height-expected.html

    r154713 r154714  
    1 <div style="-moz-column-width:200px; -webkit-column-width:200px;height:300px; position:absolute; background-color:lime">
     1<div style="-moz-column-width:200px; -webkit-column-width:200px; -webkit-column-fill:auto; column-width:200px; column-fill:auto; height:300px; position:absolute;">
    22This is some text<br>
    33This is some text<br>
  • trunk/LayoutTests/fast/multicol/positioned-with-constrained-height.html

    r48679 r154714  
    1 <div style="-moz-column-width:200px; -webkit-column-width:200px;height:300px; position:absolute; background-color:lime">
     1<div style="-moz-column-width:200px; -webkit-column-width:200px; -webkit-column-fill:auto; column-width:200px; column-fill:auto; width:200px; height:300px;">
    22This is some text<br>
    33This is some text<br>
  • trunk/Source/WebCore/ChangeLog

    r154713 r154714  
     12013-08-27  Morten Stenshorne  <mstensho@opera.com>
     2
     3        Improve multicol intrinsic width calculation
     4        https://bugs.webkit.org/show_bug.cgi?id=116677
     5
     6        Reviewed by David Hyatt.
     7
     8        Test: fast/css-intrinsic-dimensions/multicol.html
     9
     10        * rendering/RenderBlock.cpp:
     11        (WebCore::RenderBlock::computeIntrinsicLogicalWidths):
     12        (WebCore::RenderBlock::adjustIntrinsicLogicalWidthsForColumns):
     13        * rendering/RenderBlock.h:
     14
    1152013-08-27  Rob Buis  <rwlbuis@webkit.org>
    216
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r154641 r154714  
    60406040    maxLogicalWidth = max(minLogicalWidth, maxLogicalWidth);
    60416041
     6042    adjustIntrinsicLogicalWidthsForColumns(minLogicalWidth, maxLogicalWidth);
     6043
    60426044    if (!style()->autoWrap() && childrenInline()) {
    60436045        // A horizontal marquee with inline children has no minimum width.
     
    60946096
    60956097    setPreferredLogicalWidthsDirty(false);
     6098}
     6099
     6100void RenderBlock::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
     6101{
     6102    // FIXME: make this method virtual and move the code to RenderMultiColumnBlock once the old
     6103    // multicol code is gone.
     6104
     6105    if (!style()->hasAutoColumnCount() || !style()->hasAutoColumnWidth()) {
     6106        // The min/max intrinsic widths calculated really tell how much space elements need when
     6107        // laid out inside the columns. In order to eventually end up with the desired column width,
     6108        // we need to convert them to values pertaining to the multicol container.
     6109        int columnCount = style()->hasAutoColumnCount() ? 1 : style()->columnCount();
     6110        LayoutUnit columnWidth;
     6111        LayoutUnit gapExtra = (columnCount - 1) * columnGap();
     6112        if (style()->hasAutoColumnWidth())
     6113            minLogicalWidth = minLogicalWidth * columnCount + gapExtra;
     6114        else {
     6115            columnWidth = style()->columnWidth();
     6116            minLogicalWidth = min(minLogicalWidth, columnWidth);
     6117        }
     6118        // FIXME: If column-count is auto here, we should resolve it to calculate the maximum
     6119        // intrinsic width, instead of pretending that it's 1. The only way to do that is by
     6120        // performing a layout pass, but this is not an appropriate time or place for layout. The
     6121        // good news is that if height is unconstrained and there are no explicit breaks, the
     6122        // resolved column-count really should be 1.
     6123        maxLogicalWidth = max(maxLogicalWidth, columnWidth) * columnCount + gapExtra;
     6124    }
    60966125}
    60976126
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r154641 r154714  
    545545    virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
    546546    virtual void computePreferredLogicalWidths() OVERRIDE;
     547    void adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;
    547548
    548549    virtual int firstLineBoxBaseline() const;
Note: See TracChangeset for help on using the changeset viewer.