Title: [240372] branches/safari-607-branch/Source/WebCore
Revision
240372
Author
alanc...@apple.com
Date
2019-01-23 17:20:56 -0800 (Wed, 23 Jan 2019)

Log Message

Cherry-pick r239971. rdar://problem/47458229

    Only run the node comparison code in FrameSelection::respondToNodeModification() for range selections
    https://bugs.webkit.org/show_bug.cgi?id=193416

    Reviewed by Wenson Hsieh.

    The code inside the m_selection.firstRange() clause needs to only run for non-collapsed selections, and
    it shows up on Speedometer profiles so optimize to only run this code if we have a selection range.

    * editing/FrameSelection.cpp:
    (WebCore::FrameSelection::respondToNodeModification):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239971 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (240371 => 240372)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-24 01:20:52 UTC (rev 240371)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-24 01:20:56 UTC (rev 240372)
@@ -1,3 +1,34 @@
+2019-01-23  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r239971. rdar://problem/47458229
+
+    Only run the node comparison code in FrameSelection::respondToNodeModification() for range selections
+    https://bugs.webkit.org/show_bug.cgi?id=193416
+    
+    Reviewed by Wenson Hsieh.
+    
+    The code inside the m_selection.firstRange() clause needs to only run for non-collapsed selections, and
+    it shows up on Speedometer profiles so optimize to only run this code if we have a selection range.
+    
+    * editing/FrameSelection.cpp:
+    (WebCore::FrameSelection::respondToNodeModification):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239971 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-01-14  Simon Fraser  <simon.fra...@apple.com>
+
+            Only run the node comparison code in FrameSelection::respondToNodeModification() for range selections
+            https://bugs.webkit.org/show_bug.cgi?id=193416
+
+            Reviewed by Wenson Hsieh.
+
+            The code inside the m_selection.firstRange() clause needs to only run for non-collapsed selections, and
+            it shows up on Speedometer profiles so optimize to only run this code if we have a selection range.
+
+            * editing/FrameSelection.cpp:
+            (WebCore::FrameSelection::respondToNodeModification):
+
 2019-01-22  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r240046. rdar://problem/47099573

Modified: branches/safari-607-branch/Source/WebCore/editing/FrameSelection.cpp (240371 => 240372)


--- branches/safari-607-branch/Source/WebCore/editing/FrameSelection.cpp	2019-01-24 01:20:52 UTC (rev 240371)
+++ branches/safari-607-branch/Source/WebCore/editing/FrameSelection.cpp	2019-01-24 01:20:56 UTC (rev 240372)
@@ -513,16 +513,18 @@
             m_selection.setWithoutValidation(m_selection.start(), m_selection.end());
         else
             m_selection.setWithoutValidation(m_selection.end(), m_selection.start());
-    } else if (RefPtr<Range> range = m_selection.firstRange()) {
-        auto compareNodeResult = range->compareNode(node);
-        if (!compareNodeResult.hasException()) {
-            auto compareResult = compareNodeResult.releaseReturnValue();
-            if (compareResult == Range::NODE_BEFORE_AND_AFTER || compareResult == Range::NODE_INSIDE) {
-                // If we did nothing here, when this node's renderer was destroyed, the rect that it 
-                // occupied would be invalidated, but, selection gaps that change as a result of 
-                // the removal wouldn't be invalidated.
-                // FIXME: Don't do so much unnecessary invalidation.
-                clearRenderTreeSelection = true;
+    } else if (isRange()) {
+        if (RefPtr<Range> range = m_selection.firstRange()) {
+            auto compareNodeResult = range->compareNode(node);
+            if (!compareNodeResult.hasException()) {
+                auto compareResult = compareNodeResult.releaseReturnValue();
+                if (compareResult == Range::NODE_BEFORE_AND_AFTER || compareResult == Range::NODE_INSIDE) {
+                    // If we did nothing here, when this node's renderer was destroyed, the rect that it
+                    // occupied would be invalidated, but, selection gaps that change as a result of
+                    // the removal wouldn't be invalidated.
+                    // FIXME: Don't do so much unnecessary invalidation.
+                    clearRenderTreeSelection = true;
+                }
             }
         }
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to