Changeset 164231 in webkit


Ignore:
Timestamp:
Feb 17, 2014 11:10:42 AM (10 years ago)
Author:
stavila@adobe.com
Message:

[CSS Regions] The box decorations of an element overflowing a region should be clipped at the border box, not the content box
https://bugs.webkit.org/show_bug.cgi?id=128815

Reviewed by Andrei Bucur.

Source/WebCore:

Elements flowed into a region should not be painted past the region's content box
if they continue to flow into another region in that direction.
If they do not continue into another region in that direction, they should be
painted all the way to the region's border box.
Regions with overflow:hidden will apply clip at the border box, not the content box.

Tests: fast/regions/box-decorations-over-region-padding-fragmented.html

fast/regions/box-decorations-over-region-padding-horiz-bt.html
fast/regions/box-decorations-over-region-padding-vert-lr.html
fast/regions/box-decorations-over-region-padding-vert-rl.html
fast/regions/box-decorations-over-region-padding.html

  • rendering/RenderNamedFlowFragment.cpp:

(WebCore::RenderNamedFlowFragment::flowThreadPortionRectForClipping):

  • rendering/RenderNamedFlowFragment.h:
  • rendering/RenderRegion.cpp:

(WebCore::RenderRegion::rectFlowPortionForBox):

LayoutTests:

Added tests for the painting of the borders of elements flowed into regions
over the region's padding area, for regions with overflow:hidden.
Tests were added for all writing modes.

  • fast/regions/box-decorations-over-region-padding-expected.html: Added.
  • fast/regions/box-decorations-over-region-padding-fragmented-expected.html: Added.
  • fast/regions/box-decorations-over-region-padding-fragmented.html: Added.
  • fast/regions/box-decorations-over-region-padding-horiz-bt-expected.html: Added.
  • fast/regions/box-decorations-over-region-padding-horiz-bt.html: Added.
  • fast/regions/box-decorations-over-region-padding-vert-lr-expected.html: Added.
  • fast/regions/box-decorations-over-region-padding-vert-lr.html: Added.
  • fast/regions/box-decorations-over-region-padding-vert-rl-expected.html: Added.
  • fast/regions/box-decorations-over-region-padding-vert-rl.html: Added.
  • fast/regions/box-decorations-over-region-padding.html: Added.
Location:
trunk
Files:
10 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r164227 r164231  
     12014-02-17  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSS Regions] The box decorations of an element overflowing a region should be clipped at the border box, not the content box
     4        https://bugs.webkit.org/show_bug.cgi?id=128815
     5
     6        Reviewed by Andrei Bucur.
     7
     8        Added tests for the painting of the borders of elements flowed into regions
     9        over the region's padding area, for regions with overflow:hidden.
     10        Tests were added for all writing modes.
     11
     12        * fast/regions/box-decorations-over-region-padding-expected.html: Added.
     13        * fast/regions/box-decorations-over-region-padding-fragmented-expected.html: Added.
     14        * fast/regions/box-decorations-over-region-padding-fragmented.html: Added.
     15        * fast/regions/box-decorations-over-region-padding-horiz-bt-expected.html: Added.
     16        * fast/regions/box-decorations-over-region-padding-horiz-bt.html: Added.
     17        * fast/regions/box-decorations-over-region-padding-vert-lr-expected.html: Added.
     18        * fast/regions/box-decorations-over-region-padding-vert-lr.html: Added.
     19        * fast/regions/box-decorations-over-region-padding-vert-rl-expected.html: Added.
     20        * fast/regions/box-decorations-over-region-padding-vert-rl.html: Added.
     21        * fast/regions/box-decorations-over-region-padding.html: Added.
     22
    1232014-02-17  Brendan Long  <b.long@cablelabs.com>
    224
  • trunk/Source/WebCore/ChangeLog

    r164227 r164231  
     12014-02-17  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSS Regions] The box decorations of an element overflowing a region should be clipped at the border box, not the content box
     4        https://bugs.webkit.org/show_bug.cgi?id=128815
     5
     6        Reviewed by Andrei Bucur.
     7
     8        Elements flowed into a region should not be painted past the region's content box
     9        if they continue to flow into another region in that direction.
     10        If they do not continue into another region in that direction, they should be
     11        painted all the way to the region's border box.
     12        Regions with overflow:hidden will apply clip at the border box, not the content box.
     13
     14        Tests: fast/regions/box-decorations-over-region-padding-fragmented.html
     15               fast/regions/box-decorations-over-region-padding-horiz-bt.html
     16               fast/regions/box-decorations-over-region-padding-vert-lr.html
     17               fast/regions/box-decorations-over-region-padding-vert-rl.html
     18               fast/regions/box-decorations-over-region-padding.html
     19
     20        * rendering/RenderNamedFlowFragment.cpp:
     21        (WebCore::RenderNamedFlowFragment::flowThreadPortionRectForClipping):
     22        * rendering/RenderNamedFlowFragment.h:
     23        * rendering/RenderRegion.cpp:
     24        (WebCore::RenderRegion::rectFlowPortionForBox):
     25
    1262014-02-17  Brendan Long  <b.long@cablelabs.com>
    227
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp

    r163333 r164231  
    189189}
    190190
     191LayoutRect RenderNamedFlowFragment::flowThreadPortionRectForClipping(bool isFirstRegionInRange, bool isLastRegionInRange) const
     192{
     193    // Elements flowed into a region should not be painted past the region's content box
     194    // if they continue to flow into another region in that direction.
     195    // If they do not continue into another region in that direction, they should be
     196    // painted all the way to the region's border box.
     197    // Regions with overflow:hidden will apply clip at the border box, not the content box.
     198   
     199    LayoutRect clippingRect = flowThreadPortionRect();
     200    if (regionContainer()->style().hasPadding()) {
     201        if (isFirstRegionInRange) {
     202            if (flowThread()->isHorizontalWritingMode()) {
     203                clippingRect.move(0, -regionContainer()->paddingBefore());
     204                clippingRect.expand(0, regionContainer()->paddingBefore());
     205            } else {
     206                clippingRect.move(-regionContainer()->paddingBefore(), 0);
     207                clippingRect.expand(regionContainer()->paddingBefore(), 0);
     208            }
     209        }
     210       
     211        if (isLastRegionInRange) {
     212            if (flowThread()->isHorizontalWritingMode())
     213                clippingRect.expand(0, regionContainer()->paddingAfter());
     214            else
     215                clippingRect.expand(regionContainer()->paddingAfter(), 0);
     216        }
     217       
     218        if (flowThread()->isHorizontalWritingMode()) {
     219            clippingRect.move(-regionContainer()->paddingStart(), 0);
     220            clippingRect.expand(regionContainer()->paddingStart() + regionContainer()->paddingEnd(), 0);
     221        } else {
     222            clippingRect.move(0, -regionContainer()->paddingStart());
     223            clippingRect.expand(0, regionContainer()->paddingStart() + regionContainer()->paddingEnd());
     224        }
     225    }
     226   
     227    return clippingRect;
     228}
     229
    191230void RenderNamedFlowFragment::layoutBlock(bool relayoutChildren, LayoutUnit)
    192231{
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h

    r162523 r164231  
    6060    virtual LayoutUnit pageLogicalHeight() const;
    6161    LayoutUnit maxPageLogicalHeight() const;
     62   
     63    LayoutRect flowThreadPortionRectForClipping(bool isFirstRegionInRange, bool isLastRegionInRange) const;
    6264
    6365    bool isPseudoElementRegion() const { return parent() && parent()->isPseudoElement(); }
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r163873 r164231  
    522522
    523523    bool isLastRegionWithRegionFragmentBreak = (isLastRegion() && (style().regionFragment() == BreakRegionFragment));
    524     if (hasOverflowClip() || isLastRegionWithRegionFragmentBreak)
    525         mappedRect.intersect(flowThreadPortionRect());
     524    if (hasOverflowClip() || isLastRegionWithRegionFragmentBreak) {
     525        LayoutRect portionRect;
     526        if (isRenderNamedFlowFragment())
     527            portionRect = toRenderNamedFlowFragment(this)->flowThreadPortionRectForClipping(this == startRegion, this == endRegion);
     528        else
     529            portionRect = flowThreadPortionRect();
     530       
     531        mappedRect.intersect(portionRect);
     532    }
    526533
    527534    return mappedRect.isEmpty() ? mappedRect : m_flowThread->mapFromFlowThreadToLocal(box, mappedRect);
Note: See TracChangeset for help on using the changeset viewer.