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

Side by Side Diff: cc/trees/layer_tree_host_impl.h

Issue 15579002: Implement transform/clip support for Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests Created 7 years, 6 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 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_
6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // Must be called if and only if PrepareToDraw was called. 173 // Must be called if and only if PrepareToDraw was called.
174 void DidDrawAllLayers(const FrameData& frame); 174 void DidDrawAllLayers(const FrameData& frame);
175 175
176 const LayerTreeSettings& settings() const { return settings_; } 176 const LayerTreeSettings& settings() const { return settings_; }
177 177
178 // Returns the currently visible viewport size in DIP. This value excludes 178 // Returns the currently visible viewport size in DIP. This value excludes
179 // the URL bar and non-overlay scrollbars. 179 // the URL bar and non-overlay scrollbars.
180 gfx::SizeF VisibleViewportSize() const; 180 gfx::SizeF VisibleViewportSize() const;
181 181
182 // RendererClient implementation 182 // RendererClient implementation
183 virtual gfx::Rect DeviceViewport() const OVERRIDE;
183 private: 184 private:
184 virtual gfx::Size DeviceViewportSize() const OVERRIDE;
185 virtual float DeviceScaleFactor() const OVERRIDE; 185 virtual float DeviceScaleFactor() const OVERRIDE;
186 virtual const LayerTreeSettings& Settings() const OVERRIDE; 186 virtual const LayerTreeSettings& Settings() const OVERRIDE;
187 public: 187 public:
188 virtual void DidLoseOutputSurface() OVERRIDE; 188 virtual void DidLoseOutputSurface() OVERRIDE;
189 virtual void OnSwapBuffersComplete() OVERRIDE; 189 virtual void OnSwapBuffersComplete() OVERRIDE;
190 virtual void SetFullRootLayerDamage() OVERRIDE; 190 virtual void SetFullRootLayerDamage() OVERRIDE;
191 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) 191 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
192 OVERRIDE; 192 OVERRIDE;
193 virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) 193 virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
194 OVERRIDE; 194 OVERRIDE;
195 virtual bool HasImplThread() const OVERRIDE; 195 virtual bool HasImplThread() const OVERRIDE;
196 virtual bool ShouldClearRootRenderPass() const OVERRIDE; 196 virtual bool ShouldClearRootRenderPass() const OVERRIDE;
197 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE; 197 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE;
198 virtual bool AllowPartialSwap() const OVERRIDE; 198 virtual bool AllowPartialSwap() const OVERRIDE;
199 199
200 // TileManagerClient implementation. 200 // TileManagerClient implementation.
201 virtual void ScheduleManageTiles() OVERRIDE; 201 virtual void ScheduleManageTiles() OVERRIDE;
202 virtual void DidInitializeVisibleTile() OVERRIDE; 202 virtual void DidInitializeVisibleTile() OVERRIDE;
203 virtual bool ShouldForceTileUploadsRequiredForActivationToComplete() const 203 virtual bool ShouldForceTileUploadsRequiredForActivationToComplete() const
204 OVERRIDE; 204 OVERRIDE;
205 205
206 // OutputSurfaceClient implementation. 206 // OutputSurfaceClient implementation.
207 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; 207 virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE;
208 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, 208 virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
209 base::TimeDelta interval) OVERRIDE; 209 base::TimeDelta interval) OVERRIDE;
210 virtual void BeginFrame(base::TimeTicks frame_time) 210 virtual void BeginFrame(base::TimeTicks frame_time)
211 OVERRIDE; 211 OVERRIDE;
212 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack) 212 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack)
213 OVERRIDE; 213 OVERRIDE;
214 virtual void SetExternalDrawConstraints(const gfx::Transform& transform,
215 gfx::Rect viewport) OVERRIDE;
214 216
215 // Called from LayerTreeImpl. 217 // Called from LayerTreeImpl.
216 void OnCanDrawStateChangedForTree(); 218 void OnCanDrawStateChangedForTree();
217 219
218 // Implementation 220 // Implementation
219 bool CanDraw(); 221 bool CanDraw();
220 OutputSurface* output_surface() const { return output_surface_.get(); } 222 OutputSurface* output_surface() const { return output_surface_.get(); }
221 223
222 std::string LayerTreeAsText() const; 224 std::string LayerTreeAsText() const;
223 std::string LayerTreeAsJson() const; 225 std::string LayerTreeAsJson() const;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 266
265 void SetViewportSize(gfx::Size device_viewport_size); 267 void SetViewportSize(gfx::Size device_viewport_size);
266 gfx::Size device_viewport_size() const { return device_viewport_size_; } 268 gfx::Size device_viewport_size() const { return device_viewport_size_; }
267 269
268 void SetOverdrawBottomHeight(float overdraw_bottom_height); 270 void SetOverdrawBottomHeight(float overdraw_bottom_height);
269 float overdraw_bottom_height() const { return overdraw_bottom_height_; } 271 float overdraw_bottom_height() const { return overdraw_bottom_height_; }
270 272
271 void SetDeviceScaleFactor(float device_scale_factor); 273 void SetDeviceScaleFactor(float device_scale_factor);
272 float device_scale_factor() const { return device_scale_factor_; } 274 float device_scale_factor() const { return device_scale_factor_; }
273 275
276 gfx::Rect DeviceClip() const;
277 const gfx::Transform& DeviceTransform() const;
278
274 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); 279 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas();
275 280
276 bool needs_animate_layers() const { 281 bool needs_animate_layers() const {
277 return !animation_registrar_->active_animation_controllers().empty(); 282 return !animation_registrar_->active_animation_controllers().empty();
278 } 283 }
279 284
280 void SendManagedMemoryStats( 285 void SendManagedMemoryStats(
281 size_t memory_visible_bytes, 286 size_t memory_visible_bytes,
282 size_t memory_visible_and_nearby_bytes, 287 size_t memory_visible_and_nearby_bytes,
283 size_t memory_use_bytes); 288 size_t memory_use_bytes);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 scoped_ptr<LayerTreeImpl> recycle_tree_; 460 scoped_ptr<LayerTreeImpl> recycle_tree_;
456 461
457 InputHandlerClient* input_handler_client_; 462 InputHandlerClient* input_handler_client_;
458 bool did_lock_scrolling_layer_; 463 bool did_lock_scrolling_layer_;
459 bool should_bubble_scrolls_; 464 bool should_bubble_scrolls_;
460 bool wheel_scrolling_; 465 bool wheel_scrolling_;
461 // The optional delegate for the root layer scroll offset. 466 // The optional delegate for the root layer scroll offset.
462 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; 467 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_;
463 LayerTreeSettings settings_; 468 LayerTreeSettings settings_;
464 LayerTreeDebugState debug_state_; 469 LayerTreeDebugState debug_state_;
465 gfx::Size device_viewport_size_;
466 float overdraw_bottom_height_;
467 float device_scale_factor_;
468 bool visible_; 470 bool visible_;
469 ManagedMemoryPolicy managed_memory_policy_; 471 ManagedMemoryPolicy managed_memory_policy_;
470 472
471 gfx::Vector2dF accumulated_root_overscroll_; 473 gfx::Vector2dF accumulated_root_overscroll_;
472 gfx::Vector2dF current_fling_velocity_; 474 gfx::Vector2dF current_fling_velocity_;
473 475
474 bool pinch_gesture_active_; 476 bool pinch_gesture_active_;
475 gfx::Point previous_pinch_anchor_; 477 gfx::Point previous_pinch_anchor_;
476 478
477 // This is set by AnimateLayers() and used by UpdateAnimationState() 479 // This is set by AnimateLayers() and used by UpdateAnimationState()
(...skipping 13 matching lines...) Expand all
491 scoped_ptr<DebugRectHistory> debug_rect_history_; 493 scoped_ptr<DebugRectHistory> debug_rect_history_;
492 494
493 // The maximum memory that would be used by the prioritized resource 495 // The maximum memory that would be used by the prioritized resource
494 // manager, if there were no limit on memory usage. 496 // manager, if there were no limit on memory usage.
495 size_t max_memory_needed_bytes_; 497 size_t max_memory_needed_bytes_;
496 498
497 size_t last_sent_memory_visible_bytes_; 499 size_t last_sent_memory_visible_bytes_;
498 size_t last_sent_memory_visible_and_nearby_bytes_; 500 size_t last_sent_memory_visible_and_nearby_bytes_;
499 size_t last_sent_memory_use_bytes_; 501 size_t last_sent_memory_use_bytes_;
500 502
503 // Viewport size passed in from the main thread, in physical pixels.
504 gfx::Size device_viewport_size_;
505
506 // Conversion factor from CSS pixels to physical pixels when
507 // pageScaleFactor=1.
508 float device_scale_factor_;
509
510 // Vertical amount of the viewport size that's known to covered by a
511 // browser-side UI element, such as an on-screen-keyboard. This affects
512 // scrollable size since we want to still be able to scroll to the bottom of
513 // the page when the keyboard is up.
514 float overdraw_bottom_height_;
515
516 // Optional top-level constraints that can be set by the OutputSurface. The
517 // external_viewport_'s size takes precedence over device_viewport_size_ for
518 // DrawQuad generation and Renderer; however, device_viewport_size_ is still
519 // used for scrollable size.
520 gfx::Transform external_transform_;
521 gfx::Rect external_viewport_;
522
501 gfx::Rect viewport_damage_rect_; 523 gfx::Rect viewport_damage_rect_;
502 524
503 base::TimeTicks current_frame_timeticks_; 525 base::TimeTicks current_frame_timeticks_;
504 base::Time current_frame_time_; 526 base::Time current_frame_time_;
505 527
506 scoped_ptr<AnimationRegistrar> animation_registrar_; 528 scoped_ptr<AnimationRegistrar> animation_registrar_;
507 529
508 RenderingStatsInstrumentation* rendering_stats_instrumentation_; 530 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
509 531
510 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 532 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
511 }; 533 };
512 534
513 } // namespace cc 535 } // namespace cc
514 536
515 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ 537 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698