Skip to content
Permalink
Browse files
Editor::m_compositionNode not updated on HTMLInputElement::setValue()
https://bugs.webkit.org/show_bug.cgi?id=107737

Patch by Aurimas Liutikas <aurimas@chromium.org> on 2013-01-31
Reviewed by Ryosuke Niwa.

Source/WebCore:

Chromium has a bug where the IME composition did not get cancelled on JavaScript changes
to the focused editing field. Most of other WebKit ports were already doing this check
in their EditorClient::respondToChangedSelection. I took that logic and moved it to the
Editor so every port and use the same code.

An existing test editing/input/setting-input-value-cancel-ime-composition.html covers this change.
This test used to have an expectation to fail on Chromium and after this patch it will start passing.

* editing/Editor.cpp:
(WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
    Adding a call that can be used by any the port to cancel the composition if it's no longer valid.
(WebCore):
* editing/Editor.h:
(Editor):

Source/WebKit/chromium:

* public/WebViewClient.h:
(WebKit::WebViewClient::didCancelCompositionOnSelectionChange):
    Adding a callback to let the WebViewClient know that the composition has been cancelled.
* src/EditorClientImpl.cpp:
(WebKit::EditorClientImpl::respondToChangedSelection):
    Adding a call composition if it is no longer valid.

Source/WebKit/efl:

* WebCoreSupport/EditorClientEfl.cpp:
(WebCore::EditorClientEfl::respondToChangedSelection):
    Adding a call to the newly refactored method.

Source/WebKit/gtk:

* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::EditorClient::respondToChangedSelection):
    Adding a call to the newly refactored Editor method.

Source/WebKit/mac:

* WebView/WebHTMLView.mm:
(-[WebHTMLView _updateSelectionForInputManager]):

Source/WebKit/win:

* WebView.cpp:
(WebView::updateSelectionForIME):
    Adding a call to the newly refactored method.

LayoutTests:

* platform/chromium/TestExpectations: Removed fail expectation for the editing/input/setting-input-value-cancel-ime-composition.html since this patch fixes the bug https://bugs.webkit.org/show_bug.cgi?id=55560

Canonical link: https://commits.webkit.org/126746@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141479 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Aurimas Liutikas authored and webkit-commit-queue committed Jan 31, 2013
1 parent 90c7cda commit 2913b3d89666b6d33ef964d6445159223eeda6df
Showing 16 changed files with 110 additions and 27 deletions.
@@ -1,3 +1,12 @@
2013-01-31 Aurimas Liutikas <aurimas@chromium.org>

Editor::m_compositionNode not updated on HTMLInputElement::setValue()
https://bugs.webkit.org/show_bug.cgi?id=107737

Reviewed by Ryosuke Niwa.

* platform/chromium/TestExpectations: Removed fail expectation for the editing/input/setting-input-value-cancel-ime-composition.html since this patch fixes the bug https://bugs.webkit.org/show_bug.cgi?id=55560

2013-01-31 Rouslan Solomakhin <rouslan@chromium.org>

[Chromium] Expect spellcheck to work for exactly-selected multi-word misspellings
@@ -1105,8 +1105,6 @@ crbug.com/64733 editing/text-iterator/findString.html [ Failure ]
# Selection is wrong.
crbug.com/64938 editing/selection/5354455-1.html [ Failure ]

webkit.org/b/55560 editing/input/setting-input-value-cancel-ime-composition.html [ Failure ]

# New test added in r82159
crbug.com/77706 editing/spelling/grammar.html [ Failure ]

@@ -1,3 +1,25 @@
2013-01-31 Aurimas Liutikas <aurimas@chromium.org>

Editor::m_compositionNode not updated on HTMLInputElement::setValue()
https://bugs.webkit.org/show_bug.cgi?id=107737

Reviewed by Ryosuke Niwa.

Chromium has a bug where the IME composition did not get cancelled on JavaScript changes
to the focused editing field. Most of other WebKit ports were already doing this check
in their EditorClient::respondToChangedSelection. I took that logic and moved it to the
Editor so every port and use the same code.

An existing test editing/input/setting-input-value-cancel-ime-composition.html covers this change.
This test used to have an expectation to fail on Chromium and after this patch it will start passing.

* editing/Editor.cpp:
(WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
Adding a call that can be used by any the port to cancel the composition if it's no longer valid.
(WebCore):
* editing/Editor.h:
(Editor):

2013-01-31 Joseph Pecoraro <pecoraro@apple.com>

Disable ENABLE_FULLSCREEN_API on iOS
@@ -1343,6 +1343,17 @@ void Editor::cancelComposition()
setComposition(emptyString(), CancelComposition);
}

bool Editor::cancelCompositionIfSelectionIsInvalid()
{
unsigned start;
unsigned end;
if (!hasComposition() || ignoreCompositionSelectionChange() || getCompositionSelection(start, end))
return false;

cancelComposition();
return true;
}

void Editor::confirmComposition(const String& text)
{
setComposition(text, ConfirmComposition);
@@ -296,6 +296,7 @@ class Editor : public FrameDestructionObserver {
void confirmComposition();
void confirmComposition(const String&); // if no existing composition, replaces selection
void cancelComposition();
bool cancelCompositionIfSelectionIsInvalid();
PassRefPtr<Range> compositionRange() const;
bool getCompositionSelection(unsigned& selectionStart, unsigned& selectionEnd) const;
bool setSelectionOffsets(int selectionStart, int selectionEnd);
@@ -1,3 +1,17 @@
2013-01-31 Aurimas Liutikas <aurimas@chromium.org>

Editor::m_compositionNode not updated on HTMLInputElement::setValue()
https://bugs.webkit.org/show_bug.cgi?id=107737

Reviewed by Ryosuke Niwa.

* public/WebViewClient.h:
(WebKit::WebViewClient::didCancelCompositionOnSelectionChange):
Adding a callback to let the WebViewClient know that the composition has been cancelled.
* src/EditorClientImpl.cpp:
(WebKit::EditorClientImpl::respondToChangedSelection):
Adding a call composition if it is no longer valid.

2013-01-31 Mark Pilgrim <pilgrim@chromium.org>

[Chromium] Move LocalizedStrings to WebCore
@@ -190,6 +190,7 @@ class WebViewClient : virtual public WebWidgetClient {
virtual bool isSelectTrailingWhitespaceEnabled() { return true; }

virtual void didBeginEditing() { }
virtual void didCancelCompositionOnSelectionChange() { }
virtual void didChangeSelection(bool isSelectionEmpty) { }
virtual void didChangeContents() { }
virtual void didExecuteCommand(const WebString& commandName) { }
@@ -268,8 +268,11 @@ void EditorClientImpl::didBeginEditing()
void EditorClientImpl::respondToChangedSelection(Frame* frame)
{
if (m_webView->client()) {
if (frame)
if (frame) {
m_webView->client()->didChangeSelection(!frame->selection()->isRange());
if (frame->editor()->cancelCompositionIfSelectionIsInvalid())
m_webView->client()->didCancelCompositionOnSelectionChange();
}
}
}

@@ -1,3 +1,14 @@
2013-01-31 Aurimas Liutikas <aurimas@chromium.org>

Editor::m_compositionNode not updated on HTMLInputElement::setValue()
https://bugs.webkit.org/show_bug.cgi?id=107737

Reviewed by Ryosuke Niwa.

* WebCoreSupport/EditorClientEfl.cpp:
(WebCore::EditorClientEfl::respondToChangedSelection):
Adding a call to the newly refactored method.

2013-01-31 Enrica Casucci <enrica@apple.com>

WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
@@ -152,14 +152,7 @@ void EditorClientEfl::respondToChangedSelection(Frame* coreFrame)
Evas_Object* webFrame = EWKPrivate::kitFrame(coreFrame);
ewk_frame_editor_client_selection_changed(webFrame);

if (!coreFrame->editor()->hasComposition() || coreFrame->editor()->ignoreCompositionSelectionChange())
return;

unsigned start;
unsigned end;

if (!coreFrame->editor()->getCompositionSelection(start, end))
coreFrame->editor()->cancelComposition();
coreFrame->editor()->cancelCompositionIfSelectionIsInvalid();
}

void EditorClientEfl::didEndEditing()
@@ -1,3 +1,14 @@
2013-01-31 Aurimas Liutikas <aurimas@chromium.org>

Editor::m_compositionNode not updated on HTMLInputElement::setValue()
https://bugs.webkit.org/show_bug.cgi?id=107737

Reviewed by Ryosuke Niwa.

* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::EditorClient::respondToChangedSelection):
Adding a call to the newly refactored Editor method.

2013-01-31 Enrica Casucci <enrica@apple.com>

WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
@@ -262,12 +262,7 @@ void EditorClient::respondToChangedSelection(Frame* frame)
setSelectionPrimaryClipboardIfNeeded(m_webView);
#endif

if (!frame->editor()->hasComposition() || frame->editor()->ignoreCompositionSelectionChange())
return;

unsigned start;
unsigned end;
if (!frame->editor()->getCompositionSelection(start, end))
if (frame->editor()->cancelCompositionIfSelectionIsInvalid())
m_webView->priv->imFilter.resetContext();
}

@@ -1,3 +1,13 @@
2013-01-31 Aurimas Liutikas <aurimas@chromium.org>

Editor::m_compositionNode not updated on HTMLInputElement::setValue()
https://bugs.webkit.org/show_bug.cgi?id=107737

Reviewed by Ryosuke Niwa.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _updateSelectionForInputManager]):

2013-01-31 Joseph Pecoraro <pecoraro@apple.com>

Disable ENABLE_FULLSCREEN_API on iOS
@@ -6037,10 +6037,7 @@ - (void)_updateSelectionForInputManager

[self _updateSecureInputState];

if (!coreFrame->editor()->hasComposition())
return;

if (coreFrame->editor()->ignoreCompositionSelectionChange())
if (!coreFrame->editor()->hasComposition() || coreFrame->editor()->ignoreCompositionSelectionChange())
return;

unsigned start;
@@ -1,3 +1,14 @@
2013-01-31 Aurimas Liutikas <aurimas@chromium.org>

Editor::m_compositionNode not updated on HTMLInputElement::setValue()
https://bugs.webkit.org/show_bug.cgi?id=107737

Reviewed by Ryosuke Niwa.

* WebView.cpp:
(WebView::updateSelectionForIME):
Adding a call to the newly refactored method.

2013-01-31 Enrica Casucci <enrica@apple.com>

WebKit2: provide new bundle APIs to allow bundle clients to be notified of pasteboard access.
@@ -5481,15 +5481,11 @@ void WebView::resetIME(Frame* targetFrame)
void WebView::updateSelectionForIME()
{
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
if (!targetFrame || !targetFrame->editor()->hasComposition())
return;

if (targetFrame->editor()->ignoreCompositionSelectionChange())
if (!targetFrame)
return;

unsigned start;
unsigned end;
if (!targetFrame->editor()->getCompositionSelection(start, end))
if (!targetFrame->editor()->cancelCompositionIfSelectionIsInvalid())
resetIME(targetFrame);
}

0 comments on commit 2913b3d

Please sign in to comment.