Changeset 167597 in webkit


Ignore:
Timestamp:
Apr 21, 2014 11:07:15 AM (10 years ago)
Author:
hyatt@apple.com
Message:

[New Multicolumn] Pagination mode messed up with non-inline axis and reversed direction.
https://bugs.webkit.org/show_bug.cgi?id=131811

Reviewed by Dean Jackson.

Source/WebCore:
Added fast/multicol/newmulticol/compare-with-old-impl/BottomToTop-tb.html

With block axis pagination mode, it is possible to set a column height that is not the same
as the available fill height for a block. The new multi-column code had the assumption that
the column height was the same as the amount of fill room you had available. This is not
the case.

To correct the issue, I added a member variable to RenderMultiColumnSet that stores the
available column height as a separate variable from the computed column height. This allows
the pagination API to specify a different column height that is not the same as the view's
content height.

Even though it isn't involved in the solution, I also patched pageOrViewLogicalHeight on
RenderView to work with the new column code as well.

To address the layout test failures (that caused the previous rollout), I made sure to
initialize m_availableHeight to 0 when m_computedColumnHeight also gets reset to 0.

The assertion is not something I could reproduce on any machine, but I can see the problem.
I patched Page's pageCount method to not have column code directly in Page.cpp,
and to make a new pageCount() method on RenderView that Page calls
into. This method is now patched to handle the new column code as well as the old. I have
no real way of testing this method though, since I can't reproduce the assertion that the
bots were experiencing.

  • page/Page.cpp:

(WebCore::Page::pageCount):

  • rendering/RenderMultiColumnSet.cpp:

(WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
(WebCore::RenderMultiColumnSet::setAndConstrainColumnHeight):
(WebCore::RenderMultiColumnSet::prepareForLayout):
(WebCore::RenderMultiColumnSet::computeLogicalHeight):

  • rendering/RenderMultiColumnSet.h:
  • rendering/RenderView.cpp:

(WebCore::RenderView::pageOrViewLogicalHeight):
(WebCore::RenderView::pageCount):

  • rendering/RenderView.h:

LayoutTests:

  • fast/multicol/newmulticol/compare-with-old-impl/BottomToTop-tb-expected.html: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/BottomToTop-tb.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167593 r167597  
     12014-04-21  David Hyatt  <hyatt@apple.com>
     2
     3        [New Multicolumn] Pagination mode messed up with non-inline axis and reversed direction.
     4        https://bugs.webkit.org/show_bug.cgi?id=131811
     5
     6        Reviewed by Dean Jackson.
     7
     8        * fast/multicol/newmulticol/compare-with-old-impl/BottomToTop-tb-expected.html: Added.
     9        * fast/multicol/newmulticol/compare-with-old-impl/BottomToTop-tb.html: Added.
     10
    1112014-04-21  Alexey Proskuryakov  <ap@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r167596 r167597  
     12014-04-21  David Hyatt  <hyatt@apple.com>
     2
     3        [New Multicolumn] Pagination mode messed up with non-inline axis and reversed direction.
     4        https://bugs.webkit.org/show_bug.cgi?id=131811
     5
     6        Reviewed by Dean Jackson.
     7
     8        Added fast/multicol/newmulticol/compare-with-old-impl/BottomToTop-tb.html
     9       
     10        With block axis pagination mode, it is possible to set a column height that is not the same
     11        as the available fill height for a block. The new multi-column code had the assumption that
     12        the column height was the same as the amount of fill room you had available. This is not
     13        the case.
     14       
     15        To correct the issue, I added a member variable to RenderMultiColumnSet that stores the
     16        available column height as a separate variable from the computed column height. This allows
     17        the pagination API to specify a different column height that is not the same as the view's
     18        content height.
     19
     20        Even though it isn't involved in the solution, I also patched pageOrViewLogicalHeight on
     21        RenderView to work with the new column code as well.
     22
     23        To address the layout test failures (that caused the previous rollout), I made sure to
     24        initialize m_availableHeight to 0 when m_computedColumnHeight also gets reset to 0.
     25       
     26        The assertion is not something I could reproduce on any machine, but I can see the problem.
     27        I patched Page's pageCount method to not have column code directly in Page.cpp,
     28        and to make a new pageCount() method on RenderView that Page calls
     29        into. This method is now patched to handle the new column code as well as the old. I have
     30        no real way of testing this method though, since I can't reproduce the assertion that the
     31        bots were experiencing.
     32
     33        * page/Page.cpp:
     34        (WebCore::Page::pageCount):
     35        * rendering/RenderMultiColumnSet.cpp:
     36        (WebCore::RenderMultiColumnSet::RenderMultiColumnSet):
     37        (WebCore::RenderMultiColumnSet::setAndConstrainColumnHeight):
     38        (WebCore::RenderMultiColumnSet::prepareForLayout):
     39        (WebCore::RenderMultiColumnSet::computeLogicalHeight):
     40        * rendering/RenderMultiColumnSet.h:
     41        * rendering/RenderView.cpp:
     42        (WebCore::RenderView::pageOrViewLogicalHeight):
     43        (WebCore::RenderView::pageCount):
     44        * rendering/RenderView.h:
     45
    1462014-04-18  Dean Jackson  <dino@apple.com>
    247
  • trunk/Source/WebCore/page/Page.cpp

    r167523 r167597  
    859859
    860860    RenderView* contentRenderer = mainFrame().contentRenderer();
    861     return contentRenderer ? contentRenderer->columnCount(contentRenderer->columnInfo()) : 0;
     861    return contentRenderer ? contentRenderer->pageCount() : 0;
    862862}
    863863
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp

    r167483 r167597  
    2727#include "RenderMultiColumnSet.h"
    2828
     29#include "FrameView.h"
    2930#include "PaintInfo.h"
    3031#include "RenderLayer.h"
    3132#include "RenderMultiColumnFlowThread.h"
    3233#include "RenderMultiColumnSpannerPlaceholder.h"
     34#include "RenderView.h"
    3335
    3436namespace WebCore {
     
    3941    , m_computedColumnWidth(0)
    4042    , m_computedColumnHeight(0)
     43    , m_availableColumnHeight(0)
    4144    , m_maxColumnHeight(RenderFlowThread::maxLogicalHeight())
    4245    , m_minSpaceShortage(RenderFlowThread::maxLogicalHeight())
     
    152155    if (m_computedColumnHeight > m_maxColumnHeight)
    153156        m_computedColumnHeight = m_maxColumnHeight;
     157   
     158    // FIXME: The available column height is not the same as the constrained height specified
     159    // by the pagination API. The column set in this case is allowed to be bigger than the
     160    // height of a single column. We cache available column height in order to use it
     161    // in computeLogicalHeight later. This is pretty gross, and maybe there's a better way
     162    // to formalize the idea of clamped column heights without having a view dependency
     163    // here.
     164    m_availableColumnHeight = m_computedColumnHeight;
     165    if (multiColumnFlowThread() && !multiColumnFlowThread()->progressionIsInline() && parent()->isRenderView()) {
     166        int pageLength = view().frameView().pagination().pageLength;
     167        if (pageLength)
     168            m_computedColumnHeight = pageLength;
     169    }
    154170    // FIXME: the height may also be affected by the enclosing pagination context, if any.
    155171}
     
    328344        m_maxColumnHeight = calculateMaxColumnHeight();
    329345    if (requiresBalancing()) {
    330         if (initial)
     346        if (initial) {
    331347            m_computedColumnHeight = 0;
     348            m_availableColumnHeight = 0;
     349        }
    332350    } else
    333351        setAndConstrainColumnHeight(heightAdjustedForSetOffset(multiColumnFlowThread()->columnHeightAvailable()));
     
    397415void RenderMultiColumnSet::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
    398416{
    399     computedValues.m_extent = m_computedColumnHeight;
     417    computedValues.m_extent = m_availableColumnHeight;
    400418    computedValues.m_position = logicalTop;
    401419}
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.h

    r167483 r167597  
    179179    LayoutUnit m_computedColumnWidth; // Used column width (the resulting 'W' from the pseudo-algorithm in the multicol spec)
    180180    LayoutUnit m_computedColumnHeight;
     181    LayoutUnit m_availableColumnHeight;
    181182   
    182183    // The following variables are used when balancing the column set.
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r167538 r167597  
    296296        return pageLogicalHeight();
    297297   
    298     if (hasColumns() && !style().hasInlineColumnAxis()) {
     298    if ((hasColumns() || multiColumnFlowThread()) && !style().hasInlineColumnAxis()) {
    299299        if (int pageLength = frameView().pagination().pageLength)
    300300            return pageLength;
     
    12581258}
    12591259
     1260unsigned RenderView::pageCount() const
     1261{
     1262    const Pagination& pagination = frameView().frame().page()->pagination();
     1263    if (pagination.mode == Pagination::Unpaginated)
     1264        return 0;
     1265   
     1266    if (hasColumns())
     1267        return columnCount(columnInfo());
     1268    if (multiColumnFlowThread())
     1269        return multiColumnFlowThread()->columnCount();
     1270
     1271    return 0;
     1272}
     1273
    12601274} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderView.h

    r167444 r167597  
    161161    unsigned pageNumberForBlockProgressionOffset(int offset) const;
    162162
     163    unsigned pageCount() const;
     164
    163165    // FIXME: These functions are deprecated. No code should be added that uses these.
    164166    int bestTruncatedAt() const { return m_legacyPrinting.m_bestTruncatedAt; }
Note: See TracChangeset for help on using the changeset viewer.