Title: [183780] trunk/Source/WebKit2
Revision
183780
Author
[email protected]
Date
2015-05-04 16:51:21 -0700 (Mon, 04 May 2015)

Log Message

[iOS WK2] editorState should include information about selection clipping rectangle.
https://bugs.webkit.org/show_bug.cgi?id=144603
rdar://problem/20521252

Reviewed by Chris Dumez.

Adding selectionClipRect to the post-layout portion of EditorState.
This way we can compute the selection clipping rectangle based on
up-to-date information instead of using the rectangle provided when
then element was first focused.

* Shared/EditorState.cpp:
(WebKit::EditorState::PostLayoutData::encode):
(WebKit::EditorState::PostLayoutData::decode):
* Shared/EditorState.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _selectionClipRect]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::platformEditorState):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (183779 => 183780)


--- trunk/Source/WebKit2/ChangeLog	2015-05-04 23:46:44 UTC (rev 183779)
+++ trunk/Source/WebKit2/ChangeLog	2015-05-04 23:51:21 UTC (rev 183780)
@@ -1,3 +1,25 @@
+2015-05-04  Enrica Casucci  <[email protected]>
+
+        [iOS WK2] editorState should include information about selection clipping rectangle.
+        https://bugs.webkit.org/show_bug.cgi?id=144603
+        rdar://problem/20521252
+
+        Reviewed by Chris Dumez.
+
+        Adding selectionClipRect to the post-layout portion of EditorState.
+        This way we can compute the selection clipping rectangle based on
+        up-to-date information instead of using the rectangle provided when
+        then element was first focused.
+
+        * Shared/EditorState.cpp:
+        (WebKit::EditorState::PostLayoutData::encode):
+        (WebKit::EditorState::PostLayoutData::decode):
+        * Shared/EditorState.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _selectionClipRect]):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::platformEditorState):
+
 2015-05-04  Antti Koivisto  <[email protected]>
 
         Network Cache: Support time based cache clearing

Modified: trunk/Source/WebKit2/Shared/EditorState.cpp (183779 => 183780)


--- trunk/Source/WebKit2/Shared/EditorState.cpp	2015-05-04 23:46:44 UTC (rev 183779)
+++ trunk/Source/WebKit2/Shared/EditorState.cpp	2015-05-04 23:51:21 UTC (rev 183780)
@@ -111,6 +111,7 @@
 #if PLATFORM(IOS)
 void EditorState::PostLayoutData::encode(IPC::ArgumentEncoder& encoder) const
 {
+    encoder << selectionClipRect;
     encoder << selectionRects;
     encoder << caretRectAtStart;
     encoder << caretRectAtEnd;
@@ -126,6 +127,8 @@
 
 bool EditorState::PostLayoutData::decode(IPC::ArgumentDecoder& decoder, PostLayoutData& result)
 {
+    if (!decoder.decode(result.selectionClipRect))
+        return false;
     if (!decoder.decode(result.selectionRects))
         return false;
     if (!decoder.decode(result.caretRectAtStart))

Modified: trunk/Source/WebKit2/Shared/EditorState.h (183779 => 183780)


--- trunk/Source/WebKit2/Shared/EditorState.h	2015-05-04 23:46:44 UTC (rev 183779)
+++ trunk/Source/WebKit2/Shared/EditorState.h	2015-05-04 23:51:21 UTC (rev 183780)
@@ -61,6 +61,7 @@
     String markedText;
 
     struct PostLayoutData {
+        WebCore::IntRect selectionClipRect;
         Vector<WebCore::SelectionRect> selectionRects;
         WebCore::IntRect caretRectAtStart;
         WebCore::IntRect caretRectAtEnd;

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (183779 => 183780)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-05-04 23:46:44 UTC (rev 183779)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-05-04 23:51:21 UTC (rev 183780)
@@ -818,7 +818,7 @@
 {
     if (_assistedNodeInformation.elementType == InputType::None)
         return CGRectZero;
-    return _assistedNodeInformation.elementRect;
+    return _page->editorState().postLayoutData().selectionClipRect;
 }
 
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (183779 => 183780)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-05-04 23:46:44 UTC (rev 183779)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-05-04 23:51:21 UTC (rev 183780)
@@ -186,6 +186,9 @@
         postLayoutData.isReplaceAllowed = result.isContentEditable && !result.isInPasswordField && !selectedText.containsOnlyWhitespace();
     }
     if (!selection.isNone()) {
+        if (m_assistedNode && m_assistedNode->renderer())
+            postLayoutData.selectionClipRect = view->contentsToRootView(m_assistedNode->renderer()->absoluteBoundingBoxRect());
+        
         Node* nodeToRemove;
         if (RenderStyle* style = Editor::styleForSelectionStart(&frame, nodeToRemove)) {
             CTFontRef font = style->fontCascade().primaryFont().getCTFont();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to