Diff
Modified: branches/safari-536.28-branch/Source/WebCore/ChangeLog (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/ChangeLog 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/ChangeLog 2012-11-09 21:43:22 UTC (rev 134106)
@@ -1,5 +1,42 @@
2012-11-09 Lucas Forschler <lforsch...@apple.com>
+ Merge r126048.
+ Prerequisite for <rdar://problem/12536470>
+
+ 2012-08-20 Julien Chaffraix <jchaffr...@webkit.org>
+
+ Introduce a will-be-removed-from-tree notification in RenderObject
+ https://bugs.webkit.org/show_bug.cgi?id=94271
+
+ Reviewed by Abhishek Arya.
+
+ Following bug 93874, we have an insertion notification. This change adds the
+ matching removal notification (willBeRemovedFromTree).
+
+ Refactoring covered by existing tests.
+
+ * rendering/RenderObjectChildList.cpp:
+ (WebCore::RenderObjectChildList::removeChildNode):
+ Removed the code from here and moved it below.
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::willBeRemovedFromTree):
+ * rendering/RenderObject.h:
+ This is the base function that should be called by every instance.
+
+ * rendering/RenderListItem.cpp:
+ (WebCore::RenderListItem::willBeRemovedFromTree):
+ * rendering/RenderListItem.h:
+ * rendering/RenderQuote.cpp:
+ (WebCore::RenderQuote::willBeRemovedFromTree):
+ * rendering/RenderQuote.h:
+ * rendering/RenderRegion.cpp:
+ (WebCore::RenderRegion::willBeRemovedFromTree):
+ * rendering/RenderRegion.h:
+ Overriden functions.
+
+2012-11-09 Lucas Forschler <lforsch...@apple.com>
+
Merge r125737.
Prerequisite for <rdar://problem/12536470>
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderListItem.cpp (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderListItem.cpp 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderListItem.cpp 2012-11-09 21:43:22 UTC (rev 134106)
@@ -83,6 +83,13 @@
updateListMarkerNumbers();
}
+void RenderListItem::willBeRemovedFromTree()
+{
+ RenderBlock::willBeRemovedFromTree();
+
+ updateListMarkerNumbers();
+}
+
static bool isList(Node* node)
{
return (node->hasTagName(ulTag) || node->hasTagName(olTag));
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderListItem.h (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderListItem.h 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderListItem.h 2012-11-09 21:43:22 UTC (rev 134106)
@@ -59,6 +59,7 @@
virtual void willBeDestroyed();
virtual void insertedIntoTree() OVERRIDE;
+ virtual void willBeRemovedFromTree() OVERRIDE;
virtual bool isEmpty() const;
virtual void paint(PaintInfo&, const LayoutPoint&);
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderObject.cpp (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderObject.cpp 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderObject.cpp 2012-11-09 21:43:22 UTC (rev 134106)
@@ -2407,6 +2407,42 @@
containerFlowThread->addFlowChild(this);
}
+void RenderObject::willBeRemovedFromTree()
+{
+ // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removals which would need to be fixed first.
+
+ // If we remove a visible child from an invisible parent, we don't know the layer visibility any more.
+ RenderLayer* layer = 0;
+ if (parent()->style()->visibility() != VISIBLE && style()->visibility() == VISIBLE && !hasLayer()) {
+ if ((layer = parent()->enclosingLayer()))
+ layer->dirtyVisibleContentStatus();
+ }
+
+ // Keep our layer hierarchy updated.
+ if (firstChild() || hasLayer()) {
+ if (!layer)
+ layer = parent()->enclosingLayer();
+ removeLayers(layer);
+ }
+
+ if (isPositioned() && parent()->childrenInline())
+ parent()->dirtyLinesFromChangedChild(this);
+
+ if (inRenderFlowThread() && isBox()) {
+ enclosingRenderFlowThread()->removeRenderBoxRegionInfo(toRenderBox(this));
+ if (canHaveRegionStyle())
+ enclosingRenderFlowThread()->clearRenderBoxCustomStyle(toRenderBox(this));
+ }
+
+ if (RenderNamedFlowThread* containerFlowThread = parent()->enclosingRenderNamedFlowThread())
+ containerFlowThread->removeFlowChild(this);
+
+#if ENABLE(SVG)
+ // Update cached boundaries in SVG renderers, if a child is removed.
+ parent()->setNeedsBoundariesUpdate();
+#endif
+}
+
void RenderObject::destroyAndCleanupAnonymousWrappers()
{
RenderObject* parent = this->parent();
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderObject.h (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderObject.h 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderObject.h 2012-11-09 21:43:22 UTC (rev 134106)
@@ -922,6 +922,7 @@
virtual bool canBeReplacedWithInlineRunIn() const;
virtual void insertedIntoTree();
+ virtual void willBeRemovedFromTree();
private:
RenderStyle* firstLineStyleSlowCase() const;
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderObjectChildList.cpp (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderObjectChildList.cpp 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderObjectChildList.cpp 2012-11-09 21:43:22 UTC (rev 134106)
@@ -63,7 +63,7 @@
}
}
-RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, RenderObject* oldChild, bool fullRemove)
+RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, RenderObject* oldChild, bool notifyRenderer)
{
ASSERT(oldChild->parent() == owner);
@@ -73,7 +73,7 @@
// So that we'll get the appropriate dirty bit set (either that a normal flow child got yanked or
// that a positioned child got yanked). We also repaint, so that the area exposed when the child
// disappears gets repainted properly.
- if (!owner->documentBeingDestroyed() && fullRemove && oldChild->everHadLayout()) {
+ if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadLayout()) {
oldChild->setNeedsLayoutAndPrefWidthsRecalc();
if (oldChild->isBody())
owner->view()->repaint();
@@ -85,44 +85,8 @@
if (oldChild->isBox())
toRenderBox(oldChild)->deleteLineBoxWrapper();
- if (!owner->documentBeingDestroyed() && fullRemove) {
- // if we remove visible child from an invisible parent, we don't know the layer visibility any more
- RenderLayer* layer = 0;
- if (owner->style()->visibility() != VISIBLE && oldChild->style()->visibility() == VISIBLE && !oldChild->hasLayer()) {
- if ((layer = owner->enclosingLayer()))
- layer->dirtyVisibleContentStatus();
- }
-
- // Keep our layer hierarchy updated.
- if (oldChild->firstChild() || oldChild->hasLayer()) {
- if (!layer)
- layer = owner->enclosingLayer();
- oldChild->removeLayers(layer);
- }
-
- if (oldChild->isListItem())
- toRenderListItem(oldChild)->updateListMarkerNumbers();
-
- if (oldChild->isPositioned() && owner->childrenInline())
- owner->dirtyLinesFromChangedChild(oldChild);
-
- if (oldChild->isRenderRegion())
- toRenderRegion(oldChild)->detachRegion();
-
- if (oldChild->inRenderFlowThread() && oldChild->isBox()) {
- oldChild->enclosingRenderFlowThread()->removeRenderBoxRegionInfo(toRenderBox(oldChild));
- if (oldChild->canHaveRegionStyle())
- oldChild->enclosingRenderFlowThread()->clearRenderBoxCustomStyle(toRenderBox(oldChild));
- }
-
- if (RenderNamedFlowThread* containerFlowThread = owner->enclosingRenderNamedFlowThread())
- containerFlowThread->removeFlowChild(oldChild);
-
-#if ENABLE(SVG)
- // Update cached boundaries in SVG renderers, if a child is removed.
- owner->setNeedsBoundariesUpdate();
-#endif
- }
+ if (!owner->documentBeingDestroyed() && notifyRenderer)
+ oldChild->willBeRemovedFromTree();
// If oldChild is the start or end of the selection, then clear the selection to
// avoid problems of invalid pointers.
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderObjectChildList.h (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderObjectChildList.h 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderObjectChildList.h 2012-11-09 21:43:22 UTC (rev 134106)
@@ -52,7 +52,7 @@
void destroyLeftoverChildren();
- RenderObject* removeChildNode(RenderObject* owner, RenderObject*, bool fullRemove = true);
+ RenderObject* removeChildNode(RenderObject* owner, RenderObject*, bool notifyRenderer = true);
void appendChildNode(RenderObject* owner, RenderObject*, bool notifyRenderer = true);
void insertChildNode(RenderObject* owner, RenderObject* child, RenderObject* before, bool notifyRenderer = true);
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderQuote.cpp (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderQuote.cpp 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderQuote.cpp 2012-11-09 21:43:22 UTC (rev 134106)
@@ -63,6 +63,20 @@
{
}
+void RenderQuote::willBeRemovedFromTree()
+{
+ RenderText::willBeRemovedFromTree();
+
+#if PLATFORM(IOS)
+ // <rdar://problem/12568339>.
+ // Merge of http://trac.webkit.org/changeset/126048 depends on http://trac.webkit.org/changeset/125220 so did
+ // not fully apply.
+ // RenderObjectChildList::removeChildNode() still calls RenderQuote::rendererRemovedFromTree(oldChild),
+ // so this call should not be necessary. When merging OpenSource, restore this to the OpenSource version.
+ // detachQuote();
+#endif
+}
+
const char* RenderQuote::renderName() const
{
return "RenderQuote";
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderQuote.h (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderQuote.h 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderQuote.h 2012-11-09 21:43:22 UTC (rev 134106)
@@ -46,6 +46,8 @@
// renderers before going into the main render tree. Once we can ensure that insertIntoTree,
// is called on an attached tree, we should override it here.
+ virtual void willBeRemovedFromTree() OVERRIDE;
+
QuoteType m_type;
int m_depth;
RenderQuote* m_next;
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderRegion.cpp (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderRegion.cpp 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderRegion.cpp 2012-11-09 21:43:22 UTC (rev 134106)
@@ -291,6 +291,13 @@
return computeStyleInRegion(renderBox);
}
+void RenderRegion::willBeRemovedFromTree()
+{
+ RenderReplaced::willBeRemovedFromTree();
+
+ detachRegion();
+}
+
PassRefPtr<RenderStyle> RenderRegion::computeStyleInRegion(const RenderBox* box)
{
ASSERT(box);
Modified: branches/safari-536.28-branch/Source/WebCore/rendering/RenderRegion.h (134105 => 134106)
--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderRegion.h 2012-11-09 21:42:59 UTC (rev 134105)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderRegion.h 2012-11-09 21:43:22 UTC (rev 134106)
@@ -99,6 +99,7 @@
virtual const char* renderName() const { return "RenderRegion"; }
virtual void insertedIntoTree() OVERRIDE;
+ virtual void willBeRemovedFromTree() OVERRIDE;
PassRefPtr<RenderStyle> renderBoxRegionStyle(const RenderBox*);
PassRefPtr<RenderStyle> computeStyleInRegion(const RenderBox*);