<!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>[171807] branches/safari-600.1-branch</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/171807">171807</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2014-07-30 13:26:34 -0700 (Wed, 30 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/171718">r171718</a>. <rdar://problem/17824793></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6001branchLayoutTestsChangeLog">branches/safari-600.1-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6001branchSourceWebCoreChangeLog">branches/safari-600.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6001branchSourceWebCoreeditingFrameSelectioncpp">branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.cpp</a></li>
<li><a href="#branchessafari6001branchSourceWebCoreeditingFrameSelectionh">branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.h</a></li>
<li><a href="#branchessafari6001branchSourceWebCorepageFrameViewcpp">branches/safari-600.1-branch/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#branchessafari6001branchSourceWebCorerenderingRenderBlockFlowcpp">branches/safari-600.1-branch/Source/WebCore/rendering/RenderBlockFlow.cpp</a></li>
<li><a href="#branchessafari6001branchSourceWebCorerenderingRenderElementcpp">branches/safari-600.1-branch/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#branchessafari6001branchSourceWebCorerenderingRenderInlinecpp">branches/safari-600.1-branch/Source/WebCore/rendering/RenderInline.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6001branchLayoutTestsfastdynamicselectiongetsclearedwhenpartofitgetsremovedexpectedhtml">branches/safari-600.1-branch/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed-expected.html</a></li>
<li><a href="#branchessafari6001branchLayoutTestsfastdynamicselectiongetsclearedwhenpartofitgetsremovedhtml">branches/safari-600.1-branch/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6001branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/LayoutTests/ChangeLog (171806 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/LayoutTests/ChangeLog        2014-07-30 20:15:50 UTC (rev 171806)
+++ branches/safari-600.1-branch/LayoutTests/ChangeLog        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-07-30 Lucas Forschler <lforschler@apple.com>
+
+ Merge r171718
+
+ 2014-07-28 Zalan Bujtas <zalan@apple.com>
+
+ REGRESSION(r164133): Selection disappears after scrolling on nytimes.com
+ https://bugs.webkit.org/show_bug.cgi?id=135361
+
+ Reviewed by Ryosuke Niwa.
+
+ Ensure that when a RenderElement, part of the current selection is removed,
+ we recalculate and update the selection soon after layout.
+
+ * fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed-expected.html: Added.
+ * fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html: Added.
+
</ins><span class="cx"> 2014-07-29 Lucas Forschler <lforschler@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r171675
</span></span></pre></div>
<a id="branchessafari6001branchLayoutTestsfastdynamicselectiongetsclearedwhenpartofitgetsremovedexpectedhtmlfromrev171718trunkLayoutTestsfastdynamicselectiongetsclearedwhenpartofitgetsremovedexpectedhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1-branch/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed-expected.html (from rev 171718, trunk/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed-expected.html) (0 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed-expected.html         (rev 0)
+++ branches/safari-600.1-branch/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed-expected.html        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<!DOCTYPE html>
+<head>
+ <title>This tests that selection stays on when part of the selection gets removed.</title>
+</head>
+<body>
+ This should still be selected.
+ <script>
+ var range = document.createRange();
+ range.selectNode(document.body);
+ window.getSelection().addRange(range);
+ </script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari6001branchLayoutTestsfastdynamicselectiongetsclearedwhenpartofitgetsremovedhtmlfromrev171718trunkLayoutTestsfastdynamicselectiongetsclearedwhenpartofitgetsremovedhtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1-branch/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html (from rev 171718, trunk/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html) (0 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html         (rev 0)
+++ branches/safari-600.1-branch/LayoutTests/fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+<!DOCTYPE html>
+<head>
+ <title>This tests that selection stays on when part of the selection gets removed.</title>
+</head>
+<body>
+ <div id=foo>When this text disappears, selection clears too.</div>
+ This should still be selected.
+ <script>
+ if (window.testRunner)
+ window.testRunner.waitUntilDone();
+
+ var range = document.createRange();
+ range.selectNode(document.body);
+ window.getSelection().addRange(range);
+
+ function select() {
+ document.getElementById("foo").style.display = "none";
+ if (window.testRunner)
+ window.testRunner.notifyDone();
+ }
+
+ setTimeout(select, 0);
+ </script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari6001branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/ChangeLog (171806 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/ChangeLog        2014-07-30 20:15:50 UTC (rev 171806)
+++ branches/safari-600.1-branch/Source/WebCore/ChangeLog        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2014-07-30 Lucas Forschler <lforschler@apple.com>
+
+ Merge r171718
+
+ 2014-07-28 Zalan Bujtas <zalan@apple.com>
+
+ REGRESSION(r164133): Selection disappears after scrolling on nytimes.com
+ https://bugs.webkit.org/show_bug.cgi?id=135361
+
+ Reviewed by Ryosuke Niwa.
+
+ Ensure that when a RenderElement, part of the current selection is removed,
+ we recalculate and update the selection soon after layout.
+
+ Test: fast/dynamic/selection-gets-cleared-when-part-of-it-gets-removed.html
+
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::setNeedsSelectionUpdate):
+ (WebCore::FrameSelection::didLayout): didLayout name reflects its functionality better.
+ (WebCore::FrameSelection::layoutDidChange): Deleted.
+ * editing/FrameSelection.h: : move some functions to private.
+ * page/FrameView.cpp:
+ (WebCore::FrameView::performPostLayoutTasks):
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::willBeDestroyed):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::removeChildInternal):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::willBeDestroyed):
+
</ins><span class="cx"> 2014-07-29 Lucas Forschler <lforschler@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r171711
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCoreeditingFrameSelectioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.cpp (171806 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.cpp        2014-07-30 20:15:50 UTC (rev 171806)
+++ branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.cpp        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -352,6 +352,13 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void FrameSelection::setNeedsSelectionUpdate()
+{
+ m_pendingSelectionUpdate = true;
+ if (RenderView* view = m_frame->contentRenderer())
+ view->clearSelection();
+}
+
</ins><span class="cx"> void FrameSelection::updateAndRevealSelection()
</span><span class="cx"> {
</span><span class="cx"> if (!m_pendingSelectionUpdate)
</span><span class="lines">@@ -2141,7 +2148,7 @@
</span><span class="cx"> updateAppearance();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void FrameSelection::layoutDidChange()
</del><ins>+void FrameSelection::didLayout()
</ins><span class="cx"> {
</span><span class="cx"> setCaretRectNeedsUpdate();
</span><span class="cx"> updateAndRevealSelection();
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCoreeditingFrameSelectionh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.h (171806 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.h        2014-07-30 20:15:50 UTC (rev 171806)
+++ branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.h        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -144,14 +144,13 @@
</span><span class="cx">
</span><span class="cx"> const VisibleSelection& selection() const { return m_selection; }
</span><span class="cx"> void setSelection(const VisibleSelection&, SetSelectionOptions = defaultSetSelectionOptions(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
</span><del>- void updateAndRevealSelection();
- void updateDataDetectorsForSelection();
</del><span class="cx"> bool setSelectedRange(Range*, EAffinity, bool closeTyping);
</span><span class="cx"> void selectAll();
</span><span class="cx"> void clear();
</span><span class="cx"> void prepareForDestruction();
</span><span class="cx">
</span><del>- void layoutDidChange();
</del><ins>+ void didLayout();
+ void setNeedsSelectionUpdate();
</ins><span class="cx">
</span><span class="cx"> bool contains(const LayoutPoint&);
</span><span class="cx">
</span><span class="lines">@@ -272,6 +271,9 @@
</span><span class="cx"> private:
</span><span class="cx"> enum EPositionType { START, END, BASE, EXTENT };
</span><span class="cx">
</span><ins>+ void updateAndRevealSelection();
+ void updateDataDetectorsForSelection();
+
</ins><span class="cx"> bool setSelectionWithoutUpdatingAppearance(const VisibleSelection&, SetSelectionOptions, CursorAlignOnScroll, TextGranularity);
</span><span class="cx">
</span><span class="cx"> void respondToNodeModification(Node*, bool baseRemoved, bool extentRemoved, bool startRemoved, bool endRemoved);
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/page/FrameView.cpp (171806 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/page/FrameView.cpp        2014-07-30 20:15:50 UTC (rev 171806)
+++ branches/safari-600.1-branch/Source/WebCore/page/FrameView.cpp        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -2816,7 +2816,7 @@
</span><span class="cx">
</span><span class="cx"> m_postLayoutTasksTimer.stop();
</span><span class="cx">
</span><del>- frame().selection().layoutDidChange();
</del><ins>+ frame().selection().didLayout();
</ins><span class="cx">
</span><span class="cx"> if (m_nestedLayoutCount <= 1 && frame().document()->documentElement())
</span><span class="cx"> fireLayoutRelatedMilestonesIfNeeded();
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/rendering/RenderBlockFlow.cpp (171806 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-07-30 20:15:50 UTC (rev 171806)
+++ branches/safari-600.1-branch/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include "Editor.h"
</span><span class="cx"> #include "FloatingObjects.h"
</span><span class="cx"> #include "Frame.h"
</span><ins>+#include "FrameSelection.h"
</ins><span class="cx"> #include "HTMLElement.h"
</span><span class="cx"> #include "HitTestLocation.h"
</span><span class="cx"> #include "InlineTextBox.h"
</span><span class="lines">@@ -162,10 +163,8 @@
</span><span class="cx"> if (firstRootBox()) {
</span><span class="cx"> // We can't wait for RenderBox::destroy to clear the selection,
</span><span class="cx"> // because by then we will have nuked the line boxes.
</span><del>- // FIXME: The FrameSelection should be responsible for this when it
- // is notified of DOM mutations.
</del><span class="cx"> if (isSelectionBorder())
</span><del>- view().clearSelection();
</del><ins>+ frame().selection().setNeedsSelectionUpdate();
</ins><span class="cx">
</span><span class="cx"> // If we are an anonymous block, then our line boxes might have children
</span><span class="cx"> // that will outlast this block. In the non-anonymous block case those
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/rendering/RenderElement.cpp (171806 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/rendering/RenderElement.cpp        2014-07-30 20:15:50 UTC (rev 171806)
+++ branches/safari-600.1-branch/Source/WebCore/rendering/RenderElement.cpp        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "CursorList.h"
</span><span class="cx"> #include "EventHandler.h"
</span><span class="cx"> #include "Frame.h"
</span><ins>+#include "FrameSelection.h"
</ins><span class="cx"> #include "HTMLElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "FlowThreadController.h"
</span><span class="lines">@@ -607,10 +608,8 @@
</span><span class="cx">
</span><span class="cx"> // If oldChild is the start or end of the selection, then clear the selection to
</span><span class="cx"> // avoid problems of invalid pointers.
</span><del>- // FIXME: The FrameSelection should be responsible for this when it
- // is notified of DOM mutations.
</del><span class="cx"> if (!documentBeingDestroyed() && oldChild.isSelectionBorder())
</span><del>- view().clearSelection();
</del><ins>+ frame().selection().setNeedsSelectionUpdate();
</ins><span class="cx">
</span><span class="cx"> if (!documentBeingDestroyed() && notifyChildren == NotifyChildren)
</span><span class="cx"> oldChild.willBeRemovedFromTree();
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCorerenderingRenderInlinecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/rendering/RenderInline.cpp (171806 => 171807)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/rendering/RenderInline.cpp        2014-07-30 20:15:50 UTC (rev 171806)
+++ branches/safari-600.1-branch/Source/WebCore/rendering/RenderInline.cpp        2014-07-30 20:26:34 UTC (rev 171807)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">
</span><span class="cx"> #include "Chrome.h"
</span><span class="cx"> #include "FloatQuad.h"
</span><ins>+#include "FrameSelection.h"
</ins><span class="cx"> #include "GraphicsContext.h"
</span><span class="cx"> #include "HitTestResult.h"
</span><span class="cx"> #include "InlineElementBox.h"
</span><span class="lines">@@ -93,10 +94,8 @@
</span><span class="cx"> if (firstLineBox()) {
</span><span class="cx"> // We can't wait for RenderBoxModelObject::destroy to clear the selection,
</span><span class="cx"> // because by then we will have nuked the line boxes.
</span><del>- // FIXME: The FrameSelection should be responsible for this when it
- // is notified of DOM mutations.
</del><span class="cx"> if (isSelectionBorder())
</span><del>- view().clearSelection();
</del><ins>+ frame().selection().setNeedsSelectionUpdate();
</ins><span class="cx">
</span><span class="cx"> // If line boxes are contained inside a root, that means we're an inline.
</span><span class="cx"> // In that case, we need to remove all the line boxes so that the parent
</span></span></pre>
</div>
</div>
</body>
</html>