Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/Tab.java

Issue 821393004: Wrap ContentView in a parent view to fix infobar accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: satisfy findbugs Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/Tab.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
index 62eadf463a5e98643a3a149d64ec7592aa439b0e..59c6f1a499f53d88a9e2ae572404b775795c76ce 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
@@ -142,6 +142,9 @@ public class Tab {
/** {@link ContentViewCore} showing the current page, or {@code null} if the tab is frozen. */
private ContentViewCore mContentViewCore;
+ /** The parent view of the ContentView and the InfoBarContainer. */
+ private FrameLayout mContentViewParent;
+
/** A list of Tab observers. These are used to broadcast Tab events to listeners. */
private final ObserverList<TabObserver> mObservers = new ObserverList<TabObserver>();
@@ -754,8 +757,7 @@ public class Tab {
* This can be {@code null}, if the tab is frozen or being initialized or destroyed.
*/
public View getView() {
- return mNativePage != null ? mNativePage.getView() :
- (mContentViewCore != null ? mContentViewCore.getContainerView() : null);
+ return mNativePage != null ? mNativePage.getView() : mContentViewParent;
}
/**
@@ -1285,6 +1287,18 @@ public class Tab {
mContentViewCore = cvc;
+ // Wrap the ContentView in a FrameLayout, which will contain both the ContentView and the
+ // InfoBarContainer. The alternative -- placing the InfoBarContainer inside the ContentView
+ // -- causes problems since then the ContentView would contain both real views (the
+ // infobars) and virtual views (the web page elements), which breaks Android accessibility.
+ // http://crbug.com/416663
+ if (mContentViewParent != null) {
+ assert false;
+ mContentViewParent.removeAllViews();
+ }
+ mContentViewParent = new FrameLayout(mContext);
+ mContentViewParent.addView(cvc.getContainerView());
+
mWebContentsDelegate = createWebContentsDelegate();
mWebContentsObserver = new TabWebContentsObserver(mContentViewCore.getWebContents());
mVoiceSearchTabHelper = new VoiceSearchTabHelper(mContentViewCore.getWebContents());
@@ -1303,9 +1317,9 @@ public class Tab {
// initialized.
WebContents webContents = mContentViewCore.getWebContents();
mInfoBarContainer = new InfoBarContainer(
- mContext, getId(), mContentViewCore.getContainerView(), webContents);
+ mContext, getId(), mContentViewParent, webContents);
} else {
- mInfoBarContainer.onParentViewChanged(getId(), mContentViewCore.getContainerView());
+ mInfoBarContainer.onParentViewChanged(getId(), mContentViewParent);
}
if (AppBannerManager.isEnabled() && mAppBannerManager == null) {
@@ -1696,9 +1710,8 @@ public class Tab {
destroyContentViewCoreInternal(mContentViewCore);
- if (mInfoBarContainer != null && mInfoBarContainer.getParent() != null) {
- mInfoBarContainer.removeFromParentView();
- }
+ mContentViewParent.removeAllViews();
+ mContentViewParent = null;
mContentViewCore.destroy();
mContentViewCore = null;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698