| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 return hitTestLocation.intersects(m_rect); | 139 return hitTestLocation.intersects(m_rect); |
| 140 } | 140 } |
| 141 | 141 |
| 142 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) | 142 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
| 143 : m_inResizeMode(false) | 143 : m_inResizeMode(false) |
| 144 , m_scrollDimensionsDirty(true) | 144 , m_scrollDimensionsDirty(true) |
| 145 , m_normalFlowListDirty(true) | 145 , m_normalFlowListDirty(true) |
| 146 , m_hasSelfPaintingLayerDescendant(false) | 146 , m_hasSelfPaintingLayerDescendant(false) |
| 147 , m_hasSelfPaintingLayerDescendantDirty(false) | 147 , m_hasSelfPaintingLayerDescendantDirty(false) |
| 148 , m_hasOutOfFlowPositionedDescendant(false) | 148 , m_hasOutOfFlowPositionedDescendant(false) |
| 149 , m_hasOutOfFlowPositionedDescendantDirty(true) | 149 , m_hasOutOfFlowPositionedDescendantDirty(false) |
| 150 , m_needsCompositedScrolling(false) | 150 , m_needsCompositedScrolling(false) |
| 151 , m_descendantsAreContiguousInStackingOrder(false) | 151 , m_descendantsAreContiguousInStackingOrder(true) |
| 152 , m_descendantsAreContiguousInStackingOrderDirty(false) |
| 152 , m_isRootLayer(renderer->isRenderView()) | 153 , m_isRootLayer(renderer->isRenderView()) |
| 153 , m_usedTransparency(false) | 154 , m_usedTransparency(false) |
| 154 , m_paintingInsideReflection(false) | 155 , m_paintingInsideReflection(false) |
| 155 , m_inOverflowRelayout(false) | 156 , m_inOverflowRelayout(false) |
| 156 , m_repaintStatus(NeedsNormalRepaint) | 157 , m_repaintStatus(NeedsNormalRepaint) |
| 157 , m_visibleContentStatusDirty(true) | 158 , m_visibleContentStatusDirty(true) |
| 158 , m_hasVisibleContent(false) | 159 , m_hasVisibleContent(false) |
| 159 , m_visibleDescendantStatusDirty(false) | 160 , m_visibleDescendantStatusDirty(false) |
| 160 , m_hasVisibleDescendant(false) | 161 , m_hasVisibleDescendant(false) |
| 161 , m_isPaginated(false) | 162 , m_isPaginated(false) |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 // numSCDecendants = 3 | 589 // numSCDecendants = 3 |
| 589 // | 590 // |
| 590 // and so, | 591 // and so, |
| 591 // maxStackIndex - minStackIndex == numSCDescendants | 592 // maxStackIndex - minStackIndex == numSCDescendants |
| 592 // ===> 3 - 0 == 3 | 593 // ===> 3 - 0 == 3 |
| 593 // ===> 3 == 3 | 594 // ===> 3 == 3 |
| 594 // | 595 // |
| 595 // And we would conclude that C could be promoted. | 596 // And we would conclude that C could be promoted. |
| 596 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() | 597 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() |
| 597 { | 598 { |
| 598 if (!isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled(
)) | 599 if (!m_descendantsAreContiguousInStackingOrderDirty || !isStackingContext()
|| !acceleratedCompositingForOverflowScrollEnabled()) { |
| 600 m_descendantsAreContiguousInStackingOrderDirty = false; |
| 599 return; | 601 return; |
| 600 | 602 } |
| 601 ASSERT(!m_normalFlowListDirty); | |
| 602 ASSERT(!m_zOrderListsDirty); | |
| 603 | 603 |
| 604 OwnPtr<Vector<RenderLayer*> > posZOrderList; | 604 OwnPtr<Vector<RenderLayer*> > posZOrderList; |
| 605 OwnPtr<Vector<RenderLayer*> > negZOrderList; | 605 OwnPtr<Vector<RenderLayer*> > negZOrderList; |
| 606 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); | 606 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); |
| 607 | 607 |
| 608 // Create a reverse lookup. | 608 // Create a reverse lookup. |
| 609 HashMap<const RenderLayer*, int> lookup; | 609 HashMap<const RenderLayer*, int> lookup; |
| 610 | 610 |
| 611 if (negZOrderList) { | 611 if (negZOrderList) { |
| 612 int stackingOrderIndex = -1; | 612 int stackingOrderIndex = -1; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 628 continue; | 628 continue; |
| 629 lookup.set(currentLayer, stackingOrderIndex++); | 629 lookup.set(currentLayer, stackingOrderIndex++); |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 | 632 |
| 633 int minIndex = 0; | 633 int minIndex = 0; |
| 634 int maxIndex = 0; | 634 int maxIndex = 0; |
| 635 int count = 0; | 635 int count = 0; |
| 636 bool firstIteration = true; | 636 bool firstIteration = true; |
| 637 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max
Index, count, firstIteration); | 637 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max
Index, count, firstIteration); |
| 638 |
| 639 m_descendantsAreContiguousInStackingOrderDirty = false; |
| 638 } | 640 } |
| 639 | 641 |
| 640 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H
ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun
t, bool firstIteration) | 642 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H
ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun
t, bool firstIteration) |
| 641 { | 643 { |
| 644 m_descendantsAreContiguousInStackingOrderDirty = false; |
| 645 |
| 642 if (isStackingContext() && !firstIteration) { | 646 if (isStackingContext() && !firstIteration) { |
| 643 if (lookup.contains(this)) { | 647 if (lookup.contains(this)) { |
| 644 minIndex = std::min(minIndex, lookup.get(this)); | 648 minIndex = std::min(minIndex, lookup.get(this)); |
| 645 maxIndex = std::max(maxIndex, lookup.get(this)); | 649 maxIndex = std::max(maxIndex, lookup.get(this)); |
| 646 count++; | 650 count++; |
| 647 } | 651 } |
| 648 return; | 652 return; |
| 649 } | 653 } |
| 650 | 654 |
| 651 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
{ | 655 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
{ |
| 652 int childMinIndex = 0; | 656 int childMinIndex = 0; |
| 653 int childMaxIndex = 0; | 657 int childMaxIndex = 0; |
| 654 int childCount = 0; | 658 int childCount = 0; |
| 655 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch
ildMinIndex, childMaxIndex, childCount, false); | 659 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch
ildMinIndex, childMaxIndex, childCount, false); |
| 656 if (childCount) { | 660 if (childCount) { |
| 657 count += childCount; | 661 count += childCount; |
| 658 minIndex = std::min(minIndex, childMinIndex); | 662 minIndex = std::min(minIndex, childMinIndex); |
| 659 maxIndex = std::max(maxIndex, childMaxIndex); | 663 maxIndex = std::max(maxIndex, childMaxIndex); |
| 660 } | 664 } |
| 661 } | 665 } |
| 662 | 666 |
| 663 if (!isStackingContext()) { | 667 if (!isStackingContext()) |
| 664 bool newValue = maxIndex - minIndex == count; | 668 m_descendantsAreContiguousInStackingOrder = maxIndex - minIndex == count
; |
| 665 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; | |
| 666 m_descendantsAreContiguousInStackingOrder = newValue; | |
| 667 if (didUpdate) | |
| 668 updateNeedsCompositedScrolling(); | |
| 669 } | |
| 670 } | 669 } |
| 671 | 670 |
| 672 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta
iner, const RenderGeometryMap* geometryMap) | 671 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta
iner, const RenderGeometryMap* geometryMap) |
| 673 { | 672 { |
| 674 ASSERT(!m_visibleContentStatusDirty); | 673 ASSERT(!m_visibleContentStatusDirty); |
| 675 | 674 |
| 676 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); | 675 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); |
| 677 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr
yMap); | 676 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr
yMap); |
| 678 } | 677 } |
| 679 | 678 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 if (curr == ancestorStackingContainer) | 963 if (curr == ancestorStackingContainer) |
| 965 return; | 964 return; |
| 966 } | 965 } |
| 967 } | 966 } |
| 968 | 967 |
| 969 bool RenderLayer::canBeStackingContainer() const | 968 bool RenderLayer::canBeStackingContainer() const |
| 970 { | 969 { |
| 971 if (isStackingContext() || !stackingContainer()) | 970 if (isStackingContext() || !stackingContainer()) |
| 972 return true; | 971 return true; |
| 973 | 972 |
| 973 ASSERT(!m_descendantsAreContiguousInStackingOrderDirty); |
| 974 return m_descendantsAreContiguousInStackingOrder; | 974 return m_descendantsAreContiguousInStackingOrder; |
| 975 } | 975 } |
| 976 | 976 |
| 977 void RenderLayer::setHasVisibleContent() | 977 void RenderLayer::setHasVisibleContent() |
| 978 { | 978 { |
| 979 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { | 979 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { |
| 980 ASSERT(!parent() || parent()->hasVisibleDescendant()); | 980 ASSERT(!parent() || parent()->hasVisibleDescendant()); |
| 981 return; | 981 return; |
| 982 } | 982 } |
| 983 | 983 |
| 984 m_visibleContentStatusDirty = false; | 984 m_visibleContentStatusDirty = false; |
| 985 m_hasVisibleContent = true; | 985 m_hasVisibleContent = true; |
| 986 computeRepaintRects(renderer()->containerForRepaint()); | 986 computeRepaintRects(renderer()->containerForRepaint()); |
| 987 if (!isNormalFlowOnly()) { | 987 if (!isNormalFlowOnly()) { |
| 988 // We don't collect invisible layers in z-order lists if we are not in c
ompositing mode. | 988 // We don't collect invisible layers in z-order lists if we are not in c
ompositing mode. |
| 989 // As we became visible, we need to dirty our stacking containers ancest
ors to be properly | 989 // As we became visible, we need to dirty our stacking containers ancest
ors to be properly |
| 990 // collected. FIXME: When compositing, we could skip this dirtying phase
. | 990 // collected. FIXME: When compositing, we could skip this dirtying phase
. |
| 991 for (RenderLayer* sc = stackingContainer(); sc; sc = sc->stackingContain
er()) { | 991 for (RenderLayer* sc = parent(); sc; sc = sc->parent()) { |
| 992 sc->dirtyZOrderLists(); | 992 sc->dirtyZOrderLists(); |
| 993 if (sc->hasVisibleContent()) | 993 if (sc->hasVisibleContent()) |
| 994 break; | 994 break; |
| 995 } | 995 } |
| 996 } | 996 } |
| 997 | 997 |
| 998 if (parent()) | 998 if (parent()) |
| 999 parent()->setAncestorChainHasVisibleDescendant(); | 999 parent()->setAncestorChainHasVisibleDescendant(); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 childOutOfFlowDescendantContainingBlocks.add(child->renderer()->
containingBlock()); | 1044 childOutOfFlowDescendantContainingBlocks.add(child->renderer()->
containingBlock()); |
| 1045 | 1045 |
| 1046 if (outOfFlowDescendantContainingBlocks) { | 1046 if (outOfFlowDescendantContainingBlocks) { |
| 1047 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow
DescendantContainingBlocks.begin(); | 1047 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow
DescendantContainingBlocks.begin(); |
| 1048 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i
t) | 1048 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i
t) |
| 1049 outOfFlowDescendantContainingBlocks->add(*it); | 1049 outOfFlowDescendantContainingBlocks->add(*it); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h
asVisibleDescendant; | 1052 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h
asVisibleDescendant; |
| 1053 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() |
| child->hasSelfPaintingLayerDescendant(); | 1053 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() |
| child->hasSelfPaintingLayerDescendant(); |
| 1054 bool hasOutOfFlowPositionedDescendant = !childOutOfFlowDescendantCon
tainingBlocks.isEmpty(); | 1054 bool hasOutOfFlowPositionedDescendant = !childOutOfFlowDescendantCon
tainingBlocks.isEmpty() || child->hasOutOfFlowPositionedDescendant(); |
| 1055 | 1055 |
| 1056 m_hasVisibleDescendant |= hasVisibleDescendant; | 1056 m_hasVisibleDescendant |= hasVisibleDescendant; |
| 1057 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; | 1057 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; |
| 1058 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda
nt; | 1058 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda
nt; |
| 1059 | 1059 |
| 1060 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_
hasOutOfFlowPositionedDescendant) | 1060 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_
hasOutOfFlowPositionedDescendant) |
| 1061 break; | 1061 break; |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 if (outOfFlowDescendantContainingBlocks && renderer()) | 1064 if (outOfFlowDescendantContainingBlocks && renderer()) |
| 1065 outOfFlowDescendantContainingBlocks->remove(renderer()); | 1065 outOfFlowDescendantContainingBlocks->remove(renderer()); |
| 1066 | 1066 |
| 1067 m_visibleDescendantStatusDirty = false; | 1067 m_visibleDescendantStatusDirty = false; |
| 1068 m_hasSelfPaintingLayerDescendantDirty = false; | 1068 m_hasSelfPaintingLayerDescendantDirty = false; |
| 1069 | |
| 1070 if (m_hasOutOfFlowPositionedDescendantDirty) | |
| 1071 updateNeedsCompositedScrolling(); | |
| 1072 | |
| 1073 m_hasOutOfFlowPositionedDescendantDirty = false; | 1069 m_hasOutOfFlowPositionedDescendantDirty = false; |
| 1074 } | 1070 } |
| 1075 | 1071 |
| 1076 if (m_visibleContentStatusDirty) { | 1072 if (m_visibleContentStatusDirty) { |
| 1077 if (renderer()->style()->visibility() == VISIBLE) | 1073 if (renderer()->style()->visibility() == VISIBLE) |
| 1078 m_hasVisibleContent = true; | 1074 m_hasVisibleContent = true; |
| 1079 else { | 1075 else { |
| 1080 // layer may be hidden but still have some visible content, check fo
r this | 1076 // layer may be hidden but still have some visible content, check fo
r this |
| 1081 m_hasVisibleContent = false; | 1077 m_hasVisibleContent = false; |
| 1082 RenderObject* r = renderer()->firstChild(); | 1078 RenderObject* r = renderer()->firstChild(); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 if (!renderer()->hasTransform()) | 1266 if (!renderer()->hasTransform()) |
| 1271 return FloatPoint(); | 1267 return FloatPoint(); |
| 1272 | 1268 |
| 1273 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); | 1269 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); |
| 1274 RenderStyle* style = renderer()->style(); | 1270 RenderStyle* style = renderer()->style(); |
| 1275 | 1271 |
| 1276 return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox
.width()), | 1272 return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox
.width()), |
| 1277 floatValueForLength(style->perspectiveOriginY(), borderBox
.height())); | 1273 floatValueForLength(style->perspectiveOriginY(), borderBox
.height())); |
| 1278 } | 1274 } |
| 1279 | 1275 |
| 1280 RenderLayer* RenderLayer::stackingContainer() const | 1276 RenderLayer* RenderLayer::stackingContainer(bool allowDirty) const |
| 1281 { | 1277 { |
| 1282 RenderLayer* layer = parent(); | 1278 RenderLayer* layer = parent(); |
| 1283 while (layer && !layer->isStackingContainer()) | 1279 while (layer && !layer->isStackingContainer(allowDirty)) |
| 1284 layer = layer->parent(); | 1280 layer = layer->parent(); |
| 1285 | 1281 |
| 1286 ASSERT(!layer || layer->isStackingContainer()); | 1282 ASSERT(!layer || layer->isStackingContainer(allowDirty)); |
| 1287 return layer; | 1283 return layer; |
| 1288 } | 1284 } |
| 1289 | 1285 |
| 1290 static inline bool isPositionedContainer(RenderLayer* layer) | 1286 static inline bool isPositionedContainer(RenderLayer* layer) |
| 1291 { | 1287 { |
| 1292 RenderLayerModelObject* layerRenderer = layer->renderer(); | 1288 RenderLayerModelObject* layerRenderer = layer->renderer(); |
| 1293 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr
ansform(); | 1289 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr
ansform(); |
| 1294 } | 1290 } |
| 1295 | 1291 |
| 1296 static inline bool isFixedPositionedContainer(RenderLayer* layer) | 1292 static inline bool isFixedPositionedContainer(RenderLayer* layer) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1324 | 1320 |
| 1325 RenderLayer* RenderLayer::enclosingTransformedAncestor() const | 1321 RenderLayer* RenderLayer::enclosingTransformedAncestor() const |
| 1326 { | 1322 { |
| 1327 RenderLayer* curr = parent(); | 1323 RenderLayer* curr = parent(); |
| 1328 while (curr && !curr->isRootLayer() && !curr->transform()) | 1324 while (curr && !curr->isRootLayer() && !curr->transform()) |
| 1329 curr = curr->parent(); | 1325 curr = curr->parent(); |
| 1330 | 1326 |
| 1331 return curr; | 1327 return curr; |
| 1332 } | 1328 } |
| 1333 | 1329 |
| 1334 static inline const RenderLayer* compositingContainer(const RenderLayer* layer) | 1330 static inline const RenderLayer* compositingContainer(const RenderLayer* layer,
bool allowDirty = false) |
| 1335 { | 1331 { |
| 1336 return layer->isNormalFlowOnly() ? layer->parent() : layer->stackingContaine
r(); | 1332 return layer->isNormalFlowOnly() ? layer->parent() : layer->stackingContaine
r(allowDirty); |
| 1337 } | 1333 } |
| 1338 | 1334 |
| 1339 inline bool RenderLayer::shouldRepaintAfterLayout() const | 1335 inline bool RenderLayer::shouldRepaintAfterLayout() const |
| 1340 { | 1336 { |
| 1341 if (m_repaintStatus == NeedsNormalRepaint) | 1337 if (m_repaintStatus == NeedsNormalRepaint) |
| 1342 return true; | 1338 return true; |
| 1343 | 1339 |
| 1344 // Composited layers that were moved during a positioned movement only | 1340 // Composited layers that were moved during a positioned movement only |
| 1345 // layout, don't need to be repainted. They just need to be recomposited. | 1341 // layout, don't need to be repainted. They just need to be recomposited. |
| 1346 ASSERT(m_repaintStatus == NeedsFullRepaintForPositionedMovementLayout); | 1342 ASSERT(m_repaintStatus == NeedsFullRepaintForPositionedMovementLayout); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1358 } | 1354 } |
| 1359 | 1355 |
| 1360 return 0; | 1356 return 0; |
| 1361 } | 1357 } |
| 1362 | 1358 |
| 1363 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf)
const | 1359 RenderLayer* RenderLayer::enclosingCompositingLayerForRepaint(bool includeSelf)
const |
| 1364 { | 1360 { |
| 1365 if (includeSelf && isComposited() && !backing()->paintsIntoCompositedAncesto
r()) | 1361 if (includeSelf && isComposited() && !backing()->paintsIntoCompositedAncesto
r()) |
| 1366 return const_cast<RenderLayer*>(this); | 1362 return const_cast<RenderLayer*>(this); |
| 1367 | 1363 |
| 1368 for (const RenderLayer* curr = compositingContainer(this); curr; curr = comp
ositingContainer(curr)) { | 1364 for (const RenderLayer* curr = compositingContainer(this, true); curr; curr
= compositingContainer(curr, true)) { |
| 1369 if (curr->isComposited() && !curr->backing()->paintsIntoCompositedAncest
or()) | 1365 if (curr->isComposited() && !curr->backing()->paintsIntoCompositedAncest
or()) |
| 1370 return const_cast<RenderLayer*>(curr); | 1366 return const_cast<RenderLayer*>(curr); |
| 1371 } | 1367 } |
| 1372 | 1368 |
| 1373 return 0; | 1369 return 0; |
| 1374 } | 1370 } |
| 1375 | 1371 |
| 1376 #if ENABLE(CSS_FILTERS) | 1372 #if ENABLE(CSS_FILTERS) |
| 1377 RenderLayer* RenderLayer::enclosingFilterLayer(bool includeSelf) const | 1373 RenderLayer* RenderLayer::enclosingFilterLayer(bool includeSelf) const |
| 1378 { | 1374 { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 child->setParent(this); | 1666 child->setParent(this); |
| 1671 | 1667 |
| 1672 if (child->isNormalFlowOnly()) | 1668 if (child->isNormalFlowOnly()) |
| 1673 dirtyNormalFlowList(); | 1669 dirtyNormalFlowList(); |
| 1674 | 1670 |
| 1675 if (!child->isNormalFlowOnly() || child->firstChild()) { | 1671 if (!child->isNormalFlowOnly() || child->firstChild()) { |
| 1676 // Dirty the z-order list in which we are contained. The stackingContain
er() can be null in the | 1672 // Dirty the z-order list in which we are contained. The stackingContain
er() can be null in the |
| 1677 // case where we're building up generated content layers. This is ok, si
nce the lists will start | 1673 // case where we're building up generated content layers. This is ok, si
nce the lists will start |
| 1678 // off dirty in that case anyway. | 1674 // off dirty in that case anyway. |
| 1679 child->dirtyStackingContainerZOrderLists(); | 1675 child->dirtyStackingContainerZOrderLists(); |
| 1676 child->m_descendantsAreContiguousInStackingOrderDirty = true; |
| 1680 } | 1677 } |
| 1681 | 1678 |
| 1682 child->updateDescendantDependentFlags(); | 1679 child->updateDescendantDependentFlags(); |
| 1683 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) | 1680 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) |
| 1684 setAncestorChainHasVisibleDescendant(); | 1681 setAncestorChainHasVisibleDescendant(); |
| 1685 | 1682 |
| 1686 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) | 1683 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) |
| 1687 setAncestorChainHasSelfPaintingLayerDescendant(); | 1684 setAncestorChainHasSelfPaintingLayerDescendant(); |
| 1688 | 1685 |
| 1689 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil
d->hasOutOfFlowPositionedDescendant())) | 1686 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil
d->hasOutOfFlowPositionedDescendant())) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1703 if (oldChild->nextSibling()) | 1700 if (oldChild->nextSibling()) |
| 1704 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling())
; | 1701 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling())
; |
| 1705 | 1702 |
| 1706 if (m_first == oldChild) | 1703 if (m_first == oldChild) |
| 1707 m_first = oldChild->nextSibling(); | 1704 m_first = oldChild->nextSibling(); |
| 1708 if (m_last == oldChild) | 1705 if (m_last == oldChild) |
| 1709 m_last = oldChild->previousSibling(); | 1706 m_last = oldChild->previousSibling(); |
| 1710 | 1707 |
| 1711 if (oldChild->isNormalFlowOnly()) | 1708 if (oldChild->isNormalFlowOnly()) |
| 1712 dirtyNormalFlowList(); | 1709 dirtyNormalFlowList(); |
| 1713 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { | 1710 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { |
| 1714 // Dirty the z-order list in which we are contained. When called via th
e | 1711 // Dirty the z-order list in which we are contained. When called via th
e |
| 1715 // reattachment process in removeOnlyThisLayer, the layer may already be
disconnected | 1712 // reattachment process in removeOnlyThisLayer, the layer may already be
disconnected |
| 1716 // from the main layer tree, so we need to null-check the |stackingConta
iner| value. | 1713 // from the main layer tree, so we need to null-check the |stackingConta
iner| value. |
| 1717 oldChild->dirtyStackingContainerZOrderLists(); | 1714 oldChild->dirtyStackingContainerZOrderLists(); |
| 1715 m_descendantsAreContiguousInStackingOrderDirty = true; |
| 1718 } | 1716 } |
| 1719 | 1717 |
| 1720 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned())
|| oldChild->hasOutOfFlowPositionedDescendant()) | 1718 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned())
|| oldChild->hasOutOfFlowPositionedDescendant()) |
| 1721 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 1719 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
| 1722 | 1720 |
| 1723 oldChild->setPreviousSibling(0); | 1721 oldChild->setPreviousSibling(0); |
| 1724 oldChild->setNextSibling(0); | 1722 oldChild->setNextSibling(0); |
| 1725 oldChild->setParent(0); | 1723 oldChild->setParent(0); |
| 1726 | 1724 |
| 1727 oldChild->updateDescendantDependentFlags(); | 1725 oldChild->updateDescendantDependentFlags(); |
| 1728 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1726 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
| 1729 dirtyAncestorChainVisibleDescendantStatus(); | 1727 dirtyAncestorChainVisibleDescendantStatus(); |
| 1730 | 1728 |
| 1731 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend
ant()) | 1729 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend
ant()) |
| 1732 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1730 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 1733 | 1731 |
| 1734 return oldChild; | 1732 return oldChild; |
| 1735 } | 1733 } |
| 1736 | 1734 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 LayoutPoint delta; | 1928 LayoutPoint delta; |
| 1931 convertToLayerCoords(ancestorLayer, delta); | 1929 convertToLayerCoords(ancestorLayer, delta); |
| 1932 rect.move(-delta.x(), -delta.y()); | 1930 rect.move(-delta.x(), -delta.y()); |
| 1933 } | 1931 } |
| 1934 | 1932 |
| 1935 bool RenderLayer::usesCompositedScrolling() const | 1933 bool RenderLayer::usesCompositedScrolling() const |
| 1936 { | 1934 { |
| 1937 return isComposited() && backing()->scrollingLayer(); | 1935 return isComposited() && backing()->scrollingLayer(); |
| 1938 } | 1936 } |
| 1939 | 1937 |
| 1940 bool RenderLayer::needsCompositedScrolling() const | 1938 bool RenderLayer::needsCompositedScrolling(bool allowDirty) const |
| 1941 { | 1939 { |
| 1940 ASSERT(allowDirty || !m_descendantsAreContiguousInStackingOrderDirty); |
| 1941 ASSERT(allowDirty || !m_hasOutOfFlowPositionedDescendantDirty); |
| 1942 return m_needsCompositedScrolling; | 1942 return m_needsCompositedScrolling; |
| 1943 } | 1943 } |
| 1944 | 1944 |
| 1945 void RenderLayer::updateNeedsCompositedScrolling() | 1945 void RenderLayer::updateNeedsCompositedScrolling() |
| 1946 { | 1946 { |
| 1947 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; | 1947 bool needsCompositedScrolling = false; |
| 1948 | 1948 |
| 1949 FrameView* frameView = renderer()->view()->frameView(); | 1949 FrameView* frameView = renderer()->view()->frameView(); |
| 1950 if (!frameView || !frameView->containsScrollableArea(this)) | 1950 if (frameView && frameView->containsScrollableArea(this)) { |
| 1951 m_needsCompositedScrolling = false; | |
| 1952 else { | |
| 1953 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro
llEnabled() | 1951 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro
llEnabled() |
| 1954 && canBeStackingContainer() | 1952 && canBeStackingContainer() |
| 1955 && !hasOutOfFlowPositionedDescendant(); | 1953 && !hasOutOfFlowPositionedDescendant(); |
| 1956 | 1954 |
| 1957 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 1955 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
| 1958 m_needsCompositedScrolling = forceUseCompositedScrolling || renderer()->
style()->useTouchOverflowScrolling(); | 1956 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st
yle()->useTouchOverflowScrolling(); |
| 1959 #else | 1957 #else |
| 1960 m_needsCompositedScrolling = forceUseCompositedScrolling; | 1958 needsCompositedScrolling = forceUseCompositedScrolling; |
| 1961 #endif | 1959 #endif |
| 1962 // We gather a boolean value for use with Google UMA histograms to | 1960 // We gather a boolean value for use with Google UMA histograms to |
| 1963 // quantify the actual effects of a set of patches attempting to | 1961 // quantify the actual effects of a set of patches attempting to |
| 1964 // relax composited scrolling requirements, thereby increasing the | 1962 // relax composited scrolling requirements, thereby increasing the |
| 1965 // number of composited overflow divs. | 1963 // number of composited overflow divs. |
| 1966 if (acceleratedCompositingForOverflowScrollEnabled()) | 1964 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 1967 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro
lling", m_needsCompositedScrolling, 2); | 1965 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro
lling", needsCompositedScrolling, 2); |
| 1968 } | 1966 } |
| 1969 | 1967 |
| 1970 if (oldNeedsCompositedScrolling != m_needsCompositedScrolling) { | 1968 if (m_needsCompositedScrolling == needsCompositedScrolling) |
| 1971 updateSelfPaintingLayer(); | 1969 return; |
| 1972 if (isStackingContainer()) | |
| 1973 dirtyZOrderLists(); | |
| 1974 else | |
| 1975 clearZOrderLists(); | |
| 1976 | 1970 |
| 1977 dirtyStackingContainerZOrderLists(); | 1971 m_needsCompositedScrolling = needsCompositedScrolling; |
| 1978 | 1972 |
| 1979 compositor()->setShouldReevaluateCompositingAfterLayout(); | 1973 // Update values that depend on m_needsCompositedScrolling. |
| 1980 compositor()->setCompositingLayersNeedRebuild(); | 1974 updateIsNormalFlowOnly(); |
| 1975 updateSelfPaintingLayer(); |
| 1976 |
| 1977 // Changes to needsCompositedScrolling will affect which layers appear |
| 1978 // in which z-order lists (some layers that had previously been in our |
| 1979 // stacking context's lists may now be in ours), but it will never |
| 1980 // affect contiguity (this is the point of these opt in checks). So |
| 1981 // we will dirty the z-order lists but leave the contiguity dirty bit |
| 1982 // unaffected. RenderLayerCompositor guarantees these values are clean |
| 1983 // before calling updateNeedsCompositedScrolling, so we just need to |
| 1984 // reset the dirty bits to clean. |
| 1985 if (isStackingContainer()) |
| 1986 dirtyZOrderLists(); |
| 1987 else |
| 1988 clearZOrderLists(); |
| 1989 dirtyStackingContainerZOrderLists(); |
| 1990 |
| 1991 for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
| 1992 layer->m_descendantsAreContiguousInStackingOrderDirty = false; |
| 1993 if (layer->isStackingContext()) |
| 1994 break; |
| 1981 } | 1995 } |
| 1996 |
| 1997 compositor()->setShouldReevaluateCompositingAfterLayout(); |
| 1998 compositor()->setCompositingLayersNeedRebuild(); |
| 1982 } | 1999 } |
| 1983 | 2000 |
| 1984 static inline int adjustedScrollDelta(int beginningDelta) { | 2001 static inline int adjustedScrollDelta(int beginningDelta) { |
| 1985 // This implemention matches Firefox's. | 2002 // This implemention matches Firefox's. |
| 1986 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml
#856. | 2003 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml
#856. |
| 1987 const int speedReducer = 12; | 2004 const int speedReducer = 12; |
| 1988 | 2005 |
| 1989 int adjustedDelta = beginningDelta / speedReducer; | 2006 int adjustedDelta = beginningDelta / speedReducer; |
| 1990 if (adjustedDelta > 1) | 2007 if (adjustedDelta > 1) |
| 1991 adjustedDelta = static_cast<int>(adjustedDelta * sqrt(static_cast<double
>(adjustedDelta))) - 1; | 2008 adjustedDelta = static_cast<int>(adjustedDelta * sqrt(static_cast<double
>(adjustedDelta))) - 1; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 frameView->resumeScheduledEvents(); | 2283 frameView->resumeScheduledEvents(); |
| 2267 } | 2284 } |
| 2268 | 2285 |
| 2269 void RenderLayer::updateCompositingLayersAfterScroll() | 2286 void RenderLayer::updateCompositingLayersAfterScroll() |
| 2270 { | 2287 { |
| 2271 if (compositor()->inCompositingMode()) { | 2288 if (compositor()->inCompositingMode()) { |
| 2272 // Our stacking container is guaranteed to contain all of our descendant
s that may need | 2289 // Our stacking container is guaranteed to contain all of our descendant
s that may need |
| 2273 // repositioning, so update compositing layers from there. | 2290 // repositioning, so update compositing layers from there. |
| 2274 if (RenderLayer* compositingAncestor = stackingContainer()->enclosingCom
positingLayer()) { | 2291 if (RenderLayer* compositingAncestor = stackingContainer()->enclosingCom
positingLayer()) { |
| 2275 if (compositor()->compositingConsultsOverlap()) { | 2292 if (compositor()->compositingConsultsOverlap()) { |
| 2276 if (usesCompositedScrolling() && !hasOutOfFlowPositionedDescenda
nt()) | 2293 if (usesCompositedScrolling()) |
| 2277 compositor()->updateCompositingLayers(CompositingUpdateOnCom
positedScroll, compositingAncestor); | 2294 compositor()->updateCompositingLayers(CompositingUpdateOnCom
positedScroll, compositingAncestor); |
| 2278 else | 2295 else |
| 2279 compositor()->updateCompositingLayers(CompositingUpdateOnScr
oll, compositingAncestor); | 2296 compositor()->updateCompositingLayers(CompositingUpdateOnScr
oll, compositingAncestor); |
| 2280 } else | 2297 } else |
| 2281 compositingAncestor->backing()->updateAfterLayout(RenderLayerBac
king::IsUpdateRoot); | 2298 compositingAncestor->backing()->updateAfterLayout(RenderLayerBac
king::IsUpdateRoot); |
| 2282 } | 2299 } |
| 2283 } | 2300 } |
| 2284 } | 2301 } |
| 2285 | 2302 |
| 2286 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const Lay
outRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& align
Y) | 2303 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const Lay
outRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& align
Y) |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3101 // to pull our scroll offsets back to the max (or push them up to the mi
n). | 3118 // to pull our scroll offsets back to the max (or push them up to the mi
n). |
| 3102 IntSize clampedScrollOffset = clampScrollOffset(scrollOffset()); | 3119 IntSize clampedScrollOffset = clampScrollOffset(scrollOffset()); |
| 3103 if (clampedScrollOffset != scrollOffset()) | 3120 if (clampedScrollOffset != scrollOffset()) |
| 3104 scrollToOffset(clampedScrollOffset); | 3121 scrollToOffset(clampedScrollOffset); |
| 3105 } | 3122 } |
| 3106 | 3123 |
| 3107 updateScrollbarsAfterLayout(); | 3124 updateScrollbarsAfterLayout(); |
| 3108 | 3125 |
| 3109 if (originalScrollOffset != scrollOffset()) | 3126 if (originalScrollOffset != scrollOffset()) |
| 3110 scrollToOffsetWithoutAnimation(IntPoint(scrollOffset())); | 3127 scrollToOffsetWithoutAnimation(IntPoint(scrollOffset())); |
| 3111 | |
| 3112 // Composited scrolling may need to be enabled or disabled if the amount of
overflow changed. | |
| 3113 if (renderer()->view() && compositor()->updateLayerCompositingState(this)) | |
| 3114 compositor()->setCompositingLayersNeedRebuild(); | |
| 3115 } | 3128 } |
| 3116 | 3129 |
| 3117 bool RenderLayer::overflowControlsIntersectRect(const IntRect& localRect) const | 3130 bool RenderLayer::overflowControlsIntersectRect(const IntRect& localRect) const |
| 3118 { | 3131 { |
| 3119 const IntRect borderBox = renderBox()->pixelSnappedBorderBoxRect(); | 3132 const IntRect borderBox = renderBox()->pixelSnappedBorderBoxRect(); |
| 3120 | 3133 |
| 3121 if (rectForHorizontalScrollbar(borderBox).intersects(localRect)) | 3134 if (rectForHorizontalScrollbar(borderBox).intersects(localRect)) |
| 3122 return true; | 3135 return true; |
| 3123 | 3136 |
| 3124 if (rectForVerticalScrollbar(borderBox).intersects(localRect)) | 3137 if (rectForVerticalScrollbar(borderBox).intersects(localRect)) |
| (...skipping 2364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5489 | 5502 |
| 5490 // Helper for the sorting of layers by z-index. | 5503 // Helper for the sorting of layers by z-index. |
| 5491 static inline bool compareZIndex(RenderLayer* first, RenderLayer* second) | 5504 static inline bool compareZIndex(RenderLayer* first, RenderLayer* second) |
| 5492 { | 5505 { |
| 5493 return first->zIndex() < second->zIndex(); | 5506 return first->zIndex() < second->zIndex(); |
| 5494 } | 5507 } |
| 5495 | 5508 |
| 5496 void RenderLayer::dirtyZOrderLists() | 5509 void RenderLayer::dirtyZOrderLists() |
| 5497 { | 5510 { |
| 5498 ASSERT(m_layerListMutationAllowed); | 5511 ASSERT(m_layerListMutationAllowed); |
| 5499 ASSERT(isStackingContainer()); | |
| 5500 | 5512 |
| 5501 if (m_posZOrderList) | 5513 if (m_posZOrderList) |
| 5502 m_posZOrderList->clear(); | 5514 m_posZOrderList->clear(); |
| 5503 if (m_negZOrderList) | 5515 if (m_negZOrderList) |
| 5504 m_negZOrderList->clear(); | 5516 m_negZOrderList->clear(); |
| 5505 m_zOrderListsDirty = true; | 5517 m_zOrderListsDirty = true; |
| 5506 | 5518 |
| 5519 m_descendantsAreContiguousInStackingOrderDirty = true; |
| 5520 |
| 5507 if (!renderer()->documentBeingDestroyed()) { | 5521 if (!renderer()->documentBeingDestroyed()) { |
| 5508 compositor()->setCompositingLayersNeedRebuild(); | 5522 compositor()->setCompositingLayersNeedRebuild(); |
| 5509 if (acceleratedCompositingForOverflowScrollEnabled()) | 5523 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 5510 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5524 compositor()->setShouldReevaluateCompositingAfterLayout(); |
| 5511 } | 5525 } |
| 5512 } | 5526 } |
| 5513 | 5527 |
| 5514 void RenderLayer::dirtyStackingContainerZOrderLists() | 5528 void RenderLayer::dirtyStackingContainerZOrderLists() |
| 5515 { | 5529 { |
| 5516 RenderLayer* sc = stackingContainer(); | 5530 // When this function is called, we need to dirty both our enclosing |
| 5517 if (sc) | 5531 // stacking container and our stacking context's z-order lists since a |
| 5518 sc->dirtyZOrderLists(); | 5532 // z-order change in the container may affect our decision to opt into |
| 5533 // composited scrolling and could therefore affect either layer's z-order |
| 5534 // lists. Unfortunately, we are not able to ask if a layer is a stacking |
| 5535 // container once z-order lists start getting dirtied (since this will |
| 5536 // dirty descendants-are-contiguous-in-stacking-order and could affect our |
| 5537 // composited scrolling status and consequently our stacking-containerness) |
| 5538 // That said, we do know that if we march up our ancestors, once we reach |
| 5539 // a stacking context, we must have hit a stacking container (since |
| 5540 // stacking contexts are always stacking containers), so it's safe to stop |
| 5541 // there. |
| 5542 for (RenderLayer* layer = parent(); layer; layer = layer->parent()) { |
| 5543 layer->dirtyZOrderLists(); |
| 5544 if (layer->isStackingContext()) |
| 5545 break; |
| 5546 } |
| 5519 } | 5547 } |
| 5520 | 5548 |
| 5521 void RenderLayer::dirtyNormalFlowList() | 5549 void RenderLayer::dirtyNormalFlowList() |
| 5522 { | 5550 { |
| 5523 ASSERT(m_layerListMutationAllowed); | 5551 ASSERT(m_layerListMutationAllowed); |
| 5524 | 5552 |
| 5525 if (m_normalFlowList) | 5553 if (m_normalFlowList) |
| 5526 m_normalFlowList->clear(); | 5554 m_normalFlowList->clear(); |
| 5527 m_normalFlowListDirty = true; | 5555 m_normalFlowListDirty = true; |
| 5528 | 5556 |
| 5557 m_descendantsAreContiguousInStackingOrderDirty = true; |
| 5529 if (!renderer()->documentBeingDestroyed()) { | 5558 if (!renderer()->documentBeingDestroyed()) { |
| 5530 compositor()->setCompositingLayersNeedRebuild(); | 5559 compositor()->setCompositingLayersNeedRebuild(); |
| 5531 if (acceleratedCompositingForOverflowScrollEnabled()) | 5560 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 5532 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5561 compositor()->setShouldReevaluateCompositingAfterLayout(); |
| 5533 } | 5562 } |
| 5534 } | 5563 } |
| 5535 | 5564 |
| 5536 void RenderLayer::rebuildZOrderLists() | 5565 void RenderLayer::rebuildZOrderLists() |
| 5537 { | 5566 { |
| 5538 ASSERT(m_layerListMutationAllowed); | 5567 ASSERT(m_layerListMutationAllowed); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5621 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin
g()) { | 5650 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin
g()) { |
| 5622 // Ignore reflections. | 5651 // Ignore reflections. |
| 5623 if (!m_reflection || reflectionLayer() != child) | 5652 if (!m_reflection || reflectionLayer() != child) |
| 5624 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n
egBuffer); | 5653 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n
egBuffer); |
| 5625 } | 5654 } |
| 5626 } | 5655 } |
| 5627 } | 5656 } |
| 5628 | 5657 |
| 5629 void RenderLayer::updateLayerListsIfNeeded() | 5658 void RenderLayer::updateLayerListsIfNeeded() |
| 5630 { | 5659 { |
| 5631 bool shouldUpdateDescendantsAreContiguousInStackingOrder = isStackingContext
() && (m_zOrderListsDirty || m_normalFlowListDirty); | 5660 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos
itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty ||
m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; |
| 5632 updateZOrderLists(); | 5661 updateZOrderLists(); |
| 5633 updateNormalFlowList(); | 5662 updateNormalFlowList(); |
| 5634 | 5663 |
| 5635 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { | 5664 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { |
| 5636 reflectionLayer->updateZOrderLists(); | 5665 reflectionLayer->updateZOrderLists(); |
| 5637 reflectionLayer->updateNormalFlowList(); | 5666 reflectionLayer->updateNormalFlowList(); |
| 5638 } | 5667 } |
| 5639 | 5668 |
| 5640 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { | 5669 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { |
| 5641 updateDescendantsAreContiguousInStackingOrder(); | 5670 updateDescendantsAreContiguousInStackingOrder(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5717 && !renderer()->hasBlendMode() | 5746 && !renderer()->hasBlendMode() |
| 5718 #endif | 5747 #endif |
| 5719 && !isTransparent() | 5748 && !isTransparent() |
| 5720 && !needsCompositedScrolling() | 5749 && !needsCompositedScrolling() |
| 5721 #if ENABLE(CSS_EXCLUSIONS) | 5750 #if ENABLE(CSS_EXCLUSIONS) |
| 5722 && !renderer()->isFloatingWithShapeOutside() | 5751 && !renderer()->isFloatingWithShapeOutside() |
| 5723 #endif | 5752 #endif |
| 5724 ; | 5753 ; |
| 5725 } | 5754 } |
| 5726 | 5755 |
| 5756 void RenderLayer::updateIsNormalFlowOnly() |
| 5757 { |
| 5758 bool isNormalFlowOnly = shouldBeNormalFlowOnly(); |
| 5759 if (isNormalFlowOnly == m_isNormalFlowOnly) |
| 5760 return; |
| 5761 |
| 5762 m_isNormalFlowOnly = isNormalFlowOnly; |
| 5763 RenderLayer* p = parent(); |
| 5764 if (p) |
| 5765 p->dirtyNormalFlowList(); |
| 5766 dirtyStackingContainerZOrderLists(); |
| 5767 } |
| 5768 |
| 5727 bool RenderLayer::shouldBeSelfPaintingLayer() const | 5769 bool RenderLayer::shouldBeSelfPaintingLayer() const |
| 5728 { | 5770 { |
| 5729 return !isNormalFlowOnly() | 5771 return !isNormalFlowOnly() |
| 5730 || hasOverlayScrollbars() | 5772 || hasOverlayScrollbars() |
| 5731 || needsCompositedScrolling() | 5773 || needsCompositedScrolling() |
| 5732 || renderer()->hasReflection() | 5774 || renderer()->hasReflection() |
| 5733 || renderer()->hasMask() | 5775 || renderer()->hasMask() |
| 5734 || renderer()->isTableRow() | 5776 || renderer()->isTableRow() |
| 5735 || renderer()->isCanvas() | 5777 || renderer()->isCanvas() |
| 5736 || renderer()->isVideo() | 5778 || renderer()->isVideo() |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5801 return true; | 5843 return true; |
| 5802 | 5844 |
| 5803 if (hasVisibleBoxDecorations()) | 5845 if (hasVisibleBoxDecorations()) |
| 5804 return true; | 5846 return true; |
| 5805 | 5847 |
| 5806 return false; | 5848 return false; |
| 5807 } | 5849 } |
| 5808 | 5850 |
| 5809 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS
tyle) | 5851 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS
tyle) |
| 5810 { | 5852 { |
| 5811 if (!oldStyle) | 5853 bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; |
| 5812 return; | 5854 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; |
| 5813 | 5855 int oldZIndex = oldStyle ? oldStyle->zIndex() : 0; |
| 5814 bool wasStackingContext = isStackingContext(oldStyle); | |
| 5815 bool isStackingContext = this->isStackingContext(); | |
| 5816 if (isStackingContext != wasStackingContext) { | |
| 5817 dirtyStackingContainerZOrderLists(); | |
| 5818 if (isStackingContext) | |
| 5819 dirtyZOrderLists(); | |
| 5820 else | |
| 5821 clearZOrderLists(); | |
| 5822 return; | |
| 5823 } | |
| 5824 | 5856 |
| 5825 // FIXME: RenderLayer already handles visibility changes through our visibli
ty dirty bits. This logic could | 5857 // FIXME: RenderLayer already handles visibility changes through our visibli
ty dirty bits. This logic could |
| 5826 // likely be folded along with the rest. | 5858 // likely be folded along with the rest. |
| 5827 if (oldStyle->zIndex() != renderer()->style()->zIndex() || oldStyle->visibil
ity() != renderer()->style()->visibility()) { | 5859 bool isStackingContext = this->isStackingContext(); |
| 5828 dirtyStackingContainerZOrderLists(); | 5860 if (isStackingContext == wasStackingContext && oldVisibility == renderer()->
style()->visibility() && oldZIndex == renderer()->style()->zIndex()) |
| 5829 if (isStackingContext) | 5861 return; |
| 5830 dirtyZOrderLists(); | 5862 |
| 5831 } | 5863 dirtyStackingContainerZOrderLists(); |
| 5864 if (isStackingContainer()) |
| 5865 dirtyZOrderLists(); |
| 5866 else |
| 5867 clearZOrderLists(); |
| 5832 } | 5868 } |
| 5833 | 5869 |
| 5834 static bool overflowRequiresScrollbar(EOverflow overflow) | 5870 static bool overflowRequiresScrollbar(EOverflow overflow) |
| 5835 { | 5871 { |
| 5836 return overflow == OSCROLL; | 5872 return overflow == OSCROLL; |
| 5837 } | 5873 } |
| 5838 | 5874 |
| 5839 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 5875 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
| 5840 { | 5876 { |
| 5841 return overflow == OAUTO || overflow == OOVERLAY; | 5877 return overflow == OAUTO || overflow == OOVERLAY; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5878 } | 5914 } |
| 5879 | 5915 |
| 5880 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject*
containingBlock) | 5916 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject*
containingBlock) |
| 5881 { | 5917 { |
| 5882 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | 5918 for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
| 5883 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl
owPositionedDescendant()) | 5919 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl
owPositionedDescendant()) |
| 5884 break; | 5920 break; |
| 5885 | 5921 |
| 5886 layer->m_hasOutOfFlowPositionedDescendantDirty = false; | 5922 layer->m_hasOutOfFlowPositionedDescendantDirty = false; |
| 5887 layer->m_hasOutOfFlowPositionedDescendant = true; | 5923 layer->m_hasOutOfFlowPositionedDescendant = true; |
| 5888 layer->updateNeedsCompositedScrolling(); | |
| 5889 | 5924 |
| 5890 if (layer->renderer() && layer->renderer() == containingBlock) | 5925 if (layer->renderer() && layer->renderer() == containingBlock) |
| 5891 break; | 5926 break; |
| 5892 } | 5927 } |
| 5893 } | 5928 } |
| 5894 | 5929 |
| 5895 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() | 5930 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() |
| 5896 { | 5931 { |
| 5897 m_hasOutOfFlowPositionedDescendantDirty = true; | 5932 if (m_hasOutOfFlowPositionedDescendant) |
| 5933 m_hasOutOfFlowPositionedDescendantDirty = true; |
| 5934 |
| 5898 if (parent()) | 5935 if (parent()) |
| 5899 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 5936 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
| 5900 } | 5937 } |
| 5901 | 5938 |
| 5902 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) | 5939 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) |
| 5903 { | 5940 { |
| 5904 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP
osition || oldStyle->position() == FixedPosition); | 5941 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP
osition || oldStyle->position() == FixedPosition); |
| 5905 if (parent() && ((renderer() && renderer()->isOutOfFlowPositioned()) != wasO
utOfFlowPositioned)) { | 5942 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); |
| 5906 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 5943 if (parent() && isOutOfFlowPositioned != wasOutOfFlowPositioned) { |
| 5907 if (!renderer()->documentBeingDestroyed() && acceleratedCompositingForOv
erflowScrollEnabled()) | 5944 if (isOutOfFlowPositioned) |
| 5908 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5945 parent()->setAncestorChainHasOutOfFlowPositionedDescendant(renderer(
)->containingBlock()); |
| 5946 else |
| 5947 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus()
; |
| 5909 } | 5948 } |
| 5910 } | 5949 } |
| 5911 | 5950 |
| 5912 #if ENABLE(CSS_FILTERS) | 5951 #if ENABLE(CSS_FILTERS) |
| 5913 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS
tyle) | 5952 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS
tyle) |
| 5914 { | 5953 { |
| 5915 ASSERT(newStyle); | 5954 ASSERT(newStyle); |
| 5916 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); | 5955 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); |
| 5917 } | 5956 } |
| 5918 #endif | 5957 #endif |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5982 // FilterEffectRenderer is intended to render software filters and shouldn't
be needed for accelerated filters. | 6021 // FilterEffectRenderer is intended to render software filters and shouldn't
be needed for accelerated filters. |
| 5983 // We should extract the SVG graph building functionality out of FilterEffec
tRenderer, and it should happen in RenderLayer::computeFilterOperations. | 6022 // We should extract the SVG graph building functionality out of FilterEffec
tRenderer, and it should happen in RenderLayer::computeFilterOperations. |
| 5984 // https://bugs.webkit.org/show_bug.cgi?id=114051 | 6023 // https://bugs.webkit.org/show_bug.cgi?id=114051 |
| 5985 if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter()) | 6024 if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter()) |
| 5986 backing()->updateFilters(renderer()->style()); | 6025 backing()->updateFilters(renderer()->style()); |
| 5987 } | 6026 } |
| 5988 #endif | 6027 #endif |
| 5989 | 6028 |
| 5990 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) | 6029 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) |
| 5991 { | 6030 { |
| 5992 bool isNormalFlowOnly = shouldBeNormalFlowOnly(); | 6031 // Skip this for now. We'll do the update after layout. |
| 5993 if (isNormalFlowOnly != m_isNormalFlowOnly) { | 6032 // updateIsNormalFlowOnly(); |
| 5994 m_isNormalFlowOnly = isNormalFlowOnly; | |
| 5995 RenderLayer* p = parent(); | |
| 5996 if (p) | |
| 5997 p->dirtyNormalFlowList(); | |
| 5998 dirtyStackingContainerZOrderLists(); | |
| 5999 } | |
| 6000 | 6033 |
| 6001 if (renderer()->style()->overflowX() == OMARQUEE && renderer()->style()->mar
queeBehavior() != MNONE && renderer()->isBox()) { | 6034 if (renderer()->style()->overflowX() == OMARQUEE && renderer()->style()->mar
queeBehavior() != MNONE && renderer()->isBox()) { |
| 6002 if (!m_marquee) | 6035 if (!m_marquee) |
| 6003 m_marquee = adoptPtr(new RenderMarquee(this)); | 6036 m_marquee = adoptPtr(new RenderMarquee(this)); |
| 6004 FeatureObserver::observe(renderer()->document(), renderer()->isHTMLMarqu
ee() ? FeatureObserver::HTMLMarqueeElement : FeatureObserver::CSSOverflowMarquee
); | 6037 FeatureObserver::observe(renderer()->document(), renderer()->isHTMLMarqu
ee() ? FeatureObserver::HTMLMarqueeElement : FeatureObserver::CSSOverflowMarquee
); |
| 6005 m_marquee->updateMarqueeStyle(); | 6038 m_marquee->updateMarqueeStyle(); |
| 6006 } | 6039 } |
| 6007 else if (m_marquee) { | 6040 else if (m_marquee) { |
| 6008 m_marquee.clear(); | 6041 m_marquee.clear(); |
| 6009 } | 6042 } |
| 6010 | 6043 |
| 6011 updateScrollbarsAfterStyleChange(oldStyle); | 6044 updateScrollbarsAfterStyleChange(oldStyle); |
| 6012 updateStackingContextsAfterStyleChange(oldStyle); | 6045 updateStackingContextsAfterStyleChange(oldStyle); |
| 6046 |
| 6013 // Overlay scrollbars can make this layer self-painting so we need | 6047 // Overlay scrollbars can make this layer self-painting so we need |
| 6014 // to recompute the bit once scrollbars have been updated. | 6048 // to recompute the bit once scrollbars have been updated. |
| 6015 updateSelfPaintingLayer(); | 6049 |
| 6050 // Skip this for now. We'll do the update after layout. |
| 6051 // updateSelfPaintingLayer(); |
| 6016 updateOutOfFlowPositioned(oldStyle); | 6052 updateOutOfFlowPositioned(oldStyle); |
| 6017 | 6053 |
| 6018 if (!hasReflection() && m_reflection) | 6054 if (!hasReflection() && m_reflection) |
| 6019 removeReflection(); | 6055 removeReflection(); |
| 6020 else if (hasReflection()) { | 6056 else if (hasReflection()) { |
| 6021 if (!m_reflection) | 6057 if (!m_reflection) |
| 6022 createReflection(); | 6058 createReflection(); |
| 6023 FeatureObserver::observe(renderer()->document(), FeatureObserver::Reflec
tion); | 6059 FeatureObserver::observe(renderer()->document(), FeatureObserver::Reflec
tion); |
| 6024 updateReflectionStyle(); | 6060 updateReflectionStyle(); |
| 6025 } | 6061 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6040 #endif | 6076 #endif |
| 6041 | 6077 |
| 6042 bool didPaintWithFilters = false; | 6078 bool didPaintWithFilters = false; |
| 6043 | 6079 |
| 6044 #if ENABLE(CSS_FILTERS) | 6080 #if ENABLE(CSS_FILTERS) |
| 6045 if (paintsWithFilters()) | 6081 if (paintsWithFilters()) |
| 6046 didPaintWithFilters = true; | 6082 didPaintWithFilters = true; |
| 6047 updateFilters(oldStyle, renderer()->style()); | 6083 updateFilters(oldStyle, renderer()->style()); |
| 6048 #endif | 6084 #endif |
| 6049 | 6085 |
| 6050 updateNeedsCompositedScrolling(); | 6086 // FIXME(vollick) this requires updates that won't happen until after layout. |
| 6051 | 6087 // Will this just fall out of the updateCompositingLayers call that will be |
| 6052 const RenderStyle* newStyle = renderer()->style(); | 6088 // coming anyway? |
| 6053 if (compositor()->updateLayerCompositingState(this) | 6089 // |
| 6054 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 6090 // const RenderStyle* newStyle = renderer()->style(); |
| 6055 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 6091 // if (compositor()->updateLayerCompositingState(this) |
| 6056 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW
ithFilters)) | 6092 // || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) |
| 6057 compositor()->setCompositingLayersNeedRebuild(); | 6093 // || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
| 6058 else if (isComposited()) | 6094 // || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPain
tWithFilters)) |
| 6059 backing()->updateGraphicsLayerGeometry(); | 6095 // compositor()->setCompositingLayersNeedRebuild(); |
| 6096 // else if (isComposited()) |
| 6097 // backing()->updateGraphicsLayerGeometry(); |
| 6098 // |
| 6060 } | 6099 } |
| 6061 | 6100 |
| 6062 void RenderLayer::updateScrollableAreaSet(bool hasOverflow) | 6101 void RenderLayer::updateScrollableAreaSet(bool hasOverflow) |
| 6063 { | 6102 { |
| 6064 Frame* frame = renderer()->frame(); | 6103 Frame* frame = renderer()->frame(); |
| 6065 if (!frame) | 6104 if (!frame) |
| 6066 return; | 6105 return; |
| 6067 | 6106 |
| 6068 FrameView* frameView = frame->view(); | 6107 FrameView* frameView = frame->view(); |
| 6069 if (!frameView) | 6108 if (!frameView) |
| 6070 return; | 6109 return; |
| 6071 | 6110 |
| 6072 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); | 6111 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); |
| 6073 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) | 6112 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) |
| 6074 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH
itTesting(); | 6113 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH
itTesting(); |
| 6075 | 6114 |
| 6076 if (hasOverflow && isVisibleToHitTest ? frameView->addScrollableArea(this) :
frameView->removeScrollableArea(this)) | 6115 if (hasOverflow && isVisibleToHitTest) |
| 6077 updateNeedsCompositedScrolling(); | 6116 frameView->addScrollableArea(this); |
| 6117 else |
| 6118 frameView->removeScrollableArea(this); |
| 6078 } | 6119 } |
| 6079 | 6120 |
| 6080 void RenderLayer::updateScrollCornerStyle() | 6121 void RenderLayer::updateScrollCornerStyle() |
| 6081 { | 6122 { |
| 6082 RenderObject* actualRenderer = rendererForScrollbar(renderer()); | 6123 RenderObject* actualRenderer = rendererForScrollbar(renderer()); |
| 6083 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer-
>getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st
yle()) : PassRefPtr<RenderStyle>(0); | 6124 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer-
>getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st
yle()) : PassRefPtr<RenderStyle>(0); |
| 6084 if (corner) { | 6125 if (corner) { |
| 6085 if (!m_scrollCorner) { | 6126 if (!m_scrollCorner) { |
| 6086 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do
cument()); | 6127 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do
cument()); |
| 6087 m_scrollCorner->setParent(renderer()); | 6128 m_scrollCorner->setParent(renderer()); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6320 } | 6361 } |
| 6321 } | 6362 } |
| 6322 | 6363 |
| 6323 void showLayerTree(const WebCore::RenderObject* renderer) | 6364 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6324 { | 6365 { |
| 6325 if (!renderer) | 6366 if (!renderer) |
| 6326 return; | 6367 return; |
| 6327 showLayerTree(renderer->enclosingLayer()); | 6368 showLayerTree(renderer->enclosingLayer()); |
| 6328 } | 6369 } |
| 6329 #endif | 6370 #endif |
| OLD | NEW |