1dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block/* 2dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * Copyright (C) 2010 Google Inc. All rights reserved. 3dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * 4dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * Redistribution and use in source and binary forms, with or without 5dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * modification, are permitted provided that the following conditions are 6dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * met: 7dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * 8dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * * Redistributions of source code must retain the above copyright 9dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * notice, this list of conditions and the following disclaimer. 10dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * * Redistributions in binary form must reproduce the above 11dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * copyright notice, this list of conditions and the following disclaimer 12dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * in the documentation and/or other materials provided with the 13dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * distribution. 14dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * * Neither the name of Google Inc. nor the names of its 15dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * contributors may be used to endorse or promote products derived from 16dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * this software without specific prior written permission. 17dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * 18dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block */ 30dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 31dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#ifndef GraphicsLayerChromium_h 32dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#define GraphicsLayerChromium_h 33dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 34dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#if USE(ACCELERATED_COMPOSITING) 35dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 36dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include "GraphicsContext.h" 37dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#include "GraphicsLayer.h" 38dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 39dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blocknamespace WebCore { 40dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 41dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockclass LayerChromium; 42dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 43dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockclass GraphicsLayerChromium : public GraphicsLayer { 44dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockpublic: 45dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block GraphicsLayerChromium(GraphicsLayerClient*); 46dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual ~GraphicsLayerChromium(); 47dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 48dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setName(const String&); 49dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 50dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual bool setChildren(const Vector<GraphicsLayer*>&); 51dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void addChild(GraphicsLayer*); 52dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void addChildAtIndex(GraphicsLayer*, int index); 53dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void addChildAbove(GraphicsLayer*, GraphicsLayer* sibling); 54dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling); 55dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild); 56dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 57dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void removeFromParent(); 58dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 59dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setPosition(const FloatPoint&); 60dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setAnchorPoint(const FloatPoint3D&); 61dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setSize(const FloatSize&); 62dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 63dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setTransform(const TransformationMatrix&); 64dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 65dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setChildrenTransform(const TransformationMatrix&); 66dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 67dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setPreserves3D(bool); 68dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setMasksToBounds(bool); 69dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setDrawsContent(bool); 702fc2651226baac27029e38c9d6ef883fa32084dbSteve Block virtual void setMaskLayer(GraphicsLayer*); 71dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 72dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setBackgroundColor(const Color&); 73dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void clearBackgroundColor(); 74dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 75dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setContentsOpaque(bool); 76dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setBackfaceVisibility(bool); 77dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 782fc2651226baac27029e38c9d6ef883fa32084dbSteve Block virtual void setReplicatedByLayer(GraphicsLayer*); 792fc2651226baac27029e38c9d6ef883fa32084dbSteve Block 80dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setOpacity(float); 81dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 82dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setNeedsDisplay(); 83dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setNeedsDisplayInRect(const FloatRect&); 84dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch virtual void setContentsNeedsDisplay(); 85dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 86dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setContentsRect(const IntRect&); 87dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 88dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setContentsToImage(Image*); 89967717af5423377c967781471ee106e2bb4e11c8Ben Murdoch virtual void setContentsToMedia(PlatformLayer*); 90dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch virtual void setContentsToCanvas(PlatformLayer*); 91dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 92dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual PlatformLayer* platformLayer() const; 93dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 94dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setDebugBackgroundColor(const Color&); 95dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block virtual void setDebugBorder(const Color&, float borderWidth); 96dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 97dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void notifySyncRequired() 98dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block { 99dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block if (m_client) 100dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block m_client->notifySyncRequired(this); 101dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block } 102dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 103dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Blockprivate: 104dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateOpacityOnLayer(); 105dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 106dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayerChromium* primaryLayer() const { return m_transformLayer.get() ? m_transformLayer.get() : m_layer.get(); } 107dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayerChromium* hostLayerForSublayers() const; 108dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayerChromium* layerForSuperlayer() const; 109dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 11081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch void updateNames(); 111dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateSublayerList(); 112dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateLayerPosition(); 113dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateLayerSize(); 114dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateAnchorPoint(); 115dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateTransform(); 116dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateChildrenTransform(); 117dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateMasksToBounds(); 118dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateContentsOpaque(); 119dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateBackfaceVisibility(); 120dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateLayerPreserves3D(); 121dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateLayerDrawsContent(); 122dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateLayerBackgroundColor(); 123dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 124dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateContentsImage(); 125dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateContentsVideo(); 126dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void updateContentsRect(); 127dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 128dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block void setupContentsLayer(LayerChromium*); 129dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block LayerChromium* contentsLayer() const { return m_contentsLayer.get(); } 130dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 13181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch String m_nameBase; 13281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 133dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block RefPtr<LayerChromium> m_layer; 134dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block RefPtr<LayerChromium> m_transformLayer; 135dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block RefPtr<LayerChromium> m_contentsLayer; 136dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 137dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block enum ContentsLayerPurpose { 138dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block NoContentsLayer = 0, 139dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ContentsLayerForImage, 14006ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen ContentsLayerForVideo, 1415abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick ContentsLayerForCanvas, 142dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block }; 143dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 144dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block ContentsLayerPurpose m_contentsLayerPurpose; 145dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block bool m_contentsLayerHasBackgroundColor : 1; 146dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block}; 147dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 148dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block} // namespace WebCore 149dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 150dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#endif // USE(ACCELERATED_COMPOSITING) 151dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block 152dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block#endif 153