Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: cc/trees/layer_tree_impl.cc

Issue 18647013: Delete CC-impl-side clip layer adjustment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename to ContainerLayer Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 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 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 #include "cc/trees/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/animation/keyframed_animation_curve.h" 8 #include "cc/animation/keyframed_animation_curve.h"
9 #include "cc/animation/scrollbar_animation_controller.h" 9 #include "cc/animation/scrollbar_animation_controller.h"
10 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 target_tree->root_layer(), hud_layer()->id()))); 133 target_tree->root_layer(), hud_layer()->id())));
134 else 134 else
135 target_tree->set_hud_layer(NULL); 135 target_tree->set_hud_layer(NULL);
136 } 136 }
137 137
138 LayerImpl* LayerTreeImpl::RootScrollLayer() const { 138 LayerImpl* LayerTreeImpl::RootScrollLayer() const {
139 DCHECK(IsActiveTree()); 139 DCHECK(IsActiveTree());
140 return root_scroll_layer_; 140 return root_scroll_layer_;
141 } 141 }
142 142
143 LayerImpl* LayerTreeImpl::RootClipLayer() const { 143 LayerImpl* LayerTreeImpl::RootContainerLayer() const {
144 return root_scroll_layer_ ? root_scroll_layer_->parent() : NULL; 144 return root_scroll_layer_ ? root_scroll_layer_->parent() : NULL;
145 } 145 }
146 146
147 LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() const { 147 LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() const {
148 DCHECK(IsActiveTree()); 148 DCHECK(IsActiveTree());
149 return currently_scrolling_layer_; 149 return currently_scrolling_layer_;
150 } 150 }
151 151
152 void LayerTreeImpl::SetCurrentlyScrollingLayer(LayerImpl* layer) { 152 void LayerTreeImpl::SetCurrentlyScrollingLayer(LayerImpl* layer) {
153 if (currently_scrolling_layer_ == layer) 153 if (currently_scrolling_layer_ == layer)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 DCHECK(settings().solid_color_scrollbars); 226 DCHECK(settings().solid_color_scrollbars);
227 227
228 LayerImpl* root_scroll = RootScrollLayer(); 228 LayerImpl* root_scroll = RootScrollLayer();
229 DCHECK(root_scroll); 229 DCHECK(root_scroll);
230 DCHECK(IsActiveTree()); 230 DCHECK(IsActiveTree());
231 231
232 gfx::RectF scrollable_viewport( 232 gfx::RectF scrollable_viewport(
233 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), 233 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()),
234 ScrollableViewportSize()); 234 ScrollableViewportSize());
235 float vertical_adjust = 0.0f; 235 float vertical_adjust = 0.0f;
236 if (RootClipLayer()) 236 if (RootContainerLayer())
237 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - 237 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() -
238 RootClipLayer()->bounds().height(); 238 RootContainerLayer()->bounds().height();
239 if (ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer()) { 239 if (ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer()) {
240 horiz->set_vertical_adjust(vertical_adjust); 240 horiz->set_vertical_adjust(vertical_adjust);
241 horiz->set_visible_to_total_length_ratio( 241 horiz->set_visible_to_total_length_ratio(
242 scrollable_viewport.width() / ScrollableSize().width()); 242 scrollable_viewport.width() / ScrollableSize().width());
243 } 243 }
244 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { 244 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) {
245 vertical->set_vertical_adjust(vertical_adjust); 245 vertical->set_vertical_adjust(vertical_adjust);
246 vertical->set_visible_to_total_length_ratio( 246 vertical->set_visible_to_total_length_ratio(
247 scrollable_viewport.height() / ScrollableSize().height()); 247 scrollable_viewport.height() / ScrollableSize().height());
248 } 248 }
249 } 249 }
250 250
251 void LayerTreeImpl::UpdateDrawProperties() { 251 void LayerTreeImpl::UpdateDrawProperties() {
252 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) 252 if (IsActiveTree() && RootScrollLayer() && RootContainerLayer())
253 UpdateRootScrollLayerSizeDelta(); 253 UpdateRootScrollLayerSizeDelta();
254 254
255 if (settings().solid_color_scrollbars && 255 if (settings().solid_color_scrollbars &&
256 IsActiveTree() && 256 IsActiveTree() &&
257 RootScrollLayer()) { 257 RootScrollLayer()) {
258 UpdateSolidColorScrollbars(); 258 UpdateSolidColorScrollbars();
259
260 // The top controls manager is incompatible with the WebKit-created cliprect
261 // because it can bring into view a larger amount of content when it
262 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars
263 // are present.
264 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager())
265 RootClipLayer()->SetMasksToBounds(false);
266 } 259 }
267 260
268 needs_update_draw_properties_ = false; 261 needs_update_draw_properties_ = false;
269 render_surface_layer_list_.clear(); 262 render_surface_layer_list_.clear();
270 263
271 // For max_texture_size. 264 // For max_texture_size.
272 if (!layer_tree_host_impl_->renderer()) 265 if (!layer_tree_host_impl_->renderer())
273 return; 266 return;
274 267
275 if (!root_layer()) 268 if (!root_layer())
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) { 511 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) {
519 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate; 512 root_layer_scroll_offset_delegate_ = root_layer_scroll_offset_delegate;
520 if (root_scroll_layer_) { 513 if (root_scroll_layer_) {
521 root_scroll_layer_->SetScrollOffsetDelegate( 514 root_scroll_layer_->SetScrollOffsetDelegate(
522 root_layer_scroll_offset_delegate_); 515 root_layer_scroll_offset_delegate_);
523 } 516 }
524 } 517 }
525 518
526 void LayerTreeImpl::UpdateRootScrollLayerSizeDelta() { 519 void LayerTreeImpl::UpdateRootScrollLayerSizeDelta() {
527 LayerImpl* root_scroll = RootScrollLayer(); 520 LayerImpl* root_scroll = RootScrollLayer();
528 LayerImpl* root_clip = RootClipLayer(); 521 LayerImpl* root_container = RootContainerLayer();
529 DCHECK(root_scroll); 522 DCHECK(root_scroll);
530 DCHECK(root_clip); 523 DCHECK(root_container);
531 DCHECK(IsActiveTree()); 524 DCHECK(IsActiveTree());
532 525
533 gfx::Vector2dF scrollable_viewport_size = 526 gfx::Vector2dF scrollable_viewport_size =
534 gfx::RectF(ScrollableViewportSize()).bottom_right() - gfx::PointF(); 527 gfx::RectF(ScrollableViewportSize()).bottom_right() - gfx::PointF();
535 528
536 gfx::Vector2dF original_viewport_size = 529 gfx::Vector2dF original_viewport_size =
537 gfx::RectF(root_clip->bounds()).bottom_right() - 530 gfx::RectF(root_container->bounds()).bottom_right() -
538 gfx::PointF(); 531 gfx::PointF();
539 original_viewport_size.Scale(1 / page_scale_factor()); 532 original_viewport_size.Scale(1 / page_scale_factor());
540 533
541 root_scroll->SetFixedContainerSizeDelta( 534 root_scroll->SetFixedContainerSizeDelta(
542 scrollable_viewport_size - original_viewport_size); 535 scrollable_viewport_size - original_viewport_size);
543 } 536 }
544 537
545 void LayerTreeImpl::SetLatencyInfo(const ui::LatencyInfo& latency_info) { 538 void LayerTreeImpl::SetLatencyInfo(const ui::LatencyInfo& latency_info) {
546 latency_info_.MergeWith(latency_info); 539 latency_info_.MergeWith(latency_info);
547 } 540 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() 579 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest()
587 const { 580 const {
588 // Only the active tree needs to know about layers with copy requests, as 581 // Only the active tree needs to know about layers with copy requests, as
589 // they are aborted if not serviced during draw. 582 // they are aborted if not serviced during draw.
590 DCHECK(IsActiveTree()); 583 DCHECK(IsActiveTree());
591 584
592 return layers_with_copy_output_request_; 585 return layers_with_copy_output_request_;
593 } 586 }
594 587
595 } // namespace cc 588 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698