Source/WebCore/ChangeLog

 12014-04-24 Darin Adler <darin@apple.com>
 2
 3 REGRESSION (r164133): Selection doesn't paint when scrolling some pages
 4 https://bugs.webkit.org/show_bug.cgi?id=132172
 5 rdar://problem/16719473
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 Tests: fast/dynamic/remove-invisible-node-inside-selection.html
 10 fast/dynamic/remove-node-inside-selection.html
 11
 12 * editing/FrameSelection.cpp:
 13 (WebCore::clearRenderViewSelection): Changed to take a Node& because having
 14 this take a Position& was unnecessary and strange, when really it just needs
 15 to take a document as an argument.
 16 (WebCore::DragCaretController::nodeWillBeRemoved): Updated for the above.
 17 (WebCore::FrameSelection::respondToNodeModification): Added code to set the
 18 m_pendingSelectionUpdate flag and call RenderView::setNeedsLayout so the
 19 selection will be recomputed after it's temporarily cleared when one of
 20 the selected nodes is removed.
 21
1222014-04-24 Gyuyoung Kim <gyuyoung.kim@samsung.com>
223
324 Mark Supplement instead of RefCountedSupplement in NavigatorContentUtils

Source/WebCore/editing/FrameSelection.cpp

@@static bool removingNodeRemovesPosition(Node* node, const Position& position)
390390 return element->containsIncludingShadowDOM(position.anchorNode());
391391}
392392
393 static void clearRenderViewSelection(const Position& position)
 393static void clearRenderViewSelection(Node& node)
394394{
395  Ref<Document> document(position.anchorNode()->document());
 395 Ref<Document> document(node.document());
396396 document->updateStyleIfNeeded();
397397 if (RenderView* view = document->renderView())
398398 view->clearSelection();

@@void DragCaretController::nodeWillBeRemoved(Node* node)
406406 if (!removingNodeRemovesPosition(node, m_position.deepEquivalent()))
407407 return;
408408
409  clearRenderViewSelection(m_position.deepEquivalent());
 409 clearRenderViewSelection(*node);
410410 clear();
411411}
412412

@@void FrameSelection::respondToNodeModification(Node* node, bool baseRemoved, boo
464464 }
465465 }
466466
467  if (clearRenderTreeSelection)
468  clearRenderViewSelection(m_selection.start());
 467 if (clearRenderTreeSelection) {
 468 clearRenderViewSelection(*node);
 469
 470 // Trigger a selection update so the selection will be set again.
 471 if (auto* renderView = node->document().renderView()) {
 472 m_pendingSelectionUpdate = true;
 473 renderView->setNeedsLayout();
 474 }
 475 }
469476
470477 if (clearDOMTreeSelection)
471478 setSelection(VisibleSelection(), DoNotSetFocus);

LayoutTests/ChangeLog

 12014-04-24 Darin Adler <darin@apple.com>
 2
 3 REGRESSION (r164133): Selection doesn't paint when scrolling some pages
 4 https://bugs.webkit.org/show_bug.cgi?id=132172
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * fast/dynamic/remove-invisible-node-inside-selection-expected.html: Added.
 9 * fast/dynamic/remove-invisible-node-inside-selection.html: Added.
 10 * fast/dynamic/remove-node-inside-selection-expected.html: Added.
 11 * fast/dynamic/remove-node-inside-selection.html: Added.
 12
1132014-04-24 Commit Queue <commit-queue@webkit.org>
214
315 Unreviewed, rolling out r167441.

LayoutTests/fast/dynamic/remove-invisible-node-inside-selection-expected.html

 1<p id="paragraph">This test checks to see if removing a word causes the painted color of a selection to disappear. There is an extra word that is removed and the test passes if everything looks selected as it should.</p>
 2<script>
 3 var paragraph = document.getElementById("paragraph");
 4 getSelection().setBaseAndExtent(paragraph, 0, paragraph, paragraph.childNodes.length);
 5</script>

LayoutTests/fast/dynamic/remove-invisible-node-inside-selection.html

 1<p id="paragraph">This test checks to see if removing a word causes the painted color of a selection to disappear. There is an extra word <b id="word" style="display:none">word </b>that is removed and the test passes if everything looks selected as it should.</p>
 2<script>
 3 var paragraph = document.getElementById("paragraph");
 4 getSelection().setBaseAndExtent(paragraph, 0, paragraph, paragraph.childNodes.length);
 5 paragraph.removeChild(document.getElementById("word"));
 6</script>

LayoutTests/fast/dynamic/remove-node-inside-selection-expected.html

 1<p id="paragraph">This test checks to see if removing a word causes the painted color of a selection to disappear. There is an extra word that is removed and the test passes if everything looks selected as it should.</p>
 2<script>
 3 var paragraph = document.getElementById("paragraph");
 4 getSelection().setBaseAndExtent(paragraph, 0, paragraph, paragraph.childNodes.length);
 5</script>

LayoutTests/fast/dynamic/remove-node-inside-selection.html

 1<p id="paragraph">This test checks to see if removing a word causes the painted color of a selection to disappear. There is an extra word <b id="word">word </b>that is removed and the test passes if everything looks selected as it should.</p>
 2<script>
 3 var paragraph = document.getElementById("paragraph");
 4 getSelection().setBaseAndExtent(paragraph, 0, paragraph, paragraph.childNodes.length);
 5 paragraph.removeChild(document.getElementById("word"));
 6</script>