Chromium Code Reviews| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(true) |
| 150 , m_needsCompositedScrolling(false) | 150 , m_needsCompositedScrolling(false) |
| 151 , m_descendantsAreContiguousInStackingOrder(false) | 151 , m_descendantsAreContiguousInStackingOrder(false) |
| 152 , m_descendantsAreContiguousInStackingOrderDirty(true) | |
| 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()) |
| 599 return; | 600 return; |
| 600 | 601 |
| 601 ASSERT(!m_normalFlowListDirty); | |
| 602 ASSERT(!m_zOrderListsDirty); | |
|
Julien - ping for review
2013/04/18 00:42:34
I would have like to see any explanation why this
| |
| 603 | |
| 604 OwnPtr<Vector<RenderLayer*> > posZOrderList; | 602 OwnPtr<Vector<RenderLayer*> > posZOrderList; |
| 605 OwnPtr<Vector<RenderLayer*> > negZOrderList; | 603 OwnPtr<Vector<RenderLayer*> > negZOrderList; |
| 606 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); | 604 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); |
| 607 | 605 |
| 608 // Create a reverse lookup. | 606 // Create a reverse lookup. |
| 609 HashMap<const RenderLayer*, int> lookup; | 607 HashMap<const RenderLayer*, int> lookup; |
| 610 | 608 |
| 611 if (negZOrderList) { | 609 if (negZOrderList) { |
| 612 int stackingOrderIndex = -1; | 610 int stackingOrderIndex = -1; |
| 613 size_t listSize = negZOrderList->size(); | 611 size_t listSize = negZOrderList->size(); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 628 continue; | 626 continue; |
| 629 lookup.set(currentLayer, stackingOrderIndex++); | 627 lookup.set(currentLayer, stackingOrderIndex++); |
| 630 } | 628 } |
| 631 } | 629 } |
| 632 | 630 |
| 633 int minIndex = 0; | 631 int minIndex = 0; |
| 634 int maxIndex = 0; | 632 int maxIndex = 0; |
| 635 int count = 0; | 633 int count = 0; |
| 636 bool firstIteration = true; | 634 bool firstIteration = true; |
| 637 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max Index, count, firstIteration); | 635 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max Index, count, firstIteration); |
| 636 | |
| 637 m_descendantsAreContiguousInStackingOrderDirty = false; | |
| 638 } | 638 } |
| 639 | 639 |
| 640 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun t, bool firstIteration) | 640 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun t, bool firstIteration) |
| 641 { | 641 { |
| 642 if (isStackingContext() && !firstIteration) { | 642 if (isStackingContext() && !firstIteration) { |
| 643 if (lookup.contains(this)) { | 643 if (lookup.contains(this)) { |
| 644 minIndex = std::min(minIndex, lookup.get(this)); | 644 minIndex = std::min(minIndex, lookup.get(this)); |
| 645 maxIndex = std::max(maxIndex, lookup.get(this)); | 645 maxIndex = std::max(maxIndex, lookup.get(this)); |
| 646 count++; | 646 count++; |
| 647 } | 647 } |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1023 break; | 1023 break; |
| 1024 | 1024 |
| 1025 layer->m_hasVisibleDescendant = true; | 1025 layer->m_hasVisibleDescendant = true; |
| 1026 layer->m_visibleDescendantStatusDirty = false; | 1026 layer->m_visibleDescendantStatusDirty = false; |
| 1027 } | 1027 } |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* o utOfFlowDescendantContainingBlocks) | 1030 void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* o utOfFlowDescendantContainingBlocks) |
| 1031 { | 1031 { |
| 1032 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty) { | 1032 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty) { |
| 1033 const bool hadVisibleDescendant = m_hasVisibleDescendant; | |
| 1034 const bool hadOutOfFlowPositionedDescendant = m_hasOutOfFlowPositionedDe scendant; | |
| 1035 | |
| 1033 m_hasVisibleDescendant = false; | 1036 m_hasVisibleDescendant = false; |
| 1034 m_hasSelfPaintingLayerDescendant = false; | 1037 m_hasSelfPaintingLayerDescendant = false; |
| 1035 m_hasOutOfFlowPositionedDescendant = false; | 1038 m_hasOutOfFlowPositionedDescendant = false; |
| 1036 | 1039 |
| 1037 HashSet<const RenderObject*> childOutOfFlowDescendantContainingBlocks; | 1040 HashSet<const RenderObject*> childOutOfFlowDescendantContainingBlocks; |
| 1038 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { | 1041 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
| 1039 childOutOfFlowDescendantContainingBlocks.clear(); | 1042 childOutOfFlowDescendantContainingBlocks.clear(); |
| 1040 child->updateDescendantDependentFlags(&childOutOfFlowDescendantConta iningBlocks); | 1043 child->updateDescendantDependentFlags(&childOutOfFlowDescendantConta iningBlocks); |
| 1041 | 1044 |
| 1042 bool childIsOutOfFlowPositioned = child->renderer() && child->render er()->isOutOfFlowPositioned(); | 1045 bool childIsOutOfFlowPositioned = child->renderer() && child->render er()->isOutOfFlowPositioned(); |
| 1046 | |
|
Julien - ping for review
2013/04/18 00:42:34
Nit: Unneeded extra-space.
Ian Vollick
2013/04/18 20:55:52
Done.
| |
| 1043 if (childIsOutOfFlowPositioned) | 1047 if (childIsOutOfFlowPositioned) |
| 1044 childOutOfFlowDescendantContainingBlocks.add(child->renderer()-> containingBlock()); | 1048 childOutOfFlowDescendantContainingBlocks.add(child->renderer()-> containingBlock()); |
| 1045 | 1049 |
| 1046 if (outOfFlowDescendantContainingBlocks) { | 1050 if (outOfFlowDescendantContainingBlocks) { |
| 1047 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow DescendantContainingBlocks.begin(); | 1051 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow DescendantContainingBlocks.begin(); |
| 1048 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i t) | 1052 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i t) |
| 1049 outOfFlowDescendantContainingBlocks->add(*it); | 1053 outOfFlowDescendantContainingBlocks->add(*it); |
| 1050 } | 1054 } |
| 1051 | 1055 |
| 1052 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; | 1056 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; |
| 1053 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); | 1057 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); |
| 1054 bool hasOutOfFlowPositionedDescendant = !childOutOfFlowDescendantCon tainingBlocks.isEmpty(); | 1058 bool hasOutOfFlowPositionedDescendant = hasVisibleDescendant && (!ch ildOutOfFlowDescendantContainingBlocks.isEmpty() || child->hasOutOfFlowPositione dDescendant()); |
| 1055 | 1059 |
| 1056 m_hasVisibleDescendant |= hasVisibleDescendant; | 1060 m_hasVisibleDescendant |= hasVisibleDescendant; |
| 1057 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; | 1061 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; |
| 1058 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt; | 1062 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt; |
| 1059 | 1063 |
| 1060 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_ hasOutOfFlowPositionedDescendant) | 1064 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_ hasOutOfFlowPositionedDescendant) |
| 1061 break; | 1065 break; |
| 1062 } | 1066 } |
| 1063 | 1067 |
| 1064 if (outOfFlowDescendantContainingBlocks && renderer()) | 1068 if (outOfFlowDescendantContainingBlocks && renderer()) |
| 1065 outOfFlowDescendantContainingBlocks->remove(renderer()); | 1069 outOfFlowDescendantContainingBlocks->remove(renderer()); |
| 1066 | 1070 |
| 1067 m_visibleDescendantStatusDirty = false; | 1071 m_visibleDescendantStatusDirty = false; |
| 1068 m_hasSelfPaintingLayerDescendantDirty = false; | 1072 m_hasSelfPaintingLayerDescendantDirty = false; |
| 1073 m_hasOutOfFlowPositionedDescendantDirty = false; | |
| 1069 | 1074 |
| 1070 if (m_hasOutOfFlowPositionedDescendantDirty) | 1075 if (m_hasVisibleDescendant != hadVisibleDescendant || m_hasOutOfFlowPosi tionedDescendant != hadOutOfFlowPositionedDescendant) |
| 1071 updateNeedsCompositedScrolling(); | 1076 updateNeedsCompositedScrolling(); |
| 1072 | |
| 1073 m_hasOutOfFlowPositionedDescendantDirty = false; | |
| 1074 } | 1077 } |
| 1075 | 1078 |
| 1076 if (m_visibleContentStatusDirty) { | 1079 if (m_visibleContentStatusDirty) { |
| 1080 const bool hadVisibleContent = m_hasVisibleContent; | |
| 1077 if (renderer()->style()->visibility() == VISIBLE) | 1081 if (renderer()->style()->visibility() == VISIBLE) |
| 1078 m_hasVisibleContent = true; | 1082 m_hasVisibleContent = true; |
| 1079 else { | 1083 else { |
| 1080 // layer may be hidden but still have some visible content, check fo r this | 1084 // layer may be hidden but still have some visible content, check fo r this |
| 1081 m_hasVisibleContent = false; | 1085 m_hasVisibleContent = false; |
| 1082 RenderObject* r = renderer()->firstChild(); | 1086 RenderObject* r = renderer()->firstChild(); |
| 1083 while (r) { | 1087 while (r) { |
| 1084 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { | 1088 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { |
| 1085 m_hasVisibleContent = true; | 1089 m_hasVisibleContent = true; |
| 1086 break; | 1090 break; |
| 1087 } | 1091 } |
| 1088 if (r->firstChild() && !r->hasLayer()) | 1092 if (r->firstChild() && !r->hasLayer()) |
| 1089 r = r->firstChild(); | 1093 r = r->firstChild(); |
| 1090 else if (r->nextSibling()) | 1094 else if (r->nextSibling()) |
| 1091 r = r->nextSibling(); | 1095 r = r->nextSibling(); |
| 1092 else { | 1096 else { |
| 1093 do { | 1097 do { |
| 1094 r = r->parent(); | 1098 r = r->parent(); |
| 1095 if (r == renderer()) | 1099 if (r == renderer()) |
| 1096 r = 0; | 1100 r = 0; |
| 1097 } while (r && !r->nextSibling()); | 1101 } while (r && !r->nextSibling()); |
| 1098 if (r) | 1102 if (r) |
| 1099 r = r->nextSibling(); | 1103 r = r->nextSibling(); |
| 1100 } | 1104 } |
| 1101 } | 1105 } |
| 1102 } | 1106 } |
| 1103 m_visibleContentStatusDirty = false; | 1107 m_visibleContentStatusDirty = false; |
| 1108 if (hadVisibleContent != m_hasVisibleContent) | |
| 1109 updateNeedsCompositedScrolling(); | |
| 1104 } | 1110 } |
| 1105 } | 1111 } |
| 1106 | 1112 |
| 1107 void RenderLayer::dirty3DTransformedDescendantStatus() | 1113 void RenderLayer::dirty3DTransformedDescendantStatus() |
| 1108 { | 1114 { |
| 1109 RenderLayer* curr = stackingContainer(); | 1115 RenderLayer* curr = stackingContainer(); |
| 1110 if (curr) | 1116 if (curr) |
| 1111 curr->m_3DTransformedDescendantStatusDirty = true; | 1117 curr->m_3DTransformedDescendantStatusDirty = true; |
| 1112 | 1118 |
| 1113 // This propagates up through preserve-3d hierarchies to the enclosing flatt ening layer. | 1119 // This propagates up through preserve-3d hierarchies to the enclosing flatt ening layer. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1280 RenderLayer* RenderLayer::stackingContainer() const | 1286 RenderLayer* RenderLayer::stackingContainer() const |
| 1281 { | 1287 { |
| 1282 RenderLayer* layer = parent(); | 1288 RenderLayer* layer = parent(); |
| 1283 while (layer && !layer->isStackingContainer()) | 1289 while (layer && !layer->isStackingContainer()) |
| 1284 layer = layer->parent(); | 1290 layer = layer->parent(); |
| 1285 | 1291 |
| 1286 ASSERT(!layer || layer->isStackingContainer()); | 1292 ASSERT(!layer || layer->isStackingContainer()); |
| 1287 return layer; | 1293 return layer; |
| 1288 } | 1294 } |
| 1289 | 1295 |
| 1296 RenderLayer* RenderLayer::stackingContext() const | |
|
Julien - ping for review
2013/04/18 00:42:34
This function should be named stackingContextAnces
Ian Vollick
2013/04/18 20:55:52
Done.
| |
| 1297 { | |
| 1298 RenderLayer* layer = parent(); | |
|
Julien - ping for review
2013/04/18 00:42:34
Note that this could be implemented (which I would
Ian Vollick
2013/04/18 20:55:52
Done.
| |
| 1299 while (layer && !layer->isStackingContext()) | |
| 1300 layer = layer->parent(); | |
| 1301 | |
| 1302 ASSERT(!layer || layer->isStackingContext()); | |
| 1303 return layer; | |
| 1304 } | |
| 1305 | |
| 1290 static inline bool isPositionedContainer(RenderLayer* layer) | 1306 static inline bool isPositionedContainer(RenderLayer* layer) |
| 1291 { | 1307 { |
| 1292 RenderLayerModelObject* layerRenderer = layer->renderer(); | 1308 RenderLayerModelObject* layerRenderer = layer->renderer(); |
| 1293 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); | 1309 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); |
| 1294 } | 1310 } |
| 1295 | 1311 |
| 1296 static inline bool isFixedPositionedContainer(RenderLayer* layer) | 1312 static inline bool isFixedPositionedContainer(RenderLayer* layer) |
| 1297 { | 1313 { |
| 1298 return layer->isRootLayer() || layer->hasTransform(); | 1314 return layer->isRootLayer() || layer->hasTransform(); |
| 1299 } | 1315 } |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1670 child->setParent(this); | 1686 child->setParent(this); |
| 1671 | 1687 |
| 1672 if (child->isNormalFlowOnly()) | 1688 if (child->isNormalFlowOnly()) |
| 1673 dirtyNormalFlowList(); | 1689 dirtyNormalFlowList(); |
| 1674 | 1690 |
| 1675 if (!child->isNormalFlowOnly() || child->firstChild()) { | 1691 if (!child->isNormalFlowOnly() || child->firstChild()) { |
| 1676 // Dirty the z-order list in which we are contained. The stackingContain er() can be null in the | 1692 // 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 | 1693 // 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. | 1694 // off dirty in that case anyway. |
| 1679 child->dirtyStackingContainerZOrderLists(); | 1695 child->dirtyStackingContainerZOrderLists(); |
| 1696 child->updateDescendantsAreContiguousInStackingOrder(); | |
| 1697 | |
| 1698 // Adding an out of flow positioned descendant can only affect | |
| 1699 // the opt-in decision for layers beneath and including our | |
| 1700 // containing block. | |
| 1701 RenderObject* containingBlock = child->renderer()->containingBlock(); | |
| 1702 for (RenderLayer* layer = child; layer; layer = layer->parent()) { | |
| 1703 layer->updateNeedsCompositedScrolling(); | |
| 1704 if (layer->renderer() == containingBlock) | |
| 1705 break; | |
| 1706 } | |
| 1680 } | 1707 } |
| 1681 | 1708 |
| 1682 child->updateDescendantDependentFlags(); | 1709 child->updateDescendantDependentFlags(); |
| 1683 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) | 1710 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) |
| 1684 setAncestorChainHasVisibleDescendant(); | 1711 setAncestorChainHasVisibleDescendant(); |
| 1685 | 1712 |
| 1686 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) | 1713 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) |
| 1687 setAncestorChainHasSelfPaintingLayerDescendant(); | 1714 setAncestorChainHasSelfPaintingLayerDescendant(); |
| 1688 | 1715 |
| 1689 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil d->hasOutOfFlowPositionedDescendant())) | 1716 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil d->hasOutOfFlowPositionedDescendant())) |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1703 if (oldChild->nextSibling()) | 1730 if (oldChild->nextSibling()) |
| 1704 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; | 1731 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; |
| 1705 | 1732 |
| 1706 if (m_first == oldChild) | 1733 if (m_first == oldChild) |
| 1707 m_first = oldChild->nextSibling(); | 1734 m_first = oldChild->nextSibling(); |
| 1708 if (m_last == oldChild) | 1735 if (m_last == oldChild) |
| 1709 m_last = oldChild->previousSibling(); | 1736 m_last = oldChild->previousSibling(); |
| 1710 | 1737 |
| 1711 if (oldChild->isNormalFlowOnly()) | 1738 if (oldChild->isNormalFlowOnly()) |
| 1712 dirtyNormalFlowList(); | 1739 dirtyNormalFlowList(); |
| 1713 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { | 1740 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { |
| 1714 // Dirty the z-order list in which we are contained. When called via th e | 1741 // 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 | 1742 // 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. | 1743 // from the main layer tree, so we need to null-check the |stackingConta iner| value. |
| 1717 oldChild->dirtyStackingContainerZOrderLists(); | 1744 oldChild->dirtyStackingContainerZOrderLists(); |
| 1745 updateDescendantsAreContiguousInStackingOrder(); | |
| 1746 | |
| 1747 // This could affect whether or not a layer has an out of flow | |
| 1748 // positioned descendant so we need to schedule some updates. | |
| 1749 for (RenderLayer* layer = this; layer; layer = layer->parent()) | |
|
Julien - ping for review
2013/04/18 00:42:34
This could probably stop at the oldChild's contain
Ian Vollick
2013/04/18 20:55:52
Done.
| |
| 1750 layer->updateNeedsCompositedScrolling(); | |
| 1718 } | 1751 } |
| 1719 | 1752 |
| 1720 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned()) || oldChild->hasOutOfFlowPositionedDescendant()) | 1753 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned()) || oldChild->hasOutOfFlowPositionedDescendant()) |
| 1721 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 1754 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
| 1722 | 1755 |
| 1723 oldChild->setPreviousSibling(0); | 1756 oldChild->setPreviousSibling(0); |
| 1724 oldChild->setNextSibling(0); | 1757 oldChild->setNextSibling(0); |
| 1725 oldChild->setParent(0); | 1758 oldChild->setParent(0); |
| 1726 | 1759 |
| 1727 oldChild->updateDescendantDependentFlags(); | 1760 oldChild->updateDescendantDependentFlags(); |
| 1728 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1761 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
| 1729 dirtyAncestorChainVisibleDescendantStatus(); | 1762 dirtyAncestorChainVisibleDescendantStatus(); |
| 1730 | 1763 |
| 1731 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) | 1764 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) |
| 1732 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1765 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 1733 | 1766 |
| 1734 return oldChild; | 1767 return oldChild; |
| 1735 } | 1768 } |
| 1736 | 1769 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1937 return isComposited() && backing()->scrollingLayer(); | 1970 return isComposited() && backing()->scrollingLayer(); |
| 1938 } | 1971 } |
| 1939 | 1972 |
| 1940 bool RenderLayer::needsCompositedScrolling() const | 1973 bool RenderLayer::needsCompositedScrolling() const |
| 1941 { | 1974 { |
| 1942 return m_needsCompositedScrolling; | 1975 return m_needsCompositedScrolling; |
| 1943 } | 1976 } |
| 1944 | 1977 |
| 1945 void RenderLayer::updateNeedsCompositedScrolling() | 1978 void RenderLayer::updateNeedsCompositedScrolling() |
| 1946 { | 1979 { |
| 1947 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; | 1980 bool needsCompositedScrolling = false; |
| 1948 | 1981 |
| 1949 FrameView* frameView = renderer()->view()->frameView(); | 1982 FrameView* frameView = renderer()->view()->frameView(); |
| 1950 if (!frameView || !frameView->containsScrollableArea(this)) | 1983 if (frameView && frameView->containsScrollableArea(this)) { |
| 1951 m_needsCompositedScrolling = false; | 1984 updateDescendantDependentFlags(); |
| 1952 else { | 1985 |
| 1953 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() | 1986 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() |
| 1954 && canBeStackingContainer() | 1987 && canBeStackingContainer() |
| 1955 && !hasOutOfFlowPositionedDescendant(); | 1988 && !hasOutOfFlowPositionedDescendant(); |
| 1956 | 1989 |
| 1957 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 1990 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
| 1958 m_needsCompositedScrolling = forceUseCompositedScrolling || renderer()-> style()->useTouchOverflowScrolling(); | 1991 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st yle()->useTouchOverflowScrolling(); |
| 1959 #else | 1992 #else |
| 1960 m_needsCompositedScrolling = forceUseCompositedScrolling; | 1993 needsCompositedScrolling = forceUseCompositedScrolling; |
| 1961 #endif | 1994 #endif |
| 1962 // We gather a boolean value for use with Google UMA histograms to | 1995 // We gather a boolean value for use with Google UMA histograms to |
| 1963 // quantify the actual effects of a set of patches attempting to | 1996 // quantify the actual effects of a set of patches attempting to |
| 1964 // relax composited scrolling requirements, thereby increasing the | 1997 // relax composited scrolling requirements, thereby increasing the |
| 1965 // number of composited overflow divs. | 1998 // number of composited overflow divs. |
| 1966 if (acceleratedCompositingForOverflowScrollEnabled()) | 1999 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 1967 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro lling", m_needsCompositedScrolling, 2); | 2000 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro lling", needsCompositedScrolling, 2); |
| 1968 } | 2001 } |
| 1969 | 2002 |
| 1970 if (oldNeedsCompositedScrolling != m_needsCompositedScrolling) { | 2003 if (m_needsCompositedScrolling == needsCompositedScrolling) |
| 1971 updateSelfPaintingLayer(); | 2004 return; |
| 1972 if (isStackingContainer()) | |
| 1973 dirtyZOrderLists(); | |
| 1974 else | |
| 1975 clearZOrderLists(); | |
| 1976 | 2005 |
| 1977 dirtyStackingContainerZOrderLists(); | 2006 m_needsCompositedScrolling = needsCompositedScrolling; |
| 1978 | 2007 |
| 1979 compositor()->setShouldReevaluateCompositingAfterLayout(); | 2008 updateIsNormalFlowOnly(); |
| 1980 compositor()->setCompositingLayersNeedRebuild(); | 2009 updateSelfPaintingLayer(); |
| 1981 } | 2010 |
| 2011 if (isStackingContainer()) | |
| 2012 dirtyZOrderLists(); | |
| 2013 else | |
| 2014 clearZOrderLists(); | |
| 2015 | |
| 2016 dirtyStackingContainerZOrderLists(); | |
| 2017 | |
| 2018 compositor()->setShouldReevaluateCompositingAfterLayout(); | |
| 2019 compositor()->setCompositingLayersNeedRebuild(); | |
| 1982 } | 2020 } |
| 1983 | 2021 |
| 1984 static inline int adjustedScrollDelta(int beginningDelta) { | 2022 static inline int adjustedScrollDelta(int beginningDelta) { |
| 1985 // This implemention matches Firefox's. | 2023 // This implemention matches Firefox's. |
| 1986 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml #856. | 2024 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml #856. |
| 1987 const int speedReducer = 12; | 2025 const int speedReducer = 12; |
| 1988 | 2026 |
| 1989 int adjustedDelta = beginningDelta / speedReducer; | 2027 int adjustedDelta = beginningDelta / speedReducer; |
| 1990 if (adjustedDelta > 1) | 2028 if (adjustedDelta > 1) |
| 1991 adjustedDelta = static_cast<int>(adjustedDelta * sqrt(static_cast<double >(adjustedDelta))) - 1; | 2029 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(); | 2304 frameView->resumeScheduledEvents(); |
| 2267 } | 2305 } |
| 2268 | 2306 |
| 2269 void RenderLayer::updateCompositingLayersAfterScroll() | 2307 void RenderLayer::updateCompositingLayersAfterScroll() |
| 2270 { | 2308 { |
| 2271 if (compositor()->inCompositingMode()) { | 2309 if (compositor()->inCompositingMode()) { |
| 2272 // Our stacking container is guaranteed to contain all of our descendant s that may need | 2310 // Our stacking container is guaranteed to contain all of our descendant s that may need |
| 2273 // repositioning, so update compositing layers from there. | 2311 // repositioning, so update compositing layers from there. |
| 2274 if (RenderLayer* compositingAncestor = stackingContainer()->enclosingCom positingLayer()) { | 2312 if (RenderLayer* compositingAncestor = stackingContainer()->enclosingCom positingLayer()) { |
| 2275 if (compositor()->compositingConsultsOverlap()) { | 2313 if (compositor()->compositingConsultsOverlap()) { |
| 2276 if (usesCompositedScrolling() && !hasOutOfFlowPositionedDescenda nt()) | 2314 if (usesCompositedScrolling()) |
| 2277 compositor()->updateCompositingLayers(CompositingUpdateOnCom positedScroll, compositingAncestor); | 2315 compositor()->updateCompositingLayers(CompositingUpdateOnCom positedScroll, compositingAncestor); |
| 2278 else | 2316 else |
| 2279 compositor()->updateCompositingLayers(CompositingUpdateOnScr oll, compositingAncestor); | 2317 compositor()->updateCompositingLayers(CompositingUpdateOnScr oll, compositingAncestor); |
| 2280 } else | 2318 } else |
| 2281 compositingAncestor->backing()->updateAfterLayout(RenderLayerBac king::IsUpdateRoot); | 2319 compositingAncestor->backing()->updateAfterLayout(RenderLayerBac king::IsUpdateRoot); |
| 2282 } | 2320 } |
| 2283 } | 2321 } |
| 2284 } | 2322 } |
| 2285 | 2323 |
| 2286 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const Lay outRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& align Y) | 2324 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const Lay outRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& align Y) |
| (...skipping 3210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5497 { | 5535 { |
| 5498 ASSERT(m_layerListMutationAllowed); | 5536 ASSERT(m_layerListMutationAllowed); |
| 5499 ASSERT(isStackingContainer()); | 5537 ASSERT(isStackingContainer()); |
| 5500 | 5538 |
| 5501 if (m_posZOrderList) | 5539 if (m_posZOrderList) |
| 5502 m_posZOrderList->clear(); | 5540 m_posZOrderList->clear(); |
| 5503 if (m_negZOrderList) | 5541 if (m_negZOrderList) |
| 5504 m_negZOrderList->clear(); | 5542 m_negZOrderList->clear(); |
| 5505 m_zOrderListsDirty = true; | 5543 m_zOrderListsDirty = true; |
| 5506 | 5544 |
| 5545 m_descendantsAreContiguousInStackingOrderDirty = true; | |
| 5546 updateDescendantsAreContiguousInStackingOrder(); | |
| 5547 | |
| 5507 if (!renderer()->documentBeingDestroyed()) { | 5548 if (!renderer()->documentBeingDestroyed()) { |
| 5508 compositor()->setCompositingLayersNeedRebuild(); | 5549 compositor()->setCompositingLayersNeedRebuild(); |
| 5509 if (acceleratedCompositingForOverflowScrollEnabled()) | 5550 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 5510 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5551 compositor()->setShouldReevaluateCompositingAfterLayout(); |
| 5511 } | 5552 } |
| 5512 } | 5553 } |
| 5513 | 5554 |
| 5514 void RenderLayer::dirtyStackingContainerZOrderLists() | 5555 void RenderLayer::dirtyStackingContainerZOrderLists() |
| 5515 { | 5556 { |
| 5516 RenderLayer* sc = stackingContainer(); | 5557 RenderLayer* stackingContainer = this->stackingContainer(); |
| 5517 if (sc) | 5558 if (stackingContainer) |
|
Julien - ping for review
2013/04/18 00:42:34
There is only one case where this could be NULL: t
Ian Vollick
2013/04/18 20:55:52
Done.
| |
| 5518 sc->dirtyZOrderLists(); | 5559 stackingContainer->dirtyZOrderLists(); |
| 5560 | |
| 5561 // Any change that could affect our stacking container's z-order list could | |
| 5562 // cause other RenderLayers in our stacking context to either opt in or out | |
| 5563 // of composited scrolling. It is important that we make our stacking | |
| 5564 // context aware of these z-order changes so the appropriate updating can | |
| 5565 // happen. | |
| 5566 RenderLayer* stackingContext = this->stackingContext(); | |
| 5567 if (stackingContext && stackingContext != stackingContainer) | |
| 5568 stackingContext->dirtyZOrderLists(); | |
| 5519 } | 5569 } |
| 5520 | 5570 |
| 5521 void RenderLayer::dirtyNormalFlowList() | 5571 void RenderLayer::dirtyNormalFlowList() |
| 5522 { | 5572 { |
| 5523 ASSERT(m_layerListMutationAllowed); | 5573 ASSERT(m_layerListMutationAllowed); |
| 5524 | 5574 |
| 5525 if (m_normalFlowList) | 5575 if (m_normalFlowList) |
| 5526 m_normalFlowList->clear(); | 5576 m_normalFlowList->clear(); |
| 5527 m_normalFlowListDirty = true; | 5577 m_normalFlowListDirty = true; |
| 5528 | 5578 |
| 5579 updateDescendantsAreContiguousInStackingOrder(); | |
| 5529 if (!renderer()->documentBeingDestroyed()) { | 5580 if (!renderer()->documentBeingDestroyed()) { |
| 5530 compositor()->setCompositingLayersNeedRebuild(); | 5581 compositor()->setCompositingLayersNeedRebuild(); |
| 5531 if (acceleratedCompositingForOverflowScrollEnabled()) | 5582 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 5532 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5583 compositor()->setShouldReevaluateCompositingAfterLayout(); |
| 5533 } | 5584 } |
| 5534 } | 5585 } |
| 5535 | 5586 |
| 5536 void RenderLayer::rebuildZOrderLists() | 5587 void RenderLayer::rebuildZOrderLists() |
| 5537 { | 5588 { |
| 5538 ASSERT(m_layerListMutationAllowed); | 5589 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()) { | 5672 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
| 5622 // Ignore reflections. | 5673 // Ignore reflections. |
| 5623 if (!m_reflection || reflectionLayer() != child) | 5674 if (!m_reflection || reflectionLayer() != child) |
| 5624 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer); | 5675 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer); |
| 5625 } | 5676 } |
| 5626 } | 5677 } |
| 5627 } | 5678 } |
| 5628 | 5679 |
| 5629 void RenderLayer::updateLayerListsIfNeeded() | 5680 void RenderLayer::updateLayerListsIfNeeded() |
| 5630 { | 5681 { |
| 5631 bool shouldUpdateDescendantsAreContiguousInStackingOrder = isStackingContext () && (m_zOrderListsDirty || m_normalFlowListDirty); | 5682 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; |
| 5632 updateZOrderLists(); | 5683 updateZOrderLists(); |
| 5633 updateNormalFlowList(); | 5684 updateNormalFlowList(); |
| 5634 | 5685 |
| 5635 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { | 5686 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { |
| 5636 reflectionLayer->updateZOrderLists(); | 5687 reflectionLayer->updateZOrderLists(); |
| 5637 reflectionLayer->updateNormalFlowList(); | 5688 reflectionLayer->updateNormalFlowList(); |
| 5638 } | 5689 } |
| 5639 | 5690 |
| 5640 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { | 5691 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { |
| 5641 updateDescendantsAreContiguousInStackingOrder(); | 5692 updateDescendantsAreContiguousInStackingOrder(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5717 && !renderer()->hasBlendMode() | 5768 && !renderer()->hasBlendMode() |
| 5718 #endif | 5769 #endif |
| 5719 && !isTransparent() | 5770 && !isTransparent() |
| 5720 && !needsCompositedScrolling() | 5771 && !needsCompositedScrolling() |
| 5721 #if ENABLE(CSS_EXCLUSIONS) | 5772 #if ENABLE(CSS_EXCLUSIONS) |
| 5722 && !renderer()->isFloatingWithShapeOutside() | 5773 && !renderer()->isFloatingWithShapeOutside() |
| 5723 #endif | 5774 #endif |
| 5724 ; | 5775 ; |
| 5725 } | 5776 } |
| 5726 | 5777 |
| 5778 void RenderLayer::updateIsNormalFlowOnly() | |
| 5779 { | |
| 5780 bool isNormalFlowOnly = shouldBeNormalFlowOnly(); | |
| 5781 if (isNormalFlowOnly == m_isNormalFlowOnly) | |
| 5782 return; | |
| 5783 | |
| 5784 m_isNormalFlowOnly = isNormalFlowOnly; | |
| 5785 if (RenderLayer* p = parent()) | |
| 5786 p->dirtyNormalFlowList(); | |
| 5787 dirtyStackingContainerZOrderLists(); | |
| 5788 } | |
| 5789 | |
| 5727 bool RenderLayer::shouldBeSelfPaintingLayer() const | 5790 bool RenderLayer::shouldBeSelfPaintingLayer() const |
| 5728 { | 5791 { |
| 5729 return !isNormalFlowOnly() | 5792 return !isNormalFlowOnly() |
| 5730 || hasOverlayScrollbars() | 5793 || hasOverlayScrollbars() |
| 5731 || needsCompositedScrolling() | 5794 || needsCompositedScrolling() |
| 5732 || renderer()->hasReflection() | 5795 || renderer()->hasReflection() |
| 5733 || renderer()->hasMask() | 5796 || renderer()->hasMask() |
| 5734 || renderer()->isTableRow() | 5797 || renderer()->isTableRow() |
| 5735 || renderer()->isCanvas() | 5798 || renderer()->isCanvas() |
| 5736 || renderer()->isVideo() | 5799 || renderer()->isVideo() |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5799 | 5862 |
| 5800 if (renderer()->isReplaced() || renderer()->hasMask()) | 5863 if (renderer()->isReplaced() || renderer()->hasMask()) |
| 5801 return true; | 5864 return true; |
| 5802 | 5865 |
| 5803 if (hasVisibleBoxDecorations()) | 5866 if (hasVisibleBoxDecorations()) |
| 5804 return true; | 5867 return true; |
| 5805 | 5868 |
| 5806 return false; | 5869 return false; |
| 5807 } | 5870 } |
| 5808 | 5871 |
| 5872 void RenderLayer::updateVisibilityAfterStyleChange(const RenderStyle* oldStyle) | |
| 5873 { | |
| 5874 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; | |
| 5875 if (oldVisibility == renderer()->style()->visibility()) | |
| 5876 return; | |
| 5877 | |
| 5878 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | |
| 5879 } | |
| 5880 | |
| 5809 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle) | 5881 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle) |
| 5810 { | 5882 { |
| 5811 if (!oldStyle) | 5883 bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; |
| 5812 return; | 5884 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; |
| 5813 | 5885 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 | 5886 |
| 5825 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could | 5887 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could |
| 5826 // likely be folded along with the rest. | 5888 // likely be folded along with the rest. |
| 5827 if (oldStyle->zIndex() != renderer()->style()->zIndex() || oldStyle->visibil ity() != renderer()->style()->visibility()) { | 5889 bool isStackingContext = this->isStackingContext(); |
| 5828 dirtyStackingContainerZOrderLists(); | 5890 if (isStackingContext == wasStackingContext && oldVisibility == renderer()-> style()->visibility() && oldZIndex == renderer()->style()->zIndex()) |
| 5829 if (isStackingContext) | 5891 return; |
| 5830 dirtyZOrderLists(); | 5892 |
| 5831 } | 5893 dirtyStackingContainerZOrderLists(); |
| 5894 | |
| 5895 if (isStackingContainer()) | |
| 5896 dirtyZOrderLists(); | |
| 5897 else | |
| 5898 clearZOrderLists(); | |
| 5899 | |
| 5900 updateNeedsCompositedScrolling(); | |
| 5832 } | 5901 } |
| 5833 | 5902 |
| 5834 static bool overflowRequiresScrollbar(EOverflow overflow) | 5903 static bool overflowRequiresScrollbar(EOverflow overflow) |
| 5835 { | 5904 { |
| 5836 return overflow == OSCROLL; | 5905 return overflow == OSCROLL; |
| 5837 } | 5906 } |
| 5838 | 5907 |
| 5839 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 5908 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
| 5840 { | 5909 { |
| 5841 return overflow == OAUTO || overflow == OOVERLAY; | 5910 return overflow == OAUTO || overflow == OOVERLAY; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5887 layer->m_hasOutOfFlowPositionedDescendant = true; | 5956 layer->m_hasOutOfFlowPositionedDescendant = true; |
| 5888 layer->updateNeedsCompositedScrolling(); | 5957 layer->updateNeedsCompositedScrolling(); |
| 5889 | 5958 |
| 5890 if (layer->renderer() && layer->renderer() == containingBlock) | 5959 if (layer->renderer() && layer->renderer() == containingBlock) |
| 5891 break; | 5960 break; |
| 5892 } | 5961 } |
| 5893 } | 5962 } |
| 5894 | 5963 |
| 5895 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() | 5964 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() |
| 5896 { | 5965 { |
| 5897 m_hasOutOfFlowPositionedDescendantDirty = true; | 5966 m_hasOutOfFlowPositionedDescendantDirty = true; |
| 5967 updateNeedsCompositedScrolling(); | |
|
Julien - ping for review
2013/04/18 00:42:34
Wrong indentation for the previous 2 lines.
This
Ian Vollick
2013/04/18 20:55:52
Until we put the updates into a well defined phase
| |
| 5898 if (parent()) | 5968 if (parent()) |
| 5899 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 5969 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
| 5900 } | 5970 } |
| 5901 | 5971 |
| 5902 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) | 5972 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) |
| 5903 { | 5973 { |
| 5904 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition); | 5974 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition); |
| 5905 if (parent() && ((renderer() && renderer()->isOutOfFlowPositioned()) != wasO utOfFlowPositioned)) { | 5975 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); |
| 5906 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 5976 if (parent() && isOutOfFlowPositioned != wasOutOfFlowPositioned) { |
| 5907 if (!renderer()->documentBeingDestroyed() && acceleratedCompositingForOv erflowScrollEnabled()) | 5977 if (isOutOfFlowPositioned) |
| 5908 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5978 parent()->setAncestorChainHasOutOfFlowPositionedDescendant(renderer( )->containingBlock()); |
| 5979 else | |
| 5980 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() ; | |
| 5909 } | 5981 } |
| 5910 } | 5982 } |
| 5911 | 5983 |
| 5912 #if ENABLE(CSS_FILTERS) | 5984 #if ENABLE(CSS_FILTERS) |
| 5913 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle) | 5985 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle) |
| 5914 { | 5986 { |
| 5915 ASSERT(newStyle); | 5987 ASSERT(newStyle); |
| 5916 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); | 5988 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); |
| 5917 } | 5989 } |
| 5918 #endif | 5990 #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. | 6054 // 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. | 6055 // 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 | 6056 // https://bugs.webkit.org/show_bug.cgi?id=114051 |
| 5985 if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter()) | 6057 if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter()) |
| 5986 backing()->updateFilters(renderer()->style()); | 6058 backing()->updateFilters(renderer()->style()); |
| 5987 } | 6059 } |
| 5988 #endif | 6060 #endif |
| 5989 | 6061 |
| 5990 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) | 6062 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) |
| 5991 { | 6063 { |
| 5992 bool isNormalFlowOnly = shouldBeNormalFlowOnly(); | |
| 5993 if (isNormalFlowOnly != m_isNormalFlowOnly) { | |
| 5994 m_isNormalFlowOnly = isNormalFlowOnly; | |
| 5995 RenderLayer* p = parent(); | |
| 5996 if (p) | |
| 5997 p->dirtyNormalFlowList(); | |
| 5998 dirtyStackingContainerZOrderLists(); | |
| 5999 } | |
| 6000 | |
| 6001 if (renderer()->style()->overflowX() == OMARQUEE && renderer()->style()->mar queeBehavior() != MNONE && renderer()->isBox()) { | 6064 if (renderer()->style()->overflowX() == OMARQUEE && renderer()->style()->mar queeBehavior() != MNONE && renderer()->isBox()) { |
| 6002 if (!m_marquee) | 6065 if (!m_marquee) |
| 6003 m_marquee = adoptPtr(new RenderMarquee(this)); | 6066 m_marquee = adoptPtr(new RenderMarquee(this)); |
| 6004 FeatureObserver::observe(renderer()->document(), renderer()->isHTMLMarqu ee() ? FeatureObserver::HTMLMarqueeElement : FeatureObserver::CSSOverflowMarquee ); | 6067 FeatureObserver::observe(renderer()->document(), renderer()->isHTMLMarqu ee() ? FeatureObserver::HTMLMarqueeElement : FeatureObserver::CSSOverflowMarquee ); |
| 6005 m_marquee->updateMarqueeStyle(); | 6068 m_marquee->updateMarqueeStyle(); |
| 6006 } | 6069 } |
| 6007 else if (m_marquee) { | 6070 else if (m_marquee) { |
| 6008 m_marquee.clear(); | 6071 m_marquee.clear(); |
| 6009 } | 6072 } |
| 6010 | 6073 |
| 6011 updateScrollbarsAfterStyleChange(oldStyle); | 6074 updateScrollbarsAfterStyleChange(oldStyle); |
| 6012 updateStackingContextsAfterStyleChange(oldStyle); | 6075 updateStackingContextsAfterStyleChange(oldStyle); |
| 6076 updateVisibilityAfterStyleChange(oldStyle); | |
| 6013 // Overlay scrollbars can make this layer self-painting so we need | 6077 // Overlay scrollbars can make this layer self-painting so we need |
| 6014 // to recompute the bit once scrollbars have been updated. | 6078 // to recompute the bit once scrollbars have been updated. |
| 6015 updateSelfPaintingLayer(); | 6079 updateSelfPaintingLayer(); |
| 6016 updateOutOfFlowPositioned(oldStyle); | 6080 updateOutOfFlowPositioned(oldStyle); |
| 6017 | 6081 |
| 6018 if (!hasReflection() && m_reflection) | 6082 if (!hasReflection() && m_reflection) |
| 6019 removeReflection(); | 6083 removeReflection(); |
| 6020 else if (hasReflection()) { | 6084 else if (hasReflection()) { |
| 6021 if (!m_reflection) | 6085 if (!m_reflection) |
| 6022 createReflection(); | 6086 createReflection(); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 6040 #endif | 6104 #endif |
| 6041 | 6105 |
| 6042 bool didPaintWithFilters = false; | 6106 bool didPaintWithFilters = false; |
| 6043 | 6107 |
| 6044 #if ENABLE(CSS_FILTERS) | 6108 #if ENABLE(CSS_FILTERS) |
| 6045 if (paintsWithFilters()) | 6109 if (paintsWithFilters()) |
| 6046 didPaintWithFilters = true; | 6110 didPaintWithFilters = true; |
| 6047 updateFilters(oldStyle, renderer()->style()); | 6111 updateFilters(oldStyle, renderer()->style()); |
| 6048 #endif | 6112 #endif |
| 6049 | 6113 |
| 6050 updateNeedsCompositedScrolling(); | |
| 6051 | |
| 6052 const RenderStyle* newStyle = renderer()->style(); | 6114 const RenderStyle* newStyle = renderer()->style(); |
| 6053 if (compositor()->updateLayerCompositingState(this) | 6115 if (compositor()->updateLayerCompositingState(this) |
| 6054 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 6116 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) |
| 6055 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 6117 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
| 6056 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) | 6118 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) |
| 6057 compositor()->setCompositingLayersNeedRebuild(); | 6119 compositor()->setCompositingLayersNeedRebuild(); |
| 6058 else if (isComposited()) | 6120 else if (isComposited()) |
| 6059 backing()->updateGraphicsLayerGeometry(); | 6121 backing()->updateGraphicsLayerGeometry(); |
| 6060 } | 6122 } |
| 6061 | 6123 |
| 6062 void RenderLayer::updateScrollableAreaSet(bool hasOverflow) | 6124 void RenderLayer::updateScrollableAreaSet(bool hasOverflow) |
| 6063 { | 6125 { |
| 6064 Frame* frame = renderer()->frame(); | 6126 Frame* frame = renderer()->frame(); |
| 6065 if (!frame) | 6127 if (!frame) |
| 6066 return; | 6128 return; |
| 6067 | 6129 |
| 6068 FrameView* frameView = frame->view(); | 6130 FrameView* frameView = frame->view(); |
| 6069 if (!frameView) | 6131 if (!frameView) |
| 6070 return; | 6132 return; |
| 6071 | 6133 |
| 6072 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); | 6134 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); |
| 6073 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) | 6135 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) |
| 6074 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); | 6136 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); |
| 6075 | 6137 |
| 6076 if (hasOverflow && isVisibleToHitTest ? frameView->addScrollableArea(this) : frameView->removeScrollableArea(this)) | 6138 bool updatedScrollableAreaSet = false; |
| 6139 if (hasOverflow && isVisibleToHitTest) | |
| 6140 updatedScrollableAreaSet = frameView->addScrollableArea(this); | |
| 6141 else | |
| 6142 updatedScrollableAreaSet = frameView->removeScrollableArea(this); | |
| 6143 | |
| 6144 if (updatedScrollableAreaSet) | |
| 6077 updateNeedsCompositedScrolling(); | 6145 updateNeedsCompositedScrolling(); |
| 6078 } | 6146 } |
| 6079 | 6147 |
| 6080 void RenderLayer::updateScrollCornerStyle() | 6148 void RenderLayer::updateScrollCornerStyle() |
| 6081 { | 6149 { |
| 6082 RenderObject* actualRenderer = rendererForScrollbar(renderer()); | 6150 RenderObject* actualRenderer = rendererForScrollbar(renderer()); |
| 6083 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); | 6151 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); |
| 6084 if (corner) { | 6152 if (corner) { |
| 6085 if (!m_scrollCorner) { | 6153 if (!m_scrollCorner) { |
| 6086 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument()); | 6154 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument()); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6320 } | 6388 } |
| 6321 } | 6389 } |
| 6322 | 6390 |
| 6323 void showLayerTree(const WebCore::RenderObject* renderer) | 6391 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6324 { | 6392 { |
| 6325 if (!renderer) | 6393 if (!renderer) |
| 6326 return; | 6394 return; |
| 6327 showLayerTree(renderer->enclosingLayer()); | 6395 showLayerTree(renderer->enclosingLayer()); |
| 6328 } | 6396 } |
| 6329 #endif | 6397 #endif |
| OLD | NEW |