1/* 2 * Copyright (C) 2009, 2014 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#ifndef GraphicsLayer_h 27#define GraphicsLayer_h 28 29#include "Animation.h" 30#include "Color.h" 31#include "FloatPoint.h" 32#include "FloatPoint3D.h" 33#include "FloatRect.h" 34#include "FloatSize.h" 35#include "GraphicsLayerClient.h" 36#include "IntRect.h" 37#include "PlatformLayer.h" 38#include "TransformOperations.h" 39#include <wtf/OwnPtr.h> 40#include <wtf/PassOwnPtr.h> 41 42#if ENABLE(CSS_FILTERS) 43#include "FilterOperations.h" 44#endif 45 46#if ENABLE(CSS_COMPOSITING) 47#include "GraphicsTypes.h" 48#endif 49 50namespace WebCore { 51 52enum LayerTreeAsTextBehaviorFlags { 53 LayerTreeAsTextBehaviorNormal = 0, 54 LayerTreeAsTextDebug = 1 << 0, // Dump extra debugging info like layer addresses. 55 LayerTreeAsTextIncludeVisibleRects = 1 << 1, 56 LayerTreeAsTextIncludeTileCaches = 1 << 2, 57 LayerTreeAsTextIncludeRepaintRects = 1 << 3, 58 LayerTreeAsTextIncludePaintingPhases = 1 << 4, 59 LayerTreeAsTextIncludeContentLayers = 1 << 5 60}; 61typedef unsigned LayerTreeAsTextBehavior; 62 63class GraphicsContext; 64class GraphicsLayerFactory; 65class Image; 66class TextStream; 67class TiledBacking; 68class TimingFunction; 69class TransformationMatrix; 70 71// Base class for animation values (also used for transitions). Here to 72// represent values for properties being animated via the GraphicsLayer, 73// without pulling in style-related data from outside of the platform directory. 74// FIXME: Should be moved to its own header file. 75class AnimationValue { 76 WTF_MAKE_FAST_ALLOCATED; 77public: 78 virtual ~AnimationValue() { } 79 80 double keyTime() const { return m_keyTime; } 81 const TimingFunction* timingFunction() const { return m_timingFunction.get(); } 82 virtual PassOwnPtr<AnimationValue> clone() const = 0; 83 84protected: 85 AnimationValue(double keyTime, TimingFunction* timingFunction = nullptr) 86 : m_keyTime(keyTime) 87 , m_timingFunction(timingFunction) 88 { 89 } 90 91private: 92 double m_keyTime; 93 RefPtr<TimingFunction> m_timingFunction; 94}; 95 96// Used to store one float value of an animation. 97// FIXME: Should be moved to its own header file. 98class FloatAnimationValue : public AnimationValue { 99public: 100 static PassOwnPtr<FloatAnimationValue> create(double keyTime, float value, TimingFunction* timingFunction = nullptr) 101 { 102 return adoptPtr(new FloatAnimationValue(keyTime, value, timingFunction)); 103 } 104 105 virtual PassOwnPtr<AnimationValue> clone() const override 106 { 107 return adoptPtr(new FloatAnimationValue(*this)); 108 } 109 110 float value() const { return m_value; } 111 112private: 113 FloatAnimationValue(double keyTime, float value, TimingFunction* timingFunction) 114 : AnimationValue(keyTime, timingFunction) 115 , m_value(value) 116 { 117 } 118 119 float m_value; 120}; 121 122// Used to store one transform value in a keyframe list. 123// FIXME: Should be moved to its own header file. 124class TransformAnimationValue : public AnimationValue { 125public: 126 static PassOwnPtr<TransformAnimationValue> create(double keyTime, const TransformOperations& value, TimingFunction* timingFunction = nullptr) 127 { 128 return adoptPtr(new TransformAnimationValue(keyTime, value, timingFunction)); 129 } 130 131 virtual PassOwnPtr<AnimationValue> clone() const override 132 { 133 return adoptPtr(new TransformAnimationValue(*this)); 134 } 135 136 const TransformOperations& value() const { return m_value; } 137 138private: 139 TransformAnimationValue(double keyTime, const TransformOperations& value, TimingFunction* timingFunction) 140 : AnimationValue(keyTime, timingFunction) 141 , m_value(value) 142 { 143 } 144 145 TransformOperations m_value; 146}; 147 148#if ENABLE(CSS_FILTERS) 149// Used to store one filter value in a keyframe list. 150// FIXME: Should be moved to its own header file. 151class FilterAnimationValue : public AnimationValue { 152public: 153 static PassOwnPtr<FilterAnimationValue> create(double keyTime, const FilterOperations& value, TimingFunction* timingFunction = nullptr) 154 { 155 return adoptPtr(new FilterAnimationValue(keyTime, value, timingFunction)); 156 } 157 158 virtual PassOwnPtr<AnimationValue> clone() const override 159 { 160 return adoptPtr(new FilterAnimationValue(*this)); 161 } 162 163 const FilterOperations& value() const { return m_value; } 164 165private: 166 FilterAnimationValue(double keyTime, const FilterOperations& value, TimingFunction* timingFunction) 167 : AnimationValue(keyTime, timingFunction) 168 , m_value(value) 169 { 170 } 171 172 FilterOperations m_value; 173}; 174#endif 175 176// Used to store a series of values in a keyframe list. 177// Values will all be of the same type, which can be inferred from the property. 178// FIXME: Should be moved to its own header file. 179class KeyframeValueList { 180public: 181 explicit KeyframeValueList(AnimatedPropertyID property) 182 : m_property(property) 183 { 184 } 185 186 KeyframeValueList(const KeyframeValueList& other) 187 : m_property(other.property()) 188 { 189 for (size_t i = 0; i < other.m_values.size(); ++i) 190 m_values.append(other.m_values[i]->clone()); 191 } 192 193 ~KeyframeValueList() 194 { 195 } 196 197 KeyframeValueList& operator=(const KeyframeValueList& other) 198 { 199 KeyframeValueList copy(other); 200 swap(copy); 201 return *this; 202 } 203 204 void swap(KeyframeValueList& other) 205 { 206 std::swap(m_property, other.m_property); 207 m_values.swap(other.m_values); 208 } 209 210 AnimatedPropertyID property() const { return m_property; } 211 212 size_t size() const { return m_values.size(); } 213 const AnimationValue& at(size_t i) const { return *m_values.at(i); } 214 215 // Insert, sorted by keyTime. 216 void insert(PassOwnPtr<const AnimationValue>); 217 218protected: 219 Vector<OwnPtr<const AnimationValue>> m_values; 220 AnimatedPropertyID m_property; 221}; 222 223// GraphicsLayer is an abstraction for a rendering surface with backing store, 224// which may have associated transformation and animations. 225 226class GraphicsLayer { 227 WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED; 228public: 229 static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient&); 230 231 virtual ~GraphicsLayer(); 232 233 virtual void initialize() { } 234 235 typedef uint64_t PlatformLayerID; 236 virtual PlatformLayerID primaryLayerID() const { return 0; } 237 238 GraphicsLayerClient& client() const { return m_client; } 239 240 // Layer name. Only used to identify layers in debug output 241 const String& name() const { return m_name; } 242 virtual void setName(const String& name) { m_name = name; } 243 244 GraphicsLayer* parent() const { return m_parent; }; 245 void setParent(GraphicsLayer*); // Internal use only. 246 247 // Returns true if the layer has the given layer as an ancestor (excluding self). 248 bool hasAncestor(GraphicsLayer*) const; 249 250 const Vector<GraphicsLayer*>& children() const { return m_children; } 251 // Returns true if the child list changed. 252 virtual bool setChildren(const Vector<GraphicsLayer*>&); 253 254 // Add child layers. If the child is already parented, it will be removed from its old parent. 255 virtual void addChild(GraphicsLayer*); 256 virtual void addChildAtIndex(GraphicsLayer*, int index); 257 virtual void addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling); 258 virtual void addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling); 259 virtual bool replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild); 260 261 void removeAllChildren(); 262 virtual void removeFromParent(); 263 264 // The parent() of a maskLayer is set to the layer being masked. 265 GraphicsLayer* maskLayer() const { return m_maskLayer; } 266 virtual void setMaskLayer(GraphicsLayer*); 267 268 void setIsMaskLayer(bool isMask) { m_isMaskLayer = isMask; } 269 bool isMaskLayer() const { return m_isMaskLayer; } 270 271 // The given layer will replicate this layer and its children; the replica renders behind this layer. 272 virtual void setReplicatedByLayer(GraphicsLayer*); 273 // Whether this layer is being replicated by another layer. 274 bool isReplicated() const { return m_replicaLayer; } 275 // The layer that replicates this layer (if any). 276 GraphicsLayer* replicaLayer() const { return m_replicaLayer; } 277 278 const FloatPoint& replicatedLayerPosition() const { return m_replicatedLayerPosition; } 279 void setReplicatedLayerPosition(const FloatPoint& p) { m_replicatedLayerPosition = p; } 280 281 enum ShouldSetNeedsDisplay { 282 DontSetNeedsDisplay, 283 SetNeedsDisplay 284 }; 285 286 // Offset is origin of the renderer minus origin of the graphics layer. 287 FloatSize offsetFromRenderer() const { return m_offsetFromRenderer; } 288 void setOffsetFromRenderer(const FloatSize&, ShouldSetNeedsDisplay = SetNeedsDisplay); 289 290 // The position of the layer (the location of its top-left corner in its parent) 291 const FloatPoint& position() const { return m_position; } 292 virtual void setPosition(const FloatPoint& p) { m_position = p; } 293 294 // For platforms that move underlying platform layers on a different thread for scrolling; just update the GraphicsLayer state. 295 virtual void syncPosition(const FloatPoint& p) { m_position = p; } 296 297 // Anchor point: (0, 0) is top left, (1, 1) is bottom right. The anchor point 298 // affects the origin of the transforms. 299 const FloatPoint3D& anchorPoint() const { return m_anchorPoint; } 300 virtual void setAnchorPoint(const FloatPoint3D& p) { m_anchorPoint = p; } 301 302 // The size of the layer. 303 const FloatSize& size() const { return m_size; } 304 virtual void setSize(const FloatSize&); 305 306 // The boundOrigin affects the offset at which content is rendered, and sublayers are positioned. 307 const FloatPoint& boundsOrigin() const { return m_boundsOrigin; } 308 virtual void setBoundsOrigin(const FloatPoint& origin) { m_boundsOrigin = origin; } 309 310 // For platforms that move underlying platform layers on a different thread for scrolling; just update the GraphicsLayer state. 311 virtual void syncBoundsOrigin(const FloatPoint& origin) { m_boundsOrigin = origin; } 312 313 const TransformationMatrix& transform() const { return m_transform; } 314 virtual void setTransform(const TransformationMatrix& t) { m_transform = t; } 315 316 const TransformationMatrix& childrenTransform() const { return m_childrenTransform; } 317 virtual void setChildrenTransform(const TransformationMatrix& t) { m_childrenTransform = t; } 318 319 bool preserves3D() const { return m_preserves3D; } 320 virtual void setPreserves3D(bool b) { m_preserves3D = b; } 321 322 bool masksToBounds() const { return m_masksToBounds; } 323 virtual void setMasksToBounds(bool b) { m_masksToBounds = b; } 324 325 bool drawsContent() const { return m_drawsContent; } 326 virtual void setDrawsContent(bool b) { m_drawsContent = b; } 327 328 bool contentsAreVisible() const { return m_contentsVisible; } 329 virtual void setContentsVisible(bool b) { m_contentsVisible = b; } 330 331 bool acceleratesDrawing() const { return m_acceleratesDrawing; } 332 virtual void setAcceleratesDrawing(bool b) { m_acceleratesDrawing = b; } 333 334 // The color used to paint the layer background. Pass an invalid color to remove it. 335 // Note that this covers the entire layer. Use setContentsToSolidColor() if the color should 336 // only cover the contentsRect. 337 const Color& backgroundColor() const { return m_backgroundColor; } 338 virtual void setBackgroundColor(const Color&); 339 340 // opaque means that we know the layer contents have no alpha 341 bool contentsOpaque() const { return m_contentsOpaque; } 342 virtual void setContentsOpaque(bool b) { m_contentsOpaque = b; } 343 344 bool backfaceVisibility() const { return m_backfaceVisibility; } 345 virtual void setBackfaceVisibility(bool b) { m_backfaceVisibility = b; } 346 347 float opacity() const { return m_opacity; } 348 virtual void setOpacity(float opacity) { m_opacity = opacity; } 349 350#if ENABLE(CSS_FILTERS) 351 const FilterOperations& filters() const { return m_filters; } 352 353 // Returns true if filter can be rendered by the compositor 354 virtual bool setFilters(const FilterOperations& filters) { m_filters = filters; return true; } 355#endif 356 357#if ENABLE(CSS_COMPOSITING) 358 BlendMode blendMode() const { return m_blendMode; } 359 virtual void setBlendMode(BlendMode blendMode) { m_blendMode = blendMode; } 360#endif 361 362 // Some GraphicsLayers paint only the foreground or the background content 363 GraphicsLayerPaintingPhase paintingPhase() const { return m_paintingPhase; } 364 void setPaintingPhase(GraphicsLayerPaintingPhase phase) { m_paintingPhase = phase; } 365 366 enum ShouldClipToLayer { 367 DoNotClipToLayer, 368 ClipToLayer 369 }; 370 371 virtual void setNeedsDisplay() = 0; 372 // mark the given rect (in layer coords) as needing dispay. Never goes deep. 373 virtual void setNeedsDisplayInRect(const FloatRect&, ShouldClipToLayer = ClipToLayer) = 0; 374 375 virtual void setContentsNeedsDisplay() { }; 376 377 // The tile phase is relative to the GraphicsLayer bounds. 378 virtual void setContentsTilePhase(const FloatPoint& p) { m_contentsTilePhase = p; } 379 FloatPoint contentsTilePhase() const { return m_contentsTilePhase; } 380 381 virtual void setContentsTileSize(const FloatSize& s) { m_contentsTileSize = s; } 382 FloatSize contentsTileSize() const { return m_contentsTileSize; } 383 bool hasContentsTiling() const { return !m_contentsTileSize.isEmpty(); } 384 385 // Set that the position/size of the contents (image or video). 386 FloatRect contentsRect() const { return m_contentsRect; } 387 virtual void setContentsRect(const FloatRect& r) { m_contentsRect = r; } 388 389 FloatRect contentsClippingRect() const { return m_contentsClippingRect; } 390 virtual void setContentsClippingRect(const FloatRect& r) { m_contentsClippingRect = r; } 391 392 // Transitions are identified by a special animation name that cannot clash with a keyframe identifier. 393 static String animationNameForTransition(AnimatedPropertyID); 394 395 // Return true if the animation is handled by the compositing system. If this returns 396 // false, the animation will be run by AnimationController. 397 // These methods handle both transitions and keyframe animations. 398 virtual bool addAnimation(const KeyframeValueList&, const FloatSize& /*boxSize*/, const Animation*, const String& /*animationName*/, double /*timeOffset*/) { return false; } 399 virtual void pauseAnimation(const String& /*animationName*/, double /*timeOffset*/) { } 400 virtual void removeAnimation(const String& /*animationName*/) { } 401 402 virtual void suspendAnimations(double time); 403 virtual void resumeAnimations(); 404 405 // Layer contents 406 virtual void setContentsToImage(Image*) { } 407 virtual bool shouldDirectlyCompositeImage(Image*) const { return true; } 408 virtual void setContentsToMedia(PlatformLayer*) { } // video or plug-in 409#if PLATFORM(IOS) 410 virtual PlatformLayer* contentsLayerForMedia() const { return 0; } 411#endif 412 // Pass an invalid color to remove the contents layer. 413 virtual void setContentsToSolidColor(const Color&) { } 414 virtual void setContentsToCanvas(PlatformLayer*) { } 415 // FIXME: webkit.org/b/109658 416 // Should unify setContentsToMedia and setContentsToCanvas 417 virtual void setContentsToPlatformLayer(PlatformLayer* layer) { setContentsToMedia(layer); } 418 virtual bool usesContentsLayer() const { return false; } 419 420 // Callback from the underlying graphics system to draw layer contents. 421 void paintGraphicsLayerContents(GraphicsContext&, const FloatRect& clip); 422 423 // For hosting this GraphicsLayer in a native layer hierarchy. 424 virtual PlatformLayer* platformLayer() const { return 0; } 425 426 enum CompositingCoordinatesOrientation { CompositingCoordinatesTopDown, CompositingCoordinatesBottomUp }; 427 428 // Flippedness of the contents of this layer. Does not affect sublayer geometry. 429 virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation) { m_contentsOrientation = orientation; } 430 CompositingCoordinatesOrientation contentsOrientation() const { return m_contentsOrientation; } 431 432 void dumpLayer(TextStream&, int indent = 0, LayerTreeAsTextBehavior = LayerTreeAsTextBehaviorNormal) const; 433 434 virtual void setShowDebugBorder(bool show) { m_showDebugBorder = show; } 435 bool isShowingDebugBorder() const { return m_showDebugBorder; } 436 437 virtual void setShowRepaintCounter(bool show) { m_showRepaintCounter = show; } 438 bool isShowingRepaintCounter() const { return m_showRepaintCounter; } 439 440 // FIXME: this is really a paint count. 441 int repaintCount() const { return m_repaintCount; } 442 int incrementRepaintCount() { return ++m_repaintCount; } 443 444 virtual void setDebugBackgroundColor(const Color&) { } 445 virtual void setDebugBorder(const Color&, float /*borderWidth*/) { } 446 447 enum CustomAppearance { NoCustomAppearance, ScrollingOverhang, ScrollingShadow }; 448 virtual void setCustomAppearance(CustomAppearance customAppearance) { m_customAppearance = customAppearance; } 449 CustomAppearance customAppearance() const { return m_customAppearance; } 450 451 enum CustomBehavior { NoCustomBehavior, CustomScrollingBehavior, CustomScrolledContentsBehavior }; 452 virtual void setCustomBehavior(CustomBehavior customBehavior) { m_customBehavior = customBehavior; } 453 CustomBehavior customBehavior() const { return m_customBehavior; } 454 455 // z-position is the z-equivalent of position(). It's only used for debugging purposes. 456 virtual float zPosition() const { return m_zPosition; } 457 virtual void setZPosition(float); 458 459 virtual void distributeOpacity(float); 460 virtual float accumulatedOpacity() const; 461 462#if PLATFORM(IOS) 463 bool hasFlattenedPerspectiveTransform() const { return !preserves3D() && m_childrenTransform.hasPerspective(); } 464#endif 465 virtual FloatSize pixelAlignmentOffset() const { return FloatSize(); } 466 467 virtual void setAppliesPageScale(bool appliesScale = true) { m_appliesPageScale = appliesScale; } 468 virtual bool appliesPageScale() const { return m_appliesPageScale; } 469 470 float pageScaleFactor() const { return m_client.pageScaleFactor(); } 471 float deviceScaleFactor() const { return m_client.deviceScaleFactor(); } 472 473 virtual void deviceOrPageScaleFactorChanged() { } 474 void noteDeviceOrPageScaleFactorChangedIncludingDescendants(); 475 476 // Some compositing systems may do internal batching to synchronize compositing updates 477 // with updates drawn into the window. These methods flush internal batched state on this layer 478 // and descendant layers, and this layer only. 479 virtual void flushCompositingState(const FloatRect& /* clipRect */) { } 480 virtual void flushCompositingStateForThisLayerOnly() { } 481 482 // If the exposed rect of this layer changes, returns true if this or descendant layers need a flush, 483 // for example to allocate new tiles. 484 virtual bool visibleRectChangeRequiresFlush(const FloatRect& /* clipRect */) const { return false; } 485 486 // Return a string with a human readable form of the layer tree, If debug is true 487 // pointers for the layers and timing data will be included in the returned string. 488 String layerTreeAsText(LayerTreeAsTextBehavior = LayerTreeAsTextBehaviorNormal) const; 489 490 // Return an estimate of the backing store memory cost (in bytes). May be incorrect for tiled layers. 491 virtual double backingStoreMemoryEstimate() const; 492 493 bool usingTiledBacking() const { return m_usingTiledBacking; } 494 virtual TiledBacking* tiledBacking() const { return 0; } 495 496 void resetTrackedRepaints(); 497 void addRepaintRect(const FloatRect&); 498 499 static bool supportsBackgroundColorContent() 500 { 501#if USE(CA) || USE(TEXTURE_MAPPER) 502 return true; 503#else 504 return false; 505#endif 506 } 507 508#if USE(COORDINATED_GRAPHICS) 509 static bool supportsContentsTiling(); 510#else 511 static bool supportsContentsTiling() 512 { 513 // FIXME: Enable the feature on different ports. 514 return false; 515 } 516#endif 517 518 void updateDebugIndicators(); 519 520 virtual bool canThrottleLayerFlush() const { return false; } 521 522 virtual bool isGraphicsLayerCA() const { return false; } 523 virtual bool isGraphicsLayerCARemote() const { return false; } 524 525protected: 526 // Should be called from derived class destructors. Should call willBeDestroyed() on super. 527 virtual void willBeDestroyed(); 528 529#if ENABLE(CSS_FILTERS) 530 // This method is used by platform GraphicsLayer classes to clear the filters 531 // when compositing is not done in hardware. It is not virtual, so the caller 532 // needs to notifiy the change to the platform layer as needed. 533 void clearFilters() { m_filters.clear(); } 534 535 // Given a KeyframeValueList containing filterOperations, return true if the operations are valid. 536 static int validateFilterOperations(const KeyframeValueList&); 537#endif 538 539 // Given a list of TransformAnimationValues, see if all the operations for each keyframe match. If so 540 // return the index of the KeyframeValueList entry that has that list of operations (it may not be 541 // the first entry because some keyframes might have an empty transform and those match any list). 542 // If the lists don't match return -1. On return, if hasBigRotation is true, functions contain 543 // rotations of >= 180 degrees 544 static int validateTransformOperations(const KeyframeValueList&, bool& hasBigRotation); 545 546 virtual bool shouldRepaintOnSizeChange() const { return drawsContent(); } 547 548 virtual void setOpacityInternal(float) { } 549 550 // The layer being replicated. 551 GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; } 552 virtual void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; } 553 554 explicit GraphicsLayer(GraphicsLayerClient&); 555 556 void dumpProperties(TextStream&, int indent, LayerTreeAsTextBehavior) const; 557 virtual void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeAsTextBehavior) const { } 558 559 virtual void getDebugBorderInfo(Color&, float& width) const; 560 561 GraphicsLayerClient& m_client; 562 String m_name; 563 564 // Offset from the owning renderer 565 FloatSize m_offsetFromRenderer; 566 567 // Position is relative to the parent GraphicsLayer 568 FloatPoint m_position; 569 FloatPoint3D m_anchorPoint; 570 FloatSize m_size; 571 FloatPoint m_boundsOrigin; 572 573 TransformationMatrix m_transform; 574 TransformationMatrix m_childrenTransform; 575 576 Color m_backgroundColor; 577 float m_opacity; 578 float m_zPosition; 579 580#if ENABLE(CSS_FILTERS) 581 FilterOperations m_filters; 582#endif 583 584#if ENABLE(CSS_COMPOSITING) 585 BlendMode m_blendMode; 586#endif 587 588 bool m_contentsOpaque : 1; 589 bool m_preserves3D: 1; 590 bool m_backfaceVisibility : 1; 591 bool m_usingTiledBacking : 1; 592 bool m_masksToBounds : 1; 593 bool m_drawsContent : 1; 594 bool m_contentsVisible : 1; 595 bool m_acceleratesDrawing : 1; 596 bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it. 597 bool m_showDebugBorder : 1; 598 bool m_showRepaintCounter : 1; 599 bool m_isMaskLayer : 1; 600 601 GraphicsLayerPaintingPhase m_paintingPhase; 602 CompositingCoordinatesOrientation m_contentsOrientation; // affects orientation of layer contents 603 604 Vector<GraphicsLayer*> m_children; 605 GraphicsLayer* m_parent; 606 607 GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this. 608 609 GraphicsLayer* m_replicaLayer; // A layer that replicates this layer. We only allow one, for now. 610 // The replica is not parented; this is the primary reference to it. 611 GraphicsLayer* m_replicatedLayer; // For a replica layer, a reference to the original layer. 612 FloatPoint m_replicatedLayerPosition; // For a replica layer, the position of the replica. 613 614 FloatRect m_contentsRect; 615 FloatRect m_contentsClippingRect; 616 FloatPoint m_contentsTilePhase; 617 FloatSize m_contentsTileSize; 618 619 int m_repaintCount; 620 CustomAppearance m_customAppearance; 621 CustomBehavior m_customBehavior; 622}; 623 624#define GRAPHICSLAYER_TYPE_CASTS(ToValueTypeName, predicate) \ 625 TYPE_CASTS_BASE(ToValueTypeName, WebCore::GraphicsLayer, value, value->predicate, value.predicate) 626 627} // namespace WebCore 628 629#ifndef NDEBUG 630// Outside the WebCore namespace for ease of invocation from gdb. 631void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer); 632#endif 633 634#endif // GraphicsLayer_h 635