- Revision
- 167845
- Author
- [email protected]
- Date
- 2014-04-26 14:28:20 -0700 (Sat, 26 Apr 2014)
Log Message
REGRESSION (r164133): Selection doesn't paint when scrolling some pages
https://bugs.webkit.org/show_bug.cgi?id=132172
Source/WebCore:
rdar://problem/16719473
Reviewed by Brent Fulgham.
Tests: fast/dynamic/remove-invisible-node-inside-selection.html
fast/dynamic/remove-node-inside-selection.html
* editing/FrameSelection.cpp:
(WebCore::clearRenderViewSelection): Changed to take a Node& because having
this take a Position& was unnecessary and strange, when really it just needs
to take a document as an argument.
(WebCore::DragCaretController::nodeWillBeRemoved): Updated for the above.
(WebCore::FrameSelection::respondToNodeModification): Added code to set the
m_pendingSelectionUpdate flag and call RenderView::setNeedsLayout so the
selection will be recomputed after it's temporarily cleared when one of
the selected nodes is removed.
LayoutTests:
Reviewed by Brent Fulgham.
* fast/dynamic/remove-invisible-node-inside-selection-expected.html: Added.
* fast/dynamic/remove-invisible-node-inside-selection.html: Added.
* fast/dynamic/remove-node-inside-selection-expected.html: Added.
* fast/dynamic/remove-node-inside-selection.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (167844 => 167845)
--- trunk/LayoutTests/ChangeLog 2014-04-26 19:15:40 UTC (rev 167844)
+++ trunk/LayoutTests/ChangeLog 2014-04-26 21:28:20 UTC (rev 167845)
@@ -1,3 +1,15 @@
+2014-04-24 Darin Adler <[email protected]>
+
+ REGRESSION (r164133): Selection doesn't paint when scrolling some pages
+ https://bugs.webkit.org/show_bug.cgi?id=132172
+
+ Reviewed by Brent Fulgham.
+
+ * fast/dynamic/remove-invisible-node-inside-selection-expected.html: Added.
+ * fast/dynamic/remove-invisible-node-inside-selection.html: Added.
+ * fast/dynamic/remove-node-inside-selection-expected.html: Added.
+ * fast/dynamic/remove-node-inside-selection.html: Added.
+
2014-04-25 Ryosuke Niwa <[email protected]>
REGRESSION (r167689): Hovering file name in a file input causes a crash
Added: trunk/LayoutTests/fast/dynamic/remove-invisible-node-inside-selection-expected.html (0 => 167845)
--- trunk/LayoutTests/fast/dynamic/remove-invisible-node-inside-selection-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dynamic/remove-invisible-node-inside-selection-expected.html 2014-04-26 21:28:20 UTC (rev 167845)
@@ -0,0 +1,5 @@
+<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>
+<script>
+ var paragraph = document.getElementById("paragraph");
+ getSelection().setBaseAndExtent(paragraph, 0, paragraph, paragraph.childNodes.length);
+</script>
Property changes on: trunk/LayoutTests/fast/dynamic/remove-invisible-node-inside-selection-expected.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Added: trunk/LayoutTests/fast/dynamic/remove-invisible-node-inside-selection.html (0 => 167845)
--- trunk/LayoutTests/fast/dynamic/remove-invisible-node-inside-selection.html (rev 0)
+++ trunk/LayoutTests/fast/dynamic/remove-invisible-node-inside-selection.html 2014-04-26 21:28:20 UTC (rev 167845)
@@ -0,0 +1,6 @@
+<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>
+<script>
+ var paragraph = document.getElementById("paragraph");
+ getSelection().setBaseAndExtent(paragraph, 0, paragraph, paragraph.childNodes.length);
+ paragraph.removeChild(document.getElementById("word"));
+</script>
Property changes on: trunk/LayoutTests/fast/dynamic/remove-invisible-node-inside-selection.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Added: trunk/LayoutTests/fast/dynamic/remove-node-inside-selection-expected.html (0 => 167845)
--- trunk/LayoutTests/fast/dynamic/remove-node-inside-selection-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dynamic/remove-node-inside-selection-expected.html 2014-04-26 21:28:20 UTC (rev 167845)
@@ -0,0 +1,5 @@
+<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>
+<script>
+ var paragraph = document.getElementById("paragraph");
+ getSelection().setBaseAndExtent(paragraph, 0, paragraph, paragraph.childNodes.length);
+</script>
Property changes on: trunk/LayoutTests/fast/dynamic/remove-node-inside-selection-expected.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Added: trunk/LayoutTests/fast/dynamic/remove-node-inside-selection.html (0 => 167845)
--- trunk/LayoutTests/fast/dynamic/remove-node-inside-selection.html (rev 0)
+++ trunk/LayoutTests/fast/dynamic/remove-node-inside-selection.html 2014-04-26 21:28:20 UTC (rev 167845)
@@ -0,0 +1,6 @@
+<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>
+<script>
+ var paragraph = document.getElementById("paragraph");
+ getSelection().setBaseAndExtent(paragraph, 0, paragraph, paragraph.childNodes.length);
+ paragraph.removeChild(document.getElementById("word"));
+</script>
Property changes on: trunk/LayoutTests/fast/dynamic/remove-node-inside-selection.html
___________________________________________________________________
Added: svn:mime-type
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (167844 => 167845)
--- trunk/Source/WebCore/ChangeLog 2014-04-26 19:15:40 UTC (rev 167844)
+++ trunk/Source/WebCore/ChangeLog 2014-04-26 21:28:20 UTC (rev 167845)
@@ -1,3 +1,24 @@
+2014-04-24 Darin Adler <[email protected]>
+
+ REGRESSION (r164133): Selection doesn't paint when scrolling some pages
+ https://bugs.webkit.org/show_bug.cgi?id=132172
+ rdar://problem/16719473
+
+ Reviewed by Brent Fulgham.
+
+ Tests: fast/dynamic/remove-invisible-node-inside-selection.html
+ fast/dynamic/remove-node-inside-selection.html
+
+ * editing/FrameSelection.cpp:
+ (WebCore::clearRenderViewSelection): Changed to take a Node& because having
+ this take a Position& was unnecessary and strange, when really it just needs
+ to take a document as an argument.
+ (WebCore::DragCaretController::nodeWillBeRemoved): Updated for the above.
+ (WebCore::FrameSelection::respondToNodeModification): Added code to set the
+ m_pendingSelectionUpdate flag and call RenderView::setNeedsLayout so the
+ selection will be recomputed after it's temporarily cleared when one of
+ the selected nodes is removed.
+
2014-04-25 Ryosuke Niwa <[email protected]>
REGRESSION (r167689): Hovering file name in a file input causes a crash
Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (167844 => 167845)
--- trunk/Source/WebCore/editing/FrameSelection.cpp 2014-04-26 19:15:40 UTC (rev 167844)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp 2014-04-26 21:28:20 UTC (rev 167845)
@@ -390,9 +390,9 @@
return element->containsIncludingShadowDOM(position.anchorNode());
}
-static void clearRenderViewSelection(const Position& position)
+static void clearRenderViewSelection(Node& node)
{
- Ref<Document> document(position.anchorNode()->document());
+ Ref<Document> document(node.document());
document->updateStyleIfNeeded();
if (RenderView* view = document->renderView())
view->clearSelection();
@@ -406,7 +406,7 @@
if (!removingNodeRemovesPosition(node, m_position.deepEquivalent()))
return;
- clearRenderViewSelection(m_position.deepEquivalent());
+ clearRenderViewSelection(*node);
clear();
}
@@ -464,9 +464,16 @@
}
}
- if (clearRenderTreeSelection)
- clearRenderViewSelection(m_selection.start());
+ if (clearRenderTreeSelection) {
+ clearRenderViewSelection(*node);
+ // Trigger a selection update so the selection will be set again.
+ if (auto* renderView = node->document().renderView()) {
+ m_pendingSelectionUpdate = true;
+ renderView->setNeedsLayout();
+ }
+ }
+
if (clearDOMTreeSelection)
setSelection(VisibleSelection(), DoNotSetFocus);
}