OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2014 Google Inc. All rights reserved. | 3 * Copyright (C) 2014 Google Inc. 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 11 matching lines...) Expand all Loading... |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/layout/compositing/GraphicsLayerUpdater.h" | 28 #include "core/layout/compositing/GraphicsLayerUpdater.h" |
29 | 29 |
30 #include "core/html/HTMLMediaElement.h" | 30 #include "core/html/HTMLMediaElement.h" |
31 #include "core/inspector/InspectorTraceEvents.h" | 31 #include "core/inspector/InspectorTraceEvents.h" |
| 32 #include "core/layout/Layer.h" |
| 33 #include "core/layout/LayerReflectionInfo.h" |
32 #include "core/layout/compositing/CompositedLayerMapping.h" | 34 #include "core/layout/compositing/CompositedLayerMapping.h" |
33 #include "core/layout/compositing/RenderLayerCompositor.h" | 35 #include "core/layout/compositing/LayerCompositor.h" |
34 #include "core/rendering/RenderLayer.h" | |
35 #include "core/rendering/RenderLayerReflectionInfo.h" | |
36 #include "platform/TraceEvent.h" | 36 #include "platform/TraceEvent.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class GraphicsLayerUpdater::UpdateContext { | 40 class GraphicsLayerUpdater::UpdateContext { |
41 public: | 41 public: |
42 UpdateContext() | 42 UpdateContext() |
43 : m_compositingStackingContext(0) | 43 : m_compositingStackingContext(0) |
44 , m_compositingAncestor(0) | 44 , m_compositingAncestor(0) |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 UpdateContext(const UpdateContext& other, const RenderLayer& layer) | 48 UpdateContext(const UpdateContext& other, const Layer& layer) |
49 : m_compositingStackingContext(other.m_compositingStackingContext) | 49 : m_compositingStackingContext(other.m_compositingStackingContext) |
50 , m_compositingAncestor(other.compositingContainer(layer)) | 50 , m_compositingAncestor(other.compositingContainer(layer)) |
51 { | 51 { |
52 CompositingState compositingState = layer.compositingState(); | 52 CompositingState compositingState = layer.compositingState(); |
53 if (compositingState != NotComposited && compositingState != PaintsIntoG
roupedBacking) { | 53 if (compositingState != NotComposited && compositingState != PaintsIntoG
roupedBacking) { |
54 m_compositingAncestor = &layer; | 54 m_compositingAncestor = &layer; |
55 if (layer.stackingNode()->isStackingContext()) | 55 if (layer.stackingNode()->isStackingContext()) |
56 m_compositingStackingContext = &layer; | 56 m_compositingStackingContext = &layer; |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 const RenderLayer* compositingContainer(const RenderLayer& layer) const | 60 const Layer* compositingContainer(const Layer& layer) const |
61 { | 61 { |
62 return layer.stackingNode()->isNormalFlowOnly() ? m_compositingAncestor
: m_compositingStackingContext; | 62 return layer.stackingNode()->isNormalFlowOnly() ? m_compositingAncestor
: m_compositingStackingContext; |
63 } | 63 } |
64 | 64 |
65 const RenderLayer* compositingStackingContext() const | 65 const Layer* compositingStackingContext() const |
66 { | 66 { |
67 return m_compositingStackingContext; | 67 return m_compositingStackingContext; |
68 } | 68 } |
69 | 69 |
70 private: | 70 private: |
71 const RenderLayer* m_compositingStackingContext; | 71 const Layer* m_compositingStackingContext; |
72 const RenderLayer* m_compositingAncestor; | 72 const Layer* m_compositingAncestor; |
73 }; | 73 }; |
74 | 74 |
75 GraphicsLayerUpdater::GraphicsLayerUpdater() | 75 GraphicsLayerUpdater::GraphicsLayerUpdater() |
76 : m_needsRebuildTree(false) | 76 : m_needsRebuildTree(false) |
77 { | 77 { |
78 } | 78 } |
79 | 79 |
80 GraphicsLayerUpdater::~GraphicsLayerUpdater() | 80 GraphicsLayerUpdater::~GraphicsLayerUpdater() |
81 { | 81 { |
82 } | 82 } |
83 | 83 |
84 void GraphicsLayerUpdater::update(RenderLayer& layer, Vector<RenderLayer*>& laye
rsNeedingPaintInvalidation) | 84 void GraphicsLayerUpdater::update(Layer& layer, Vector<Layer*>& layersNeedingPai
ntInvalidation) |
85 { | 85 { |
86 TRACE_EVENT0("blink", "GraphicsLayerUpdater::update"); | 86 TRACE_EVENT0("blink", "GraphicsLayerUpdater::update"); |
87 updateRecursive(layer, DoNotForceUpdate, UpdateContext(), layersNeedingPaint
Invalidation); | 87 updateRecursive(layer, DoNotForceUpdate, UpdateContext(), layersNeedingPaint
Invalidation); |
88 layer.compositor()->updateRootLayerPosition(); | 88 layer.compositor()->updateRootLayerPosition(); |
89 } | 89 } |
90 | 90 |
91 void GraphicsLayerUpdater::updateRecursive(RenderLayer& layer, UpdateType update
Type, const UpdateContext& context, Vector<RenderLayer*>& layersNeedingPaintInva
lidation) | 91 void GraphicsLayerUpdater::updateRecursive(Layer& layer, UpdateType updateType,
const UpdateContext& context, Vector<Layer*>& layersNeedingPaintInvalidation) |
92 { | 92 { |
93 if (layer.hasCompositedLayerMapping()) { | 93 if (layer.hasCompositedLayerMapping()) { |
94 CompositedLayerMapping* mapping = layer.compositedLayerMapping(); | 94 CompositedLayerMapping* mapping = layer.compositedLayerMapping(); |
95 | 95 |
96 if (updateType == ForceUpdate || mapping->needsGraphicsLayerUpdate()) { | 96 if (updateType == ForceUpdate || mapping->needsGraphicsLayerUpdate()) { |
97 const RenderLayer* compositingContainer = context.compositingContain
er(layer); | 97 const Layer* compositingContainer = context.compositingContainer(lay
er); |
98 ASSERT(compositingContainer == layer.enclosingLayerWithCompositedLay
erMapping(ExcludeSelf)); | 98 ASSERT(compositingContainer == layer.enclosingLayerWithCompositedLay
erMapping(ExcludeSelf)); |
99 | 99 |
100 if (mapping->updateGraphicsLayerConfiguration()) | 100 if (mapping->updateGraphicsLayerConfiguration()) |
101 m_needsRebuildTree = true; | 101 m_needsRebuildTree = true; |
102 | 102 |
103 mapping->updateGraphicsLayerGeometry(compositingContainer, context.c
ompositingStackingContext(), layersNeedingPaintInvalidation); | 103 mapping->updateGraphicsLayerGeometry(compositingContainer, context.c
ompositingStackingContext(), layersNeedingPaintInvalidation); |
104 | 104 |
105 if (mapping->hasUnpositionedOverflowControlsLayers()) | 105 if (mapping->hasUnpositionedOverflowControlsLayers()) |
106 layer.scrollableArea()->positionOverflowControls(IntSize()); | 106 layer.scrollableArea()->positionOverflowControls(IntSize()); |
107 | 107 |
108 updateType = mapping->updateTypeForChildren(updateType); | 108 updateType = mapping->updateTypeForChildren(updateType); |
109 mapping->clearNeedsGraphicsLayerUpdate(); | 109 mapping->clearNeedsGraphicsLayerUpdate(); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 UpdateContext childContext(context, layer); | 113 UpdateContext childContext(context, layer); |
114 for (RenderLayer* child = layer.firstChild(); child; child = child->nextSibl
ing()) | 114 for (Layer* child = layer.firstChild(); child; child = child->nextSibling()) |
115 updateRecursive(*child, updateType, childContext, layersNeedingPaintInva
lidation); | 115 updateRecursive(*child, updateType, childContext, layersNeedingPaintInva
lidation); |
116 } | 116 } |
117 | 117 |
118 #if ENABLE(ASSERT) | 118 #if ENABLE(ASSERT) |
119 | 119 |
120 void GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(RenderLay
er& layer) | 120 void GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(Layer& la
yer) |
121 { | 121 { |
122 if (layer.hasCompositedLayerMapping()) | 122 if (layer.hasCompositedLayerMapping()) |
123 layer.compositedLayerMapping()->assertNeedsToUpdateGraphicsLayerBitsClea
red(); | 123 layer.compositedLayerMapping()->assertNeedsToUpdateGraphicsLayerBitsClea
red(); |
124 | 124 |
125 for (RenderLayer* child = layer.firstChild(); child; child = child->nextSibl
ing()) | 125 for (Layer* child = layer.firstChild(); child; child = child->nextSibling()) |
126 assertNeedsToUpdateGraphicsLayerBitsCleared(*child); | 126 assertNeedsToUpdateGraphicsLayerBitsCleared(*child); |
127 } | 127 } |
128 | 128 |
129 #endif | 129 #endif |
130 | 130 |
131 } // namespace blink | 131 } // namespace blink |
OLD | NEW |