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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/Layout.java

Issue 2098683002: Refactor OverlayPanel height calculations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address donnd comments 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
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.layouts; 5 package org.chromium.chrome.browser.compositor.layouts;
6 6
7 import static org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Ani matableAnimation.createAnimation; 7 import static org.chromium.chrome.browser.compositor.layouts.ChromeAnimation.Ani matableAnimation.createAnimation;
8 8
9 import android.content.Context; 9 import android.content.Context;
10 import android.graphics.Point; 10 import android.graphics.Point;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 * @param availableViewport The actual viewport this {@link Layout} sho uld be rendering to. 365 * @param availableViewport The actual viewport this {@link Layout} sho uld be rendering to.
366 * @param visibleViewport The visible viewport that represents the ar ea on the screen 366 * @param visibleViewport The visible viewport that represents the ar ea on the screen
367 * this {@link Layout} gets to draw to (potent ially takes into 367 * this {@link Layout} gets to draw to (potent ially takes into
368 * account top controls). 368 * account top controls).
369 * @param screenViewport The viewport of the screen. 369 * @param screenViewport The viewport of the screen.
370 * @param heightMinusTopControls The height the {@link Layout} gets excludin g the height of the 370 * @param heightMinusTopControls The height the {@link Layout} gets excludin g the height of the
371 * top controls. TODO(dtrainor): Look at gett ing rid of this. 371 * top controls. TODO(dtrainor): Look at gett ing rid of this.
372 * @param orientation The new orientation. Valid values are defi ned by 372 * @param orientation The new orientation. Valid values are defi ned by
373 * {@link Orientation}. 373 * {@link Orientation}.
374 */ 374 */
375 public final void sizeChanged(RectF availableViewport, RectF visibleViewport , 375 public final void sizeChanged(RectF availableViewport, RectF visibleViewport ,
Changwan Ryu 2016/07/07 03:29:32 If availableViewport is not used any more, could y
mdjones 2016/07/07 18:33:40 Done.
376 RectF screenViewport, float heightMinusTopControls, int orientation) { 376 RectF screenViewport, float heightMinusTopControls, int orientation) {
377 // 1. Pull out this Layout's specific width and height properties based on the available 377 // 1. Pull out this Layout's width and height properties based on the vi ewport.
378 // viewport. 378 float width = screenViewport.width();
379 float width = availableViewport.width(); 379 float height = screenViewport.height();
Theresa 2016/06/24 23:43:04 As we discussed offline, my only concern was aroun
380 float height = availableViewport.height();
381 380
382 // 2. Check if any Layout-specific properties have changed. 381 // 2. Check if any Layout-specific properties have changed.
383 boolean layoutPropertiesChanged = mWidth != width 382 boolean layoutPropertiesChanged = mWidth != width
384 || mHeight != height 383 || mHeight != height
385 || mHeightMinusTopControls != heightMinusTopControls 384 || mHeightMinusTopControls != heightMinusTopControls
386 || mCurrentOrientation != orientation; 385 || mCurrentOrientation != orientation;
387 386
388 // 3. Update the internal sizing properties. 387 // 3. Update the internal sizing properties.
389 mWidth = width; 388 mWidth = width;
390 mHeight = height; 389 mHeight = height;
391 mHeightMinusTopControls = heightMinusTopControls; 390 mHeightMinusTopControls = heightMinusTopControls;
392 mCurrentOrientation = orientation; 391 mCurrentOrientation = orientation;
393 392
394 // 4. Notify the actual Layout if necessary. 393 // 4. Notify the actual Layout if necessary.
395 if (layoutPropertiesChanged) { 394 if (layoutPropertiesChanged) {
396 notifySizeChanged(width, height, orientation); 395 notifySizeChanged(width, height, orientation);
397 } 396 }
398 397
399 // 5. TODO(dtrainor): Notify the overlay objects. 398 // 5. TODO(dtrainor): Notify the overlay objects.
400 for (int i = 0; i < mSceneOverlays.size(); i++) { 399 for (int i = 0; i < mSceneOverlays.size(); i++) {
401 mSceneOverlays.get(i).onSizeChanged(width, height, visibleViewport.t op, orientation); 400 mSceneOverlays.get(i).onSizeChanged(width, height, visibleViewport.t op, orientation);
Changwan Ryu 2016/07/07 03:29:32 This may slightly affect overlay panel's height in
mdjones 2016/07/07 18:33:40 Right, this is the expected behavior. For instance
402 } 401 }
403 } 402 }
404 403
405 /** 404 /**
406 * Notifies when the size or the orientation of the view has actually change d. 405 * Notifies when the size or the orientation of the view has actually change d.
407 * 406 *
408 * @param width The new width in dp. 407 * @param width The new width in dp.
409 * @param height The new height in dp. 408 * @param height The new height in dp.
410 * @param orientation The new orientation. 409 * @param orientation The new orientation.
411 */ 410 */
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 1207
1209 /** 1208 /**
1210 * Update {@link SceneLayer} instance this layout holds. Any class inheritin g {@link Layout} 1209 * Update {@link SceneLayer} instance this layout holds. Any class inheritin g {@link Layout}
1211 * should override this function in order for other functions to work. 1210 * should override this function in order for other functions to work.
1212 */ 1211 */
1213 protected void updateSceneLayer(Rect viewport, Rect contentViewport, 1212 protected void updateSceneLayer(Rect viewport, Rect contentViewport,
1214 LayerTitleCache layerTitleCache, TabContentManager tabContentManager , 1213 LayerTitleCache layerTitleCache, TabContentManager tabContentManager ,
1215 ResourceManager resourceManager, ChromeFullscreenManager fullscreenM anager) { 1214 ResourceManager resourceManager, ChromeFullscreenManager fullscreenM anager) {
1216 } 1215 }
1217 } 1216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698