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

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: MaxScrollOffset must never be negative. 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 366
367 void SetScrollOffsetDelegate( 367 void SetScrollOffsetDelegate(
368 LayerScrollOffsetDelegate* scroll_offset_delegate); 368 LayerScrollOffsetDelegate* scroll_offset_delegate);
369 bool IsExternalFlingActive() const; 369 bool IsExternalFlingActive() const;
370 370
371 void SetScrollOffset(gfx::Vector2d scroll_offset); 371 void SetScrollOffset(gfx::Vector2d scroll_offset);
372 void SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset, 372 void SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset,
373 const gfx::Vector2dF& scroll_delta); 373 const gfx::Vector2dF& scroll_delta);
374 gfx::Vector2d scroll_offset() const { return scroll_offset_; } 374 gfx::Vector2d scroll_offset() const { return scroll_offset_; }
375 375
376 void SetMaxScrollOffset(gfx::Vector2d max_scroll_offset); 376 gfx::Vector2d MaxScrollOffset() const;
377 gfx::Vector2d max_scroll_offset() const { return max_scroll_offset_; } 377 gfx::Vector2dF ClampScrollToMaxScrollOffset();
378 void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
379 LayerImpl* scrollbar_clip_layer) const;
378 380
379 void SetScrollDelta(const gfx::Vector2dF& scroll_delta); 381 void SetScrollDelta(const gfx::Vector2dF& scroll_delta);
380 gfx::Vector2dF ScrollDelta() const; 382 gfx::Vector2dF ScrollDelta() const;
381 383
382 gfx::Vector2dF TotalScrollOffset() const; 384 gfx::Vector2dF TotalScrollOffset() const;
383 385
384 void SetSentScrollDelta(gfx::Vector2d sent_scroll_delta); 386 void SetSentScrollDelta(gfx::Vector2d sent_scroll_delta);
385 gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; } 387 gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; }
386 388
387 // Returns the delta of the scroll that was outside of the bounds of the 389 // Returns the delta of the scroll that was outside of the bounds of the
388 // initial scroll 390 // initial scroll
389 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll); 391 gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll);
390 392
391 void SetScrollable(bool scrollable) { scrollable_ = scrollable; } 393 void SetScrollClipLayer(int scroll_clip_layer_id);
392 bool scrollable() const { return scrollable_; } 394 bool scrollable() const { return !!scroll_clip_layer_; }
393 395
394 void set_user_scrollable_horizontal(bool scrollable) { 396 void set_user_scrollable_horizontal(bool scrollable) {
395 user_scrollable_horizontal_ = scrollable; 397 user_scrollable_horizontal_ = scrollable;
396 } 398 }
397 void set_user_scrollable_vertical(bool scrollable) { 399 void set_user_scrollable_vertical(bool scrollable) {
398 user_scrollable_vertical_ = scrollable; 400 user_scrollable_vertical_ = scrollable;
399 } 401 }
400 402
401 void ApplySentScrollDeltasFromAbortedCommit(); 403 void ApplySentScrollDeltasFromAbortedCommit();
402 void ApplyScrollDeltasSinceBeginMainFrame(); 404 void ApplyScrollDeltasSinceBeginMainFrame();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 virtual void DidBeginTracing(); 474 virtual void DidBeginTracing();
473 475
474 // Release resources held by this layer. Called when the output surface 476 // Release resources held by this layer. Called when the output surface
475 // that rendered this layer was lost or a rendering mode switch has occured. 477 // that rendered this layer was lost or a rendering mode switch has occured.
476 virtual void ReleaseResources(); 478 virtual void ReleaseResources();
477 479
478 ScrollbarAnimationController* scrollbar_animation_controller() const { 480 ScrollbarAnimationController* scrollbar_animation_controller() const {
479 return scrollbar_animation_controller_.get(); 481 return scrollbar_animation_controller_.get();
480 } 482 }
481 483
482 void SetHorizontalScrollbarLayer(ScrollbarLayerImplBase* scrollbar_layer); 484 typedef std::set<ScrollbarLayerImplBase*> ScrollbarSet;
483 ScrollbarLayerImplBase* horizontal_scrollbar_layer() { 485 ScrollbarSet* scrollbars() { return scrollbars_.get(); }
484 return horizontal_scrollbar_layer_; 486 void ClearScrollbars();
485 } 487 void AddScrollbar(ScrollbarLayerImplBase* layer);
486 488 void RemoveScrollbar(ScrollbarLayerImplBase* layer);
487 void SetVerticalScrollbarLayer(ScrollbarLayerImplBase* scrollbar_layer); 489 bool HasScrollbar(ScrollbarOrientation orientation) const;
488 ScrollbarLayerImplBase* vertical_scrollbar_layer() { 490 void ScrollbarParametersDidChange();
489 return vertical_scrollbar_layer_; 491 int clip_height() {
492 return scroll_clip_layer_ ? scroll_clip_layer_->bounds().height() : 0;
490 } 493 }
491 494
492 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; 495 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
493 496
494 virtual skia::RefPtr<SkPicture> GetPicture(); 497 virtual skia::RefPtr<SkPicture> GetPicture();
495 498
496 virtual bool AreVisibleResourcesReady() const; 499 virtual bool AreVisibleResourcesReady() const;
497 500
498 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); 501 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
499 virtual void PushPropertiesTo(LayerImpl* layer); 502 virtual void PushPropertiesTo(LayerImpl* layer);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 540
538 void NoteLayerPropertyChanged(); 541 void NoteLayerPropertyChanged();
539 void NoteLayerPropertyChangedForSubtree(); 542 void NoteLayerPropertyChangedForSubtree();
540 543
541 // Note carefully this does not affect the current layer. 544 // Note carefully this does not affect the current layer.
542 void NoteLayerPropertyChangedForDescendants(); 545 void NoteLayerPropertyChangedForDescendants();
543 546
544 private: 547 private:
545 void NoteLayerPropertyChangedForDescendantsInternal(); 548 void NoteLayerPropertyChangedForDescendantsInternal();
546 549
547 void UpdateScrollbarPositions();
548
549 virtual const char* LayerTypeAsString() const; 550 virtual const char* LayerTypeAsString() const;
550 551
551 // Properties internal to LayerImpl 552 // Properties internal to LayerImpl
552 LayerImpl* parent_; 553 LayerImpl* parent_;
553 OwnedLayerImplList children_; 554 OwnedLayerImplList children_;
554 555
555 LayerImpl* scroll_parent_; 556 LayerImpl* scroll_parent_;
556 557
557 // Storing a pointer to a set rather than a set since this will be rarely 558 // Storing a pointer to a set rather than a set since this will be rarely
558 // used. If this pointer turns out to be too heavy, we could have this (and 559 // used. If this pointer turns out to be too heavy, we could have this (and
(...skipping 12 matching lines...) Expand all
571 scoped_ptr<LayerImpl> replica_layer_; 572 scoped_ptr<LayerImpl> replica_layer_;
572 int layer_id_; 573 int layer_id_;
573 LayerTreeImpl* layer_tree_impl_; 574 LayerTreeImpl* layer_tree_impl_;
574 575
575 // Properties synchronized from the associated Layer. 576 // Properties synchronized from the associated Layer.
576 gfx::PointF anchor_point_; 577 gfx::PointF anchor_point_;
577 float anchor_point_z_; 578 float anchor_point_z_;
578 gfx::Size bounds_; 579 gfx::Size bounds_;
579 gfx::Vector2d scroll_offset_; 580 gfx::Vector2d scroll_offset_;
580 LayerScrollOffsetDelegate* scroll_offset_delegate_; 581 LayerScrollOffsetDelegate* scroll_offset_delegate_;
582 LayerImpl* scroll_clip_layer_;
581 bool scrollable_ : 1; 583 bool scrollable_ : 1;
582 bool should_scroll_on_main_thread_ : 1; 584 bool should_scroll_on_main_thread_ : 1;
583 bool have_wheel_event_handlers_ : 1; 585 bool have_wheel_event_handlers_ : 1;
584 bool user_scrollable_horizontal_ : 1; 586 bool user_scrollable_horizontal_ : 1;
585 bool user_scrollable_vertical_ : 1; 587 bool user_scrollable_vertical_ : 1;
586 bool stacking_order_changed_ : 1; 588 bool stacking_order_changed_ : 1;
587 // Whether the "back" of this layer should draw. 589 // Whether the "back" of this layer should draw.
588 bool double_sided_ : 1; 590 bool double_sided_ : 1;
589 591
590 // Tracks if drawing-related properties have changed since last redraw. 592 // Tracks if drawing-related properties have changed since last redraw.
(...skipping 22 matching lines...) Expand all
613 gfx::Transform transform_; 615 gfx::Transform transform_;
614 616
615 // This property is effective when 617 // This property is effective when
616 // is_container_for_fixed_position_layers_ == true, 618 // is_container_for_fixed_position_layers_ == true,
617 gfx::Vector2dF fixed_container_size_delta_; 619 gfx::Vector2dF fixed_container_size_delta_;
618 620
619 LayerPositionConstraint position_constraint_; 621 LayerPositionConstraint position_constraint_;
620 622
621 gfx::Vector2dF scroll_delta_; 623 gfx::Vector2dF scroll_delta_;
622 gfx::Vector2d sent_scroll_delta_; 624 gfx::Vector2d sent_scroll_delta_;
623 gfx::Vector2d max_scroll_offset_;
624 gfx::Vector2dF last_scroll_offset_; 625 gfx::Vector2dF last_scroll_offset_;
625 626
626 // The global depth value of the center of the layer. This value is used 627 // The global depth value of the center of the layer. This value is used
627 // to sort layers from back to front. 628 // to sort layers from back to front.
628 float draw_depth_; 629 float draw_depth_;
629 630
630 FilterOperations filters_; 631 FilterOperations filters_;
631 FilterOperations background_filters_; 632 FilterOperations background_filters_;
632 633
633 protected: 634 protected:
(...skipping 15 matching lines...) Expand all
649 // Note that plugin layers bypass this and leave it empty. 650 // Note that plugin layers bypass this and leave it empty.
650 // Uses layer (not content) space. 651 // Uses layer (not content) space.
651 gfx::RectF update_rect_; 652 gfx::RectF update_rect_;
652 653
653 // Manages animations for this layer. 654 // Manages animations for this layer.
654 scoped_refptr<LayerAnimationController> layer_animation_controller_; 655 scoped_refptr<LayerAnimationController> layer_animation_controller_;
655 656
656 // Manages scrollbars for this layer 657 // Manages scrollbars for this layer
657 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_; 658 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_;
658 659
659 // Weak pointers to this layer's scrollbars, if it has them. Updated during 660 scoped_ptr<ScrollbarSet> scrollbars_;
660 // tree synchronization.
661 ScrollbarLayerImplBase* horizontal_scrollbar_layer_;
662 ScrollbarLayerImplBase* vertical_scrollbar_layer_;
663 661
664 ScopedPtrVector<CopyOutputRequest> copy_requests_; 662 ScopedPtrVector<CopyOutputRequest> copy_requests_;
665 663
666 // Group of properties that need to be computed based on the layer tree 664 // Group of properties that need to be computed based on the layer tree
667 // hierarchy before layers can be drawn. 665 // hierarchy before layers can be drawn.
668 DrawProperties<LayerImpl> draw_properties_; 666 DrawProperties<LayerImpl> draw_properties_;
669 667
670 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_; 668 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_;
671 669
672 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 670 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
673 }; 671 };
674 672
675 } // namespace cc 673 } // namespace cc
676 674
677 #endif // CC_LAYERS_LAYER_IMPL_H_ 675 #endif // CC_LAYERS_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/layer_impl.cc » ('j') | cc/layers/layer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698