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

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

Issue 23171014: Fix UpdateTilePriorities viewport in Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to 221292 Created 7 years, 3 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
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 pending_tree->SetPageScaleDelta( 200 pending_tree->SetPageScaleDelta(
201 page_scale_delta_ / sent_page_scale_delta_); 201 page_scale_delta_ / sent_page_scale_delta_);
202 } 202 }
203 } 203 }
204 204
205 UpdateMaxScrollOffset(); 205 UpdateMaxScrollOffset();
206 set_needs_update_draw_properties(); 206 set_needs_update_draw_properties();
207 } 207 }
208 208
209 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const { 209 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const {
210 return gfx::ScaleSize(layer_tree_host_impl_->VisibleViewportSize(), 210 return gfx::ScaleSize(layer_tree_host_impl_->UnscaledScrollableViewportSize(),
211 1.0f / total_page_scale_factor()); 211 1.0f / total_page_scale_factor());
212 } 212 }
213 213
214 void LayerTreeImpl::UpdateMaxScrollOffset() { 214 void LayerTreeImpl::UpdateMaxScrollOffset() {
215 LayerImpl* root_scroll = RootScrollLayer(); 215 LayerImpl* root_scroll = RootScrollLayer();
216 if (!root_scroll || !root_scroll->children().size()) 216 if (!root_scroll || !root_scroll->children().size())
217 return; 217 return;
218 218
219 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - 219 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() -
220 gfx::RectF(ScrollableViewportSize()).bottom_right(); 220 gfx::RectF(ScrollableViewportSize()).bottom_right();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 LayerImpl* root_scroll = RootScrollLayer(); 266 LayerImpl* root_scroll = RootScrollLayer();
267 DCHECK(root_scroll); 267 DCHECK(root_scroll);
268 DCHECK(IsActiveTree()); 268 DCHECK(IsActiveTree());
269 269
270 gfx::RectF scrollable_viewport( 270 gfx::RectF scrollable_viewport(
271 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), 271 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()),
272 ScrollableViewportSize()); 272 ScrollableViewportSize());
273 float vertical_adjust = 0.0f; 273 float vertical_adjust = 0.0f;
274 if (RootContainerLayer()) 274 if (RootContainerLayer())
275 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - 275 vertical_adjust =
276 RootContainerLayer()->bounds().height(); 276 layer_tree_host_impl_->UnscaledScrollableViewportSize().height() -
277 RootContainerLayer()->bounds().height();
277 if (ScrollbarLayerImplBase* horiz = 278 if (ScrollbarLayerImplBase* horiz =
278 root_scroll->horizontal_scrollbar_layer()) { 279 root_scroll->horizontal_scrollbar_layer()) {
279 horiz->SetVerticalAdjust(vertical_adjust); 280 horiz->SetVerticalAdjust(vertical_adjust);
280 horiz->SetVisibleToTotalLengthRatio( 281 horiz->SetVisibleToTotalLengthRatio(
281 scrollable_viewport.width() / ScrollableSize().width()); 282 scrollable_viewport.width() / ScrollableSize().width());
282 } 283 }
283 if (ScrollbarLayerImplBase* vertical = 284 if (ScrollbarLayerImplBase* vertical =
284 root_scroll->vertical_scrollbar_layer()) { 285 root_scroll->vertical_scrollbar_layer()) {
285 vertical->SetVerticalAdjust(vertical_adjust); 286 vertical->SetVerticalAdjust(vertical_adjust);
286 vertical->SetVisibleToTotalLengthRatio( 287 vertical->SetVisibleToTotalLengthRatio(
(...skipping 23 matching lines...) Expand all
310 311
311 { 312 {
312 TRACE_EVENT2("cc", 313 TRACE_EVENT2("cc",
313 "LayerTreeImpl::UpdateDrawProperties", 314 "LayerTreeImpl::UpdateDrawProperties",
314 "IsActive", 315 "IsActive",
315 IsActiveTree(), 316 IsActiveTree(),
316 "SourceFrameNumber", 317 "SourceFrameNumber",
317 source_frame_number_); 318 source_frame_number_);
318 LayerTreeHostCommon::CalcDrawPropsImplInputs inputs( 319 LayerTreeHostCommon::CalcDrawPropsImplInputs inputs(
319 root_layer(), 320 root_layer(),
320 layer_tree_host_impl_->DeviceViewport().size(), 321 DrawViewportSize(),
321 layer_tree_host_impl_->DeviceTransform(), 322 layer_tree_host_impl_->DrawTransform(),
322 device_scale_factor(), 323 device_scale_factor(),
323 total_page_scale_factor(), 324 total_page_scale_factor(),
324 root_scroll_layer_ ? root_scroll_layer_->parent() : NULL, 325 root_scroll_layer_ ? root_scroll_layer_->parent() : NULL,
325 MaxTextureSize(), 326 MaxTextureSize(),
326 settings().can_use_lcd_text, 327 settings().can_use_lcd_text,
327 settings().layer_transforms_should_scale_layer_contents, 328 settings().layer_transforms_should_scale_layer_contents,
328 &render_surface_layer_list_); 329 &render_surface_layer_list_);
329 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 330 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
330 } 331 }
331 332
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 448 }
448 449
449 PaintTimeCounter* LayerTreeImpl::paint_time_counter() const { 450 PaintTimeCounter* LayerTreeImpl::paint_time_counter() const {
450 return layer_tree_host_impl_->paint_time_counter(); 451 return layer_tree_host_impl_->paint_time_counter();
451 } 452 }
452 453
453 MemoryHistory* LayerTreeImpl::memory_history() const { 454 MemoryHistory* LayerTreeImpl::memory_history() const {
454 return layer_tree_host_impl_->memory_history(); 455 return layer_tree_host_impl_->memory_history();
455 } 456 }
456 457
458 bool LayerTreeImpl::device_viewport_valid_for_tile_management() const {
459 return layer_tree_host_impl_->device_viewport_valid_for_tile_management();
460 }
461
457 bool LayerTreeImpl::IsActiveTree() const { 462 bool LayerTreeImpl::IsActiveTree() const {
458 return layer_tree_host_impl_->active_tree() == this; 463 return layer_tree_host_impl_->active_tree() == this;
459 } 464 }
460 465
461 bool LayerTreeImpl::IsPendingTree() const { 466 bool LayerTreeImpl::IsPendingTree() const {
462 return layer_tree_host_impl_->pending_tree() == this; 467 return layer_tree_host_impl_->pending_tree() == this;
463 } 468 }
464 469
465 bool LayerTreeImpl::IsRecycleTree() const { 470 bool LayerTreeImpl::IsRecycleTree() const {
466 return layer_tree_host_impl_->recycle_tree() == this; 471 return layer_tree_host_impl_->recycle_tree() == this;
(...skipping 30 matching lines...) Expand all
497 } 502 }
498 503
499 base::TimeTicks LayerTreeImpl::CurrentPhysicalTimeTicks() const { 504 base::TimeTicks LayerTreeImpl::CurrentPhysicalTimeTicks() const {
500 return layer_tree_host_impl_->CurrentPhysicalTimeTicks(); 505 return layer_tree_host_impl_->CurrentPhysicalTimeTicks();
501 } 506 }
502 507
503 void LayerTreeImpl::SetNeedsCommit() { 508 void LayerTreeImpl::SetNeedsCommit() {
504 layer_tree_host_impl_->SetNeedsCommit(); 509 layer_tree_host_impl_->SetNeedsCommit();
505 } 510 }
506 511
512 gfx::Size LayerTreeImpl::DrawViewportSize() const {
513 return layer_tree_host_impl_->DrawViewportSize();
514 }
515
507 void LayerTreeImpl::SetNeedsRedraw() { 516 void LayerTreeImpl::SetNeedsRedraw() {
508 layer_tree_host_impl_->SetNeedsRedraw(); 517 layer_tree_host_impl_->SetNeedsRedraw();
509 } 518 }
510 519
511 const LayerTreeDebugState& LayerTreeImpl::debug_state() const { 520 const LayerTreeDebugState& LayerTreeImpl::debug_state() const {
512 return layer_tree_host_impl_->debug_state(); 521 return layer_tree_host_impl_->debug_state();
513 } 522 }
514 523
515 float LayerTreeImpl::device_scale_factor() const { 524 float LayerTreeImpl::device_scale_factor() const {
516 return layer_tree_host_impl_->device_scale_factor(); 525 return layer_tree_host_impl_->device_scale_factor();
517 } 526 }
518 527
519 gfx::Size LayerTreeImpl::device_viewport_size() const {
520 return layer_tree_host_impl_->device_viewport_size();
521 }
522
523 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { 528 DebugRectHistory* LayerTreeImpl::debug_rect_history() const {
524 return layer_tree_host_impl_->debug_rect_history(); 529 return layer_tree_host_impl_->debug_rect_history();
525 } 530 }
526 531
527 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { 532 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const {
528 return layer_tree_host_impl_->animation_registrar(); 533 return layer_tree_host_impl_->animation_registrar();
529 } 534 }
530 535
531 scoped_ptr<base::Value> LayerTreeImpl::AsValue() const { 536 scoped_ptr<base::Value> LayerTreeImpl::AsValue() const {
532 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 537 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() 658 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest()
654 const { 659 const {
655 // Only the active tree needs to know about layers with copy requests, as 660 // Only the active tree needs to know about layers with copy requests, as
656 // they are aborted if not serviced during draw. 661 // they are aborted if not serviced during draw.
657 DCHECK(IsActiveTree()); 662 DCHECK(IsActiveTree());
658 663
659 return layers_with_copy_output_request_; 664 return layers_with_copy_output_request_;
660 } 665 }
661 666
662 } // namespace cc 667 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | content/browser/android/in_process/synchronous_compositor_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698