Changeset 167018 in webkit


Ignore:
Timestamp:
Apr 9, 2014 10:07:50 AM (10 years ago)
Author:
stavila@adobe.com
Message:

[CSS Regions] Monolithic elements should not affect the layout of the content outside its region
https://bugs.webkit.org/show_bug.cgi?id=130499

Reviewed by David Hyatt.

Source/WebCore:

When performing layout on an element flowed into regions, its logical height must not be incremented
past the region's logical bottom for monolithic elements in regions different than the last region their containing
block is fragmented into. This ensures that the following elements are correctly laid out
from the top of the next region.
This change must also be applied to floats in order to prevent text from avoiding part
of a float that did not actually made it into the current region, but instead overflowed
the previous one.

Tests: fast/regions/fragmentation-after-float-overflow-single-region.html

fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html
fast/regions/fragmentation-after-monolithic-overflow-single-region.html
fast/regions/fragmentation-after-monolithic-overflow.html

  • rendering/FloatingObjects.cpp:

(WebCore::FloatingObjects::computePlacedFloatsTree):

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::layoutBlockChild):
(WebCore::RenderBlockFlow::adjustBlockChildForPagination):
(WebCore::RenderBlockFlow::lowestFloatLogicalBottom):
(WebCore::RenderBlockFlow::getClearDelta):
(WebCore::RenderBlockFlow::applyAfterBreak): Deleted.
(WebCore::RenderBlockFlow::nextFloatLogicalBottomBelow): Deleted.
(WebCore::RenderBlockFlow::nextFloatLogicalBottomBelowForBlock): Deleted.
(WebCore::RenderBlockFlow::flipFloatForWritingModeForChild): Deleted.

  • rendering/RenderBlockFlow.h:
  • rendering/RenderFlowThread.cpp:

(WebCore::RenderFlowThread::isBoxInDifferentRegionsAsFloat):

  • rendering/RenderFlowThread.h:

LayoutTests:

Added tests for different types of fragmentation following monolithic content
overflowing its region.
Rebased the webkit-flow-float-unable-to-push test as its expected result was not the correct one.

  • fast/regions/webkit-flow-float-unable-to-push-expected.html:
  • fast/regions/fragmentation-after-float-overflow-single-region-expected.html: Added.
  • fast/regions/fragmentation-after-float-overflow-single-region.html: Added.
  • fast/regions/fragmentation-after-monolithic-overflow-expected.html: Added.
  • fast/regions/fragmentation-after-monolithic-overflow-self-collapsed-expected.html: Added.
  • fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html: Added.
  • fast/regions/fragmentation-after-monolithic-overflow-single-region-expected.html: Added.
  • fast/regions/fragmentation-after-monolithic-overflow-single-region.html: Added.
  • fast/regions/fragmentation-after-monolithic-overflow.html: Added.
Location:
trunk
Files:
8 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167015 r167018  
     12014-04-09  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSS Regions] Monolithic elements should not affect the layout of the content outside its region
     4        https://bugs.webkit.org/show_bug.cgi?id=130499
     5
     6        Reviewed by David Hyatt.
     7
     8        Added tests for different types of fragmentation following monolithic content
     9        overflowing its region.
     10        Rebased the webkit-flow-float-unable-to-push test as its expected result was not the correct one.
     11
     12        * fast/regions/webkit-flow-float-unable-to-push-expected.html:
     13        * fast/regions/fragmentation-after-float-overflow-single-region-expected.html: Added.
     14        * fast/regions/fragmentation-after-float-overflow-single-region.html: Added.
     15        * fast/regions/fragmentation-after-monolithic-overflow-expected.html: Added.
     16        * fast/regions/fragmentation-after-monolithic-overflow-self-collapsed-expected.html: Added.
     17        * fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html: Added.
     18        * fast/regions/fragmentation-after-monolithic-overflow-single-region-expected.html: Added.
     19        * fast/regions/fragmentation-after-monolithic-overflow-single-region.html: Added.
     20        * fast/regions/fragmentation-after-monolithic-overflow.html: Added.
     21
    1222014-04-09  Alexey Proskuryakov  <ap@apple.com>
    223
  • trunk/LayoutTests/fast/regions/webkit-flow-float-unable-to-push-expected.html

    r159609 r167018  
    132132        height: 100px;
    133133    }
    134 
    135     #float2 {
    136         float: right;
    137         width: 34px;
    138         height: 70px;
    139         visibility: hidden;
    140     }
    141134</style>
    142135
     
    156149            <div class="first-box" id="first-box2">
    157150                <div class="second-box" id="second-box2">
    158                     <div class="test_paragraph" id="first-paragraph2">region. <img id="float2" src="resources/transparent.png">This line of text should not get out of the region. This line of text should not get out of the region.</div>
    159                     <div class="test_paragraph" id="second-paragraph2">This line of text should not get out of the</div>
     151                    <div class="test_paragraph" id="first-paragraph2">region. This line of text should not get out of the region. This line of text should not get out of the region.</div>
     152                    <div class="test_paragraph" id="second-paragraph2">This line of text should not get out of the region. This line of</div>
    160153                </div>
    161154            </div>
     
    167160            <div class="first-box" id="first-box3">
    168161                <div class="second-box" id="second-box3">
    169                     <div class="test_paragraph" id="first-paragraph3">region. This line of text should not get out of the region. This line of text should not get out of the region. This line of text should not get out of the region.</div>
     162                    <div class="test_paragraph" id="first-paragraph3">text should not get out of the region. This line of text should not get out of the region. This line of text should not get out of the region.</div>
    170163                    <div class="test_paragraph" id="second-paragraph3">This line of text should not get out of the region.</div>
    171164                </div>
  • trunk/Source/WebCore/ChangeLog

    r167017 r167018  
     12014-04-09  Radu Stavila  <stavila@adobe.com>
     2
     3        [CSS Regions] Monolithic elements should not affect the layout of the content outside its region
     4        https://bugs.webkit.org/show_bug.cgi?id=130499
     5
     6        Reviewed by David Hyatt.
     7
     8        When performing layout on an element flowed into regions, its logical height must not be incremented
     9        past the region's logical bottom for monolithic elements in regions different than the last region their containing
     10        block is fragmented into. This ensures that the following elements are correctly laid out
     11        from the top of the next region.
     12        This change must also be applied to floats in order to prevent text from avoiding part
     13        of a float that did not actually made it into the current region, but instead overflowed
     14        the previous one.
     15
     16        Tests: fast/regions/fragmentation-after-float-overflow-single-region.html
     17               fast/regions/fragmentation-after-monolithic-overflow-self-collapsed.html
     18               fast/regions/fragmentation-after-monolithic-overflow-single-region.html
     19               fast/regions/fragmentation-after-monolithic-overflow.html
     20
     21        * rendering/FloatingObjects.cpp:
     22        (WebCore::FloatingObjects::computePlacedFloatsTree):
     23        * rendering/RenderBlockFlow.cpp:
     24        (WebCore::RenderBlockFlow::layoutBlockChild):
     25        (WebCore::RenderBlockFlow::adjustBlockChildForPagination):
     26        (WebCore::RenderBlockFlow::lowestFloatLogicalBottom):
     27        (WebCore::RenderBlockFlow::getClearDelta):
     28        (WebCore::RenderBlockFlow::applyAfterBreak): Deleted.
     29        (WebCore::RenderBlockFlow::nextFloatLogicalBottomBelow): Deleted.
     30        (WebCore::RenderBlockFlow::nextFloatLogicalBottomBelowForBlock): Deleted.
     31        (WebCore::RenderBlockFlow::flipFloatForWritingModeForChild): Deleted.
     32        * rendering/RenderBlockFlow.h:
     33        * rendering/RenderFlowThread.cpp:
     34        (WebCore::RenderFlowThread::isBoxInDifferentRegionsAsFloat):
     35        * rendering/RenderFlowThread.h:
     36
    1372014-04-09  Anders Carlsson  <andersca@apple.com>
    238
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r166938 r167018  
    677677
    678678    // Update our height now that the child has been placed in the correct position.
    679     setLogicalHeight(logicalHeight() + logicalHeightForChild(child));
     679    setLogicalHeight(logicalHeight() + logicalHeightForChildForFragmentation(child));
    680680    if (mustSeparateMarginAfterForChild(child)) {
    681681        setLogicalHeight(logicalHeight() + marginAfterForChild(child));
     
    17841784}
    17851785
     1786LayoutUnit RenderBlockFlow::logicalHeightForChildForFragmentation(const RenderBox& child) const
     1787{
     1788    // This method is required because regions do not fragment monolithic elements but instead
     1789    // they let them overflow the region they flow in. This behaviour is different from the
     1790    // multicol/printing implementations, which have not yet been updated to correctly handle
     1791    // monolithic elements.
     1792    // As a result, for the moment, this method will only be used for regions, the multicol and
     1793    // printing implementations will stick to the existing behaviour until their fragmentation
     1794    // implementation is updated to match the regions implementation.
     1795    if (!flowThreadContainingBlock() || !flowThreadContainingBlock()->isRenderNamedFlowThread())
     1796        return logicalHeightForChild(child);
     1797
     1798    // For unsplittable elements, this method will just return the height of the element that
     1799    // fits into the current region, without the height of the part that overflows the region.
     1800    // This is done for all regions, except the last one because in that case, the logical
     1801    // height of the flow thread needs to also
     1802    if (!childBoxIsUnsplittableForFragmentation(child) || !pageLogicalHeightForOffset(logicalTopForChild(child)))
     1803        return logicalHeightForChild(child);
     1804
     1805    // If we're on the last page this block fragments to, the logical height of the flow thread must include
     1806    // the entire unsplittable child because any following children will not be moved to the next page
     1807    // so they will need to be laid out below the current unsplittable child.
     1808    LayoutUnit childLogicalTop = logicalTopForChild(child);
     1809    if (!hasNextPage(childLogicalTop))
     1810        return logicalHeightForChild(child);
     1811   
     1812    LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(childLogicalTop, ExcludePageBoundary);
     1813    return std::min(child.logicalHeight(), remainingLogicalHeight);
     1814}
    17861815
    17871816void RenderBlockFlow::layoutLineGridBox()
     
    22982327        setLogicalTopForFloat(floatingObject, floatLogicalLocation.y());
    22992328
    2300         setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
     2329        setLogicalHeightForFloat(floatingObject, logicalHeightForChildForFragmentation(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
    23012330
    23022331        m_floatingObjects->addPlacedObject(floatingObject);
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r166489 r167018  
    374374    LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const;
    375375    LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule = IncludePageBoundary) const;
     376    LayoutUnit logicalHeightForChildForFragmentation(const RenderBox& child) const;
    376377    bool hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule = ExcludePageBoundary) const;
    377378
Note: See TracChangeset for help on using the changeset viewer.