[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 1 | // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "cc/layer_tree_impl.h" |
| 6 | |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 7 | #include "base/debug/trace_event.h" |
[email protected] | b7c4783f | 2013-03-15 23:11:42 | [diff] [blame^] | 8 | #include "cc/animation.h" |
| 9 | #include "cc/animation_id_provider.h" |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 10 | #include "cc/heads_up_display_layer_impl.h" |
[email protected] | b7c4783f | 2013-03-15 23:11:42 | [diff] [blame^] | 11 | #include "cc/keyframed_animation_curve.h" |
| 12 | #include "cc/layer.h" |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 13 | #include "cc/layer_tree_host_common.h" |
| 14 | #include "cc/layer_tree_host_impl.h" |
[email protected] | b7c4783f | 2013-03-15 23:11:42 | [diff] [blame^] | 15 | #include "cc/pinch_zoom_scrollbar.h" |
[email protected] | ffb2720f | 2013-03-15 19:18:37 | [diff] [blame] | 16 | #include "cc/scrollbar_layer_impl.h" |
| 17 | #include "ui/gfx/size_conversions.h" |
[email protected] | caa567d | 2012-12-20 07:56:16 | [diff] [blame] | 18 | #include "ui/gfx/vector2d_conversions.h" |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 19 | |
| 20 | namespace cc { |
| 21 | |
[email protected] | 8bef4057 | 2012-12-11 21:38:08 | [diff] [blame] | 22 | LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) |
[email protected] | db8259f | 2013-02-01 05:25:04 | [diff] [blame] | 23 | : layer_tree_host_impl_(layer_tree_host_impl), |
| 24 | source_frame_number_(-1), |
| 25 | hud_layer_(0), |
| 26 | root_scroll_layer_(0), |
| 27 | currently_scrolling_layer_(0), |
| 28 | background_color_(0), |
| 29 | has_transparent_background_(false), |
[email protected] | b7c4783f | 2013-03-15 23:11:42 | [diff] [blame^] | 30 | pinch_zoom_scrollbar_horizontal_layer_id_(Layer::INVALID_ID), |
| 31 | pinch_zoom_scrollbar_vertical_layer_id_(Layer::INVALID_ID), |
[email protected] | db8259f | 2013-02-01 05:25:04 | [diff] [blame] | 32 | page_scale_factor_(1), |
| 33 | page_scale_delta_(1), |
| 34 | sent_page_scale_delta_(1), |
| 35 | min_page_scale_factor_(0), |
| 36 | max_page_scale_factor_(0), |
| 37 | scrolling_layer_id_from_previous_tree_(0), |
| 38 | contents_textures_purged_(false), |
[email protected] | 31882285 | 2013-02-14 00:54:27 | [diff] [blame] | 39 | viewport_size_invalid_(false), |
[email protected] | db8259f | 2013-02-01 05:25:04 | [diff] [blame] | 40 | needs_update_draw_properties_(true), |
| 41 | needs_full_tree_sync_(true) { |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | LayerTreeImpl::~LayerTreeImpl() { |
[email protected] | 361bc00d | 2012-12-14 07:03:24 | [diff] [blame] | 45 | // Need to explicitly clear the tree prior to destroying this so that |
| 46 | // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
| 47 | root_layer_.reset(); |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | static LayerImpl* findRootScrollLayer(LayerImpl* layer) |
| 51 | { |
| 52 | if (!layer) |
| 53 | return 0; |
| 54 | |
| 55 | if (layer->scrollable()) |
| 56 | return layer; |
| 57 | |
| 58 | for (size_t i = 0; i < layer->children().size(); ++i) { |
| 59 | LayerImpl* found = findRootScrollLayer(layer->children()[i]); |
| 60 | if (found) |
| 61 | return found; |
| 62 | } |
| 63 | |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) { |
| 68 | root_layer_ = layer.Pass(); |
[email protected] | 5c4824e1 | 2013-01-12 16:34:53 | [diff] [blame] | 69 | root_scroll_layer_ = NULL; |
| 70 | currently_scrolling_layer_ = NULL; |
| 71 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 72 | layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
[email protected] | 5c4824e1 | 2013-01-12 16:34:53 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | void LayerTreeImpl::FindRootScrollLayer() { |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 76 | root_scroll_layer_ = findRootScrollLayer(root_layer_.get()); |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 77 | |
| 78 | if (root_layer_ && scrolling_layer_id_from_previous_tree_) { |
| 79 | currently_scrolling_layer_ = LayerTreeHostCommon::findLayerInSubtree( |
| 80 | root_layer_.get(), |
| 81 | scrolling_layer_id_from_previous_tree_); |
| 82 | } |
| 83 | |
| 84 | scrolling_layer_id_from_previous_tree_ = 0; |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() { |
| 88 | // Clear all data structures that have direct references to the layer tree. |
| 89 | scrolling_layer_id_from_previous_tree_ = |
| 90 | currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; |
[email protected] | 69b50ec | 2013-01-19 04:58:01 | [diff] [blame] | 91 | root_scroll_layer_ = NULL; |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 92 | currently_scrolling_layer_ = NULL; |
| 93 | |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 94 | render_surface_layer_list_.clear(); |
[email protected] | 615c78a | 2013-01-24 23:44:16 | [diff] [blame] | 95 | set_needs_update_draw_properties(); |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 96 | return root_layer_.Pass(); |
| 97 | } |
| 98 | |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 99 | void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 100 | target_tree->SetPageScaleFactorAndLimits( |
| 101 | page_scale_factor(), min_page_scale_factor(), max_page_scale_factor()); |
| 102 | target_tree->SetPageScaleDelta( |
| 103 | target_tree->page_scale_delta() / target_tree->sent_page_scale_delta()); |
| 104 | target_tree->set_sent_page_scale_delta(1); |
| 105 | |
| 106 | // This should match the property synchronization in |
| 107 | // LayerTreeHost::finishCommitOnImplThread(). |
| 108 | target_tree->set_source_frame_number(source_frame_number()); |
| 109 | target_tree->set_background_color(background_color()); |
| 110 | target_tree->set_has_transparent_background(has_transparent_background()); |
| 111 | |
| 112 | if (ContentsTexturesPurged()) |
| 113 | target_tree->SetContentsTexturesPurged(); |
| 114 | else |
| 115 | target_tree->ResetContentsTexturesPurged(); |
| 116 | |
[email protected] | 31882285 | 2013-02-14 00:54:27 | [diff] [blame] | 117 | if (ViewportSizeInvalid()) |
| 118 | target_tree->SetViewportSizeInvalid(); |
| 119 | else |
| 120 | target_tree->ResetViewportSizeInvalid(); |
| 121 | |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 122 | if (hud_layer()) |
| 123 | target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( |
| 124 | LayerTreeHostCommon::findLayerInSubtree( |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 125 | target_tree->root_layer(), hud_layer()->id()))); |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 126 | else |
| 127 | target_tree->set_hud_layer(NULL); |
[email protected] | b7c4783f | 2013-03-15 23:11:42 | [diff] [blame^] | 128 | |
| 129 | target_tree->SetPinchZoomHorizontalLayerId( |
| 130 | pinch_zoom_scrollbar_horizontal_layer_id_); |
| 131 | target_tree->SetPinchZoomVerticalLayerId( |
| 132 | pinch_zoom_scrollbar_vertical_layer_id_); |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 133 | } |
| 134 | |
[email protected] | ffb2720f | 2013-03-15 19:18:37 | [diff] [blame] | 135 | LayerImpl* LayerTreeImpl::RootScrollLayer() const { |
[email protected] | 69b50ec | 2013-01-19 04:58:01 | [diff] [blame] | 136 | DCHECK(IsActiveTree()); |
| 137 | return root_scroll_layer_; |
| 138 | } |
| 139 | |
[email protected] | ffb2720f | 2013-03-15 19:18:37 | [diff] [blame] | 140 | LayerImpl* LayerTreeImpl::RootClipLayer() const { |
| 141 | return root_scroll_layer_ ? root_scroll_layer_->parent() : NULL; |
| 142 | } |
| 143 | |
| 144 | LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() const { |
[email protected] | 69b50ec | 2013-01-19 04:58:01 | [diff] [blame] | 145 | DCHECK(IsActiveTree()); |
| 146 | return currently_scrolling_layer_; |
| 147 | } |
| 148 | |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 149 | void LayerTreeImpl::ClearCurrentlyScrollingLayer() { |
| 150 | currently_scrolling_layer_ = NULL; |
| 151 | scrolling_layer_id_from_previous_tree_ = 0; |
| 152 | } |
| 153 | |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 154 | void LayerTreeImpl::SetPageScaleFactorAndLimits(float page_scale_factor, |
| 155 | float min_page_scale_factor, float max_page_scale_factor) |
| 156 | { |
| 157 | if (!page_scale_factor) |
| 158 | return; |
| 159 | |
| 160 | min_page_scale_factor_ = min_page_scale_factor; |
| 161 | max_page_scale_factor_ = max_page_scale_factor; |
| 162 | page_scale_factor_ = page_scale_factor; |
| 163 | } |
| 164 | |
| 165 | void LayerTreeImpl::SetPageScaleDelta(float delta) |
| 166 | { |
| 167 | // Clamp to the current min/max limits. |
| 168 | float total = page_scale_factor_ * delta; |
| 169 | if (min_page_scale_factor_ && total < min_page_scale_factor_) |
| 170 | delta = min_page_scale_factor_ / page_scale_factor_; |
| 171 | else if (max_page_scale_factor_ && total > max_page_scale_factor_) |
| 172 | delta = max_page_scale_factor_ / page_scale_factor_; |
| 173 | |
| 174 | if (delta == page_scale_delta_) |
| 175 | return; |
| 176 | |
| 177 | page_scale_delta_ = delta; |
| 178 | |
| 179 | if (IsActiveTree()) { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 180 | LayerTreeImpl* pending_tree = layer_tree_host_impl_->pending_tree(); |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 181 | if (pending_tree) { |
| 182 | DCHECK_EQ(1, pending_tree->sent_page_scale_delta()); |
| 183 | pending_tree->SetPageScaleDelta(page_scale_delta_ / sent_page_scale_delta_); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | UpdateMaxScrollOffset(); |
| 188 | set_needs_update_draw_properties(); |
| 189 | } |
| 190 | |
[email protected] | 257abfa8 | 2013-01-29 23:47:24 | [diff] [blame] | 191 | gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const { |
[email protected] | ffb2720f | 2013-03-15 19:18:37 | [diff] [blame] | 192 | return gfx::ScaleSize(layer_tree_host_impl_->VisibleViewportSize(), |
| 193 | 1.0f / total_page_scale_factor()); |
[email protected] | 257abfa8 | 2013-01-29 23:47:24 | [diff] [blame] | 194 | } |
| 195 | |
[email protected] | caa567d | 2012-12-20 07:56:16 | [diff] [blame] | 196 | void LayerTreeImpl::UpdateMaxScrollOffset() { |
[email protected] | 69b50ec | 2013-01-19 04:58:01 | [diff] [blame] | 197 | if (!root_scroll_layer_ || !root_scroll_layer_->children().size()) |
[email protected] | caa567d | 2012-12-20 07:56:16 | [diff] [blame] | 198 | return; |
| 199 | |
[email protected] | 42ccdbef | 2013-01-21 07:54:54 | [diff] [blame] | 200 | gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - |
[email protected] | 257abfa8 | 2013-01-29 23:47:24 | [diff] [blame] | 201 | gfx::RectF(ScrollableViewportSize()).bottom_right(); |
[email protected] | caa567d | 2012-12-20 07:56:16 | [diff] [blame] | 202 | |
| 203 | // The viewport may be larger than the contents in some cases, such as |
| 204 | // having a vertical scrollbar but no horizontal overflow. |
| 205 | max_scroll.ClampToMin(gfx::Vector2dF()); |
| 206 | |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 207 | root_scroll_layer_->SetMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); |
[email protected] | caa567d | 2012-12-20 07:56:16 | [diff] [blame] | 208 | } |
| 209 | |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 210 | gfx::Transform LayerTreeImpl::ImplTransform() const { |
| 211 | gfx::Transform transform; |
[email protected] | c2d0c5a | 2013-02-26 04:43:36 | [diff] [blame] | 212 | transform.Scale(total_page_scale_factor(), total_page_scale_factor()); |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 213 | return transform; |
| 214 | } |
| 215 | |
[email protected] | ffb2720f | 2013-03-15 19:18:37 | [diff] [blame] | 216 | void LayerTreeImpl::UpdateSolidColorScrollbars() { |
| 217 | DCHECK(settings().solidColorScrollbars); |
| 218 | |
| 219 | LayerImpl* root_scroll = RootScrollLayer(); |
| 220 | if (!root_scroll) |
| 221 | return; |
| 222 | |
| 223 | if (!IsActiveTree()) |
| 224 | return; |
| 225 | |
| 226 | gfx::RectF scrollable_viewport( |
| 227 | gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), |
| 228 | ScrollableViewportSize()); |
| 229 | float vertical_adjust = 0.0f; |
| 230 | if (RootClipLayer()) |
| 231 | vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - |
| 232 | RootClipLayer()->bounds().height(); |
| 233 | if (ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer()) { |
| 234 | horiz->set_vertical_adjust(vertical_adjust); |
| 235 | horiz->SetViewportWithinScrollableArea(scrollable_viewport, |
| 236 | ScrollableSize()); |
| 237 | } |
| 238 | if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { |
| 239 | vertical->set_vertical_adjust(vertical_adjust); |
| 240 | vertical->SetViewportWithinScrollableArea(scrollable_viewport, |
| 241 | ScrollableSize()); |
| 242 | } |
| 243 | } |
| 244 | |
[email protected] | 4c9bb95 | 2013-01-27 05:41:18 | [diff] [blame] | 245 | struct UpdateTilePrioritiesForLayer { |
| 246 | void operator()(LayerImpl *layer) { |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 247 | layer->UpdateTilePriorities(); |
[email protected] | 4c9bb95 | 2013-01-27 05:41:18 | [diff] [blame] | 248 | } |
| 249 | }; |
| 250 | |
| 251 | void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) { |
[email protected] | ffb2720f | 2013-03-15 19:18:37 | [diff] [blame] | 252 | if (settings().solidColorScrollbars && IsActiveTree()) { |
| 253 | UpdateSolidColorScrollbars(); |
| 254 | |
| 255 | // The top controls manager is incompatible with the WebKit-created cliprect |
| 256 | // because it can bring into view a larger amount of content when it |
| 257 | // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars |
| 258 | // are present. |
| 259 | if (layer_tree_host_impl_->top_controls_manager()) |
| 260 | RootScrollLayer()->parent()->SetMasksToBounds(false); |
| 261 | } |
| 262 | |
[email protected] | 4c9bb95 | 2013-01-27 05:41:18 | [diff] [blame] | 263 | if (!needs_update_draw_properties_) { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 264 | if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && root_layer()) |
[email protected] | 4c9bb95 | 2013-01-27 05:41:18 | [diff] [blame] | 265 | LayerTreeHostCommon::callFunctionForSubtree<UpdateTilePrioritiesForLayer>( |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 266 | root_layer()); |
[email protected] | 615c78a | 2013-01-24 23:44:16 | [diff] [blame] | 267 | return; |
[email protected] | 4c9bb95 | 2013-01-27 05:41:18 | [diff] [blame] | 268 | } |
[email protected] | 615c78a | 2013-01-24 23:44:16 | [diff] [blame] | 269 | |
| 270 | needs_update_draw_properties_ = false; |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 271 | render_surface_layer_list_.clear(); |
[email protected] | 615c78a | 2013-01-24 23:44:16 | [diff] [blame] | 272 | |
| 273 | // For maxTextureSize. |
| 274 | if (!layer_tree_host_impl_->renderer()) |
| 275 | return; |
| 276 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 277 | if (!root_layer()) |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 278 | return; |
| 279 | |
[email protected] | 69b50ec | 2013-01-19 04:58:01 | [diff] [blame] | 280 | if (root_scroll_layer_) { |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 281 | root_scroll_layer_->SetImplTransform(ImplTransform()); |
[email protected] | 615c78a | 2013-01-24 23:44:16 | [diff] [blame] | 282 | // Setting the impl transform re-sets this. |
| 283 | needs_update_draw_properties_ = false; |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 287 | TRACE_EVENT1("cc", |
| 288 | "LayerTreeImpl::UpdateDrawProperties", |
| 289 | "IsActive", |
| 290 | IsActiveTree()); |
[email protected] | 4c9bb95 | 2013-01-27 05:41:18 | [diff] [blame] | 291 | bool update_tile_priorities = |
| 292 | reason == UPDATE_PENDING_TREE || |
| 293 | reason == UPDATE_ACTIVE_TREE_FOR_DRAW; |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 294 | LayerTreeHostCommon::calculateDrawProperties( |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 295 | root_layer(), |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 296 | device_viewport_size(), |
| 297 | device_scale_factor(), |
[email protected] | c6027947 | 2013-01-30 12:10:51 | [diff] [blame] | 298 | total_page_scale_factor(), |
[email protected] | f677653 | 2012-12-21 20:24:33 | [diff] [blame] | 299 | MaxTextureSize(), |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 300 | settings().canUseLCDText, |
[email protected] | 4c9bb95 | 2013-01-27 05:41:18 | [diff] [blame] | 301 | render_surface_layer_list_, |
| 302 | update_tile_priorities); |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 303 | } |
[email protected] | 615c78a | 2013-01-24 23:44:16 | [diff] [blame] | 304 | |
| 305 | DCHECK(!needs_update_draw_properties_) << |
| 306 | "calcDrawProperties should not set_needs_update_draw_properties()"; |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) |
| 310 | { |
| 311 | DCHECK(current); |
| 312 | for (size_t i = 0; i < current->children().size(); ++i) |
| 313 | ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]); |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 314 | current->ClearRenderSurface(); |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | void LayerTreeImpl::ClearRenderSurfaces() { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 318 | ClearRenderSurfacesOnLayerImplRecursive(root_layer()); |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 319 | render_surface_layer_list_.clear(); |
[email protected] | 615c78a | 2013-01-24 23:44:16 | [diff] [blame] | 320 | set_needs_update_draw_properties(); |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 321 | } |
| 322 | |
[email protected] | b0a917c8d | 2013-01-12 17:42:25 | [diff] [blame] | 323 | bool LayerTreeImpl::AreVisibleResourcesReady() const { |
| 324 | TRACE_EVENT0("cc", "LayerTreeImpl::AreVisibleResourcesReady"); |
| 325 | |
| 326 | typedef LayerIterator<LayerImpl, |
| 327 | std::vector<LayerImpl*>, |
| 328 | RenderSurfaceImpl, |
| 329 | LayerIteratorActions::BackToFront> LayerIteratorType; |
| 330 | LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list_); |
| 331 | for (LayerIteratorType it = LayerIteratorType::begin( |
| 332 | &render_surface_layer_list_); it != end; ++it) { |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 333 | if (it.representsItself() && !(*it)->AreVisibleResourcesReady()) |
[email protected] | b0a917c8d | 2013-01-12 17:42:25 | [diff] [blame] | 334 | return false; |
| 335 | } |
| 336 | |
| 337 | return true; |
| 338 | } |
| 339 | |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 340 | const LayerTreeImpl::LayerList& LayerTreeImpl::RenderSurfaceLayerList() const { |
| 341 | // If this assert triggers, then the list is dirty. |
[email protected] | 615c78a | 2013-01-24 23:44:16 | [diff] [blame] | 342 | DCHECK(!needs_update_draw_properties_); |
[email protected] | 76ffd9e | 2012-12-20 19:12:47 | [diff] [blame] | 343 | return render_surface_layer_list_; |
| 344 | } |
| 345 | |
[email protected] | 42ccdbef | 2013-01-21 07:54:54 | [diff] [blame] | 346 | gfx::Size LayerTreeImpl::ScrollableSize() const { |
[email protected] | c4d467a | 2013-01-21 03:21:01 | [diff] [blame] | 347 | if (!root_scroll_layer_ || root_scroll_layer_->children().empty()) |
[email protected] | caa567d | 2012-12-20 07:56:16 | [diff] [blame] | 348 | return gfx::Size(); |
[email protected] | c4d467a | 2013-01-21 03:21:01 | [diff] [blame] | 349 | return root_scroll_layer_->children()[0]->bounds(); |
[email protected] | caa567d | 2012-12-20 07:56:16 | [diff] [blame] | 350 | } |
| 351 | |
[email protected] | 361bc00d | 2012-12-14 07:03:24 | [diff] [blame] | 352 | LayerImpl* LayerTreeImpl::LayerById(int id) { |
| 353 | LayerIdMap::iterator iter = layer_id_map_.find(id); |
| 354 | return iter != layer_id_map_.end() ? iter->second : NULL; |
| 355 | } |
| 356 | |
| 357 | void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { |
| 358 | DCHECK(!LayerById(layer->id())); |
| 359 | layer_id_map_[layer->id()] = layer; |
| 360 | } |
| 361 | |
| 362 | void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { |
| 363 | DCHECK(LayerById(layer->id())); |
| 364 | layer_id_map_.erase(layer->id()); |
| 365 | } |
| 366 | |
[email protected] | 1e0f8d6 | 2013-01-09 07:41:35 | [diff] [blame] | 367 | void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pendingTree) { |
| 368 | int id = currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; |
| 369 | pendingTree->set_currently_scrolling_layer( |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 370 | LayerTreeHostCommon::findLayerInSubtree(pendingTree->root_layer(), id)); |
[email protected] | 1e0f8d6 | 2013-01-09 07:41:35 | [diff] [blame] | 371 | } |
| 372 | |
[email protected] | 37386f05 | 2013-01-13 00:42:22 | [diff] [blame] | 373 | static void DidBecomeActiveRecursive(LayerImpl* layer) { |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 374 | layer->DidBecomeActive(); |
[email protected] | 37386f05 | 2013-01-13 00:42:22 | [diff] [blame] | 375 | for (size_t i = 0; i < layer->children().size(); ++i) |
| 376 | DidBecomeActiveRecursive(layer->children()[i]); |
| 377 | } |
| 378 | |
| 379 | void LayerTreeImpl::DidBecomeActive() { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 380 | if (root_layer()) |
| 381 | DidBecomeActiveRecursive(root_layer()); |
[email protected] | 69b50ec | 2013-01-19 04:58:01 | [diff] [blame] | 382 | FindRootScrollLayer(); |
| 383 | UpdateMaxScrollOffset(); |
[email protected] | b7c4783f | 2013-03-15 23:11:42 | [diff] [blame^] | 384 | // Main thread scrolls do not get handled in LayerTreeHostImpl, so after |
| 385 | // each commit (and after the root scroll layer has its max scroll offset |
| 386 | // set), we need to update pinch zoom scrollbars. |
| 387 | UpdatePinchZoomScrollbars(); |
[email protected] | 37386f05 | 2013-01-13 00:42:22 | [diff] [blame] | 388 | } |
| 389 | |
[email protected] | 6f90b9e | 2013-01-17 23:42:00 | [diff] [blame] | 390 | bool LayerTreeImpl::ContentsTexturesPurged() const { |
| 391 | return contents_textures_purged_; |
| 392 | } |
| 393 | |
| 394 | void LayerTreeImpl::SetContentsTexturesPurged() { |
| 395 | contents_textures_purged_ = true; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 396 | layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
[email protected] | 6f90b9e | 2013-01-17 23:42:00 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | void LayerTreeImpl::ResetContentsTexturesPurged() { |
| 400 | contents_textures_purged_ = false; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 401 | layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
[email protected] | 6f90b9e | 2013-01-17 23:42:00 | [diff] [blame] | 402 | } |
| 403 | |
[email protected] | 31882285 | 2013-02-14 00:54:27 | [diff] [blame] | 404 | bool LayerTreeImpl::ViewportSizeInvalid() const { |
| 405 | return viewport_size_invalid_; |
| 406 | } |
| 407 | |
| 408 | void LayerTreeImpl::SetViewportSizeInvalid() { |
| 409 | viewport_size_invalid_ = true; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 410 | layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
[email protected] | 31882285 | 2013-02-14 00:54:27 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | void LayerTreeImpl::ResetViewportSizeInvalid() { |
| 414 | viewport_size_invalid_ = false; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 415 | layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
[email protected] | 31882285 | 2013-02-14 00:54:27 | [diff] [blame] | 416 | } |
| 417 | |
[email protected] | 48871fc | 2013-01-23 07:36:51 | [diff] [blame] | 418 | Proxy* LayerTreeImpl::proxy() const { |
| 419 | return layer_tree_host_impl_->proxy(); |
| 420 | } |
| 421 | |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 422 | const LayerTreeSettings& LayerTreeImpl::settings() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 423 | return layer_tree_host_impl_->settings(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 424 | } |
| 425 | |
[email protected] | bf5b3a0 | 2013-02-13 02:02:52 | [diff] [blame] | 426 | const RendererCapabilities& LayerTreeImpl::rendererCapabilities() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 427 | return layer_tree_host_impl_->GetRendererCapabilities(); |
[email protected] | bf5b3a0 | 2013-02-13 02:02:52 | [diff] [blame] | 428 | } |
| 429 | |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 430 | OutputSurface* LayerTreeImpl::output_surface() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 431 | return layer_tree_host_impl_->output_surface(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 432 | } |
| 433 | |
| 434 | ResourceProvider* LayerTreeImpl::resource_provider() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 435 | return layer_tree_host_impl_->resource_provider(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | TileManager* LayerTreeImpl::tile_manager() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 439 | return layer_tree_host_impl_->tile_manager(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | FrameRateCounter* LayerTreeImpl::frame_rate_counter() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 443 | return layer_tree_host_impl_->fps_counter(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 444 | } |
| 445 | |
[email protected] | 71691c2 | 2013-01-18 03:14:22 | [diff] [blame] | 446 | PaintTimeCounter* LayerTreeImpl::paint_time_counter() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 447 | return layer_tree_host_impl_->paint_time_counter(); |
[email protected] | 71691c2 | 2013-01-18 03:14:22 | [diff] [blame] | 448 | } |
| 449 | |
[email protected] | 1191d9d | 2013-02-02 06:00:33 | [diff] [blame] | 450 | MemoryHistory* LayerTreeImpl::memory_history() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 451 | return layer_tree_host_impl_->memory_history(); |
[email protected] | 1191d9d | 2013-02-02 06:00:33 | [diff] [blame] | 452 | } |
| 453 | |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 454 | bool LayerTreeImpl::IsActiveTree() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 455 | return layer_tree_host_impl_->active_tree() == this; |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 456 | } |
| 457 | |
| 458 | bool LayerTreeImpl::IsPendingTree() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 459 | return layer_tree_host_impl_->pending_tree() == this; |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 460 | } |
| 461 | |
[email protected] | 48871fc | 2013-01-23 07:36:51 | [diff] [blame] | 462 | bool LayerTreeImpl::IsRecycleTree() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 463 | return layer_tree_host_impl_->recycle_tree() == this; |
[email protected] | 48871fc | 2013-01-23 07:36:51 | [diff] [blame] | 464 | } |
| 465 | |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 466 | LayerImpl* LayerTreeImpl::FindActiveTreeLayerById(int id) { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 467 | LayerTreeImpl* tree = layer_tree_host_impl_->active_tree(); |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 468 | if (!tree) |
| 469 | return NULL; |
| 470 | return tree->LayerById(id); |
| 471 | } |
| 472 | |
| 473 | LayerImpl* LayerTreeImpl::FindPendingTreeLayerById(int id) { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 474 | LayerTreeImpl* tree = layer_tree_host_impl_->pending_tree(); |
[email protected] | f117a4c | 2012-12-16 04:53:10 | [diff] [blame] | 475 | if (!tree) |
| 476 | return NULL; |
| 477 | return tree->LayerById(id); |
| 478 | } |
| 479 | |
[email protected] | f677653 | 2012-12-21 20:24:33 | [diff] [blame] | 480 | int LayerTreeImpl::MaxTextureSize() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 481 | return layer_tree_host_impl_->GetRendererCapabilities().max_texture_size; |
[email protected] | f677653 | 2012-12-21 20:24:33 | [diff] [blame] | 482 | } |
| 483 | |
[email protected] | 166db5c8 | 2013-01-09 23:54:31 | [diff] [blame] | 484 | bool LayerTreeImpl::PinchGestureActive() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 485 | return layer_tree_host_impl_->pinch_gesture_active(); |
[email protected] | 166db5c8 | 2013-01-09 23:54:31 | [diff] [blame] | 486 | } |
| 487 | |
[email protected] | 829ad97 | 2013-01-28 23:36:10 | [diff] [blame] | 488 | base::TimeTicks LayerTreeImpl::CurrentFrameTime() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 489 | return layer_tree_host_impl_->CurrentFrameTime(); |
[email protected] | 829ad97 | 2013-01-28 23:36:10 | [diff] [blame] | 490 | } |
| 491 | |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 492 | void LayerTreeImpl::SetNeedsRedraw() { |
| 493 | layer_tree_host_impl_->setNeedsRedraw(); |
| 494 | } |
| 495 | |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 496 | const LayerTreeDebugState& LayerTreeImpl::debug_state() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 497 | return layer_tree_host_impl_->debug_state(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 498 | } |
| 499 | |
| 500 | float LayerTreeImpl::device_scale_factor() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 501 | return layer_tree_host_impl_->device_scale_factor(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 502 | } |
| 503 | |
[email protected] | 90ec987 | 2013-03-08 02:28:18 | [diff] [blame] | 504 | gfx::Size LayerTreeImpl::device_viewport_size() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 505 | return layer_tree_host_impl_->device_viewport_size(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 506 | } |
| 507 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 508 | gfx::Size LayerTreeImpl::layout_viewport_size() const { |
| 509 | return layer_tree_host_impl_->layout_viewport_size(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 510 | } |
| 511 | |
| 512 | std::string LayerTreeImpl::layer_tree_as_text() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 513 | return layer_tree_host_impl_->LayerTreeAsText(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 514 | } |
| 515 | |
| 516 | DebugRectHistory* LayerTreeImpl::debug_rect_history() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 517 | return layer_tree_host_impl_->debug_rect_history(); |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 518 | } |
| 519 | |
[email protected] | de4afb5e | 2012-12-20 00:11:34 | [diff] [blame] | 520 | AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 521 | return layer_tree_host_impl_->animation_registrar(); |
[email protected] | de4afb5e | 2012-12-20 00:11:34 | [diff] [blame] | 522 | } |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 523 | |
[email protected] | 8c569022 | 2013-02-15 17:36:43 | [diff] [blame] | 524 | scoped_ptr<base::Value> LayerTreeImpl::AsValue() const { |
| 525 | scoped_ptr<base::ListValue> state(new base::ListValue()); |
| 526 | typedef LayerIterator<LayerImpl, |
| 527 | std::vector<LayerImpl*>, |
| 528 | RenderSurfaceImpl, |
| 529 | LayerIteratorActions::BackToFront> LayerIteratorType; |
| 530 | LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list_); |
| 531 | for (LayerIteratorType it = LayerIteratorType::begin( |
| 532 | &render_surface_layer_list_); it != end; ++it) { |
| 533 | if (!it.representsItself()) |
| 534 | continue; |
| 535 | state->Append((*it)->AsValue().release()); |
| 536 | } |
| 537 | return state.PassAs<base::Value>(); |
| 538 | } |
| 539 | |
[email protected] | b7c4783f | 2013-03-15 23:11:42 | [diff] [blame^] | 540 | void LayerTreeImpl::DidBeginScroll() { |
| 541 | if (HasPinchZoomScrollbars()) |
| 542 | FadeInPinchZoomScrollbars(); |
| 543 | } |
| 544 | |
| 545 | void LayerTreeImpl::DidUpdateScroll() { |
| 546 | if (HasPinchZoomScrollbars()) |
| 547 | UpdatePinchZoomScrollbars(); |
| 548 | } |
| 549 | |
| 550 | void LayerTreeImpl::DidEndScroll() { |
| 551 | if (HasPinchZoomScrollbars()) |
| 552 | FadeOutPinchZoomScrollbars(); |
| 553 | } |
| 554 | |
| 555 | void LayerTreeImpl::SetPinchZoomHorizontalLayerId(int layer_id) { |
| 556 | pinch_zoom_scrollbar_horizontal_layer_id_ = layer_id; |
| 557 | } |
| 558 | |
| 559 | ScrollbarLayerImpl* LayerTreeImpl::PinchZoomScrollbarHorizontal() { |
| 560 | return static_cast<ScrollbarLayerImpl*>(LayerById( |
| 561 | pinch_zoom_scrollbar_horizontal_layer_id_)); |
| 562 | } |
| 563 | |
| 564 | void LayerTreeImpl::SetPinchZoomVerticalLayerId(int layer_id) { |
| 565 | pinch_zoom_scrollbar_vertical_layer_id_ = layer_id; |
| 566 | } |
| 567 | |
| 568 | ScrollbarLayerImpl* LayerTreeImpl::PinchZoomScrollbarVertical() { |
| 569 | return static_cast<ScrollbarLayerImpl*>(LayerById( |
| 570 | pinch_zoom_scrollbar_vertical_layer_id_)); |
| 571 | } |
| 572 | |
| 573 | void LayerTreeImpl::UpdatePinchZoomScrollbars() { |
| 574 | LayerImpl* root_scroll_layer = RootScrollLayer(); |
| 575 | if (!root_scroll_layer) |
| 576 | return; |
| 577 | |
| 578 | if (ScrollbarLayerImpl* scrollbar = PinchZoomScrollbarHorizontal()) { |
| 579 | scrollbar->SetCurrentPos(root_scroll_layer->scroll_offset().x()); |
| 580 | scrollbar->SetTotalSize(root_scroll_layer->bounds().width()); |
| 581 | scrollbar->SetMaximum(root_scroll_layer->max_scroll_offset().x()); |
| 582 | } |
| 583 | if (ScrollbarLayerImpl* scrollbar = PinchZoomScrollbarVertical()) { |
| 584 | scrollbar->SetCurrentPos(root_scroll_layer->scroll_offset().y()); |
| 585 | scrollbar->SetTotalSize(root_scroll_layer->bounds().height()); |
| 586 | scrollbar->SetMaximum(root_scroll_layer->max_scroll_offset().y()); |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | static scoped_ptr<Animation> MakePinchZoomFadeAnimation( |
| 591 | float start_opacity, float end_opacity) { |
| 592 | scoped_ptr<KeyframedFloatAnimationCurve> curve = |
| 593 | KeyframedFloatAnimationCurve::Create(); |
| 594 | curve->AddKeyframe(FloatKeyframe::Create( |
| 595 | 0, start_opacity, EaseInTimingFunction::create())); |
| 596 | curve->AddKeyframe(FloatKeyframe::Create( |
| 597 | PinchZoomScrollbar::kFadeDurationInSeconds, end_opacity, |
| 598 | EaseInTimingFunction::create())); |
| 599 | |
| 600 | scoped_ptr<Animation> animation = Animation::Create( |
| 601 | curve.PassAs<AnimationCurve>(), AnimationIdProvider::NextAnimationId(), |
| 602 | 0, Animation::Opacity); |
| 603 | animation->set_is_impl_only(true); |
| 604 | |
| 605 | return animation.Pass(); |
| 606 | } |
| 607 | |
| 608 | static void StartFadeInAnimation(ScrollbarLayerImpl* layer) { |
| 609 | DCHECK(layer); |
| 610 | float start_opacity = layer->opacity(); |
| 611 | LayerAnimationController* controller = layer->layer_animation_controller(); |
| 612 | // TODO() It shouldn't be necessary to manually remove the old animation. |
| 613 | if (Animation* animation = controller->GetAnimation(Animation::Opacity)) |
| 614 | controller->RemoveAnimation(animation->id()); |
| 615 | controller->AddAnimation(MakePinchZoomFadeAnimation(start_opacity, |
| 616 | PinchZoomScrollbar::kDefaultOpacity)); |
| 617 | } |
| 618 | |
| 619 | void LayerTreeImpl::FadeInPinchZoomScrollbars() { |
| 620 | if (!HasPinchZoomScrollbars() || page_scale_factor_ == 1) |
| 621 | return; |
| 622 | |
| 623 | StartFadeInAnimation(PinchZoomScrollbarHorizontal()); |
| 624 | StartFadeInAnimation(PinchZoomScrollbarVertical()); |
| 625 | } |
| 626 | |
| 627 | static void StartFadeOutAnimation(LayerImpl* layer) { |
| 628 | float opacity = layer->opacity(); |
| 629 | if (!opacity) |
| 630 | return; |
| 631 | |
| 632 | LayerAnimationController* controller = layer->layer_animation_controller(); |
| 633 | // TODO(wjmaclean) It shouldn't be necessary to manually remove the old |
| 634 | // animation. |
| 635 | if (Animation* animation = controller->GetAnimation(Animation::Opacity)) |
| 636 | controller->RemoveAnimation(animation->id()); |
| 637 | controller->AddAnimation(MakePinchZoomFadeAnimation(opacity, 0)); |
| 638 | } |
| 639 | |
| 640 | void LayerTreeImpl::FadeOutPinchZoomScrollbars() { |
| 641 | if (!HasPinchZoomScrollbars()) |
| 642 | return; |
| 643 | |
| 644 | StartFadeOutAnimation(PinchZoomScrollbarHorizontal()); |
| 645 | StartFadeOutAnimation(PinchZoomScrollbarVertical()); |
| 646 | } |
| 647 | |
| 648 | bool LayerTreeImpl::HasPinchZoomScrollbars() const { |
| 649 | return pinch_zoom_scrollbar_horizontal_layer_id_ != Layer::INVALID_ID && |
| 650 | pinch_zoom_scrollbar_vertical_layer_id_ != Layer::INVALID_ID; |
| 651 | } |
| 652 | |
| 653 | |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 654 | } // namespace cc |