Title: [187521] trunk/Source/WebCore
Revision
187521
Author
[email protected]
Date
2015-07-28 15:22:14 -0700 (Tue, 28 Jul 2015)

Log Message

[iOS] Creating a TextIndicator causes the view to scroll to the current selection
https://bugs.webkit.org/show_bug.cgi?id=147379
<rdar://problem/22038421>

Reviewed by Beth Dakin.

* editing/Editor.cpp:
(WebCore::Editor::setIgnoreCompositionSelectionChange):
* editing/Editor.h:
Add a flag so that setIgnoreCompositionSelectionChange(false) can still
not force-reveal the current selection.

This is useful for e.g. TextIndicator, who saves the selection, changes it,
and then restores it, but doesn't want to scroll to the saved/restored selection.

* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):
Make use of the above flag.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (187520 => 187521)


--- trunk/Source/WebCore/ChangeLog	2015-07-28 22:14:29 UTC (rev 187520)
+++ trunk/Source/WebCore/ChangeLog	2015-07-28 22:22:14 UTC (rev 187521)
@@ -1,3 +1,24 @@
+2015-07-28  Tim Horton  <[email protected]>
+
+        [iOS] Creating a TextIndicator causes the view to scroll to the current selection
+        https://bugs.webkit.org/show_bug.cgi?id=147379
+        <rdar://problem/22038421>
+
+        Reviewed by Beth Dakin.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::setIgnoreCompositionSelectionChange):
+        * editing/Editor.h:
+        Add a flag so that setIgnoreCompositionSelectionChange(false) can still
+        not force-reveal the current selection.
+
+        This is useful for e.g. TextIndicator, who saves the selection, changes it,
+        and then restores it, but doesn't want to scroll to the saved/restored selection.
+
+        * page/TextIndicator.cpp:
+        (WebCore::TextIndicator::createWithRange):
+        Make use of the above flag.
+
 2015-07-28  Eric Carlson  <[email protected]>
 
         [iOS] Set AirPlay discovery mode to disabled when page is hidden

Modified: trunk/Source/WebCore/editing/Editor.cpp (187520 => 187521)


--- trunk/Source/WebCore/editing/Editor.cpp	2015-07-28 22:14:29 UTC (rev 187520)
+++ trunk/Source/WebCore/editing/Editor.cpp	2015-07-28 22:22:14 UTC (rev 187521)
@@ -2757,7 +2757,7 @@
     m_frame.selection().revealSelection(alignment, revealExtentOption);
 }
 
-void Editor::setIgnoreCompositionSelectionChange(bool ignore)
+void Editor::setIgnoreCompositionSelectionChange(bool ignore, RevealSelection shouldRevealExistingSelection)
 {
     if (m_ignoreCompositionSelectionChange == ignore)
         return;
@@ -2768,7 +2768,7 @@
     if (!ignore)
         respondToChangedSelection(m_frame.selection().selection(), 0);
 #endif
-    if (!ignore)
+    if (!ignore && shouldRevealExistingSelection == RevealSelection::Yes)
         revealSelectionAfterEditingOperation(ScrollAlignment::alignToEdgeIfNeeded, RevealExtent);
 }
 

Modified: trunk/Source/WebCore/editing/Editor.h (187520 => 187521)


--- trunk/Source/WebCore/editing/Editor.h	2015-07-28 22:14:29 UTC (rev 187520)
+++ trunk/Source/WebCore/editing/Editor.h	2015-07-28 22:22:14 UTC (rev 187521)
@@ -310,7 +310,8 @@
     bool compositionUsesCustomUnderlines() const { return !m_customCompositionUnderlines.isEmpty(); }
     const Vector<CompositionUnderline>& customCompositionUnderlines() const { return m_customCompositionUnderlines; }
 
-    WEBCORE_EXPORT void setIgnoreCompositionSelectionChange(bool);
+    enum class RevealSelection { No, Yes };
+    WEBCORE_EXPORT void setIgnoreCompositionSelectionChange(bool, RevealSelection shouldRevealExistingSelection = RevealSelection::Yes);
     bool ignoreCompositionSelectionChange() const { return m_ignoreCompositionSelectionChange; }
 
     void setStartNewKillRingSequence(bool);

Modified: trunk/Source/WebCore/page/TextIndicator.cpp (187520 => 187521)


--- trunk/Source/WebCore/page/TextIndicator.cpp	2015-07-28 22:14:29 UTC (rev 187520)
+++ trunk/Source/WebCore/page/TextIndicator.cpp	2015-07-28 22:22:14 UTC (rev 187521)
@@ -71,7 +71,7 @@
         indicator->setWantsMargin(!areRangesEqual(&range, oldSelection.toNormalizedRange().get()));
 
 #if PLATFORM(IOS)
-    frame->editor().setIgnoreCompositionSelectionChange(false);
+    frame->editor().setIgnoreCompositionSelectionChange(false, Editor::RevealSelection::No);
     frame->selection().setUpdateAppearanceEnabled(false);
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to