Title: [239971] trunk/Source/WebCore
Revision
239971
Author
[email protected]
Date
2019-01-14 19:31:41 -0800 (Mon, 14 Jan 2019)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239970 => 239971)


--- trunk/Source/WebCore/ChangeLog	2019-01-15 03:26:04 UTC (rev 239970)
+++ trunk/Source/WebCore/ChangeLog	2019-01-15 03:31:41 UTC (rev 239971)
@@ -1,5 +1,18 @@
 2019-01-14  Simon Fraser  <[email protected]>
 
+        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-14  Simon Fraser  <[email protected]>
+
         Animation and other code is too aggressive about invalidating layer composition
         https://bugs.webkit.org/show_bug.cgi?id=193343
 

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (239970 => 239971)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2019-01-15 03:26:04 UTC (rev 239970)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2019-01-15 03:31:41 UTC (rev 239971)
@@ -537,16 +537,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to