Title: [164319] trunk/Source/WebCore
Revision
164319
Author
rn...@webkit.org
Date
2014-02-18 14:35:14 -0800 (Tue, 18 Feb 2014)

Log Message

FrameSelection::textWasReplaced and setSelectedRange shouldn't trigger synchronous layout
https://bugs.webkit.org/show_bug.cgi?id=128951

Reviewed by Antti Koivisto.

Cleanup.

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::textWasReplaced): Don't call updateLayout. It's totally unnecessarily.
(WebCore::FrameSelection::setSelectedRange): Ditto. Also removed the code to set affinity only when
range is collapsed since VisibleSelection::validate already does this.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164318 => 164319)


--- trunk/Source/WebCore/ChangeLog	2014-02-18 22:24:29 UTC (rev 164318)
+++ trunk/Source/WebCore/ChangeLog	2014-02-18 22:35:14 UTC (rev 164319)
@@ -1,3 +1,17 @@
+2014-02-18  Ryosuke Niwa  <rn...@webkit.org>
+
+        FrameSelection::textWasReplaced and setSelectedRange shouldn't trigger synchronous layout
+        https://bugs.webkit.org/show_bug.cgi?id=128951
+
+        Reviewed by Antti Koivisto.
+
+        Cleanup.
+
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::textWasReplaced): Don't call updateLayout. It's totally unnecessarily.
+        (WebCore::FrameSelection::setSelectedRange): Ditto. Also removed the code to set affinity only when
+        range is collapsed since VisibleSelection::validate already does this.
+
 2014-02-18  Eric Carlson  <eric.carl...@apple.com>
 
         Do not cache media time until media engine returns a non-zero value

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (164318 => 164319)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2014-02-18 22:24:29 UTC (rev 164318)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2014-02-18 22:35:14 UTC (rev 164319)
@@ -515,7 +515,6 @@
         else
             newSelection.setWithoutValidation(start, end);
 
-        m_frame->document()->updateLayout();
         setSelection(newSelection, DoNotSetFocus);
     }
 }
@@ -1700,25 +1699,15 @@
         return false;
     ASSERT(&range->startContainer()->document() == &range->endContainer()->document());
 
-    m_frame->document()->updateLayoutIgnorePendingStylesheets();
+    VisibleSelection newSelection(range, affinity);
 
-    // Non-collapsed ranges are not allowed to start at the end of a line that is wrapped,
-    // they start at the beginning of the next line instead
-    ExceptionCode ec = 0;
-    bool collapsed = range->collapsed(ec);
-    if (ec)
-        return false;
-
-    // FIXME: Can we provide extentAffinity?
-    VisiblePosition visibleStart(range->startPosition(), collapsed ? affinity : DOWNSTREAM);
-    VisiblePosition visibleEnd(range->endPosition(), SEL_DEFAULT_AFFINITY);
 #if PLATFORM(IOS)
-    if (range->startContainer() && visibleStart.isNull())
+    // FIXME: Why do we need this check only in iOS?
+    if (range->startContainer() && range->endContainer() && newSelection.isNull())
         return false;
-    if (range->endContainer() && visibleEnd.isNull())
-        return false;
 #endif
-    setSelection(VisibleSelection(visibleStart, visibleEnd), ClearTypingStyle | (closeTyping ? CloseTyping : 0));
+
+    setSelection(newSelection, ClearTypingStyle | (closeTyping ? CloseTyping : 0));
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to