| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 * This class holds a {@link CompositorView}. This level of indirection is neede
d to benefit from | 69 * This class holds a {@link CompositorView}. This level of indirection is neede
d to benefit from |
| 70 * the {@link android.view.ViewGroup#onInterceptTouchEvent(android.view.MotionEv
ent)} capability on | 70 * the {@link android.view.ViewGroup#onInterceptTouchEvent(android.view.MotionEv
ent)} capability on |
| 71 * available on {@link android.view.ViewGroup}s. | 71 * available on {@link android.view.ViewGroup}s. |
| 72 * This class also holds the {@link LayoutManager} responsible to describe the i
tems to be | 72 * This class also holds the {@link LayoutManager} responsible to describe the i
tems to be |
| 73 * drawn by the UI compositor on the native side. | 73 * drawn by the UI compositor on the native side. |
| 74 */ | 74 */ |
| 75 public class CompositorViewHolder extends CoordinatorLayout | 75 public class CompositorViewHolder extends CoordinatorLayout |
| 76 implements ContentOffsetProvider, LayoutManagerHost, LayoutRenderHost, I
nvalidator.Host, | 76 implements ContentOffsetProvider, LayoutManagerHost, LayoutRenderHost, I
nvalidator.Host, |
| 77 FullscreenListener { | 77 FullscreenListener { |
| 78 | 78 |
| 79 private boolean mIsKeyboardShowing = false; | 79 private boolean mIsKeyboardShowing; |
| 80 | 80 |
| 81 private final Invalidator mInvalidator = new Invalidator(); | 81 private final Invalidator mInvalidator = new Invalidator(); |
| 82 private LayoutManager mLayoutManager; | 82 private LayoutManager mLayoutManager; |
| 83 private LayerTitleCache mLayerTitleCache; | 83 private LayerTitleCache mLayerTitleCache; |
| 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; |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * A task to be performed after a resize event. | 95 * A task to be performed after a resize event. |
| 96 */ | 96 */ |
| 97 private Runnable mPostHideKeyboardTask; | 97 private Runnable mPostHideKeyboardTask; |
| 98 | 98 |
| 99 private TabModelSelector mTabModelSelector; | 99 private TabModelSelector mTabModelSelector; |
| 100 private ChromeFullscreenManager mFullscreenManager; | 100 private ChromeFullscreenManager mFullscreenManager; |
| 101 private View mAccessibilityView; | 101 private View mAccessibilityView; |
| 102 private CompositorAccessibilityProvider mNodeProvider; | 102 private CompositorAccessibilityProvider mNodeProvider; |
| 103 private boolean mFullscreenTouchEvent = false; | 103 private boolean mFullscreenTouchEvent; |
| 104 private float mLastContentOffset = 0; | 104 private float mLastContentOffset; |
| 105 private float mLastVisibleContentOffset = 0; | 105 private float mLastVisibleContentOffset; |
| 106 | 106 |
| 107 /** The toolbar control container. **/ | 107 /** The toolbar control container. **/ |
| 108 private ControlContainer mControlContainer; | 108 private ControlContainer mControlContainer; |
| 109 | 109 |
| 110 /** The currently visible Tab. */ | 110 /** The currently visible Tab. */ |
| 111 private Tab mTabVisible; | 111 private Tab mTabVisible; |
| 112 | 112 |
| 113 /** The currently attached View. */ | 113 /** The currently attached View. */ |
| 114 private TabContentViewParent mView; | 114 private TabContentViewParent mView; |
| 115 | 115 |
| 116 private TabObserver mTabObserver; | 116 private TabObserver mTabObserver; |
| 117 private boolean mEnableCompositorTabStrip; | 117 private boolean mEnableCompositorTabStrip; |
| 118 | 118 |
| 119 // Cache objects that should not be created frequently. | 119 // Cache objects that should not be created frequently. |
| 120 private final RectF mCacheViewport = new RectF(); | 120 private final RectF mCacheViewport = new RectF(); |
| 121 private DrawingInfo mProgressBarDrawingInfo; | 121 private DrawingInfo mProgressBarDrawingInfo; |
| 122 | 122 |
| 123 // If we've drawn at least one frame. | 123 // If we've drawn at least one frame. |
| 124 private boolean mHasDrawnOnce = false; | 124 private boolean mHasDrawnOnce; |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * The desired size of this view in {@link MeasureSpec}. Set by the host | 127 * The desired size of this view in {@link MeasureSpec}. Set by the host |
| 128 * when it should be different from that of the parent. | 128 * when it should be different from that of the parent. |
| 129 */ | 129 */ |
| 130 private int mDesiredWidthMeasureSpec = ContentView.DEFAULT_MEASURE_SPEC; | 130 private int mDesiredWidthMeasureSpec = ContentView.DEFAULT_MEASURE_SPEC; |
| 131 private int mDesiredHeightMeasureSpec = ContentView.DEFAULT_MEASURE_SPEC; | 131 private int mDesiredHeightMeasureSpec = ContentView.DEFAULT_MEASURE_SPEC; |
| 132 | 132 |
| 133 /** | 133 /** |
| 134 * This view is created on demand to display debugging information. | 134 * This view is created on demand to display debugging information. |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 if (mPixelRect.width() == 0) { | 1121 if (mPixelRect.width() == 0) { |
| 1122 mPixelRect.right = mPixelRect.left + 1; | 1122 mPixelRect.right = mPixelRect.left + 1; |
| 1123 } | 1123 } |
| 1124 if (mPixelRect.height() == 0) { | 1124 if (mPixelRect.height() == 0) { |
| 1125 mPixelRect.bottom = mPixelRect.top + 1; | 1125 mPixelRect.bottom = mPixelRect.top + 1; |
| 1126 } | 1126 } |
| 1127 return mPixelRect; | 1127 return mPixelRect; |
| 1128 } | 1128 } |
| 1129 } | 1129 } |
| 1130 } | 1130 } |
| OLD | NEW |