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

Side by Side Diff: cc/layers/layer_impl.h

Issue 23983047: Pinch/Zoom Infrastructure & Plumbing CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add fix for empty scroll-layer bounds. Created 6 years, 11 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
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 #ifndef CC_LAYERS_LAYER_IMPL_H_ 5 #ifndef CC_LAYERS_LAYER_IMPL_H_
6 #define CC_LAYERS_LAYER_IMPL_H_ 6 #define CC_LAYERS_LAYER_IMPL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 void SetScrollOffsetDelegate( 369 void SetScrollOffsetDelegate(
370 LayerScrollOffsetDelegate* scroll_offset_delegate); 370 LayerScrollOffsetDelegate* scroll_offset_delegate);
371 bool IsExternalFlingActive() const; 371 bool IsExternalFlingActive() const;
372 372
373 void SetScrollOffset(gfx::Vector2d scroll_offset); 373 void SetScrollOffset(gfx::Vector2d scroll_offset);
374 void SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset, 374 void SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset,
375 gfx::Vector2dF scroll_delta); 375 gfx::Vector2dF scroll_delta);
376 gfx::Vector2d scroll_offset() const { return scroll_offset_; } 376 gfx::Vector2d scroll_offset() const { return scroll_offset_; }
377 377
378 void SetMaxScrollOffset(gfx::Vector2d max_scroll_offset); 378 gfx::Vector2d MaxScrollOffset() const;
379 gfx::Vector2d max_scroll_offset() const { return max_scroll_offset_; } 379 gfx::Vector2dF ClampScrollToMaxScrollOffset();
380 void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
381 LayerImpl* scrollbar_clip_layer) const;
380 382
381 void SetScrollDelta(gfx::Vector2dF scroll_delta); 383 void SetScrollDelta(gfx::Vector2dF scroll_delta);
382 gfx::Vector2dF ScrollDelta() const; 384 gfx::Vector2dF ScrollDelta() const;
383 385
384 gfx::Vector2dF TotalScrollOffset() const; 386 gfx::Vector2dF TotalScrollOffset() const;
385 387
386 void SetSentScrollDelta(gfx::Vector2d sent_scroll_delta); 388 void SetSentScrollDelta(gfx::Vector2d sent_scroll_delta);
387 gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; } 389 gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; }
388 390
389 // Returns the delta of the scroll that was outside of the bounds of the 391 // Returns the delta of the scroll that was outside of the bounds of the
390 // initial scroll 392 // initial scroll
391 gfx::Vector2dF ScrollBy(gfx::Vector2dF scroll); 393 gfx::Vector2dF ScrollBy(gfx::Vector2dF scroll);
392 394
393 void SetScrollable(bool scrollable) { scrollable_ = scrollable; } 395 void SetScrollClipLayer(int scroll_clip_layer_id);
394 bool scrollable() const { return scrollable_; } 396 bool scrollable() const { return scroll_clip_layer_; }
395 397
396 void set_user_scrollable_horizontal(bool scrollable) { 398 void set_user_scrollable_horizontal(bool scrollable) {
397 user_scrollable_horizontal_ = scrollable; 399 user_scrollable_horizontal_ = scrollable;
398 } 400 }
399 void set_user_scrollable_vertical(bool scrollable) { 401 void set_user_scrollable_vertical(bool scrollable) {
400 user_scrollable_vertical_ = scrollable; 402 user_scrollable_vertical_ = scrollable;
401 } 403 }
402 404
403 void ApplySentScrollDeltasFromAbortedCommit(); 405 void ApplySentScrollDeltasFromAbortedCommit();
404 void ApplyScrollDeltasSinceBeginMainFrame(); 406 void ApplyScrollDeltasSinceBeginMainFrame();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 478
477 // Indicates that the surface previously used to render this layer 479 // Indicates that the surface previously used to render this layer
478 // was lost and that a new one has been created. Won't be called 480 // was lost and that a new one has been created. Won't be called
479 // until the new surface has been created successfully. 481 // until the new surface has been created successfully.
480 virtual void DidLoseOutputSurface(); 482 virtual void DidLoseOutputSurface();
481 483
482 ScrollbarAnimationController* scrollbar_animation_controller() const { 484 ScrollbarAnimationController* scrollbar_animation_controller() const {
483 return scrollbar_animation_controller_.get(); 485 return scrollbar_animation_controller_.get();
484 } 486 }
485 487
486 void SetHorizontalScrollbarLayer(ScrollbarLayerImplBase* scrollbar_layer); 488 typedef std::set<ScrollbarLayerImplBase*> ScrollbarSet;
487 ScrollbarLayerImplBase* horizontal_scrollbar_layer() { 489 ScrollbarSet* scrollbars() { return scrollbars_.get(); }
488 return horizontal_scrollbar_layer_; 490 void ClearScrollbars();
489 } 491 void AddScrollbar(ScrollbarLayerImplBase* layer);
490 492 void RemoveScrollbar(ScrollbarLayerImplBase* layer);
491 void SetVerticalScrollbarLayer(ScrollbarLayerImplBase* scrollbar_layer); 493 bool HasScrollbar(ScrollbarOrientation orientation) const;
492 ScrollbarLayerImplBase* vertical_scrollbar_layer() { 494 void ScrollbarParametersDidChange();
493 return vertical_scrollbar_layer_; 495 int clip_height() {
496 return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0;
494 } 497 }
495 498
496 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; 499 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
497 500
498 virtual skia::RefPtr<SkPicture> GetPicture(); 501 virtual skia::RefPtr<SkPicture> GetPicture();
499 502
500 virtual bool AreVisibleResourcesReady() const; 503 virtual bool AreVisibleResourcesReady() const;
501 504
502 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); 505 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
503 virtual void PushPropertiesTo(LayerImpl* layer); 506 virtual void PushPropertiesTo(LayerImpl* layer);
(...skipping 27 matching lines...) Expand all
531 534
532 virtual void AsValueInto(base::DictionaryValue* dict) const; 535 virtual void AsValueInto(base::DictionaryValue* dict) const;
533 536
534 void NoteLayerPropertyChanged(); 537 void NoteLayerPropertyChanged();
535 void NoteLayerPropertyChangedForSubtree(); 538 void NoteLayerPropertyChangedForSubtree();
536 539
537 // Note carefully this does not affect the current layer. 540 // Note carefully this does not affect the current layer.
538 void NoteLayerPropertyChangedForDescendants(); 541 void NoteLayerPropertyChangedForDescendants();
539 542
540 private: 543 private:
541 void UpdateScrollbarPositions();
542
543 virtual const char* LayerTypeAsString() const; 544 virtual const char* LayerTypeAsString() const;
544 545
545 // Properties internal to LayerImpl 546 // Properties internal to LayerImpl
546 LayerImpl* parent_; 547 LayerImpl* parent_;
547 OwnedLayerImplList children_; 548 OwnedLayerImplList children_;
548 549
549 LayerImpl* scroll_parent_; 550 LayerImpl* scroll_parent_;
550 551
551 // Storing a pointer to a set rather than a set since this will be rarely 552 // Storing a pointer to a set rather than a set since this will be rarely
552 // used. If this pointer turns out to be too heavy, we could have this (and 553 // used. If this pointer turns out to be too heavy, we could have this (and
(...skipping 12 matching lines...) Expand all
565 scoped_ptr<LayerImpl> replica_layer_; 566 scoped_ptr<LayerImpl> replica_layer_;
566 int layer_id_; 567 int layer_id_;
567 LayerTreeImpl* layer_tree_impl_; 568 LayerTreeImpl* layer_tree_impl_;
568 569
569 // Properties synchronized from the associated Layer. 570 // Properties synchronized from the associated Layer.
570 gfx::PointF anchor_point_; 571 gfx::PointF anchor_point_;
571 float anchor_point_z_; 572 float anchor_point_z_;
572 gfx::Size bounds_; 573 gfx::Size bounds_;
573 gfx::Vector2d scroll_offset_; 574 gfx::Vector2d scroll_offset_;
574 LayerScrollOffsetDelegate* scroll_offset_delegate_; 575 LayerScrollOffsetDelegate* scroll_offset_delegate_;
576 LayerImpl* scroll_clip_layer_;
575 bool scrollable_ : 1; 577 bool scrollable_ : 1;
576 bool should_scroll_on_main_thread_ : 1; 578 bool should_scroll_on_main_thread_ : 1;
577 bool have_wheel_event_handlers_ : 1; 579 bool have_wheel_event_handlers_ : 1;
578 bool user_scrollable_horizontal_ : 1; 580 bool user_scrollable_horizontal_ : 1;
579 bool user_scrollable_vertical_ : 1; 581 bool user_scrollable_vertical_ : 1;
580 bool stacking_order_changed_ : 1; 582 bool stacking_order_changed_ : 1;
581 // Whether the "back" of this layer should draw. 583 // Whether the "back" of this layer should draw.
582 bool double_sided_ : 1; 584 bool double_sided_ : 1;
583 585
584 // Tracks if drawing-related properties have changed since last redraw. 586 // Tracks if drawing-related properties have changed since last redraw.
(...skipping 22 matching lines...) Expand all
607 gfx::Transform transform_; 609 gfx::Transform transform_;
608 610
609 // This property is effective when 611 // This property is effective when
610 // is_container_for_fixed_position_layers_ == true, 612 // is_container_for_fixed_position_layers_ == true,
611 gfx::Vector2dF fixed_container_size_delta_; 613 gfx::Vector2dF fixed_container_size_delta_;
612 614
613 LayerPositionConstraint position_constraint_; 615 LayerPositionConstraint position_constraint_;
614 616
615 gfx::Vector2dF scroll_delta_; 617 gfx::Vector2dF scroll_delta_;
616 gfx::Vector2d sent_scroll_delta_; 618 gfx::Vector2d sent_scroll_delta_;
617 gfx::Vector2d max_scroll_offset_;
618 gfx::Vector2dF last_scroll_offset_; 619 gfx::Vector2dF last_scroll_offset_;
619 620
620 // The global depth value of the center of the layer. This value is used 621 // The global depth value of the center of the layer. This value is used
621 // to sort layers from back to front. 622 // to sort layers from back to front.
622 float draw_depth_; 623 float draw_depth_;
623 624
624 // Debug layer name. 625 // Debug layer name.
625 std::string debug_name_; 626 std::string debug_name_;
626 627
627 FilterOperations filters_; 628 FilterOperations filters_;
628 FilterOperations background_filters_; 629 FilterOperations background_filters_;
629 630
630 protected: 631 protected:
631 DrawMode current_draw_mode_; 632 DrawMode current_draw_mode_;
632 633
633 private: 634 private:
634 // Rect indicating what was repainted/updated during update. 635 // Rect indicating what was repainted/updated during update.
635 // Note that plugin layers bypass this and leave it empty. 636 // Note that plugin layers bypass this and leave it empty.
636 // Uses layer (not content) space. 637 // Uses layer (not content) space.
637 gfx::RectF update_rect_; 638 gfx::RectF update_rect_;
638 639
639 // Manages animations for this layer. 640 // Manages animations for this layer.
640 scoped_refptr<LayerAnimationController> layer_animation_controller_; 641 scoped_refptr<LayerAnimationController> layer_animation_controller_;
641 642
642 // Manages scrollbars for this layer 643 // Manages scrollbars for this layer
643 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_; 644 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_;
644 645
645 // Weak pointers to this layer's scrollbars, if it has them. Updated during 646 scoped_ptr<ScrollbarSet> scrollbars_;
646 // tree synchronization.
647 ScrollbarLayerImplBase* horizontal_scrollbar_layer_;
648 ScrollbarLayerImplBase* vertical_scrollbar_layer_;
649 647
650 ScopedPtrVector<CopyOutputRequest> copy_requests_; 648 ScopedPtrVector<CopyOutputRequest> copy_requests_;
651 649
652 // Group of properties that need to be computed based on the layer tree 650 // Group of properties that need to be computed based on the layer tree
653 // hierarchy before layers can be drawn. 651 // hierarchy before layers can be drawn.
654 DrawProperties<LayerImpl> draw_properties_; 652 DrawProperties<LayerImpl> draw_properties_;
655 653
656 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_; 654 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_;
657 655
658 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 656 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
659 }; 657 };
660 658
661 } // namespace cc 659 } // namespace cc
662 660
663 #endif // CC_LAYERS_LAYER_IMPL_H_ 661 #endif // CC_LAYERS_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698