summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-10-14 09:26:59 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-10-14 09:26:59 -0700
commit036a4662d3b03554e3563ca093fdefb250d19c17 (patch)
treed5fe38e9249a4d58d7790418ff304f5670617d76 /Source/WebCore
parent1a27d4c9519aca9ff266bd6a0bc2833b95decb14 (diff)
parent4fb1f2dd7e874d968a0effac0dd1e0ea8e94f46d (diff)
downloadexternal_webkit-036a4662d3b03554e3563ca093fdefb250d19c17.zip
external_webkit-036a4662d3b03554e3563ca093fdefb250d19c17.tar.gz
external_webkit-036a4662d3b03554e3563ca093fdefb250d19c17.tar.bz2
am 4fb1f2dd: Cherry-pick WebKit change 89165 to fix a crash due to floats not being removed
* commit '4fb1f2dd7e874d968a0effac0dd1e0ea8e94f46d': Cherry-pick WebKit change 89165 to fix a crash due to floats not being removed
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/rendering/RenderBlock.cpp42
-rw-r--r--Source/WebCore/rendering/RenderBlock.h1
2 files changed, 39 insertions, 4 deletions
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 792b809..4df6066 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -269,12 +269,33 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
}
// 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();
}
}
@@ -3738,6 +3759,19 @@ int RenderBlock::addOverhangingFloats(RenderBlock* child, int logicalLeftOffset,
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.
diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h
index d45ab66..7ca13c6 100644
--- a/Source/WebCore/rendering/RenderBlock.h
+++ b/Source/WebCore/rendering/RenderBlock.h
@@ -542,6 +542,7 @@ private:
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);