Title: [89165] trunk
- Revision
- 89165
- Author
- [email protected]
- Date
- 2011-06-17 13:19:10 -0700 (Fri, 17 Jun 2011)
Log Message
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-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:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (89164 => 89165)
--- trunk/LayoutTests/ChangeLog 2011-06-17 20:08:30 UTC (rev 89164)
+++ trunk/LayoutTests/ChangeLog 2011-06-17 20:19:10 UTC (rev 89165)
@@ -1,3 +1,14 @@
+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-06-17 Vsevolod Vlasov <[email protected]>
Reviewed by Pavel Feldman.
Added: trunk/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5-expected.txt (0 => 89165)
--- trunk/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5-expected.txt 2011-06-17 20:19:10 UTC (rev 89165)
@@ -0,0 +1,4 @@
+Test passes if it does not crash.
+A A
+
+
Added: trunk/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5.html (0 => 89165)
--- trunk/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5.html (rev 0)
+++ trunk/LayoutTests/fast/block/float/float-not-removed-from-next-sibling5.html 2011-06-17 20:19:10 UTC (rev 89165)
@@ -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: trunk/Source/WebCore/ChangeLog (89164 => 89165)
--- trunk/Source/WebCore/ChangeLog 2011-06-17 20:08:30 UTC (rev 89164)
+++ trunk/Source/WebCore/ChangeLog 2011-06-17 20:19:10 UTC (rev 89165)
@@ -1,3 +1,19 @@
+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-06-17 Vsevolod Vlasov <[email protected]>
Reviewed by Pavel Feldman.
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (89164 => 89165)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2011-06-17 20:08:30 UTC (rev 89164)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2011-06-17 20:19:10 UTC (rev 89165)
@@ -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();
}
}
@@ -3733,6 +3754,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: trunk/Source/WebCore/rendering/RenderBlock.h (89164 => 89165)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2011-06-17 20:08:30 UTC (rev 89164)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2011-06-17 20:19:10 UTC (rev 89165)
@@ -582,6 +582,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);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes