mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1929160 - Update InputContext when clicking design mode document. r=masayuki,geckoview-reviewers,ohall
You know, `sFocusedElement` in IMEStateManager is nullptr. So `IMEStateManager::OnClickInEditor` doesn't update `IMEState`. It means that it is no way to set focus again in widget side via SetInputContext etc. So we should consider design mode in this function. Differential Revision: https://phabricator.services.mozilla.com/D227899
This commit is contained in:
parent
73511b6ae5
commit
5605194832
@ -1029,7 +1029,10 @@ void IMEStateManager::OnClickInEditor(nsPresContext& aPresContext,
|
||||
GetBoolName(sTextInputHandlingWidget &&
|
||||
!sTextInputHandlingWidget->Destroyed())));
|
||||
|
||||
if (sFocusedPresContext != &aPresContext || sFocusedElement != aElement ||
|
||||
if (sFocusedPresContext != &aPresContext ||
|
||||
(sFocusedElement != aElement &&
|
||||
((sFocusedElement && !sFocusedElement->IsInDesignMode()) ||
|
||||
(aElement && !aElement->IsInDesignMode()))) ||
|
||||
NS_WARN_IF(!sFocusedPresContext) ||
|
||||
NS_WARN_IF(!sTextInputHandlingWidget) ||
|
||||
NS_WARN_IF(sTextInputHandlingWidget->Destroyed())) {
|
||||
|
@ -409,6 +409,34 @@ class TextInputDelegateTest : BaseSessionTest() {
|
||||
})
|
||||
}
|
||||
|
||||
@WithDisplay(width = 100, height = 100)
|
||||
@Test
|
||||
fun showSoftInputOnDesignMode() {
|
||||
// This test is for design mode only
|
||||
assumeThat("in designmode", id, equalTo("#designmode"))
|
||||
|
||||
mainSession.loadTestPath(HELLO_HTML_PATH)
|
||||
mainSession.waitForPageStop()
|
||||
|
||||
mainSession.evaluateJS("document.designMode = 'on'")
|
||||
|
||||
mainSession.synthesizeTap(50, 50)
|
||||
|
||||
mainSession.waitUntilCalled(object : TextInputDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun showSoftInput(session: GeckoSession) {
|
||||
}
|
||||
})
|
||||
|
||||
mainSession.evaluateJS("document.designMode = 'off'")
|
||||
|
||||
mainSession.waitUntilCalled(object : TextInputDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun hideSoftInput(session: GeckoSession) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun getText(ic: InputConnection) =
|
||||
ic.getExtractedText(ExtractedTextRequest(), 0).text.toString()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user