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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java

Issue 2098683002: Refactor OverlayPanel height calculations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years, 5 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 | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.compositor.bottombar; 5 package org.chromium.chrome.browser.compositor.bottombar;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.content.Context; 8 import android.content.Context;
9 import android.view.View; 9 import android.view.View;
10 import android.view.View.MeasureSpec; 10 import android.view.View.MeasureSpec;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return PanelPriority.MEDIUM; 283 return PanelPriority.MEDIUM;
284 } 284 }
285 285
286 /** 286 /**
287 * @return True if a panel can be suppressed. This should be overridden by e ach panel. 287 * @return True if a panel can be suppressed. This should be overridden by e ach panel.
288 */ 288 */
289 public boolean canBeSuppressed() { 289 public boolean canBeSuppressed() {
290 return false; 290 return false;
291 } 291 }
292 292
293 @Override 293 /**
294 * @return The absolute amount in DP that the top controls have shifted off screen.
295 */
294 protected float getTopControlsOffsetDp() { 296 protected float getTopControlsOffsetDp() {
295 if (mActivity == null || mActivity.getFullscreenManager() == null) retur n 0.0f; 297 if (mActivity == null || mActivity.getFullscreenManager() == null) retur n 0.0f;
296 return -mActivity.getFullscreenManager().getControlOffset() * mPxToDp; 298 return -mActivity.getFullscreenManager().getControlOffset() * mPxToDp;
297 } 299 }
298 300
299 /** 301 /**
300 * Set the visibility of the base page text selection controls. This will al so attempt to 302 * Set the visibility of the base page text selection controls. This will al so attempt to
301 * remove focus from the base page to clear any open controls. 303 * remove focus from the base page to clear any open controls.
302 * TODO(mdjones): This should be replaced with focusing the panel's ContentV iewCore. 304 * TODO(mdjones): This should be replaced with focusing the panel's ContentV iewCore.
303 * @param visible If the text controls are visible. 305 * @param visible If the text controls are visible.
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 809
808 @Override 810 @Override
809 public EventFilter getEventFilter() { 811 public EventFilter getEventFilter() {
810 return mEventFilter; 812 return mEventFilter;
811 } 813 }
812 814
813 @Override 815 @Override
814 public void onSizeChanged(float width, float height, float visibleViewportOf fsetY, 816 public void onSizeChanged(float width, float height, float visibleViewportOf fsetY,
815 int orientation) { 817 int orientation) {
816 resizePanelContentViewCore(width, height); 818 resizePanelContentViewCore(width, height);
817 onSizeChanged(width, height); 819 onLayoutChanged(width, height, visibleViewportOffsetY);
818 } 820 }
819 821
820 /** 822 /**
821 * Resize the panel's ContentViewCore manually since it is not attached to t he view hierarchy. 823 * Resize the panel's ContentViewCore manually since it is not attached to t he view hierarchy.
822 * TODO(mdjones): Remove the need for this method by supporting multiple Con tentViewCores 824 * TODO(mdjones): Remove the need for this method by supporting multiple Con tentViewCores
823 * existing simultaneously in the view hierarchy. 825 * existing simultaneously in the view hierarchy.
824 * @param width The new width in dp. 826 * @param width The new width in dp.
825 * @param height The new height in dp. 827 * @param height The new height in dp.
826 */ 828 */
827 private void resizePanelContentViewCore(float width, float height) { 829 protected void resizePanelContentViewCore(float width, float height) {
828 if (!isShowing()) return; 830 if (!isShowing()) return;
829 ContentViewCore panelContent = getContentViewCore(); 831 ContentViewCore panelContent = getContentViewCore();
830 if (panelContent != null) { 832 if (panelContent != null) {
831 // Take the height of the toolbar into consideration.
832 int toolbarHeightPx = getTopControlsOffsetDp() > 0
833 ? 0 : (int) (getToolbarHeight() / mPxToDp);
834 panelContent.onSizeChanged((int) (width / mPxToDp), 833 panelContent.onSizeChanged((int) (width / mPxToDp),
835 (int) (height / mPxToDp) + toolbarHeightPx, panelContent.get ViewportWidthPix(), 834 (int) (height / mPxToDp), panelContent.getViewportWidthPix() ,
836 panelContent.getViewportHeightPix()); 835 panelContent.getViewportHeightPix());
837 panelContent.onPhysicalBackingSizeChanged( 836 panelContent.onPhysicalBackingSizeChanged(
838 (int) (width / mPxToDp), (int) (height / mPxToDp)); 837 (int) (width / mPxToDp), (int) (height / mPxToDp));
839 } 838 }
840 } 839 }
841 840
842 @Override 841 @Override
843 public void getVirtualViews(List<VirtualView> views) { 842 public void getVirtualViews(List<VirtualView> views) {
844 // TODO(mdjones): Add views for accessibility. 843 // TODO(mdjones): Add views for accessibility.
845 } 844 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 909
911 @Override 910 @Override
912 public void tabPageLoadFinished(int id, boolean incognito) {} 911 public void tabPageLoadFinished(int id, boolean incognito) {}
913 912
914 @Override 913 @Override
915 public void tabLoadStarted(int id, boolean incognito) {} 914 public void tabLoadStarted(int id, boolean incognito) {}
916 915
917 @Override 916 @Override
918 public void tabLoadFinished(int id, boolean incognito) {} 917 public void tabLoadFinished(int id, boolean incognito) {}
919 } 918 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBase.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698