Diff
Modified: branches/safari-534.51-branch/LayoutTests/ChangeLog (91502 => 91503)
--- branches/safari-534.51-branch/LayoutTests/ChangeLog 2011-07-21 21:38:56 UTC (rev 91502)
+++ branches/safari-534.51-branch/LayoutTests/ChangeLog 2011-07-21 21:42:51 UTC (rev 91503)
@@ -1,5 +1,20 @@
2011-07-21 Lucas Forschler <[email protected]>
+ Merged 89165.
+
+ 2011-06-17 Abhishek Arya <[email protected]>
+
+ Reviewed by Dave Hyatt.
+
+ Tests that we do not crash when unable to remove floats from
+ parent's next siblings blocks.
+ https://bugs.webkit.org/show_bug.cgi?id=62875
+
+ * fast/block/float/float-not-removed-from-next-sibling5-expected.txt: Added.
+ * fast/block/float/float-not-removed-from-next-sibling5.html: Added.
+
+2011-07-21 Lucas Forschler <[email protected]>
+
Merged 88987.
2011-06-15 Abhishek Arya <[email protected]>
Copied: branches/safari-534.51-branch/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5-expected.txt (from rev 89165, trunk/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5-expected.txt) (0 => 91503)
--- branches/safari-534.51-branch/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5-expected.txt (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5-expected.txt 2011-07-21 21:42:51 UTC (rev 91503)
@@ -0,0 +1,4 @@
+Test passes if it does not crash.
+A A
+
+
Copied: branches/safari-534.51-branch/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5.html (from rev 89165, trunk/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5.html) (0 => 91503)
--- branches/safari-534.51-branch/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5.html (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5.html 2011-07-21 21:42:51 UTC (rev 91503)
@@ -0,0 +1,26 @@
+<html>
+Test passes if it does not crash.
+<div id="test1" style="width: 12px; position: relative">
+ <span>
+ <div id="test2">
+ <p style="float: left"></p>
+ </div>
+ </span>
+ <div id="test3">
+ <span>
+ <p>A A</p>
+ </span>
+ </div>
+</div>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ document.body.offsetTop;
+ test3.style.position = 'absolute';
+ test2.style.position = 'absolute';
+ document.body.offsetTop;
+ test1.style.height = '1';
+ test2.style.display = 'none';
+</script>
+</html>
Modified: branches/safari-534.51-branch/Source/WebCore/ChangeLog (91502 => 91503)
--- branches/safari-534.51-branch/Source/WebCore/ChangeLog 2011-07-21 21:38:56 UTC (rev 91502)
+++ branches/safari-534.51-branch/Source/WebCore/ChangeLog 2011-07-21 21:42:51 UTC (rev 91503)
@@ -1,5 +1,25 @@
2011-07-21 Lucas Forschler <[email protected]>
+ Merged 89165.
+
+ 2011-06-17 Abhishek Arya <[email protected]>
+
+ Reviewed by Dave Hyatt.
+
+ When we lose ability to propagate floats, need to find topmost
+ parent with that overhanging float, and then iterate over its
+ sibling blocks to remove the float.
+ https://bugs.webkit.org/show_bug.cgi?id=62875
+
+ Test: fast/block/float/float-not-removed-from-next-sibling5.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::styleDidChange):
+ (WebCore::RenderBlock::hasOverhangingFloat):
+ * rendering/RenderBlock.h:
+
+2011-07-21 Lucas Forschler <[email protected]>
+
Merged 89067.
2011-06-16 Abhishek Arya <[email protected]>
Modified: branches/safari-534.51-branch/Source/WebCore/rendering/RenderBlock.cpp (91502 => 91503)
--- branches/safari-534.51-branch/Source/WebCore/rendering/RenderBlock.cpp 2011-07-21 21:38:56 UTC (rev 91502)
+++ branches/safari-534.51-branch/Source/WebCore/rendering/RenderBlock.cpp 2011-07-21 21:42:51 UTC (rev 91503)
@@ -262,12 +262,33 @@
}
// After our style changed, if we lose our ability to propagate floats into next sibling
- // blocks, then we need to mark our descendants with floats for layout and clear all floats
- // from next sibling blocks that exist in our floating objects list. See bug 56299.
+ // blocks, then we need to find the top most parent containing that overhanging float and
+ // then mark its descendants with floats for layout and clear all floats from its next
+ // sibling blocks that exist in our floating objects list. See bug 56299 and 62875.
bool canPropagateFloatIntoSibling = !isFloatingOrPositioned() && !avoidsFloats();
if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canPropagateFloatIntoSibling && hasOverhangingFloats()) {
- markAllDescendantsWithFloatsForLayout();
- markSiblingsWithFloatsForLayout();
+ RenderBlock* parentBlock = this;
+ FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+ FloatingObjectSetIterator end = floatingObjectSet.end();
+
+ for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) {
+ if (curr->isRenderBlock()) {
+ RenderBlock* currBlock = toRenderBlock(curr);
+
+ if (currBlock->hasOverhangingFloats()) {
+ for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
+ RenderBox* renderer = (*it)->renderer();
+ if (currBlock->hasOverhangingFloat(renderer)) {
+ parentBlock = currBlock;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ parentBlock->markAllDescendantsWithFloatsForLayout();
+ parentBlock->markSiblingsWithFloatsForLayout();
}
}
@@ -3742,6 +3763,19 @@
return lowestFloatLogicalBottom;
}
+bool RenderBlock::hasOverhangingFloat(RenderBox* renderer)
+{
+ if (!m_floatingObjects || hasColumns() || !parent())
+ return false;
+
+ FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
+ FloatingObjectSetIterator it = floatingObjectSet.find<RenderBox*, FloatingObjectHashTranslator>(renderer);
+ if (it == floatingObjectSet.end())
+ return false;
+
+ return logicalBottomForFloat(*it) > logicalHeight();
+}
+
void RenderBlock::addIntrudingFloats(RenderBlock* prev, int logicalLeftOffset, int logicalTopOffset)
{
// If the parent or previous sibling doesn't have any floats to add, don't bother.
Modified: branches/safari-534.51-branch/Source/WebCore/rendering/RenderBlock.h (91502 => 91503)
--- branches/safari-534.51-branch/Source/WebCore/rendering/RenderBlock.h 2011-07-21 21:38:56 UTC (rev 91502)
+++ branches/safari-534.51-branch/Source/WebCore/rendering/RenderBlock.h 2011-07-21 21:42:51 UTC (rev 91503)
@@ -567,6 +567,7 @@
virtual bool avoidsFloats() const;
bool hasOverhangingFloats() { return parent() && !hasColumns() && containsFloats() && lowestFloatLogicalBottom() > logicalHeight(); }
+ bool hasOverhangingFloat(RenderBox*);
void addIntrudingFloats(RenderBlock* prev, int xoffset, int yoffset);
int addOverhangingFloats(RenderBlock* child, int xoffset, int yoffset, bool makeChildPaintOtherFloats);