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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/TabContentViewParent.java

Issue 2241643003: Fix a bug that some NativePage might overlap tabstrip on tablets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.tab; 5 package org.chromium.chrome.browser.tab;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.support.design.widget.CoordinatorLayout; 8 import android.support.design.widget.CoordinatorLayout;
9 import android.support.design.widget.CoordinatorLayout.Behavior; 9 import android.support.design.widget.CoordinatorLayout.Behavior;
10 import android.view.Gravity;
10 import android.view.View; 11 import android.view.View;
11 import android.widget.FrameLayout; 12 import android.widget.FrameLayout;
12 13
13 import org.chromium.chrome.R; 14 import org.chromium.chrome.R;
14 import org.chromium.chrome.browser.banners.SwipableOverlayView; 15 import org.chromium.chrome.browser.banners.SwipableOverlayView;
15 import org.chromium.ui.UiUtils; 16 import org.chromium.ui.UiUtils;
16 import org.chromium.ui.base.DeviceFormFactor; 17 import org.chromium.ui.base.DeviceFormFactor;
17 18
18 /** 19 /**
19 * Parent {@link FrameLayout} holding the infobar and content of a tab. The cont ent could be either 20 * Parent {@link FrameLayout} holding the infobar and content of a tab. The cont ent could be either
(...skipping 16 matching lines...) Expand all
36 if (tab.getNativePage() != null) { 37 if (tab.getNativePage() != null) {
37 viewToShow = tab.getNativePage().getView(); 38 viewToShow = tab.getNativePage().getView();
38 if (isShowing(viewToShow)) return; 39 if (isShowing(viewToShow)) return;
39 40
40 } else { 41 } else {
41 viewToShow = tab.getContentViewCore().getContainerView(); 42 viewToShow = tab.getContentViewCore().getContainerView();
42 if (isShowing(viewToShow)) return; 43 if (isShowing(viewToShow)) return;
43 } 44 }
44 45
45 removeCurrentContent(); 46 removeCurrentContent();
47 LayoutParams lp = (LayoutParams) viewToShow.getLayoutParams();
48 if (lp == null) {
49 lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MA TCH_PARENT);
50 }
51 // Weirdly enough, if gravity is not top, top_margin is not respecte d by FrameLayout.
52 // Yet for many native pages on tablet, top_margin is necessary to n ot overlap the tab
53 // switcher.
54 lp.gravity = Gravity.TOP;
46 UiUtils.removeViewFromParent(viewToShow); 55 UiUtils.removeViewFromParent(viewToShow);
47 addView(viewToShow, CONTENT_INDEX, new FrameLayout.LayoutParams( 56 addView(viewToShow, CONTENT_INDEX, lp);
48 LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
49 viewToShow.requestFocus(); 57 viewToShow.requestFocus();
50 } 58 }
51 }; 59 };
52 60
53 public TabContentViewParent(Context context, Tab tab) { 61 public TabContentViewParent(Context context, Tab tab) {
54 super(context); 62 super(context);
55 mInfobarWrapper = new FrameLayout(context); 63 mInfobarWrapper = new FrameLayout(context);
56 mInfobarWrapper.setFocusable(true); 64 mInfobarWrapper.setFocusable(true);
57 mInfobarWrapper.setFocusableInTouchMode(true); 65 mInfobarWrapper.setFocusableInTouchMode(true);
58 addView(mInfobarWrapper, 66 addView(mInfobarWrapper,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return true; 118 return true;
111 } 119 }
112 120
113 @Override 121 @Override
114 public void onDependentViewRemoved(CoordinatorLayout parent, TabContentV iewParent child, 122 public void onDependentViewRemoved(CoordinatorLayout parent, TabContentV iewParent child,
115 View dependency) { 123 View dependency) {
116 child.mInfobarWrapper.setTranslationY(0); 124 child.mInfobarWrapper.setTranslationY(0);
117 } 125 }
118 } 126 }
119 } 127 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698