<!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>[200738] branches/safari-601-branch/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/200738">200738</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2016-05-11 19:56:39 -0700 (Wed, 11 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/198701">r198701</a>. rdar://problem/26228577</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601branchSourceWebCoreChangeLog">branches/safari-601-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari601branchSourceWebCoredomElementcpp">branches/safari-601-branch/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#branchessafari601branchSourceWebCorerenderingLogicalSelectionOffsetCachesh">branches/safari-601-branch/Source/WebCore/rendering/LogicalSelectionOffsetCaches.h</a></li>
<li><a href="#branchessafari601branchSourceWebCorerenderingRenderElementcpp">branches/safari-601-branch/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#branchessafari601branchSourceWebCorerenderingRenderElementh">branches/safari-601-branch/Source/WebCore/rendering/RenderElement.h</a></li>
<li><a href="#branchessafari601branchSourceWebCorerenderingRenderObjectcpp">branches/safari-601-branch/Source/WebCore/rendering/RenderObject.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebCore/ChangeLog (200737 => 200738)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebCore/ChangeLog        2016-05-12 02:13:51 UTC (rev 200737)
+++ branches/safari-601-branch/Source/WebCore/ChangeLog        2016-05-12 02:56:39 UTC (rev 200738)
</span><span class="lines">@@ -1,5 +1,40 @@
</span><span class="cx"> 2016-05-11 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r198701. rdar://problem/26228577
+
+ 2016-03-25 Zalan Bujtas <zalan@apple.com>
+
+ RenderImage::repaintOrMarkForLayout fails when the renderer is detached.
+ https://bugs.webkit.org/show_bug.cgi?id=155885
+ <rdar://problem/25359164>
+
+ Reviewed by Simon Fraser.
+
+ Making containingBlockFor* functions standalone ensures that we don't
+ call them on an invalid object.
+
+ Covered by existing tests.
+
+ * dom/Element.cpp:
+ (WebCore::layoutOverflowRectContainsAllDescendants):
+ * rendering/LogicalSelectionOffsetCaches.h:
+ (WebCore::LogicalSelectionOffsetCaches::LogicalSelectionOffsetCaches):
+ * rendering/RenderElement.cpp:
+ (WebCore::containingBlockForFixedPosition):
+ (WebCore::containingBlockForAbsolutePosition):
+ (WebCore::containingBlockForObjectInFlow):
+ (WebCore::RenderElement::containingBlockForFixedPosition): Deleted.
+ (WebCore::RenderElement::containingBlockForAbsolutePosition): Deleted.
+ (WebCore::isNonRenderBlockInline): Deleted.
+ (WebCore::RenderElement::containingBlockForObjectInFlow): Deleted.
+ * rendering/RenderElement.h:
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::styleWillChange):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::containingBlock):
+
+2016-05-11 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r198143. rdar://problem/26228593
</span><span class="cx">
</span><span class="cx"> 2016-03-14 Chris Vienneau <chris.vno@outlook.com>
</span></span></pre></div>
<a id="branchessafari601branchSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebCore/dom/Element.cpp (200737 => 200738)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebCore/dom/Element.cpp        2016-05-12 02:13:51 UTC (rev 200737)
+++ branches/safari-601-branch/Source/WebCore/dom/Element.cpp        2016-05-12 02:56:39 UTC (rev 200738)
</span><span class="lines">@@ -948,7 +948,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // This renderer may have positioned descendants whose containing block is some ancestor.
</span><del>- if (auto containingBlock = renderer.containingBlockForAbsolutePosition()) {
</del><ins>+ if (auto containingBlock = containingBlockForAbsolutePosition(&renderer)) {
</ins><span class="cx"> if (auto positionedObjects = containingBlock->positionedObjects()) {
</span><span class="cx"> for (RenderBox* it : *positionedObjects) {
</span><span class="cx"> if (it != &renderer && renderer.element()->contains(it->element()))
</span></span></pre></div>
<a id="branchessafari601branchSourceWebCorerenderingLogicalSelectionOffsetCachesh"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebCore/rendering/LogicalSelectionOffsetCaches.h (200737 => 200738)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebCore/rendering/LogicalSelectionOffsetCaches.h        2016-05-12 02:13:51 UTC (rev 200737)
+++ branches/safari-601-branch/Source/WebCore/rendering/LogicalSelectionOffsetCaches.h        2016-05-12 02:56:39 UTC (rev 200738)
</span><span class="lines">@@ -91,9 +91,9 @@
</span><span class="cx"> auto parent = rootBlock.parent();
</span><span class="cx">
</span><span class="cx"> // LogicalSelectionOffsetCaches should not be used on an orphaned tree.
</span><del>- m_containingBlockForFixedPosition.setBlock(parent->containingBlockForFixedPosition(), nullptr);
- m_containingBlockForAbsolutePosition.setBlock(parent->containingBlockForAbsolutePosition(), nullptr);
- m_containingBlockForInflowPosition.setBlock(parent->containingBlockForObjectInFlow(), nullptr);
</del><ins>+ m_containingBlockForFixedPosition.setBlock(containingBlockForFixedPosition(parent), nullptr);
+ m_containingBlockForAbsolutePosition.setBlock(containingBlockForAbsolutePosition(parent), nullptr);
+ m_containingBlockForInflowPosition.setBlock(containingBlockForObjectInFlow(parent), nullptr);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> LogicalSelectionOffsetCaches(RenderBlock& block, const LogicalSelectionOffsetCaches& cache)
</span></span></pre></div>
<a id="branchessafari601branchSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebCore/rendering/RenderElement.cpp (200737 => 200738)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebCore/rendering/RenderElement.cpp        2016-05-12 02:13:51 UTC (rev 200737)
+++ branches/safari-601-branch/Source/WebCore/rendering/RenderElement.cpp        2016-05-12 02:56:39 UTC (rev 200738)
</span><span class="lines">@@ -1515,48 +1515,6 @@
</span><span class="cx"> return document().ensureStyleResolver().pseudoStyleForElement(element(), pseudoStyleRequest, parentStyle);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RenderBlock* RenderElement::containingBlockForFixedPosition() const
-{
- const RenderElement* object = this;
- while (object && !object->canContainFixedPositionObjects())
- object = object->parent();
-
- ASSERT(!object || !object->isAnonymousBlock());
- return const_cast<RenderBlock*>(downcast<RenderBlock>(object));
-}
-
-RenderBlock* RenderElement::containingBlockForAbsolutePosition() const
-{
- const RenderElement* object = this;
- while (object && !object->canContainAbsolutelyPositionedObjects())
- object = object->parent();
-
- // For a relatively positioned inline, return its nearest non-anonymous containing block,
- // not the inline itself, to avoid having a positioned objects list in all RenderInlines
- // and use RenderBlock* as RenderElement::containingBlock's return type.
- // Use RenderBlock::container() to obtain the inline.
- if (object && !is<RenderBlock>(*object))
- object = object->containingBlock();
-
- while (object && object->isAnonymousBlock())
- object = object->containingBlock();
-
- return const_cast<RenderBlock*>(downcast<RenderBlock>(object));
-}
-
-static inline bool isNonRenderBlockInline(const RenderElement& object)
-{
- return (object.isInline() && !object.isReplaced()) || !object.isRenderBlock();
-}
-
-RenderBlock* RenderElement::containingBlockForObjectInFlow() const
-{
- const RenderElement* object = this;
- while (object && isNonRenderBlockInline(*object))
- object = object->parent();
- return const_cast<RenderBlock*>(downcast<RenderBlock>(object));
-}
-
</del><span class="cx"> Color RenderElement::selectionColor(int colorProperty) const
</span><span class="cx"> {
</span><span class="cx"> // If the element is unselectable, or we are only painting the selection,
</span><span class="lines">@@ -1741,7 +1699,7 @@
</span><span class="cx"> return current;
</span><span class="cx"> if (!current->isRenderInline() || current->isRubyText())
</span><span class="cx"> return nullptr;
</span><del>-
</del><ins>+
</ins><span class="cx"> const RenderStyle& styleToUse = firstLine ? current->firstLineStyle() : current->style();
</span><span class="cx"> if (styleToUse.textDecoration() & textDecoration)
</span><span class="cx"> return current;
</span><span class="lines">@@ -1751,4 +1709,41 @@
</span><span class="cx"> return current;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RenderBlock* containingBlockForFixedPosition(const RenderElement* element)
+{
+ const auto* object = element;
+ while (object && !object->canContainFixedPositionObjects())
+ object = object->parent();
+
+ ASSERT(!object || !object->isAnonymousBlock());
+ return const_cast<RenderBlock*>(downcast<RenderBlock>(object));
</ins><span class="cx"> }
</span><ins>+
+RenderBlock* containingBlockForAbsolutePosition(const RenderElement* element)
+{
+ const auto* object = element;
+ while (object && !object->canContainAbsolutelyPositionedObjects())
+ object = object->parent();
+
+ // For a relatively positioned inline, return its nearest non-anonymous containing block,
+ // not the inline itself, to avoid having a positioned objects list in all RenderInlines
+ // and use RenderBlock* as RenderElement::containingBlock's return type.
+ // Use RenderBlock::container() to obtain the inline.
+ if (object && !is<RenderBlock>(*object))
+ object = object->containingBlock();
+
+ while (object && object->isAnonymousBlock())
+ object = object->containingBlock();
+
+ return const_cast<RenderBlock*>(downcast<RenderBlock>(object));
+}
+
+RenderBlock* containingBlockForObjectInFlow(const RenderElement* element)
+{
+ const auto* object = element;
+ while (object && ((object->isInline() && !object->isReplaced()) || !object->isRenderBlock()))
+ object = object->parent();
+ return const_cast<RenderBlock*>(downcast<RenderBlock>(object));
+}
+
+}
</ins></span></pre></div>
<a id="branchessafari601branchSourceWebCorerenderingRenderElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebCore/rendering/RenderElement.h (200737 => 200738)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebCore/rendering/RenderElement.h        2016-05-12 02:13:51 UTC (rev 200737)
+++ branches/safari-601-branch/Source/WebCore/rendering/RenderElement.h        2016-05-12 02:56:39 UTC (rev 200738)
</span><span class="lines">@@ -70,10 +70,6 @@
</span><span class="cx"> bool canContainFixedPositionObjects() const;
</span><span class="cx"> bool canContainAbsolutelyPositionedObjects() const;
</span><span class="cx">
</span><del>- RenderBlock* containingBlockForFixedPosition() const;
- RenderBlock* containingBlockForAbsolutePosition() const;
- RenderBlock* containingBlockForObjectInFlow() const;
-
</del><span class="cx"> Color selectionColor(int colorProperty) const;
</span><span class="cx"> PassRefPtr<RenderStyle> selectionPseudoStyle() const;
</span><span class="cx">
</span><span class="lines">@@ -481,6 +477,9 @@
</span><span class="cx"> return adjustLayoutUnitForAbsoluteZoom(value, renderer.style());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RenderBlock* containingBlockForFixedPosition(const RenderElement*);
+RenderBlock* containingBlockForAbsolutePosition(const RenderElement*);
+RenderBlock* containingBlockForObjectInFlow(const RenderElement*);
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderElement, isRenderElement())
</span></span></pre></div>
<a id="branchessafari601branchSourceWebCorerenderingRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebCore/rendering/RenderObject.cpp (200737 => 200738)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebCore/rendering/RenderObject.cpp        2016-05-12 02:13:51 UTC (rev 200737)
+++ branches/safari-601-branch/Source/WebCore/rendering/RenderObject.cpp        2016-05-12 02:56:39 UTC (rev 200738)
</span><span class="lines">@@ -696,15 +696,15 @@
</span><span class="cx">
</span><span class="cx"> const RenderStyle& style = this->style();
</span><span class="cx"> if (!is<RenderText>(*this) && style.position() == FixedPosition)
</span><del>- parent = parent->containingBlockForFixedPosition();
</del><ins>+ parent = containingBlockForFixedPosition(parent);
</ins><span class="cx"> else if (!is<RenderText>(*this) && style.position() == AbsolutePosition)
</span><del>- parent = parent->containingBlockForAbsolutePosition();
</del><ins>+ parent = containingBlockForAbsolutePosition(parent);
</ins><span class="cx"> else
</span><del>- parent = parent->containingBlockForObjectInFlow();
</del><ins>+ parent = containingBlockForObjectInFlow(parent);
</ins><span class="cx">
</span><del>- if (!is<RenderBlock>(parent))
- return nullptr; // This can still happen in case of an orphaned tree
-
</del><ins>+ // This can still happen in case of an detached tree
+ if (!parent)
+ return nullptr;
</ins><span class="cx"> return downcast<RenderBlock>(parent);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>