summaryrefslogtreecommitdiff
path: root/android_webview
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2013-07-18 11:57:30 +0100
committerBen Murdoch <benm@google.com>2013-07-18 11:57:30 +0100
commit9ab5563a3196760eb381d102cbb2bc0f7abc6a50 (patch)
tree1c690f8b0c998ba536a0c7aeff34764383c7dff6 /android_webview
parent106cdaa9e420b49e5b1ef6941f08dd990128a374 (diff)
downloadchromium_org-9ab5563a3196760eb381d102cbb2bc0f7abc6a50.tar.gz
Merge from Chromium at DEPS revision r212225
This commit was generated by merge_to_master.py. Change-Id: I9b658b6bade7aff6166611a04fb26f4bcf0ca77c
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/browser/in_process_view_renderer.cc23
-rw-r--r--android_webview/browser/in_process_view_renderer.h9
-rw-r--r--android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc2
-rw-r--r--android_webview/browser/scoped_app_gl_state_restore.cc24
-rw-r--r--android_webview/browser/scoped_app_gl_state_restore.h7
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwContents.java2
-rw-r--r--android_webview/java/src/org/chromium/android_webview/AwGeolocationPermissions.java2
-rw-r--r--android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java2
-rw-r--r--android_webview/java/src/org/chromium/android_webview/SslUtil.java2
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java23
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java37
-rw-r--r--android_webview/native/DEPS3
-rw-r--r--android_webview/native/aw_settings.cc5
-rw-r--r--android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java2
14 files changed, 91 insertions, 52 deletions
diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc
index 09a0e02337..55b3aa67d3 100644
--- a/android_webview/browser/in_process_view_renderer.cc
+++ b/android_webview/browser/in_process_view_renderer.cc
@@ -224,7 +224,7 @@ void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) {
return;
}
- ScopedAppGLStateRestore state_restore;
+ ScopedAppGLStateRestore state_restore(ScopedAppGLStateRestore::MODE_DRAW);
if (attached_to_window_ && compositor_ && !hardware_initialized_) {
TRACE_EVENT0("android_webview", "InitializeHwDraw");
@@ -449,7 +449,8 @@ void InProcessViewRenderer::OnDetachedFromWindow() {
if (hardware_initialized_) {
DCHECK(compositor_);
- ScopedAppGLStateRestore state_restore;
+ ScopedAppGLStateRestore state_restore(
+ ScopedAppGLStateRestore::MODE_DETACH_FROM_WINDOW);
compositor_->ReleaseHwDraw();
hardware_initialized_ = false;
}
@@ -537,8 +538,6 @@ void InProcessViewRenderer::ScrollTo(gfx::Vector2d new_value) {
void InProcessViewRenderer::SetTotalRootLayerScrollOffset(
gfx::Vector2dF new_value_css) {
- previous_accumulated_overscroll_ = gfx::Vector2dF();
-
// TOOD(mkosiba): Add a DCHECK to say that this does _not_ get called during
// DrawGl when http://crbug.com/249972 is fixed.
if (scroll_offset_css_ == new_value_css)
@@ -560,17 +559,19 @@ gfx::Vector2dF InProcessViewRenderer::GetTotalRootLayerScrollOffset() {
}
void InProcessViewRenderer::DidOverscroll(
- gfx::Vector2dF accumulated_overscroll,
+ gfx::Vector2dF latest_overscroll_delta,
gfx::Vector2dF current_fling_velocity) {
// TODO(mkosiba): Enable this once flinging is handled entirely Java-side.
// DCHECK(current_fling_velocity.IsZero());
const float physical_pixel_scale = dip_scale_ * page_scale_factor_;
- gfx::Vector2d overscroll_delta = gfx::ToRoundedVector2d(gfx::ScaleVector2d(
- accumulated_overscroll - previous_accumulated_overscroll_,
- physical_pixel_scale));
- previous_accumulated_overscroll_ +=
- gfx::ScaleVector2d(overscroll_delta, 1.0f / physical_pixel_scale);
- client_->DidOverscroll(overscroll_delta);
+ gfx::Vector2dF scaled_overscroll_delta = gfx::ScaleVector2d(
+ latest_overscroll_delta + overscroll_rounding_error_,
+ physical_pixel_scale);
+ gfx::Vector2d rounded_overscroll_delta =
+ gfx::ToRoundedVector2d(scaled_overscroll_delta);
+ overscroll_rounding_error_ =
+ scaled_overscroll_delta - rounded_overscroll_delta;
+ client_->DidOverscroll(rounded_overscroll_delta);
}
void InProcessViewRenderer::EnsureContinuousInvalidation(
diff --git a/android_webview/browser/in_process_view_renderer.h b/android_webview/browser/in_process_view_renderer.h
index 3ec28308f3..07c03ddb0c 100644
--- a/android_webview/browser/in_process_view_renderer.h
+++ b/android_webview/browser/in_process_view_renderer.h
@@ -63,7 +63,7 @@ class InProcessViewRenderer : public BrowserViewRenderer,
virtual void SetTotalRootLayerScrollOffset(
gfx::Vector2dF new_value_css) OVERRIDE;
virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE;
- virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll,
+ virtual void DidOverscroll(gfx::Vector2dF latest_overscroll_delta,
gfx::Vector2dF current_fling_velocity) OVERRIDE;
void WebContentsGone();
@@ -114,9 +114,10 @@ class InProcessViewRenderer : public BrowserViewRenderer,
// Current scroll offset in CSS pixels.
gfx::Vector2dF scroll_offset_css_;
- // Used to convert accumulated-based overscroll updates into delta-based
- // updates.
- gfx::Vector2dF previous_accumulated_overscroll_;
+ // Used to prevent rounding errors from accumulating enough to generate
+ // visible skew (especially noticeable when scrolling up and down in the same
+ // spot over a period of time).
+ gfx::Vector2dF overscroll_rounding_error_;
DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer);
};
diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
index 34b6adaf89..2e59cd5199 100644
--- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
+++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
@@ -212,8 +212,6 @@ void AwResourceDispatcherHostDelegate::RequestBeginning(
child_id, route_id, request));
bool allow_intercepting =
- // We ignore POST requests because of BUG=155250.
- request->method() != "POST" &&
// We allow intercepting navigations within subframes, but only if the
// scheme other than http or https. This is because the embedder
// can't distinguish main frame and subframe callbacks (which could lead
diff --git a/android_webview/browser/scoped_app_gl_state_restore.cc b/android_webview/browser/scoped_app_gl_state_restore.cc
index 87f888e5f5..70e5075c1b 100644
--- a/android_webview/browser/scoped_app_gl_state_restore.cc
+++ b/android_webview/browser/scoped_app_gl_state_restore.cc
@@ -42,15 +42,31 @@ void MakeAppContextCurrent() {
} // namespace
-ScopedAppGLStateRestore::ScopedAppGLStateRestore() {
+ScopedAppGLStateRestore::ScopedAppGLStateRestore(CallMode mode) {
MakeAppContextCurrent();
- // TODO(boliu): These should always be 0 in draw case, but not necessarily in
- // OnDetachFromWindow or other cases. When we have guarantee that we are no
- // longer making GL calls outside of draw, DCHECK these are 0 in draw case.
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &vertex_array_buffer_binding_);
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &index_array_buffer_binding_);
+ switch(mode) {
+ case MODE_DRAW:
+ // TODO(boliu): These should always be 0 in draw case. When we have
+ // guarantee that we are no longer making GL calls outside of draw, DCHECK
+ // these are 0 here.
+ LOG_IF(ERROR, vertex_array_buffer_binding_)
+ << "GL_ARRAY_BUFFER_BINDING not zero in draw: "
+ << vertex_array_buffer_binding_;
+ LOG_IF(ERROR, index_array_buffer_binding_)
+ << "GL_ELEMENT_ARRAY_BUFFER_BINDING not zero in draw: "
+ << index_array_buffer_binding_;
+
+ vertex_array_buffer_binding_ = 0;
+ index_array_buffer_binding_ = 0;
+ break;
+ case MODE_DETACH_FROM_WINDOW:
+ break;
+ }
+
glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES,
&texture_external_oes_binding_);
glGetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment_);
diff --git a/android_webview/browser/scoped_app_gl_state_restore.h b/android_webview/browser/scoped_app_gl_state_restore.h
index a74ffb9e90..c8eb0ba4aa 100644
--- a/android_webview/browser/scoped_app_gl_state_restore.h
+++ b/android_webview/browser/scoped_app_gl_state_restore.h
@@ -14,7 +14,12 @@ namespace android_webview {
// This class is not thread safe and should only be used on the UI thread.
class ScopedAppGLStateRestore {
public:
- ScopedAppGLStateRestore();
+ enum CallMode {
+ MODE_DRAW,
+ MODE_DETACH_FROM_WINDOW
+ };
+
+ ScopedAppGLStateRestore(CallMode mode);
~ScopedAppGLStateRestore();
private:
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index a3e7dcf70c..d425f4d1c3 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -66,7 +66,7 @@ import java.net.URL;
*/
@JNINamespace("android_webview")
public class AwContents {
- private static final String TAG = AwContents.class.getSimpleName();
+ private static final String TAG = "AwContents";
private static final String WEB_ARCHIVE_EXTENSION = ".mht";
diff --git a/android_webview/java/src/org/chromium/android_webview/AwGeolocationPermissions.java b/android_webview/java/src/org/chromium/android_webview/AwGeolocationPermissions.java
index b091b3be71..ddf2efb5e8 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwGeolocationPermissions.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwGeolocationPermissions.java
@@ -21,7 +21,7 @@ import java.util.Set;
public final class AwGeolocationPermissions {
private static final String PREF_PREFIX =
- AwGeolocationPermissions.class.getCanonicalName() + "%";
+ "AwGeolocationPermissions%";
private final SharedPreferences mSharedPreferences;
public AwGeolocationPermissions(SharedPreferences sharedPreferences) {
diff --git a/android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java b/android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java
index 39b72d9460..baa7680fa3 100644
--- a/android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java
+++ b/android_webview/java/src/org/chromium/android_webview/HttpAuthDatabase.java
@@ -28,7 +28,7 @@ import android.util.Log;
*/
public class HttpAuthDatabase {
- private static final String LOGTAG = HttpAuthDatabase.class.getName();
+ private static final String LOGTAG = "HttpAuthDatabase";
private static final int DATABASE_VERSION = 1;
diff --git a/android_webview/java/src/org/chromium/android_webview/SslUtil.java b/android_webview/java/src/org/chromium/android_webview/SslUtil.java
index 41b4c182ef..329cb15569 100644
--- a/android_webview/java/src/org/chromium/android_webview/SslUtil.java
+++ b/android_webview/java/src/org/chromium/android_webview/SslUtil.java
@@ -17,7 +17,7 @@ import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
public class SslUtil {
- private static final String TAG = SslUtil.class.getSimpleName();
+ private static final String TAG = "SslUtil";
/**
* Creates an SslError object from a chromium net error code.
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java
index ae2c128ed4..277d4ca09f 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java
@@ -29,9 +29,6 @@ public class AwContentsClientFaviconTest extends AwTestBase {
"<link rel=\"icon\" href=\""+ FAVICON1_URL + "\" />",
"Body");
- private static final String TOUCHICON_URL = "apple-touch-icon.png";
- private static final String TOUCHICON_PRECOMPOSED_URL = "apple-touch-icon-precomposed.png";
-
private static final String TOUCHICON_REL_LINK = "touch.png";
private static final String TOUCHICON_REL_LINK_72 = "touch_72.png";
private static final String TOUCHICON_REL_URL = "/" + TOUCHICON_REL_LINK;
@@ -121,26 +118,6 @@ public class AwContentsClientFaviconTest extends AwTestBase {
}
@SmallTest
- public void testReceiveBasicTouchIconRoot() throws Throwable {
- init(new TestAwContentsClientTouchIcon());
- int callCount = mContentsClient.mFaviconHelper.getCallCount();
-
- // Use the favicon page url. Since this does not specify a link rel for touch icon,
- // we should get the default touch icon urls in the callback.
- final String pageUrl = mWebServer.setResponse(FAVICON1_PAGE_URL, FAVICON1_PAGE_HTML,
- CommonResources.getTextHtmlHeaders(true));
-
- loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), pageUrl);
-
- mContentsClient.mFaviconHelper.waitForCallback(callCount, 2);
-
- HashMap<String, Boolean> touchIcons = mContentsClient.mFaviconHelper.mTouchIcons;
- assertEquals(2, touchIcons.size());
- assertFalse(touchIcons.get(mWebServer.getBaseUrl() + TOUCHICON_URL));
- assertTrue(touchIcons.get(mWebServer.getBaseUrl() + TOUCHICON_PRECOMPOSED_URL));
- }
-
- @SmallTest
public void testReceiveBasicTouchIconLinkRel() throws Throwable {
init(new TestAwContentsClientTouchIcon());
int callCount = mContentsClient.mFaviconHelper.getCallCount();
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java
index 09d9cbecda..9f3b475c8a 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java
@@ -619,6 +619,43 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase {
@SmallTest
@Feature({"AndroidWebView", "Navigation"})
+ public void testCalledFor302AfterPostNavigations() throws Throwable {
+ // The reason POST requests are excluded is BUG 155250.
+ final TestAwContentsClient contentsClient = new TestAwContentsClient();
+ final AwTestContainerView testContainerView =
+ createAwTestContainerViewOnMainSync(contentsClient);
+ final AwContents awContents = testContainerView.getAwContents();
+ final TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper =
+ contentsClient.getShouldOverrideUrlLoadingHelper();
+
+ final String redirectTargetUrl = createRedirectTargetPage(mWebServer);
+ final String postToGetRedirectUrl = mWebServer.setRedirect("/302.html", redirectTargetUrl);
+ final String postLinkUrl = addPageToTestServer(mWebServer, "/page_with_post_link.html",
+ getHtmlForPageWithSimplePostFormTo(postToGetRedirectUrl));
+
+ loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), postLinkUrl);
+
+ final int shouldOverrideUrlLoadingCallCount =
+ shouldOverrideUrlLoadingHelper.getCallCount();
+
+ clickOnLinkUsingJs(awContents, contentsClient);
+
+ shouldOverrideUrlLoadingHelper.waitForCallback(shouldOverrideUrlLoadingCallCount);
+
+ // Wait for the target URL to be fetched from the server.
+ assertTrue(CriteriaHelper.pollForCriteria(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ return mWebServer.getRequestCount(REDIRECT_TARGET_PATH) == 1;
+ }
+ }, WAIT_TIMEOUT_SECONDS * 1000L, CHECK_INTERVAL));
+
+ assertEquals(redirectTargetUrl,
+ shouldOverrideUrlLoadingHelper.getShouldOverrideUrlLoadingUrl());
+ }
+
+ @SmallTest
+ @Feature({"AndroidWebView", "Navigation"})
public void testNotCalledForIframeHttpNavigations() throws Throwable {
final TestAwContentsClient contentsClient = new TestAwContentsClient();
final AwTestContainerView testContainerView =
diff --git a/android_webview/native/DEPS b/android_webview/native/DEPS
index b45be10503..bb16f7d82f 100644
--- a/android_webview/native/DEPS
+++ b/android_webview/native/DEPS
@@ -9,4 +9,7 @@ include_rules = [
"+components/navigation_interception",
"+components/user_prefs",
"+components/web_contents_delegate_android",
+
+ # These should be burned down. http://crbug.com/237267
+ "!third_party/WebKit/public/web/WebView.h",
]
diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc
index 667f42658d..9295c00979 100644
--- a/android_webview/native/aw_settings.cc
+++ b/android_webview/native/aw_settings.cc
@@ -14,6 +14,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
#include "jni/AwSettings_jni.h"
+#include "third_party/WebKit/public/web/WebView.h"
#include "webkit/common/user_agent/user_agent.h"
#include "webkit/common/webpreferences.h"
#include "webkit/glue/webkit_glue.h"
@@ -114,8 +115,8 @@ void AwSettings::UpdateWebkitPreferencesLocked(JNIEnv* env, jobject obj) {
render_view_host_ext->SetTextZoomLevel(0);
} else {
prefs.force_enable_zoom = false;
- render_view_host_ext->SetTextZoomLevel(webkit_glue::ZoomFactorToZoomLevel(
- text_size_percent / 100.0f));
+ render_view_host_ext->SetTextZoomLevel(
+ WebKit::WebView::zoomFactorToZoomLevel(text_size_percent / 100.0f));
}
prefs.standard_font_family_map[webkit_glue::kCommonScript] =
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
index b1d0757f21..53b9643de9 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
@@ -15,7 +15,7 @@ import org.chromium.content.common.CommandLine;
public class AwShellApplication extends Application {
- private static final String TAG = AwShellApplication.class.getName();
+ private static final String TAG = "AwShellApplication";
/** The minimum set of .pak files the test runner needs. */
private static final String[] MANDATORY_PAKS = {
"webviewchromium.pak", "en-US.pak"