Title: [116986] trunk
- Revision
- 116986
- Author
- [email protected]
- Date
- 2012-05-14 13:04:37 -0700 (Mon, 14 May 2012)
Log Message
Pagination splits lines that could fit on a single page if it were not for their top leading
https://bugs.webkit.org/show_bug.cgi?id=86388
Reviewed by Darin Adler.
Source/WebCore:
Test: fast/multicol/split-in-top-margin.html
When a line’s visible content fits on a page, but adding the top leading makes it taller than
a page, instead of giving up and splitting the line in an arbitrary position, add a strut
to push it downwards so that the split occurs in the top leading, and the visible content is
fully contained on a single page.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::adjustLinePositionForPagination):
LayoutTests:
* fast/multicol/split-in-top-margin-expected.html: Added.
* fast/multicol/split-in-top-margin.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (116985 => 116986)
--- trunk/LayoutTests/ChangeLog 2012-05-14 19:52:16 UTC (rev 116985)
+++ trunk/LayoutTests/ChangeLog 2012-05-14 20:04:37 UTC (rev 116986)
@@ -1,3 +1,13 @@
+2012-05-14 Dan Bernstein <[email protected]>
+
+ Pagination splits lines that could fit on a single page if it were not for their top leading
+ https://bugs.webkit.org/show_bug.cgi?id=86388
+
+ Reviewed by Darin Adler.
+
+ * fast/multicol/split-in-top-margin-expected.html: Added.
+ * fast/multicol/split-in-top-margin.html: Added.
+
2012-05-14 Joshua Bell <[email protected]>
Unreviewed - remove a Chromium test expectation. Regressed (with others) by r115582,
Added: trunk/LayoutTests/fast/multicol/split-in-top-margin-expected.html (0 => 116986)
--- trunk/LayoutTests/fast/multicol/split-in-top-margin-expected.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/split-in-top-margin-expected.html 2012-05-14 20:04:37 UTC (rev 116986)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<style>
+ div.test { font-family: ahem; border: solid; width: 100px; margin: 8px 0; padding-left: 100px; }
+ div.test div { display: inline-block; background-color: blue; width: 100px; height: 100px; }
+</style>
+<div class="test" style="height: 120px;">
+ <div style="margin-top: 17px;"></div>
+</div>
+<div class="test" style="height: 150px;">
+ <div style="margin-top: 47px;"></div>
+</div>
+<div class="test" style="height: 160px;">
+ <div style="margin-top: 50px;"></div>
+</div>
Added: trunk/LayoutTests/fast/multicol/split-in-top-margin.html (0 => 116986)
--- trunk/LayoutTests/fast/multicol/split-in-top-margin.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/split-in-top-margin.html 2012-05-14 20:04:37 UTC (rev 116986)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<style>
+ div.test { font-family: ahem; border: solid; width: 200px; -webkit-column-gap: 0; -webkit-columns: 2; margin: 8px 0; }
+ div.test div { display: inline-block; background-color: blue; width: 100px; height: 100px; }
+</style>
+<div class="test" style="height: 120px;">
+ <br><br><br>
+ <div style="margin-top: 50px;"></div>
+</div>
+<div class="test" style="height: 150px;">
+ <br><br><br>
+ <div style="margin-top: 50px;"></div>
+</div>
+<div class="test" style="height: 160px;">
+ <br><br><br>
+ <div style="margin-top: 50px;"></div>
+</div>
Modified: trunk/Source/WebCore/ChangeLog (116985 => 116986)
--- trunk/Source/WebCore/ChangeLog 2012-05-14 19:52:16 UTC (rev 116985)
+++ trunk/Source/WebCore/ChangeLog 2012-05-14 20:04:37 UTC (rev 116986)
@@ -1,3 +1,20 @@
+2012-05-14 Dan Bernstein <[email protected]>
+
+ Pagination splits lines that could fit on a single page if it were not for their top leading
+ https://bugs.webkit.org/show_bug.cgi?id=86388
+
+ Reviewed by Darin Adler.
+
+ Test: fast/multicol/split-in-top-margin.html
+
+ When a line’s visible content fits on a page, but adding the top leading makes it taller than
+ a page, instead of giving up and splitting the line in an arbitrary position, add a strut
+ to push it downwards so that the split occurs in the top leading, and the visible content is
+ fully contained on a single page.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::adjustLinePositionForPagination):
+
2012-05-14 Terry Anderson <[email protected]>
[chromium] Compute the best target node on a GestureTap event
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (116985 => 116986)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-05-14 19:52:16 UTC (rev 116985)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-05-14 20:04:37 UTC (rev 116986)
@@ -6773,7 +6773,9 @@
lineBox->setPaginationStrut(0);
LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
bool hasUniformPageLogicalHeight = !inRenderFlowThread() || enclosingRenderFlowThread()->regionsHaveUniformLogicalHeight();
- if (!pageLogicalHeight || (hasUniformPageLogicalHeight && lineHeight > pageLogicalHeight)
+ // If lineHeight is greater than pageLogicalHeight, but logicalVisualOverflow.height() still fits, we are
+ // still going to add a strut, so that the visible overflow fits on a single page.
+ if (!pageLogicalHeight || (hasUniformPageLogicalHeight && logicalVisualOverflow.height() > pageLogicalHeight)
|| !hasNextPage(logicalOffset))
return;
LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logicalOffset, ExcludePageBoundary);
@@ -6781,6 +6783,10 @@
// If we have a non-uniform page height, then we have to shift further possibly.
if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHeight(remainingLogicalHeight, logicalOffset, lineHeight))
return;
+ if (lineHeight > pageLogicalHeight) {
+ // Split the top margin in order to avoid splitting the visible part of the line.
+ remainingLogicalHeight -= min(lineHeight - pageLogicalHeight, max(ZERO_LAYOUT_UNIT, logicalVisualOverflow.y() - lineBox->lineTopWithLeading()));
+ }
LayoutUnit totalLogicalHeight = lineHeight + max(ZERO_LAYOUT_UNIT, logicalOffset);
LayoutUnit pageLogicalHeightAtNewOffset = hasUniformPageLogicalHeight ? pageLogicalHeight : pageLogicalHeightForOffset(logicalOffset + remainingLogicalHeight);
if (lineBox == firstRootBox() && totalLogicalHeight < pageLogicalHeightAtNewOffset && !isPositioned() && !isTableCell())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes