Title: [104709] trunk/Source/WebKit2
Revision
104709
Author
kenn...@webkit.org
Date
2012-01-11 06:58:22 -0800 (Wed, 11 Jan 2012)

Log Message

[Qt] Add the editor rect to the EditorState https://bugs.webkit.org/show_bug.cgi?id=76053

Reviewed by Simon Hausmann.

Also rename some members to match the new Qt naming scheme.

* Shared/EditorState.cpp:
(WebKit::EditorState::encode):
(WebKit::EditorState::decode):
* Shared/EditorState.h:
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebView::inputMethodQuery):
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::respondToChangedSelection):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (104708 => 104709)


--- trunk/Source/WebKit2/ChangeLog	2012-01-11 14:33:49 UTC (rev 104708)
+++ trunk/Source/WebKit2/ChangeLog	2012-01-11 14:58:22 UTC (rev 104709)
@@ -1,3 +1,23 @@
+2012-01-11  Kenneth Rohde Christiansen  <kenn...@webkit.org>
+
+        [Qt] Add the editor rect to the EditorState
+        https://bugs.webkit.org/show_bug.cgi?id=76053
+
+        Reviewed by Simon Hausmann.
+
+        Also rename some members to match the new Qt naming scheme.
+
+        * Shared/EditorState.cpp:
+        (WebKit::EditorState::encode):
+        (WebKit::EditorState::decode):
+        * Shared/EditorState.h:
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebView::inputMethodQuery):
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::respondToChangedSelection):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::editorState):
+
 2012-01-11  Gustavo Noronha Silva  <gustavo.noro...@collabora.com>
 
         [GTK] Linking of big binaries should be serialized to avoid thrashing

Modified: trunk/Source/WebKit2/Shared/EditorState.cpp (104708 => 104709)


--- trunk/Source/WebKit2/Shared/EditorState.cpp	2012-01-11 14:33:49 UTC (rev 104708)
+++ trunk/Source/WebKit2/Shared/EditorState.cpp	2012-01-11 14:58:22 UTC (rev 104709)
@@ -44,7 +44,8 @@
 #if PLATFORM(QT)
     encoder->encode(cursorPosition);
     encoder->encode(anchorPosition);
-    encoder->encode(microFocus);
+    encoder->encode(editorRect);
+    encoder->encode(cursorRect);
     encoder->encode(compositionRect);
     encoder->encode(selectedText);
     encoder->encode(surroundingText);
@@ -81,9 +82,12 @@
     if (!decoder->decode(result.anchorPosition))
         return false;
 
-    if (!decoder->decode(result.microFocus))
+    if (!decoder->decode(result.editorRect))
         return false;
 
+    if (!decoder->decode(result.cursorRect))
+        return false;
+
     if (!decoder->decode(result.compositionRect))
         return false;
 

Modified: trunk/Source/WebKit2/Shared/EditorState.h (104708 => 104709)


--- trunk/Source/WebKit2/Shared/EditorState.h	2012-01-11 14:33:49 UTC (rev 104708)
+++ trunk/Source/WebKit2/Shared/EditorState.h	2012-01-11 14:58:22 UTC (rev 104709)
@@ -63,7 +63,8 @@
     unsigned cursorPosition;
     unsigned anchorPosition;
 
-    WebCore::IntRect microFocus;
+    WebCore::IntRect editorRect;
+    WebCore::IntRect cursorRect;
     WebCore::IntRect compositionRect;
     WTF::String selectedText;
     WTF::String surroundingText;

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (104708 => 104709)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-01-11 14:33:49 UTC (rev 104708)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-01-11 14:58:22 UTC (rev 104709)
@@ -924,7 +924,7 @@
 
     switch(property) {
     case Qt::ImCursorRectangle:
-        return QRectF(state.microFocus);
+        return QRectF(state.cursorRect);
     case Qt::ImFont:
         return QVariant();
     case Qt::ImCursorPosition:

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (104708 => 104709)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2012-01-11 14:33:49 UTC (rev 104708)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2012-01-11 14:58:22 UTC (rev 104709)
@@ -186,8 +186,9 @@
     EditorState state = m_page->editorState();
 
 #if PLATFORM(QT)
-    if (Element* scope = frame->selection()->rootEditableElement())
-        m_page->send(Messages::WebPageProxy::FocusEditableArea(state.microFocus, scope->getRect()));
+    // FIXME: Move this to act on the vkb visibility change.
+    if (state.isContentEditable)
+        m_page->send(Messages::WebPageProxy::FocusEditableArea(state.cursorRect, state.editorRect));
 #endif
 
     m_page->send(Messages::WebPageProxy::EditorStateChanged(state));

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (104708 => 104709)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-01-11 14:33:49 UTC (rev 104708)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-01-11 14:58:22 UTC (rev 104709)
@@ -398,6 +398,9 @@
     if (!scope)
         return result;
 
+    if (selectionRoot)
+        result.editorRect = frame->view()->contentsToWindow(selectionRoot->getRect());
+
     RefPtr<Range> range;
     if (result.hasComposition && (range = frame->editor()->compositionRange())) {
         frame->editor()->getCompositionSelection(result.anchorPosition, result.cursorPosition);
@@ -415,7 +418,7 @@
     }
 
     if (range)
-        result.microFocus = frame->view()->contentsToWindow(frame->editor()->firstRectForRange(range.get()));
+        result.cursorRect = frame->view()->contentsToWindow(frame->editor()->firstRectForRange(range.get()));
 
     // FIXME: We should only transfer innerText when it changes and do this on the UI side.
     if (result.isContentEditable && !result.isInPasswordField) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to