Changeset 143467 in webkit


Ignore:
Timestamp:
Feb 20, 2013 8:59:53 AM (11 years ago)
Author:
hyatt@apple.com
Message:

[New Multicolumn] Make layers paint properly in columns.
https://bugs.webkit.org/show_bug.cgi?id=110296.

Reviewed by Sam Weinig.

Source/WebCore:

Construct the style for the RenderMultiColumnFlowThread such that it
establishes a stacking context (by being position:relative
with a z-index of 0). This causes the layer collection code
to correctly ignore the RenderFlowThread layers during normal
painting.

Fix more clipping bugs to eliminate subpixel layout differences
between old and new multicolumn.

Test: fast/multicol/newmulticol/layers-in-multicol.html

  • rendering/RenderMultiColumnBlock.cpp:

(WebCore::createMultiColumnFlowThreadStyle):
(WebCore):
(WebCore::RenderMultiColumnBlock::addChild):
Use a custom style (similar to what normal RenderFlowThreads do)
for the RenderMultiColumnFlowThread that makes it a stacking
context.

  • rendering/RenderMultiColumnSet.cpp:

(WebCore::RenderMultiColumnSet::flowThreadPortionOverflowRect):
Fix the overflow calculations out the leftmost and rightmost
columns to actually look at the physical placement of the columns.
The old code was backwards for RTL.

  • rendering/RenderRegion.cpp:

(WebCore::RenderRegion::overflowRectForFlowThreadPortion):
Fix the clipping done by overflowRectForFlowThreadPortion to min
and max with the passed-in portion rect so that subclasses that
inflate the rect prior to passing it into the method don't have that
inflation discarded.

LayoutTests:

  • fast/multicol/newmulticol/layers-in-multicol-expected.html: Added.
  • fast/multicol/newmulticol/layers-in-multicol.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r143463 r143467  
     12013-02-19  David Hyatt  <hyatt@apple.com>
     2
     3        [New Multicolumn] Make layers paint properly in columns.
     4        https://bugs.webkit.org/show_bug.cgi?id=110296.
     5
     6        Reviewed by Sam Weinig.
     7
     8        * fast/multicol/newmulticol/layers-in-multicol-expected.html: Added.
     9        * fast/multicol/newmulticol/layers-in-multicol.html: Added.
     10
    1112013-02-20  Xabier Rodriguez Calvar  <calvaris@igalia.com>
    212
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r143450 r143467  
    15891589webkit.org/b/110203 [ Mac ] fast/multicol/seamless-flowed-through-columns.html [ Failure ]
    15901590
     1591# Test fails for some reason.
     1592webkit.org/b/110296 fast/multicol/newmulticol/column-rules-fixed-height.html [ ImageOnlyFailure ]
     1593
    15911594# -----------------------------------------------------------------
    15921595# MAC PORT TESTS
  • trunk/Source/WebCore/ChangeLog

    r143465 r143467  
     12013-02-19  David Hyatt  <hyatt@apple.com>
     2
     3        [New Multicolumn] Make layers paint properly in columns.
     4        https://bugs.webkit.org/show_bug.cgi?id=110296.
     5
     6        Reviewed by Sam Weinig.
     7
     8        Construct the style for the RenderMultiColumnFlowThread such that it
     9        establishes a stacking context (by being position:relative
     10        with a z-index of 0). This causes the layer collection code
     11        to correctly ignore the RenderFlowThread layers during normal
     12        painting.
     13       
     14        Fix more clipping bugs to eliminate subpixel layout differences
     15        between old and new multicolumn.
     16
     17        Test: fast/multicol/newmulticol/layers-in-multicol.html
     18
     19        * rendering/RenderMultiColumnBlock.cpp:
     20        (WebCore::createMultiColumnFlowThreadStyle):
     21        (WebCore):
     22        (WebCore::RenderMultiColumnBlock::addChild):
     23        Use a custom style (similar to what normal RenderFlowThreads do)
     24        for the RenderMultiColumnFlowThread that makes it a stacking
     25        context.
     26       
     27        * rendering/RenderMultiColumnSet.cpp:
     28        (WebCore::RenderMultiColumnSet::flowThreadPortionOverflowRect):
     29        Fix the overflow calculations out the leftmost and rightmost
     30        columns to actually look at the physical placement of the columns.
     31        The old code was backwards for RTL.
     32       
     33        * rendering/RenderRegion.cpp:
     34        (WebCore::RenderRegion::overflowRectForFlowThreadPortion):
     35        Fix the clipping done by overflowRectForFlowThreadPortion to min
     36        and max with the passed-in portion rect so that subclasses that
     37        inflate the rect prior to passing it into the method don't have that
     38        inflation discarded.
     39
    1402013-02-20  Alexander Pavlov  <apavlov@chromium.org>
    241
  • trunk/Source/WebCore/rendering/RenderMultiColumnBlock.cpp

    r140244 r143467  
    104104}
    105105
     106static PassRefPtr<RenderStyle> createMultiColumnFlowThreadStyle(RenderStyle* parentStyle)
     107{
     108    RefPtr<RenderStyle> newStyle(RenderStyle::create());
     109    newStyle->inheritFrom(parentStyle);
     110    newStyle->setDisplay(BLOCK);
     111    newStyle->setPosition(RelativePosition);
     112    newStyle->setZIndex(0);
     113    newStyle->font().update(0);
     114    return newStyle.release();
     115}
     116
    106117void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* beforeChild)
    107118{
    108119    if (!m_flowThread) {
    109120        m_flowThread = new (renderArena()) RenderMultiColumnFlowThread(document());
    110         m_flowThread->setStyle(RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK));
     121        m_flowThread->setStyle(createMultiColumnFlowThreadStyle(style()));
    111122        RenderBlock::addChild(m_flowThread); // Always put the flow thread at the end.
    112123    }
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp

    r143395 r143467  
    171171    bool isFirstColumn = !index;
    172172    bool isLastColumn = index == colCount - 1;
     173    bool isLeftmostColumn = style()->isLeftToRightDirection() ? isFirstColumn : isLastColumn;
     174    bool isRightmostColumn = style()->isLeftToRightDirection() ? isLastColumn : isFirstColumn;
    173175    LayoutRect overflowRect(portionRect);
    174176    if (isHorizontalWritingMode()) {
    175         if (isFirstColumn) {
     177        if (isLeftmostColumn) {
    176178            // Shift to the logical left overflow of the flow thread to make sure it's all covered.
    177179            overflowRect.shiftXEdgeTo(min(flowThread()->visualOverflowRect().x(), portionRect.x()));
     
    180182            overflowRect.shiftXEdgeTo(portionRect.x() - colGap / 2);
    181183        }
    182         if (isLastColumn) {
     184        if (isRightmostColumn) {
    183185            // Shift to the logical right overflow of the flow thread to ensure content can spill out of the column.
    184186            overflowRect.shiftMaxXEdgeTo(max(flowThread()->visualOverflowRect().maxX(), portionRect.maxX()));
     
    188190        }
    189191    } else {
    190         if (isFirstColumn) {
     192        if (isLeftmostColumn) {
    191193            // Shift to the logical left overflow of the flow thread to make sure it's all covered.
    192194            overflowRect.shiftYEdgeTo(min(flowThread()->visualOverflowRect().y(), portionRect.y()));
     
    195197            overflowRect.shiftYEdgeTo(portionRect.y() - colGap / 2);
    196198        }
    197         if (isLastColumn) {
     199        if (isRightmostColumn) {
    198200            // Shift to the logical right overflow of the flow thread to ensure content can spill out of the column.
    199201            overflowRect.shiftMaxYEdgeTo(max(flowThread()->visualOverflowRect().maxY(), portionRect.maxY()));
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r142984 r143467  
    4343#include "StyleResolver.h"
    4444
     45using namespace std;
     46
    4547namespace WebCore {
    4648
     
    106108        LayoutUnit minY = isFirstPortion ? (flowThreadOverflow.y() - outlineSize) : flowThreadPortionRect.y();
    107109        LayoutUnit maxY = isLastPortion ? max(flowThreadPortionRect.maxY(), flowThreadOverflow.maxY()) + outlineSize : flowThreadPortionRect.maxY();
    108         LayoutUnit minX = clipX ? flowThreadPortionRect.x() : (flowThreadOverflow.x() - outlineSize);
    109         LayoutUnit maxX = clipX ? flowThreadPortionRect.maxX() : (flowThreadOverflow.maxX() + outlineSize);
     110        LayoutUnit minX = clipX ? flowThreadPortionRect.x() : min(flowThreadPortionRect.x(), flowThreadOverflow.x() - outlineSize);
     111        LayoutUnit maxX = clipX ? flowThreadPortionRect.maxX() : max(flowThreadPortionRect.maxX(), (flowThreadOverflow.maxX() + outlineSize));
    110112        clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY);
    111113    } else {
    112114        LayoutUnit minX = isFirstPortion ? (flowThreadOverflow.x() - outlineSize) : flowThreadPortionRect.x();
    113115        LayoutUnit maxX = isLastPortion ? max(flowThreadPortionRect.maxX(), flowThreadOverflow.maxX()) + outlineSize : flowThreadPortionRect.maxX();
    114         LayoutUnit minY = clipY ? flowThreadPortionRect.y() : (flowThreadOverflow.y() - outlineSize);
    115         LayoutUnit maxY = clipY ? flowThreadPortionRect.maxY() : (flowThreadOverflow.maxY() + outlineSize);
     116        LayoutUnit minY = clipY ? flowThreadPortionRect.y() : min(flowThreadPortionRect.y(), (flowThreadOverflow.y() - outlineSize));
     117        LayoutUnit maxY = clipY ? flowThreadPortionRect.maxY() : max(flowThreadPortionRect.y(), (flowThreadOverflow.maxY() + outlineSize));
    116118        clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY);
    117119    }
Note: See TracChangeset for help on using the changeset viewer.