Commit a35f58db authored by Soumadeep Mazumdar's avatar Soumadeep Mazumdar Committed by Commit Bot

Fix pen/touch selection handles not disappearing on refresh

Issue: Pen/Touch selection handles persist even on refresh. On refresh,
the active client is invalidated before handles are dismissed.
Selection handles in PDF created in touch selection controller currently
had no way of being destroyed on a tab refresh before the actual parent
was destroyed. This is not the case in HTML where there is an explicit
call made to HideAndDisalllowShowingAutomatically to remove the handles
from aura observer depending on window focus lost.

Fix: Added call to Hide and not show handles automatically on
destruction. Following similarly from HTML, this call is made from
PDFWebContentsHelper destructor which takes care of removing the
selection handles before destroying the controller. Since this is tied
to the client, it does not remove existing handles in other active
clients.

Bug: 1110815

Change-Id: I9818f06ac8fe7fac3223472a58088544f2bc462a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359652
Commit-Queue: Soumadeep Mazumdar <somazu@microsoft.com>
Reviewed-by: Ankit Kumar 🌪️ <ankk@microsoft.com>
Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809243}
parent fd33965f
...@@ -40,6 +40,14 @@ PDFWebContentsHelper::~PDFWebContentsHelper() { ...@@ -40,6 +40,14 @@ PDFWebContentsHelper::~PDFWebContentsHelper() {
if (!touch_selection_controller_client_manager_) if (!touch_selection_controller_client_manager_)
return; return;
// PDFWebContentsHelperTest overrides TouchSelectionControllerClientManager
// to mock it and GetTouchSelectionController() returns nullptr in that case.
// This check prevents the tests from failing in that condition.
ui::TouchSelectionController* touch_selection_controller =
touch_selection_controller_client_manager_->GetTouchSelectionController();
if (touch_selection_controller)
touch_selection_controller->HideAndDisallowShowingAutomatically();
touch_selection_controller_client_manager_->InvalidateClient(this); touch_selection_controller_client_manager_->InvalidateClient(this);
touch_selection_controller_client_manager_->RemoveObserver(this); touch_selection_controller_client_manager_->RemoveObserver(this);
} }
......
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