Cherry-pick "[Android] Don't hide text handles if they are being dragged"

From https://codereview.chromium.org/26491010/

Bug 10723151

Original Description:

In webview, hiding of text handles can be triggered by many events
(containing view being scrolled, capturePicture call, etc.). If the
user is dragging a handle, we don't actually want to hide it. Instead,
explicitly suppress hiding of text handles while they are being dragged.

BUG=b/10723151

Review URL: https://codereview.chromium.org/26491010

Change-Id: I254e12582c0ef3446756c2aa1d8b418639413f3c
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228728 0039d316-1c4b-4281-b951-d872f2087c98
Cherry-pick: [Android WebView] Do not throttle if need picture listener

Cherry-pick of Chromium crrev.com/r229116

BUG: 11230312

Original description:

Currently as implemented, this will ensure clearView can be
unset even if AwContents.onPause is called.

Should considering refactoring clearView such that this case
can be dealt with more sanely.

Change-Id: Id5f160d339eace1b58d7fdc3666fc1a9f5248ead
Revert "Fork: Read and skip glBindRenderbufferEXT if no change"

The corruption mentioned in the bug is gone even without this
workaround, so reverting the change.

> Skip calling glBindRenderbufferEXT if it's not changed from 0.
>
> Android WebView for now do not use this feature since we do not support
> WebGL and such. This is a workaround for what is suspected is a qualcomm
> driver bug.

BUG: 11061206

This reverts commit 8a5fbdacd4c28d4cd41276de73ca7205569fc2cf.
Cherry Pick [Android] Properly handle cancelled scroll events

Cherry pick of https://codereview.chromium.org/27220002/

Bug: 10892868

Original description:
[Android] Properly handle cancelled scroll events

If the gesture handler receives an ACTION_CANCEL event during a scroll,
it should tell native to end scrolling.

Adds tests that the proper events are sent to native in both the normal
scroll sequence and the cancelled sequence.

BUG=b/10892868

Committed:
https://src.chromium.org/viewvc/chrome?view=rev&revision=228583

Change-Id: If69ceeb2ebb3e991d9b7ec9422ad514345a50e46
Merge "Cherry-pick "[Android] Don't hide text handles if they are being dragged"" into klp-dev
Merge "Cherry Pick [Android] Properly handle cancelled scroll events" into klp-dev
Cherry pick [Android] Allow text handles to observe position of "parent" view

Cherry pick of https://codereview.chromium.org/24449007/

Bug: 10892868
Bug: 10562149
Bug: 10723151

Original description:

[Android] Allow text handles to observe position of "parent" view

This adds the class PositionObserver. This class provides a way to
listen for changes to the position of a particular view (and to query
that views current position).

Then, HandleView is updated to use a PositionObserver to keep its
PopupWindow's position up-to-date with the logical "parent" view (
HandleView is logically a child of some other view, but has to use
a PopupWindow outside of the logical parent's view hierarchy).

This is similar to, and influenced by, Android's Editor.java
(https://android.googlesource.com/platform/frameworks/base/+/android-4.3_r3.1/core/java/android/widget/Editor.java).

BUG=b/10562149

Committed:
https://src.chromium.org/viewvc/chrome?view=rev&revision=228594

Change-Id: Ifb8508628a716ee518227a289d89486d191cdced
Cherry pick [Android] Hide handles when the containing view moves

Cherry pick of https://codereview.chromium.org/26575006/

Bug: 10892868

Original description:
[Android] Hide handles when the containing view moves

We temporarily hide handles when there is a scroll or zoom in the
content area. When the containing view is moved, we should also hide
the handles. This is particularly important for webview where scrolling
is often handled outside of the webview itself (and is sometimes mixed
between the two).

BUG=b/10892868

Change-Id: I79e5238f3c61d7fee725f4eab8fe29363409b80d
Android WebView: use IO thread for cookie manager.

Instead of posting tasks to the FILE thread, use the IO thread to match
the rest of Chromium (which normally only calls CookieMonster on the IO
thread). This is a workaround for a possible thread safety issue in
CookieMonster (see http://crbug.com/308589), but it's fine to change
this permanently as the original choice of the FILE thread was not
significant.

Bug: 11265317
Change-Id: I0f54d9ce9408d17312e312d4b919b542dcac4828
Cherry pick android: fix base::Time::FromLocalExploded() crash.

Cherry pick of https://codereview.chromium.org/27472003/

Bug: 11313033

Original description:

android: fix base::Time::FromLocalExploded() crash.

This patch does the following:

- Provide a work-around for an Android platform bug that
happens on older Android releases (e.g. 4.1.2), but fixed
on later ones (e.g. 4.3), where mktime() / mktime64()
would return -1 even when passed proper time values.

- Improve the code to properly deal with the fact that
SysTime is actually int64 on Android, unlike other
platforms, allowing us to remove the CHECK() that
was triggered by the platform bug.

- Add a new unit test to verify that the new code
doesn't crash on Android 4.1.2 anymore, and returns
the correct values.

BUG=287821
R=jar@chromium.org,mark@chromium.org,brettw@chromium.org

Committed:
https://src.chromium.org/viewvc/chrome?view=rev&revision=229567

Change-Id: Icca4d67b827fbca14d6218493db776fb79db85b8
Merge "Android WebView: use IO thread for cookie manager." into klp-dev
Cherry pick  [Android] MediaPlayerBridge should pass Bridge to getAllowedOperations

Cherry pick of https://codereview.chromium.org/32213003/

Bug: 11311417

Original description:
[Android] MediaPlayerBridge should pass Bridge to getAllowedOperations

Right now the Java side is expecting a MediaPlayer object to be passed
to the MediaPlayerBridge.getAllowedOperations function, but native
is actually passing it a MediaPlayerBridge. Update the code to be
consistent - Java now expects the MediaPlayerBrdige and uses it to
extract a MediaPlayer.

Change-Id: I5ac618c833c6c3ff015d43405a9a4d507fce9ba5
[android_webview] Fix crash in testCreateDestroy.

Cherry-pick of http://crrev.com/28923005

> The onSizeChanged callback was arriving after the AwContents was destroyed.
> Ignoring the setFixedLayoutSize call is fine since the AwContents is going
> away anyway.
>
> BUG=308497
> R=mnaganov@chromium.org
>
> Review URL: https://codereview.chromium.org/28923005
>
> git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229798 0039d316-1c4b-4281-b951-d872f2087c98

BUG: 11316652
Change-Id: I6e29e143aa5b14389df3d55756fc8bda315f245d
Merge "Cherry pick  [Android] MediaPlayerBridge should pass Bridge to getAllowedOperations" into klp-dev
Do not exclude background images/colors when printing

Bug: 10969979

When we implemented printing, we used the default values from Chrome
which by default does not enable background colors and images. In
Chrome, such settings are enabled via GUI. Without this setting,
some pages look broken.
Since Webview does not provide an API for this setting,
not excluding background images seems the more reasonable approach.

Change-Id: If038e960e297bdc8f2e54ec7d946fd2157c71009
Merge "[android_webview] Fix crash in testCreateDestroy." into klp-dev
Merge "Do not exclude background images/colors when printing" into klp-dev
Prevent log spam in autofill

Bug: 11267456
Change-Id: Ied852024f58582fa96cf073a10ab39a2acae32ff
Merge "Prevent log spam in autofill" into klp-dev
Cherry-pick "Dynamically enable spatial navigation based on events"

Bug: 11144676

Taken from already-landed chromium r230304

Original description:

As currently implemented spatial navigation and touch event handling
have some unexpected interactions (see bug link) so instead:
1/ make a better-guess initial value based on presence of touchscreen
2/ dynamically enable spatnav when a DPAD event is received, and disable
   it when touch down event received.

BUG=309425

Review URL: https://codereview.chromium.org/33823005

Change-Id: I8ae9c798794e8f46f79c97b8f404def5146553ae
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230304 0039d316-1c4b-4281-b951-d872f2087c98