Title: [171807] branches/safari-600.1-branch

Diff

Modified: branches/safari-600.1-branch/LayoutTests/ChangeLog (171806 => 171807)


--- 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)
@@ -1,3 +1,20 @@
+2014-07-30  Lucas Forschler  <[email protected]>
+
+        Merge r171718
+
+    2014-07-28  Zalan Bujtas  <[email protected]>
+
+            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.
+
 2014-07-29  Lucas Forschler  <[email protected]>
 
         Merge r171675

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)


--- 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)
@@ -0,0 +1,13 @@
+<!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>

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)


--- 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)
@@ -0,0 +1,25 @@
+<!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>

Modified: branches/safari-600.1-branch/Source/WebCore/ChangeLog (171806 => 171807)


--- 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)
@@ -1,3 +1,33 @@
+2014-07-30  Lucas Forschler  <[email protected]>
+
+        Merge r171718
+
+    2014-07-28  Zalan Bujtas  <[email protected]>
+
+            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):
+
 2014-07-29  Lucas Forschler  <[email protected]>
 
         Merge r171711

Modified: branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.cpp (171806 => 171807)


--- 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)
@@ -352,6 +352,13 @@
 #endif
 }
 
+void FrameSelection::setNeedsSelectionUpdate()
+{
+    m_pendingSelectionUpdate = true;
+    if (RenderView* view = m_frame->contentRenderer())
+        view->clearSelection();
+}
+
 void FrameSelection::updateAndRevealSelection()
 {
     if (!m_pendingSelectionUpdate)
@@ -2141,7 +2148,7 @@
     updateAppearance();
 }
 
-void FrameSelection::layoutDidChange()
+void FrameSelection::didLayout()
 {
     setCaretRectNeedsUpdate();
     updateAndRevealSelection();

Modified: branches/safari-600.1-branch/Source/WebCore/editing/FrameSelection.h (171806 => 171807)


--- 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)
@@ -144,14 +144,13 @@
 
     const VisibleSelection& selection() const { return m_selection; }
     void setSelection(const VisibleSelection&, SetSelectionOptions = defaultSetSelectionOptions(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
-    void updateAndRevealSelection();
-    void updateDataDetectorsForSelection();
     bool setSelectedRange(Range*, EAffinity, bool closeTyping);
     void selectAll();
     void clear();
     void prepareForDestruction();
 
-    void layoutDidChange();
+    void didLayout();
+    void setNeedsSelectionUpdate();
 
     bool contains(const LayoutPoint&);
 
@@ -272,6 +271,9 @@
 private:
     enum EPositionType { START, END, BASE, EXTENT };
 
+    void updateAndRevealSelection();
+    void updateDataDetectorsForSelection();
+
     bool setSelectionWithoutUpdatingAppearance(const VisibleSelection&, SetSelectionOptions, CursorAlignOnScroll, TextGranularity);
 
     void respondToNodeModification(Node*, bool baseRemoved, bool extentRemoved, bool startRemoved, bool endRemoved);

Modified: branches/safari-600.1-branch/Source/WebCore/page/FrameView.cpp (171806 => 171807)


--- 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)
@@ -2816,7 +2816,7 @@
 
     m_postLayoutTasksTimer.stop();
 
-    frame().selection().layoutDidChange();
+    frame().selection().didLayout();
 
     if (m_nestedLayoutCount <= 1 && frame().document()->documentElement())
         fireLayoutRelatedMilestonesIfNeeded();

Modified: branches/safari-600.1-branch/Source/WebCore/rendering/RenderBlockFlow.cpp (171806 => 171807)


--- 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)
@@ -27,6 +27,7 @@
 #include "Editor.h"
 #include "FloatingObjects.h"
 #include "Frame.h"
+#include "FrameSelection.h"
 #include "HTMLElement.h"
 #include "HitTestLocation.h"
 #include "InlineTextBox.h"
@@ -162,10 +163,8 @@
         if (firstRootBox()) {
             // We can't wait for RenderBox::destroy to clear the selection,
             // because by then we will have nuked the line boxes.
-            // FIXME: The FrameSelection should be responsible for this when it
-            // is notified of DOM mutations.
             if (isSelectionBorder())
-                view().clearSelection();
+                frame().selection().setNeedsSelectionUpdate();
 
             // If we are an anonymous block, then our line boxes might have children
             // that will outlast this block. In the non-anonymous block case those

Modified: branches/safari-600.1-branch/Source/WebCore/rendering/RenderElement.cpp (171806 => 171807)


--- 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)
@@ -31,6 +31,7 @@
 #include "CursorList.h"
 #include "EventHandler.h"
 #include "Frame.h"
+#include "FrameSelection.h"
 #include "HTMLElement.h"
 #include "HTMLNames.h"
 #include "FlowThreadController.h"
@@ -607,10 +608,8 @@
 
     // If oldChild is the start or end of the selection, then clear the selection to
     // avoid problems of invalid pointers.
-    // FIXME: The FrameSelection should be responsible for this when it
-    // is notified of DOM mutations.
     if (!documentBeingDestroyed() && oldChild.isSelectionBorder())
-        view().clearSelection();
+        frame().selection().setNeedsSelectionUpdate();
 
     if (!documentBeingDestroyed() && notifyChildren == NotifyChildren)
         oldChild.willBeRemovedFromTree();

Modified: branches/safari-600.1-branch/Source/WebCore/rendering/RenderInline.cpp (171806 => 171807)


--- 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)
@@ -25,6 +25,7 @@
 
 #include "Chrome.h"
 #include "FloatQuad.h"
+#include "FrameSelection.h"
 #include "GraphicsContext.h"
 #include "HitTestResult.h"
 #include "InlineElementBox.h"
@@ -93,10 +94,8 @@
         if (firstLineBox()) {
             // We can't wait for RenderBoxModelObject::destroy to clear the selection,
             // because by then we will have nuked the line boxes.
-            // FIXME: The FrameSelection should be responsible for this when it
-            // is notified of DOM mutations.
             if (isSelectionBorder())
-                view().clearSelection();
+                frame().selection().setNeedsSelectionUpdate();
 
             // If line boxes are contained inside a root, that means we're an inline.
             // In that case, we need to remove all the line boxes so that the parent
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to