OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer
Client*); | 214 static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayer
Client*); |
215 | 215 |
216 virtual ~GraphicsLayer(); | 216 virtual ~GraphicsLayer(); |
217 | 217 |
218 GraphicsLayerClient* client() const { return m_client; } | 218 GraphicsLayerClient* client() const { return m_client; } |
219 | 219 |
220 // WebKit::WebLayerClient implementation. | 220 // WebKit::WebLayerClient implementation. |
221 virtual WebKit::WebString debugName(WebKit::WebLayer*) OVERRIDE; | 221 virtual WebKit::WebString debugName(WebKit::WebLayer*) OVERRIDE; |
222 | 222 |
223 void setCompositingReasons(WebKit::WebCompositingReasons); | 223 void setCompositingReasons(WebKit::WebCompositingReasons); |
| 224 WebKit::WebCompositingReasons compositingReasons() const { return m_composit
ingReasons; } |
224 | 225 |
225 GraphicsLayer* parent() const { return m_parent; }; | 226 GraphicsLayer* parent() const { return m_parent; }; |
226 void setParent(GraphicsLayer*); // Internal use only. | 227 void setParent(GraphicsLayer*); // Internal use only. |
227 | 228 |
228 // Returns true if the layer has the given layer as an ancestor (excluding s
elf). | 229 // Returns true if the layer has the given layer as an ancestor (excluding s
elf). |
229 bool hasAncestor(GraphicsLayer*) const; | 230 bool hasAncestor(GraphicsLayer*) const; |
230 | 231 |
231 const Vector<GraphicsLayer*>& children() const { return m_children; } | 232 const Vector<GraphicsLayer*>& children() const { return m_children; } |
232 // Returns true if the child list changed. | 233 // Returns true if the child list changed. |
233 bool setChildren(const Vector<GraphicsLayer*>&); | 234 bool setChildren(const Vector<GraphicsLayer*>&); |
(...skipping 10 matching lines...) Expand all Loading... |
244 | 245 |
245 GraphicsLayer* maskLayer() const { return m_maskLayer; } | 246 GraphicsLayer* maskLayer() const { return m_maskLayer; } |
246 void setMaskLayer(GraphicsLayer*); | 247 void setMaskLayer(GraphicsLayer*); |
247 | 248 |
248 // The given layer will replicate this layer and its children; the replica r
enders behind this layer. | 249 // The given layer will replicate this layer and its children; the replica r
enders behind this layer. |
249 void setReplicatedByLayer(GraphicsLayer*); | 250 void setReplicatedByLayer(GraphicsLayer*); |
250 // Whether this layer is being replicated by another layer. | 251 // Whether this layer is being replicated by another layer. |
251 bool isReplicated() const { return m_replicaLayer; } | 252 bool isReplicated() const { return m_replicaLayer; } |
252 // The layer that replicates this layer (if any). | 253 // The layer that replicates this layer (if any). |
253 GraphicsLayer* replicaLayer() const { return m_replicaLayer; } | 254 GraphicsLayer* replicaLayer() const { return m_replicaLayer; } |
| 255 // The layer being replicated. |
| 256 GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; } |
254 | 257 |
255 const FloatPoint& replicatedLayerPosition() const { return m_replicatedLayer
Position; } | 258 const FloatPoint& replicatedLayerPosition() const { return m_replicatedLayer
Position; } |
256 void setReplicatedLayerPosition(const FloatPoint& p) { m_replicatedLayerPosi
tion = p; } | 259 void setReplicatedLayerPosition(const FloatPoint& p) { m_replicatedLayerPosi
tion = p; } |
257 | 260 |
258 enum ShouldSetNeedsDisplay { | 261 enum ShouldSetNeedsDisplay { |
259 DontSetNeedsDisplay, | 262 DontSetNeedsDisplay, |
260 SetNeedsDisplay | 263 SetNeedsDisplay |
261 }; | 264 }; |
262 | 265 |
263 // Offset is origin of the renderer minus origin of the graphics layer (so e
ither zero or negative). | 266 // Offset is origin of the renderer minus origin of the graphics layer (so e
ither zero or negative). |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 WebKit::WebLayer* platformLayer() const; | 373 WebKit::WebLayer* platformLayer() const; |
371 | 374 |
372 enum CompositingCoordinatesOrientation { CompositingCoordinatesTopDown, Comp
ositingCoordinatesBottomUp }; | 375 enum CompositingCoordinatesOrientation { CompositingCoordinatesTopDown, Comp
ositingCoordinatesBottomUp }; |
373 | 376 |
374 // Flippedness of the contents of this layer. Does not affect sublayer geome
try. | 377 // Flippedness of the contents of this layer. Does not affect sublayer geome
try. |
375 void setContentsOrientation(CompositingCoordinatesOrientation orientation) {
m_contentsOrientation = orientation; } | 378 void setContentsOrientation(CompositingCoordinatesOrientation orientation) {
m_contentsOrientation = orientation; } |
376 CompositingCoordinatesOrientation contentsOrientation() const { return m_con
tentsOrientation; } | 379 CompositingCoordinatesOrientation contentsOrientation() const { return m_con
tentsOrientation; } |
377 | 380 |
378 void dumpLayer(TextStream&, int indent = 0, LayerTreeFlags = LayerTreeNormal
) const; | 381 void dumpLayer(TextStream&, int indent = 0, LayerTreeFlags = LayerTreeNormal
) const; |
379 | 382 |
380 void setShowRepaintCounter(bool show) { m_showRepaintCounter = show; } | 383 int paintCount() const { return m_paintCount; } |
381 bool isShowingRepaintCounter() const { return m_showRepaintCounter; } | |
382 | |
383 // FIXME: this is really a paint count. | |
384 int repaintCount() const { return m_repaintCount; } | |
385 int incrementRepaintCount() { return ++m_repaintCount; } | |
386 | 384 |
387 // z-position is the z-equivalent of position(). It's only used for debuggin
g purposes. | 385 // z-position is the z-equivalent of position(). It's only used for debuggin
g purposes. |
388 float zPosition() const { return m_zPosition; } | 386 float zPosition() const { return m_zPosition; } |
389 void setZPosition(float); | 387 void setZPosition(float); |
390 | 388 |
391 void distributeOpacity(float); | 389 void distributeOpacity(float); |
392 float accumulatedOpacity() const; | 390 float accumulatedOpacity() const; |
393 | 391 |
394 // If the exposed rect of this layer changes, returns true if this or descen
dant layers need a flush, | 392 // If the exposed rect of this layer changes, returns true if this or descen
dant layers need a flush, |
395 // for example to allocate new tiles. | 393 // for example to allocate new tiles. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 // Given a KeyframeValueList containing filterOperations, return true if the
operations are valid. | 446 // Given a KeyframeValueList containing filterOperations, return true if the
operations are valid. |
449 static int validateFilterOperations(const KeyframeValueList&); | 447 static int validateFilterOperations(const KeyframeValueList&); |
450 | 448 |
451 // Given a list of TransformAnimationValues, see if all the operations for e
ach keyframe match. If so | 449 // Given a list of TransformAnimationValues, see if all the operations for e
ach keyframe match. If so |
452 // return the index of the KeyframeValueList entry that has that list of ope
rations (it may not be | 450 // return the index of the KeyframeValueList entry that has that list of ope
rations (it may not be |
453 // the first entry because some keyframes might have an empty transform and
those match any list). | 451 // the first entry because some keyframes might have an empty transform and
those match any list). |
454 // If the lists don't match return -1. On return, if hasBigRotation is true,
functions contain | 452 // If the lists don't match return -1. On return, if hasBigRotation is true,
functions contain |
455 // rotations of >= 180 degrees | 453 // rotations of >= 180 degrees |
456 static int validateTransformOperations(const KeyframeValueList&, bool& hasBi
gRotation); | 454 static int validateTransformOperations(const KeyframeValueList&, bool& hasBi
gRotation); |
457 | 455 |
458 // The layer being replicated. | |
459 GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; } | |
460 void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; } | 456 void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; } |
461 | 457 |
| 458 int incrementPaintCount() { return ++m_paintCount; } |
| 459 |
462 // Any factory classes that want to create a GraphicsLayer need to be friend
s. | 460 // Any factory classes that want to create a GraphicsLayer need to be friend
s. |
463 friend class WebKit::GraphicsLayerFactoryChromium; | 461 friend class WebKit::GraphicsLayerFactoryChromium; |
464 explicit GraphicsLayer(GraphicsLayerClient*); | 462 explicit GraphicsLayer(GraphicsLayerClient*); |
465 | 463 |
466 static void writeIndent(TextStream&, int indent); | 464 static void writeIndent(TextStream&, int indent); |
467 | 465 |
468 void dumpProperties(TextStream&, int indent, LayerTreeFlags) const; | 466 void dumpProperties(TextStream&, int indent, LayerTreeFlags) const; |
469 void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeFlags) c
onst { } | 467 void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeFlags) c
onst { } |
470 | 468 |
471 // Helper functions used by settors to keep layer's the state consistent. | 469 // Helper functions used by settors to keep layer's the state consistent. |
(...skipping 25 matching lines...) Expand all Loading... |
497 float m_zPosition; | 495 float m_zPosition; |
498 | 496 |
499 FilterOperations m_filters; | 497 FilterOperations m_filters; |
500 | 498 |
501 bool m_contentsOpaque : 1; | 499 bool m_contentsOpaque : 1; |
502 bool m_preserves3D: 1; | 500 bool m_preserves3D: 1; |
503 bool m_backfaceVisibility : 1; | 501 bool m_backfaceVisibility : 1; |
504 bool m_masksToBounds : 1; | 502 bool m_masksToBounds : 1; |
505 bool m_drawsContent : 1; | 503 bool m_drawsContent : 1; |
506 bool m_contentsVisible : 1; | 504 bool m_contentsVisible : 1; |
507 bool m_showRepaintCounter : 1; | |
508 | 505 |
509 GraphicsLayerPaintingPhase m_paintingPhase; | 506 GraphicsLayerPaintingPhase m_paintingPhase; |
510 CompositingCoordinatesOrientation m_contentsOrientation; // affects orientat
ion of layer contents | 507 CompositingCoordinatesOrientation m_contentsOrientation; // affects orientat
ion of layer contents |
511 | 508 |
512 Vector<GraphicsLayer*> m_children; | 509 Vector<GraphicsLayer*> m_children; |
513 GraphicsLayer* m_parent; | 510 GraphicsLayer* m_parent; |
514 | 511 |
515 GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this. | 512 GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this. |
516 | 513 |
517 GraphicsLayer* m_replicaLayer; // A layer that replicates this layer. We onl
y allow one, for now. | 514 GraphicsLayer* m_replicaLayer; // A layer that replicates this layer. We onl
y allow one, for now. |
518 // The replica is not parented; this is the p
rimary reference to it. | 515 // The replica is not parented; this is the p
rimary reference to it. |
519 GraphicsLayer* m_replicatedLayer; // For a replica layer, a reference to the
original layer. | 516 GraphicsLayer* m_replicatedLayer; // For a replica layer, a reference to the
original layer. |
520 FloatPoint m_replicatedLayerPosition; // For a replica layer, the position o
f the replica. | 517 FloatPoint m_replicatedLayerPosition; // For a replica layer, the position o
f the replica. |
521 | 518 |
522 IntRect m_contentsRect; | 519 IntRect m_contentsRect; |
523 | 520 |
524 int m_repaintCount; | 521 int m_paintCount; |
525 | 522 |
526 Color m_contentsSolidColor; | 523 Color m_contentsSolidColor; |
527 | 524 |
528 OwnPtr<WebKit::WebContentLayer> m_layer; | 525 OwnPtr<WebKit::WebContentLayer> m_layer; |
529 OwnPtr<WebKit::WebImageLayer> m_imageLayer; | 526 OwnPtr<WebKit::WebImageLayer> m_imageLayer; |
530 OwnPtr<WebKit::WebNinePatchLayer> m_ninePatchLayer; | 527 OwnPtr<WebKit::WebNinePatchLayer> m_ninePatchLayer; |
531 OwnPtr<WebKit::WebSolidColorLayer> m_contentsSolidColorLayer; | 528 OwnPtr<WebKit::WebSolidColorLayer> m_contentsSolidColorLayer; |
532 WebKit::WebLayer* m_contentsLayer; | 529 WebKit::WebLayer* m_contentsLayer; |
533 // We don't have ownership of m_contentsLayer, but we do want to know if a g
iven layer is the | 530 // We don't have ownership of m_contentsLayer, but we do want to know if a g
iven layer is the |
534 // same as our current layer in setContentsTo(). Since m_contentsLayer may b
e deleted at this point, | 531 // same as our current layer in setContentsTo(). Since m_contentsLayer may b
e deleted at this point, |
535 // we stash an ID away when we know m_contentsLayer is alive and use that fo
r comparisons from that point | 532 // we stash an ID away when we know m_contentsLayer is alive and use that fo
r comparisons from that point |
536 // on. | 533 // on. |
537 int m_contentsLayerId; | 534 int m_contentsLayerId; |
538 | 535 |
539 LinkHighlightClient* m_linkHighlight; | 536 LinkHighlightClient* m_linkHighlight; |
540 | 537 |
541 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa
yerDelegate; | 538 OwnPtr<OpaqueRectTrackingContentLayerDelegate> m_opaqueRectTrackingContentLa
yerDelegate; |
542 | 539 |
543 ContentsLayerPurpose m_contentsLayerPurpose; | 540 ContentsLayerPurpose m_contentsLayerPurpose; |
544 bool m_inSetChildren; | 541 bool m_inSetChildren; |
545 | 542 |
546 typedef HashMap<String, int> AnimationIdMap; | 543 typedef HashMap<String, int> AnimationIdMap; |
547 AnimationIdMap m_animationIdMap; | 544 AnimationIdMap m_animationIdMap; |
548 | 545 |
549 ScrollableArea* m_scrollableArea; | 546 ScrollableArea* m_scrollableArea; |
| 547 WebKit::WebCompositingReasons m_compositingReasons; |
550 }; | 548 }; |
551 | 549 |
552 | 550 |
553 } // namespace WebCore | 551 } // namespace WebCore |
554 | 552 |
555 #ifndef NDEBUG | 553 #ifndef NDEBUG |
556 // Outside the WebCore namespace for ease of invocation from gdb. | 554 // Outside the WebCore namespace for ease of invocation from gdb. |
557 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer); | 555 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer); |
558 #endif | 556 #endif |
559 | 557 |
560 #endif // GraphicsLayer_h | 558 #endif // GraphicsLayer_h |
OLD | NEW |