OLD | NEW |
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; | 5 package org.chromium.chrome.browser.compositor; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.Canvas; | 8 import android.graphics.Canvas; |
9 import android.graphics.Color; | 9 import android.graphics.Color; |
10 import android.graphics.Paint; | 10 import android.graphics.Paint; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 private CompositorView mCompositorView; | 84 private CompositorView mCompositorView; |
85 | 85 |
86 private boolean mContentOverlayVisiblity = true; | 86 private boolean mContentOverlayVisiblity = true; |
87 | 87 |
88 private int mPendingSwapBuffersCount; | 88 private int mPendingSwapBuffersCount; |
89 | 89 |
90 private final ArrayList<Invalidator.Client> mPendingInvalidations = | 90 private final ArrayList<Invalidator.Client> mPendingInvalidations = |
91 new ArrayList<Invalidator.Client>(); | 91 new ArrayList<Invalidator.Client>(); |
92 private boolean mSkipInvalidation = false; | 92 private boolean mSkipInvalidation = false; |
93 | 93 |
94 private boolean mSkipNextToolbarTextureUpdate = false; | |
95 | |
96 /** | 94 /** |
97 * A task to be performed after a resize event. | 95 * A task to be performed after a resize event. |
98 */ | 96 */ |
99 private Runnable mPostHideKeyboardTask; | 97 private Runnable mPostHideKeyboardTask; |
100 | 98 |
101 private TabModelSelector mTabModelSelector; | 99 private TabModelSelector mTabModelSelector; |
102 private ChromeFullscreenManager mFullscreenManager; | 100 private ChromeFullscreenManager mFullscreenManager; |
103 private View mAccessibilityView; | 101 private View mAccessibilityView; |
104 private CompositorAccessibilityProvider mNodeProvider; | 102 private CompositorAccessibilityProvider mNodeProvider; |
105 private boolean mFullscreenTouchEvent = false; | 103 private boolean mFullscreenTouchEvent = false; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 | 413 |
416 sCachedCVCList.clear(); | 414 sCachedCVCList.clear(); |
417 mLayoutManager.getActiveLayout().getAllContentViewCores(sCachedCVCList); | 415 mLayoutManager.getActiveLayout().getAllContentViewCores(sCachedCVCList); |
418 | 416 |
419 for (int i = 0; i < sCachedCVCList.size(); i++) { | 417 for (int i = 0; i < sCachedCVCList.size(); i++) { |
420 adjustPhysicalBackingSize(sCachedCVCList.get(i), width, height); | 418 adjustPhysicalBackingSize(sCachedCVCList.get(i), width, height); |
421 } | 419 } |
422 sCachedCVCList.clear(); | 420 sCachedCVCList.clear(); |
423 } | 421 } |
424 | 422 |
425 @Override | |
426 public void onOverdrawBottomHeightChanged(int overdrawHeight) { | |
427 mSkipNextToolbarTextureUpdate = true; | |
428 requestRender(); | |
429 } | |
430 | |
431 @Override | |
432 public int getCurrentOverdrawBottomHeight() { | |
433 if (mTabVisible != null) { | |
434 float overdrawBottomHeight = mTabVisible.getFullscreenOverdrawBottom
HeightPix(); | |
435 if (!Float.isNaN(overdrawBottomHeight)) { | |
436 return (int) overdrawBottomHeight; | |
437 } | |
438 } | |
439 return mCompositorView.getOverdrawBottomHeight(); | |
440 } | |
441 | |
442 /** | 423 /** |
443 * Called whenever the host activity is started. | 424 * Called whenever the host activity is started. |
444 */ | 425 */ |
445 public void onStart() { | 426 public void onStart() { |
446 if (mFullscreenManager != null) { | 427 if (mFullscreenManager != null) { |
447 mLastContentOffset = mFullscreenManager.getContentOffset(); | 428 mLastContentOffset = mFullscreenManager.getContentOffset(); |
448 mLastVisibleContentOffset = mFullscreenManager.getVisibleContentOffs
et(); | 429 mLastVisibleContentOffset = mFullscreenManager.getVisibleContentOffs
et(); |
449 mFullscreenManager.addListener(this); | 430 mFullscreenManager.addListener(this); |
450 } | 431 } |
451 requestRender(); | 432 requestRender(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 if (mLayoutManager != null) { | 507 if (mLayoutManager != null) { |
527 mLayoutManager.onUpdate(); | 508 mLayoutManager.onUpdate(); |
528 | 509 |
529 if (!DeviceFormFactor.isTablet(getContext()) && mControlContainer !=
null) { | 510 if (!DeviceFormFactor.isTablet(getContext()) && mControlContainer !=
null) { |
530 if (mProgressBarDrawingInfo == null) mProgressBarDrawingInfo = n
ew DrawingInfo(); | 511 if (mProgressBarDrawingInfo == null) mProgressBarDrawingInfo = n
ew DrawingInfo(); |
531 mControlContainer.getProgressBarDrawingInfo(mProgressBarDrawingI
nfo); | 512 mControlContainer.getProgressBarDrawingInfo(mProgressBarDrawingI
nfo); |
532 } else { | 513 } else { |
533 assert mProgressBarDrawingInfo == null; | 514 assert mProgressBarDrawingInfo == null; |
534 } | 515 } |
535 | 516 |
536 mCompositorView.finalizeLayers(mLayoutManager, mSkipNextToolbarTextu
reUpdate, | 517 mCompositorView.finalizeLayers(mLayoutManager, false, |
537 mProgressBarDrawingInfo); | 518 mProgressBarDrawingInfo); |
538 | |
539 // TODO(changwan): Check if this hack can be removed. | |
540 // This is a hack to draw one more frame if the screen just rotated
for Nexus 10 + L. | |
541 // See http://crbug/440469 for more. | |
542 if (mSkipNextToolbarTextureUpdate) { | |
543 requestRender(); | |
544 } | |
545 } | 519 } |
546 | 520 |
547 TraceEvent.end("CompositorViewHolder:layout"); | 521 TraceEvent.end("CompositorViewHolder:layout"); |
548 mSkipNextToolbarTextureUpdate = false; | |
549 } | 522 } |
550 | 523 |
551 @Override | 524 @Override |
552 public void requestRender() { | 525 public void requestRender() { |
553 mCompositorView.requestRender(); | 526 mCompositorView.requestRender(); |
554 } | 527 } |
555 | 528 |
556 @Override | 529 @Override |
557 public void onSurfaceCreated() { | 530 public void onSurfaceCreated() { |
558 mPendingSwapBuffersCount = 0; | 531 mPendingSwapBuffersCount = 0; |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 if (mPixelRect.width() == 0) { | 1101 if (mPixelRect.width() == 0) { |
1129 mPixelRect.right = mPixelRect.left + 1; | 1102 mPixelRect.right = mPixelRect.left + 1; |
1130 } | 1103 } |
1131 if (mPixelRect.height() == 0) { | 1104 if (mPixelRect.height() == 0) { |
1132 mPixelRect.bottom = mPixelRect.top + 1; | 1105 mPixelRect.bottom = mPixelRect.top + 1; |
1133 } | 1106 } |
1134 return mPixelRect; | 1107 return mPixelRect; |
1135 } | 1108 } |
1136 } | 1109 } |
1137 } | 1110 } |
OLD | NEW |