Commit 125cf9f2 authored by Anupam Snigdha's avatar Anupam Snigdha Committed by Chromium LUCI CQ

Cleanup TSF InputPanelPolicy changes.

This patch removes the logic to process input panel policy changes
in TSF in favor of VirtualKeyboard APIs that we have been suggesting
to web authors to use instead and not rely on TSF to manage VK for
them as it leads to lot of buggy behaviors and its non-deterministic.

Bug: 1031786
Change-Id: I5fe03a8a7dba40eef1101f3172751dd9f597e216
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587587Reviewed-by: default avatarYohei Yukawa <yukawa@chromium.org>
Commit-Queue: Anupam Snigdha <snianu@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#836878}
parent 22e354b4
...@@ -1022,7 +1022,6 @@ test("ui_base_unittests") { ...@@ -1022,7 +1022,6 @@ test("ui_base_unittests") {
sources += [ sources += [
"ime/win/imm32_manager_unittest.cc", "ime/win/imm32_manager_unittest.cc",
"ime/win/on_screen_keyboard_display_manager_unittest.cc", "ime/win/on_screen_keyboard_display_manager_unittest.cc",
"ime/win/tsf_input_policy_unittest.cc",
"ime/win/tsf_input_scope_unittest.cc", "ime/win/tsf_input_scope_unittest.cc",
"ime/win/tsf_text_store_unittest.cc", "ime/win/tsf_text_store_unittest.cc",
] ]
......
...@@ -176,10 +176,6 @@ void InputMethodWinTSF::ConfirmCompositionText() { ...@@ -176,10 +176,6 @@ void InputMethodWinTSF::ConfirmCompositionText() {
} }
void InputMethodWinTSF::ShowVirtualKeyboardIfEnabled() { void InputMethodWinTSF::ShowVirtualKeyboardIfEnabled() {
// TODO(crbug.com/1031786): Enable this once TSF input pane policy bug is
// fixed if (ui::TSFBridge::GetInstance())
// ui::TSFBridge::GetInstance()->SetInputPanelPolicy(
// /*inputPanelPolicyManual*/ false);
if (auto* controller = GetInputMethodKeyboardController()) if (auto* controller = GetInputMethodKeyboardController())
controller->DisplayVirtualKeyboard(); controller->DisplayVirtualKeyboard();
} }
......
...@@ -61,11 +61,6 @@ TextInputClient* MockTSFBridge::GetFocusedTextInputClient() const { ...@@ -61,11 +61,6 @@ TextInputClient* MockTSFBridge::GetFocusedTextInputClient() const {
return text_input_client_; return text_input_client_;
} }
void MockTSFBridge::SetInputPanelPolicy(bool input_panel_policy_manual) {
if (tsf_text_store_)
tsf_text_store_->SetInputPanelPolicy(input_panel_policy_manual);
}
bool MockTSFBridge::IsInputLanguageCJK() { bool MockTSFBridge::IsInputLanguageCJK() {
return false; return false;
} }
......
...@@ -33,7 +33,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_WIN) MockTSFBridge : public TSFBridge { ...@@ -33,7 +33,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_WIN) MockTSFBridge : public TSFBridge {
Microsoft::WRL::ComPtr<ITfThreadMgr> GetThreadManager() override; Microsoft::WRL::ComPtr<ITfThreadMgr> GetThreadManager() override;
TextInputClient* GetFocusedTextInputClient() const override; TextInputClient* GetFocusedTextInputClient() const override;
bool IsInputLanguageCJK() override; bool IsInputLanguageCJK() override;
void SetInputPanelPolicy(bool input_panel_policy_manual) override;
// Resets MockTSFBridge state including function call counter. // Resets MockTSFBridge state including function call counter.
void Reset(); void Reset();
......
...@@ -47,7 +47,6 @@ class TSFBridgeImpl : public TSFBridge { ...@@ -47,7 +47,6 @@ class TSFBridgeImpl : public TSFBridge {
bool IsInputLanguageCJK() override; bool IsInputLanguageCJK() override;
Microsoft::WRL::ComPtr<ITfThreadMgr> GetThreadManager() override; Microsoft::WRL::ComPtr<ITfThreadMgr> GetThreadManager() override;
TextInputClient* GetFocusedTextInputClient() const override; TextInputClient* GetFocusedTextInputClient() const override;
void SetInputPanelPolicy(bool input_panel_policy_manual) override;
private: private:
// Returns S_OK if |tsf_document_map_| is successfully initialized. This // Returns S_OK if |tsf_document_map_| is successfully initialized. This
...@@ -259,15 +258,6 @@ void TSFBridgeImpl::OnTextLayoutChanged() { ...@@ -259,15 +258,6 @@ void TSFBridgeImpl::OnTextLayoutChanged() {
document->text_store->SendOnLayoutChange(); document->text_store->SendOnLayoutChange();
} }
void TSFBridgeImpl::SetInputPanelPolicy(bool input_panel_policy_manual) {
TSFDocument* document = GetAssociatedDocument();
if (!document)
return;
if (!document->text_store)
return;
document->text_store->SetInputPanelPolicy(input_panel_policy_manual);
}
bool TSFBridgeImpl::CancelComposition() { bool TSFBridgeImpl::CancelComposition() {
DCHECK(base::CurrentUIThread::IsSet()); DCHECK(base::CurrentUIThread::IsSet());
DCHECK(IsInitialized()); DCHECK(IsInitialized());
......
...@@ -95,17 +95,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_WIN) TSFBridge { ...@@ -95,17 +95,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_WIN) TSFBridge {
// Returns the focused text input client. // Returns the focused text input client.
virtual TextInputClient* GetFocusedTextInputClient() const = 0; virtual TextInputClient* GetFocusedTextInputClient() const = 0;
// Sets the input panel policy in TSFTextStore so that input service
// could invoke the software input panel (SIP) on Windows.
// input_panel_policy_manual equals to false would make the SIP policy
// to automatic meaning TSF would raise/dismiss the SIP based on TSFTextStore
// focus and other heuristics that input service have added on Windows to
// provide a consistent behavior across all apps on Windows.
// input_panel_policy_manual equals to true would make the SIP policy to
// manual meaning TSF wouldn't raise/dismiss the SIP automatically. This is
// used to control the SIP behavior based on user interaction with the page.
virtual void SetInputPanelPolicy(bool input_panel_policy_manual) = 0;
protected: protected:
// Uses GetInstance() instead. // Uses GetInstance() instead.
TSFBridge(); TSFBridge();
......
This diff is collapsed.
...@@ -248,12 +248,7 @@ HRESULT TSFTextStore::GetSelection(ULONG selection_index, ...@@ -248,12 +248,7 @@ HRESULT TSFTextStore::GetSelection(ULONG selection_index,
HRESULT TSFTextStore::GetStatus(TS_STATUS* status) { HRESULT TSFTextStore::GetStatus(TS_STATUS* status) {
if (!status) if (!status)
return E_INVALIDARG; return E_INVALIDARG;
// TODO(snianu): Uncomment this once TSF fix for input pane policy is
// serviced.
// if (input_panel_policy_manual_)
// status->dwDynamicFlags |= TS_SD_INPUTPANEMANUALDISPLAYENABLE;
// else
// status->dwDynamicFlags &= ~TS_SD_INPUTPANEMANUALDISPLAYENABLE;
status->dwDynamicFlags |= TS_SD_INPUTPANEMANUALDISPLAYENABLE; status->dwDynamicFlags |= TS_SD_INPUTPANEMANUALDISPLAYENABLE;
// We don't support hidden text. // We don't support hidden text.
// TODO(IME): Remove TS_SS_TRANSITORY to support Korean reconversion // TODO(IME): Remove TS_SS_TRANSITORY to support Korean reconversion
...@@ -1321,14 +1316,6 @@ bool TSFTextStore::ConfirmComposition() { ...@@ -1321,14 +1316,6 @@ bool TSFTextStore::ConfirmComposition() {
return TerminateComposition(); return TerminateComposition();
} }
void TSFTextStore::SetInputPanelPolicy(bool input_panel_policy_manual) {
input_panel_policy_manual_ = input_panel_policy_manual;
// This notification tells TSF that the input pane flag has changed.
// TSF queries for the status of this flag using GetStatus and gets
// the updated value.
text_store_acp_sink_->OnStatusChange(TS_SD_INPUTPANEMANUALDISPLAYENABLE);
}
void TSFTextStore::SendOnLayoutChange() { void TSFTextStore::SendOnLayoutChange() {
// A re-entrant call leads to infinite loop in TSF. // A re-entrant call leads to infinite loop in TSF.
// We bail out if are in the process of notifying TSF about changes. // We bail out if are in the process of notifying TSF about changes.
......
...@@ -251,8 +251,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_WIN) TSFTextStore ...@@ -251,8 +251,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_WIN) TSFTextStore
// Sends OnLayoutChange() via |text_store_acp_sink_|. // Sends OnLayoutChange() via |text_store_acp_sink_|.
void SendOnLayoutChange(); void SendOnLayoutChange();
void SetInputPanelPolicy(bool input_panel_policy_manual);
private: private:
friend class TSFTextStoreTest; friend class TSFTextStoreTest;
friend class TSFTextStoreTestCallback; friend class TSFTextStoreTestCallback;
...@@ -442,15 +440,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_WIN) TSFTextStore ...@@ -442,15 +440,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_WIN) TSFTextStore
Microsoft::WRL::ComPtr<ITfDisplayAttributeMgr> display_attribute_manager_; Microsoft::WRL::ComPtr<ITfDisplayAttributeMgr> display_attribute_manager_;
Microsoft::WRL::ComPtr<ITfContext> context_; Microsoft::WRL::ComPtr<ITfContext> context_;
// input_panel_policy_manual_ equals to false would make the SIP policy
// to automatic meaning TSF would raise/dismiss the SIP based on TSFTextStore
// focus and other heuristics that input service have added on Windows to
// provide a consistent behavior across all apps on Windows.
// input_panel_policy_manual_ equals to true would make the SIP policy to
// manual meaning TSF wouldn't raise/dismiss the SIP automatically. This is
// used to control the SIP behavior based on user interaction with the page.
bool input_panel_policy_manual_ = true;
DISALLOW_COPY_AND_ASSIGN(TSFTextStore); DISALLOW_COPY_AND_ASSIGN(TSFTextStore);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment