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.Paint; | 9 import android.graphics.Paint; |
10 import android.graphics.Rect; | 10 import android.graphics.Rect; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // ContentView's relayout, which causes the ContentView to relay
out on top of the | 216 // ContentView's relayout, which causes the ContentView to relay
out on top of the |
217 // stack view. The 30ms is arbitrary, hoping to let the view ge
t one repaint | 217 // stack view. The 30ms is arbitrary, hoping to let the view ge
t one repaint |
218 // in so the full page is shown. | 218 // in so the full page is shown. |
219 if (mPostHideKeyboardTask != null) { | 219 if (mPostHideKeyboardTask != null) { |
220 new Handler().postDelayed(mPostHideKeyboardTask, 30); | 220 new Handler().postDelayed(mPostHideKeyboardTask, 30); |
221 mPostHideKeyboardTask = null; | 221 mPostHideKeyboardTask = null; |
222 } | 222 } |
223 } | 223 } |
224 }); | 224 }); |
225 | 225 |
226 if (!DeviceFormFactor.isTablet(getContext())) mProgressBarDrawingInfo =
new DrawingInfo(); | |
227 mCompositorView = new CompositorView(getContext(), this); | 226 mCompositorView = new CompositorView(getContext(), this); |
228 addView(mCompositorView, | 227 addView(mCompositorView, |
229 new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutPa
rams.WRAP_CONTENT)); | 228 new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutPa
rams.WRAP_CONTENT)); |
230 } | 229 } |
231 | 230 |
232 /** | 231 /** |
233 * @param layoutManager The {@link LayoutManager} instance that will be driv
ing what | 232 * @param layoutManager The {@link LayoutManager} instance that will be driv
ing what |
234 * shows in this {@link CompositorViewHolder}. | 233 * shows in this {@link CompositorViewHolder}. |
235 */ | 234 */ |
236 public void setLayoutManager(LayoutManager layoutManager) { | 235 public void setLayoutManager(LayoutManager layoutManager) { |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 533 } |
535 | 534 |
536 /** | 535 /** |
537 * To be called once a frame before commit. | 536 * To be called once a frame before commit. |
538 */ | 537 */ |
539 @Override | 538 @Override |
540 public void onCompositorLayout() { | 539 public void onCompositorLayout() { |
541 TraceEvent.begin("CompositorViewHolder:layout"); | 540 TraceEvent.begin("CompositorViewHolder:layout"); |
542 if (mLayoutManager != null) { | 541 if (mLayoutManager != null) { |
543 mLayoutManager.onUpdate(); | 542 mLayoutManager.onUpdate(); |
544 if (mProgressBarDrawingInfo != null) { | 543 |
| 544 if (!DeviceFormFactor.isTablet(getContext()) && mControlContainer !=
null) { |
| 545 if (mProgressBarDrawingInfo == null) mProgressBarDrawingInfo = n
ew DrawingInfo(); |
545 mControlContainer.getProgressBarDrawingInfo(mProgressBarDrawingI
nfo); | 546 mControlContainer.getProgressBarDrawingInfo(mProgressBarDrawingI
nfo); |
| 547 } else { |
| 548 assert mProgressBarDrawingInfo == null; |
546 } | 549 } |
| 550 |
547 mCompositorView.finalizeLayers(mLayoutManager, mSkipNextToolbarTextu
reUpdate, | 551 mCompositorView.finalizeLayers(mLayoutManager, mSkipNextToolbarTextu
reUpdate, |
548 mProgressBarDrawingInfo); | 552 mProgressBarDrawingInfo); |
549 | 553 |
550 // TODO(changwan): Check if this hack can be removed. | 554 // TODO(changwan): Check if this hack can be removed. |
551 // This is a hack to draw one more frame if the screen just rotated
for Nexus 10 + L. | 555 // This is a hack to draw one more frame if the screen just rotated
for Nexus 10 + L. |
552 // See http://crbug/440469 for more. | 556 // See http://crbug/440469 for more. |
553 if (mSkipNextToolbarTextureUpdate) { | 557 if (mSkipNextToolbarTextureUpdate) { |
554 requestRender(); | 558 requestRender(); |
555 } | 559 } |
556 } | 560 } |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 if (mPixelRect.width() == 0) { | 1134 if (mPixelRect.width() == 0) { |
1131 mPixelRect.right = mPixelRect.left + 1; | 1135 mPixelRect.right = mPixelRect.left + 1; |
1132 } | 1136 } |
1133 if (mPixelRect.height() == 0) { | 1137 if (mPixelRect.height() == 0) { |
1134 mPixelRect.bottom = mPixelRect.top + 1; | 1138 mPixelRect.bottom = mPixelRect.top + 1; |
1135 } | 1139 } |
1136 return mPixelRect; | 1140 return mPixelRect; |
1137 } | 1141 } |
1138 } | 1142 } |
1139 } | 1143 } |
OLD | NEW |