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

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: Backup 2013.10.29 Created 7 years, 1 month 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 void SetScrollOffsetDelegate( 350 void SetScrollOffsetDelegate(
351 LayerScrollOffsetDelegate* scroll_offset_delegate); 351 LayerScrollOffsetDelegate* scroll_offset_delegate);
352 bool IsExternalFlingActive() const; 352 bool IsExternalFlingActive() const;
353 353
354 void SetScrollOffset(gfx::Vector2d scroll_offset); 354 void SetScrollOffset(gfx::Vector2d scroll_offset);
355 void SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset, 355 void SetScrollOffsetAndDelta(gfx::Vector2d scroll_offset,
356 gfx::Vector2dF scroll_delta); 356 gfx::Vector2dF scroll_delta);
357 gfx::Vector2d scroll_offset() const { return scroll_offset_; } 357 gfx::Vector2d scroll_offset() const { return scroll_offset_; }
358 358
359 void SetMaxScrollOffset(gfx::Vector2d max_scroll_offset); 359 gfx::Vector2d MaxScrollOffset() const;
360 gfx::Vector2d max_scroll_offset() const { return max_scroll_offset_; } 360 gfx::Vector2dF ClampScrollToMaxScrollOffset();
361 void SetScrollbarPosition(ScrollbarLayerImplBase* scrollbar_layer,
362 LayerImpl* scrollbar_clip_layer) const;
361 363
362 void SetScrollDelta(gfx::Vector2dF scroll_delta); 364 void SetScrollDelta(gfx::Vector2dF scroll_delta);
363 gfx::Vector2dF ScrollDelta() const; 365 gfx::Vector2dF ScrollDelta() const;
364 366
365 gfx::Vector2dF TotalScrollOffset() const; 367 gfx::Vector2dF TotalScrollOffset() const;
366 368
367 void SetSentScrollDelta(gfx::Vector2d sent_scroll_delta); 369 void SetSentScrollDelta(gfx::Vector2d sent_scroll_delta);
368 gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; } 370 gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; }
369 371
370 // Returns the delta of the scroll that was outside of the bounds of the 372 // Returns the delta of the scroll that was outside of the bounds of the
371 // initial scroll 373 // initial scroll
372 gfx::Vector2dF ScrollBy(gfx::Vector2dF scroll); 374 gfx::Vector2dF ScrollBy(gfx::Vector2dF scroll);
373 375
374 void SetScrollable(bool scrollable) { scrollable_ = scrollable; } 376 void SetScrollable(int clip_layer_id);
375 bool scrollable() const { return scrollable_; } 377 bool scrollable() const { return clip_layer_; }
376 378
377 void set_user_scrollable_horizontal(bool scrollable) { 379 void set_user_scrollable_horizontal(bool scrollable) {
378 user_scrollable_horizontal_ = scrollable; 380 user_scrollable_horizontal_ = scrollable;
379 } 381 }
380 void set_user_scrollable_vertical(bool scrollable) { 382 void set_user_scrollable_vertical(bool scrollable) {
381 user_scrollable_vertical_ = scrollable; 383 user_scrollable_vertical_ = scrollable;
382 } 384 }
383 385
384 void ApplySentScrollDeltasFromAbortedCommit(); 386 void ApplySentScrollDeltasFromAbortedCommit();
385 void ApplyScrollDeltasSinceBeginMainFrame(); 387 void ApplyScrollDeltasSinceBeginMainFrame();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 459
458 // Indicates that the surface previously used to render this layer 460 // Indicates that the surface previously used to render this layer
459 // was lost and that a new one has been created. Won't be called 461 // was lost and that a new one has been created. Won't be called
460 // until the new surface has been created successfully. 462 // until the new surface has been created successfully.
461 virtual void DidLoseOutputSurface(); 463 virtual void DidLoseOutputSurface();
462 464
463 ScrollbarAnimationController* scrollbar_animation_controller() const { 465 ScrollbarAnimationController* scrollbar_animation_controller() const {
464 return scrollbar_animation_controller_.get(); 466 return scrollbar_animation_controller_.get();
465 } 467 }
466 468
467 void SetHorizontalScrollbarLayer(ScrollbarLayerImplBase* scrollbar_layer); 469 typedef std::set<ScrollbarLayerImplBase*> ScrollbarSet;
468 ScrollbarLayerImplBase* horizontal_scrollbar_layer() { 470 ScrollbarSet* scrollbars() { return scrollbars_.get(); }
469 return horizontal_scrollbar_layer_; 471 void ClearScrollbars();
470 } 472 void AddScrollbar(ScrollbarLayerImplBase* layer);
471 473 void RemoveScrollbar(ScrollbarLayerImplBase* layer);
472 void SetVerticalScrollbarLayer(ScrollbarLayerImplBase* scrollbar_layer); 474 bool HasScrollbar(ScrollbarOrientation orientation) const;
473 ScrollbarLayerImplBase* vertical_scrollbar_layer() { 475 void NotifyScrollbars();
474 return vertical_scrollbar_layer_; 476 int clip_height() { return clip_layer_ ? clip_layer_->bounds().height() : 0; }
enne (OOO) 2013/10/31 18:45:58 Why just height?
wjmaclean 2013/11/13 21:01:29 There are currently no consumers for width ... thi
475 }
476 477
477 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; 478 gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const;
478 479
479 virtual skia::RefPtr<SkPicture> GetPicture(); 480 virtual skia::RefPtr<SkPicture> GetPicture();
480 481
481 virtual bool AreVisibleResourcesReady() const; 482 virtual bool AreVisibleResourcesReady() const;
482 483
483 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); 484 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl);
484 virtual void PushPropertiesTo(LayerImpl* layer); 485 virtual void PushPropertiesTo(LayerImpl* layer);
485 486
(...skipping 21 matching lines...) Expand all
507 508
508 virtual void AsValueInto(base::DictionaryValue* dict) const; 509 virtual void AsValueInto(base::DictionaryValue* dict) const;
509 510
510 void NoteLayerPropertyChanged(); 511 void NoteLayerPropertyChanged();
511 void NoteLayerPropertyChangedForSubtree(); 512 void NoteLayerPropertyChangedForSubtree();
512 513
513 // Note carefully this does not affect the current layer. 514 // Note carefully this does not affect the current layer.
514 void NoteLayerPropertyChangedForDescendants(); 515 void NoteLayerPropertyChangedForDescendants();
515 516
516 private: 517 private:
517 void UpdateScrollbarPositions();
518
519 virtual const char* LayerTypeAsString() const; 518 virtual const char* LayerTypeAsString() const;
520 519
521 // Properties internal to LayerImpl 520 // Properties internal to LayerImpl
522 LayerImpl* parent_; 521 LayerImpl* parent_;
523 OwnedLayerImplList children_; 522 OwnedLayerImplList children_;
524 523
525 LayerImpl* scroll_parent_; 524 LayerImpl* scroll_parent_;
526 525
527 // Storing a pointer to a set rather than a set since this will be rarely 526 // Storing a pointer to a set rather than a set since this will be rarely
528 // used. If this pointer turns out to be too heavy, we could have this (and 527 // used. If this pointer turns out to be too heavy, we could have this (and
(...skipping 12 matching lines...) Expand all
541 scoped_ptr<LayerImpl> replica_layer_; 540 scoped_ptr<LayerImpl> replica_layer_;
542 int layer_id_; 541 int layer_id_;
543 LayerTreeImpl* layer_tree_impl_; 542 LayerTreeImpl* layer_tree_impl_;
544 543
545 // Properties synchronized from the associated Layer. 544 // Properties synchronized from the associated Layer.
546 gfx::PointF anchor_point_; 545 gfx::PointF anchor_point_;
547 float anchor_point_z_; 546 float anchor_point_z_;
548 gfx::Size bounds_; 547 gfx::Size bounds_;
549 gfx::Vector2d scroll_offset_; 548 gfx::Vector2d scroll_offset_;
550 LayerScrollOffsetDelegate* scroll_offset_delegate_; 549 LayerScrollOffsetDelegate* scroll_offset_delegate_;
551 bool scrollable_; 550 LayerImpl* clip_layer_;
552 bool should_scroll_on_main_thread_; 551 bool should_scroll_on_main_thread_;
553 bool have_wheel_event_handlers_; 552 bool have_wheel_event_handlers_;
554 bool user_scrollable_horizontal_; 553 bool user_scrollable_horizontal_;
555 bool user_scrollable_vertical_; 554 bool user_scrollable_vertical_;
556 Region non_fast_scrollable_region_; 555 Region non_fast_scrollable_region_;
557 Region touch_event_handler_region_; 556 Region touch_event_handler_region_;
558 SkColor background_color_; 557 SkColor background_color_;
559 bool stacking_order_changed_; 558 bool stacking_order_changed_;
560 559
561 // Whether the "back" of this layer should draw. 560 // Whether the "back" of this layer should draw.
(...skipping 19 matching lines...) Expand all
581 // Set for the layer that other layers are fixed to. 580 // Set for the layer that other layers are fixed to.
582 bool is_container_for_fixed_position_layers_; 581 bool is_container_for_fixed_position_layers_;
583 // This property is effective when 582 // This property is effective when
584 // is_container_for_fixed_position_layers_ == true, 583 // is_container_for_fixed_position_layers_ == true,
585 gfx::Vector2dF fixed_container_size_delta_; 584 gfx::Vector2dF fixed_container_size_delta_;
586 585
587 LayerPositionConstraint position_constraint_; 586 LayerPositionConstraint position_constraint_;
588 587
589 gfx::Vector2dF scroll_delta_; 588 gfx::Vector2dF scroll_delta_;
590 gfx::Vector2d sent_scroll_delta_; 589 gfx::Vector2d sent_scroll_delta_;
591 gfx::Vector2d max_scroll_offset_; 590 // gfx::Vector2d max_scroll_offset_;
592 gfx::Vector2dF last_scroll_offset_; 591 gfx::Vector2dF last_scroll_offset_;
593 592
594 // The global depth value of the center of the layer. This value is used 593 // The global depth value of the center of the layer. This value is used
595 // to sort layers from back to front. 594 // to sort layers from back to front.
596 float draw_depth_; 595 float draw_depth_;
597 596
598 // Debug layer name. 597 // Debug layer name.
599 std::string debug_name_; 598 std::string debug_name_;
600 CompositingReasons compositing_reasons_; 599 CompositingReasons compositing_reasons_;
601 600
602 FilterOperations filters_; 601 FilterOperations filters_;
603 FilterOperations background_filters_; 602 FilterOperations background_filters_;
604 603
605 protected: 604 protected:
606 DrawMode current_draw_mode_; 605 DrawMode current_draw_mode_;
607 606
608 private: 607 private:
609 // Rect indicating what was repainted/updated during update. 608 // Rect indicating what was repainted/updated during update.
610 // Note that plugin layers bypass this and leave it empty. 609 // Note that plugin layers bypass this and leave it empty.
611 // Uses layer's content space. 610 // Uses layer's content space.
612 gfx::RectF update_rect_; 611 gfx::RectF update_rect_;
613 612
614 // Manages animations for this layer. 613 // Manages animations for this layer.
615 scoped_refptr<LayerAnimationController> layer_animation_controller_; 614 scoped_refptr<LayerAnimationController> layer_animation_controller_;
616 615
617 // Manages scrollbars for this layer 616 // Manages scrollbars for this layer
618 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_; 617 scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_;
619 618
620 // Weak pointers to this layer's scrollbars, if it has them. Updated during 619 scoped_ptr<ScrollbarSet> scrollbars_;
621 // tree synchronization.
622 ScrollbarLayerImplBase* horizontal_scrollbar_layer_;
623 ScrollbarLayerImplBase* vertical_scrollbar_layer_;
624 620
625 ScopedPtrVector<CopyOutputRequest> copy_requests_; 621 ScopedPtrVector<CopyOutputRequest> copy_requests_;
626 622
627 // Group of properties that need to be computed based on the layer tree 623 // Group of properties that need to be computed based on the layer tree
628 // hierarchy before layers can be drawn. 624 // hierarchy before layers can be drawn.
629 DrawProperties<LayerImpl> draw_properties_; 625 DrawProperties<LayerImpl> draw_properties_;
630 626
631 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 627 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
632 }; 628 };
633 629
634 } // namespace cc 630 } // namespace cc
635 631
636 #endif // CC_LAYERS_LAYER_IMPL_H_ 632 #endif // CC_LAYERS_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698