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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 public void onChange() { | 207 public void onChange() { |
208 onContentChanged(); | 208 onContentChanged(); |
209 } | 209 } |
210 | 210 |
211 @Override | 211 @Override |
212 public void onNewTabCreated(Tab tab) { | 212 public void onNewTabCreated(Tab tab) { |
213 initializeTab(tab); | 213 initializeTab(tab); |
214 } | 214 } |
215 }; | 215 }; |
216 | 216 |
217 mEnableCompositorTabStrip = DeviceFormFactor.isTablet(getContext()); | 217 mEnableCompositorTabStrip = DeviceFormFactor.isTablet(); |
218 | 218 |
219 addOnLayoutChangeListener(new OnLayoutChangeListener() { | 219 addOnLayoutChangeListener(new OnLayoutChangeListener() { |
220 @Override | 220 @Override |
221 public void onLayoutChange(View v, int left, int top, int right, int
bottom, | 221 public void onLayoutChange(View v, int left, int top, int right, int
bottom, |
222 int oldLeft, int oldTop, int oldRight, int oldBottom) { | 222 int oldLeft, int oldTop, int oldRight, int oldBottom) { |
223 onViewportChanged(); | 223 onViewportChanged(); |
224 | 224 |
225 // If there's an event that needs to occur after the keyboard is
hidden, post | 225 // If there's an event that needs to occur after the keyboard is
hidden, post |
226 // it as a delayed event. Otherwise this happens in the midst o
f the | 226 // it as a delayed event. Otherwise this happens in the midst o
f the |
227 // ContentView's relayout, which causes the ContentView to relay
out on top of the | 227 // ContentView's relayout, which causes the ContentView to relay
out on top of the |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 507 |
508 /** | 508 /** |
509 * To be called once a frame before commit. | 509 * To be called once a frame before commit. |
510 */ | 510 */ |
511 @Override | 511 @Override |
512 public void onCompositorLayout() { | 512 public void onCompositorLayout() { |
513 TraceEvent.begin("CompositorViewHolder:layout"); | 513 TraceEvent.begin("CompositorViewHolder:layout"); |
514 if (mLayoutManager != null) { | 514 if (mLayoutManager != null) { |
515 mLayoutManager.onUpdate(); | 515 mLayoutManager.onUpdate(); |
516 | 516 |
517 if (!DeviceFormFactor.isTablet(getContext()) && mControlContainer !=
null) { | 517 if (!DeviceFormFactor.isTablet() && mControlContainer != null) { |
518 if (mProgressBarDrawingInfo == null) mProgressBarDrawingInfo = n
ew DrawingInfo(); | 518 if (mProgressBarDrawingInfo == null) mProgressBarDrawingInfo = n
ew DrawingInfo(); |
519 mControlContainer.getProgressBarDrawingInfo(mProgressBarDrawingI
nfo); | 519 mControlContainer.getProgressBarDrawingInfo(mProgressBarDrawingI
nfo); |
520 } else { | 520 } else { |
521 assert mProgressBarDrawingInfo == null; | 521 assert mProgressBarDrawingInfo == null; |
522 } | 522 } |
523 | 523 |
524 mCompositorView.finalizeLayers(mLayoutManager, false, | 524 mCompositorView.finalizeLayers(mLayoutManager, false, |
525 mProgressBarDrawingInfo); | 525 mProgressBarDrawingInfo); |
526 } | 526 } |
527 | 527 |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 if (mPixelRect.width() == 0) { | 1118 if (mPixelRect.width() == 0) { |
1119 mPixelRect.right = mPixelRect.left + 1; | 1119 mPixelRect.right = mPixelRect.left + 1; |
1120 } | 1120 } |
1121 if (mPixelRect.height() == 0) { | 1121 if (mPixelRect.height() == 0) { |
1122 mPixelRect.bottom = mPixelRect.top + 1; | 1122 mPixelRect.bottom = mPixelRect.top + 1; |
1123 } | 1123 } |
1124 return mPixelRect; | 1124 return mPixelRect; |
1125 } | 1125 } |
1126 } | 1126 } |
1127 } | 1127 } |
OLD | NEW |