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

Side by Side Diff: Source/platform/graphics/GraphicsLayer.h

Issue 335453002: Remove unused cruft from GraphicsLayer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove test file Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/platform/graphics/GraphicsLayer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. 3 * Copyright (C) 2013 Intel Corporation. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 GraphicsLayerDebugInfo& debugInfo(); 96 GraphicsLayerDebugInfo& debugInfo();
97 97
98 void setCompositingReasons(CompositingReasons); 98 void setCompositingReasons(CompositingReasons);
99 CompositingReasons compositingReasons() const { return m_debugInfo.compositi ngReasons(); } 99 CompositingReasons compositingReasons() const { return m_debugInfo.compositi ngReasons(); }
100 void setOwnerNodeId(int); 100 void setOwnerNodeId(int);
101 101
102 GraphicsLayer* parent() const { return m_parent; }; 102 GraphicsLayer* parent() const { return m_parent; };
103 void setParent(GraphicsLayer*); // Internal use only. 103 void setParent(GraphicsLayer*); // Internal use only.
104 104
105 // Returns true if the layer has the given layer as an ancestor (excluding s elf).
106 bool hasAncestor(GraphicsLayer*) const;
107
108 const Vector<GraphicsLayer*>& children() const { return m_children; } 105 const Vector<GraphicsLayer*>& children() const { return m_children; }
109 // Returns true if the child list changed. 106 // Returns true if the child list changed.
110 bool setChildren(const GraphicsLayerVector&); 107 bool setChildren(const GraphicsLayerVector&);
111 108
112 // Add child layers. If the child is already parented, it will be removed fr om its old parent. 109 // Add child layers. If the child is already parented, it will be removed fr om its old parent.
113 void addChild(GraphicsLayer*); 110 void addChild(GraphicsLayer*);
114 void addChildAtIndex(GraphicsLayer*, int index); 111 void addChildAtIndex(GraphicsLayer*, int index);
115 void addChildAbove(GraphicsLayer*, GraphicsLayer* sibling); 112 void addChildAbove(GraphicsLayer*, GraphicsLayer* sibling);
116 void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling); 113 void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling);
117 bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild); 114 bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild);
118 115
119 void removeAllChildren(); 116 void removeAllChildren();
120 void removeFromParent(); 117 void removeFromParent();
121 118
122 GraphicsLayer* maskLayer() const { return m_maskLayer; } 119 GraphicsLayer* maskLayer() const { return m_maskLayer; }
123 void setMaskLayer(GraphicsLayer*); 120 void setMaskLayer(GraphicsLayer*);
124 121
125 GraphicsLayer* contentsClippingMaskLayer() const { return m_contentsClipping MaskLayer; } 122 GraphicsLayer* contentsClippingMaskLayer() const { return m_contentsClipping MaskLayer; }
126 void setContentsClippingMaskLayer(GraphicsLayer*); 123 void setContentsClippingMaskLayer(GraphicsLayer*);
127 124
128 // The given layer will replicate this layer and its children; the replica r enders behind this layer. 125 // The given layer will replicate this layer and its children; the replica r enders behind this layer.
129 void setReplicatedByLayer(GraphicsLayer*); 126 void setReplicatedByLayer(GraphicsLayer*);
130 // Whether this layer is being replicated by another layer.
131 bool isReplicated() const { return m_replicaLayer; }
132 // The layer that replicates this layer (if any). 127 // The layer that replicates this layer (if any).
133 GraphicsLayer* replicaLayer() const { return m_replicaLayer; } 128 GraphicsLayer* replicaLayer() const { return m_replicaLayer; }
134 // The layer being replicated. 129 // The layer being replicated.
135 GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; } 130 GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; }
136 131
137 enum ShouldSetNeedsDisplay { 132 enum ShouldSetNeedsDisplay {
138 DontSetNeedsDisplay, 133 DontSetNeedsDisplay,
139 SetNeedsDisplay 134 SetNeedsDisplay
140 }; 135 };
141 136
(...skipping 11 matching lines...) Expand all
153 // The size of the layer. 148 // The size of the layer.
154 const FloatSize& size() const { return m_size; } 149 const FloatSize& size() const { return m_size; }
155 void setSize(const FloatSize&); 150 void setSize(const FloatSize&);
156 151
157 // The boundOrigin affects the offset at which content is rendered, and subl ayers are positioned. 152 // The boundOrigin affects the offset at which content is rendered, and subl ayers are positioned.
158 const FloatPoint& boundsOrigin() const { return m_boundsOrigin; } 153 const FloatPoint& boundsOrigin() const { return m_boundsOrigin; }
159 void setBoundsOrigin(const FloatPoint& origin) { m_boundsOrigin = origin; } 154 void setBoundsOrigin(const FloatPoint& origin) { m_boundsOrigin = origin; }
160 155
161 const TransformationMatrix& transform() const { return m_transform; } 156 const TransformationMatrix& transform() const { return m_transform; }
162 void setTransform(const TransformationMatrix&); 157 void setTransform(const TransformationMatrix&);
163
164 bool shouldFlattenTransform() const { return m_shouldFlattenTransform; }
165 void setShouldFlattenTransform(bool); 158 void setShouldFlattenTransform(bool);
166
167 int renderingContext() const { return m_3dRenderingContext; }
168 void setRenderingContext(int id); 159 void setRenderingContext(int id);
169
170 bool masksToBounds() const { return m_masksToBounds; }
171 void setMasksToBounds(bool); 160 void setMasksToBounds(bool);
172 161
173 bool drawsContent() const { return m_drawsContent; } 162 bool drawsContent() const { return m_drawsContent; }
174 void setDrawsContent(bool); 163 void setDrawsContent(bool);
175 164
176 bool contentsAreVisible() const { return m_contentsVisible; } 165 bool contentsAreVisible() const { return m_contentsVisible; }
177 void setContentsVisible(bool); 166 void setContentsVisible(bool);
178 167
179 void setScrollParent(blink::WebLayer*); 168 void setScrollParent(blink::WebLayer*);
180 void setClipParent(blink::WebLayer*); 169 void setClipParent(blink::WebLayer*);
181 170
182 // For special cases, e.g. drawing missing tiles on Android. 171 // For special cases, e.g. drawing missing tiles on Android.
183 // The compositor should never paint this color in normal cases because the RenderLayer 172 // The compositor should never paint this color in normal cases because the RenderLayer
184 // will paint background by itself. 173 // will paint background by itself.
185 const Color& backgroundColor() const { return m_backgroundColor; }
186 void setBackgroundColor(const Color&); 174 void setBackgroundColor(const Color&);
187 175
188 // opaque means that we know the layer contents have no alpha 176 // opaque means that we know the layer contents have no alpha
189 bool contentsOpaque() const { return m_contentsOpaque; } 177 bool contentsOpaque() const { return m_contentsOpaque; }
190 void setContentsOpaque(bool); 178 void setContentsOpaque(bool);
191 179
192 bool backfaceVisibility() const { return m_backfaceVisibility; } 180 bool backfaceVisibility() const { return m_backfaceVisibility; }
193 void setBackfaceVisibility(bool visible); 181 void setBackfaceVisibility(bool visible);
194 182
195 float opacity() const { return m_opacity; } 183 float opacity() const { return m_opacity; }
196 void setOpacity(float); 184 void setOpacity(float);
197 185
198 blink::WebBlendMode blendMode() const { return m_blendMode; }
199 void setBlendMode(blink::WebBlendMode); 186 void setBlendMode(blink::WebBlendMode);
200
201 bool isRootForIsolatedGroup() const { return m_isRootForIsolatedGroup; }
202 void setIsRootForIsolatedGroup(bool); 187 void setIsRootForIsolatedGroup(bool);
203 188
204 const FilterOperations& filters() const { return m_filters; }
205
206 // Returns true if filter can be rendered by the compositor 189 // Returns true if filter can be rendered by the compositor
207 bool setFilters(const FilterOperations&); 190 bool setFilters(const FilterOperations&);
208 void setBackgroundFilters(const FilterOperations&); 191 void setBackgroundFilters(const FilterOperations&);
209 192
210 // Some GraphicsLayers paint only the foreground or the background content 193 // Some GraphicsLayers paint only the foreground or the background content
211 GraphicsLayerPaintingPhase paintingPhase() const { return m_paintingPhase; }
212 void setPaintingPhase(GraphicsLayerPaintingPhase); 194 void setPaintingPhase(GraphicsLayerPaintingPhase);
213 195
214 void setNeedsDisplay(); 196 void setNeedsDisplay();
215 // mark the given rect (in layer coords) as needing dispay. Never goes deep. 197 // mark the given rect (in layer coords) as needing dispay. Never goes deep.
216 void setNeedsDisplayInRect(const FloatRect&); 198 void setNeedsDisplayInRect(const FloatRect&);
217 199
218 void setContentsNeedsDisplay(); 200 void setContentsNeedsDisplay();
219 201
220 // Set that the position/size of the contents (image or video). 202 // Set that the position/size of the contents (image or video).
221 IntRect contentsRect() const { return m_contentsRect; }
222 void setContentsRect(const IntRect&); 203 void setContentsRect(const IntRect&);
223 204
224 // Return true if the animation is handled by the compositing system. If thi s returns 205 // Return true if the animation is handled by the compositing system. If thi s returns
225 // false, the animation will be run by AnimationController. 206 // false, the animation will be run by AnimationController.
226 // These methods handle both transitions and keyframe animations. 207 // These methods handle both transitions and keyframe animations.
227 bool addAnimation(PassOwnPtr<blink::WebAnimation>); 208 bool addAnimation(PassOwnPtr<blink::WebAnimation>);
228 void pauseAnimation(int animationId, double /*timeOffset*/); 209 void pauseAnimation(int animationId, double /*timeOffset*/);
229 void removeAnimation(int animationId); 210 void removeAnimation(int animationId);
230 211
231 // Layer contents 212 // Layer contents
232 void setContentsToImage(Image*); 213 void setContentsToImage(Image*);
233 void setContentsToNinePatch(Image*, const IntRect& aperture); 214 void setContentsToNinePatch(Image*, const IntRect& aperture);
234 void setContentsToPlatformLayer(blink::WebLayer* layer) { setContentsTo(laye r); } 215 void setContentsToPlatformLayer(blink::WebLayer* layer) { setContentsTo(laye r); }
235 bool hasContentsLayer() const { return m_contentsLayer; } 216 bool hasContentsLayer() const { return m_contentsLayer; }
236 217
237 // Callback from the underlying graphics system to draw layer contents. 218 // Callback from the underlying graphics system to draw layer contents.
238 void paintGraphicsLayerContents(GraphicsContext&, const IntRect& clip); 219 void paintGraphicsLayerContents(GraphicsContext&, const IntRect& clip);
239 220
240 // For hosting this GraphicsLayer in a native layer hierarchy. 221 // For hosting this GraphicsLayer in a native layer hierarchy.
241 blink::WebLayer* platformLayer() const; 222 blink::WebLayer* platformLayer() const;
242 223
243 enum CompositingCoordinatesOrientation { CompositingCoordinatesTopDown, Comp ositingCoordinatesBottomUp };
244
245 // Flippedness of the contents of this layer. Does not affect sublayer geome try.
246 void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; }
247 CompositingCoordinatesOrientation contentsOrientation() const { return m_con tentsOrientation; }
248
249 typedef HashMap<int, int> RenderingContextMap; 224 typedef HashMap<int, int> RenderingContextMap;
250 void dumpLayer(TextStream&, int indent, LayerTreeFlags, RenderingContextMap& ) const; 225 void dumpLayer(TextStream&, int indent, LayerTreeFlags, RenderingContextMap& ) const;
251 226
252 int paintCount() const { return m_paintCount; } 227 int paintCount() const { return m_paintCount; }
253 228
254 // z-position is the z-equivalent of position(). It's only used for debuggin g purposes.
255 float zPosition() const { return m_zPosition; }
256 void setZPosition(float);
257
258 // If the exposed rect of this layer changes, returns true if this or descen dant layers need a flush,
259 // for example to allocate new tiles.
260 bool visibleRectChangeRequiresFlush(const FloatRect& /* clipRect */) const { return false; }
261
262 // Return a string with a human readable form of the layer tree, If debug is true 229 // Return a string with a human readable form of the layer tree, If debug is true
263 // pointers for the layers and timing data will be included in the returned string. 230 // pointers for the layers and timing data will be included in the returned string.
264 String layerTreeAsText(LayerTreeFlags = LayerTreeNormal) const; 231 String layerTreeAsText(LayerTreeFlags = LayerTreeNormal) const;
265 String debugName(blink::WebLayer*) const; 232 String debugName(blink::WebLayer*) const;
266 233
267 void resetTrackedRepaints(); 234 void resetTrackedRepaints();
268 void addRepaintRect(const FloatRect&); 235 void addRepaintRect(const FloatRect&);
269 236
270 void collectTrackedRepaintRects(Vector<FloatRect>&) const; 237 void collectTrackedRepaintRects(Vector<FloatRect>&) const;
271 238
(...skipping 27 matching lines...) Expand all
299 friend class blink::GraphicsLayerFactoryChromium; 266 friend class blink::GraphicsLayerFactoryChromium;
300 267
301 // Exposed for tests. 268 // Exposed for tests.
302 virtual blink::WebLayer* contentsLayer() const { return m_contentsLayer; } 269 virtual blink::WebLayer* contentsLayer() const { return m_contentsLayer; }
303 270
304 private: 271 private:
305 // Adds a child without calling updateChildList(), so that adding children 272 // Adds a child without calling updateChildList(), so that adding children
306 // can be batched before updating. 273 // can be batched before updating.
307 void addChildInternal(GraphicsLayer*); 274 void addChildInternal(GraphicsLayer*);
308 275
276 #if ASSERT_ENABLED
277 bool hasAncestor(GraphicsLayer*) const;
278 #endif
279
309 // This method is used by platform GraphicsLayer classes to clear the filter s 280 // This method is used by platform GraphicsLayer classes to clear the filter s
310 // when compositing is not done in hardware. It is not virtual, so the calle r 281 // when compositing is not done in hardware. It is not virtual, so the calle r
311 // needs to notifiy the change to the platform layer as needed. 282 // needs to notifiy the change to the platform layer as needed.
312 void clearFilters() { m_filters.clear(); } 283 void clearFilters() { m_filters.clear(); }
313 284
314 void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; } 285 void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; }
315 286
316 int incrementPaintCount() { return ++m_paintCount; } 287 int incrementPaintCount() { return ++m_paintCount; }
317 288
318 void dumpProperties(TextStream&, int indent, LayerTreeFlags, RenderingContex tMap&) const; 289 void dumpProperties(TextStream&, int indent, LayerTreeFlags, RenderingContex tMap&) const;
(...skipping 16 matching lines...) Expand all
335 // Position is relative to the parent GraphicsLayer 306 // Position is relative to the parent GraphicsLayer
336 FloatPoint m_position; 307 FloatPoint m_position;
337 FloatSize m_size; 308 FloatSize m_size;
338 FloatPoint m_boundsOrigin; 309 FloatPoint m_boundsOrigin;
339 310
340 TransformationMatrix m_transform; 311 TransformationMatrix m_transform;
341 FloatPoint3D m_transformOrigin; 312 FloatPoint3D m_transformOrigin;
342 313
343 Color m_backgroundColor; 314 Color m_backgroundColor;
344 float m_opacity; 315 float m_opacity;
345 float m_zPosition;
346 316
347 blink::WebBlendMode m_blendMode; 317 blink::WebBlendMode m_blendMode;
348 318
349 FilterOperations m_filters; 319 FilterOperations m_filters;
350 320
351 bool m_hasTransformOrigin : 1; 321 bool m_hasTransformOrigin : 1;
352 bool m_contentsOpaque : 1; 322 bool m_contentsOpaque : 1;
353 bool m_shouldFlattenTransform: 1; 323 bool m_shouldFlattenTransform: 1;
354 bool m_backfaceVisibility : 1; 324 bool m_backfaceVisibility : 1;
355 bool m_masksToBounds : 1; 325 bool m_masksToBounds : 1;
356 bool m_drawsContent : 1; 326 bool m_drawsContent : 1;
357 bool m_contentsVisible : 1; 327 bool m_contentsVisible : 1;
358 bool m_isRootForIsolatedGroup : 1; 328 bool m_isRootForIsolatedGroup : 1;
359 329
360 bool m_hasScrollParent : 1; 330 bool m_hasScrollParent : 1;
361 bool m_hasClipParent : 1; 331 bool m_hasClipParent : 1;
362 332
363 GraphicsLayerPaintingPhase m_paintingPhase; 333 GraphicsLayerPaintingPhase m_paintingPhase;
364 CompositingCoordinatesOrientation m_contentsOrientation; // affects orientat ion of layer contents
365 334
366 Vector<GraphicsLayer*> m_children; 335 Vector<GraphicsLayer*> m_children;
367 GraphicsLayer* m_parent; 336 GraphicsLayer* m_parent;
368 337
369 GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this. 338 GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this.
370 GraphicsLayer* m_contentsClippingMaskLayer; // Reference to clipping mask la yer. We don't own this. 339 GraphicsLayer* m_contentsClippingMaskLayer; // Reference to clipping mask la yer. We don't own this.
371 340
372 GraphicsLayer* m_replicaLayer; // A layer that replicates this layer. We onl y allow one, for now. 341 GraphicsLayer* m_replicaLayer; // A layer that replicates this layer. We onl y allow one, for now.
373 // The replica is not parented; this is the p rimary reference to it. 342 // The replica is not parented; this is the p rimary reference to it.
374 GraphicsLayer* m_replicatedLayer; // For a replica layer, a reference to the original layer. 343 GraphicsLayer* m_replicatedLayer; // For a replica layer, a reference to the original layer.
(...skipping 23 matching lines...) Expand all
398 }; 367 };
399 368
400 } // namespace WebCore 369 } // namespace WebCore
401 370
402 #ifndef NDEBUG 371 #ifndef NDEBUG
403 // Outside the WebCore namespace for ease of invocation from gdb. 372 // Outside the WebCore namespace for ease of invocation from gdb.
404 void PLATFORM_EXPORT showGraphicsLayerTree(const WebCore::GraphicsLayer*); 373 void PLATFORM_EXPORT showGraphicsLayerTree(const WebCore::GraphicsLayer*);
405 #endif 374 #endif
406 375
407 #endif // GraphicsLayer_h 376 #endif // GraphicsLayer_h
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/GraphicsLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698