Title: [205983] trunk/Source/WebKit2
Revision
205983
Author
[email protected]
Date
2016-09-15 10:58:01 -0700 (Thu, 15 Sep 2016)

Log Message

dictionaryPopupInfoForRange() can change selection temporarily; updates should not 
be sent to the UIProcess.
https://bugs.webkit.org/show_bug.cgi?id=162008
-and corresponding-
rdar://problem/28312297

Reviewed by Tim Horton.

This patch prevents the selection changes that occur while gathering 
dictionaryPopupInfo from being propagated to the UIProcess.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didChangeSelection):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::dictionaryPopupInfoForRange):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (205982 => 205983)


--- trunk/Source/WebKit2/ChangeLog	2016-09-15 17:48:05 UTC (rev 205982)
+++ trunk/Source/WebKit2/ChangeLog	2016-09-15 17:58:01 UTC (rev 205983)
@@ -1,3 +1,21 @@
+2016-09-14  Beth Dakin  <[email protected]>
+
+        dictionaryPopupInfoForRange() can change selection temporarily; updates should not 
+        be sent to the UIProcess.
+        https://bugs.webkit.org/show_bug.cgi?id=162008
+        -and corresponding-
+        rdar://problem/28312297
+
+        Reviewed by Tim Horton.
+
+        This patch prevents the selection changes that occur while gathering 
+        dictionaryPopupInfo from being propagated to the UIProcess.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didChangeSelection):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::dictionaryPopupInfoForRange):
+
 2016-09-14  Wenson Hsieh  <[email protected]>
 
         Media controls behave strangely when changing media sources

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (205982 => 205983)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-09-15 17:48:05 UTC (rev 205982)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-09-15 17:58:01 UTC (rev 205983)
@@ -4836,6 +4836,12 @@
 
 void WebPage::didChangeSelection()
 {
+    // The act of getting Dictionary Popup info can make selection changes that we should not propagate to the UIProcess.
+    // Specifically, if there is a caret selection, it will change to a range selection of the word around the caret. And
+    // then it will change back.
+    if (m_isGettingDictionaryPopupInfo)
+        return;
+
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     FrameView* view = frame.view();
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (205982 => 205983)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-09-15 17:48:05 UTC (rev 205982)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-09-15 17:58:01 UTC (rev 205983)
@@ -1487,6 +1487,7 @@
     bool m_mainFrameProgressCompleted;
     bool m_shouldDispatchFakeMouseMoveEvents;
     bool m_isEditorStateMissingPostLayoutData { false };
+    bool m_isGettingDictionaryPopupInfo { false };
 
     enum class EditorStateIsContentEditable { No, Yes, Unset };
     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (205982 => 205983)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2016-09-15 17:48:05 UTC (rev 205982)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2016-09-15 17:58:01 UTC (rev 205983)
@@ -88,6 +88,7 @@
 #import <WebCore/WindowsKeyboardCodes.h>
 #import <WebCore/htmlediting.h>
 #import <WebKitSystemInterface.h>
+#import <wtf/TemporaryChange.h>
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 #include <WebCore/MediaPlaybackTargetMac.h>
@@ -417,6 +418,8 @@
 
 DictionaryPopupInfo WebPage::dictionaryPopupInfoForRange(Frame* frame, Range& range, NSDictionary **options, TextIndicatorPresentationTransition presentationTransition)
 {
+    TemporaryChange<bool> isGettingDictionaryPopupInfoChange { m_isGettingDictionaryPopupInfo, true };
+
     DictionaryPopupInfo dictionaryPopupInfo;
     if (range.text().stripWhiteSpace().isEmpty())
         return dictionaryPopupInfo;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to