Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 void setSquashingDisallowedReasons(SquashingDisallowedReasons); | 92 void setSquashingDisallowedReasons(SquashingDisallowedReasons); |
| 93 void setOwnerNodeId(int); | 93 void setOwnerNodeId(int); |
| 94 | 94 |
| 95 GraphicsLayer* parent() const { return m_parent; } | 95 GraphicsLayer* parent() const { return m_parent; } |
| 96 void setParent(GraphicsLayer*); // Internal use only. | 96 void setParent(GraphicsLayer*); // Internal use only. |
| 97 | 97 |
| 98 const Vector<GraphicsLayer*>& children() const { return m_children; } | 98 const Vector<GraphicsLayer*>& children() const { return m_children; } |
| 99 // Returns true if the child list changed. | 99 // Returns true if the child list changed. |
| 100 bool setChildren(const GraphicsLayerVector&); | 100 bool setChildren(const GraphicsLayerVector&); |
| 101 | 101 |
| 102 // Add child layers. If the child is already parented, it will be removed from its old parent. | 102 // Add child layers. If the child is already parented, it will be removed from |
| 103 // its old parent. | |
| 103 void addChild(GraphicsLayer*); | 104 void addChild(GraphicsLayer*); |
| 104 void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling); | 105 void addChildBelow(GraphicsLayer*, GraphicsLayer* sibling); |
| 105 | 106 |
| 106 void removeAllChildren(); | 107 void removeAllChildren(); |
| 107 void removeFromParent(); | 108 void removeFromParent(); |
| 108 | 109 |
| 109 GraphicsLayer* maskLayer() const { return m_maskLayer; } | 110 GraphicsLayer* maskLayer() const { return m_maskLayer; } |
| 110 void setMaskLayer(GraphicsLayer*); | 111 void setMaskLayer(GraphicsLayer*); |
| 111 | 112 |
| 112 GraphicsLayer* contentsClippingMaskLayer() const { | 113 GraphicsLayer* contentsClippingMaskLayer() const { |
| 113 return m_contentsClippingMaskLayer; | 114 return m_contentsClippingMaskLayer; |
| 114 } | 115 } |
| 115 void setContentsClippingMaskLayer(GraphicsLayer*); | 116 void setContentsClippingMaskLayer(GraphicsLayer*); |
| 116 | 117 |
| 117 enum ShouldSetNeedsDisplay { DontSetNeedsDisplay, SetNeedsDisplay }; | 118 enum ShouldSetNeedsDisplay { DontSetNeedsDisplay, SetNeedsDisplay }; |
| 118 | 119 |
| 119 // Offset is origin of the layoutObject minus origin of the graphics layer (so either zero or negative). | 120 // The offset is the origin of the layoutObject minus the origin of the |
| 121 // graphics layer (so either zero or negative). | |
| 120 IntSize offsetFromLayoutObject() const { | 122 IntSize offsetFromLayoutObject() const { |
| 121 return flooredIntSize(m_offsetFromLayoutObject); | 123 return flooredIntSize(m_offsetFromLayoutObject); |
| 122 } | 124 } |
| 123 void setOffsetFromLayoutObject(const IntSize&, | 125 void setOffsetFromLayoutObject(const IntSize&, |
| 124 ShouldSetNeedsDisplay = SetNeedsDisplay); | 126 ShouldSetNeedsDisplay = SetNeedsDisplay); |
| 125 LayoutSize offsetFromLayoutObjectWithSubpixelAccumulation() const; | 127 LayoutSize offsetFromLayoutObjectWithSubpixelAccumulation() const; |
| 126 | 128 |
| 127 // The double version is only used in |updateScrollingLayerGeometry()| for det ecting | 129 // The double version is only used in |updateScrollingLayerGeometry()| for |
|
Stephen White
2016/10/05 14:45:37
Nit: not new to this patch, but this seems to be o
Peter Kasting
2016/10/05 18:46:02
Yeah, those shouldn't be there. Removed.
| |
| 128 // scroll offset change at floating point precision. | 130 // detecting a scroll offset change at floating point precision. |
| 129 DoubleSize offsetDoubleFromLayoutObject() const { | 131 DoubleSize offsetDoubleFromLayoutObject() const { |
| 130 return m_offsetFromLayoutObject; | 132 return m_offsetFromLayoutObject; |
| 131 } | 133 } |
| 132 void setOffsetDoubleFromLayoutObject(const DoubleSize&, | 134 void setOffsetDoubleFromLayoutObject(const DoubleSize&, |
| 133 ShouldSetNeedsDisplay = SetNeedsDisplay); | 135 ShouldSetNeedsDisplay = SetNeedsDisplay); |
| 134 | 136 |
| 135 // The position of the layer (the location of its top-left corner in its paren t) | 137 // The position of the layer (the location of its top-left corner in its |
| 138 // parent). | |
| 136 const FloatPoint& position() const { return m_position; } | 139 const FloatPoint& position() const { return m_position; } |
| 137 void setPosition(const FloatPoint&); | 140 void setPosition(const FloatPoint&); |
| 138 | 141 |
| 139 const FloatPoint3D& transformOrigin() const { return m_transformOrigin; } | 142 const FloatPoint3D& transformOrigin() const { return m_transformOrigin; } |
| 140 void setTransformOrigin(const FloatPoint3D&); | 143 void setTransformOrigin(const FloatPoint3D&); |
| 141 | 144 |
| 142 // The size of the layer. | 145 // The size of the layer. |
| 143 const FloatSize& size() const { return m_size; } | 146 const FloatSize& size() const { return m_size; } |
| 144 void setSize(const FloatSize&); | 147 void setSize(const FloatSize&); |
| 145 | 148 |
| 146 const TransformationMatrix& transform() const { return m_transform; } | 149 const TransformationMatrix& transform() const { return m_transform; } |
| 147 void setTransform(const TransformationMatrix&); | 150 void setTransform(const TransformationMatrix&); |
| 148 void setShouldFlattenTransform(bool); | 151 void setShouldFlattenTransform(bool); |
| 149 void setRenderingContext(int id); | 152 void setRenderingContext(int id); |
| 150 | 153 |
| 151 bool masksToBounds() const; | 154 bool masksToBounds() const; |
| 152 void setMasksToBounds(bool); | 155 void setMasksToBounds(bool); |
| 153 | 156 |
| 154 bool drawsContent() const { return m_drawsContent; } | 157 bool drawsContent() const { return m_drawsContent; } |
| 155 void setDrawsContent(bool); | 158 void setDrawsContent(bool); |
| 156 | 159 |
| 157 bool contentsAreVisible() const { return m_contentsVisible; } | 160 bool contentsAreVisible() const { return m_contentsVisible; } |
| 158 void setContentsVisible(bool); | 161 void setContentsVisible(bool); |
| 159 | 162 |
| 160 void setScrollParent(WebLayer*); | 163 void setScrollParent(WebLayer*); |
| 161 void setClipParent(WebLayer*); | 164 void setClipParent(WebLayer*); |
| 162 | 165 |
| 163 // For special cases, e.g. drawing missing tiles on Android. | 166 // For special cases, e.g. drawing missing tiles on Android. |
| 164 // The compositor should never paint this color in normal cases because the La yer | 167 // The compositor should never paint this color in normal cases because the |
| 165 // will paint background by itself. | 168 // Layer will paint the background by itself. |
| 166 void setBackgroundColor(const Color&); | 169 void setBackgroundColor(const Color&); |
| 167 | 170 |
| 168 // opaque means that we know the layer contents have no alpha | 171 // opaque means that we know the layer contents have no alpha |
| 169 bool contentsOpaque() const { return m_contentsOpaque; } | 172 bool contentsOpaque() const { return m_contentsOpaque; } |
| 170 void setContentsOpaque(bool); | 173 void setContentsOpaque(bool); |
| 171 | 174 |
| 172 bool backfaceVisibility() const { return m_backfaceVisibility; } | 175 bool backfaceVisibility() const { return m_backfaceVisibility; } |
| 173 void setBackfaceVisibility(bool visible); | 176 void setBackfaceVisibility(bool visible); |
| 174 | 177 |
| 175 float opacity() const { return m_opacity; } | 178 float opacity() const { return m_opacity; } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 205 Image*, | 208 Image*, |
| 206 RespectImageOrientationEnum = DoNotRespectImageOrientation); | 209 RespectImageOrientationEnum = DoNotRespectImageOrientation); |
| 207 void setContentsToPlatformLayer(WebLayer* layer) { setContentsTo(layer); } | 210 void setContentsToPlatformLayer(WebLayer* layer) { setContentsTo(layer); } |
| 208 bool hasContentsLayer() const { return m_contentsLayer; } | 211 bool hasContentsLayer() const { return m_contentsLayer; } |
| 209 | 212 |
| 210 // For hosting this GraphicsLayer in a native layer hierarchy. | 213 // For hosting this GraphicsLayer in a native layer hierarchy. |
| 211 WebLayer* platformLayer() const; | 214 WebLayer* platformLayer() const; |
| 212 | 215 |
| 213 int paintCount() const { return m_paintCount; } | 216 int paintCount() const { return m_paintCount; } |
| 214 | 217 |
| 215 // Return a string with a human readable form of the layer tree, If debug is t rue | 218 // Return a string with a human readable form of the layer tree. If debug is |
| 216 // pointers for the layers and timing data will be included in the returned st ring. | 219 // true, pointers for the layers and timing data will be included in the |
| 220 // returned string. | |
| 217 String layerTreeAsText(LayerTreeFlags = LayerTreeNormal) const; | 221 String layerTreeAsText(LayerTreeFlags = LayerTreeNormal) const; |
| 218 | 222 |
| 219 std::unique_ptr<JSONObject> layerTreeAsJSON(LayerTreeFlags) const; | 223 std::unique_ptr<JSONObject> layerTreeAsJSON(LayerTreeFlags) const; |
| 220 | 224 |
| 221 void setTracksRasterInvalidations(bool); | 225 void setTracksRasterInvalidations(bool); |
| 222 bool isTrackingOrCheckingRasterInvalidations() const { | 226 bool isTrackingOrCheckingRasterInvalidations() const { |
| 223 return RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() || | 227 return RuntimeEnabledFeatures::paintUnderInvalidationCheckingEnabled() || |
| 224 m_isTrackingRasterInvalidations; | 228 m_isTrackingRasterInvalidations; |
| 225 } | 229 } |
| 226 | 230 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 bool m_painted : 1; | 360 bool m_painted : 1; |
| 357 | 361 |
| 358 bool m_isTrackingRasterInvalidations : 1; | 362 bool m_isTrackingRasterInvalidations : 1; |
| 359 | 363 |
| 360 GraphicsLayerPaintingPhase m_paintingPhase; | 364 GraphicsLayerPaintingPhase m_paintingPhase; |
| 361 | 365 |
| 362 Vector<GraphicsLayer*> m_children; | 366 Vector<GraphicsLayer*> m_children; |
| 363 GraphicsLayer* m_parent; | 367 GraphicsLayer* m_parent; |
| 364 | 368 |
| 365 GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this. | 369 GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this. |
| 366 GraphicsLayer* | 370 GraphicsLayer* m_contentsClippingMaskLayer; // Reference to clipping mask |
| 367 m_contentsClippingMaskLayer; // Reference to clipping mask layer. We don' t own this. | 371 // layer. We don't own this. |
| 368 | 372 |
| 369 IntRect m_contentsRect; | 373 IntRect m_contentsRect; |
| 370 | 374 |
| 371 int m_paintCount; | 375 int m_paintCount; |
| 372 | 376 |
| 373 std::unique_ptr<WebContentLayer> m_layer; | 377 std::unique_ptr<WebContentLayer> m_layer; |
| 374 std::unique_ptr<WebImageLayer> m_imageLayer; | 378 std::unique_ptr<WebImageLayer> m_imageLayer; |
| 375 WebLayer* m_contentsLayer; | 379 WebLayer* m_contentsLayer; |
| 376 // We don't have ownership of m_contentsLayer, but we do want to know if a giv en layer is the | 380 // We don't have ownership of m_contentsLayer, but we do want to know if a |
| 377 // same as our current layer in setContentsTo(). Since m_contentsLayer may be deleted at this point, | 381 // given layer is the same as our current layer in setContentsTo(). Since |
| 378 // we stash an ID away when we know m_contentsLayer is alive and use that for comparisons from that point | 382 // |m_contentsLayer| may be deleted at this point, we stash an ID away when we |
| 379 // on. | 383 // know |m_contentsLayer| is alive and use that for comparisons from that |
| 384 // point on. | |
| 380 int m_contentsLayerId; | 385 int m_contentsLayerId; |
| 381 | 386 |
| 382 Vector<LinkHighlight*> m_linkHighlights; | 387 Vector<LinkHighlight*> m_linkHighlights; |
| 383 | 388 |
| 384 std::unique_ptr<ContentLayerDelegate> m_contentLayerDelegate; | 389 std::unique_ptr<ContentLayerDelegate> m_contentLayerDelegate; |
| 385 | 390 |
| 386 WeakPersistent<ScrollableArea> m_scrollableArea; | 391 WeakPersistent<ScrollableArea> m_scrollableArea; |
| 387 GraphicsLayerDebugInfo m_debugInfo; | 392 GraphicsLayerDebugInfo m_debugInfo; |
| 388 int m_renderingContext3d; | 393 int m_renderingContext3d; |
| 389 | 394 |
| 390 std::unique_ptr<PaintController> m_paintController; | 395 std::unique_ptr<PaintController> m_paintController; |
| 391 | 396 |
| 392 IntRect m_previousInterestRect; | 397 IntRect m_previousInterestRect; |
| 393 }; | 398 }; |
| 394 | 399 |
| 395 } // namespace blink | 400 } // namespace blink |
| 396 | 401 |
| 397 #ifndef NDEBUG | 402 #ifndef NDEBUG |
| 398 // Outside the blink namespace for ease of invocation from gdb. | 403 // Outside the blink namespace for ease of invocation from gdb. |
| 399 void PLATFORM_EXPORT showGraphicsLayerTree(const blink::GraphicsLayer*); | 404 void PLATFORM_EXPORT showGraphicsLayerTree(const blink::GraphicsLayer*); |
| 400 #endif | 405 #endif |
| 401 | 406 |
| 402 #endif // GraphicsLayer_h | 407 #endif // GraphicsLayer_h |
| OLD | NEW |