Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Unified Diff: Source/WebCore/rendering/RenderBlock.cpp

Issue 9371039: Merge 106150 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderBlock.cpp
===================================================================
--- Source/WebCore/rendering/RenderBlock.cpp (revision 107332)
+++ Source/WebCore/rendering/RenderBlock.cpp (working copy)
@@ -1019,6 +1019,18 @@
&& prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanBlock();
}
+void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* child)
+{
+ parent->setNeedsLayoutAndPrefWidthsRecalc();
+ parent->setChildrenInline(child->childrenInline());
+ RenderBlock* anonBlock = toRenderBlock(parent->children()->removeChildNode(parent, child, child->hasLayer()));
+ anonBlock->moveAllChildrenTo(parent, child->hasLayer());
+ // Delete the now-empty block's lines and nuke it.
+ if (!parent->documentBeingDestroyed())
+ anonBlock->deleteLineBoxTree();
+ anonBlock->destroy();
+}
+
void RenderBlock::removeChild(RenderObject* oldChild)
{
// If this child is a block, and if our previous and next siblings are
@@ -1075,13 +1087,17 @@
// The removal has knocked us down to containing only a single anonymous
// box. We can go ahead and pull the content right back up into our
// box.
- setNeedsLayoutAndPrefWidthsRecalc();
- setChildrenInline(child->childrenInline());
- RenderBlock* anonBlock = toRenderBlock(children()->removeChildNode(this, child, child->hasLayer()));
- anonBlock->moveAllChildrenTo(this, child->hasLayer());
- // Delete the now-empty block's lines and nuke it.
- anonBlock->deleteLineBoxTree();
- anonBlock->destroy();
+ collapseAnonymousBoxChild(this, child);
+ } else if ((prev && prev->isAnonymousBlock()) || (next && next->isAnonymousBlock())) {
+ // It's possible that the removal has knocked us down to a single anonymous
+ // block with pseudo-style element siblings (e.g. first-letter). If these
+ // are floating, then we need to pull the content up also.
+ RenderBlock* anonBlock = toRenderBlock((prev && prev->isAnonymousBlock()) ? prev : next);
+ if ((anonBlock->previousSibling() || anonBlock->nextSibling())
+ && (!anonBlock->previousSibling() || (anonBlock->previousSibling()->style()->styleType() != NOPSEUDO && anonBlock->previousSibling()->isFloating()))
+ && (!anonBlock->nextSibling() || (anonBlock->nextSibling()->style()->styleType() != NOPSEUDO && anonBlock->nextSibling()->isFloating()))) {
+ collapseAnonymousBoxChild(this, anonBlock);
+ }
}
if (!firstChild() && !documentBeingDestroyed()) {
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698