Diff
Modified: trunk/LayoutTests/ChangeLog (97390 => 97391)
--- trunk/LayoutTests/ChangeLog 2011-10-13 20:22:35 UTC (rev 97390)
+++ trunk/LayoutTests/ChangeLog 2011-10-13 20:37:28 UTC (rev 97391)
@@ -1,3 +1,17 @@
+2011-10-13 David Hyatt <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=70049
+
+ [CSS Regions] Add a test of a float being pushed down because it can't fit
+ next to another float and make sure it re-evaluates its position when it changes
+ regions as a result of the push.
+
+ Reviewed by Sam Weinig.
+
+ * fast/regions/float-pushed-width-change.html: Added.
+ * platform/mac/fast/regions/float-pushed-width-change-expected.png: Added.
+ * platform/mac/fast/regions/float-pushed-width-change-expected.txt: Added.
+
2011-10-13 Robert Hogan <[email protected]>
Platform-specific results for r97378
Added: trunk/LayoutTests/fast/regions/float-pushed-width-change.html (0 => 97391)
--- trunk/LayoutTests/fast/regions/float-pushed-width-change.html (rev 0)
+++ trunk/LayoutTests/fast/regions/float-pushed-width-change.html 2011-10-13 20:37:28 UTC (rev 97391)
@@ -0,0 +1,62 @@
+<!doctype html>
+
+ <style>
+ #content {
+ -webkit-flow: "flow1";
+ text-align: justify;
+ padding: 5px;
+ }
+
+ #float1 {
+ float: left;
+ width: 150px;
+ height: 100px;
+ background-color:green
+ }
+
+ #float2 {
+ float:right;
+ width:200px;
+ height:30px;
+ background-color:orange
+ }
+
+ #region1, #region2, #region3 {
+ border: 1px solid black;
+ content: -webkit-from-flow("flow1");
+ }
+
+ #region1 {
+ width: 180px;
+ height: 90px;
+ }
+
+ #region2 {
+ width: 400px;
+ height: 90px;
+ }
+
+ #region3 {
+ width: 400px;
+ height: 90px;
+ }
+</style>
+
+<p>In the example below, the green float should be at the top of the first region and on the left. It should spill into region two.
+The orange float should be on the right at the top of region two.</p>
+
+<div id="content">
+ <div id="first-box">
+ <div id="second-box">
+ <p><img id="float1"><img id="float2">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. This line of text should not get out of the region.</p>
+ <p>This line of text should not get out of the region..</p>
+
+ </div>
+ </div>
+</div>
+
+<div id="container">
+ <div id="region1"></div>
+ <div id="region2"></div>
+ <div id="region3"></div>
+</div>
Added: trunk/LayoutTests/platform/mac/fast/regions/float-pushed-width-change-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/regions/float-pushed-width-change-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/fast/regions/float-pushed-width-change-expected.txt (0 => 97391)
--- trunk/LayoutTests/platform/mac/fast/regions/float-pushed-width-change-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/regions/float-pushed-width-change-expected.txt 2011-10-13 20:37:28 UTC (rev 97391)
@@ -0,0 +1,37 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x352
+ RenderBlock {HTML} at (0,0) size 800x352
+ RenderBody {BODY} at (8,16) size 784x328
+ RenderBlock {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 764x36
+ text run at (0,0) width 764: "In the example below, the green float should be at the top of the first region and on the left. It should spill into region two."
+ text run at (0,18) width 400: "The orange float should be on the right at the top of region two."
+ RenderBlock {DIV} at (0,52) size 784x276
+ RenderRegion {DIV} at (0,0) size 182x92 [border: (1px solid #000000)]
+ RenderRegion {DIV} at (0,92) size 402x92 [border: (1px solid #000000)]
+ RenderRegion {DIV} at (0,184) size 402x92 [border: (1px solid #000000)]
+Flow Threads
+ Thread with flow-name 'flow1'
+ layer at (0,0) size 400x270
+ RenderFlowThread at (0,0) size 400x270
+ RenderBlock {DIV} at (0,0) size 400x253
+ RenderBlock {DIV} at (5,21) size 390x211
+ RenderBlock {DIV} at (0,0) size 390x211
+ RenderBlock {P} at (0,0) size 390x177
+ RenderImage {IMG} at (0,0) size 150x100 [bgcolor=#008000]
+ RenderImage {IMG} at (190,70) size 200x30 [bgcolor=#FFA500]
+ RenderText {#text} at (0,100) size 390x77
+ text run at (0,100) width 106: "This line of text "
+ text run at (106,100) width 161: "should not get out of the "
+ text run at (267,100) width 123: "region. This line of"
+ text run at (0,118) width 390: "text should not get out of the region. This line of text should"
+ text run at (0,136) width 390: "not get out of the region. This line of text should not get out"
+ text run at (0,159) width 84: "of the region."
+ RenderBlock {P} at (0,193) size 390x18
+ RenderText {#text} at (0,0) size 308x18
+ text run at (0,0) width 308: "This line of text should not get out of the region.."
+ Regions for flow 'flow1'
+ RenderRegion {DIV} #region1
+ RenderRegion {DIV} #region2
+ RenderRegion {DIV} #region3
Modified: trunk/Source/WebCore/ChangeLog (97390 => 97391)
--- trunk/Source/WebCore/ChangeLog 2011-10-13 20:22:35 UTC (rev 97390)
+++ trunk/Source/WebCore/ChangeLog 2011-10-13 20:37:28 UTC (rev 97391)
@@ -1,3 +1,18 @@
+2011-10-13 David Hyatt <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=70049
+
+ [CSS Regions] Add a test of a float being pushed down because it can't fit
+ next to another float and make sure it re-evaluates its position when it changes
+ regions as a result of the push.
+
+ Reviewed by Sam Weinig.
+
+ Added new test in fast/regions.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::computeLogicalLocationForFloat):
+
2011-10-13 Adam Barth <[email protected]>
Move XSTL to script-src in Content-Security-Policy
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (97390 => 97391)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2011-10-13 20:22:35 UTC (rev 97390)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2011-10-13 20:37:28 UTC (rev 97391)
@@ -3326,10 +3326,8 @@
RenderBox* childBox = floatingObject->renderer();
LayoutUnit logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset.
LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset.
- LayoutUnit floatLogicalWidth = logicalWidthForFloat(floatingObject); // The width we look for.
- if (logicalRightOffset - logicalLeftOffset < floatLogicalWidth)
- floatLogicalWidth = logicalRightOffset - logicalLeftOffset; // Never look for more than what will be available.
-
+ LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); // The width we look for.
+
LayoutUnit floatLogicalLeft;
if (childBox->style()->floating() == LeftFloat) {
@@ -3339,6 +3337,12 @@
while (logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth) {
logicalTopOffset += min(heightRemainingLeft, heightRemainingRight);
floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft);
+ if (inRenderFlowThread()) {
+ // Have to re-evaluate all of our offsets, since they may have changed.
+ logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset.
+ logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset.
+ floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset);
+ }
}
floatLogicalLeft = max<LayoutUnit>(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft);
} else {
@@ -3348,6 +3352,12 @@
while (floatLogicalLeft - logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) {
logicalTopOffset += min(heightRemainingLeft, heightRemainingRight);
floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight);
+ if (inRenderFlowThread()) {
+ // Have to re-evaluate all of our offsets, since they may have changed.
+ logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset.
+ logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset.
+ floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset);
+ }
}
floatLogicalLeft -= logicalWidthForFloat(floatingObject); // Use the original width of the float here, since the local variable
// |floatLogicalWidth| was capped to the available line width.