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 * | 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "core/html/canvas/CanvasRenderingContext.h" | 44 #include "core/html/canvas/CanvasRenderingContext.h" |
45 #include "core/inspector/InspectorInstrumentation.h" | 45 #include "core/inspector/InspectorInstrumentation.h" |
46 #include "core/page/Chrome.h" | 46 #include "core/page/Chrome.h" |
47 #include "core/page/Page.h" | 47 #include "core/page/Page.h" |
48 #include "core/page/scrolling/ScrollingConstraints.h" | 48 #include "core/page/scrolling/ScrollingConstraints.h" |
49 #include "core/page/scrolling/ScrollingCoordinator.h" | 49 #include "core/page/scrolling/ScrollingCoordinator.h" |
50 #include "core/rendering/HitTestResult.h" | 50 #include "core/rendering/HitTestResult.h" |
51 #include "core/rendering/RenderApplet.h" | 51 #include "core/rendering/RenderApplet.h" |
52 #include "core/rendering/RenderEmbeddedObject.h" | 52 #include "core/rendering/RenderEmbeddedObject.h" |
53 #include "core/rendering/RenderFullScreen.h" | 53 #include "core/rendering/RenderFullScreen.h" |
54 #include "core/rendering/RenderGeometryMap.h" | |
55 #include "core/rendering/RenderIFrame.h" | 54 #include "core/rendering/RenderIFrame.h" |
56 #include "core/rendering/RenderLayerStackingNode.h" | 55 #include "core/rendering/RenderLayerStackingNode.h" |
57 #include "core/rendering/RenderLayerStackingNodeIterator.h" | 56 #include "core/rendering/RenderLayerStackingNodeIterator.h" |
58 #include "core/rendering/RenderReplica.h" | 57 #include "core/rendering/RenderReplica.h" |
59 #include "core/rendering/RenderVideo.h" | 58 #include "core/rendering/RenderVideo.h" |
60 #include "core/rendering/RenderView.h" | 59 #include "core/rendering/RenderView.h" |
61 #include "core/rendering/compositing/CompositedLayerMapping.h" | 60 #include "core/rendering/compositing/CompositedLayerMapping.h" |
62 #include "core/rendering/compositing/GraphicsLayerUpdater.h" | 61 #include "core/rendering/compositing/GraphicsLayerUpdater.h" |
63 #include "platform/OverscrollTheme.h" | 62 #include "platform/OverscrollTheme.h" |
64 #include "platform/TraceEvent.h" | 63 #include "platform/TraceEvent.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 104 } |
106 private: | 105 private: |
107 Vector<IntRect, 64> m_layerRects; | 106 Vector<IntRect, 64> m_layerRects; |
108 IntRect m_boundingBox; | 107 IntRect m_boundingBox; |
109 }; | 108 }; |
110 | 109 |
111 class RenderLayerCompositor::OverlapMap { | 110 class RenderLayerCompositor::OverlapMap { |
112 WTF_MAKE_NONCOPYABLE(OverlapMap); | 111 WTF_MAKE_NONCOPYABLE(OverlapMap); |
113 public: | 112 public: |
114 OverlapMap() | 113 OverlapMap() |
115 : m_geometryMap(UseTransforms) | |
116 { | 114 { |
117 // Begin by assuming the root layer will be composited so that there | 115 // Begin by assuming the root layer will be composited so that there |
118 // is something on the stack. The root layer should also never get a | 116 // is something on the stack. The root layer should also never get a |
119 // finishCurrentOverlapTestingContext() call. | 117 // finishCurrentOverlapTestingContext() call. |
120 beginNewOverlapTestingContext(); | 118 beginNewOverlapTestingContext(); |
121 } | 119 } |
122 | 120 |
123 void add(const IntRect& bounds) | 121 void add(const IntRect& bounds) |
124 { | 122 { |
125 // Layers do not contribute to overlap immediately--instead, they will | 123 // Layers do not contribute to overlap immediately--instead, they will |
(...skipping 22 matching lines...) Expand all Loading... |
148 // for checking overlap of any layers outside this context that may | 146 // for checking overlap of any layers outside this context that may |
149 // overlap things from inside this context. Therefore, we must merge | 147 // overlap things from inside this context. Therefore, we must merge |
150 // the information from the top of the stack before popping the stack. | 148 // the information from the top of the stack before popping the stack. |
151 // | 149 // |
152 // FIXME: we may be able to avoid this deep copy by rearranging how | 150 // FIXME: we may be able to avoid this deep copy by rearranging how |
153 // overlapMap state is managed. | 151 // overlapMap state is managed. |
154 m_overlapStack[m_overlapStack.size() - 2].unite(m_overlapStack.last()); | 152 m_overlapStack[m_overlapStack.size() - 2].unite(m_overlapStack.last()); |
155 m_overlapStack.removeLast(); | 153 m_overlapStack.removeLast(); |
156 } | 154 } |
157 | 155 |
158 RenderGeometryMap& geometryMap() { return m_geometryMap; } | |
159 | |
160 private: | 156 private: |
161 Vector<OverlapMapContainer> m_overlapStack; | 157 Vector<OverlapMapContainer> m_overlapStack; |
162 RenderGeometryMap m_geometryMap; | |
163 }; | 158 }; |
164 | 159 |
165 struct CompositingRecursionData { | 160 struct CompositingRecursionData { |
166 CompositingRecursionData(RenderLayer* compAncestor, RenderLayer* mostRecentC
ompositedLayer, RenderLayerCompositor::BoundsUpdateType boundsUpdateType, bool t
estOverlap) | 161 CompositingRecursionData(RenderLayer* compAncestor, RenderLayer* mostRecentC
ompositedLayer, bool testOverlap) |
167 : m_compositingAncestor(compAncestor) | 162 : m_compositingAncestor(compAncestor) |
168 , m_mostRecentCompositedLayer(mostRecentCompositedLayer) | 163 , m_mostRecentCompositedLayer(mostRecentCompositedLayer) |
169 , m_recomputeLayerBoundsUpdateType(boundsUpdateType) | |
170 , m_subtreeIsCompositing(false) | 164 , m_subtreeIsCompositing(false) |
171 , m_hasUnisolatedCompositedBlendingDescendant(false) | 165 , m_hasUnisolatedCompositedBlendingDescendant(false) |
172 , m_testingOverlap(testOverlap) | 166 , m_testingOverlap(testOverlap) |
173 #ifndef NDEBUG | 167 #ifndef NDEBUG |
174 , m_depth(0) | 168 , m_depth(0) |
175 #endif | 169 #endif |
176 { | 170 { |
177 } | 171 } |
178 | 172 |
179 CompositingRecursionData(const CompositingRecursionData& other) | 173 CompositingRecursionData(const CompositingRecursionData& other) |
180 : m_compositingAncestor(other.m_compositingAncestor) | 174 : m_compositingAncestor(other.m_compositingAncestor) |
181 , m_mostRecentCompositedLayer(other.m_mostRecentCompositedLayer) | 175 , m_mostRecentCompositedLayer(other.m_mostRecentCompositedLayer) |
182 , m_recomputeLayerBoundsUpdateType(other.m_recomputeLayerBoundsUpdateTyp
e) | |
183 , m_subtreeIsCompositing(other.m_subtreeIsCompositing) | 176 , m_subtreeIsCompositing(other.m_subtreeIsCompositing) |
184 , m_hasUnisolatedCompositedBlendingDescendant(other.m_hasUnisolatedCompo
sitedBlendingDescendant) | 177 , m_hasUnisolatedCompositedBlendingDescendant(other.m_hasUnisolatedCompo
sitedBlendingDescendant) |
185 , m_testingOverlap(other.m_testingOverlap) | 178 , m_testingOverlap(other.m_testingOverlap) |
186 #ifndef NDEBUG | 179 #ifndef NDEBUG |
187 , m_depth(other.m_depth + 1) | 180 , m_depth(other.m_depth + 1) |
188 #endif | 181 #endif |
189 { | 182 { |
190 } | 183 } |
191 | 184 |
192 RenderLayer* m_compositingAncestor; | 185 RenderLayer* m_compositingAncestor; |
193 RenderLayer* m_mostRecentCompositedLayer; // in paint order regardless of hi
erarchy. | 186 RenderLayer* m_mostRecentCompositedLayer; // in paint order regardless of hi
erarchy. |
194 RenderLayerCompositor::BoundsUpdateType m_recomputeLayerBoundsUpdateType; | |
195 bool m_subtreeIsCompositing; | 187 bool m_subtreeIsCompositing; |
196 bool m_hasUnisolatedCompositedBlendingDescendant; | 188 bool m_hasUnisolatedCompositedBlendingDescendant; |
197 bool m_testingOverlap; | 189 bool m_testingOverlap; |
198 #ifndef NDEBUG | 190 #ifndef NDEBUG |
199 int m_depth; | 191 int m_depth; |
200 #endif | 192 #endif |
201 }; | 193 }; |
202 | 194 |
203 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) | 195 RenderLayerCompositor::RenderLayerCompositor(RenderView& renderView) |
204 : m_renderView(renderView) | 196 : m_renderView(renderView) |
205 , m_compositingReasonFinder(renderView) | 197 , m_compositingReasonFinder(renderView) |
206 , m_hasAcceleratedCompositing(true) | 198 , m_hasAcceleratedCompositing(true) |
207 , m_showRepaintCounter(false) | 199 , m_showRepaintCounter(false) |
208 , m_needsToRecomputeCompositingRequirements(false) | 200 , m_needsToRecomputeCompositingRequirements(false) |
209 , m_needsToUpdateLayerTreeGeometry(false) | 201 , m_needsToUpdateLayerTreeGeometry(false) |
210 , m_pendingUpdateType(GraphicsLayerUpdater::DoNotForceUpdate) | 202 , m_pendingUpdateType(GraphicsLayerUpdater::DoNotForceUpdate) |
211 , m_recomputeLayerBoundsUpdateType(DoNotForceUpdate) | 203 , m_pendingPropertyUpdateType(CompositingPropertyUpdater::DoNotForceUpdate) |
212 , m_compositing(false) | 204 , m_compositing(false) |
213 , m_compositingLayersNeedRebuild(false) | 205 , m_compositingLayersNeedRebuild(false) |
214 , m_forceCompositingMode(false) | 206 , m_forceCompositingMode(false) |
215 , m_needsUpdateCompositingRequirementsState(false) | 207 , m_needsUpdateCompositingRequirementsState(false) |
216 , m_isTrackingRepaints(false) | 208 , m_isTrackingRepaints(false) |
217 , m_rootLayerAttachment(RootLayerUnattached) | 209 , m_rootLayerAttachment(RootLayerUnattached) |
218 { | 210 { |
219 } | 211 } |
220 | 212 |
221 RenderLayerCompositor::~RenderLayerCompositor() | 213 RenderLayerCompositor::~RenderLayerCompositor() |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 359 |
368 switch (updateType) { | 360 switch (updateType) { |
369 case CompositingUpdateAfterStyleChange: | 361 case CompositingUpdateAfterStyleChange: |
370 m_needsToRecomputeCompositingRequirements = true; | 362 m_needsToRecomputeCompositingRequirements = true; |
371 break; | 363 break; |
372 case CompositingUpdateAfterLayout: | 364 case CompositingUpdateAfterLayout: |
373 m_needsToRecomputeCompositingRequirements = true; | 365 m_needsToRecomputeCompositingRequirements = true; |
374 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. | 366 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
375 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; | 367 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; |
376 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. | 368 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
377 m_recomputeLayerBoundsUpdateType = ForceUpdate; | 369 m_pendingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; |
378 break; | 370 break; |
379 case CompositingUpdateOnScroll: | 371 case CompositingUpdateOnScroll: |
380 m_needsToRecomputeCompositingRequirements = true; // Overlap can change
with scrolling, so need to check for hierarchy updates. | 372 m_needsToRecomputeCompositingRequirements = true; // Overlap can change
with scrolling, so need to check for hierarchy updates. |
381 m_needsToUpdateLayerTreeGeometry = true; | 373 m_needsToUpdateLayerTreeGeometry = true; |
382 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. | 374 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
383 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; | 375 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; |
384 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. | 376 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
385 m_recomputeLayerBoundsUpdateType = ForceUpdate; | 377 m_pendingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; |
386 break; | 378 break; |
387 case CompositingUpdateOnCompositedScroll: | 379 case CompositingUpdateOnCompositedScroll: |
388 m_needsToUpdateLayerTreeGeometry = true; | 380 m_needsToUpdateLayerTreeGeometry = true; |
389 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. | 381 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
390 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; | 382 m_pendingUpdateType = GraphicsLayerUpdater::ForceUpdate; |
391 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. | 383 // FIXME: Ideally we'd be smarter about tracking dirtiness and wouldn't
need a ForceUpdate here. |
392 m_recomputeLayerBoundsUpdateType = ForceUpdate; | 384 m_pendingPropertyUpdateType = CompositingPropertyUpdater::ForceUpdate; |
393 break; | 385 break; |
394 case CompositingUpdateAfterCanvasContextChange: | 386 case CompositingUpdateAfterCanvasContextChange: |
395 m_needsToUpdateLayerTreeGeometry = true; | 387 m_needsToUpdateLayerTreeGeometry = true; |
396 break; | 388 break; |
397 } | 389 } |
398 | 390 |
399 page()->animator().scheduleVisualUpdate(); | 391 page()->animator().scheduleVisualUpdate(); |
400 } | 392 } |
401 | 393 |
402 static void clearAncestorDependentPropertyCacheRecursive(RenderLayer* layer) | 394 static void clearAncestorDependentPropertyCacheRecursive(RenderLayer* layer) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 } | 437 } |
446 } | 438 } |
447 } | 439 } |
448 } | 440 } |
449 | 441 |
450 bool RenderLayerCompositor::hasUnresolvedDirtyBits() | 442 bool RenderLayerCompositor::hasUnresolvedDirtyBits() |
451 { | 443 { |
452 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR
ebuild || m_needsToUpdateLayerTreeGeometry || m_needsUpdateCompositingRequiremen
tsState || m_pendingUpdateType != GraphicsLayerUpdater::DoNotForceUpdate; | 444 return m_needsToRecomputeCompositingRequirements || m_compositingLayersNeedR
ebuild || m_needsToUpdateLayerTreeGeometry || m_needsUpdateCompositingRequiremen
tsState || m_pendingUpdateType != GraphicsLayerUpdater::DoNotForceUpdate; |
453 } | 445 } |
454 | 446 |
455 static void assertNeedsRecomputeBoundsBitsCleared(RenderLayer* updateRoot) | |
456 { | |
457 // We don't do overlap testing on the root layer, so we never compute its ab
solute bounding box. | |
458 ASSERT(updateRoot->isRootLayer() || !updateRoot->needsToRecomputeBounds()); | |
459 for (RenderLayer* child = updateRoot->firstChild(); child; child = child->ne
xtSibling()) | |
460 assertNeedsRecomputeBoundsBitsCleared(child); | |
461 } | |
462 | |
463 void RenderLayerCompositor::updateCompositingLayersInternal() | 447 void RenderLayerCompositor::updateCompositingLayersInternal() |
464 { | 448 { |
465 if (isMainFrame() && m_renderView.frameView()) | 449 if (isMainFrame() && m_renderView.frameView()) |
466 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); | 450 finishCompositingUpdateForFrameTree(&m_renderView.frameView()->frame()); |
467 | 451 |
468 if (m_forceCompositingMode && !m_compositing) | 452 if (m_forceCompositingMode && !m_compositing) |
469 enableCompositingMode(true); | 453 enableCompositingMode(true); |
470 | 454 |
471 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) | 455 if (!m_needsToRecomputeCompositingRequirements && !m_compositing) |
472 return; | 456 return; |
(...skipping 12 matching lines...) Expand all Loading... |
485 m_compositingLayersNeedRebuild = false; | 469 m_compositingLayersNeedRebuild = false; |
486 m_needsToUpdateLayerTreeGeometry = false; | 470 m_needsToUpdateLayerTreeGeometry = false; |
487 m_needsToRecomputeCompositingRequirements = false; | 471 m_needsToRecomputeCompositingRequirements = false; |
488 m_pendingUpdateType = GraphicsLayerUpdater::DoNotForceUpdate; | 472 m_pendingUpdateType = GraphicsLayerUpdater::DoNotForceUpdate; |
489 | 473 |
490 RenderLayer* updateRoot = rootRenderLayer(); | 474 RenderLayer* updateRoot = rootRenderLayer(); |
491 | 475 |
492 if (needCompositingRequirementsUpdate) { | 476 if (needCompositingRequirementsUpdate) { |
493 // Go through the layers in presentation order, so that we can compute w
hich RenderLayers need compositing layers. | 477 // Go through the layers in presentation order, so that we can compute w
hich RenderLayers need compositing layers. |
494 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b
ut the parenting logic would be more complex. | 478 // FIXME: we could maybe do this and the hierarchy udpate in one pass, b
ut the parenting logic would be more complex. |
495 CompositingRecursionData recursionData(updateRoot, 0, m_recomputeLayerBo
undsUpdateType, true); | 479 CompositingRecursionData recursionData(updateRoot, 0, true); |
496 m_recomputeLayerBoundsUpdateType = DoNotForceUpdate; | |
497 bool layersChanged = false; | 480 bool layersChanged = false; |
498 bool saw3DTransform = false; | 481 bool saw3DTransform = false; |
| 482 |
| 483 { |
| 484 TRACE_EVENT0("blink_rendering", "CompositingPropertyUpdater::updateA
ncestorDependentProperties"); |
| 485 CompositingPropertyUpdater().updateAncestorDependentProperties(updat
eRoot, m_pendingPropertyUpdateType); |
| 486 m_pendingPropertyUpdateType = CompositingPropertyUpdater::DoNotForce
Update; |
| 487 #if !ASSERT_DISABLED |
| 488 CompositingPropertyUpdater::assertNeedsToUpdateAncestorDependantProp
ertiesBitsCleared(updateRoot); |
| 489 #endif |
| 490 } |
| 491 |
499 { | 492 { |
500 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo
sitingRequirements"); | 493 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::computeCompo
sitingRequirements"); |
501 OverlapMap overlapTestRequestMap; | 494 OverlapMap overlapTestRequestMap; |
502 | 495 |
503 // FIXME: Passing these unclippedDescendants down and keeping track | 496 // FIXME: Passing these unclippedDescendants down and keeping track |
504 // of them dynamically, we are requiring a full tree walk. This | 497 // of them dynamically, we are requiring a full tree walk. This |
505 // should be removed as soon as proper overlap testing based on | 498 // should be removed as soon as proper overlap testing based on |
506 // scrolling and animation bounds is implemented (crbug.com/252472). | 499 // scrolling and animation bounds is implemented (crbug.com/252472). |
507 Vector<RenderLayer*> unclippedDescendants; | 500 Vector<RenderLayer*> unclippedDescendants; |
508 IntRect absoluteDecendantBoundingBox; | 501 IntRect absoluteDecendantBoundingBox; |
509 computeCompositingRequirements(0, updateRoot, overlapTestRequestMap,
recursionData, saw3DTransform, unclippedDescendants, absoluteDecendantBoundingB
ox); | 502 computeCompositingRequirements(0, updateRoot, overlapTestRequestMap,
recursionData, saw3DTransform, unclippedDescendants, absoluteDecendantBoundingB
ox); |
510 #if !ASSERT_DISABLED | |
511 assertNeedsRecomputeBoundsBitsCleared(updateRoot); | |
512 #endif | |
513 } | 503 } |
514 | 504 |
515 { | 505 { |
516 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::assignLayers
ToBackings"); | 506 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::assignLayers
ToBackings"); |
517 assignLayersToBackings(updateRoot, layersChanged); | 507 assignLayersToBackings(updateRoot, layersChanged); |
518 } | 508 } |
519 | 509 |
520 { | 510 { |
521 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateHasVis
ibleNonLayerContentLoop"); | 511 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateHasVis
ibleNonLayerContentLoop"); |
522 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView.f
rameView()->scrollableAreas(); | 512 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView.f
rameView()->scrollableAreas(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 // be compositing in order to render above that layer. | 921 // be compositing in order to render above that layer. |
932 // | 922 // |
933 // If a child in the negative z-order list is compositing, then the layer i
tself | 923 // If a child in the negative z-order list is compositing, then the layer i
tself |
934 // must be compositing so that its contents render over that child. | 924 // must be compositing so that its contents render over that child. |
935 // This implies that its positive z-index children must also be compositing
. | 925 // This implies that its positive z-index children must also be compositing
. |
936 // | 926 // |
937 void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
Layer, RenderLayer* layer, OverlapMap& overlapMap, CompositingRecursionData& cur
rentRecursionData, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclipp
edDescendants, IntRect& absoluteDecendantBoundingBox) | 927 void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
Layer, RenderLayer* layer, OverlapMap& overlapMap, CompositingRecursionData& cur
rentRecursionData, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclipp
edDescendants, IntRect& absoluteDecendantBoundingBox) |
938 { | 928 { |
939 layer->stackingNode()->updateLayerListsIfNeeded(); | 929 layer->stackingNode()->updateLayerListsIfNeeded(); |
940 | 930 |
941 overlapMap.geometryMap().pushMappingsToAncestor(layer, ancestorLayer); | |
942 | |
943 // Clear the flag | 931 // Clear the flag |
944 layer->setHasCompositingDescendant(false); | 932 layer->setHasCompositingDescendant(false); |
945 layer->setHasNonCompositedChild(false); | 933 layer->setHasNonCompositedChild(false); |
946 | 934 |
947 // Start by assuming this layer will not need to composite. | 935 // Start by assuming this layer will not need to composite. |
948 CompositingReasons reasonsToComposite = CompositingReasonNone; | 936 CompositingReasons reasonsToComposite = CompositingReasonNone; |
949 | 937 |
950 // First accumulate the straightforward compositing reasons. | 938 // First accumulate the straightforward compositing reasons. |
951 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l
ayer, &m_needsToRecomputeCompositingRequirements); | 939 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l
ayer, &m_needsToRecomputeCompositingRequirements); |
952 | 940 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 // indices remain valid. | 973 // indices remain valid. |
986 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) | 974 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) |
987 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe
dDescendantsToRemove.size() - i - 1)); | 975 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe
dDescendantsToRemove.size() - i - 1)); |
988 | 976 |
989 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) | 977 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) |
990 unclippedDescendants.append(layer); | 978 unclippedDescendants.append(layer); |
991 } | 979 } |
992 | 980 |
993 IntRect absBounds; | 981 IntRect absBounds; |
994 if (!layer->isRootLayer()) { | 982 if (!layer->isRootLayer()) { |
995 if (currentRecursionData.m_recomputeLayerBoundsUpdateType == ForceUpdate
|| layer->needsToRecomputeBounds()) { | 983 absBounds = layer->ancestorDependentProperties().absoluteBoundingBox; |
996 // FIXME: If the absolute bounds didn't change, then we don't need t
o ForceUpdate descendant RenderLayers. | |
997 currentRecursionData.m_recomputeLayerBoundsUpdateType = ForceUpdate; | |
998 absBounds = enclosingIntRect(overlapMap.geometryMap().absoluteRect(l
ayer->overlapBounds())); | |
999 layer->setAbsoluteBoundingBox(absBounds); | |
1000 } else { | |
1001 absBounds = layer->absoluteBoundingBox(); | |
1002 } | |
1003 // Setting the absBounds to 1x1 instead of 0x0 makes very little sense, | 984 // Setting the absBounds to 1x1 instead of 0x0 makes very little sense, |
1004 // but removing this code will make JSGameBench sad. | 985 // but removing this code will make JSGameBench sad. |
1005 // See https://codereview.chromium.org/13912020/ | 986 // See https://codereview.chromium.org/13912020/ |
1006 if (absBounds.isEmpty()) | 987 if (absBounds.isEmpty()) |
1007 absBounds.setSize(IntSize(1, 1)); | 988 absBounds.setSize(IntSize(1, 1)); |
1008 } | 989 } |
1009 | 990 |
1010 absoluteDecendantBoundingBox = absBounds; | 991 absoluteDecendantBoundingBox = absBounds; |
1011 | 992 |
1012 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing
(directReasons)) | 993 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing
(directReasons)) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 if (!willBeCompositedOrSquashed) { | 1039 if (!willBeCompositedOrSquashed) { |
1059 // make layer compositing | 1040 // make layer compositing |
1060 childRecursionData.m_compositingAncestor = layer; | 1041 childRecursionData.m_compositingAncestor = layer; |
1061 overlapMap.beginNewOverlapTestingContext(); | 1042 overlapMap.beginNewOverlapTestingContext(); |
1062 willBeCompositedOrSquashed = true; | 1043 willBeCompositedOrSquashed = true; |
1063 willHaveForegroundLayer = true; | 1044 willHaveForegroundLayer = true; |
1064 | 1045 |
1065 // FIXME: temporary solution for the first negative z-index
composited child: | 1046 // FIXME: temporary solution for the first negative z-index
composited child: |
1066 // re-compute the absBounds for the child so that we
can add the | 1047 // re-compute the absBounds for the child so that we
can add the |
1067 // negative z-index child's bounds to the new overlap
context. | 1048 // negative z-index child's bounds to the new overlap
context. |
1068 overlapMap.geometryMap().pushMappingsToAncestor(curNode->lay
er(), layer); | |
1069 // The above call to computeCompositinRequirements will have
already updated this layer's absolute bounding box. | |
1070 overlapMap.beginNewOverlapTestingContext(); | 1049 overlapMap.beginNewOverlapTestingContext(); |
1071 ASSERT(!curNode->layer()->needsToRecomputeBounds()); | 1050 addToOverlapMap(overlapMap, curNode->layer(), curNode->layer
()->ancestorDependentProperties().absoluteBoundingBox); |
1072 addToOverlapMap(overlapMap, curNode->layer(), curNode->layer
()->absoluteBoundingBox()); | |
1073 overlapMap.finishCurrentOverlapTestingContext(); | 1051 overlapMap.finishCurrentOverlapTestingContext(); |
1074 overlapMap.geometryMap().popMappingsToAncestor(layer); | |
1075 } | 1052 } |
1076 } | 1053 } |
1077 } | 1054 } |
1078 } | 1055 } |
1079 | 1056 |
1080 if (willHaveForegroundLayer) { | 1057 if (willHaveForegroundLayer) { |
1081 ASSERT(willBeCompositedOrSquashed); | 1058 ASSERT(willBeCompositedOrSquashed); |
1082 // A foreground layer effectively is a new backing for all subsequent ch
ildren, so | 1059 // A foreground layer effectively is a new backing for all subsequent ch
ildren, so |
1083 // we don't need to test for overlap with anything behind this. So, we c
an finish | 1060 // we don't need to test for overlap with anything behind this. So, we c
an finish |
1084 // the previous context that was accumulating rects for the negative z-i
ndex | 1061 // the previous context that was accumulating rects for the negative z-i
ndex |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 // second-from-top context of the stack. | 1112 // second-from-top context of the stack. |
1136 overlapMap.beginNewOverlapTestingContext(); | 1113 overlapMap.beginNewOverlapTestingContext(); |
1137 addToOverlapMap(overlapMap, layer, absoluteDecendantBoundingBox); | 1114 addToOverlapMap(overlapMap, layer, absoluteDecendantBoundingBox); |
1138 willBeCompositedOrSquashed = true; | 1115 willBeCompositedOrSquashed = true; |
1139 } | 1116 } |
1140 | 1117 |
1141 // If the original layer is composited, the reflection needs to be, too. | 1118 // If the original layer is composited, the reflection needs to be, too. |
1142 if (layer->reflectionInfo()) { | 1119 if (layer->reflectionInfo()) { |
1143 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r
eflection overlapping with another renderer? | 1120 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r
eflection overlapping with another renderer? |
1144 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflectionLayer(
); | 1121 RenderLayer* reflectionLayer = layer->reflectionInfo()->reflectionLayer(
); |
1145 reflectionLayer->clearNeedsToRecomputeBounds(); | |
1146 CompositingReasons reflectionCompositingReason = willBeCompositedOrSquas
hed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone; | 1122 CompositingReasons reflectionCompositingReason = willBeCompositedOrSquas
hed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone; |
1147 reflectionLayer->setCompositingReasons(reflectionLayer->compositingReaso
ns() | reflectionCompositingReason); | 1123 reflectionLayer->setCompositingReasons(reflectionLayer->compositingReaso
ns() | reflectionCompositingReason); |
1148 } | 1124 } |
1149 | 1125 |
1150 // Subsequent layers in the parent's stacking context may also need to compo
site. | 1126 // Subsequent layers in the parent's stacking context may also need to compo
site. |
1151 if (childRecursionData.m_subtreeIsCompositing) | 1127 if (childRecursionData.m_subtreeIsCompositing) |
1152 currentRecursionData.m_subtreeIsCompositing = true; | 1128 currentRecursionData.m_subtreeIsCompositing = true; |
1153 | 1129 |
1154 if (willBeCompositedOrSquashed && layer->blendInfo().hasBlendMode()) | 1130 if (willBeCompositedOrSquashed && layer->blendInfo().hasBlendMode()) |
1155 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = true; | 1131 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = true; |
(...skipping 27 matching lines...) Expand all Loading... |
1183 if (requiresCompositing(reasonsToComposite)) | 1159 if (requiresCompositing(reasonsToComposite)) |
1184 currentRecursionData.m_mostRecentCompositedLayer = layer; | 1160 currentRecursionData.m_mostRecentCompositedLayer = layer; |
1185 | 1161 |
1186 // At this point we have finished collecting all reasons to composite this l
ayer. | 1162 // At this point we have finished collecting all reasons to composite this l
ayer. |
1187 layer->setCompositingReasons(reasonsToComposite); | 1163 layer->setCompositingReasons(reasonsToComposite); |
1188 | 1164 |
1189 if (!willBeCompositedOrSquashed && layer->parent()) | 1165 if (!willBeCompositedOrSquashed && layer->parent()) |
1190 layer->parent()->setHasNonCompositedChild(true); | 1166 layer->parent()->setHasNonCompositedChild(true); |
1191 | 1167 |
1192 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans
form(); | 1168 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans
form(); |
1193 overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer); | |
1194 } | 1169 } |
1195 | 1170 |
1196 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co
mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap
ping, LayoutPoint newOffsetFromAbsoluteForSquashingCLM, RenderLayer* newClipping
AncestorForMostRecentMapping) | 1171 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co
mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap
ping, LayoutPoint newOffsetFromAbsoluteForSquashingCLM, RenderLayer* newClipping
AncestorForMostRecentMapping) |
1197 { | 1172 { |
1198 // The most recent backing is done accumulating any more squashing layers. | 1173 // The most recent backing is done accumulating any more squashing layers. |
1199 if (hasMostRecentMapping) | 1174 if (hasMostRecentMapping) |
1200 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn
dex); | 1175 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn
dex); |
1201 | 1176 |
1202 nextSquashedLayerIndex = 0; | 1177 nextSquashedLayerIndex = 0; |
1203 mostRecentMapping = newCompositedLayerMapping; | 1178 mostRecentMapping = newCompositedLayerMapping; |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 } else if (graphicsLayer == m_scrollLayer.get()) { | 2162 } else if (graphicsLayer == m_scrollLayer.get()) { |
2188 name = "LocalFrame Scrolling Layer"; | 2163 name = "LocalFrame Scrolling Layer"; |
2189 } else { | 2164 } else { |
2190 ASSERT_NOT_REACHED(); | 2165 ASSERT_NOT_REACHED(); |
2191 } | 2166 } |
2192 | 2167 |
2193 return name; | 2168 return name; |
2194 } | 2169 } |
2195 | 2170 |
2196 } // namespace WebCore | 2171 } // namespace WebCore |
OLD | NEW |