summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/browser/android/popup_touch_handle_drawable.cc3
-rw-r--r--content/browser/renderer_host/input/touch_selection_controller.cc14
-rw-r--r--content/browser/renderer_host/input/touch_selection_controller.h3
-rw-r--r--content/browser/renderer_host/input/touch_selection_controller_unittest.cc25
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.cc4
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java1
6 files changed, 4 insertions, 46 deletions
diff --git a/content/browser/android/popup_touch_handle_drawable.cc b/content/browser/android/popup_touch_handle_drawable.cc
index ac2f57bffc..8a7cf845f7 100644
--- a/content/browser/android/popup_touch_handle_drawable.cc
+++ b/content/browser/android/popup_touch_handle_drawable.cc
@@ -16,6 +16,9 @@ PopupTouchHandleDrawable::PopupTouchHandleDrawable(
}
PopupTouchHandleDrawable::~PopupTouchHandleDrawable() {
+ // Explicitly disabling ensures that any external references to the Java
+ // object are cleared, allowing it to be GC'ed in a timely fashion.
+ SetEnabled(false);
}
void PopupTouchHandleDrawable::SetEnabled(bool enabled) {
diff --git a/content/browser/renderer_host/input/touch_selection_controller.cc b/content/browser/renderer_host/input/touch_selection_controller.cc
index e904e283ee..d57b96f0aa 100644
--- a/content/browser/renderer_host/input/touch_selection_controller.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller.cc
@@ -160,20 +160,6 @@ void TouchSelectionController::HideAndDisallowShowingAutomatically() {
activate_selection_automatically_ = false;
}
-void TouchSelectionController::SetTemporarilyHidden(bool hidden) {
- if (temporarily_hidden_ == hidden)
- return;
- temporarily_hidden_ = hidden;
-
- TouchHandle::AnimationStyle animation_style = GetAnimationStyle(true);
- if (is_selection_active_) {
- start_selection_handle_->SetVisible(GetStartVisible(), animation_style);
- end_selection_handle_->SetVisible(GetEndVisible(), animation_style);
- }
- if (is_insertion_active_)
- insertion_handle_->SetVisible(GetStartVisible(), animation_style);
-}
-
void TouchSelectionController::OnSelectionEditable(bool editable) {
if (selection_editable_ == editable)
return;
diff --git a/content/browser/renderer_host/input/touch_selection_controller.h b/content/browser/renderer_host/input/touch_selection_controller.h
index 13031e12b9..452dde0cc3 100644
--- a/content/browser/renderer_host/input/touch_selection_controller.h
+++ b/content/browser/renderer_host/input/touch_selection_controller.h
@@ -69,9 +69,6 @@ class CONTENT_EXPORT TouchSelectionController : public TouchHandleClient {
// showing allowance.
void HideAndDisallowShowingAutomatically();
- // Override the handle visibility according to |hidden|.
- void SetTemporarilyHidden(bool hidden);
-
// To be called when the editability of the focused region changes.
void OnSelectionEditable(bool editable);
diff --git a/content/browser/renderer_host/input/touch_selection_controller_unittest.cc b/content/browser/renderer_host/input/touch_selection_controller_unittest.cc
index 5bdf57273f..c3422077dd 100644
--- a/content/browser/renderer_host/input/touch_selection_controller_unittest.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller_unittest.cc
@@ -632,31 +632,6 @@ TEST_F(TouchSelectionControllerTest, Animation) {
EXPECT_FALSE(GetAndResetNeedsAnimate());
}
-TEST_F(TouchSelectionControllerTest, TemporarilyHidden) {
- controller().OnTapEvent();
- controller().OnSelectionEditable(true);
-
- gfx::RectF insertion_rect(5, 5, 0, 10);
-
- bool visible = true;
- ChangeInsertion(insertion_rect, visible);
- EXPECT_FALSE(GetAndResetNeedsAnimate());
-
- controller().SetTemporarilyHidden(true);
- EXPECT_TRUE(GetAndResetNeedsAnimate());
-
- visible = false;
- ChangeInsertion(insertion_rect, visible);
- EXPECT_FALSE(GetAndResetNeedsAnimate());
-
- visible = true;
- ChangeInsertion(insertion_rect, visible);
- EXPECT_FALSE(GetAndResetNeedsAnimate());
-
- controller().SetTemporarilyHidden(false);
- EXPECT_TRUE(GetAndResetNeedsAnimate());
-}
-
TEST_F(TouchSelectionControllerTest, SelectionClearOnTap) {
gfx::RectF start_rect(5, 5, 0, 10);
gfx::RectF end_rect(50, 5, 0, 10);
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 205650f949..66c9fcdd74 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -477,8 +477,6 @@ void RenderWidgetHostViewAndroid::Focus() {
host_->SetInputMethodActive(true);
if (overscroll_effect_)
overscroll_effect_->Enable();
- if (selection_controller_)
- selection_controller_->SetTemporarilyHidden(false);
}
void RenderWidgetHostViewAndroid::Blur() {
@@ -486,8 +484,6 @@ void RenderWidgetHostViewAndroid::Blur() {
host_->Blur();
if (overscroll_effect_)
overscroll_effect_->Disable();
- if (selection_controller_)
- selection_controller_->SetTemporarilyHidden(true);
}
bool RenderWidgetHostViewAndroid::HasFocus() const {
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java b/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
index ffb03af20e..c23e4d534e 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
@@ -220,6 +220,7 @@ public class PopupTouchHandleDrawable extends View {
}
private void doInvalidate() {
+ if (!mContainer.isShowing()) return;
updatePosition();
updateVisibility();
invalidate();