Chromium Code Reviews| Index: cc/layer_impl.h |
| diff --git a/cc/layer_impl.h b/cc/layer_impl.h |
| index a325aa0bbfd34df9a3f4c7685dd3a0a2a313df71..41dda158a37858b4823c41793338c7a6e20cd2ee 100644 |
| --- a/cc/layer_impl.h |
| +++ b/cc/layer_impl.h |
| @@ -47,393 +47,471 @@ class Layer; |
| struct AppendQuadsData; |
| class CC_EXPORT LayerImpl : LayerAnimationValueObserver { |
| -public: |
| - typedef ScopedPtrVector<LayerImpl> LayerList; |
| + public: |
| + typedef ScopedPtrVector<LayerImpl> LayerList; |
| - static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) |
| - { |
| - return make_scoped_ptr(new LayerImpl(treeImpl, id)); |
| - } |
| + static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
| + return make_scoped_ptr(new LayerImpl(tree_impl, id)); |
| + } |
| - virtual ~LayerImpl(); |
| + virtual ~LayerImpl(); |
| - int id() const; |
| + int id() const { return layer_id_; } |
| - // LayerAnimationValueObserver implementation. |
| - virtual void OnOpacityAnimated(float) OVERRIDE; |
| - virtual void OnTransformAnimated(const gfx::Transform&) OVERRIDE; |
| - virtual bool IsActive() const OVERRIDE; |
| + // LayerAnimationValueObserver implementation. |
| + virtual void OnOpacityAnimated(float opacity) OVERRIDE; |
| + virtual void OnTransformAnimated(const gfx::Transform& transform) OVERRIDE; |
| + virtual bool IsActive() const OVERRIDE; |
| + |
| + // Tree structure. |
| + LayerImpl* parent() { return parent_; } |
| + const LayerImpl* parent() const { return parent_; } |
| + const LayerList& children() const { return children_; } |
| + LayerList& children() { return children_; } |
| + LayerImpl* child_at(size_t index) const { return children_[index]; } |
| + void AddChild(scoped_ptr<LayerImpl> child); |
| + scoped_ptr<LayerImpl> RemoveChild(LayerImpl* child); |
| + void set_parent(LayerImpl* parent) { parent_ = parent; } |
| + // Warning: This does not preserve tree structure invariants. |
| + void ClearChildList(); |
| + |
| + void SetMaskLayer(scoped_ptr<LayerImpl> mask_layer); |
| + LayerImpl* mask_layer() { return mask_layer_.get(); } |
| + const LayerImpl* mask_layer() const { return mask_layer_.get(); } |
| + scoped_ptr<LayerImpl> TakeMaskLayer(); |
| + |
| + void SetReplicaLayer(scoped_ptr<LayerImpl> replica_layer); |
| + LayerImpl* replica_layer() { return replica_layer_.get(); } |
| + const LayerImpl* replica_layer() const { return replica_layer_.get(); } |
| + scoped_ptr<LayerImpl> TakeReplicaLayer(); |
| - // Tree structure. |
| - LayerImpl* parent() { return m_parent; } |
| - const LayerImpl* parent() const { return m_parent; } |
| - const LayerList& children() const { return m_children; } |
| - LayerList& children() { return m_children; } |
| - LayerImpl* childAt(size_t index) const; |
| - void addChild(scoped_ptr<LayerImpl>); |
| - scoped_ptr<LayerImpl> removeChild(LayerImpl* child); |
| - void setParent(LayerImpl* parent) { m_parent = parent; } |
| - void clearChildList(); // Warning: This does not preserve tree structure invariants. |
| + bool has_mask() const { return mask_layer_; } |
| + bool has_replica() const { return replica_layer_; } |
| + bool replica_has_mask() const { return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); } |
| + |
| + LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; } |
| + |
| + scoped_ptr<SharedQuadState> CreateSharedQuadState() const; |
| + // willDraw must be called before appendQuads. If willDraw is called, |
| + // didDraw is guaranteed to be called before another willDraw or before |
| + // the layer is destroyed. To enforce this, any class that overrides |
| + // willDraw/didDraw must call the base class version. |
| + virtual void WillDraw(ResourceProvider* resource_provider); |
| + virtual void AppendQuads(QuadSink* quad_sink, |
| + AppendQuadsData* append_quads_data) {} |
| + virtual void DidDraw(ResourceProvider* resource_provider); |
| + |
| + virtual ResourceProvider::ResourceId ContentsResourceId() const; |
| + |
| + virtual bool HasDelegatedContent() const; |
| + virtual bool HasContributingDelegatedRenderPasses() const; |
| + virtual RenderPass::Id FirstContributingRenderPassId() const; |
| + virtual RenderPass::Id NextContributingRenderPassId(RenderPass::Id id) const; |
| + |
| + virtual void UpdateTilePriorities() {} |
| + |
| + virtual ScrollbarLayerImpl* ToScrollbarLayer(); |
| + |
| + // Returns true if this layer has content to draw. |
| + void SetDrawsContent(bool draws_content); |
| + bool DrawsContent() const { return draws_content_; } |
| + |
| + bool force_render_surface() const { return force_render_surface_; } |
| + void SetForceRenderSurface(bool force) { force_render_surface_ = force; } |
| + |
| + void SetAnchorPoint(gfx::PointF anchor_point); |
| + gfx::PointF anchor_point() const { return anchor_point_; } |
| + |
| + void SetAnchorPointZ(float anchor_point_z); |
| + float anchor_point_z() const { return anchor_point_z_; } |
| + |
| + void SetBackgroundColor(SkColor background_color); |
| + SkColor background_color() const { return background_color_; } |
| + |
| + void SetFilters(const WebKit::WebFilterOperations& filters); |
| + const WebKit::WebFilterOperations& filters() const { return filters_; } |
| + |
| + void SetBackgroundFilters(const WebKit::WebFilterOperations& filters); |
| + const WebKit::WebFilterOperations& background_filters() const { |
| + return background_filters_; |
| + } |
| + |
| + void SetFilter(const skia::RefPtr<SkImageFilter>& filter); |
| + skia::RefPtr<SkImageFilter> filter() const { return filter_; } |
| + |
| + void SetMasksToBounds(bool masks_to_bounds); |
| + bool masks_to_bounds() const { return masks_to_bounds_; } |
| + |
| + void SetContentsOpaque(bool opaque); |
| + bool contents_opaque() const { return contents_opaque_; } |
| + |
| + void SetOpacity(float opacity); |
| + float opacity() const { return opacity_; } |
| + bool OpacityIsAnimating() const; |
| + |
| + void SetPosition(gfx::PointF position); |
| + gfx::PointF position() const { return position_; } |
| + |
| + void SetIsContainerForFixedPositionLayers(bool container) { |
| + is_container_for_fixed_position_layers_ = container; |
| + } |
| + bool is_container_for_fixed_position_layers() const { |
| + return is_container_for_fixed_position_layers_; |
| + } |
| + |
| + void SetFixedToContainerLayer(bool fixed) { |
| + fixed_to_container_layer_ = fixed; |
| + } |
| + bool fixed_to_container_layer() const { return fixed_to_container_layer_; } |
| + |
| + void SetPreserves3d(bool preserves_3d); |
| + bool preserves_3d() const { return preserves_3d_; } |
| + |
| + void SetUseParentBackfaceVisibility(bool use) { |
| + use_parent_backface_visibility_ = use; |
| + } |
| + bool use_parent_backface_visibility() const { |
| + return use_parent_backface_visibility_; |
| + } |
| + |
| + void SetSublayerTransform(const gfx::Transform& sublayer_transform); |
| + const gfx::Transform& sublayer_transform() const { |
| + return sublayer_transform_; |
| + } |
| + |
| + // Debug layer name. |
| + void SetDebugName(const std::string& debug_name) { debug_name_ = debug_name; } |
| + std::string debug_name() const { return debug_name_; } |
| + |
| + bool ShowDebugBorders() const; |
| + |
| + // These invalidate the host's render surface layer list. The caller |
| + // is responsible for calling setNeedsUpdateDrawProperties on the host |
| + // so that its list can be recreated. |
| + void CreateRenderSurface(); |
| + void ClearRenderSurface() { draw_properties_.render_surface.reset(); } |
| + |
| + DrawProperties<LayerImpl, RenderSurfaceImpl>& draw_properties() { |
| + return draw_properties_; |
| + } |
| + const DrawProperties<LayerImpl, RenderSurfaceImpl>& draw_properties() const { |
| + return draw_properties_; |
| + } |
| + |
| + // The following are shortcut accessors to get various information from |
| + // draw_properties_ |
| + const gfx::Transform& draw_transform() const { |
| + return draw_properties_.target_space_transform; |
| + } |
| + const gfx::Transform& screen_space_transform() const { |
| + return draw_properties_.screen_space_transform; |
| + } |
| + float draw_opacity() const { return draw_properties_.opacity; } |
| + bool draw_opacity_is_animating() const { |
| + return draw_properties_.opacity_is_animating; |
| + } |
| + bool draw_transform_is_animating() const { |
| + return draw_properties_.target_space_transform_is_animating; |
| + } |
| + bool screen_space_transform_is_animating() const { |
| + return draw_properties_.screen_space_transform_is_animating; |
| + } |
| + bool screen_space_opacity_is_animating() const { |
| + return draw_properties_.screen_space_opacity_is_animating; |
| + } |
| + bool can_use_lcd_text() const { return draw_properties_.can_use_lcd_text; } |
| + bool is_clipped() const { return draw_properties_.is_clipped; } |
| + gfx::Rect clip_rect() const { return draw_properties_.clip_rect; } |
| + gfx::Rect drawable_content_rect() const { |
| + return draw_properties_.drawable_content_rect; |
| + } |
| + gfx::Rect visible_content_rect() const { |
| + return draw_properties_.visible_content_rect; |
| + } |
| + LayerImpl* render_target() { |
| + DCHECK(!draw_properties_.render_target || |
| + draw_properties_.render_target->render_surface()); |
| + return draw_properties_.render_target; |
| + } |
| + const LayerImpl* render_target() const { |
| + DCHECK(!draw_properties_.render_target || |
| + draw_properties_.render_target->render_surface()); |
| + return draw_properties_.render_target; |
| + } |
| + RenderSurfaceImpl* render_surface() const { |
| + return draw_properties_.render_surface.get(); |
| + } |
| + |
| + // The client should be responsible for setting bounds, contentBounds and |
| + // contentsScale to appropriate values. LayerImpl doesn't calculate any of |
| + // them from the other values. |
| + |
| + void SetBounds(gfx::Size bounds); |
| + gfx::Size bounds() const { return bounds_; } |
| + |
| + void SetContentBounds(gfx::Size content_bounds); |
| + gfx::Size content_bounds() const { return draw_properties_.content_bounds; } |
| + |
| + float contents_scale_x() const { return draw_properties_.contents_scale_x; } |
| + float contents_scale_y() const { return draw_properties_.contents_scale_y; } |
| + void SetContentsScale(float contents_scale_x, float contents_scale_y); |
| + |
| + virtual void CalculateContentsScale(float ideal_contents_scale, |
| + bool animating_transform_to_screen, |
| + float* contents_scale_x, |
| + float* contents_scale_y, |
| + gfx::Size* contentBounds); |
| + |
| + void SetScrollOffset(gfx::Vector2d scroll_offset); |
| + gfx::Vector2d scroll_offset() const { return scroll_offset_; } |
| + |
| + void SetMaxScrollOffset(gfx::Vector2d max_scroll_offset); |
| + gfx::Vector2d max_scroll_offset() const { return max_scroll_offset_; } |
| + |
| + void SetScrollDelta(gfx::Vector2dF scroll_delta); |
| + gfx::Vector2dF scroll_delta() const { return scroll_delta_; } |
| + |
| + void SetImplTransform(const gfx::Transform& transform); |
| + const gfx::Transform& impl_transform() const { return impl_transform_; } |
| + |
| + void SetSentScrollDelta(gfx::Vector2d sent_scroll_delta); |
| + gfx::Vector2d sent_scroll_delta() const { return sent_scroll_delta_; } |
| + |
| + // Returns the delta of the scroll that was outside of the bounds of the |
| + // initial scroll |
| + gfx::Vector2dF ScrollBy(gfx::Vector2dF scroll); |
| + |
| + void SetScrollable(bool scrollable) { scrollable_ = scrollable; } |
| + bool scrollable() const { return scrollable_; } |
| + |
| + void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) { |
| + should_scroll_on_main_thread_ = should_scroll_on_main_thread; |
| + } |
| + bool should_scroll_on_main_thread() const { |
| + return should_scroll_on_main_thread_; |
| + } |
| + |
| + void SetHaveWheelEventHandlers(bool have_wheel_event_handlers) { |
| + have_wheel_event_handlers_ = have_wheel_event_handlers; |
| + } |
| + bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; } |
| + |
| + void SetNonFastScrollableRegion(const Region& region) { |
| + non_fast_scrollable_region_ = region; |
| + } |
| + const Region& non_fast_scrollable_region() const { |
| + return non_fast_scrollable_region_; |
| + } |
| + |
| + void SetTouchEventHandlerRegion(const Region& region) { |
| + touch_event_handler_region_ = region; |
| + } |
| + const Region& touch_event_handler_region() const { |
| + return touch_event_handler_region_; |
| + } |
| + |
| + void SetDrawCheckerboardForMissingTiles(bool checkerboard) { |
| + draw_checkerboard_for_missing_tiles_ = checkerboard; |
| + } |
| + bool DrawCheckerboardForMissingTiles() const; |
| - void setMaskLayer(scoped_ptr<LayerImpl>); |
| - LayerImpl* maskLayer() { return m_maskLayer.get(); } |
| - const LayerImpl* maskLayer() const { return m_maskLayer.get(); } |
| - scoped_ptr<LayerImpl> takeMaskLayer(); |
| + InputHandlerClient::ScrollStatus TryScroll( |
| + gfx::PointF screen_space_point, |
| + InputHandlerClient::ScrollInputType type) const; |
| - void setReplicaLayer(scoped_ptr<LayerImpl>); |
| - LayerImpl* replicaLayer() { return m_replicaLayer.get(); } |
| - const LayerImpl* replicaLayer() const { return m_replicaLayer.get(); } |
| - scoped_ptr<LayerImpl> takeReplicaLayer(); |
| + void SetDoubleSided(bool double_sided); |
| + bool double_sided() const { return double_sided_; } |
| - bool hasMask() const { return m_maskLayer; } |
| - bool hasReplica() const { return m_replicaLayer; } |
| - bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); } |
| + void SetTransform(const gfx::Transform& transform); |
| + const gfx::Transform& transform() const { return transform_; } |
| + bool TransformIsAnimating() const; |
| - LayerTreeImpl* layerTreeImpl() const { return m_layerTreeImpl; } |
| + void set_update_rect(const gfx::RectF& update_rect) { |
| + update_rect_ = update_rect; |
| + } |
| + const gfx::RectF& update_rect() const { return update_rect_; } |
| - scoped_ptr<SharedQuadState> createSharedQuadState() const; |
| - // willDraw must be called before appendQuads. If willDraw is called, |
| - // didDraw is guaranteed to be called before another willDraw or before |
| - // the layer is destroyed. To enforce this, any class that overrides |
| - // willDraw/didDraw must call the base class version. |
| - virtual void willDraw(ResourceProvider*); |
| - virtual void appendQuads(QuadSink&, AppendQuadsData&) { } |
| - virtual void didDraw(ResourceProvider*); |
| + std::string LayerTreeAsText() const; |
| + virtual base::DictionaryValue* LayerTreeAsJson() const; |
| - virtual ResourceProvider::ResourceId contentsResourceId() const; |
| + void SetStackingOrderChanged(bool stacking_order_changed); |
| - virtual bool hasDelegatedContent() const; |
| - virtual bool hasContributingDelegatedRenderPasses() const; |
| - virtual RenderPass::Id firstContributingRenderPassId() const; |
| - virtual RenderPass::Id nextContributingRenderPassId(RenderPass::Id) const; |
| + bool LayerPropertyChanged() const { |
| + return layer_property_changed_ || LayerIsAlwaysDamaged(); |
| + } |
| + bool LayerSurfacePropertyChanged() const; |
| - virtual void updateTilePriorities() { } |
| + void ResetAllChangeTrackingForSubtree(); |
| - virtual ScrollbarLayerImpl* toScrollbarLayer(); |
| + virtual bool LayerIsAlwaysDamaged() const; |
| - // Returns true if this layer has content to draw. |
| - void setDrawsContent(bool); |
| - bool drawsContent() const { return m_drawsContent; } |
| - |
| - bool forceRenderSurface() const { return m_forceRenderSurface; } |
| - void setForceRenderSurface(bool force) { m_forceRenderSurface = force; } |
| + LayerAnimationController* layer_animation_controller() { |
| + return layer_animation_controller_.get(); |
| + } |
| - void setAnchorPoint(const gfx::PointF&); |
| - const gfx::PointF& anchorPoint() const { return m_anchorPoint; } |
| + virtual Region VisibleContentOpaqueRegion() const; |
| - void setAnchorPointZ(float); |
| - float anchorPointZ() const { return m_anchorPointZ; } |
| + virtual void DidBecomeActive(); |
| - void setBackgroundColor(SkColor); |
| - SkColor backgroundColor() const { return m_backgroundColor; } |
| + // Indicates that the surface previously used to render this layer |
| + // was lost and that a new one has been created. Won't be called |
| + // until the new surface has been created successfully. |
| + virtual void DidLoseOutputSurface(); |
| - void setFilters(const WebKit::WebFilterOperations&); |
| - const WebKit::WebFilterOperations& filters() const { return m_filters; } |
| + ScrollbarAnimationController* scrollbar_animation_controller() const { |
| + return scrollbar_animation_controller_.get(); |
| + } |
| - void setBackgroundFilters(const WebKit::WebFilterOperations&); |
| - const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; } |
| + void SetScrollbarOpacity(float opacity); |
| - void setFilter(const skia::RefPtr<SkImageFilter>&); |
| - skia::RefPtr<SkImageFilter> filter() const { return m_filter; } |
| + void SetHorizontalScrollbarLayer(ScrollbarLayerImpl* scrollbar_layer); |
| + ScrollbarLayerImpl* horizontal_scrollbar_layer() { |
| + return horizontal_scrollbar_layer_; |
| + } |
| - void setMasksToBounds(bool); |
| - bool masksToBounds() const { return m_masksToBounds; } |
| + void SetVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbar_layer); |
| + ScrollbarLayerImpl* vertical_scrollbar_layer() { |
| + return vertical_scrollbar_layer_; |
| + } |
| - void setContentsOpaque(bool); |
| - bool contentsOpaque() const { return m_contentsOpaque; } |
| + gfx::Rect LayerRectToContentRect(const gfx::RectF& layer_rect) const; |
| - void setOpacity(float); |
| - float opacity() const; |
| - bool opacityIsAnimating() const; |
| + virtual skia::RefPtr<SkPicture> GetPicture(); |
| + |
| + virtual bool CanClipSelf() const; |
| - void setPosition(const gfx::PointF&); |
| - const gfx::PointF& position() const { return m_position; } |
| + virtual bool AreVisibleResourcesReady() const; |
| + |
| + virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl); |
| + virtual void PushPropertiesTo(LayerImpl* layer); |
| + |
| + virtual scoped_ptr<base::Value> AsValue() const; |
| - void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLayers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; } |
| - bool isContainerForFixedPositionLayers() const { return m_isContainerForFixedPositionLayers; } |
| + protected: |
| + LayerImpl(LayerTreeImpl* layer_impl, int id); |
| - void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedToContainerLayer = fixedToContainerLayer;} |
| - bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } |
| + // Get the color and size of the layer's debug border. |
| + virtual void GetDebugBorderProperties(SkColor* color, float* width) const; |
| - void setPreserves3D(bool); |
| - bool preserves3D() const { return m_preserves3D; } |
| + void AppendDebugBorderQuad(QuadSink* quad_sink, |
| + const SharedQuadState* shared_quad_state, |
| + AppendQuadsData* append_quads_data) const; |
| - void setUseParentBackfaceVisibility(bool useParentBackfaceVisibility) { m_useParentBackfaceVisibility = useParentBackfaceVisibility; } |
| - bool useParentBackfaceVisibility() const { return m_useParentBackfaceVisibility; } |
| + virtual void DumpLayerProperties(std::string* str, int indent) const; |
| + static std::string IndentString(int indent); |
| - void setSublayerTransform(const gfx::Transform&); |
| - const gfx::Transform& sublayerTransform() const { return m_sublayerTransform; } |
| + void AsValueInto(base::DictionaryValue* dict) const; |
| - // Debug layer name. |
| - void setDebugName(const std::string& debugName) { m_debugName = debugName; } |
| - std::string debugName() const { return m_debugName; } |
| + void NoteLayerSurfacePropertyChanged(); |
| + void NoteLayerPropertyChanged(); |
| + void NoteLayerPropertyChangedForSubtree(); |
| - bool showDebugBorders() const; |
| + // Note carefully this does not affect the current layer. |
| + void NoteLayerPropertyChangedForDescendants(); |
| - // These invalidate the host's render surface layer list. The caller |
| - // is responsible for calling setNeedsUpdateDrawProperties on the host |
| - // so that its list can be recreated. |
| - void createRenderSurface(); |
| - void clearRenderSurface() { m_drawProperties.render_surface.reset(); } |
| + private: |
| + void UpdateScrollbarPositions(); |
| - DrawProperties<LayerImpl, RenderSurfaceImpl>& drawProperties() { return m_drawProperties; } |
| - const DrawProperties<LayerImpl, RenderSurfaceImpl>& drawProperties() const { return m_drawProperties; } |
| + virtual const char* LayerTypeAsString() const; |
| - // The following are shortcut accessors to get various information from m_drawProperties |
| - const gfx::Transform& drawTransform() const { return m_drawProperties.target_space_transform; } |
| - const gfx::Transform& screenSpaceTransform() const { return m_drawProperties.screen_space_transform; } |
| - float drawOpacity() const { return m_drawProperties.opacity; } |
| - bool drawOpacityIsAnimating() const { return m_drawProperties.opacity_is_animating; } |
| - bool drawTransformIsAnimating() const { return m_drawProperties.target_space_transform_is_animating; } |
| - bool screenSpaceTransformIsAnimating() const { return m_drawProperties.screen_space_transform_is_animating; } |
| - bool screenSpaceOpacityIsAnimating() const { return m_drawProperties.screen_space_opacity_is_animating; } |
| - bool canUseLCDText() const { return m_drawProperties.can_use_lcd_text; } |
| - bool isClipped() const { return m_drawProperties.is_clipped; } |
| - const gfx::Rect& clipRect() const { return m_drawProperties.clip_rect; } |
| - const gfx::Rect& drawableContentRect() const { return m_drawProperties.drawable_content_rect; } |
| - const gfx::Rect& visibleContentRect() const { return m_drawProperties.visible_content_rect; } |
| - LayerImpl* renderTarget() { DCHECK(!m_drawProperties.render_target || m_drawProperties.render_target->renderSurface()); return m_drawProperties.render_target; } |
| - const LayerImpl* renderTarget() const { DCHECK(!m_drawProperties.render_target || m_drawProperties.render_target->renderSurface()); return m_drawProperties.render_target; } |
| - RenderSurfaceImpl* renderSurface() const { return m_drawProperties.render_surface.get(); } |
| + void DumpLayer(std::string* str, int indent) const; |
| - // The client should be responsible for setting bounds, contentBounds and |
| - // contentsScale to appropriate values. LayerImpl doesn't calculate any of |
| - // them from the other values. |
| + // Properties internal to LayerImpl |
| + LayerImpl* parent_; |
| + LayerList children_; |
| + // mask_layer_ can be temporarily stolen during tree sync, we need this ID to confirm newly assigned layer is still the previous one |
|
enne (OOO)
2013/03/12 02:40:19
80 col
danakj
2013/03/12 02:47:16
Done.
|
| + int mask_layer_id_; |
| + scoped_ptr<LayerImpl> mask_layer_; |
| + int replica_layer_id_; // ditto |
| + scoped_ptr<LayerImpl> replica_layer_; |
| + int layer_id_; |
| + LayerTreeImpl* layer_tree_impl_; |
| - void setBounds(const gfx::Size&); |
| - const gfx::Size& bounds() const { return m_bounds; } |
| + // Properties synchronized from the associated Layer. |
| + gfx::PointF anchor_point_; |
| + float anchor_point_z_; |
| + gfx::Size bounds_; |
| + gfx::Vector2d scroll_offset_; |
| + bool scrollable_; |
| + bool should_scroll_on_main_thread_; |
| + bool have_wheel_event_handlers_; |
| + Region non_fast_scrollable_region_; |
| + Region touch_event_handler_region_; |
| + SkColor background_color_; |
| + bool stacking_order_changed_; |
| - void setContentBounds(const gfx::Size&); |
| - gfx::Size contentBounds() const { return m_drawProperties.content_bounds; } |
| + // Whether the "back" of this layer should draw. |
| + bool double_sided_; |
| - float contentsScaleX() const { return m_drawProperties.contents_scale_x; } |
| - float contentsScaleY() const { return m_drawProperties.contents_scale_y; } |
| - void setContentsScale(float contentsScaleX, float contentsScaleY); |
| + // Tracks if drawing-related properties have changed since last redraw. |
| + bool layer_property_changed_; |
| - virtual void calculateContentsScale( |
| - float idealContentsScale, |
| - bool animatingTransformToScreen, |
| - float* contentsScaleX, |
| - float* contentsScaleY, |
| - gfx::Size* contentBounds); |
| + // Indicates that a property has changed on this layer that would not |
| + // affect the pixels on its target surface, but would require redrawing |
| + // the targetSurface onto its ancestor targetSurface. |
| + // For layers that do not own a surface this flag acts as layer_property_changed_. |
|
enne (OOO)
2013/03/12 02:40:19
80 col.
danakj
2013/03/12 02:47:16
Done.
|
| + bool layer_surface_property_changed_; |
| - gfx::Vector2d scrollOffset() const { return m_scrollOffset; } |
| - void setScrollOffset(gfx::Vector2d); |
| + bool masks_to_bounds_; |
| + bool contents_opaque_; |
| + float opacity_; |
| + gfx::PointF position_; |
| + bool preserves_3d_; |
| + bool use_parent_backface_visibility_; |
| + bool draw_checkerboard_for_missing_tiles_; |
| + gfx::Transform sublayer_transform_; |
| + gfx::Transform transform_; |
| - gfx::Vector2d maxScrollOffset() const {return m_maxScrollOffset; } |
| - void setMaxScrollOffset(gfx::Vector2d); |
| + bool draws_content_; |
| + bool force_render_surface_; |
| - const gfx::Vector2dF& scrollDelta() const { return m_scrollDelta; } |
| - void setScrollDelta(const gfx::Vector2dF&); |
| + // Set for the layer that other layers are fixed to. |
| + bool is_container_for_fixed_position_layers_; |
| + // This is true if the layer should be fixed to the closest ancestor container. |
|
enne (OOO)
2013/03/12 02:40:19
80 col.
danakj
2013/03/12 02:47:16
Done.
|
| + bool fixed_to_container_layer_; |
| - const gfx::Transform& implTransform() const { return m_implTransform; } |
| - void setImplTransform(const gfx::Transform& transform); |
| + gfx::Vector2dF scroll_delta_; |
| + gfx::Vector2d sent_scroll_delta_; |
| + gfx::Vector2d max_scroll_offset_; |
| + gfx::Transform impl_transform_; |
| + gfx::Vector2dF last_scroll_offset_; |
| - const gfx::Vector2d& sentScrollDelta() const { return m_sentScrollDelta; } |
| - void setSentScrollDelta(const gfx::Vector2d& sentScrollDelta); |
| - |
| - // Returns the delta of the scroll that was outside of the bounds of the initial scroll |
| - gfx::Vector2dF scrollBy(const gfx::Vector2dF& scroll); |
| - |
| - bool scrollable() const { return m_scrollable; } |
| - void setScrollable(bool scrollable) { m_scrollable = scrollable; } |
| - |
| - bool shouldScrollOnMainThread() const { return m_shouldScrollOnMainThread; } |
| - void setShouldScrollOnMainThread(bool shouldScrollOnMainThread) { m_shouldScrollOnMainThread = shouldScrollOnMainThread; } |
| - |
| - bool haveWheelEventHandlers() const { return m_haveWheelEventHandlers; } |
| - void setHaveWheelEventHandlers(bool haveWheelEventHandlers) { m_haveWheelEventHandlers = haveWheelEventHandlers; } |
| - |
| - const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRegion; } |
| - void setNonFastScrollableRegion(const Region& region) { m_nonFastScrollableRegion = region; } |
| - |
| - const Region& touchEventHandlerRegion() const { return m_touchEventHandlerRegion; } |
| - void setTouchEventHandlerRegion(const Region& region) { m_touchEventHandlerRegion = region; } |
| - |
| - void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerboardForMissingTiles = checkerboard; } |
| - bool drawCheckerboardForMissingTiles() const; |
| - |
| - InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoint, InputHandlerClient::ScrollInputType) const; |
| - |
| - bool doubleSided() const { return m_doubleSided; } |
| - void setDoubleSided(bool); |
| - |
| - void setTransform(const gfx::Transform&); |
| - const gfx::Transform& transform() const; |
| - bool transformIsAnimating() const; |
| - |
| - const gfx::RectF& updateRect() const { return m_updateRect; } |
| - void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect; } |
| - |
| - std::string layerTreeAsText() const; |
| - virtual base::DictionaryValue* layerTreeAsJson() const; |
| - |
| - void setStackingOrderChanged(bool); |
| - |
| - bool layerPropertyChanged() const { return m_layerPropertyChanged || layerIsAlwaysDamaged(); } |
| - bool layerSurfacePropertyChanged() const; |
| - |
| - void resetAllChangeTrackingForSubtree(); |
| - |
| - virtual bool layerIsAlwaysDamaged() const; |
| - |
| - LayerAnimationController* layerAnimationController() { return m_layerAnimationController.get(); } |
| - |
| - virtual Region visibleContentOpaqueRegion() const; |
| - |
| - virtual void didBecomeActive(); |
| - |
| - // Indicates that the surface previously used to render this layer |
| - // was lost and that a new one has been created. Won't be called |
| - // until the new surface has been created successfully. |
| - virtual void didLoseOutputSurface(); |
| - |
| - ScrollbarAnimationController* scrollbarAnimationController() const { return m_scrollbarAnimationController.get(); } |
| - |
| - void setScrollbarOpacity(float opacity); |
| - |
| - void setHorizontalScrollbarLayer(ScrollbarLayerImpl*); |
| - ScrollbarLayerImpl* horizontalScrollbarLayer() { return m_horizontalScrollbarLayer; } |
| - |
| - void setVerticalScrollbarLayer(ScrollbarLayerImpl*); |
| - ScrollbarLayerImpl* verticalScrollbarLayer() { return m_verticalScrollbarLayer; } |
| - |
| - gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const; |
| - |
| - virtual skia::RefPtr<SkPicture> getPicture(); |
| - |
| - virtual bool canClipSelf() const; |
| - |
| - virtual bool areVisibleResourcesReady() const; |
| - |
| - virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl*); |
| - virtual void pushPropertiesTo(LayerImpl*); |
| - |
| - virtual scoped_ptr<base::Value> AsValue() const; |
| - |
| -protected: |
| - LayerImpl(LayerTreeImpl* layerImpl, int); |
| - |
| - // Get the color and size of the layer's debug border. |
| - virtual void getDebugBorderProperties(SkColor*, float* width) const; |
| - |
| - void appendDebugBorderQuad(QuadSink&, const SharedQuadState*, AppendQuadsData&) const; |
| - |
| - virtual void dumpLayerProperties(std::string*, int indent) const; |
| - static std::string indentString(int indent); |
| - |
| - void AsValueInto(base::DictionaryValue* dict) const; |
| - |
| - void noteLayerSurfacePropertyChanged(); |
| - void noteLayerPropertyChanged(); |
| - void noteLayerPropertyChangedForSubtree(); |
| - |
| - // Note carefully this does not affect the current layer. |
| - void noteLayerPropertyChangedForDescendants(); |
| - |
| -private: |
| - void updateScrollbarPositions(); |
| - |
| - virtual const char* layerTypeAsString() const; |
| - |
| - void dumpLayer(std::string*, int indent) const; |
| - |
| - // Properties internal to LayerImpl |
| - LayerImpl* m_parent; |
| - LayerList m_children; |
| - // m_maskLayer can be temporarily stolen during tree sync, we need this ID to confirm newly assigned layer is still the previous one |
| - int m_maskLayerId; |
| - scoped_ptr<LayerImpl> m_maskLayer; |
| - int m_replicaLayerId; // ditto |
| - scoped_ptr<LayerImpl> m_replicaLayer; |
| - int m_layerId; |
| - LayerTreeImpl* m_layerTreeImpl; |
| - |
| - // Properties synchronized from the associated Layer. |
| - gfx::PointF m_anchorPoint; |
| - float m_anchorPointZ; |
| - gfx::Size m_bounds; |
| - gfx::Vector2d m_scrollOffset; |
| - bool m_scrollable; |
| - bool m_shouldScrollOnMainThread; |
| - bool m_haveWheelEventHandlers; |
| - Region m_nonFastScrollableRegion; |
| - Region m_touchEventHandlerRegion; |
| - SkColor m_backgroundColor; |
| - bool m_stackingOrderChanged; |
| - |
| - // Whether the "back" of this layer should draw. |
| - bool m_doubleSided; |
| - |
| - // Tracks if drawing-related properties have changed since last redraw. |
| - bool m_layerPropertyChanged; |
| - |
| - // Indicates that a property has changed on this layer that would not |
| - // affect the pixels on its target surface, but would require redrawing |
| - // the targetSurface onto its ancestor targetSurface. |
| - // For layers that do not own a surface this flag acts as m_layerPropertyChanged. |
| - bool m_layerSurfacePropertyChanged; |
| - |
| - bool m_masksToBounds; |
| - bool m_contentsOpaque; |
| - float m_opacity; |
| - gfx::PointF m_position; |
| - bool m_preserves3D; |
| - bool m_useParentBackfaceVisibility; |
| - bool m_drawCheckerboardForMissingTiles; |
| - gfx::Transform m_sublayerTransform; |
| - gfx::Transform m_transform; |
| - |
| - bool m_drawsContent; |
| - bool m_forceRenderSurface; |
| - |
| - // Set for the layer that other layers are fixed to. |
| - bool m_isContainerForFixedPositionLayers; |
| - // This is true if the layer should be fixed to the closest ancestor container. |
| - bool m_fixedToContainerLayer; |
| - |
| - gfx::Vector2dF m_scrollDelta; |
| - gfx::Vector2d m_sentScrollDelta; |
| - gfx::Vector2d m_maxScrollOffset; |
| - gfx::Transform m_implTransform; |
| - gfx::Vector2dF m_lastScrollOffset; |
| - |
| - // The global depth value of the center of the layer. This value is used |
| - // to sort layers from back to front. |
| - float m_drawDepth; |
| - |
| - // Debug layer name. |
| - std::string m_debugName; |
| - |
| - WebKit::WebFilterOperations m_filters; |
| - WebKit::WebFilterOperations m_backgroundFilters; |
| - skia::RefPtr<SkImageFilter> m_filter; |
| + // The global depth value of the center of the layer. This value is used |
| + // to sort layers from back to front. |
| + float draw_depth_; |
| + |
| + // Debug layer name. |
| + std::string debug_name_; |
| + |
| + WebKit::WebFilterOperations filters_; |
| + WebKit::WebFilterOperations background_filters_; |
| + skia::RefPtr<SkImageFilter> filter_; |
| #ifndef NDEBUG |
| - bool m_betweenWillDrawAndDidDraw; |
| + bool between_will_draw_and_did_draw_; |
| #endif |
| - // Rect indicating what was repainted/updated during update. |
| - // Note that plugin layers bypass this and leave it empty. |
| - // Uses layer's content space. |
| - gfx::RectF m_updateRect; |
| + // Rect indicating what was repainted/updated during update. |
| + // Note that plugin layers bypass this and leave it empty. |
| + // Uses layer's content space. |
| + gfx::RectF update_rect_; |
| - // Manages animations for this layer. |
| - scoped_refptr<LayerAnimationController> m_layerAnimationController; |
| + // Manages animations for this layer. |
| + scoped_refptr<LayerAnimationController> layer_animation_controller_; |
| - // Manages scrollbars for this layer |
| - scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; |
| + // Manages scrollbars for this layer |
| + scoped_ptr<ScrollbarAnimationController> scrollbar_animation_controller_; |
| - // Weak pointers to this layer's scrollbars, if it has them. Updated during |
| - // tree synchronization. |
| - ScrollbarLayerImpl* m_horizontalScrollbarLayer; |
| - ScrollbarLayerImpl* m_verticalScrollbarLayer; |
| + // Weak pointers to this layer's scrollbars, if it has them. Updated during |
| + // tree synchronization. |
| + ScrollbarLayerImpl* horizontal_scrollbar_layer_; |
| + ScrollbarLayerImpl* vertical_scrollbar_layer_; |
| - // Group of properties that need to be computed based on the layer tree |
| - // hierarchy before layers can be drawn. |
| - DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; |
| + // Group of properties that need to be computed based on the layer tree |
| + // hierarchy before layers can be drawn. |
| + DrawProperties<LayerImpl, RenderSurfaceImpl> draw_properties_; |
| - DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| + DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| }; |
| } |