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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "core/page/Settings.h" | 65 #include "core/page/Settings.h" |
66 #include "core/page/UseCounter.h" | 66 #include "core/page/UseCounter.h" |
67 #include "core/page/animation/AnimationController.h" | 67 #include "core/page/animation/AnimationController.h" |
68 #include "core/page/scrolling/ScrollingCoordinator.h" | 68 #include "core/page/scrolling/ScrollingCoordinator.h" |
69 #include "core/platform/HistogramSupport.h" | 69 #include "core/platform/HistogramSupport.h" |
70 #include "core/platform/PlatformGestureEvent.h" | 70 #include "core/platform/PlatformGestureEvent.h" |
71 #include "core/platform/PlatformMouseEvent.h" | 71 #include "core/platform/PlatformMouseEvent.h" |
72 #include "core/platform/ScrollAnimator.h" | 72 #include "core/platform/ScrollAnimator.h" |
73 #include "core/platform/Scrollbar.h" | 73 #include "core/platform/Scrollbar.h" |
74 #include "core/platform/ScrollbarTheme.h" | 74 #include "core/platform/ScrollbarTheme.h" |
| 75 #include "core/platform/chromium/TraceEvent.h" |
75 #include "core/platform/graphics/FloatPoint3D.h" | 76 #include "core/platform/graphics/FloatPoint3D.h" |
76 #include "core/platform/graphics/FloatRect.h" | 77 #include "core/platform/graphics/FloatRect.h" |
77 #include "core/platform/graphics/GraphicsContextStateSaver.h" | 78 #include "core/platform/graphics/GraphicsContextStateSaver.h" |
78 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h" | 79 #include "core/platform/graphics/filters/custom/CustomFilterGlobalContext.h" |
79 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" | 80 #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" |
80 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h" | 81 #include "core/platform/graphics/filters/custom/CustomFilterValidatedProgram.h" |
81 #include "core/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h
" | 82 #include "core/platform/graphics/filters/custom/ValidatedCustomFilterOperation.h
" |
82 #include "core/platform/graphics/transforms/ScaleTransformOperation.h" | 83 #include "core/platform/graphics/transforms/ScaleTransformOperation.h" |
83 #include "core/platform/graphics/transforms/TransformationMatrix.h" | 84 #include "core/platform/graphics/transforms/TransformationMatrix.h" |
84 #include "core/platform/graphics/transforms/TranslateTransformOperation.h" | 85 #include "core/platform/graphics/transforms/TranslateTransformOperation.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 125 } |
125 | 126 |
126 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) | 127 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
127 : m_inResizeMode(false) | 128 : m_inResizeMode(false) |
128 , m_scrollDimensionsDirty(true) | 129 , m_scrollDimensionsDirty(true) |
129 , m_normalFlowListDirty(true) | 130 , m_normalFlowListDirty(true) |
130 , m_hasSelfPaintingLayerDescendant(false) | 131 , m_hasSelfPaintingLayerDescendant(false) |
131 , m_hasSelfPaintingLayerDescendantDirty(false) | 132 , m_hasSelfPaintingLayerDescendantDirty(false) |
132 , m_hasOutOfFlowPositionedDescendant(false) | 133 , m_hasOutOfFlowPositionedDescendant(false) |
133 , m_hasOutOfFlowPositionedDescendantDirty(true) | 134 , m_hasOutOfFlowPositionedDescendantDirty(true) |
| 135 , m_hasUnclippedDescendant(false) |
134 , m_needsCompositedScrolling(false) | 136 , m_needsCompositedScrolling(false) |
135 , m_descendantsAreContiguousInStackingOrder(false) | 137 , m_descendantsAreContiguousInStackingOrder(false) |
136 , m_descendantsAreContiguousInStackingOrderDirty(true) | 138 , m_descendantsAreContiguousInStackingOrderDirty(true) |
137 , m_isRootLayer(renderer->isRenderView()) | 139 , m_isRootLayer(renderer->isRenderView()) |
138 , m_usedTransparency(false) | 140 , m_usedTransparency(false) |
139 , m_paintingInsideReflection(false) | 141 , m_paintingInsideReflection(false) |
140 , m_inOverflowRelayout(false) | 142 , m_inOverflowRelayout(false) |
141 , m_repaintStatus(NeedsNormalRepaint) | 143 , m_repaintStatus(NeedsNormalRepaint) |
142 , m_visibleContentStatusDirty(true) | 144 , m_visibleContentStatusDirty(true) |
143 , m_hasVisibleContent(false) | 145 , m_hasVisibleContent(false) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 frameView->removeResizerArea(this); | 210 frameView->removeResizerArea(this); |
209 } | 211 } |
210 } | 212 } |
211 | 213 |
212 if (!m_renderer->documentBeingDestroyed()) { | 214 if (!m_renderer->documentBeingDestroyed()) { |
213 Node* node = m_renderer->node(); | 215 Node* node = m_renderer->node(); |
214 if (node && node->isElementNode()) | 216 if (node && node->isElementNode()) |
215 toElement(node)->setSavedLayerScrollOffset(m_scrollOffset); | 217 toElement(node)->setSavedLayerScrollOffset(m_scrollOffset); |
216 } | 218 } |
217 | 219 |
| 220 if (!m_renderer->documentBeingDestroyed()) |
| 221 compositor()->removeOutOfFlowPositionedLayer(this); |
| 222 |
218 destroyScrollbar(HorizontalScrollbar); | 223 destroyScrollbar(HorizontalScrollbar); |
219 destroyScrollbar(VerticalScrollbar); | 224 destroyScrollbar(VerticalScrollbar); |
220 | 225 |
221 if (renderer()->frame() && renderer()->frame()->page()) { | 226 if (renderer()->frame() && renderer()->frame()->page()) { |
222 if (ScrollingCoordinator* scrollingCoordinator = renderer()->frame()->pa
ge()->scrollingCoordinator()) | 227 if (ScrollingCoordinator* scrollingCoordinator = renderer()->frame()->pa
ge()->scrollingCoordinator()) |
223 scrollingCoordinator->willDestroyScrollableArea(this); | 228 scrollingCoordinator->willDestroyScrollableArea(this); |
224 } | 229 } |
225 | 230 |
226 if (m_reflection) | 231 if (m_reflection) |
227 removeReflection(); | 232 removeReflection(); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 layer->m_hasSelfPaintingLayerDescendantDirty = true; | 463 layer->m_hasSelfPaintingLayerDescendantDirty = true; |
459 // If we have reached a self-painting layer, we know our parent should h
ave a self-painting descendant | 464 // If we have reached a self-painting layer, we know our parent should h
ave a self-painting descendant |
460 // in this case, there is no need to dirty our ancestors further. | 465 // in this case, there is no need to dirty our ancestors further. |
461 if (layer->isSelfPaintingLayer()) { | 466 if (layer->isSelfPaintingLayer()) { |
462 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->hasSelfPaintingLayerDescendant()); | 467 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->hasSelfPaintingLayerDescendant()); |
463 break; | 468 break; |
464 } | 469 } |
465 } | 470 } |
466 } | 471 } |
467 | 472 |
| 473 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant() |
| 474 { |
| 475 for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
| 476 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl
owPositionedDescendant()) |
| 477 break; |
| 478 |
| 479 layer->setHasOutOfFlowPositionedDescendantDirty(false); |
| 480 layer->setHasOutOfFlowPositionedDescendant(true); |
| 481 } |
| 482 } |
| 483 |
| 484 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() |
| 485 { |
| 486 for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
| 487 layer->setHasOutOfFlowPositionedDescendantDirty(true); |
| 488 |
| 489 // We may or may not have an unclipped descendant. If we do, we'll reset |
| 490 // this to true the next time composited scrolling state is updated. |
| 491 layer->setHasUnclippedDescendant(false); |
| 492 |
| 493 // If we have reached an out of flow positioned layer, we know our paren
t should have an out-of-flow positioned descendant. |
| 494 // In this case, there is no need to dirty our ancestors further. |
| 495 if (layer->renderer()->isOutOfFlowPositioned()) { |
| 496 ASSERT(!parent() || parent()->m_hasOutOfFlowPositionedDescendantDirt
y || parent()->hasOutOfFlowPositionedDescendant()); |
| 497 break; |
| 498 } |
| 499 } |
| 500 } |
| 501 |
468 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const | 502 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const |
469 { | 503 { |
470 const Settings* settings = renderer()->document()->settings(); | 504 const Settings* settings = renderer()->document()->settings(); |
471 return settings && settings->acceleratedCompositingForOverflowScrollEnabled(
); | 505 return settings && settings->acceleratedCompositingForOverflowScrollEnabled(
); |
472 } | 506 } |
473 | 507 |
474 // If we are a stacking container, then this function will determine if our | 508 // If we are a stacking container, then this function will determine if our |
475 // descendants for a contiguous block in stacking order. This is required in | 509 // descendants for a contiguous block in stacking order. This is required in |
476 // order for an element to be safely promoted to a stacking container. It is saf
e | 510 // order for an element to be safely promoted to a stacking container. It is saf
e |
477 // to become a stacking container if this change would not alter the stacking | 511 // to become a stacking container if this change would not alter the stacking |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // maxStackIndex - minStackIndex == numSCDescendants | 580 // maxStackIndex - minStackIndex == numSCDescendants |
547 // ===> 3 - 0 == 3 | 581 // ===> 3 - 0 == 3 |
548 // ===> 3 == 3 | 582 // ===> 3 == 3 |
549 // | 583 // |
550 // And we would conclude that C could be promoted. | 584 // And we would conclude that C could be promoted. |
551 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() | 585 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() |
552 { | 586 { |
553 if (!m_descendantsAreContiguousInStackingOrderDirty || !isStackingContext()
|| !acceleratedCompositingForOverflowScrollEnabled()) | 587 if (!m_descendantsAreContiguousInStackingOrderDirty || !isStackingContext()
|| !acceleratedCompositingForOverflowScrollEnabled()) |
554 return; | 588 return; |
555 | 589 |
556 ASSERT(!m_normalFlowListDirty); | |
557 ASSERT(!m_zOrderListsDirty); | |
558 | |
559 OwnPtr<Vector<RenderLayer*> > posZOrderList; | 590 OwnPtr<Vector<RenderLayer*> > posZOrderList; |
560 OwnPtr<Vector<RenderLayer*> > negZOrderList; | 591 OwnPtr<Vector<RenderLayer*> > negZOrderList; |
561 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); | 592 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); |
562 | 593 |
563 // Create a reverse lookup. | 594 // Create a reverse lookup. |
564 HashMap<const RenderLayer*, int> lookup; | 595 HashMap<const RenderLayer*, int> lookup; |
565 | 596 |
566 if (negZOrderList) { | 597 if (negZOrderList) { |
567 int stackingOrderIndex = -1; | 598 int stackingOrderIndex = -1; |
568 size_t listSize = negZOrderList->size(); | 599 size_t listSize = negZOrderList->size(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 int childCount = 0; | 642 int childCount = 0; |
612 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch
ildMinIndex, childMaxIndex, childCount, false); | 643 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch
ildMinIndex, childMaxIndex, childCount, false); |
613 if (childCount) { | 644 if (childCount) { |
614 count += childCount; | 645 count += childCount; |
615 minIndex = std::min(minIndex, childMinIndex); | 646 minIndex = std::min(minIndex, childMinIndex); |
616 maxIndex = std::max(maxIndex, childMaxIndex); | 647 maxIndex = std::max(maxIndex, childMaxIndex); |
617 } | 648 } |
618 } | 649 } |
619 | 650 |
620 if (!isStackingContext()) { | 651 if (!isStackingContext()) { |
621 bool newValue = maxIndex - minIndex == count; | 652 m_descendantsAreContiguousInStackingOrder = (maxIndex - minIndex) == cou
nt; |
622 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; | 653 m_descendantsAreContiguousInStackingOrderDirty = false; |
623 m_descendantsAreContiguousInStackingOrder = newValue; | |
624 if (didUpdate) | |
625 updateNeedsCompositedScrolling(); | |
626 } | 654 } |
627 } | 655 } |
628 | 656 |
629 static inline bool isPositionedContainer(const RenderLayer* layer) | 657 static inline bool isPositionedContainer(const RenderLayer* layer) |
630 { | 658 { |
631 // FIXME: This is not in sync with containingBlock. | 659 // FIXME: This is not in sync with containingBlock. |
632 // RenderObject::canContainFixedPositionedObject() should probably be used | 660 // RenderObject::canContainFixedPositionedObject() should probably be used |
633 // instead. | 661 // instead. |
634 RenderLayerModelObject* layerRenderer = layer->renderer(); | 662 RenderLayerModelObject* layerRenderer = layer->renderer(); |
635 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr
ansform(); | 663 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr
ansform(); |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 if (curr == ancestorStackingContainer) | 1078 if (curr == ancestorStackingContainer) |
1051 return; | 1079 return; |
1052 } | 1080 } |
1053 } | 1081 } |
1054 | 1082 |
1055 bool RenderLayer::canBeStackingContainer() const | 1083 bool RenderLayer::canBeStackingContainer() const |
1056 { | 1084 { |
1057 if (isStackingContext() || !ancestorStackingContainer()) | 1085 if (isStackingContext() || !ancestorStackingContainer()) |
1058 return true; | 1086 return true; |
1059 | 1087 |
| 1088 ASSERT(!m_descendantsAreContiguousInStackingOrderDirty); |
1060 return m_descendantsAreContiguousInStackingOrder; | 1089 return m_descendantsAreContiguousInStackingOrder; |
1061 } | 1090 } |
1062 | 1091 |
1063 void RenderLayer::setHasVisibleContent() | 1092 void RenderLayer::setHasVisibleContent() |
1064 { | 1093 { |
1065 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { | 1094 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { |
1066 ASSERT(!parent() || parent()->hasVisibleDescendant()); | 1095 ASSERT(!parent() || parent()->hasVisibleDescendant()); |
1067 return; | 1096 return; |
1068 } | 1097 } |
1069 | 1098 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 { | 1135 { |
1107 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | 1136 for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
1108 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan
t()) | 1137 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan
t()) |
1109 break; | 1138 break; |
1110 | 1139 |
1111 layer->m_hasVisibleDescendant = true; | 1140 layer->m_hasVisibleDescendant = true; |
1112 layer->m_visibleDescendantStatusDirty = false; | 1141 layer->m_visibleDescendantStatusDirty = false; |
1113 } | 1142 } |
1114 } | 1143 } |
1115 | 1144 |
1116 void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* o
utOfFlowDescendantContainingBlocks) | 1145 void RenderLayer::updateHasUnclippedDescendant() |
| 1146 { |
| 1147 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant")
; |
| 1148 ASSERT(renderer()->isOutOfFlowPositioned()); |
| 1149 if (!m_hasVisibleContent && !m_hasVisibleDescendant) |
| 1150 return; |
| 1151 |
| 1152 const RenderObject* containingBlock = renderer()->containingBlock(); |
| 1153 for (RenderLayer* ancestor = parent(); ancestor && ancestor->renderer() != c
ontainingBlock; ancestor = ancestor->parent()) |
| 1154 ancestor->setHasUnclippedDescendant(true); |
| 1155 } |
| 1156 |
| 1157 static bool subtreeContainsOutOfFlowPositionedLayer(const RenderLayer* subtreeRo
ot) |
| 1158 { |
| 1159 return (subtreeRoot->renderer() && subtreeRoot->renderer()->isOutOfFlowPosit
ioned()) || subtreeRoot->hasOutOfFlowPositionedDescendant(); |
| 1160 } |
| 1161 |
| 1162 void RenderLayer::updateDescendantDependentFlags() |
1117 { | 1163 { |
1118 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty
|| m_hasOutOfFlowPositionedDescendantDirty) { | 1164 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty
|| m_hasOutOfFlowPositionedDescendantDirty) { |
1119 const bool hadVisibleDescendant = m_hasVisibleDescendant; | |
1120 const bool hadOutOfFlowPositionedDescendant = m_hasOutOfFlowPositionedDe
scendant; | |
1121 | |
1122 m_hasVisibleDescendant = false; | 1165 m_hasVisibleDescendant = false; |
1123 m_hasSelfPaintingLayerDescendant = false; | 1166 m_hasSelfPaintingLayerDescendant = false; |
1124 m_hasOutOfFlowPositionedDescendant = false; | 1167 m_hasOutOfFlowPositionedDescendant = false; |
1125 | 1168 |
1126 HashSet<const RenderObject*> childOutOfFlowDescendantContainingBlocks; | |
1127 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin
g()) { | 1169 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin
g()) { |
1128 childOutOfFlowDescendantContainingBlocks.clear(); | 1170 child->updateDescendantDependentFlags(); |
1129 child->updateDescendantDependentFlags(&childOutOfFlowDescendantConta
iningBlocks); | |
1130 | |
1131 bool childIsOutOfFlowPositioned = child->renderer() && child->render
er()->isOutOfFlowPositioned(); | |
1132 if (childIsOutOfFlowPositioned) | |
1133 childOutOfFlowDescendantContainingBlocks.add(child->renderer()->
containingBlock()); | |
1134 | |
1135 if (outOfFlowDescendantContainingBlocks) { | |
1136 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow
DescendantContainingBlocks.begin(); | |
1137 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i
t) | |
1138 outOfFlowDescendantContainingBlocks->add(*it); | |
1139 } | |
1140 | 1171 |
1141 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h
asVisibleDescendant; | 1172 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h
asVisibleDescendant; |
1142 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() |
| child->hasSelfPaintingLayerDescendant(); | 1173 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() |
| child->hasSelfPaintingLayerDescendant(); |
1143 bool hasOutOfFlowPositionedDescendant = hasVisibleDescendant && (!ch
ildOutOfFlowDescendantContainingBlocks.isEmpty() || child->hasOutOfFlowPositione
dDescendant()); | 1174 bool hasOutOfFlowPositionedDescendant = subtreeContainsOutOfFlowPosi
tionedLayer(child); |
1144 | 1175 |
1145 m_hasVisibleDescendant |= hasVisibleDescendant; | 1176 m_hasVisibleDescendant |= hasVisibleDescendant; |
1146 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; | 1177 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; |
1147 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda
nt; | 1178 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda
nt; |
1148 | 1179 |
1149 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_
hasOutOfFlowPositionedDescendant) | 1180 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && ha
sOutOfFlowPositionedDescendant) |
1150 break; | 1181 break; |
1151 } | 1182 } |
1152 | 1183 |
1153 if (outOfFlowDescendantContainingBlocks && renderer()) | |
1154 outOfFlowDescendantContainingBlocks->remove(renderer()); | |
1155 | |
1156 m_visibleDescendantStatusDirty = false; | 1184 m_visibleDescendantStatusDirty = false; |
1157 m_hasSelfPaintingLayerDescendantDirty = false; | 1185 m_hasSelfPaintingLayerDescendantDirty = false; |
1158 m_hasOutOfFlowPositionedDescendantDirty = false; | 1186 m_hasOutOfFlowPositionedDescendantDirty = false; |
1159 | |
1160 if (m_hasVisibleDescendant != hadVisibleDescendant || m_hasOutOfFlowPosi
tionedDescendant != hadOutOfFlowPositionedDescendant) | |
1161 updateNeedsCompositedScrolling(); | |
1162 } | 1187 } |
1163 | 1188 |
1164 if (m_visibleContentStatusDirty) { | 1189 if (m_visibleContentStatusDirty) { |
1165 const bool hadVisibleContent = m_hasVisibleContent; | |
1166 if (renderer()->style()->visibility() == VISIBLE) | 1190 if (renderer()->style()->visibility() == VISIBLE) |
1167 m_hasVisibleContent = true; | 1191 m_hasVisibleContent = true; |
1168 else { | 1192 else { |
1169 // layer may be hidden but still have some visible content, check fo
r this | 1193 // layer may be hidden but still have some visible content, check fo
r this |
1170 m_hasVisibleContent = false; | 1194 m_hasVisibleContent = false; |
1171 RenderObject* r = renderer()->firstChild(); | 1195 RenderObject* r = renderer()->firstChild(); |
1172 while (r) { | 1196 while (r) { |
1173 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { | 1197 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { |
1174 m_hasVisibleContent = true; | 1198 m_hasVisibleContent = true; |
1175 break; | 1199 break; |
1176 } | 1200 } |
1177 if (r->firstChild() && !r->hasLayer()) | 1201 if (r->firstChild() && !r->hasLayer()) |
1178 r = r->firstChild(); | 1202 r = r->firstChild(); |
1179 else if (r->nextSibling()) | 1203 else if (r->nextSibling()) |
1180 r = r->nextSibling(); | 1204 r = r->nextSibling(); |
1181 else { | 1205 else { |
1182 do { | 1206 do { |
1183 r = r->parent(); | 1207 r = r->parent(); |
1184 if (r == renderer()) | 1208 if (r == renderer()) |
1185 r = 0; | 1209 r = 0; |
1186 } while (r && !r->nextSibling()); | 1210 } while (r && !r->nextSibling()); |
1187 if (r) | 1211 if (r) |
1188 r = r->nextSibling(); | 1212 r = r->nextSibling(); |
1189 } | 1213 } |
1190 } | 1214 } |
1191 } | 1215 } |
1192 m_visibleContentStatusDirty = false; | 1216 m_visibleContentStatusDirty = false; |
1193 if (hadVisibleContent != m_hasVisibleContent) | |
1194 updateNeedsCompositedScrolling(); | |
1195 } | 1217 } |
1196 } | 1218 } |
1197 | 1219 |
1198 void RenderLayer::dirty3DTransformedDescendantStatus() | 1220 void RenderLayer::dirty3DTransformedDescendantStatus() |
1199 { | 1221 { |
1200 RenderLayer* curr = ancestorStackingContainer(); | 1222 RenderLayer* curr = ancestorStackingContainer(); |
1201 if (curr) | 1223 if (curr) |
1202 curr->m_3DTransformedDescendantStatusDirty = true; | 1224 curr->m_3DTransformedDescendantStatusDirty = true; |
1203 | 1225 |
1204 // This propagates up through preserve-3d hierarchies to the enclosing flatt
ening layer. | 1226 // This propagates up through preserve-3d hierarchies to the enclosing flatt
ening layer. |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1750 child->setParent(this); | 1772 child->setParent(this); |
1751 | 1773 |
1752 if (child->isNormalFlowOnly()) | 1774 if (child->isNormalFlowOnly()) |
1753 dirtyNormalFlowList(); | 1775 dirtyNormalFlowList(); |
1754 | 1776 |
1755 if (!child->isNormalFlowOnly() || child->firstChild()) { | 1777 if (!child->isNormalFlowOnly() || child->firstChild()) { |
1756 // Dirty the z-order list in which we are contained. The ancestorStackin
gContainer() can be null in the | 1778 // Dirty the z-order list in which we are contained. The ancestorStackin
gContainer() can be null in the |
1757 // case where we're building up generated content layers. This is ok, si
nce the lists will start | 1779 // case where we're building up generated content layers. This is ok, si
nce the lists will start |
1758 // off dirty in that case anyway. | 1780 // off dirty in that case anyway. |
1759 child->dirtyStackingContainerZOrderLists(); | 1781 child->dirtyStackingContainerZOrderLists(); |
1760 | |
1761 // Adding an out of flow positioned descendant can only affect | |
1762 // the opt-in decision for layers beneath and including our | |
1763 // containing block. | |
1764 RenderObject* containingBlock = child->renderer()->containingBlock(); | |
1765 for (RenderLayer* layer = child; layer; layer = layer->parent()) { | |
1766 layer->updateNeedsCompositedScrolling(); | |
1767 if (layer->renderer() == containingBlock) | |
1768 break; | |
1769 } | |
1770 } | 1782 } |
1771 | 1783 |
1772 child->updateDescendantDependentFlags(); | 1784 child->updateDescendantDependentFlags(); |
1773 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) | 1785 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) |
1774 setAncestorChainHasVisibleDescendant(); | 1786 setAncestorChainHasVisibleDescendant(); |
1775 | 1787 |
1776 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) | 1788 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) |
1777 setAncestorChainHasSelfPaintingLayerDescendant(); | 1789 setAncestorChainHasSelfPaintingLayerDescendant(); |
1778 | 1790 |
1779 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil
d->hasOutOfFlowPositionedDescendant())) | 1791 if (subtreeContainsOutOfFlowPositionedLayer(child)) { |
1780 setAncestorChainHasOutOfFlowPositionedDescendant(child->renderer()->cont
ainingBlock()); | 1792 // Now that the out of flow positioned descendant is in the tree, we |
| 1793 // need to tell the compositor to reevaluate the compositing |
| 1794 // requirements since we may be able to mark more layers as having |
| 1795 // an 'unclipped' descendant. |
| 1796 compositor()->setNeedsUpdateCompositingRequirementsState(); |
| 1797 setAncestorChainHasOutOfFlowPositionedDescendant(); |
| 1798 } |
1781 | 1799 |
1782 compositor()->layerWasAdded(this, child); | 1800 compositor()->layerWasAdded(this, child); |
1783 } | 1801 } |
1784 | 1802 |
1785 RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) | 1803 RenderLayer* RenderLayer::removeChild(RenderLayer* oldChild) |
1786 { | 1804 { |
1787 if (!renderer()->documentBeingDestroyed()) | 1805 if (!renderer()->documentBeingDestroyed()) |
1788 compositor()->layerWillBeRemoved(this, oldChild); | 1806 compositor()->layerWillBeRemoved(this, oldChild); |
1789 | 1807 |
1790 // remove the child | 1808 // remove the child |
1791 if (oldChild->previousSibling()) | 1809 if (oldChild->previousSibling()) |
1792 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); | 1810 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); |
1793 if (oldChild->nextSibling()) | 1811 if (oldChild->nextSibling()) |
1794 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling())
; | 1812 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling())
; |
1795 | 1813 |
1796 if (m_first == oldChild) | 1814 if (m_first == oldChild) |
1797 m_first = oldChild->nextSibling(); | 1815 m_first = oldChild->nextSibling(); |
1798 if (m_last == oldChild) | 1816 if (m_last == oldChild) |
1799 m_last = oldChild->previousSibling(); | 1817 m_last = oldChild->previousSibling(); |
1800 | 1818 |
1801 if (oldChild->isNormalFlowOnly()) | 1819 if (oldChild->isNormalFlowOnly()) |
1802 dirtyNormalFlowList(); | 1820 dirtyNormalFlowList(); |
1803 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { | 1821 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { |
1804 // Dirty the z-order list in which we are contained. When called via th
e | 1822 // Dirty the z-order list in which we are contained. When called via th
e |
1805 // reattachment process in removeOnlyThisLayer, the layer may already be
disconnected | 1823 // reattachment process in removeOnlyThisLayer, the layer may already be
disconnected |
1806 // from the main layer tree, so we need to null-check the |stackingConta
iner| value. | 1824 // from the main layer tree, so we need to null-check the |stackingConta
iner| value. |
1807 oldChild->dirtyStackingContainerZOrderLists(); | 1825 oldChild->dirtyStackingContainerZOrderLists(); |
1808 | |
1809 // This could affect whether or not a layer has an out of flow | |
1810 // positioned descendant so we need to schedule some updates. | |
1811 // Removing an out of flow positioned descendant can only affect | |
1812 // the opt-in decision for layers beneath and including the old child's | |
1813 // containing block. | |
1814 RenderObject* containingBlock = oldChild->renderer()->containingBlock(); | |
1815 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | |
1816 layer->updateNeedsCompositedScrolling(); | |
1817 if (layer->renderer() == containingBlock) | |
1818 break; | |
1819 } | |
1820 } | 1826 } |
1821 | 1827 |
1822 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned())
|| oldChild->hasOutOfFlowPositionedDescendant()) | |
1823 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
1824 | |
1825 oldChild->setPreviousSibling(0); | 1828 oldChild->setPreviousSibling(0); |
1826 oldChild->setNextSibling(0); | 1829 oldChild->setNextSibling(0); |
1827 oldChild->setParent(0); | 1830 oldChild->setParent(0); |
1828 | 1831 |
1829 oldChild->updateDescendantDependentFlags(); | 1832 oldChild->updateDescendantDependentFlags(); |
| 1833 if (subtreeContainsOutOfFlowPositionedLayer(oldChild)) { |
| 1834 // It may now be the case that a layer no longer has an unclipped |
| 1835 // descendant. Let the compositor know that it needs to reevaluate |
| 1836 // its compositing requirements to check this. |
| 1837 compositor()->setNeedsUpdateCompositingRequirementsState(); |
| 1838 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
| 1839 } |
| 1840 |
1830 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1841 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
1831 dirtyAncestorChainVisibleDescendantStatus(); | 1842 dirtyAncestorChainVisibleDescendantStatus(); |
1832 | 1843 |
1833 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend
ant()) | 1844 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend
ant()) |
1834 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1845 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
1835 | 1846 |
1836 return oldChild; | 1847 return oldChild; |
1837 } | 1848 } |
1838 | 1849 |
1839 void RenderLayer::removeOnlyThisLayer() | 1850 void RenderLayer::removeOnlyThisLayer() |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2049 case CompositedScrollingAlwaysOff: | 2060 case CompositedScrollingAlwaysOff: |
2050 return false; | 2061 return false; |
2051 } | 2062 } |
2052 | 2063 |
2053 ASSERT_NOT_REACHED(); | 2064 ASSERT_NOT_REACHED(); |
2054 return m_needsCompositedScrolling; | 2065 return m_needsCompositedScrolling; |
2055 } | 2066 } |
2056 | 2067 |
2057 void RenderLayer::updateNeedsCompositedScrolling() | 2068 void RenderLayer::updateNeedsCompositedScrolling() |
2058 { | 2069 { |
| 2070 if (RenderLayer* ancestor = ancestorStackingContext()) |
| 2071 ancestor->updateDescendantsAreContiguousInStackingOrder(); |
| 2072 |
2059 bool needsCompositedScrolling = false; | 2073 bool needsCompositedScrolling = false; |
2060 | 2074 |
2061 FrameView* frameView = renderer()->view()->frameView(); | 2075 FrameView* frameView = renderer()->view()->frameView(); |
2062 if (frameView && frameView->containsScrollableArea(this)) { | 2076 if (frameView && frameView->containsScrollableArea(this)) { |
2063 updateDescendantDependentFlags(); | 2077 updateDescendantDependentFlags(); |
2064 | 2078 |
2065 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro
llEnabled() | 2079 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro
llEnabled() |
2066 && canBeStackingContainer() | 2080 && canBeStackingContainer() |
2067 && !hasOutOfFlowPositionedDescendant(); | 2081 && !hasUnclippedDescendant(); |
2068 | 2082 |
2069 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 2083 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
2070 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st
yle()->useTouchOverflowScrolling(); | 2084 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st
yle()->useTouchOverflowScrolling(); |
2071 #else | 2085 #else |
2072 needsCompositedScrolling = forceUseCompositedScrolling; | 2086 needsCompositedScrolling = forceUseCompositedScrolling; |
2073 #endif | 2087 #endif |
2074 // We gather a boolean value for use with Google UMA histograms to | 2088 // We gather a boolean value for use with Google UMA histograms to |
2075 // quantify the actual effects of a set of patches attempting to | 2089 // quantify the actual effects of a set of patches attempting to |
2076 // relax composited scrolling requirements, thereby increasing the | 2090 // relax composited scrolling requirements, thereby increasing the |
2077 // number of composited overflow divs. | 2091 // number of composited overflow divs. |
2078 if (acceleratedCompositingForOverflowScrollEnabled()) | 2092 if (acceleratedCompositingForOverflowScrollEnabled()) |
2079 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro
lling", needsCompositedScrolling, 2); | 2093 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro
lling", needsCompositedScrolling, 2); |
2080 } | 2094 } |
2081 | 2095 |
| 2096 setNeedsCompositedScrolling(needsCompositedScrolling); |
| 2097 } |
| 2098 |
| 2099 void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling) |
| 2100 { |
2082 if (m_needsCompositedScrolling == needsCompositedScrolling) | 2101 if (m_needsCompositedScrolling == needsCompositedScrolling) |
2083 return; | 2102 return; |
2084 | 2103 |
2085 m_needsCompositedScrolling = needsCompositedScrolling; | 2104 m_needsCompositedScrolling = needsCompositedScrolling; |
2086 | 2105 |
2087 // Note, the z-order lists may need to be rebuilt, but our code guarantees | 2106 // Note, the z-order lists may need to be rebuilt, but our code guarantees |
2088 // that we have not affected stacking, so we will not dirty | 2107 // that we have not affected stacking, so we will not dirty |
2089 // m_canBePromotedToStackingContainer for either us or our stacking context | 2108 // m_canBePromotedToStackingContainer for either us or our stacking context |
2090 // or container. | 2109 // or container. |
2091 didUpdateNeedsCompositedScrolling(); | 2110 didUpdateNeedsCompositedScrolling(); |
(...skipping 3511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5603 | 5622 |
5604 if (m_posZOrderList) | 5623 if (m_posZOrderList) |
5605 m_posZOrderList->clear(); | 5624 m_posZOrderList->clear(); |
5606 if (m_negZOrderList) | 5625 if (m_negZOrderList) |
5607 m_negZOrderList->clear(); | 5626 m_negZOrderList->clear(); |
5608 m_zOrderListsDirty = true; | 5627 m_zOrderListsDirty = true; |
5609 | 5628 |
5610 m_descendantsAreContiguousInStackingOrderDirty = true; | 5629 m_descendantsAreContiguousInStackingOrderDirty = true; |
5611 | 5630 |
5612 if (!renderer()->documentBeingDestroyed()) { | 5631 if (!renderer()->documentBeingDestroyed()) { |
| 5632 compositor()->setNeedsUpdateCompositingRequirementsState(); |
5613 compositor()->setCompositingLayersNeedRebuild(); | 5633 compositor()->setCompositingLayersNeedRebuild(); |
5614 if (acceleratedCompositingForOverflowScrollEnabled()) | 5634 if (acceleratedCompositingForOverflowScrollEnabled()) |
5615 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5635 compositor()->setShouldReevaluateCompositingAfterLayout(); |
5616 } | 5636 } |
5617 } | 5637 } |
5618 | 5638 |
5619 void RenderLayer::dirtyStackingContainerZOrderLists() | 5639 void RenderLayer::dirtyStackingContainerZOrderLists() |
5620 { | 5640 { |
5621 RenderLayer* stackingContainer = this->ancestorStackingContainer(); | 5641 RenderLayer* stackingContainer = this->ancestorStackingContainer(); |
5622 if (stackingContainer) | 5642 if (stackingContainer) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5741 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin
g()) { | 5761 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin
g()) { |
5742 // Ignore reflections. | 5762 // Ignore reflections. |
5743 if (!m_reflection || reflectionLayer() != child) | 5763 if (!m_reflection || reflectionLayer() != child) |
5744 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n
egBuffer, layerToForceAsStackingContainer); | 5764 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n
egBuffer, layerToForceAsStackingContainer); |
5745 } | 5765 } |
5746 } | 5766 } |
5747 } | 5767 } |
5748 | 5768 |
5749 void RenderLayer::updateLayerListsIfNeeded() | 5769 void RenderLayer::updateLayerListsIfNeeded() |
5750 { | 5770 { |
5751 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos
itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty ||
m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; | |
5752 updateZOrderLists(); | 5771 updateZOrderLists(); |
5753 updateNormalFlowList(); | 5772 updateNormalFlowList(); |
5754 | 5773 |
5755 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { | 5774 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { |
5756 reflectionLayer->updateZOrderLists(); | 5775 reflectionLayer->updateZOrderLists(); |
5757 reflectionLayer->updateNormalFlowList(); | 5776 reflectionLayer->updateNormalFlowList(); |
5758 } | 5777 } |
5759 | |
5760 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { | |
5761 updateDescendantsAreContiguousInStackingOrder(); | |
5762 // The above function can cause us to update m_needsCompositedScrolling | |
5763 // and dirty our layer lists. Refresh them if necessary. | |
5764 updateZOrderLists(); | |
5765 updateNormalFlowList(); | |
5766 } | |
5767 } | 5778 } |
5768 | 5779 |
5769 void RenderLayer::repaintIncludingDescendants() | 5780 void RenderLayer::repaintIncludingDescendants() |
5770 { | 5781 { |
5771 renderer()->repaint(); | 5782 renderer()->repaint(); |
5772 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) | 5783 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) |
5773 curr->repaintIncludingDescendants(); | 5784 curr->repaintIncludingDescendants(); |
5774 } | 5785 } |
5775 | 5786 |
5776 void RenderLayer::setBackingNeedsRepaint() | 5787 void RenderLayer::setBackingNeedsRepaint() |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5920 return true; | 5931 return true; |
5921 | 5932 |
5922 if (hasVisibleBoxDecorations()) | 5933 if (hasVisibleBoxDecorations()) |
5923 return true; | 5934 return true; |
5924 | 5935 |
5925 return false; | 5936 return false; |
5926 } | 5937 } |
5927 | 5938 |
5928 void RenderLayer::updateVisibilityAfterStyleChange(const RenderStyle* oldStyle) | 5939 void RenderLayer::updateVisibilityAfterStyleChange(const RenderStyle* oldStyle) |
5929 { | 5940 { |
5930 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; | 5941 if (!oldStyle || (oldStyle->visibility() != renderer()->style()->visibility(
))) |
5931 if (oldVisibility == renderer()->style()->visibility() || !renderer()->isOut
OfFlowPositioned()) | 5942 compositor()->setNeedsUpdateCompositingRequirementsState(); |
5932 return; | |
5933 | |
5934 if (renderer()->style()->visibility() == VISIBLE) | |
5935 setAncestorChainHasOutOfFlowPositionedDescendant(renderer()->containingB
lock()); | |
5936 else | |
5937 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
5938 } | 5943 } |
5939 | 5944 |
5940 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS
tyle) | 5945 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS
tyle) |
5941 { | 5946 { |
5942 bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; | 5947 bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; |
5943 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; | 5948 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; |
5944 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; | 5949 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; |
5945 | 5950 |
5946 // FIXME: RenderLayer already handles visibility changes through our visibli
ty dirty bits. This logic could | 5951 // FIXME: RenderLayer already handles visibility changes through our visibli
ty dirty bits. This logic could |
5947 // likely be folded along with the rest. | 5952 // likely be folded along with the rest. |
5948 bool isStackingContext = this->isStackingContext(); | 5953 bool isStackingContext = this->isStackingContext(); |
5949 if (isStackingContext == wasStackingContext && oldVisibility == renderer()->
style()->visibility() && oldZIndex == renderer()->style()->zIndex()) | 5954 if (isStackingContext == wasStackingContext && oldVisibility == renderer()->
style()->visibility() && oldZIndex == renderer()->style()->zIndex()) |
5950 return; | 5955 return; |
5951 | 5956 |
5952 dirtyStackingContainerZOrderLists(); | 5957 dirtyStackingContainerZOrderLists(); |
5953 | 5958 |
5954 if (isStackingContainer()) | 5959 if (isStackingContainer()) |
5955 dirtyZOrderLists(); | 5960 dirtyZOrderLists(); |
5956 else | 5961 else |
5957 clearZOrderLists(); | 5962 clearZOrderLists(); |
5958 | 5963 |
5959 updateNeedsCompositedScrolling(); | 5964 compositor()->setNeedsUpdateCompositingRequirementsState(); |
5960 } | 5965 } |
5961 | 5966 |
5962 static bool overflowRequiresScrollbar(EOverflow overflow) | 5967 static bool overflowRequiresScrollbar(EOverflow overflow) |
5963 { | 5968 { |
5964 return overflow == OSCROLL; | 5969 return overflow == OSCROLL; |
5965 } | 5970 } |
5966 | 5971 |
5967 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 5972 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
5968 { | 5973 { |
5969 return overflow == OAUTO || overflow == OOVERLAY; | 5974 return overflow == OAUTO || overflow == OOVERLAY; |
(...skipping 28 matching lines...) Expand all Loading... |
5998 | 6003 |
5999 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL &
& overflowY != OSCROLL) { | 6004 if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL &
& overflowY != OSCROLL) { |
6000 ASSERT(hasVerticalScrollbar()); | 6005 ASSERT(hasVerticalScrollbar()); |
6001 m_vBar->setEnabled(true); | 6006 m_vBar->setEnabled(true); |
6002 } | 6007 } |
6003 | 6008 |
6004 if (!m_scrollDimensionsDirty) | 6009 if (!m_scrollDimensionsDirty) |
6005 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab
leVerticalOverflow()); | 6010 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab
leVerticalOverflow()); |
6006 } | 6011 } |
6007 | 6012 |
6008 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject*
containingBlock) | |
6009 { | |
6010 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | |
6011 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl
owPositionedDescendant()) | |
6012 break; | |
6013 | |
6014 layer->m_hasOutOfFlowPositionedDescendantDirty = false; | |
6015 layer->m_hasOutOfFlowPositionedDescendant = true; | |
6016 layer->updateNeedsCompositedScrolling(); | |
6017 | |
6018 if (layer->renderer() && layer->renderer() == containingBlock) | |
6019 break; | |
6020 } | |
6021 } | |
6022 | |
6023 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() | |
6024 { | |
6025 if (m_hasOutOfFlowPositionedDescendant) { | |
6026 m_hasOutOfFlowPositionedDescendantDirty = true; | |
6027 // FIXME It would be nice to avoid this when we clean up render layer | |
6028 // updating. We shouldn't have to update the composited scrolling state | |
6029 // nearly as frequently if all the updates happen in a single, well | |
6030 // defined phase. | |
6031 updateNeedsCompositedScrolling(); | |
6032 } | |
6033 | |
6034 if (parent()) | |
6035 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
6036 } | |
6037 | |
6038 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) | 6013 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) |
6039 { | 6014 { |
| 6015 if (oldStyle && (renderer()->style()->position() == oldStyle->position())) |
| 6016 return; |
| 6017 |
6040 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP
osition || oldStyle->position() == FixedPosition); | 6018 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP
osition || oldStyle->position() == FixedPosition); |
6041 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); | 6019 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); |
6042 if (parent() && isOutOfFlowPositioned != wasOutOfFlowPositioned) { | 6020 if (!wasOutOfFlowPositioned && !isOutOfFlowPositioned) |
6043 if (isOutOfFlowPositioned) | 6021 return; |
6044 parent()->setAncestorChainHasOutOfFlowPositionedDescendant(renderer(
)->containingBlock()); | 6022 |
6045 else | 6023 // Even if the layer remains out-of-flow, a change to this property |
6046 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus()
; | 6024 // will likely change its containing block. We must clear these bits |
| 6025 // so that they can be set properly by the RenderLayerCompositor. |
| 6026 for (RenderLayer* ancestor = parent(); ancestor; ancestor = ancestor->parent
()) |
| 6027 ancestor->setHasUnclippedDescendant(false); |
| 6028 |
| 6029 // Ensures that we reset the above bits correctly. |
| 6030 compositor()->setNeedsUpdateCompositingRequirementsState(); |
| 6031 |
| 6032 if (wasOutOfFlowPositioned && isOutOfFlowPositioned) |
| 6033 return; |
| 6034 |
| 6035 if (isOutOfFlowPositioned) { |
| 6036 setAncestorChainHasOutOfFlowPositionedDescendant(); |
| 6037 compositor()->addOutOfFlowPositionedLayer(this); |
| 6038 } else { |
| 6039 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 6040 compositor()->removeOutOfFlowPositionedLayer(this); |
6047 } | 6041 } |
6048 } | 6042 } |
6049 | 6043 |
6050 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS
tyle) | 6044 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS
tyle) |
6051 { | 6045 { |
6052 ASSERT(newStyle); | 6046 ASSERT(newStyle); |
6053 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); | 6047 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); |
6054 } | 6048 } |
6055 | 6049 |
6056 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle*
oldStyle, const RenderStyle* newStyle) const | 6050 inline bool RenderLayer::needsCompositingLayersRebuiltForClip(const RenderStyle*
oldStyle, const RenderStyle* newStyle) const |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6203 | 6197 |
6204 FrameView* frameView = frame->view(); | 6198 FrameView* frameView = frame->view(); |
6205 if (!frameView) | 6199 if (!frameView) |
6206 return; | 6200 return; |
6207 | 6201 |
6208 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); | 6202 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); |
6209 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) | 6203 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) |
6210 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH
itTesting(); | 6204 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH
itTesting(); |
6211 | 6205 |
6212 bool updatedScrollableAreaSet = false; | 6206 bool updatedScrollableAreaSet = false; |
6213 if (hasOverflow && isVisibleToHitTest) | 6207 if (hasOverflow && isVisibleToHitTest) { |
6214 updatedScrollableAreaSet = frameView->addScrollableArea(this); | 6208 if (frameView->addScrollableArea(this)) |
6215 else | 6209 compositor()->setNeedsUpdateCompositingRequirementsState(); |
6216 updatedScrollableAreaSet = frameView->removeScrollableArea(this); | 6210 } else { |
6217 | 6211 if (frameView->removeScrollableArea(this)) |
6218 if (updatedScrollableAreaSet) | 6212 setNeedsCompositedScrolling(false); |
6219 updateNeedsCompositedScrolling(); | 6213 } |
6220 } | 6214 } |
6221 | 6215 |
6222 void RenderLayer::updateScrollCornerStyle() | 6216 void RenderLayer::updateScrollCornerStyle() |
6223 { | 6217 { |
6224 RenderObject* actualRenderer = rendererForScrollbar(renderer()); | 6218 RenderObject* actualRenderer = rendererForScrollbar(renderer()); |
6225 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer-
>getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st
yle()) : PassRefPtr<RenderStyle>(0); | 6219 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer-
>getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st
yle()) : PassRefPtr<RenderStyle>(0); |
6226 if (corner) { | 6220 if (corner) { |
6227 if (!m_scrollCorner) { | 6221 if (!m_scrollCorner) { |
6228 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do
cument()); | 6222 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do
cument()); |
6229 m_scrollCorner->setParent(renderer()); | 6223 m_scrollCorner->setParent(renderer()); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6458 } | 6452 } |
6459 } | 6453 } |
6460 | 6454 |
6461 void showLayerTree(const WebCore::RenderObject* renderer) | 6455 void showLayerTree(const WebCore::RenderObject* renderer) |
6462 { | 6456 { |
6463 if (!renderer) | 6457 if (!renderer) |
6464 return; | 6458 return; |
6465 showLayerTree(renderer->enclosingLayer()); | 6459 showLayerTree(renderer->enclosingLayer()); |
6466 } | 6460 } |
6467 #endif | 6461 #endif |
OLD | NEW |