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

Unified Diff: ui/gfx/compositor/layer.h

Issue 8222028: Use WebKit compositor in ui::Layer (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase,fixes Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/compositor/layer.h
diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h
index 3d63f034f24e06b6fc823eb47c1b06bc25ed9c81..cde5247f373f539a89270b1a0ae6b8a0efe7bf61 100644
--- a/ui/gfx/compositor/layer.h
+++ b/ui/gfx/compositor/layer.h
@@ -12,6 +12,9 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayer.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebContentLayerClient.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebLayerClient.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/transform.h"
#include "ui/gfx/compositor/compositor.h"
@@ -35,7 +38,9 @@ class Texture;
// NOTE: unlike Views, each Layer does *not* own its children views. If you
// delete a Layer and it has children, the parent of each child layer is set to
// NULL, but the children are not deleted.
-class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
+class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate,
+ public WebKit::WebLayerClient,
+ public WebKit::WebContentLayerClient {
public:
enum LayerType {
LAYER_HAS_NO_TEXTURE = 0,
@@ -112,7 +117,7 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
// Returns true if this layer can have a texture (has_texture_ is true)
// and is not completely obscured by a child.
- bool ShouldDraw();
+ bool ShouldDraw() const;
// Converts a point from the coordinates of |source| to the coordinates of
// |target|. Necessarily, |source| and |target| must inhabit the same Layer
@@ -160,6 +165,14 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
// (e.g. the GPU process on TOUCH_UI).
bool layer_updated_externally() const { return layer_updated_externally_; }
+ // WebLayerClient
+ virtual void notifyNeedsComposite();
+
+ // WebContentLayerClient
+ virtual void paintContents(WebKit::WebCanvas*, const WebKit::WebRect& clip);
+
+ WebKit::WebContentLayer web_layer() { return web_layer_; }
+
private:
// TODO(vollick): Eventually, if a non-leaf node has an opacity of less than
// 1.0, we'll render to a separate texture, and then apply the alpha.
@@ -180,6 +193,9 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
// view has no transform with respect to its parent.
void RecomputeHole();
+ void RecomputeTransform();
+ void RecomputeDrawsContent();
+
// Returns true if the layer paints every pixel (fills_bounds_opaquely)
// and the alpha of the layer is 1.0f.
bool IsCompletelyOpaque() const;
@@ -234,6 +250,8 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
virtual void SetTransformFromAnimator(const Transform& transform) OVERRIDE;
virtual void SetOpacityFromAnimator(float opacity) OVERRIDE;
+ void CreateWebLayer();
+
const LayerType type_;
Compositor* compositor_;
@@ -266,6 +284,8 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
scoped_ptr<LayerAnimator> animator_;
+ WebKit::WebContentLayer web_layer_;
+
DISALLOW_COPY_AND_ASSIGN(Layer);
};

Powered by Google App Engine
This is Rietveld 408576698