- Revision
- 103206
- Author
- m...@apple.com
- Date
- 2011-12-18 18:51:46 -0800 (Sun, 18 Dec 2011)
Log Message
Positioned Floats: Assertion hit in fast/block/positioning/positioned-float-layout-after-image-load.html
https://bugs.webkit.org/show_bug.cgi?id=67759
Reviewed by Darin Adler.
Source/WebCore:
Test: fast/block/positioning/positioned-float-layout-after-image-load.html
Positioned floats are both floating and positioned. Made the following functions treat them as
positioned rather than as floats by reordering code.
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::LineBreaker::skipTrailingWhitespace):
(WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace):
(WebCore::RenderBlock::LineBreaker::nextLineBreak):
LayoutTests:
Re-added this test from r94695.
* fast/block/positioning/positioned-float-layout-after-image-load-expected.txt: Copied from LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load-expected.txt.
* fast/block/positioning/positioned-float-layout-after-image-load.html: Copied from LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load.html.
* fast/block/positioning/resources/positioned-float-layout-after-image-load-2.html: Copied from LayoutTests/fast/block/positioning/resources/positioned-float-layout-after-image-load-2.html.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (103205 => 103206)
--- trunk/LayoutTests/ChangeLog 2011-12-19 02:17:39 UTC (rev 103205)
+++ trunk/LayoutTests/ChangeLog 2011-12-19 02:51:46 UTC (rev 103206)
@@ -1,3 +1,16 @@
+2011-12-18 Dan Bernstein <m...@apple.com>
+
+ Positioned Floats: Assertion hit in fast/block/positioning/positioned-float-layout-after-image-load.html
+ https://bugs.webkit.org/show_bug.cgi?id=67759
+
+ Reviewed by Darin Adler.
+
+ Re-added this test from r94695.
+
+ * fast/block/positioning/positioned-float-layout-after-image-load-expected.txt: Copied from LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load-expected.txt.
+ * fast/block/positioning/positioned-float-layout-after-image-load.html: Copied from LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load.html.
+ * fast/block/positioning/resources/positioned-float-layout-after-image-load-2.html: Copied from LayoutTests/fast/block/positioning/resources/positioned-float-layout-after-image-load-2.html.
+
2011-12-18 Hajime Morrita <morr...@chromium.org>
Unreviewed expectations update.
Added: trunk/LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load-expected.txt (0 => 103206)
--- trunk/LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load-expected.txt 2011-12-19 02:51:46 UTC (rev 103206)
@@ -0,0 +1,3 @@
+
+[1]
+SUCCESS
Added: trunk/LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load.html (0 => 103206)
--- trunk/LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load.html (rev 0)
+++ trunk/LayoutTests/fast/block/positioning/positioned-float-layout-after-image-load.html 2011-12-19 02:51:46 UTC (rev 103206)
@@ -0,0 +1,21 @@
+<html>
+<head>
+<script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ // https://bugs.webkit.org/show_bug.cgi?id=54611
+ // When navigating to positioned-float-layout-after-image-load-2.html#anchor1 directly, the anchor should be positioned below
+ // the image on first load. The test is sensitive to caching of the image, so you should reload
+ // positioned-float-layout-after-image-load-2.html#anchor1 if testing manually.
+
+ function test(){
+ setTimeout(location.assign("resources/positioned-float-layout-after-image-load-2.html#anchor1"),0);
+ }
+</script>
+</head>
+<body _onload_="test();">
+</body></html>
+
Added: trunk/LayoutTests/fast/block/positioning/resources/positioned-float-layout-after-image-load-2.html (0 => 103206)
--- trunk/LayoutTests/fast/block/positioning/resources/positioned-float-layout-after-image-load-2.html (rev 0)
+++ trunk/LayoutTests/fast/block/positioning/resources/positioned-float-layout-after-image-load-2.html 2011-12-19 02:51:46 UTC (rev 103206)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<style type="text/css">
+ body { margin-left: 10%; margin-right: 10%;}
+ h1,h2,h3,h4,h5,h6 { text-align: center; clear: both;}
+ h1 span { display: block; padding-bottom: 0.5em; }
+ .figcenter { margin: auto; text-align: center;}
+ .footnote {margin-left: 10%; margin-right: 10%; font-size: 0.9em;}
+ .footnote .label {position: absolute; float: -webkit-positioned; right: 84%; text-align: right; width: 200px}
+</style>
+
+<script>
+ // https://bugs.webkit.org/show_bug.cgi?id=54611
+ // When navigating to the anchor directly, the anchor should be positioned below
+ // the image on first load.
+
+ function test(){
+ var bottomOfImage = document.getElementById("image").offsetTop + document.getElementById("image").offsetHeight;
+ var footnotePosition = document.getElementById("spantext").offsetTop;
+ if (footnotePosition >= bottomOfImage)
+ document.getElementById("console").innerHTML = "SUCCESS";
+ layoutTestController.notifyDone();
+ }
+</script>
+
+</head>
+<body _onload_="test();">
+<div class="figcenter">
+ <img id="image" src="" alt="Book cover." title="">
+</div>
+
+<div class="footnote"><a id="anchor1"></a><a href="" id="spantext" class="label">[1]</span></a></div>
+
+<div id="console">FAILURE</div>
+</body></html>
+
Modified: trunk/Source/WebCore/ChangeLog (103205 => 103206)
--- trunk/Source/WebCore/ChangeLog 2011-12-19 02:17:39 UTC (rev 103205)
+++ trunk/Source/WebCore/ChangeLog 2011-12-19 02:51:46 UTC (rev 103206)
@@ -1,3 +1,20 @@
+2011-12-18 Dan Bernstein <m...@apple.com>
+
+ Positioned Floats: Assertion hit in fast/block/positioning/positioned-float-layout-after-image-load.html
+ https://bugs.webkit.org/show_bug.cgi?id=67759
+
+ Reviewed by Darin Adler.
+
+ Test: fast/block/positioning/positioned-float-layout-after-image-load.html
+
+ Positioned floats are both floating and positioned. Made the following functions treat them as
+ positioned rather than as floats by reordering code.
+
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::LineBreaker::skipTrailingWhitespace):
+ (WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace):
+ (WebCore::RenderBlock::LineBreaker::nextLineBreak):
+
2011-12-18 Benjamin Poulain <bpoul...@apple.com>
Add support for 8 bits strings to Document::isValidName()
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (103205 => 103206)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2011-12-19 02:17:39 UTC (rev 103205)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2011-12-19 02:51:46 UTC (rev 103206)
@@ -1861,10 +1861,10 @@
{
while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo, TrailingWhitespace)) {
RenderObject* object = iterator.m_obj;
- if (object->isFloating()) {
+ if (object->isPositioned())
+ setStaticPositions(m_block, toRenderBox(object));
+ else if (object->isFloating())
m_block->insertFloatingObject(toRenderBox(object));
- } else if (object->isPositioned())
- setStaticPositions(m_block, toRenderBox(object));
iterator.increment();
}
}
@@ -1874,10 +1874,10 @@
{
while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), lineInfo, LeadingWhitespace)) {
RenderObject* object = resolver.position().m_obj;
- if (object->isFloating())
+ if (object->isPositioned())
+ setStaticPositions(m_block, toRenderBox(object));
+ else if (object->isFloating())
m_block->positionNewFloatOnLine(m_block->insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine, lineInfo, width);
- else if (object->isPositioned())
- setStaticPositions(m_block, toRenderBox(object));
resolver.increment();
}
resolver.commitExplicitEmbedding();
@@ -2156,21 +2156,7 @@
goto end;
}
- if (current.m_obj->isFloating()) {
- RenderBox* floatBox = toRenderBox(current.m_obj);
- FloatingObject* f = m_block->insertFloatingObject(floatBox);
- // check if it fits in the current line.
- // If it does, position it now, otherwise, position
- // it after moving to next line (in newLine() func)
- if (floatsFitOnLine && width.fitsOnLine(m_block->logicalWidthForFloat(f))) {
- m_block->positionNewFloatOnLine(f, lastFloatFromPreviousLine, lineInfo, width);
- if (lBreak.m_obj == current.m_obj) {
- ASSERT(!lBreak.m_pos);
- lBreak.increment();
- }
- } else
- floatsFitOnLine = false;
- } else if (current.m_obj->isPositioned()) {
+ if (current.m_obj->isPositioned()) {
// If our original display wasn't an inline type, then we can
// go ahead and determine our static inline position now.
RenderBox* box = toRenderBox(current.m_obj);
@@ -2195,6 +2181,20 @@
trailingObjects.appendBoxIfNeeded(box);
} else
m_positionedObjects.append(box);
+ } else if (current.m_obj->isFloating()) {
+ RenderBox* floatBox = toRenderBox(current.m_obj);
+ FloatingObject* f = m_block->insertFloatingObject(floatBox);
+ // check if it fits in the current line.
+ // If it does, position it now, otherwise, position
+ // it after moving to next line (in newLine() func)
+ if (floatsFitOnLine && width.fitsOnLine(m_block->logicalWidthForFloat(f))) {
+ m_block->positionNewFloatOnLine(f, lastFloatFromPreviousLine, lineInfo, width);
+ if (lBreak.m_obj == current.m_obj) {
+ ASSERT(!lBreak.m_pos);
+ lBreak.increment();
+ }
+ } else
+ floatsFitOnLine = false;
} else if (current.m_obj->isRenderInline()) {
// Right now, we should only encounter empty inlines here.
ASSERT(!current.m_obj->firstChild());