OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 #include "core/page/UseCounter.h" | 69 #include "core/page/UseCounter.h" |
70 #include "core/page/animation/AnimationController.h" | 70 #include "core/page/animation/AnimationController.h" |
71 #include "core/page/scrolling/ScrollingCoordinator.h" | 71 #include "core/page/scrolling/ScrollingCoordinator.h" |
72 #include "core/platform/FloatConversion.h" | 72 #include "core/platform/FloatConversion.h" |
73 #include "core/platform/HistogramSupport.h" | 73 #include "core/platform/HistogramSupport.h" |
74 #include "core/platform/PlatformGestureEvent.h" | 74 #include "core/platform/PlatformGestureEvent.h" |
75 #include "core/platform/PlatformMouseEvent.h" | 75 #include "core/platform/PlatformMouseEvent.h" |
76 #include "core/platform/ScrollAnimator.h" | 76 #include "core/platform/ScrollAnimator.h" |
77 #include "core/platform/Scrollbar.h" | 77 #include "core/platform/Scrollbar.h" |
78 #include "core/platform/ScrollbarTheme.h" | 78 #include "core/platform/ScrollbarTheme.h" |
79 #include "core/platform/chromium/TraceEvent.h" | |
79 #include "core/platform/graphics/FloatPoint3D.h" | 80 #include "core/platform/graphics/FloatPoint3D.h" |
80 #include "core/platform/graphics/FloatRect.h" | 81 #include "core/platform/graphics/FloatRect.h" |
81 #include "core/platform/graphics/Gradient.h" | 82 #include "core/platform/graphics/Gradient.h" |
82 #include "core/platform/graphics/GraphicsContextStateSaver.h" | 83 #include "core/platform/graphics/GraphicsContextStateSaver.h" |
83 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h" | 84 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h" |
84 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" | 85 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" |
85 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h" | 86 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h" |
86 #include "core/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h " | 87 #include "core/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h " |
87 #include "core/platform/graphics/filters/FEColorMatrix.h" | 88 #include "core/platform/graphics/filters/FEColorMatrix.h" |
88 #include "core/platform/graphics/filters/FEMerge.h" | 89 #include "core/platform/graphics/filters/FEMerge.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 } | 140 } |
140 | 141 |
141 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) | 142 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
142 : m_inResizeMode(false) | 143 : m_inResizeMode(false) |
143 , m_scrollDimensionsDirty(true) | 144 , m_scrollDimensionsDirty(true) |
144 , m_normalFlowListDirty(true) | 145 , m_normalFlowListDirty(true) |
145 , m_hasSelfPaintingLayerDescendant(false) | 146 , m_hasSelfPaintingLayerDescendant(false) |
146 , m_hasSelfPaintingLayerDescendantDirty(false) | 147 , m_hasSelfPaintingLayerDescendantDirty(false) |
147 , m_hasOutOfFlowPositionedDescendant(false) | 148 , m_hasOutOfFlowPositionedDescendant(false) |
148 , m_hasOutOfFlowPositionedDescendantDirty(true) | 149 , m_hasOutOfFlowPositionedDescendantDirty(true) |
150 , m_hasUnclippedDescendant(false) | |
149 , m_needsCompositedScrolling(false) | 151 , m_needsCompositedScrolling(false) |
150 , m_descendantsAreContiguousInStackingOrder(false) | 152 , m_descendantsAreContiguousInStackingOrder(false) |
151 , m_descendantsAreContiguousInStackingOrderDirty(true) | 153 , m_descendantsAreContiguousInStackingOrderDirty(true) |
152 , m_isRootLayer(renderer->isRenderView()) | 154 , m_isRootLayer(renderer->isRenderView()) |
153 , m_usedTransparency(false) | 155 , m_usedTransparency(false) |
154 , m_paintingInsideReflection(false) | 156 , m_paintingInsideReflection(false) |
155 , m_inOverflowRelayout(false) | 157 , m_inOverflowRelayout(false) |
156 , m_repaintStatus(NeedsNormalRepaint) | 158 , m_repaintStatus(NeedsNormalRepaint) |
157 , m_visibleContentStatusDirty(true) | 159 , m_visibleContentStatusDirty(true) |
158 , m_hasVisibleContent(false) | 160 , m_hasVisibleContent(false) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 frameView->removeResizerArea(this); | 227 frameView->removeResizerArea(this); |
226 } | 228 } |
227 } | 229 } |
228 | 230 |
229 if (!m_renderer->documentBeingDestroyed()) { | 231 if (!m_renderer->documentBeingDestroyed()) { |
230 Node* node = m_renderer->node(); | 232 Node* node = m_renderer->node(); |
231 if (node && node->isElementNode()) | 233 if (node && node->isElementNode()) |
232 toElement(node)->setSavedLayerScrollOffset(m_scrollOffset); | 234 toElement(node)->setSavedLayerScrollOffset(m_scrollOffset); |
233 } | 235 } |
234 | 236 |
237 if (!m_renderer->documentBeingDestroyed()) | |
238 compositor()->removeOutOfFlowPositionedLayer(this); | |
239 | |
235 destroyScrollbar(HorizontalScrollbar); | 240 destroyScrollbar(HorizontalScrollbar); |
236 destroyScrollbar(VerticalScrollbar); | 241 destroyScrollbar(VerticalScrollbar); |
237 | 242 |
238 if (renderer()->frame() && renderer()->frame()->page()) { | 243 if (renderer()->frame() && renderer()->frame()->page()) { |
239 if (ScrollingCoordinator* scrollingCoordinator = renderer()->frame()->pa ge()->scrollingCoordinator()) | 244 if (ScrollingCoordinator* scrollingCoordinator = renderer()->frame()->pa ge()->scrollingCoordinator()) |
240 scrollingCoordinator->willDestroyScrollableArea(this); | 245 scrollingCoordinator->willDestroyScrollableArea(this); |
241 } | 246 } |
242 | 247 |
243 if (m_reflection) | 248 if (m_reflection) |
244 removeReflection(); | 249 removeReflection(); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 layer->m_hasSelfPaintingLayerDescendantDirty = true; | 480 layer->m_hasSelfPaintingLayerDescendantDirty = true; |
476 // If we have reached a self-painting layer, we know our parent should h ave a self-painting descendant | 481 // If we have reached a self-painting layer, we know our parent should h ave a self-painting descendant |
477 // in this case, there is no need to dirty our ancestors further. | 482 // in this case, there is no need to dirty our ancestors further. |
478 if (layer->isSelfPaintingLayer()) { | 483 if (layer->isSelfPaintingLayer()) { |
479 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || parent()->hasSelfPaintingLayerDescendant()); | 484 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || parent()->hasSelfPaintingLayerDescendant()); |
480 break; | 485 break; |
481 } | 486 } |
482 } | 487 } |
483 } | 488 } |
484 | 489 |
490 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant() | |
491 { | |
492 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | |
493 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl owPositionedDescendant()) | |
494 break; | |
495 | |
496 layer->m_hasOutOfFlowPositionedDescendantDirty = false; | |
esprehn
2013/05/08 21:56:40
This is usually considered bad form, it's better t
Ian Vollick
2013/05/09 01:27:42
Done.
| |
497 layer->m_hasOutOfFlowPositionedDescendant = true; | |
498 } | |
499 } | |
500 | |
501 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() | |
502 { | |
503 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | |
504 layer->m_hasOutOfFlowPositionedDescendantDirty = true; | |
505 | |
506 // We may or may not have an unclipped descendant. If we do, we'll reset | |
507 // this to true the next time composited scrolling state is updated. | |
508 layer->m_hasUnclippedDescendant = false; | |
esprehn
2013/05/08 21:56:40
Same for all of these.
Ian Vollick
2013/05/09 01:27:42
Done.
| |
509 | |
510 // If we have reached an out of flow positioned layer, we know our paren t should have an out-of-flow positioned descendant. | |
511 // In this case, there is no need to dirty our ancestors further. | |
512 if (layer->renderer()->isOutOfFlowPositioned()) { | |
513 ASSERT(!parent() || parent()->m_hasOutOfFlowPositionedDescendantDirt y || parent()->hasOutOfFlowPositionedDescendant()); | |
514 break; | |
515 } | |
516 } | |
517 } | |
518 | |
485 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const | 519 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const |
486 { | 520 { |
487 return renderer()->frame() | 521 return renderer()->frame() |
488 && renderer()->frame()->page() | 522 && renderer()->frame()->page() |
489 && renderer()->frame()->page()->settings()->acceleratedCompositingForOve rflowScrollEnabled(); | 523 && renderer()->frame()->page()->settings()->acceleratedCompositingForOve rflowScrollEnabled(); |
490 } | 524 } |
491 | 525 |
492 // If we are a stacking container, then this function will determine if our | 526 // If we are a stacking container, then this function will determine if our |
493 // descendants for a contiguous block in stacking order. This is required in | 527 // descendants for a contiguous block in stacking order. This is required in |
494 // order for an element to be safely promoted to a stacking container. It is saf e | 528 // order for an element to be safely promoted to a stacking container. It is saf e |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
564 // maxStackIndex - minStackIndex == numSCDescendants | 598 // maxStackIndex - minStackIndex == numSCDescendants |
565 // ===> 3 - 0 == 3 | 599 // ===> 3 - 0 == 3 |
566 // ===> 3 == 3 | 600 // ===> 3 == 3 |
567 // | 601 // |
568 // And we would conclude that C could be promoted. | 602 // And we would conclude that C could be promoted. |
569 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() | 603 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() |
570 { | 604 { |
571 if (!m_descendantsAreContiguousInStackingOrderDirty || !isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled()) | 605 if (!m_descendantsAreContiguousInStackingOrderDirty || !isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled()) |
572 return; | 606 return; |
573 | 607 |
574 ASSERT(!m_normalFlowListDirty); | |
575 ASSERT(!m_zOrderListsDirty); | |
576 | |
577 OwnPtr<Vector<RenderLayer*> > posZOrderList; | 608 OwnPtr<Vector<RenderLayer*> > posZOrderList; |
578 OwnPtr<Vector<RenderLayer*> > negZOrderList; | 609 OwnPtr<Vector<RenderLayer*> > negZOrderList; |
579 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); | 610 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); |
580 | 611 |
581 // Create a reverse lookup. | 612 // Create a reverse lookup. |
582 HashMap<const RenderLayer*, int> lookup; | 613 HashMap<const RenderLayer*, int> lookup; |
583 | 614 |
584 if (negZOrderList) { | 615 if (negZOrderList) { |
585 int stackingOrderIndex = -1; | 616 int stackingOrderIndex = -1; |
586 size_t listSize = negZOrderList->size(); | 617 size_t listSize = negZOrderList->size(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 int childCount = 0; | 660 int childCount = 0; |
630 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch ildMinIndex, childMaxIndex, childCount, false); | 661 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch ildMinIndex, childMaxIndex, childCount, false); |
631 if (childCount) { | 662 if (childCount) { |
632 count += childCount; | 663 count += childCount; |
633 minIndex = std::min(minIndex, childMinIndex); | 664 minIndex = std::min(minIndex, childMinIndex); |
634 maxIndex = std::max(maxIndex, childMaxIndex); | 665 maxIndex = std::max(maxIndex, childMaxIndex); |
635 } | 666 } |
636 } | 667 } |
637 | 668 |
638 if (!isStackingContext()) { | 669 if (!isStackingContext()) { |
639 bool newValue = maxIndex - minIndex == count; | 670 m_descendantsAreContiguousInStackingOrder = (maxIndex - minIndex) == cou nt; |
640 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; | 671 m_descendantsAreContiguousInStackingOrderDirty = false; |
641 m_descendantsAreContiguousInStackingOrder = newValue; | |
642 if (didUpdate) | |
643 updateNeedsCompositedScrolling(); | |
644 } | 672 } |
645 } | 673 } |
646 | 674 |
647 static inline bool isPositionedContainer(const RenderLayer* layer) | 675 static inline bool isPositionedContainer(const RenderLayer* layer) |
648 { | 676 { |
649 // FIXME: This is not in sync with containingBlock. | 677 // FIXME: This is not in sync with containingBlock. |
650 // RenderObject::canContainFixedPositionedObject() should probably be used | 678 // RenderObject::canContainFixedPositionedObject() should probably be used |
651 // instead. | 679 // instead. |
652 RenderLayerModelObject* layerRenderer = layer->renderer(); | 680 RenderLayerModelObject* layerRenderer = layer->renderer(); |
653 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | 681 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1062 if (curr == ancestorStackingContainer) | 1090 if (curr == ancestorStackingContainer) |
1063 return; | 1091 return; |
1064 } | 1092 } |
1065 } | 1093 } |
1066 | 1094 |
1067 bool RenderLayer::canBeStackingContainer() const | 1095 bool RenderLayer::canBeStackingContainer() const |
1068 { | 1096 { |
1069 if (isStackingContext() || !ancestorStackingContainer()) | 1097 if (isStackingContext() || !ancestorStackingContainer()) |
1070 return true; | 1098 return true; |
1071 | 1099 |
1100 ASSERT(!m_descendantsAreContiguousInStackingOrderDirty); | |
1072 return m_descendantsAreContiguousInStackingOrder; | 1101 return m_descendantsAreContiguousInStackingOrder; |
1073 } | 1102 } |
1074 | 1103 |
1075 void RenderLayer::setHasVisibleContent() | 1104 void RenderLayer::setHasVisibleContent() |
1076 { | 1105 { |
1077 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { | 1106 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { |
1078 ASSERT(!parent() || parent()->hasVisibleDescendant()); | 1107 ASSERT(!parent() || parent()->hasVisibleDescendant()); |
1079 return; | 1108 return; |
1080 } | 1109 } |
1081 | 1110 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1118 { | 1147 { |
1119 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | 1148 for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
1120 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan t()) | 1149 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan t()) |
1121 break; | 1150 break; |
1122 | 1151 |
1123 layer->m_hasVisibleDescendant = true; | 1152 layer->m_hasVisibleDescendant = true; |
1124 layer->m_visibleDescendantStatusDirty = false; | 1153 layer->m_visibleDescendantStatusDirty = false; |
1125 } | 1154 } |
1126 } | 1155 } |
1127 | 1156 |
1128 void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* o utOfFlowDescendantContainingBlocks) | 1157 // This method is called on all out of flow positioned layers. It simply walks |
1158 // up to its containing block marking every layer it passes as having an | |
1159 // 'unclipped' descendant. | |
esprehn
2013/05/08 21:56:40
Remove the comment.
| |
1160 void RenderLayer::updateHasUnclippedDescendant() | |
1161 { | |
1162 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant") ; | |
1163 | |
1164 ASSERT(renderer()->isOutOfFlowPositioned()); | |
1165 if (!m_hasVisibleContent && !m_hasVisibleDescendant) | |
1166 return; | |
1167 | |
1168 const RenderObject* containingBlock = renderer()->containingBlock(); | |
1169 for (RenderLayer* ancestor = parent(); ancestor && ancestor->renderer() != c ontainingBlock; ancestor = ancestor->parent()) | |
1170 ancestor->m_hasUnclippedDescendant = true; | |
1171 } | |
1172 | |
1173 static bool isOrHasOutOfFlowPositionedDescendant(const RenderLayer* layer) | |
esprehn
2013/05/08 21:56:40
I'd remove the "isOr" part. We usually just assume
Ian Vollick
2013/05/09 01:27:42
There's already a RenderLayer::hasOutOfFlowPositio
| |
1174 { | |
1175 return (layer->renderer() && layer->renderer()->isOutOfFlowPositioned()) || layer->hasOutOfFlowPositionedDescendant(); | |
1176 } | |
1177 | |
1178 void RenderLayer::updateDescendantDependentFlags() | |
1129 { | 1179 { |
1130 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty) { | 1180 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty) { |
1131 const bool hadVisibleDescendant = m_hasVisibleDescendant; | |
1132 const bool hadOutOfFlowPositionedDescendant = m_hasOutOfFlowPositionedDe scendant; | |
1133 | |
1134 m_hasVisibleDescendant = false; | 1181 m_hasVisibleDescendant = false; |
1135 m_hasSelfPaintingLayerDescendant = false; | 1182 m_hasSelfPaintingLayerDescendant = false; |
1136 m_hasOutOfFlowPositionedDescendant = false; | 1183 m_hasOutOfFlowPositionedDescendant = false; |
1137 | 1184 |
1138 HashSet<const RenderObject*> childOutOfFlowDescendantContainingBlocks; | |
1139 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | 1185 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
1140 childOutOfFlowDescendantContainingBlocks.clear(); | 1186 child->updateDescendantDependentFlags(); |
1141 child->updateDescendantDependentFlags(&childOutOfFlowDescendantConta iningBlocks); | |
1142 | |
1143 bool childIsOutOfFlowPositioned = child->renderer() && child->render er()->isOutOfFlowPositioned(); | |
1144 if (childIsOutOfFlowPositioned) | |
1145 childOutOfFlowDescendantContainingBlocks.add(child->renderer()-> containingBlock()); | |
1146 | |
1147 if (outOfFlowDescendantContainingBlocks) { | |
1148 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow DescendantContainingBlocks.begin(); | |
1149 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i t) | |
1150 outOfFlowDescendantContainingBlocks->add(*it); | |
1151 } | |
1152 | 1187 |
1153 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; | 1188 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; |
1154 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); | 1189 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); |
1155 bool hasOutOfFlowPositionedDescendant = hasVisibleDescendant && (!ch ildOutOfFlowDescendantContainingBlocks.isEmpty() || child->hasOutOfFlowPositione dDescendant()); | 1190 bool hasOutOfFlowPositionedDescendant = isOrHasOutOfFlowPositionedDe scendant(child); |
1156 | 1191 |
1157 m_hasVisibleDescendant |= hasVisibleDescendant; | 1192 m_hasVisibleDescendant |= hasVisibleDescendant; |
1158 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; | 1193 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; |
1159 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt; | 1194 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt; |
1160 | 1195 |
1161 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_ hasOutOfFlowPositionedDescendant) | 1196 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && ha sOutOfFlowPositionedDescendant) |
1162 break; | 1197 break; |
1163 } | 1198 } |
1164 | 1199 |
1165 if (outOfFlowDescendantContainingBlocks && renderer()) | |
1166 outOfFlowDescendantContainingBlocks->remove(renderer()); | |
1167 | |
1168 m_visibleDescendantStatusDirty = false; | 1200 m_visibleDescendantStatusDirty = false; |
1169 m_hasSelfPaintingLayerDescendantDirty = false; | 1201 m_hasSelfPaintingLayerDescendantDirty = false; |
1170 m_hasOutOfFlowPositionedDescendantDirty = false; | 1202 m_hasOutOfFlowPositionedDescendantDirty = false; |
1171 | |
1172 if (m_hasVisibleDescendant != hadVisibleDescendant || m_hasOutOfFlowPosi tionedDescendant != hadOutOfFlowPositionedDescendant) | |
1173 updateNeedsCompositedScrolling(); | |
1174 } | 1203 } |
1175 | 1204 |
1176 if (m_visibleContentStatusDirty) { | 1205 if (m_visibleContentStatusDirty) { |
1177 const bool hadVisibleContent = m_hasVisibleContent; | |
1178 if (renderer()->style()->visibility() == VISIBLE) | 1206 if (renderer()->style()->visibility() == VISIBLE) |
1179 m_hasVisibleContent = true; | 1207 m_hasVisibleContent = true; |
1180 else { | 1208 else { |
1181 // layer may be hidden but still have some visible content, check fo r this | 1209 // layer may be hidden but still have some visible content, check fo r this |
1182 m_hasVisibleContent = false; | 1210 m_hasVisibleContent = false; |
1183 RenderObject* r = renderer()->firstChild(); | 1211 RenderObject* r = renderer()->firstChild(); |
1184 while (r) { | 1212 while (r) { |
1185 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { | 1213 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { |
1186 m_hasVisibleContent = true; | 1214 m_hasVisibleContent = true; |
1187 break; | 1215 break; |
1188 } | 1216 } |
1189 if (r->firstChild() && !r->hasLayer()) | 1217 if (r->firstChild() && !r->hasLayer()) |
1190 r = r->firstChild(); | 1218 r = r->firstChild(); |
1191 else if (r->nextSibling()) | 1219 else if (r->nextSibling()) |
1192 r = r->nextSibling(); | 1220 r = r->nextSibling(); |
1193 else { | 1221 else { |
1194 do { | 1222 do { |
1195 r = r->parent(); | 1223 r = r->parent(); |
1196 if (r == renderer()) | 1224 if (r == renderer()) |
1197 r = 0; | 1225 r = 0; |
1198 } while (r && !r->nextSibling()); | 1226 } while (r && !r->nextSibling()); |
1199 if (r) | 1227 if (r) |
1200 r = r->nextSibling(); | 1228 r = r->nextSibling(); |
1201 } | 1229 } |
1202 } | 1230 } |
1203 } | 1231 } |
1204 m_visibleContentStatusDirty = false; | 1232 m_visibleContentStatusDirty = false; |
1205 if (hadVisibleContent != m_hasVisibleContent) | |
1206 updateNeedsCompositedScrolling(); | |
1207 } | 1233 } |
1208 } | 1234 } |
1209 | 1235 |
1210 void RenderLayer::dirty3DTransformedDescendantStatus() | 1236 void RenderLayer::dirty3DTransformedDescendantStatus() |
1211 { | 1237 { |
1212 RenderLayer* curr = ancestorStackingContainer(); | 1238 RenderLayer* curr = ancestorStackingContainer(); |
1213 if (curr) | 1239 if (curr) |
1214 curr->m_3DTransformedDescendantStatusDirty = true; | 1240 curr->m_3DTransformedDescendantStatusDirty = true; |
1215 | 1241 |
1216 // This propagates up through preserve-3d hierarchies to the enclosing flatt ening layer. | 1242 // This propagates up through preserve-3d hierarchies to the enclosing flatt ening layer. |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1767 child->setParent(this); | 1793 child->setParent(this); |
1768 | 1794 |
1769 if (child->isNormalFlowOnly()) | 1795 if (child->isNormalFlowOnly()) |
1770 dirtyNormalFlowList(); | 1796 dirtyNormalFlowList(); |
1771 | 1797 |
1772 if (!child->isNormalFlowOnly() || child->firstChild()) { | 1798 if (!child->isNormalFlowOnly() || child->firstChild()) { |
1773 // Dirty the z-order list in which we are contained. The ancestorStackin gContainer() can be null in the | 1799 // Dirty the z-order list in which we are contained. The ancestorStackin gContainer() can be null in the |
1774 // case where we're building up generated content layers. This is ok, si nce the lists will start | 1800 // case where we're building up generated content layers. This is ok, si nce the lists will start |
1775 // off dirty in that case anyway. | 1801 // off dirty in that case anyway. |
1776 child->dirtyStackingContainerZOrderLists(); | 1802 child->dirtyStackingContainerZOrderLists(); |
1777 | |
1778 // Adding an out of flow positioned descendant can only affect | |
1779 // the opt-in decision for layers beneath and including our | |
1780 // containing block. | |
1781 RenderObject* containingBlock = child->renderer()->containingBlock(); | |
1782 for (RenderLayer* layer = child; layer; layer = layer->parent()) { | |
1783 layer->updateNeedsCompositedScrolling(); | |
1784 if (layer->renderer() == containingBlock) | |
1785 break; | |
1786 } | |
1787 } | 1803 } |
1788 | 1804 |
1789 child->updateDescendantDependentFlags(); | 1805 child->updateDescendantDependentFlags(); |
1790 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) | 1806 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) |
1791 setAncestorChainHasVisibleDescendant(); | 1807 setAncestorChainHasVisibleDescendant(); |
1792 | 1808 |
1793 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) | 1809 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) |
1794 setAncestorChainHasSelfPaintingLayerDescendant(); | 1810 setAncestorChainHasSelfPaintingLayerDescendant(); |
1795 | 1811 |
1796 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil d->hasOutOfFlowPositionedDescendant())) | 1812 if (isOrHasOutOfFlowPositionedDescendant(child)) { |
1797 setAncestorChainHasOutOfFlowPositionedDescendant(child->renderer()->cont ainingBlock()); | 1813 // Now that the out of flow positioned descendant is in the tree, we |
1814 // need to tell the compositor to reevaluate the compositing | |
1815 // requirements since we may be able to mark more layers as having | |
1816 // an 'unclipped' descendant. | |
1817 compositor()->setNeedsUpdateCompositingRequirementsState(); | |
1818 setAncestorChainHasOutOfFlowPositionedDescendant(); | |
1819 } | |
1798 | 1820 |
1799 compositor()->layerWasAdded(this, child); | 1821 compositor()->layerWasAdded(this, child); |
1800 } | 1822 } |
1801 | 1823 |
1802 RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) | 1824 RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) |
1803 { | 1825 { |
1804 if (!renderer()->documentBeingDestroyed()) | 1826 if (!renderer()->documentBeingDestroyed()) |
1805 compositor()->layerWillBeRemoved(this, oldChild); | 1827 compositor()->layerWillBeRemoved(this, oldChild); |
1806 | 1828 |
1807 // remove the child | 1829 // remove the child |
1808 if (oldChild->previousSibling()) | 1830 if (oldChild->previousSibling()) |
1809 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); | 1831 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); |
1810 if (oldChild->nextSibling()) | 1832 if (oldChild->nextSibling()) |
1811 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; | 1833 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; |
1812 | 1834 |
1813 if (m_first == oldChild) | 1835 if (m_first == oldChild) |
1814 m_first = oldChild->nextSibling(); | 1836 m_first = oldChild->nextSibling(); |
1815 if (m_last == oldChild) | 1837 if (m_last == oldChild) |
1816 m_last = oldChild->previousSibling(); | 1838 m_last = oldChild->previousSibling(); |
1817 | 1839 |
1818 if (oldChild->isNormalFlowOnly()) | 1840 if (oldChild->isNormalFlowOnly()) |
1819 dirtyNormalFlowList(); | 1841 dirtyNormalFlowList(); |
1820 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { | 1842 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { |
1821 // Dirty the z-order list in which we are contained. When called via th e | 1843 // Dirty the z-order list in which we are contained. When called via th e |
1822 // reattachment process in removeOnlyThisLayer, the layer may already be disconnected | 1844 // reattachment process in removeOnlyThisLayer, the layer may already be disconnected |
1823 // from the main layer tree, so we need to null-check the |stackingConta iner| value. | 1845 // from the main layer tree, so we need to null-check the |stackingConta iner| value. |
1824 oldChild->dirtyStackingContainerZOrderLists(); | 1846 oldChild->dirtyStackingContainerZOrderLists(); |
1825 | |
1826 // This could affect whether or not a layer has an out of flow | |
1827 // positioned descendant so we need to schedule some updates. | |
1828 // Removing an out of flow positioned descendant can only affect | |
1829 // the opt-in decision for layers beneath and including the old child's | |
1830 // containing block. | |
1831 RenderObject* containingBlock = oldChild->renderer()->containingBlock(); | |
1832 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | |
1833 layer->updateNeedsCompositedScrolling(); | |
1834 if (layer->renderer() == containingBlock) | |
1835 break; | |
1836 } | |
1837 } | 1847 } |
1838 | 1848 |
1839 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned()) || oldChild->hasOutOfFlowPositionedDescendant()) | |
1840 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
1841 | |
1842 oldChild->setPreviousSibling(0); | 1849 oldChild->setPreviousSibling(0); |
1843 oldChild->setNextSibling(0); | 1850 oldChild->setNextSibling(0); |
1844 oldChild->setParent(0); | 1851 oldChild->setParent(0); |
1845 | 1852 |
1846 oldChild->updateDescendantDependentFlags(); | 1853 oldChild->updateDescendantDependentFlags(); |
1854 if (isOrHasOutOfFlowPositionedDescendant(oldChild)) { | |
1855 // It may now be the case that a layer no longer has an unclipped | |
1856 // descendant. Let the compositor know that it needs to reevaluate | |
1857 // its compositing requirements to check this. | |
1858 compositor()->setNeedsUpdateCompositingRequirementsState(); | |
1859 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
1860 } | |
1861 | |
1847 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1862 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
1848 dirtyAncestorChainVisibleDescendantStatus(); | 1863 dirtyAncestorChainVisibleDescendantStatus(); |
1849 | 1864 |
1850 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) | 1865 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) |
1851 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1866 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
1852 | 1867 |
1853 return oldChild; | 1868 return oldChild; |
1854 } | 1869 } |
1855 | 1870 |
1856 void RenderLayer::removeOnlyThisLayer() | 1871 void RenderLayer::removeOnlyThisLayer() |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2066 case ForceCompositedScrollingOff: | 2081 case ForceCompositedScrollingOff: |
2067 return false; | 2082 return false; |
2068 } | 2083 } |
2069 | 2084 |
2070 ASSERT_NOT_REACHED(); | 2085 ASSERT_NOT_REACHED(); |
2071 return m_needsCompositedScrolling; | 2086 return m_needsCompositedScrolling; |
2072 } | 2087 } |
2073 | 2088 |
2074 void RenderLayer::updateNeedsCompositedScrolling() | 2089 void RenderLayer::updateNeedsCompositedScrolling() |
2075 { | 2090 { |
2091 if (RenderLayer* ancestor = ancestorStackingContext()) | |
2092 ancestor->updateDescendantsAreContiguousInStackingOrder(); | |
2093 | |
2076 bool needsCompositedScrolling = false; | 2094 bool needsCompositedScrolling = false; |
2077 | 2095 |
2078 FrameView* frameView = renderer()->view()->frameView(); | 2096 FrameView* frameView = renderer()->view()->frameView(); |
2079 if (frameView && frameView->containsScrollableArea(this)) { | 2097 if (frameView && frameView->containsScrollableArea(this)) { |
2080 updateDescendantDependentFlags(); | 2098 updateDescendantDependentFlags(); |
2081 | 2099 |
2082 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() | 2100 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() |
2083 && canBeStackingContainer() | 2101 && canBeStackingContainer() |
2084 && !hasOutOfFlowPositionedDescendant(); | 2102 && !hasUnclippedDescendant(); |
2085 | 2103 |
2086 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 2104 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
2087 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st yle()->useTouchOverflowScrolling(); | 2105 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st yle()->useTouchOverflowScrolling(); |
2088 #else | 2106 #else |
2089 needsCompositedScrolling = forceUseCompositedScrolling; | 2107 needsCompositedScrolling = forceUseCompositedScrolling; |
2090 #endif | 2108 #endif |
2091 // We gather a boolean value for use with Google UMA histograms to | 2109 // We gather a boolean value for use with Google UMA histograms to |
2092 // quantify the actual effects of a set of patches attempting to | 2110 // quantify the actual effects of a set of patches attempting to |
2093 // relax composited scrolling requirements, thereby increasing the | 2111 // relax composited scrolling requirements, thereby increasing the |
2094 // number of composited overflow divs. | 2112 // number of composited overflow divs. |
2095 if (acceleratedCompositingForOverflowScrollEnabled()) | 2113 if (acceleratedCompositingForOverflowScrollEnabled()) |
2096 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro lling", needsCompositedScrolling, 2); | 2114 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro lling", needsCompositedScrolling, 2); |
2097 } | 2115 } |
2098 | 2116 |
2117 setNeedsCompositedScrolling(needsCompositedScrolling); | |
2118 } | |
2119 | |
2120 void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling) | |
2121 { | |
2099 if (m_needsCompositedScrolling == needsCompositedScrolling) | 2122 if (m_needsCompositedScrolling == needsCompositedScrolling) |
2100 return; | 2123 return; |
2101 | 2124 |
2102 m_needsCompositedScrolling = needsCompositedScrolling; | 2125 m_needsCompositedScrolling = needsCompositedScrolling; |
2103 | 2126 |
2104 // Note, the z-order lists may need to be rebuilt, but our code guarantees | 2127 // Note, the z-order lists may need to be rebuilt, but our code guarantees |
2105 // that we have not affected stacking, so we will not dirty | 2128 // that we have not affected stacking, so we will not dirty |
2106 // m_canBePromotedToStackingContainer for either us or our stacking context | 2129 // m_canBePromotedToStackingContainer for either us or our stacking context |
2107 // or container. | 2130 // or container. |
2108 didUpdateNeedsCompositedScrolling(); | 2131 didUpdateNeedsCompositedScrolling(); |
(...skipping 3537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5646 | 5669 |
5647 if (m_posZOrderList) | 5670 if (m_posZOrderList) |
5648 m_posZOrderList->clear(); | 5671 m_posZOrderList->clear(); |
5649 if (m_negZOrderList) | 5672 if (m_negZOrderList) |
5650 m_negZOrderList->clear(); | 5673 m_negZOrderList->clear(); |
5651 m_zOrderListsDirty = true; | 5674 m_zOrderListsDirty = true; |
5652 | 5675 |
5653 m_descendantsAreContiguousInStackingOrderDirty = true; | 5676 m_descendantsAreContiguousInStackingOrderDirty = true; |
5654 | 5677 |
5655 if (!renderer()->documentBeingDestroyed()) { | 5678 if (!renderer()->documentBeingDestroyed()) { |
5679 compositor()->setNeedsUpdateCompositingRequirementsState(); | |
5656 compositor()->setCompositingLayersNeedRebuild(); | 5680 compositor()->setCompositingLayersNeedRebuild(); |
5657 if (acceleratedCompositingForOverflowScrollEnabled()) | 5681 if (acceleratedCompositingForOverflowScrollEnabled()) |
5658 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5682 compositor()->setShouldReevaluateCompositingAfterLayout(); |
5659 } | 5683 } |
5660 } | 5684 } |
5661 | 5685 |
5662 void RenderLayer::dirtyStackingContainerZOrderLists() | 5686 void RenderLayer::dirtyStackingContainerZOrderLists() |
5663 { | 5687 { |
5664 RenderLayer* stackingContainer = this->ancestorStackingContainer(); | 5688 RenderLayer* stackingContainer = this->ancestorStackingContainer(); |
5665 if (stackingContainer) | 5689 if (stackingContainer) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5784 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | 5808 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
5785 // Ignore reflections. | 5809 // Ignore reflections. |
5786 if (!m_reflection || reflectionLayer() != child) | 5810 if (!m_reflection || reflectionLayer() != child) |
5787 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContainer); | 5811 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContainer); |
5788 } | 5812 } |
5789 } | 5813 } |
5790 } | 5814 } |
5791 | 5815 |
5792 void RenderLayer::updateLayerListsIfNeeded() | 5816 void RenderLayer::updateLayerListsIfNeeded() |
5793 { | 5817 { |
5794 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; | |
5795 updateZOrderLists(); | 5818 updateZOrderLists(); |
5796 updateNormalFlowList(); | 5819 updateNormalFlowList(); |
5797 | 5820 |
5798 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { | 5821 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { |
5799 reflectionLayer->updateZOrderLists(); | 5822 reflectionLayer->updateZOrderLists(); |
5800 reflectionLayer->updateNormalFlowList(); | 5823 reflectionLayer->updateNormalFlowList(); |
5801 } | 5824 } |
5802 | |
5803 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { | |
5804 updateDescendantsAreContiguousInStackingOrder(); | |
5805 // The above function can cause us to update m_needsCompositedScrolling | |
5806 // and dirty our layer lists. Refresh them if necessary. | |
5807 updateZOrderLists(); | |
5808 updateNormalFlowList(); | |
5809 } | |
5810 } | 5825 } |
5811 | 5826 |
5812 void RenderLayer::repaintIncludingDescendants() | 5827 void RenderLayer::repaintIncludingDescendants() |
5813 { | 5828 { |
5814 renderer()->repaint(); | 5829 renderer()->repaint(); |
5815 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) | 5830 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) |
5816 curr->repaintIncludingDescendants(); | 5831 curr->repaintIncludingDescendants(); |
5817 } | 5832 } |
5818 | 5833 |
5819 void RenderLayer::setBackingNeedsRepaint() | 5834 void RenderLayer::setBackingNeedsRepaint() |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5972 return true; | 5987 return true; |
5973 | 5988 |
5974 if (hasVisibleBoxDecorations()) | 5989 if (hasVisibleBoxDecorations()) |
5975 return true; | 5990 return true; |
5976 | 5991 |
5977 return false; | 5992 return false; |
5978 } | 5993 } |
5979 | 5994 |
5980 void RenderLayer::updateVisibilityAfterStyleChange(const RenderStyle* oldStyle) | 5995 void RenderLayer::updateVisibilityAfterStyleChange(const RenderStyle* oldStyle) |
5981 { | 5996 { |
5982 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; | 5997 if (!oldStyle || (oldStyle->visibility() != renderer()->style()->visibility( ))) |
5983 if (oldVisibility == renderer()->style()->visibility() || !renderer()->isOut OfFlowPositioned()) | 5998 compositor()->setNeedsUpdateCompositingRequirementsState(); |
5984 return; | |
5985 | |
5986 if (renderer()->style()->visibility() == VISIBLE) | |
5987 setAncestorChainHasOutOfFlowPositionedDescendant(renderer()->containingB lock()); | |
5988 else | |
5989 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
5990 } | 5999 } |
5991 | 6000 |
5992 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle) | 6001 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle) |
5993 { | 6002 { |
5994 bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; | 6003 bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; |
5995 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; | 6004 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; |
5996 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; | 6005 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; |
5997 | 6006 |
5998 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could | 6007 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could |
5999 // likely be folded along with the rest. | 6008 // likely be folded along with the rest. |
6000 bool isStackingContext = this->isStackingContext(); | 6009 bool isStackingContext = this->isStackingContext(); |
6001 if (isStackingContext == wasStackingContext && oldVisibility == renderer()-> style()->visibility() && oldZIndex == renderer()->style()->zIndex()) | 6010 if (isStackingContext == wasStackingContext && oldVisibility == renderer()-> style()->visibility() && oldZIndex == renderer()->style()->zIndex()) |
6002 return; | 6011 return; |
6003 | 6012 |
6004 dirtyStackingContainerZOrderLists(); | 6013 dirtyStackingContainerZOrderLists(); |
6005 | 6014 |
6006 if (isStackingContainer()) | 6015 if (isStackingContainer()) |
6007 dirtyZOrderLists(); | 6016 dirtyZOrderLists(); |
6008 else | 6017 else |
6009 clearZOrderLists(); | 6018 clearZOrderLists(); |
6010 | 6019 |
6011 updateNeedsCompositedScrolling(); | 6020 compositor()->setNeedsUpdateCompositingRequirementsState(); |
6012 } | 6021 } |
6013 | 6022 |
6014 static bool overflowRequiresScrollbar(EOverflow overflow) | 6023 static bool overflowRequiresScrollbar(EOverflow overflow) |
6015 { | 6024 { |
6016 return overflow == OSCROLL; | 6025 return overflow == OSCROLL; |
6017 } | 6026 } |
6018 | 6027 |
6019 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 6028 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
6020 { | 6029 { |
6021 return overflow == OAUTO || overflow == OOVERLAY; | 6030 return overflow == OAUTO || overflow == OOVERLAY; |
(...skipping 28 matching lines...) Expand all Loading... | |
6050 | 6059 |
6051 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL & & overflowY != OSCROLL) { | 6060 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL & & overflowY != OSCROLL) { |
6052 ASSERT(hasVerticalScrollbar()); | 6061 ASSERT(hasVerticalScrollbar()); |
6053 m_vBar->setEnabled(true); | 6062 m_vBar->setEnabled(true); |
6054 } | 6063 } |
6055 | 6064 |
6056 if (!m_scrollDimensionsDirty) | 6065 if (!m_scrollDimensionsDirty) |
6057 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); | 6066 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); |
6058 } | 6067 } |
6059 | 6068 |
6060 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containingBlock) | |
6061 { | |
6062 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | |
6063 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl owPositionedDescendant()) | |
6064 break; | |
6065 | |
6066 layer->m_hasOutOfFlowPositionedDescendantDirty = false; | |
6067 layer->m_hasOutOfFlowPositionedDescendant = true; | |
6068 layer->updateNeedsCompositedScrolling(); | |
6069 | |
6070 if (layer->renderer() && layer->renderer() == containingBlock) | |
6071 break; | |
6072 } | |
6073 } | |
6074 | |
6075 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() | |
6076 { | |
6077 if (m_hasOutOfFlowPositionedDescendant) { | |
6078 m_hasOutOfFlowPositionedDescendantDirty = true; | |
6079 // FIXME It would be nice to avoid this when we clean up render layer | |
6080 // updating. We shouldn't have to update the composited scrolling state | |
6081 // nearly as frequently if all the updates happen in a single, well | |
6082 // defined phase. | |
6083 updateNeedsCompositedScrolling(); | |
6084 } | |
6085 | |
6086 if (parent()) | |
6087 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
6088 } | |
6089 | |
6090 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) | 6069 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) |
6091 { | 6070 { |
6071 if (oldStyle && (renderer()->style()->position() == oldStyle->position())) | |
esprehn
2013/05/08 21:56:40
This looks like a new optimization?
Ian Vollick
2013/05/09 01:27:42
Yep. If position() hasn't changed, we shouldn't do
| |
6072 return; | |
6073 | |
6092 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition); | 6074 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition); |
6093 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); | 6075 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); |
6094 if (parent() && isOutOfFlowPositioned != wasOutOfFlowPositioned) { | 6076 if (!wasOutOfFlowPositioned && !isOutOfFlowPositioned) |
6095 if (isOutOfFlowPositioned) | 6077 return; |
6096 parent()->setAncestorChainHasOutOfFlowPositionedDescendant(renderer( )->containingBlock()); | 6078 |
6097 else | 6079 // Even if the layer remains out-of-flow, a change to this property |
6098 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() ; | 6080 // will likely change its containing block. We must clear these bits |
6081 // so that they can be set properly by the RenderLayerCompositor. | |
6082 for (RenderLayer* ancestor = parent(); ancestor; ancestor = ancestor->parent ()) | |
6083 ancestor->m_hasUnclippedDescendant = false; | |
6084 | |
6085 // Ensures that we reset the above bits correctly. | |
6086 compositor()->setNeedsUpdateCompositingRequirementsState(); | |
6087 | |
6088 if (wasOutOfFlowPositioned && isOutOfFlowPositioned) | |
6089 return; | |
6090 | |
6091 if (isOutOfFlowPositioned) { | |
6092 setAncestorChainHasOutOfFlowPositionedDescendant(); | |
6093 compositor()->addOutOfFlowPositionedLayer(this); | |
6094 } else { | |
6095 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | |
6096 compositor()->removeOutOfFlowPositionedLayer(this); | |
6099 } | 6097 } |
6100 } | 6098 } |
6101 | 6099 |
6102 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle) | 6100 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle) |
6103 { | 6101 { |
6104 ASSERT(newStyle); | 6102 ASSERT(newStyle); |
6105 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); | 6103 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); |
6106 } | 6104 } |
6107 | 6105 |
6108 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const | 6106 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6255 | 6253 |
6256 FrameView* frameView = frame->view(); | 6254 FrameView* frameView = frame->view(); |
6257 if (!frameView) | 6255 if (!frameView) |
6258 return; | 6256 return; |
6259 | 6257 |
6260 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); | 6258 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); |
6261 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) | 6259 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) |
6262 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); | 6260 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); |
6263 | 6261 |
6264 bool updatedScrollableAreaSet = false; | 6262 bool updatedScrollableAreaSet = false; |
6265 if (hasOverflow && isVisibleToHitTest) | 6263 if (hasOverflow && isVisibleToHitTest) { |
6266 updatedScrollableAreaSet = frameView->addScrollableArea(this); | 6264 if (frameView->addScrollableArea(this)) |
6267 else | 6265 compositor()->setNeedsUpdateCompositingRequirementsState(); |
6268 updatedScrollableAreaSet = frameView->removeScrollableArea(this); | 6266 } else { |
6269 | 6267 if (frameView->removeScrollableArea(this)) |
6270 if (updatedScrollableAreaSet) | 6268 setNeedsCompositedScrolling(false); |
6271 updateNeedsCompositedScrolling(); | 6269 } |
6272 } | 6270 } |
6273 | 6271 |
6274 void RenderLayer::updateScrollCornerStyle() | 6272 void RenderLayer::updateScrollCornerStyle() |
6275 { | 6273 { |
6276 RenderObject* actualRenderer = rendererForScrollbar(renderer()); | 6274 RenderObject* actualRenderer = rendererForScrollbar(renderer()); |
6277 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); | 6275 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); |
6278 if (corner) { | 6276 if (corner) { |
6279 if (!m_scrollCorner) { | 6277 if (!m_scrollCorner) { |
6280 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument()); | 6278 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument()); |
6281 m_scrollCorner->setParent(renderer()); | 6279 m_scrollCorner->setParent(renderer()); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6512 } | 6510 } |
6513 } | 6511 } |
6514 | 6512 |
6515 void showLayerTree(const WebCore::RenderObject* renderer) | 6513 void showLayerTree(const WebCore::RenderObject* renderer) |
6516 { | 6514 { |
6517 if (!renderer) | 6515 if (!renderer) |
6518 return; | 6516 return; |
6519 showLayerTree(renderer->enclosingLayer()); | 6517 showLayerTree(renderer->enclosingLayer()); |
6520 } | 6518 } |
6521 #endif | 6519 #endif |
OLD | NEW |