LayoutTests/ChangeLog

 12014-05-16 Radu Stavila <stavila@adobe.com>
 2
 3 [CSS Regions] Block incorrectly sized when containing an unsplittable box
 4 https://bugs.webkit.org/show_bug.cgi?id=132601
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Added tests for the layout of elements following inline-block elements
 9 that overflow their region, with and without anonymous blocks.
 10
 11 * fast/regions/inline-block-inside-anonymous-overflow-expected.html: Added.
 12 * fast/regions/inline-block-inside-anonymous-overflow.html: Added.
 13 * fast/regions/inline-block-overflow-expected.html: Added.
 14 * fast/regions/inline-block-overflow.html: Added.
 15
1162014-05-15 Daniel Bates <dabates@apple.com>
217
318 ASSERT_NOT_REACHED() in DocumentOrderedMap::get() when removing SVG subtree

LayoutTests/fast/regions/inline-block-inside-anonymous-overflow-expected.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <style>
 5 .region {
 6 border: 3px solid blue;
 7 float: left;
 8 }
 9 #region1 {
 10 height: 250px;
 11 }
 12 #region2 {
 13 width: 300px;
 14 height: 200px;
 15 margin-left: 50px;
 16 }
 17 .article {
 18 background-color: #009999;
 19 }
 20 #article1 {
 21 height: 230px;
 22 }
 23 #video {
 24 width: 320px;
 25 height: 300px;
 26 background-color: salmon;
 27 border: 3px solid black;
 28 }
 29 </style>
 30 </head>
 31
 32 <body>
 33 <a href="https://bugs.webkit.org/show_bug.cgi?id=132601">Bug 132601 - [CSS Regions] Block incorrectly sized when containing an unsplittable box</a>
 34 <p>This test passes if the <span style="color:#00BB00">green text</span> is positioned at the very top of the second <span style="color:blue">region</span> and the <span style="color:blue">blue text</span> immediately after it.</p>
 35 <div class="region" id="region1">
 36 <div class="article" id="article1">
 37 <video id="video" controls></video><span style="color:#00FF00">
 38 </div>
 39 </div>
 40
 41 <div class="region" id="region2">
 42 <div class="article" id="article2">
 43 <span style="color:#00FF00">This text, together with the video element, are inside an anonymouse block</span>
 44 <div id="after" style="color:blue">This div is after the anonymous block</div>
 45 </div>
 46 </div>
 47
 48 </body>
 49</html>

LayoutTests/fast/regions/inline-block-inside-anonymous-overflow.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <style>
 5 .region {
 6 -webkit-flow-from: flow;
 7 border: 3px solid blue;
 8 float: left;
 9 }
 10 #region1 {
 11 height: 250px;
 12 }
 13 #region2 {
 14 width: 300px;
 15 height: 200px;
 16 margin-left: 50px;
 17 }
 18 #article {
 19 -webkit-flow-into: flow;
 20 background-color: #009999;
 21 }
 22 #video {
 23 width: 320px;
 24 height: 300px;
 25 background-color: salmon;
 26 border: 3px solid black;
 27 }
 28 </style>
 29 </head>
 30
 31 <body>
 32 <a href="https://bugs.webkit.org/show_bug.cgi?id=132601">Bug 132601 - [CSS Regions] Block incorrectly sized when containing an unsplittable box</a>
 33 <p>This test passes if the <span style="color:#00BB00">green text</span> is positioned at the very top of the second <span style="color:blue">region</span> and the <span style="color:blue">blue text</span> immediately after it.</p>
 34 <div class="region" id="region1"></div>
 35 <div class="region" id="region2"></div>
 36 <div id="article">
 37 <video id="video" controls></video><span style="color:#00FF00">This text, together with the video element, are inside an anonymouse block</span>
 38 <div id="after" style="color:blue">This div is after the anonymous block</div>
 39 </div>
 40 </body>
 41</html>

LayoutTests/fast/regions/inline-block-overflow-expected.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <style>
 5 .region {
 6 border: 3px solid blue;
 7 float: left;
 8 }
 9 #region1 {
 10 height: 250px;
 11 }
 12 #region2 {
 13 width: 300px;
 14 height: 200px;
 15 margin-left: 50px;
 16 }
 17 .article {
 18 background-color: #009999;
 19 }
 20 #article1 {
 21 height: 230px;
 22 }
 23 #video {
 24 width: 320px;
 25 height: 300px;
 26 background-color: salmon;
 27 border: 3px solid black;
 28 display: inline-block;
 29 }
 30 </style>
 31 </head>
 32
 33 <body>
 34 <a href="https://bugs.webkit.org/show_bug.cgi?id=132601">Bug 132601 - [CSS Regions] Block incorrectly sized when containing an unsplittable box</a>
 35 <p>This test passes if the <span style="color:#00BB00">green text</span> is positioned at the very top of the second <span style="color:blue">region</span>.</p>
 36 <div class="region" id="region1">
 37 <div class="article" id="article1">
 38 <video id="video" controls></video>
 39 </div>
 40 </div>
 41
 42 <div class="region" id="region2">
 43 <div class="article" id="article2">
 44 <div id="after" style="color:#00FF00">This div is flowed after the video element.</div>
 45 </div>
 46 </div>
 47 </body>
 48</html>

LayoutTests/fast/regions/inline-block-overflow.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <style>
 5 .region {
 6 -webkit-flow-from: flow;
 7 border: 3px solid blue;
 8 float: left;
 9 }
 10 #region1 {
 11 height: 250px;
 12 }
 13 #region2 {
 14 width: 300px;
 15 height: 200px;
 16 margin-left: 50px;
 17 }
 18 .article {
 19 -webkit-flow-into: flow;
 20 background-color: #009999;
 21 }
 22 #video {
 23 width: 320px;
 24 height: 300px;
 25 background-color: salmon;
 26 border: 3px solid black;
 27 display: inline-block;
 28 }
 29 </style>
 30 </head>
 31
 32 <body>
 33 <a href="https://bugs.webkit.org/show_bug.cgi?id=132601">Bug 132601 - [CSS Regions] Block incorrectly sized when containing an unsplittable box</a>
 34 <p>This test passes if the <span style="color:#00BB00">green text</span> is positioned at the very top of the second <span style="color:blue">region</span>.</p>
 35 <div class="region" id="region1"></div>
 36 <div class="region" id="region2"></div>
 37 <div class="article" id="article1">
 38 <video id="video" controls></video>
 39 </div>
 40 <div class="article" id="article2">
 41 <div id="after" style="color:#00FF00">This div is flowed after the video element.</div>
 42 </div>
 43 </body>
 44</html>

Source/WebCore/ChangeLog

 12014-05-16 Radu Stavila <stavila@adobe.com>
 2
 3 [CSS Regions] Block incorrectly sized when containing an unsplittable box
 4 https://bugs.webkit.org/show_bug.cgi?id=132601
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 When laying out elements in a region, when an unsplittable elements is encountered
 9 the size of its parent must not be increased beyond the bottom of the current region,
 10 unless if its the last region. This will ensure that the next sibling of the
 11 unsplittable element is correctly laid out at the top of the next region, instead
 12 of leaving an empty space equal to the height of the overflow, as it did until now.
 13
 14 Tests: fast/regions/inline-block-inside-anonymous-overflow.html
 15 fast/regions/inline-block-overflow.html
 16
 17 * rendering/RenderBlockFlow.cpp:
 18 (WebCore::RenderBlockFlow::hasNextPage):
 19 * rendering/RenderBlockLineLayout.cpp:
 20 (WebCore::RenderBlockFlow::computeBlockDirectionPositionsForLine):
 21
1222014-05-15 Daniel Bates <dabates@apple.com>
223
324 Attempt to fix the Apple Mavericks Release, Apple MountainLion Release,

Source/WebCore/rendering/RenderBlockFlow.cpp

@@bool RenderBlockFlow::hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule pag
17581758 RenderRegion* startRegion = nullptr;
17591759 RenderRegion* endRegion = nullptr;
17601760 flowThread->getRegionRangeForBox(this, startRegion, endRegion);
1761  return region != endRegion;
 1761 return (endRegion && region != endRegion);
17621762}
17631763
17641764LayoutUnit RenderBlockFlow::adjustForUnsplittableChild(RenderBox& child, LayoutUnit logicalOffset, bool includeMargins)

Source/WebCore/rendering/RenderBlockLineLayout.cpp

@@BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo
716716void RenderBlockFlow::computeBlockDirectionPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap,
717717 VerticalPositionCache& verticalPositionCache)
718718{
719  setLogicalHeight(lineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, verticalPositionCache));
 719 LayoutUnit lineLogicalHeight = lineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, verticalPositionCache);
 720
 721 // If the inline child being laid out is unsplittable for pagination (such as a video),
 722 // make sure not to increase the parent' height beyond the current page (unless it's the last page).
 723 if (view().layoutState() && view().layoutState()->isPaginated()) {
 724 RenderFlowThread* flowThread = flowThreadContainingBlock();
 725 if (flowThread && flowThread->isRenderNamedFlowThread()) {
 726 if (firstRun && firstRun->renderer().isBox() && toRenderBox(firstRun->renderer()).isUnsplittableForPagination()) {
 727 LayoutUnit lineLogicalTop = logicalTopForChild(toRenderBox(firstRun->renderer()));
 728 if (hasNextPage(lineLogicalTop)) {
 729 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(lineLogicalTop, ExcludePageBoundary);
 730 if (remainingLogicalHeight < lineLogicalHeight)
 731 lineLogicalHeight = remainingLogicalHeight;
 732 }
 733 }
 734 }
 735 }
 736
 737 setLogicalHeight(lineLogicalHeight);
720738
721739 // Now make sure we place replaced render objects correctly.
722740 for (BidiRun* r = firstRun; r; r = r->next()) {