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); | |
Julien - ping for review
2013/05/09 23:26:41
This is called even if a RenderLayer is not out-of
| |
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->setHasOutOfFlowPositionedDescendantDirty(false); | |
497 layer->setHasOutOfFlowPositionedDescendant(true); | |
498 } | |
499 } | |
500 | |
501 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() | |
502 { | |
503 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | |
504 layer->setHasOutOfFlowPositionedDescendantDirty(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->setHasUnclippedDescendant(false); | |
Julien - ping for review
2013/05/09 23:26:41
This is an optimistic reset (not repeated for the
| |
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 void RenderLayer::updateHasUnclippedDescendant() |
1158 { | |
1159 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant") ; | |
1160 ASSERT(renderer()->isOutOfFlowPositioned()); | |
1161 if (!m_hasVisibleContent && !m_hasVisibleDescendant) | |
1162 return; | |
1163 | |
1164 const RenderObject* containingBlock = renderer()->containingBlock(); | |
1165 for (RenderLayer* ancestor = parent(); ancestor && ancestor->renderer() != c ontainingBlock; ancestor = ancestor->parent()) | |
1166 ancestor->setHasUnclippedDescendant(true); | |
1167 } | |
1168 | |
1169 static bool subtreeContainsOutOfFlowPositionedLayer(const RenderLayer* subtreeRo ot) | |
1170 { | |
1171 return (subtreeRoot->renderer() && subtreeRoot->renderer()->isOutOfFlowPosit ioned()) || subtreeRoot->hasOutOfFlowPositionedDescendant(); | |
1172 } | |
1173 | |
1174 void RenderLayer::updateDescendantDependentFlags() | |
1129 { | 1175 { |
1130 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty) { | 1176 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; | 1177 m_hasVisibleDescendant = false; |
1135 m_hasSelfPaintingLayerDescendant = false; | 1178 m_hasSelfPaintingLayerDescendant = false; |
1136 m_hasOutOfFlowPositionedDescendant = false; | 1179 m_hasOutOfFlowPositionedDescendant = false; |
1137 | 1180 |
1138 HashSet<const RenderObject*> childOutOfFlowDescendantContainingBlocks; | |
1139 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | 1181 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
1140 childOutOfFlowDescendantContainingBlocks.clear(); | 1182 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 | 1183 |
1153 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; | 1184 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; |
1154 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); | 1185 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); |
1155 bool hasOutOfFlowPositionedDescendant = hasVisibleDescendant && (!ch ildOutOfFlowDescendantContainingBlocks.isEmpty() || child->hasOutOfFlowPositione dDescendant()); | 1186 bool hasOutOfFlowPositionedDescendant = subtreeContainsOutOfFlowPosi tionedLayer(child); |
1156 | 1187 |
1157 m_hasVisibleDescendant |= hasVisibleDescendant; | 1188 m_hasVisibleDescendant |= hasVisibleDescendant; |
1158 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; | 1189 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; |
1159 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt; | 1190 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt; |
1160 | 1191 |
1161 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_ hasOutOfFlowPositionedDescendant) | 1192 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && ha sOutOfFlowPositionedDescendant) |
1162 break; | 1193 break; |
1163 } | 1194 } |
1164 | 1195 |
1165 if (outOfFlowDescendantContainingBlocks && renderer()) | |
1166 outOfFlowDescendantContainingBlocks->remove(renderer()); | |
1167 | |
1168 m_visibleDescendantStatusDirty = false; | 1196 m_visibleDescendantStatusDirty = false; |
1169 m_hasSelfPaintingLayerDescendantDirty = false; | 1197 m_hasSelfPaintingLayerDescendantDirty = false; |
1170 m_hasOutOfFlowPositionedDescendantDirty = false; | 1198 m_hasOutOfFlowPositionedDescendantDirty = false; |
1171 | |
1172 if (m_hasVisibleDescendant != hadVisibleDescendant || m_hasOutOfFlowPosi tionedDescendant != hadOutOfFlowPositionedDescendant) | |
1173 updateNeedsCompositedScrolling(); | |
1174 } | 1199 } |
1175 | 1200 |
1176 if (m_visibleContentStatusDirty) { | 1201 if (m_visibleContentStatusDirty) { |
1177 const bool hadVisibleContent = m_hasVisibleContent; | |
1178 if (renderer()->style()->visibility() == VISIBLE) | 1202 if (renderer()->style()->visibility() == VISIBLE) |
1179 m_hasVisibleContent = true; | 1203 m_hasVisibleContent = true; |
1180 else { | 1204 else { |
1181 // layer may be hidden but still have some visible content, check fo r this | 1205 // layer may be hidden but still have some visible content, check fo r this |
1182 m_hasVisibleContent = false; | 1206 m_hasVisibleContent = false; |
1183 RenderObject* r = renderer()->firstChild(); | 1207 RenderObject* r = renderer()->firstChild(); |
1184 while (r) { | 1208 while (r) { |
1185 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { | 1209 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { |
1186 m_hasVisibleContent = true; | 1210 m_hasVisibleContent = true; |
1187 break; | 1211 break; |
1188 } | 1212 } |
1189 if (r->firstChild() && !r->hasLayer()) | 1213 if (r->firstChild() && !r->hasLayer()) |
1190 r = r->firstChild(); | 1214 r = r->firstChild(); |
1191 else if (r->nextSibling()) | 1215 else if (r->nextSibling()) |
1192 r = r->nextSibling(); | 1216 r = r->nextSibling(); |
1193 else { | 1217 else { |
1194 do { | 1218 do { |
1195 r = r->parent(); | 1219 r = r->parent(); |
1196 if (r == renderer()) | 1220 if (r == renderer()) |
1197 r = 0; | 1221 r = 0; |
1198 } while (r && !r->nextSibling()); | 1222 } while (r && !r->nextSibling()); |
1199 if (r) | 1223 if (r) |
1200 r = r->nextSibling(); | 1224 r = r->nextSibling(); |
1201 } | 1225 } |
1202 } | 1226 } |
1203 } | 1227 } |
1204 m_visibleContentStatusDirty = false; | 1228 m_visibleContentStatusDirty = false; |
1205 if (hadVisibleContent != m_hasVisibleContent) | |
1206 updateNeedsCompositedScrolling(); | |
1207 } | 1229 } |
1208 } | 1230 } |
1209 | 1231 |
1210 void RenderLayer::dirty3DTransformedDescendantStatus() | 1232 void RenderLayer::dirty3DTransformedDescendantStatus() |
1211 { | 1233 { |
1212 RenderLayer* curr = ancestorStackingContainer(); | 1234 RenderLayer* curr = ancestorStackingContainer(); |
1213 if (curr) | 1235 if (curr) |
1214 curr->m_3DTransformedDescendantStatusDirty = true; | 1236 curr->m_3DTransformedDescendantStatusDirty = true; |
1215 | 1237 |
1216 // This propagates up through preserve-3d hierarchies to the enclosing flatt ening layer. | 1238 // 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); | 1789 child->setParent(this); |
1768 | 1790 |
1769 if (child->isNormalFlowOnly()) | 1791 if (child->isNormalFlowOnly()) |
1770 dirtyNormalFlowList(); | 1792 dirtyNormalFlowList(); |
1771 | 1793 |
1772 if (!child->isNormalFlowOnly() || child->firstChild()) { | 1794 if (!child->isNormalFlowOnly() || child->firstChild()) { |
1773 // Dirty the z-order list in which we are contained. The ancestorStackin gContainer() can be null in the | 1795 // 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 | 1796 // 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. | 1797 // off dirty in that case anyway. |
1776 child->dirtyStackingContainerZOrderLists(); | 1798 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 } | 1799 } |
1788 | 1800 |
1789 child->updateDescendantDependentFlags(); | 1801 child->updateDescendantDependentFlags(); |
1790 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) | 1802 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) |
1791 setAncestorChainHasVisibleDescendant(); | 1803 setAncestorChainHasVisibleDescendant(); |
1792 | 1804 |
1793 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) | 1805 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) |
1794 setAncestorChainHasSelfPaintingLayerDescendant(); | 1806 setAncestorChainHasSelfPaintingLayerDescendant(); |
1795 | 1807 |
1796 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil d->hasOutOfFlowPositionedDescendant())) | 1808 if (subtreeContainsOutOfFlowPositionedLayer(child)) { |
1797 setAncestorChainHasOutOfFlowPositionedDescendant(child->renderer()->cont ainingBlock()); | 1809 // Now that the out of flow positioned descendant is in the tree, we |
1810 // need to tell the compositor to reevaluate the compositing | |
1811 // requirements since we may be able to mark more layers as having | |
1812 // an 'unclipped' descendant. | |
1813 compositor()->setNeedsUpdateCompositingRequirementsState(); | |
1814 setAncestorChainHasOutOfFlowPositionedDescendant(); | |
1815 } | |
1798 | 1816 |
1799 compositor()->layerWasAdded(this, child); | 1817 compositor()->layerWasAdded(this, child); |
1800 } | 1818 } |
1801 | 1819 |
1802 RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) | 1820 RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) |
1803 { | 1821 { |
1804 if (!renderer()->documentBeingDestroyed()) | 1822 if (!renderer()->documentBeingDestroyed()) |
1805 compositor()->layerWillBeRemoved(this, oldChild); | 1823 compositor()->layerWillBeRemoved(this, oldChild); |
1806 | 1824 |
1807 // remove the child | 1825 // remove the child |
1808 if (oldChild->previousSibling()) | 1826 if (oldChild->previousSibling()) |
1809 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); | 1827 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); |
1810 if (oldChild->nextSibling()) | 1828 if (oldChild->nextSibling()) |
1811 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; | 1829 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; |
1812 | 1830 |
1813 if (m_first == oldChild) | 1831 if (m_first == oldChild) |
1814 m_first = oldChild->nextSibling(); | 1832 m_first = oldChild->nextSibling(); |
1815 if (m_last == oldChild) | 1833 if (m_last == oldChild) |
1816 m_last = oldChild->previousSibling(); | 1834 m_last = oldChild->previousSibling(); |
1817 | 1835 |
1818 if (oldChild->isNormalFlowOnly()) | 1836 if (oldChild->isNormalFlowOnly()) |
1819 dirtyNormalFlowList(); | 1837 dirtyNormalFlowList(); |
1820 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { | 1838 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { |
1821 // Dirty the z-order list in which we are contained. When called via th e | 1839 // 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 | 1840 // 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. | 1841 // from the main layer tree, so we need to null-check the |stackingConta iner| value. |
1824 oldChild->dirtyStackingContainerZOrderLists(); | 1842 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 } | 1843 } |
1838 | 1844 |
1839 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned()) || oldChild->hasOutOfFlowPositionedDescendant()) | |
1840 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
1841 | |
1842 oldChild->setPreviousSibling(0); | 1845 oldChild->setPreviousSibling(0); |
1843 oldChild->setNextSibling(0); | 1846 oldChild->setNextSibling(0); |
1844 oldChild->setParent(0); | 1847 oldChild->setParent(0); |
1845 | 1848 |
1846 oldChild->updateDescendantDependentFlags(); | 1849 oldChild->updateDescendantDependentFlags(); |
1850 if (subtreeContainsOutOfFlowPositionedLayer(oldChild)) { | |
1851 // It may now be the case that a layer no longer has an unclipped | |
1852 // descendant. Let the compositor know that it needs to reevaluate | |
1853 // its compositing requirements to check this. | |
1854 compositor()->setNeedsUpdateCompositingRequirementsState(); | |
1855 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
1856 } | |
1857 | |
1847 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1858 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
1848 dirtyAncestorChainVisibleDescendantStatus(); | 1859 dirtyAncestorChainVisibleDescendantStatus(); |
1849 | 1860 |
1850 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) | 1861 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) |
1851 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1862 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
1852 | 1863 |
1853 return oldChild; | 1864 return oldChild; |
1854 } | 1865 } |
1855 | 1866 |
1856 void RenderLayer::removeOnlyThisLayer() | 1867 void RenderLayer::removeOnlyThisLayer() |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2066 case ForceCompositedScrollingOff: | 2077 case ForceCompositedScrollingOff: |
2067 return false; | 2078 return false; |
2068 } | 2079 } |
2069 | 2080 |
2070 ASSERT_NOT_REACHED(); | 2081 ASSERT_NOT_REACHED(); |
2071 return m_needsCompositedScrolling; | 2082 return m_needsCompositedScrolling; |
2072 } | 2083 } |
2073 | 2084 |
2074 void RenderLayer::updateNeedsCompositedScrolling() | 2085 void RenderLayer::updateNeedsCompositedScrolling() |
2075 { | 2086 { |
2087 if (RenderLayer* ancestor = ancestorStackingContext()) | |
2088 ancestor->updateDescendantsAreContiguousInStackingOrder(); | |
2089 | |
2076 bool needsCompositedScrolling = false; | 2090 bool needsCompositedScrolling = false; |
2077 | 2091 |
2078 FrameView* frameView = renderer()->view()->frameView(); | 2092 FrameView* frameView = renderer()->view()->frameView(); |
2079 if (frameView && frameView->containsScrollableArea(this)) { | 2093 if (frameView && frameView->containsScrollableArea(this)) { |
2080 updateDescendantDependentFlags(); | 2094 updateDescendantDependentFlags(); |
2081 | 2095 |
2082 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() | 2096 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() |
2083 && canBeStackingContainer() | 2097 && canBeStackingContainer() |
2084 && !hasOutOfFlowPositionedDescendant(); | 2098 && !hasUnclippedDescendant(); |
2085 | 2099 |
2086 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 2100 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
2087 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st yle()->useTouchOverflowScrolling(); | 2101 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st yle()->useTouchOverflowScrolling(); |
2088 #else | 2102 #else |
2089 needsCompositedScrolling = forceUseCompositedScrolling; | 2103 needsCompositedScrolling = forceUseCompositedScrolling; |
2090 #endif | 2104 #endif |
2091 // We gather a boolean value for use with Google UMA histograms to | 2105 // We gather a boolean value for use with Google UMA histograms to |
2092 // quantify the actual effects of a set of patches attempting to | 2106 // quantify the actual effects of a set of patches attempting to |
2093 // relax composited scrolling requirements, thereby increasing the | 2107 // relax composited scrolling requirements, thereby increasing the |
2094 // number of composited overflow divs. | 2108 // number of composited overflow divs. |
2095 if (acceleratedCompositingForOverflowScrollEnabled()) | 2109 if (acceleratedCompositingForOverflowScrollEnabled()) |
2096 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro lling", needsCompositedScrolling, 2); | 2110 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro lling", needsCompositedScrolling, 2); |
2097 } | 2111 } |
2098 | 2112 |
2113 setNeedsCompositedScrolling(needsCompositedScrolling); | |
2114 } | |
2115 | |
2116 void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling) | |
2117 { | |
2099 if (m_needsCompositedScrolling == needsCompositedScrolling) | 2118 if (m_needsCompositedScrolling == needsCompositedScrolling) |
2100 return; | 2119 return; |
2101 | 2120 |
2102 m_needsCompositedScrolling = needsCompositedScrolling; | 2121 m_needsCompositedScrolling = needsCompositedScrolling; |
2103 | 2122 |
2104 // Note, the z-order lists may need to be rebuilt, but our code guarantees | 2123 // 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 | 2124 // that we have not affected stacking, so we will not dirty |
2106 // m_canBePromotedToStackingContainer for either us or our stacking context | 2125 // m_canBePromotedToStackingContainer for either us or our stacking context |
2107 // or container. | 2126 // or container. |
2108 didUpdateNeedsCompositedScrolling(); | 2127 didUpdateNeedsCompositedScrolling(); |
(...skipping 3537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5646 | 5665 |
5647 if (m_posZOrderList) | 5666 if (m_posZOrderList) |
5648 m_posZOrderList->clear(); | 5667 m_posZOrderList->clear(); |
5649 if (m_negZOrderList) | 5668 if (m_negZOrderList) |
5650 m_negZOrderList->clear(); | 5669 m_negZOrderList->clear(); |
5651 m_zOrderListsDirty = true; | 5670 m_zOrderListsDirty = true; |
5652 | 5671 |
5653 m_descendantsAreContiguousInStackingOrderDirty = true; | 5672 m_descendantsAreContiguousInStackingOrderDirty = true; |
5654 | 5673 |
5655 if (!renderer()->documentBeingDestroyed()) { | 5674 if (!renderer()->documentBeingDestroyed()) { |
5675 compositor()->setNeedsUpdateCompositingRequirementsState(); | |
5656 compositor()->setCompositingLayersNeedRebuild(); | 5676 compositor()->setCompositingLayersNeedRebuild(); |
5657 if (acceleratedCompositingForOverflowScrollEnabled()) | 5677 if (acceleratedCompositingForOverflowScrollEnabled()) |
5658 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5678 compositor()->setShouldReevaluateCompositingAfterLayout(); |
5659 } | 5679 } |
5660 } | 5680 } |
5661 | 5681 |
5662 void RenderLayer::dirtyStackingContainerZOrderLists() | 5682 void RenderLayer::dirtyStackingContainerZOrderLists() |
5663 { | 5683 { |
5664 RenderLayer* stackingContainer = this->ancestorStackingContainer(); | 5684 RenderLayer* stackingContainer = this->ancestorStackingContainer(); |
5665 if (stackingContainer) | 5685 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()) { | 5804 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
5785 // Ignore reflections. | 5805 // Ignore reflections. |
5786 if (!m_reflection || reflectionLayer() != child) | 5806 if (!m_reflection || reflectionLayer() != child) |
5787 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContainer); | 5807 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer, layerToForceAsStackingContainer); |
5788 } | 5808 } |
5789 } | 5809 } |
5790 } | 5810 } |
5791 | 5811 |
5792 void RenderLayer::updateLayerListsIfNeeded() | 5812 void RenderLayer::updateLayerListsIfNeeded() |
5793 { | 5813 { |
5794 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; | |
5795 updateZOrderLists(); | 5814 updateZOrderLists(); |
5796 updateNormalFlowList(); | 5815 updateNormalFlowList(); |
5797 | 5816 |
5798 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { | 5817 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { |
5799 reflectionLayer->updateZOrderLists(); | 5818 reflectionLayer->updateZOrderLists(); |
5800 reflectionLayer->updateNormalFlowList(); | 5819 reflectionLayer->updateNormalFlowList(); |
5801 } | 5820 } |
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 } | 5821 } |
5811 | 5822 |
5812 void RenderLayer::repaintIncludingDescendants() | 5823 void RenderLayer::repaintIncludingDescendants() |
5813 { | 5824 { |
5814 renderer()->repaint(); | 5825 renderer()->repaint(); |
5815 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) | 5826 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) |
5816 curr->repaintIncludingDescendants(); | 5827 curr->repaintIncludingDescendants(); |
5817 } | 5828 } |
5818 | 5829 |
5819 void RenderLayer::setBackingNeedsRepaint() | 5830 void RenderLayer::setBackingNeedsRepaint() |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5972 return true; | 5983 return true; |
5973 | 5984 |
5974 if (hasVisibleBoxDecorations()) | 5985 if (hasVisibleBoxDecorations()) |
5975 return true; | 5986 return true; |
5976 | 5987 |
5977 return false; | 5988 return false; |
5978 } | 5989 } |
5979 | 5990 |
5980 void RenderLayer::updateVisibilityAfterStyleChange(const RenderStyle* oldStyle) | 5991 void RenderLayer::updateVisibilityAfterStyleChange(const RenderStyle* oldStyle) |
5981 { | 5992 { |
5982 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; | 5993 if (!oldStyle || (oldStyle->visibility() != renderer()->style()->visibility( ))) |
Julien - ping for review
2013/05/09 23:26:41
/me still prefers early returns, especially since
| |
5983 if (oldVisibility == renderer()->style()->visibility() || !renderer()->isOut OfFlowPositioned()) | 5994 compositor()->setNeedsUpdateCompositingRequirementsState(); |
5984 return; | |
5985 | |
5986 if (renderer()->style()->visibility() == VISIBLE) | |
5987 setAncestorChainHasOutOfFlowPositionedDescendant(renderer()->containingB lock()); | |
5988 else | |
5989 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
5990 } | 5995 } |
5991 | 5996 |
5992 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle) | 5997 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle) |
5993 { | 5998 { |
5994 bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; | 5999 bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; |
5995 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; | 6000 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; |
5996 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; | 6001 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; |
5997 | 6002 |
5998 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could | 6003 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could |
5999 // likely be folded along with the rest. | 6004 // likely be folded along with the rest. |
6000 bool isStackingContext = this->isStackingContext(); | 6005 bool isStackingContext = this->isStackingContext(); |
6001 if (isStackingContext == wasStackingContext && oldVisibility == renderer()-> style()->visibility() && oldZIndex == renderer()->style()->zIndex()) | 6006 if (isStackingContext == wasStackingContext && oldVisibility == renderer()-> style()->visibility() && oldZIndex == renderer()->style()->zIndex()) |
6002 return; | 6007 return; |
6003 | 6008 |
6004 dirtyStackingContainerZOrderLists(); | 6009 dirtyStackingContainerZOrderLists(); |
6005 | 6010 |
6006 if (isStackingContainer()) | 6011 if (isStackingContainer()) |
6007 dirtyZOrderLists(); | 6012 dirtyZOrderLists(); |
6008 else | 6013 else |
6009 clearZOrderLists(); | 6014 clearZOrderLists(); |
6010 | 6015 |
6011 updateNeedsCompositedScrolling(); | 6016 compositor()->setNeedsUpdateCompositingRequirementsState(); |
6012 } | 6017 } |
6013 | 6018 |
6014 static bool overflowRequiresScrollbar(EOverflow overflow) | 6019 static bool overflowRequiresScrollbar(EOverflow overflow) |
6015 { | 6020 { |
6016 return overflow == OSCROLL; | 6021 return overflow == OSCROLL; |
6017 } | 6022 } |
6018 | 6023 |
6019 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 6024 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
6020 { | 6025 { |
6021 return overflow == OAUTO || overflow == OOVERLAY; | 6026 return overflow == OAUTO || overflow == OOVERLAY; |
(...skipping 28 matching lines...) Expand all Loading... | |
6050 | 6055 |
6051 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL & & overflowY != OSCROLL) { | 6056 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL & & overflowY != OSCROLL) { |
6052 ASSERT(hasVerticalScrollbar()); | 6057 ASSERT(hasVerticalScrollbar()); |
6053 m_vBar->setEnabled(true); | 6058 m_vBar->setEnabled(true); |
6054 } | 6059 } |
6055 | 6060 |
6056 if (!m_scrollDimensionsDirty) | 6061 if (!m_scrollDimensionsDirty) |
6057 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); | 6062 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); |
6058 } | 6063 } |
6059 | 6064 |
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) | 6065 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) |
6091 { | 6066 { |
6067 if (oldStyle && (renderer()->style()->position() == oldStyle->position())) | |
6068 return; | |
6069 | |
6092 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition); | 6070 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition); |
6093 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); | 6071 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); |
6094 if (parent() && isOutOfFlowPositioned != wasOutOfFlowPositioned) { | 6072 if (!wasOutOfFlowPositioned && !isOutOfFlowPositioned) |
6095 if (isOutOfFlowPositioned) | 6073 return; |
6096 parent()->setAncestorChainHasOutOfFlowPositionedDescendant(renderer( )->containingBlock()); | 6074 |
6097 else | 6075 // Even if the layer remains out-of-flow, a change to this property |
6098 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() ; | 6076 // will likely change its containing block. We must clear these bits |
6077 // so that they can be set properly by the RenderLayerCompositor. | |
6078 for (RenderLayer* ancestor = parent(); ancestor; ancestor = ancestor->parent ()) | |
6079 ancestor->setHasUnclippedDescendant(false); | |
6080 | |
6081 // Ensures that we reset the above bits correctly. | |
6082 compositor()->setNeedsUpdateCompositingRequirementsState(); | |
6083 | |
6084 if (wasOutOfFlowPositioned && isOutOfFlowPositioned) | |
6085 return; | |
6086 | |
6087 if (isOutOfFlowPositioned) { | |
6088 setAncestorChainHasOutOfFlowPositionedDescendant(); | |
6089 compositor()->addOutOfFlowPositionedLayer(this); | |
6090 } else { | |
6091 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | |
6092 compositor()->removeOutOfFlowPositionedLayer(this); | |
6099 } | 6093 } |
6100 } | 6094 } |
6101 | 6095 |
6102 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle) | 6096 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle) |
6103 { | 6097 { |
6104 ASSERT(newStyle); | 6098 ASSERT(newStyle); |
6105 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); | 6099 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); |
6106 } | 6100 } |
6107 | 6101 |
6108 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle* oldStyle, const RenderStyle* newStyle) const | 6102 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 | 6249 |
6256 FrameView* frameView = frame->view(); | 6250 FrameView* frameView = frame->view(); |
6257 if (!frameView) | 6251 if (!frameView) |
6258 return; | 6252 return; |
6259 | 6253 |
6260 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); | 6254 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); |
6261 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) | 6255 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) |
6262 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); | 6256 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); |
6263 | 6257 |
6264 bool updatedScrollableAreaSet = false; | 6258 bool updatedScrollableAreaSet = false; |
6265 if (hasOverflow && isVisibleToHitTest) | 6259 if (hasOverflow && isVisibleToHitTest) { |
6266 updatedScrollableAreaSet = frameView->addScrollableArea(this); | 6260 if (frameView->addScrollableArea(this)) |
6267 else | 6261 compositor()->setNeedsUpdateCompositingRequirementsState(); |
6268 updatedScrollableAreaSet = frameView->removeScrollableArea(this); | 6262 } else { |
6269 | 6263 if (frameView->removeScrollableArea(this)) |
6270 if (updatedScrollableAreaSet) | 6264 setNeedsCompositedScrolling(false); |
6271 updateNeedsCompositedScrolling(); | 6265 } |
6272 } | 6266 } |
6273 | 6267 |
6274 void RenderLayer::updateScrollCornerStyle() | 6268 void RenderLayer::updateScrollCornerStyle() |
6275 { | 6269 { |
6276 RenderObject* actualRenderer = rendererForScrollbar(renderer()); | 6270 RenderObject* actualRenderer = rendererForScrollbar(renderer()); |
6277 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); | 6271 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); |
6278 if (corner) { | 6272 if (corner) { |
6279 if (!m_scrollCorner) { | 6273 if (!m_scrollCorner) { |
6280 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument()); | 6274 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument()); |
6281 m_scrollCorner->setParent(renderer()); | 6275 m_scrollCorner->setParent(renderer()); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6512 } | 6506 } |
6513 } | 6507 } |
6514 | 6508 |
6515 void showLayerTree(const WebCore::RenderObject* renderer) | 6509 void showLayerTree(const WebCore::RenderObject* renderer) |
6516 { | 6510 { |
6517 if (!renderer) | 6511 if (!renderer) |
6518 return; | 6512 return; |
6519 showLayerTree(renderer->enclosingLayer()); | 6513 showLayerTree(renderer->enclosingLayer()); |
6520 } | 6514 } |
6521 #endif | 6515 #endif |
OLD | NEW |