Title: [190512] trunk/Source/WebKit2
Revision
190512
Author
enr...@apple.com
Date
2015-10-02 11:29:03 -0700 (Fri, 02 Oct 2015)

Log Message

Text selection is inaccurate in Wikipedia pages when starting navigation from wikipedia.org.
https://bugs.webkit.org/show_bug.cgi?id=149756
rdar://problem/22332409

Reviewed by Tim Horton.

When loading a new document into the same WebPage object, we need
to clear the assisted node, since there is no guarantee that the
node will be blurred. The bug is caused by the use of a stale
assisted node to constrain the point where the gesture occurs.
A fix for this problem was landed in http://trac.webkit.org/changeset/179885
where the cleanup was added when FrameLoaderClient::detach2 was called.
This method doesn't seem to be called any longer for the main frame,
so the correct solution is to add the cleanup to didCommitLoad in WebPage.
I've also added some checks to webSelectionsRects and selectedTextRange to avoid
the use of postLayoutData when the selection is none.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView webSelectionRects]):
(-[WKContentView selectedTextRange]):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::detachedFromParent2): Removed call to resetAssistedNodeForFrame.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad): Added call to resetAssistedNodeForFrame.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (190511 => 190512)


--- trunk/Source/WebKit2/ChangeLog	2015-10-02 17:58:21 UTC (rev 190511)
+++ trunk/Source/WebKit2/ChangeLog	2015-10-02 18:29:03 UTC (rev 190512)
@@ -1,3 +1,30 @@
+2015-10-02  Enrica Casucci  <enr...@apple.com>
+
+        Text selection is inaccurate in Wikipedia pages when starting navigation from wikipedia.org.
+        https://bugs.webkit.org/show_bug.cgi?id=149756
+        rdar://problem/22332409
+
+        Reviewed by Tim Horton.
+
+        When loading a new document into the same WebPage object, we need
+        to clear the assisted node, since there is no guarantee that the
+        node will be blurred. The bug is caused by the use of a stale
+        assisted node to constrain the point where the gesture occurs.
+        A fix for this problem was landed in http://trac.webkit.org/changeset/179885
+        where the cleanup was added when FrameLoaderClient::detach2 was called.
+        This method doesn't seem to be called any longer for the main frame,
+        so the correct solution is to add the cleanup to didCommitLoad in WebPage.
+        I've also added some checks to webSelectionsRects and selectedTextRange to avoid
+        the use of postLayoutData when the selection is none.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView webSelectionRects]):
+        (-[WKContentView selectedTextRange]):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::detachedFromParent2): Removed call to resetAssistedNodeForFrame.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::didCommitLoad): Added call to resetAssistedNodeForFrame.
+
 2015-10-02  Alex Christensen  <achristen...@webkit.org>
 
         Reloading without content blockers doesn't apply to resource loads after the main frame finishes

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (190511 => 190512)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-10-02 17:58:21 UTC (rev 190511)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-10-02 18:29:03 UTC (rev 190512)
@@ -1026,6 +1026,8 @@
 
 - (NSArray *)webSelectionRects
 {
+    if (_page->editorState().selectionIsNone)
+        return nil;
     const auto& selectionRects = _page->editorState().postLayoutData().selectionRects;
     unsigned size = selectionRects.size();
     if (!size)
@@ -2301,6 +2303,8 @@
 
 - (UITextRange *)selectedTextRange
 {
+    if (_page->editorState().selectionIsNone)
+        return nil;
     auto& postLayoutEditorStateData = _page->editorState().postLayoutData();
     FloatRect startRect = postLayoutEditorStateData.caretRectAtStart;
     FloatRect endRect = postLayoutEditorStateData.caretRectAtEnd;

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (190511 => 190512)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2015-10-02 17:58:21 UTC (rev 190511)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2015-10-02 18:29:03 UTC (rev 190512)
@@ -140,9 +140,6 @@
     if (!webPage)
         return;
 
-#if PLATFORM(IOS)
-    webPage->resetAssistedNodeForFrame(m_frame);
-#endif
     RefPtr<API::Object> userData;
 
     // Notify the bundle client.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (190511 => 190512)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-10-02 17:58:21 UTC (rev 190511)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-10-02 18:29:03 UTC (rev 190512)
@@ -4592,6 +4592,7 @@
 #if PLATFORM(IOS)
     frame->setFirstLayerTreeTransactionIDAfterDidCommitLoad(downcast<RemoteLayerTreeDrawingArea>(*m_drawingArea).nextTransactionID());
     cancelPotentialTapInFrame(*frame);
+    resetAssistedNodeForFrame(frame);
 #endif
 
     if (!frame->isMainFrame())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to