Changeset 258133 in webkit
- Timestamp:
- Mar 9, 2020 2:50:20 AM (4 years ago)
- Location:
- releases/WebKitGTK/webkit-2.28
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.28/Source/WebKit/ChangeLog
r258132 r258133 1 2020-03-09 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] Surrounding text for input methods should not be limited to the current paragraph 4 https://bugs.webkit.org/show_bug.cgi?id=208706 5 6 Reviewed by Žan Doberšek. 7 8 It should include all the text around the cursor position. 9 10 * Shared/EditorState.cpp: 11 (WebKit::EditorState::PostLayoutData::encode const): Rename paragraphContext* as surroundingContext*. 12 (WebKit::EditorState::PostLayoutData::decode): Ditto. 13 * Shared/EditorState.h: 14 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 15 (webkitWebViewBaseUpdateTextInputState): Ditto. 16 * UIProcess/API/wpe/WPEView.cpp: 17 (WKWPE::View::selectionDidChange): Ditto. 18 * WebProcess/WebPage/WebPage.cpp: 19 (WebKit::WebPage::deleteSurrounding): Use content editable text as context instead of just paragraph. 20 * WebProcess/WebPage/glib/WebPageGLib.cpp: 21 (WebKit::WebPage::platformEditorState const): Ditto. 22 1 23 2020-03-08 Konstantin Tokarev <annulen@yandex.ru> 2 24 -
releases/WebKitGTK/webkit-2.28/Source/WebKit/Shared/EditorState.cpp
r254822 r258133 144 144 #endif 145 145 #if PLATFORM(GTK) || PLATFORM(WPE) 146 encoder << paragraphContext;147 encoder << paragraphContextCursorPosition;148 encoder << paragraphContextSelectionPosition;146 encoder << surroundingContext; 147 encoder << surroundingContextCursorPosition; 148 encoder << surroundingContextSelectionPosition; 149 149 #endif 150 150 encoder << fontAttributes; … … 221 221 #endif 222 222 #if PLATFORM(GTK) || PLATFORM(WPE) 223 if (!decoder.decode(result. paragraphContext))224 return false; 225 if (!decoder.decode(result. paragraphContextCursorPosition))226 return false; 227 if (!decoder.decode(result. paragraphContextSelectionPosition))223 if (!decoder.decode(result.surroundingContext)) 224 return false; 225 if (!decoder.decode(result.surroundingContextCursorPosition)) 226 return false; 227 if (!decoder.decode(result.surroundingContextSelectionPosition)) 228 228 return false; 229 229 #endif -
releases/WebKitGTK/webkit-2.28/Source/WebKit/Shared/EditorState.h
r254822 r258133 122 122 #endif 123 123 #if PLATFORM(GTK) || PLATFORM(WPE) 124 String paragraphContext;125 uint64_t paragraphContextCursorPosition { 0 };126 uint64_t paragraphContextSelectionPosition { 0 };124 String surroundingContext; 125 uint64_t surroundingContextCursorPosition { 0 }; 126 uint64_t surroundingContextSelectionPosition { 0 }; 127 127 #endif 128 128 -
releases/WebKitGTK/webkit-2.28/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
r255343 r258133 1680 1680 if (!editorState.isMissingPostLayoutData) { 1681 1681 webkitWebViewBase->priv->inputMethodFilter.notifyCursorRect(editorState.postLayoutData().caretRectAtStart); 1682 webkitWebViewBase->priv->inputMethodFilter.notifySurrounding(editorState.postLayoutData(). paragraphContext, editorState.postLayoutData().paragraphContextCursorPosition,1683 editorState.postLayoutData(). paragraphContextSelectionPosition);1682 webkitWebViewBase->priv->inputMethodFilter.notifySurrounding(editorState.postLayoutData().surroundingContext, editorState.postLayoutData().surroundingContextCursorPosition, 1683 editorState.postLayoutData().surroundingContextSelectionPosition); 1684 1684 } 1685 1685 } -
releases/WebKitGTK/webkit-2.28/Source/WebKit/UIProcess/API/wpe/WPEView.cpp
r255488 r258133 259 259 if (!editorState.isMissingPostLayoutData) { 260 260 m_inputMethodFilter.notifyCursorRect(editorState.postLayoutData().caretRectAtStart); 261 m_inputMethodFilter.notifySurrounding(editorState.postLayoutData(). paragraphContext, editorState.postLayoutData().paragraphContextCursorPosition,262 editorState.postLayoutData(). paragraphContextSelectionPosition);261 m_inputMethodFilter.notifySurrounding(editorState.postLayoutData().surroundingContext, editorState.postLayoutData().surroundingContextCursorPosition, 262 editorState.postLayoutData().surroundingContextSelectionPosition); 263 263 } 264 264 } -
releases/WebKitGTK/webkit-2.28/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r257434 r258133 5418 5418 5419 5419 auto selectionStart = selection.visibleStart(); 5420 auto paragraphRange = makeRange(startOfParagraph(selectionStart), selectionStart);5421 auto cursorPosition = TextIterator::rangeLength( paragraphRange.get());5422 auto& rootNode = paragraphRange->startContainer().treeScope().rootNode();5420 auto surroundingRange = makeRange(startOfEditableContent(selectionStart), selectionStart); 5421 auto cursorPosition = TextIterator::rangeLength(surroundingRange.get()); 5422 auto& rootNode = surroundingRange->startContainer().treeScope().rootNode(); 5423 5423 auto selectionRange = TextIterator::rangeFromLocationAndLength(&rootNode, cursorPosition + offset, characterCount); 5424 5424 if (!selectionRange) -
releases/WebKitGTK/webkit-2.28/Source/WebKit/WebProcess/WebPage/glib/WebPageGLib.cpp
r254822 r258133 108 108 if (selection.isContentEditable()) { 109 109 auto selectionStart = selection.visibleStart(); 110 auto paragraphStart = startOfParagraph(selectionStart);111 auto paragraphEnd = endOfParagraph(selectionStart);112 auto paragraphRange = makeRange(paragraphStart, paragraphEnd);110 auto surroundingStart = startOfEditableContent(selectionStart); 111 auto surroundingEnd = endOfEditableContent(selectionStart); 112 auto surroundingRange = makeRange(surroundingStart, surroundingEnd); 113 113 auto compositionRange = frame.editor().compositionRange(); 114 if (compositionRange && paragraphRange->contains(*compositionRange)) {115 auto clonedRange = paragraphRange->cloneRange();116 paragraphRange->setEnd(compositionRange->startPosition());114 if (compositionRange && surroundingRange->contains(*compositionRange)) { 115 auto clonedRange = surroundingRange->cloneRange(); 116 surroundingRange->setEnd(compositionRange->startPosition()); 117 117 clonedRange->setStart(compositionRange->endPosition()); 118 postLayoutData. paragraphContext = plainText(paragraphRange.get()) + plainText(clonedRange.ptr());119 postLayoutData. paragraphContextCursorPosition = TextIterator::rangeLength(paragraphRange.get());120 postLayoutData. paragraphContextSelectionPosition = postLayoutData.paragraphContextCursorPosition;118 postLayoutData.surroundingContext = plainText(surroundingRange.get()) + plainText(clonedRange.ptr()); 119 postLayoutData.surroundingContextCursorPosition = TextIterator::rangeLength(surroundingRange.get()); 120 postLayoutData.surroundingContextSelectionPosition = postLayoutData.surroundingContextCursorPosition; 121 121 } else { 122 postLayoutData. paragraphContext = plainText(paragraphRange.get());123 postLayoutData. paragraphContextCursorPosition = TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get());124 postLayoutData. paragraphContextSelectionPosition = TextIterator::rangeLength(makeRange(paragraphStart, selection.visibleEnd()).get());122 postLayoutData.surroundingContext = plainText(surroundingRange.get()); 123 postLayoutData.surroundingContextCursorPosition = TextIterator::rangeLength(makeRange(surroundingStart, selectionStart).get()); 124 postLayoutData.surroundingContextSelectionPosition = TextIterator::rangeLength(makeRange(surroundingStart, selection.visibleEnd()).get()); 125 125 } 126 126 } -
releases/WebKitGTK/webkit-2.28/Tools/ChangeLog
r257993 r258133 1 2020-03-09 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK][WPE] Surrounding text for input methods should not be limited to the current paragraph 4 https://bugs.webkit.org/show_bug.cgi?id=208706 5 6 Reviewed by Žan Doberšek. 7 8 Add test case to check surrounding text in multiline context. 9 10 * TestWebKitAPI/Tests/WebKitGLib/TestInputMethodContext.cpp: 11 (testWebKitInputMethodContextSurrounding): 12 1 13 2020-03-06 Lauro Moura <lmoura@igalia.com> 2 14 -
releases/WebKitGTK/webkit-2.28/Tools/TestWebKitAPI/Tests/WebKitGLib/TestInputMethodContext.cpp
r254822 r258133 53 53 G_DEFINE_TYPE(WebKitInputMethodContextMock, webkit_input_method_context_mock, WEBKIT_TYPE_INPUT_METHOD_CONTEXT) 54 54 55 static const char* testHTML = "<html><body>< input id='editable' contenteditable onkeydown='logKeyDown()' onkeyup='logKeyUp()' onkeypress='logKeyPress()'></input><script>"55 static const char* testHTML = "<html><body><textarea id='editable' rows='3', cols='50' onkeydown='logKeyDown()' onkeyup='logKeyUp()' onkeypress='logKeyPress()'></textarea><script>" 56 56 "var input = document.getElementById('editable');" 57 57 "input.addEventListener('compositionstart', logCompositionEvent);" … … 861 861 g_assert_cmpuint(test->surroundingCursorIndex(), ==, 37); 862 862 g_assert_cmpuint(test->surroundingSelectionIndex(), ==, test->surroundingCursorIndex()); 863 test->m_events.clear(); 864 865 // Check multiline context. 866 test->keyStrokeAndWaitForEvents(KEY(Return), 3); 867 test->keyStrokeAndWaitForEvents(KEY(a), 6); 868 test->waitForSurroundingText("WebKitGTKWPEWebKitabcWebKitGTK😀️\na"); 869 g_assert_cmpstr(test->surroundingText(), ==, "WebKitGTKWPEWebKitabcWebKitGTK😀️\na"); 870 g_assert_cmpuint(test->surroundingCursorIndex(), ==, 39); 871 g_assert_cmpuint(test->surroundingSelectionIndex(), ==, test->surroundingCursorIndex()); 872 test->m_events.clear(); 863 873 } 864 874
Note: See TracChangeset
for help on using the changeset viewer.