<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[175211] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/175211">175211</a></dd>
<dt>Author</dt> <dd>akling@apple.com</dd>
<dt>Date</dt> <dd>2014-10-26 15:25:00 -0700 (Sun, 26 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move some RenderObject member functions to RenderElement.
<https://webkit.org/b/138085>
Reviewed by Chris Dumez.
Move these two functions to RenderElement:
- handleDynamicFloatPositionChange()
- removeAnonymousWrappersForInlinesIfNecessary()
Also make childBecameNonInline() take a RenderElement& since
that's all we ever pass to it.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::childBecameNonInline):
* rendering/RenderBlock.h:
* rendering/RenderBoxModelObject.h:
(WebCore::RenderBoxModelObject::childBecameNonInline):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::handleDynamicFloatPositionChange):
(WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary):
* rendering/RenderElement.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::childBecameNonInline):
* rendering/RenderInline.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::handleDynamicFloatPositionChange): Deleted.
(WebCore::RenderObject::removeAnonymousWrappersForInlinesIfNecessary): Deleted.
* rendering/RenderObject.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockcpp">trunk/Source/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockh">trunk/Source/WebCore/rendering/RenderBlock.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjecth">trunk/Source/WebCore/rendering/RenderBoxModelObject.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementcpp">trunk/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementh">trunk/Source/WebCore/rendering/RenderElement.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderInlinecpp">trunk/Source/WebCore/rendering/RenderInline.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderInlineh">trunk/Source/WebCore/rendering/RenderInline.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjectcpp">trunk/Source/WebCore/rendering/RenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjecth">trunk/Source/WebCore/rendering/RenderObject.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/ChangeLog        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -1,5 +1,37 @@
</span><span class="cx"> 2014-10-26 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><ins>+ Move some RenderObject member functions to RenderElement.
+ <https://webkit.org/b/138085>
+
+ Reviewed by Chris Dumez.
+
+ Move these two functions to RenderElement:
+
+ - handleDynamicFloatPositionChange()
+ - removeAnonymousWrappersForInlinesIfNecessary()
+
+ Also make childBecameNonInline() take a RenderElement& since
+ that's all we ever pass to it.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::childBecameNonInline):
+ * rendering/RenderBlock.h:
+ * rendering/RenderBoxModelObject.h:
+ (WebCore::RenderBoxModelObject::childBecameNonInline):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::handleDynamicFloatPositionChange):
+ (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary):
+ * rendering/RenderElement.h:
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::childBecameNonInline):
+ * rendering/RenderInline.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::handleDynamicFloatPositionChange): Deleted.
+ (WebCore::RenderObject::removeAnonymousWrappersForInlinesIfNecessary): Deleted.
+ * rendering/RenderObject.h:
+
+2014-10-26 Andreas Kling <akling@apple.com>
+
</ins><span class="cx"> Move continuation teardown from subclasses to RenderBoxModelObject.
</span><span class="cx"> <https://webkit.org/b/138081>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -3397,7 +3397,7 @@
</span><span class="cx"> return isAnonymousBlockContinuation() ? continuation()->style() : style();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderBlock::childBecameNonInline(RenderObject*)
</del><ins>+void RenderBlock::childBecameNonInline(RenderElement&)
</ins><span class="cx"> {
</span><span class="cx"> makeChildrenNonInline();
</span><span class="cx"> if (isAnonymousBlock() && is<RenderBlock>(parent()))
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.h (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.h        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/rendering/RenderBlock.h        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -457,7 +457,7 @@
</span><span class="cx">
</span><span class="cx"> virtual RenderElement* hoverAncestor() const override final;
</span><span class="cx"> virtual void updateDragState(bool dragOn) override final;
</span><del>- virtual void childBecameNonInline(RenderObject* child) override final;
</del><ins>+ virtual void childBecameNonInline(RenderElement&) override final;
</ins><span class="cx">
</span><span class="cx"> virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool /*clipToVisibleContent*/) override final
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -171,7 +171,7 @@
</span><span class="cx">
</span><span class="cx"> virtual LayoutUnit containingBlockLogicalWidthForContent() const;
</span><span class="cx">
</span><del>- virtual void childBecameNonInline(RenderObject* /*child*/) { }
</del><ins>+ virtual void childBecameNonInline(RenderElement&) { }
</ins><span class="cx">
</span><span class="cx"> void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle&, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
</span><span class="cx"> bool paintNinePieceImage(GraphicsContext*, const LayoutRect&, const RenderStyle&, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -897,6 +897,51 @@
</span><span class="cx"> view().frameView().updateExtendBackgroundIfNecessary();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void RenderElement::handleDynamicFloatPositionChange()
+{
+ // We have gone from not affecting the inline status of the parent flow to suddenly
+ // having an impact. See if there is a mismatch between the parent flow's
+ // childrenInline() state and our state.
+ setInline(style().isDisplayInlineType());
+ if (isInline() != parent()->childrenInline()) {
+ if (!isInline())
+ downcast<RenderBoxModelObject>(*parent()).childBecameNonInline(*this);
+ else {
+ // An anonymous block must be made to wrap this inline.
+ RenderBlock* block = downcast<RenderBlock>(*parent()).createAnonymousBlock();
+ parent()->insertChildInternal(block, this, RenderElement::NotifyChildren);
+ parent()->removeChildInternal(*this, RenderElement::NotifyChildren);
+ block->insertChildInternal(this, nullptr, RenderElement::NotifyChildren);
+ }
+ }
+}
+
+void RenderElement::removeAnonymousWrappersForInlinesIfNecessary()
+{
+ RenderBlock& parentBlock = downcast<RenderBlock>(*parent());
+ if (!parentBlock.canCollapseAnonymousBlockChild())
+ return;
+
+ // We have changed to floated or out-of-flow positioning so maybe all our parent's
+ // children can be inline now. Bail if there are any block children left on the line,
+ // otherwise we can proceed to stripping solitary anonymous wrappers from the inlines.
+ // FIXME: We should also handle split inlines here - we exclude them at the moment by returning
+ // if we find a continuation.
+ RenderObject* current = parent()->firstChild();
+ while (current && ((current->isAnonymousBlock() && !downcast<RenderBlock>(*current).isAnonymousBlockContinuation()) || current->style().isFloating() || current->style().hasOutOfFlowPosition()))
+ current = current->nextSibling();
+
+ if (current)
+ return;
+
+ RenderObject* next;
+ for (current = parent()->firstChild(); current; current = next) {
+ next = current->nextSibling();
+ if (current->isAnonymousBlock())
+ parentBlock.collapseAnonymousBoxChild(parentBlock, downcast<RenderBlock>(current));
+ }
+}
+
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderStyle* b)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.h (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.h        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/rendering/RenderElement.h        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -217,6 +217,12 @@
</span><span class="cx"> virtual RenderObject* firstChildSlow() const override final { return firstChild(); }
</span><span class="cx"> virtual RenderObject* lastChildSlow() const override final { return lastChild(); }
</span><span class="cx">
</span><ins>+ // Called when an object that was floating or positioned becomes a normal flow object
+ // again. We have to make sure the render tree updates as needed to accommodate the new
+ // normal flow object.
+ void handleDynamicFloatPositionChange();
+ void removeAnonymousWrappersForInlinesIfNecessary();
+
</ins><span class="cx"> bool shouldRepaintForStyleDifference(StyleDifference) const;
</span><span class="cx"> bool hasImmediateNonWhitespaceTextChildOrBorderOrOutline() const;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderInlinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderInline.cpp        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -1297,15 +1297,15 @@
</span><span class="cx"> continuation->updateDragState(dragOn);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderInline::childBecameNonInline(RenderObject* child)
</del><ins>+void RenderInline::childBecameNonInline(RenderElement& child)
</ins><span class="cx"> {
</span><span class="cx"> // We have to split the parent flow.
</span><span class="cx"> RenderBlock* newBox = containingBlock()->createAnonymousBlock();
</span><span class="cx"> RenderBoxModelObject* oldContinuation = continuation();
</span><span class="cx"> setContinuation(newBox);
</span><del>- RenderObject* beforeChild = child->nextSibling();
- removeChildInternal(*child, NotifyChildren);
- splitFlow(beforeChild, newBox, child, oldContinuation);
</del><ins>+ RenderObject* beforeChild = child.nextSibling();
+ removeChildInternal(child, NotifyChildren);
+ splitFlow(beforeChild, newBox, &child, oldContinuation);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RenderInline::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderInlineh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderInline.h (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderInline.h        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/rendering/RenderInline.h        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -161,7 +161,7 @@
</span><span class="cx"> virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override final;
</span><span class="cx"> virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override final;
</span><span class="cx">
</span><del>- virtual void childBecameNonInline(RenderObject* child) override final;
</del><ins>+ virtual void childBecameNonInline(RenderElement&) override final;
</ins><span class="cx">
</span><span class="cx"> virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) override final;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.cpp        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -1635,51 +1635,6 @@
</span><span class="cx"> selectionRoot().selectionStartEndPositions(spos, epos);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderObject::handleDynamicFloatPositionChange()
-{
- // We have gone from not affecting the inline status of the parent flow to suddenly
- // having an impact. See if there is a mismatch between the parent flow's
- // childrenInline() state and our state.
- setInline(style().isDisplayInlineType());
- if (isInline() != parent()->childrenInline()) {
- if (!isInline())
- downcast<RenderBoxModelObject>(*parent()).childBecameNonInline(this);
- else {
- // An anonymous block must be made to wrap this inline.
- RenderBlock* block = downcast<RenderBlock>(*parent()).createAnonymousBlock();
- parent()->insertChildInternal(block, this, RenderElement::NotifyChildren);
- parent()->removeChildInternal(*this, RenderElement::NotifyChildren);
- block->insertChildInternal(this, nullptr, RenderElement::NotifyChildren);
- }
- }
-}
-
-void RenderObject::removeAnonymousWrappersForInlinesIfNecessary()
-{
- RenderBlock& parentBlock = downcast<RenderBlock>(*parent());
- if (!parentBlock.canCollapseAnonymousBlockChild())
- return;
-
- // We have changed to floated or out-of-flow positioning so maybe all our parent's
- // children can be inline now. Bail if there are any block children left on the line,
- // otherwise we can proceed to stripping solitary anonymous wrappers from the inlines.
- // FIXME: We should also handle split inlines here - we exclude them at the moment by returning
- // if we find a continuation.
- RenderObject* current = parent()->firstChild();
- while (current && ((current->isAnonymousBlock() && !downcast<RenderBlock>(*current).isAnonymousBlockContinuation()) || current->style().isFloating() || current->style().hasOutOfFlowPosition()))
- current = current->nextSibling();
-
- if (current)
- return;
-
- RenderObject* next;
- for (current = parent()->firstChild(); current; current = next) {
- next = current->nextSibling();
- if (current->isAnonymousBlock())
- parentBlock.collapseAnonymousBoxChild(parentBlock, downcast<RenderBlock>(current));
- }
-}
-
</del><span class="cx"> FloatPoint RenderObject::localToAbsolute(const FloatPoint& localPoint, MapCoordinatesFlags mode) const
</span><span class="cx"> {
</span><span class="cx"> TransformState transformState(TransformState::ApplyTransformDirection, localPoint);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.h (175210 => 175211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.h        2014-10-26 20:20:31 UTC (rev 175210)
+++ trunk/Source/WebCore/rendering/RenderObject.h        2014-10-26 22:25:00 UTC (rev 175211)
</span><span class="lines">@@ -245,12 +245,6 @@
</span><span class="cx"> // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
</span><span class="cx"> // children.
</span><span class="cx"> virtual RenderBlock* firstLineBlock() const;
</span><del>-
- // Called when an object that was floating or positioned becomes a normal flow object
- // again. We have to make sure the render tree updates as needed to accommodate the new
- // normal flow object.
- void handleDynamicFloatPositionChange();
- void removeAnonymousWrappersForInlinesIfNecessary();
</del><span class="cx">
</span><span class="cx"> // RenderObject tree manipulation
</span><span class="cx"> //////////////////////////////////////////
</span></span></pre>
</div>
</div>
</body>
</html>