Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: Source/WebCore/rendering/RenderLayer.cpp

Issue 13913013: Only update composited scrolling state when necessary (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: . Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 removeReflection(); 245 removeReflection();
245 246
246 #if ENABLE(CSS_FILTERS) 247 #if ENABLE(CSS_FILTERS)
247 removeFilterInfoIfNeeded(); 248 removeFilterInfoIfNeeded();
248 #endif 249 #endif
249 250
250 // Child layers will be deleted by their corresponding render objects, so 251 // Child layers will be deleted by their corresponding render objects, so
251 // we don't need to delete them ourselves. 252 // we don't need to delete them ourselves.
252 253
253 clearBacking(true); 254 clearBacking(true);
255 cancelScheduledCompositedScrollingUpdates();
254 256
255 if (m_scrollCorner) 257 if (m_scrollCorner)
256 m_scrollCorner->destroy(); 258 m_scrollCorner->destroy();
257 if (m_resizer) 259 if (m_resizer)
258 m_resizer->destroy(); 260 m_resizer->destroy();
259 } 261 }
260 262
261 String RenderLayer::name() const 263 String RenderLayer::name() const
262 { 264 {
263 StringBuilder name; 265 StringBuilder name;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 // numSCDecendants = 3 590 // numSCDecendants = 3
589 // 591 //
590 // and so, 592 // and so,
591 // maxStackIndex - minStackIndex == numSCDescendants 593 // maxStackIndex - minStackIndex == numSCDescendants
592 // ===> 3 - 0 == 3 594 // ===> 3 - 0 == 3
593 // ===> 3 == 3 595 // ===> 3 == 3
594 // 596 //
595 // And we would conclude that C could be promoted. 597 // And we would conclude that C could be promoted.
596 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() 598 void RenderLayer::updateDescendantsAreContiguousInStackingOrder()
597 { 599 {
598 if (!isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled( )) 600 if (!m_descendantsAreContiguousInStackingOrderDirty || !isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled())
599 return; 601 return;
600 602
601 ASSERT(!m_normalFlowListDirty); 603 ASSERT(!m_normalFlowListDirty);
602 ASSERT(!m_zOrderListsDirty); 604 ASSERT(!m_zOrderListsDirty);
603 605
604 OwnPtr<Vector<RenderLayer*> > posZOrderList; 606 OwnPtr<Vector<RenderLayer*> > posZOrderList;
605 OwnPtr<Vector<RenderLayer*> > negZOrderList; 607 OwnPtr<Vector<RenderLayer*> > negZOrderList;
606 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); 608 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList);
607 609
608 // Create a reverse lookup. 610 // Create a reverse lookup.
(...skipping 19 matching lines...) Expand all
628 continue; 630 continue;
629 lookup.set(currentLayer, stackingOrderIndex++); 631 lookup.set(currentLayer, stackingOrderIndex++);
630 } 632 }
631 } 633 }
632 634
633 int minIndex = 0; 635 int minIndex = 0;
634 int maxIndex = 0; 636 int maxIndex = 0;
635 int count = 0; 637 int count = 0;
636 bool firstIteration = true; 638 bool firstIteration = true;
637 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max Index, count, firstIteration); 639 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max Index, count, firstIteration);
640
641 m_descendantsAreContiguousInStackingOrderDirty = false;
638 } 642 }
639 643
640 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun t, bool firstIteration) 644 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun t, bool firstIteration)
641 { 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 }
(...skipping 10 matching lines...) Expand all
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 bool newValue = maxIndex - minIndex == count;
665 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; 669 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder;
666 m_descendantsAreContiguousInStackingOrder = newValue; 670 m_descendantsAreContiguousInStackingOrder = newValue;
667 if (didUpdate) 671 if (didUpdate)
668 updateNeedsCompositedScrolling(); 672 requestNeedsCompositedScrollingUpdate();
669 } 673 }
670 } 674 }
671 675
672 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap) 676 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap)
673 { 677 {
674 ASSERT(!m_visibleContentStatusDirty); 678 ASSERT(!m_visibleContentStatusDirty);
675 679
676 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); 680 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer);
677 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap); 681 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap);
678 } 682 }
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 break; 1027 break;
1024 1028
1025 layer->m_hasVisibleDescendant = true; 1029 layer->m_hasVisibleDescendant = true;
1026 layer->m_visibleDescendantStatusDirty = false; 1030 layer->m_visibleDescendantStatusDirty = false;
1027 } 1031 }
1028 } 1032 }
1029 1033
1030 void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* o utOfFlowDescendantContainingBlocks) 1034 void RenderLayer::updateDescendantDependentFlags(HashSet<const RenderObject*>* o utOfFlowDescendantContainingBlocks)
1031 { 1035 {
1032 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty) { 1036 if (m_visibleDescendantStatusDirty || m_hasSelfPaintingLayerDescendantDirty || m_hasOutOfFlowPositionedDescendantDirty) {
1037 const bool hadVisibleDescendant = m_hasVisibleDescendant;
1038 const bool hadOutOfFlowPositionedDescendant = m_hasOutOfFlowPositionedDe scendant;
1039
1033 m_hasVisibleDescendant = false; 1040 m_hasVisibleDescendant = false;
1034 m_hasSelfPaintingLayerDescendant = false; 1041 m_hasSelfPaintingLayerDescendant = false;
1035 m_hasOutOfFlowPositionedDescendant = false; 1042 m_hasOutOfFlowPositionedDescendant = false;
1036 1043
1037 HashSet<const RenderObject*> childOutOfFlowDescendantContainingBlocks; 1044 HashSet<const RenderObject*> childOutOfFlowDescendantContainingBlocks;
1038 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { 1045 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) {
1039 childOutOfFlowDescendantContainingBlocks.clear(); 1046 childOutOfFlowDescendantContainingBlocks.clear();
1040 child->updateDescendantDependentFlags(&childOutOfFlowDescendantConta iningBlocks); 1047 child->updateDescendantDependentFlags(&childOutOfFlowDescendantConta iningBlocks);
1041 1048
1042 bool childIsOutOfFlowPositioned = child->renderer() && child->render er()->isOutOfFlowPositioned(); 1049 bool childIsOutOfFlowPositioned = child->renderer() && child->render er()->isOutOfFlowPositioned();
1043 if (childIsOutOfFlowPositioned) 1050 if (childIsOutOfFlowPositioned)
1044 childOutOfFlowDescendantContainingBlocks.add(child->renderer()-> containingBlock()); 1051 childOutOfFlowDescendantContainingBlocks.add(child->renderer()-> containingBlock());
1045 1052
1046 if (outOfFlowDescendantContainingBlocks) { 1053 if (outOfFlowDescendantContainingBlocks) {
1047 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow DescendantContainingBlocks.begin(); 1054 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow DescendantContainingBlocks.begin();
1048 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i t) 1055 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i t)
1049 outOfFlowDescendantContainingBlocks->add(*it); 1056 outOfFlowDescendantContainingBlocks->add(*it);
1050 } 1057 }
1051 1058
1052 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; 1059 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant;
1053 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); 1060 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant();
1054 bool hasOutOfFlowPositionedDescendant = !childOutOfFlowDescendantCon tainingBlocks.isEmpty(); 1061 bool hasOutOfFlowPositionedDescendant = !childOutOfFlowDescendantCon tainingBlocks.isEmpty() || child->hasOutOfFlowPositionedDescendant();
1055 1062
1056 m_hasVisibleDescendant |= hasVisibleDescendant; 1063 m_hasVisibleDescendant |= hasVisibleDescendant;
1057 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; 1064 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant;
1058 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt; 1065 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt;
1059 1066
1060 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_ hasOutOfFlowPositionedDescendant) 1067 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_ hasOutOfFlowPositionedDescendant)
1061 break; 1068 break;
1062 } 1069 }
1063 1070
1064 if (outOfFlowDescendantContainingBlocks && renderer()) 1071 if (outOfFlowDescendantContainingBlocks && renderer())
1065 outOfFlowDescendantContainingBlocks->remove(renderer()); 1072 outOfFlowDescendantContainingBlocks->remove(renderer());
1066 1073
1067 m_visibleDescendantStatusDirty = false; 1074 m_visibleDescendantStatusDirty = false;
1068 m_hasSelfPaintingLayerDescendantDirty = false; 1075 m_hasSelfPaintingLayerDescendantDirty = false;
1076 m_hasOutOfFlowPositionedDescendantDirty = false;
1069 1077
1070 if (m_hasOutOfFlowPositionedDescendantDirty) 1078 if (m_hasVisibleDescendant != hadVisibleDescendant || m_hasOutOfFlowPosi tionedDescendant != hadOutOfFlowPositionedDescendant)
1071 updateNeedsCompositedScrolling(); 1079 requestNeedsCompositedScrollingUpdate();
1072
1073 m_hasOutOfFlowPositionedDescendantDirty = false;
1074 } 1080 }
1075 1081
1076 if (m_visibleContentStatusDirty) { 1082 if (m_visibleContentStatusDirty) {
1083 const bool hadVisibleContent = m_hasVisibleContent;
1077 if (renderer()->style()->visibility() == VISIBLE) 1084 if (renderer()->style()->visibility() == VISIBLE)
1078 m_hasVisibleContent = true; 1085 m_hasVisibleContent = true;
1079 else { 1086 else {
1080 // layer may be hidden but still have some visible content, check fo r this 1087 // layer may be hidden but still have some visible content, check fo r this
1081 m_hasVisibleContent = false; 1088 m_hasVisibleContent = false;
1082 RenderObject* r = renderer()->firstChild(); 1089 RenderObject* r = renderer()->firstChild();
1083 while (r) { 1090 while (r) {
1084 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { 1091 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) {
1085 m_hasVisibleContent = true; 1092 m_hasVisibleContent = true;
1086 break; 1093 break;
1087 } 1094 }
1088 if (r->firstChild() && !r->hasLayer()) 1095 if (r->firstChild() && !r->hasLayer())
1089 r = r->firstChild(); 1096 r = r->firstChild();
1090 else if (r->nextSibling()) 1097 else if (r->nextSibling())
1091 r = r->nextSibling(); 1098 r = r->nextSibling();
1092 else { 1099 else {
1093 do { 1100 do {
1094 r = r->parent(); 1101 r = r->parent();
1095 if (r == renderer()) 1102 if (r == renderer())
1096 r = 0; 1103 r = 0;
1097 } while (r && !r->nextSibling()); 1104 } while (r && !r->nextSibling());
1098 if (r) 1105 if (r)
1099 r = r->nextSibling(); 1106 r = r->nextSibling();
1100 } 1107 }
1101 } 1108 }
1102 } 1109 }
1103 m_visibleContentStatusDirty = false; 1110 m_visibleContentStatusDirty = false;
1111 if (hadVisibleContent != m_hasVisibleContent)
1112 requestNeedsCompositedScrollingUpdate();
1104 } 1113 }
1105 } 1114 }
1106 1115
1107 void RenderLayer::dirty3DTransformedDescendantStatus() 1116 void RenderLayer::dirty3DTransformedDescendantStatus()
1108 { 1117 {
1109 RenderLayer* curr = stackingContainer(); 1118 RenderLayer* curr = stackingContainer();
1110 if (curr) 1119 if (curr)
1111 curr->m_3DTransformedDescendantStatusDirty = true; 1120 curr->m_3DTransformedDescendantStatusDirty = true;
1112 1121
1113 // This propagates up through preserve-3d hierarchies to the enclosing flatt ening layer. 1122 // 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
1280 RenderLayer* RenderLayer::stackingContainer() const 1289 RenderLayer* RenderLayer::stackingContainer() const
1281 { 1290 {
1282 RenderLayer* layer = parent(); 1291 RenderLayer* layer = parent();
1283 while (layer && !layer->isStackingContainer()) 1292 while (layer && !layer->isStackingContainer())
1284 layer = layer->parent(); 1293 layer = layer->parent();
1285 1294
1286 ASSERT(!layer || layer->isStackingContainer()); 1295 ASSERT(!layer || layer->isStackingContainer());
1287 return layer; 1296 return layer;
1288 } 1297 }
1289 1298
1299 RenderLayer* RenderLayer::stackingContext() const
1300 {
1301 RenderLayer* layer = parent();
1302 while (layer && !layer->isStackingContext())
1303 layer = layer->parent();
1304
1305 ASSERT(!layer || layer->isStackingContext());
1306 return layer;
1307 }
1308
1290 static inline bool isPositionedContainer(RenderLayer* layer) 1309 static inline bool isPositionedContainer(RenderLayer* layer)
1291 { 1310 {
1292 RenderLayerModelObject* layerRenderer = layer->renderer(); 1311 RenderLayerModelObject* layerRenderer = layer->renderer();
1293 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform(); 1312 return layer->isRootLayer() || layerRenderer->isPositioned() || layer->hasTr ansform();
1294 } 1313 }
1295 1314
1296 static inline bool isFixedPositionedContainer(RenderLayer* layer) 1315 static inline bool isFixedPositionedContainer(RenderLayer* layer)
1297 { 1316 {
1298 return layer->isRootLayer() || layer->hasTransform(); 1317 return layer->isRootLayer() || layer->hasTransform();
1299 } 1318 }
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 child->setParent(this); 1691 child->setParent(this);
1673 1692
1674 if (child->isNormalFlowOnly()) 1693 if (child->isNormalFlowOnly())
1675 dirtyNormalFlowList(); 1694 dirtyNormalFlowList();
1676 1695
1677 if (!child->isNormalFlowOnly() || child->firstChild()) { 1696 if (!child->isNormalFlowOnly() || child->firstChild()) {
1678 // Dirty the z-order list in which we are contained. The stackingContain er() can be null in the 1697 // Dirty the z-order list in which we are contained. The stackingContain er() can be null in the
1679 // case where we're building up generated content layers. This is ok, si nce the lists will start 1698 // case where we're building up generated content layers. This is ok, si nce the lists will start
1680 // off dirty in that case anyway. 1699 // off dirty in that case anyway.
1681 child->dirtyStackingContainerZOrderLists(); 1700 child->dirtyStackingContainerZOrderLists();
1701 child->requestDescendantsAreContiguousInStackingOrderUpdate();
1702
1703 // Adding an out of flow positioned descendant can only affect
1704 // the opt-in decision for layers beneath and including our
1705 // containing block.
1706 RenderObject* containingBlock = child->renderer()->containingBlock();
1707 for (RenderLayer* layer = child; layer; layer = layer->parent()) {
1708 layer->requestNeedsCompositedScrollingUpdate();
1709 if (layer->renderer() == containingBlock)
1710 break;
1711 }
1682 } 1712 }
1683 1713
1684 child->updateDescendantDependentFlags(); 1714 child->updateDescendantDependentFlags();
1685 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) 1715 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant)
1686 setAncestorChainHasVisibleDescendant(); 1716 setAncestorChainHasVisibleDescendant();
1687 1717
1688 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) 1718 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant())
1689 setAncestorChainHasSelfPaintingLayerDescendant(); 1719 setAncestorChainHasSelfPaintingLayerDescendant();
1690 1720
1691 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil d->hasOutOfFlowPositionedDescendant())) 1721 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil d->hasOutOfFlowPositionedDescendant()))
(...skipping 11 matching lines...) Expand all
1703 if (oldChild->previousSibling()) 1733 if (oldChild->previousSibling())
1704 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); 1734 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling());
1705 if (oldChild->nextSibling()) 1735 if (oldChild->nextSibling())
1706 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; 1736 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ;
1707 1737
1708 if (m_first == oldChild) 1738 if (m_first == oldChild)
1709 m_first = oldChild->nextSibling(); 1739 m_first = oldChild->nextSibling();
1710 if (m_last == oldChild) 1740 if (m_last == oldChild)
1711 m_last = oldChild->previousSibling(); 1741 m_last = oldChild->previousSibling();
1712 1742
1743 oldChild->cancelScheduledCompositedScrollingUpdates();
1744
1713 if (oldChild->isNormalFlowOnly()) 1745 if (oldChild->isNormalFlowOnly())
1714 dirtyNormalFlowList(); 1746 dirtyNormalFlowList();
1715 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { 1747 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) {
1716 // Dirty the z-order list in which we are contained. When called via th e 1748 // Dirty the z-order list in which we are contained. When called via th e
1717 // reattachment process in removeOnlyThisLayer, the layer may already be disconnected 1749 // reattachment process in removeOnlyThisLayer, the layer may already be disconnected
1718 // from the main layer tree, so we need to null-check the |stackingConta iner| value. 1750 // from the main layer tree, so we need to null-check the |stackingConta iner| value.
1719 oldChild->dirtyStackingContainerZOrderLists(); 1751 oldChild->dirtyStackingContainerZOrderLists();
1752 requestDescendantsAreContiguousInStackingOrderUpdate();
1753
1754 // This could affect whether or not a layer has an out of flow
1755 // positioned descendant so we need to schedule some updates.
1756 for (RenderLayer* layer = this; layer; layer = layer->parent())
1757 layer->requestNeedsCompositedScrollingUpdate();
1720 } 1758 }
1721 1759
1722 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned()) || oldChild->hasOutOfFlowPositionedDescendant()) 1760 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned()) || oldChild->hasOutOfFlowPositionedDescendant())
1723 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 1761 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
1724 1762
1725 oldChild->setPreviousSibling(0); 1763 oldChild->setPreviousSibling(0);
1726 oldChild->setNextSibling(0); 1764 oldChild->setNextSibling(0);
1727 oldChild->setParent(0); 1765 oldChild->setParent(0);
1728 1766
1729 oldChild->updateDescendantDependentFlags(); 1767 oldChild->updateDescendantDependentFlags();
1730 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) 1768 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
1731 dirtyAncestorChainVisibleDescendantStatus(); 1769 dirtyAncestorChainVisibleDescendantStatus();
1732 1770
1733 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) 1771 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant())
1734 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 1772 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1735 1773
1736 return oldChild; 1774 return oldChild;
1737 } 1775 }
1738 1776
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 return isComposited() && backing()->scrollingLayer(); 1977 return isComposited() && backing()->scrollingLayer();
1940 } 1978 }
1941 1979
1942 bool RenderLayer::needsCompositedScrolling() const 1980 bool RenderLayer::needsCompositedScrolling() const
1943 { 1981 {
1944 return m_needsCompositedScrolling; 1982 return m_needsCompositedScrolling;
1945 } 1983 }
1946 1984
1947 void RenderLayer::updateNeedsCompositedScrolling() 1985 void RenderLayer::updateNeedsCompositedScrolling()
1948 { 1986 {
1949 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; 1987 bool needsCompositedScrolling = false;
1950 1988
1951 FrameView* frameView = renderer()->view()->frameView(); 1989 FrameView* frameView = renderer()->view()->frameView();
1952 if (!frameView || !frameView->containsScrollableArea(this)) 1990 if (frameView && frameView->containsScrollableArea(this)) {
1953 m_needsCompositedScrolling = false; 1991 updateDescendantDependentFlags();
1954 else { 1992
1955 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() 1993 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled()
1956 && canBeStackingContainer() 1994 && canBeStackingContainer()
1957 && !hasOutOfFlowPositionedDescendant(); 1995 && !hasOutOfFlowPositionedDescendant();
1958 1996
1959 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) 1997 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
1960 m_needsCompositedScrolling = forceUseCompositedScrolling || renderer()-> style()->useTouchOverflowScrolling(); 1998 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st yle()->useTouchOverflowScrolling();
1961 #else 1999 #else
1962 m_needsCompositedScrolling = forceUseCompositedScrolling; 2000 needsCompositedScrolling = forceUseCompositedScrolling;
1963 #endif 2001 #endif
1964 // We gather a boolean value for use with Google UMA histograms to
1965 // quantify the actual effects of a set of patches attempting to
1966 // relax composited scrolling requirements, thereby increasing the
1967 // number of composited overflow divs.
1968 if (acceleratedCompositingForOverflowScrollEnabled())
1969 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro lling", m_needsCompositedScrolling, 2);
1970 } 2002 }
1971 2003
1972 if (oldNeedsCompositedScrolling != m_needsCompositedScrolling) { 2004 setNeedsCompositedScrolling(needsCompositedScrolling);
1973 updateSelfPaintingLayer(); 2005 }
1974 if (isStackingContainer())
1975 dirtyZOrderLists();
1976 else
1977 clearZOrderLists();
1978 2006
1979 dirtyStackingContainerZOrderLists(); 2007 void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling)
2008 {
2009 // We gather a boolean value for use with Google UMA histograms to
2010 // quantify the actual effects of a set of patches attempting to
2011 // relax composited scrolling requirements, thereby increasing the
2012 // number of composited overflow divs.
2013 if (acceleratedCompositingForOverflowScrollEnabled())
2014 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScrollin g", needsCompositedScrolling, 2);
1980 2015
1981 compositor()->setShouldReevaluateCompositingAfterLayout(); 2016 if (m_needsCompositedScrolling == needsCompositedScrolling)
1982 compositor()->setCompositingLayersNeedRebuild(); 2017 return;
1983 } 2018
2019 m_needsCompositedScrolling = needsCompositedScrolling;
2020
2021 updateSelfPaintingLayer();
2022 updateIsNormalFlowOnly();
Julien - ping for review 2013/04/09 21:06:43 Already mentioned somewhere else but isSelfPaintin
Ian Vollick 2013/04/12 03:53:14 Done.
2023
2024 if (isStackingContainer())
2025 dirtyZOrderLists();
2026 else
2027 clearZOrderLists();
2028
2029 dirtyStackingContainerZOrderLists();
Julien - ping for review 2013/04/09 21:06:43 Wouldn't that dirty the z-order list of a stacking
Ian Vollick 2013/04/12 03:53:14 Should be ok, I think. This function starts lookin
2030
2031 compositor()->setShouldReevaluateCompositingAfterLayout();
2032 compositor()->setCompositingLayersNeedRebuild();
2033 }
2034
2035 void RenderLayer::requestNeedsCompositedScrollingUpdate()
2036 {
2037 if (acceleratedCompositingForOverflowScrollEnabled())
2038 ScopedCompositedScrollingUpdater(this, UpdateNeedsCompositedScrolling);
2039 }
2040
2041 void RenderLayer::requestDescendantsAreContiguousInStackingOrderUpdate()
2042 {
2043 if (acceleratedCompositingForOverflowScrollEnabled())
2044 ScopedCompositedScrollingUpdater(this, UpdateDescendantsAreContiguousInS tackingOrder);
2045 }
2046
2047 void RenderLayer::cancelScheduledCompositedScrollingUpdates() const
2048 {
2049 if (!renderer() || !renderer()->view())
2050 return;
2051
2052 renderer()->view()->cancelScheduledCompositedScrollingUpdatesForLayer(const_ cast<RenderLayer*>(this));
Julien - ping for review 2013/04/09 21:06:43 Couldn't cancelScheduledCompositedScrollingUpdates
Ian Vollick 2013/04/12 03:53:14 No longer applicable (yay).
1984 } 2053 }
1985 2054
1986 static inline int adjustedScrollDelta(int beginningDelta) { 2055 static inline int adjustedScrollDelta(int beginningDelta) {
1987 // This implemention matches Firefox's. 2056 // This implemention matches Firefox's.
1988 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml #856. 2057 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml #856.
1989 const int speedReducer = 12; 2058 const int speedReducer = 12;
1990 2059
1991 int adjustedDelta = beginningDelta / speedReducer; 2060 int adjustedDelta = beginningDelta / speedReducer;
1992 if (adjustedDelta > 1) 2061 if (adjustedDelta > 1)
1993 adjustedDelta = static_cast<int>(adjustedDelta * sqrt(static_cast<double >(adjustedDelta))) - 1; 2062 adjustedDelta = static_cast<int>(adjustedDelta * sqrt(static_cast<double >(adjustedDelta))) - 1;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2268 frameView->resumeScheduledEvents(); 2337 frameView->resumeScheduledEvents();
2269 } 2338 }
2270 2339
2271 void RenderLayer::updateCompositingLayersAfterScroll() 2340 void RenderLayer::updateCompositingLayersAfterScroll()
2272 { 2341 {
2273 if (compositor()->inCompositingMode()) { 2342 if (compositor()->inCompositingMode()) {
2274 // Our stacking container is guaranteed to contain all of our descendant s that may need 2343 // Our stacking container is guaranteed to contain all of our descendant s that may need
2275 // repositioning, so update compositing layers from there. 2344 // repositioning, so update compositing layers from there.
2276 if (RenderLayer* compositingAncestor = stackingContainer()->enclosingCom positingLayer()) { 2345 if (RenderLayer* compositingAncestor = stackingContainer()->enclosingCom positingLayer()) {
2277 if (compositor()->compositingConsultsOverlap()) { 2346 if (compositor()->compositingConsultsOverlap()) {
2278 if (usesCompositedScrolling() && !hasOutOfFlowPositionedDescenda nt()) 2347 if (usesCompositedScrolling())
2279 compositor()->updateCompositingLayers(CompositingUpdateOnCom positedScroll, compositingAncestor); 2348 compositor()->updateCompositingLayers(CompositingUpdateOnCom positedScroll, compositingAncestor);
2280 else 2349 else
2281 compositor()->updateCompositingLayers(CompositingUpdateOnScr oll, compositingAncestor); 2350 compositor()->updateCompositingLayers(CompositingUpdateOnScr oll, compositingAncestor);
2282 } else 2351 } else
2283 compositingAncestor->backing()->updateAfterLayout(RenderLayerBac king::IsUpdateRoot); 2352 compositingAncestor->backing()->updateAfterLayout(RenderLayerBac king::IsUpdateRoot);
2284 } 2353 }
2285 } 2354 }
2286 } 2355 }
2287 2356
2288 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const Lay outRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& align Y) 2357 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const Lay outRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& align Y)
(...skipping 3215 matching lines...) Expand 10 before | Expand all | Expand 10 after
5504 { 5573 {
5505 ASSERT(m_layerListMutationAllowed); 5574 ASSERT(m_layerListMutationAllowed);
5506 ASSERT(isStackingContainer()); 5575 ASSERT(isStackingContainer());
5507 5576
5508 if (m_posZOrderList) 5577 if (m_posZOrderList)
5509 m_posZOrderList->clear(); 5578 m_posZOrderList->clear();
5510 if (m_negZOrderList) 5579 if (m_negZOrderList)
5511 m_negZOrderList->clear(); 5580 m_negZOrderList->clear();
5512 m_zOrderListsDirty = true; 5581 m_zOrderListsDirty = true;
5513 5582
5583 m_descendantsAreContiguousInStackingOrderDirty = true;
5584 requestDescendantsAreContiguousInStackingOrderUpdate();
5585
5514 if (!renderer()->documentBeingDestroyed()) { 5586 if (!renderer()->documentBeingDestroyed()) {
5515 compositor()->setCompositingLayersNeedRebuild(); 5587 compositor()->setCompositingLayersNeedRebuild();
5516 if (acceleratedCompositingForOverflowScrollEnabled()) 5588 if (acceleratedCompositingForOverflowScrollEnabled())
5517 compositor()->setShouldReevaluateCompositingAfterLayout(); 5589 compositor()->setShouldReevaluateCompositingAfterLayout();
5518 } 5590 }
5519 } 5591 }
5520 5592
5521 void RenderLayer::dirtyStackingContainerZOrderLists() 5593 void RenderLayer::dirtyStackingContainerZOrderLists()
5522 { 5594 {
5523 RenderLayer* sc = stackingContainer(); 5595 RenderLayer* stackingContainer = this->stackingContainer();
5524 if (sc) 5596 if (stackingContainer)
5525 sc->dirtyZOrderLists(); 5597 stackingContainer->dirtyZOrderLists();
5598
5599 // Any change that could affect our stacking container's z-order list could
5600 // cause other RenderLayers in our stacking context to either opt in or out
5601 // of composited scrolling. It is important that we make our stacking
5602 // context aware of these z-order changes so the appropriate updating can
5603 // happen.
5604 RenderLayer* stackingContext = this->stackingContext();
5605 if (stackingContext && stackingContext != stackingContainer)
5606 stackingContext->dirtyZOrderLists();
5526 } 5607 }
5527 5608
5528 void RenderLayer::dirtyNormalFlowList() 5609 void RenderLayer::dirtyNormalFlowList()
5529 { 5610 {
5530 ASSERT(m_layerListMutationAllowed); 5611 ASSERT(m_layerListMutationAllowed);
5531 5612
5532 if (m_normalFlowList) 5613 if (m_normalFlowList)
5533 m_normalFlowList->clear(); 5614 m_normalFlowList->clear();
5534 m_normalFlowListDirty = true; 5615 m_normalFlowListDirty = true;
5535 5616
5617 requestDescendantsAreContiguousInStackingOrderUpdate();
5536 if (!renderer()->documentBeingDestroyed()) { 5618 if (!renderer()->documentBeingDestroyed()) {
5537 compositor()->setCompositingLayersNeedRebuild(); 5619 compositor()->setCompositingLayersNeedRebuild();
5538 if (acceleratedCompositingForOverflowScrollEnabled()) 5620 if (acceleratedCompositingForOverflowScrollEnabled())
5539 compositor()->setShouldReevaluateCompositingAfterLayout(); 5621 compositor()->setShouldReevaluateCompositingAfterLayout();
5540 } 5622 }
5541 } 5623 }
5542 5624
5625 void RenderLayer::updateZOrderLists()
5626 {
5627 ScopedCompositedScrollingUpdater suspendCompositedScrollingUpdates(renderer( )->view());
5628
5629 if (!m_zOrderListsDirty)
5630 return;
5631
5632 if (!isStackingContainer()) {
5633 clearZOrderLists();
5634 m_zOrderListsDirty = false;
5635 return;
5636 }
5637
5638 rebuildZOrderLists();
5639 }
5640
5543 void RenderLayer::rebuildZOrderLists() 5641 void RenderLayer::rebuildZOrderLists()
5544 { 5642 {
5545 ASSERT(m_layerListMutationAllowed); 5643 ASSERT(m_layerListMutationAllowed);
5546 ASSERT(isDirtyStackingContainer()); 5644 ASSERT(isDirtyStackingContainer());
5547 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis t); 5645 rebuildZOrderLists(StopAtStackingContainers, m_posZOrderList, m_negZOrderLis t);
5548 m_zOrderListsDirty = false; 5646 m_zOrderListsDirty = false;
5549 } 5647 }
5550 5648
5551 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList) 5649 void RenderLayer::rebuildZOrderLists(CollectLayersBehavior behavior, OwnPtr<Vect or<RenderLayer*> >& posZOrderList, OwnPtr<Vector<RenderLayer*> >& negZOrderList)
5552 { 5650 {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
5628 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { 5726 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) {
5629 // Ignore reflections. 5727 // Ignore reflections.
5630 if (!m_reflection || reflectionLayer() != child) 5728 if (!m_reflection || reflectionLayer() != child)
5631 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer); 5729 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer);
5632 } 5730 }
5633 } 5731 }
5634 } 5732 }
5635 5733
5636 void RenderLayer::updateLayerListsIfNeeded() 5734 void RenderLayer::updateLayerListsIfNeeded()
5637 { 5735 {
5638 bool shouldUpdateDescendantsAreContiguousInStackingOrder = isStackingContext () && (m_zOrderListsDirty || m_normalFlowListDirty); 5736 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty;
5639 updateZOrderLists(); 5737 updateZOrderLists();
5640 updateNormalFlowList(); 5738 updateNormalFlowList();
5641 5739
5642 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { 5740 if (RenderLayer* reflectionLayer = this->reflectionLayer()) {
5643 reflectionLayer->updateZOrderLists(); 5741 reflectionLayer->updateZOrderLists();
5644 reflectionLayer->updateNormalFlowList(); 5742 reflectionLayer->updateNormalFlowList();
5645 } 5743 }
5646 5744
5647 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { 5745 if (shouldUpdateDescendantsAreContiguousInStackingOrder) {
5648 updateDescendantsAreContiguousInStackingOrder(); 5746 updateDescendantsAreContiguousInStackingOrder();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
5734 && !renderer()->hasBlendMode() 5832 && !renderer()->hasBlendMode()
5735 #endif 5833 #endif
5736 && !isTransparent() 5834 && !isTransparent()
5737 && !needsCompositedScrolling() 5835 && !needsCompositedScrolling()
5738 #if ENABLE(CSS_EXCLUSIONS) 5836 #if ENABLE(CSS_EXCLUSIONS)
5739 && !renderer()->isFloatingWithShapeOutside() 5837 && !renderer()->isFloatingWithShapeOutside()
5740 #endif 5838 #endif
5741 ; 5839 ;
5742 } 5840 }
5743 5841
5842 void RenderLayer::updateIsNormalFlowOnly()
5843 {
5844 bool isNormalFlowOnly = shouldBeNormalFlowOnly();
5845 if (isNormalFlowOnly != m_isNormalFlowOnly) {
Julien - ping for review 2013/04/09 21:06:43 Better with an early return.
Ian Vollick 2013/04/12 03:53:14 Done.
5846 m_isNormalFlowOnly = isNormalFlowOnly;
5847 RenderLayer* p = parent();
5848 if (p)
5849 p->dirtyNormalFlowList();
5850 dirtyStackingContainerZOrderLists();
5851 }
5852 }
5853
5744 bool RenderLayer::shouldBeSelfPaintingLayer() const 5854 bool RenderLayer::shouldBeSelfPaintingLayer() const
5745 { 5855 {
5746 return !isNormalFlowOnly() 5856 return !isNormalFlowOnly()
5747 || hasOverlayScrollbars() 5857 || hasOverlayScrollbars()
5748 || needsCompositedScrolling() 5858 || needsCompositedScrolling()
5749 || renderer()->hasReflection() 5859 || renderer()->hasReflection()
5750 || renderer()->hasMask() 5860 || renderer()->hasMask()
5751 || renderer()->isTableRow() 5861 || renderer()->isTableRow()
5752 || renderer()->isCanvas() 5862 || renderer()->isCanvas()
5753 || renderer()->isVideo() 5863 || renderer()->isVideo()
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
5816 5926
5817 if (renderer()->isReplaced() || renderer()->hasMask()) 5927 if (renderer()->isReplaced() || renderer()->hasMask())
5818 return true; 5928 return true;
5819 5929
5820 if (hasVisibleBoxDecorations()) 5930 if (hasVisibleBoxDecorations())
5821 return true; 5931 return true;
5822 5932
5823 return false; 5933 return false;
5824 } 5934 }
5825 5935
5936 void RenderLayer::updateVisibilityAfterStyleChange(const RenderStyle* oldStyle)
5937 {
5938 EVisibility oldVisibility = VISIBLE;
5939 if (oldStyle)
5940 oldVisibility = oldStyle->visibility();
Julien - ping for review 2013/04/09 21:06:43 On one line? EVisibility oldVisibility = oldStyle
Ian Vollick 2013/04/12 03:53:14 Done.
5941
5942 if (oldVisibility != renderer()->style()->visibility()) {
Julien - ping for review 2013/04/09 21:06:43 Again, better with an early return.
Ian Vollick 2013/04/12 03:53:14 Done.
5943 for (RenderLayer* layer = this; layer; layer = layer->parent())
5944 layer->requestNeedsCompositedScrollingUpdate();
5945 }
5946 }
5947
5826 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle) 5948 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle)
5827 { 5949 {
5828 if (!oldStyle) 5950 bool wasStackingContext = false;
5829 return; 5951 EVisibility oldVisibility = VISIBLE;
5830 5952 int oldZIndex = 0;
Julien - ping for review 2013/04/09 21:06:43 Ditto, those should be one liners.
Ian Vollick 2013/04/12 03:53:14 Done.
5831 bool wasStackingContext = isStackingContext(oldStyle); 5953 if (oldStyle) {
5832 bool isStackingContext = this->isStackingContext(); 5954 wasStackingContext = isStackingContext(oldStyle);
5833 if (isStackingContext != wasStackingContext) { 5955 oldVisibility = oldStyle->visibility();
5834 dirtyStackingContainerZOrderLists(); 5956 oldZIndex = oldStyle->zIndex();
5835 if (isStackingContext)
5836 dirtyZOrderLists();
5837 else
5838 clearZOrderLists();
5839 return;
5840 } 5957 }
5841 5958
5842 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could 5959 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could
5843 // likely be folded along with the rest. 5960 // likely be folded along with the rest.
5844 if (oldStyle->zIndex() != renderer()->style()->zIndex() || oldStyle->visibil ity() != renderer()->style()->visibility()) { 5961 bool isStackingContext = this->isStackingContext();
5962 if (isStackingContext != wasStackingContext
5963 || oldVisibility != renderer()->style()->visibility()
5964 || oldZIndex != renderer()->style()->zIndex()) {
5845 dirtyStackingContainerZOrderLists(); 5965 dirtyStackingContainerZOrderLists();
5846 if (isStackingContext) 5966 if (isStackingContainer())
5847 dirtyZOrderLists(); 5967 dirtyZOrderLists();
5968
5969 requestNeedsCompositedScrollingUpdate();
5848 } 5970 }
5849 } 5971 }
5850 5972
5851 static bool overflowRequiresScrollbar(EOverflow overflow) 5973 static bool overflowRequiresScrollbar(EOverflow overflow)
5852 { 5974 {
5853 return overflow == OSCROLL; 5975 return overflow == OSCROLL;
5854 } 5976 }
5855 5977
5856 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) 5978 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow)
5857 { 5979 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5895 } 6017 }
5896 6018
5897 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containingBlock) 6019 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containingBlock)
5898 { 6020 {
5899 for (RenderLayer* layer = this; layer; layer = layer->parent()) { 6021 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
5900 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl owPositionedDescendant()) 6022 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl owPositionedDescendant())
5901 break; 6023 break;
5902 6024
5903 layer->m_hasOutOfFlowPositionedDescendantDirty = false; 6025 layer->m_hasOutOfFlowPositionedDescendantDirty = false;
5904 layer->m_hasOutOfFlowPositionedDescendant = true; 6026 layer->m_hasOutOfFlowPositionedDescendant = true;
5905 layer->updateNeedsCompositedScrolling(); 6027 layer->requestNeedsCompositedScrollingUpdate();
5906 6028
5907 if (layer->renderer() && layer->renderer() == containingBlock) 6029 if (layer->renderer() && layer->renderer() == containingBlock)
5908 break; 6030 break;
5909 } 6031 }
5910 } 6032 }
5911 6033
5912 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() 6034 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus()
5913 { 6035 {
5914 m_hasOutOfFlowPositionedDescendantDirty = true; 6036 if (m_hasOutOfFlowPositionedDescendant) {
6037 m_hasOutOfFlowPositionedDescendantDirty = true;
6038 requestNeedsCompositedScrollingUpdate();
6039 }
5915 if (parent()) 6040 if (parent())
5916 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 6041 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
5917 } 6042 }
5918 6043
5919 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) 6044 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle)
5920 { 6045 {
5921 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition); 6046 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition);
5922 if (parent() && ((renderer() && renderer()->isOutOfFlowPositioned()) != wasO utOfFlowPositioned)) { 6047 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned();
5923 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 6048 if (parent() && isOutOfFlowPositioned != wasOutOfFlowPositioned) {
5924 if (!renderer()->documentBeingDestroyed() && acceleratedCompositingForOv erflowScrollEnabled()) 6049 if (isOutOfFlowPositioned)
5925 compositor()->setShouldReevaluateCompositingAfterLayout(); 6050 parent()->setAncestorChainHasOutOfFlowPositionedDescendant(renderer( )->containingBlock());
6051 else
6052 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() ;
5926 } 6053 }
5927 } 6054 }
5928 6055
5929 #if ENABLE(CSS_FILTERS) 6056 #if ENABLE(CSS_FILTERS)
5930 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle) 6057 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle)
5931 { 6058 {
5932 ASSERT(newStyle); 6059 ASSERT(newStyle);
5933 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); 6060 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter();
5934 } 6061 }
5935 #endif 6062 #endif
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
5999 // FilterEffectRenderer is intended to render software filters and shouldn't be needed for accelerated filters. 6126 // FilterEffectRenderer is intended to render software filters and shouldn't be needed for accelerated filters.
6000 // We should extract the SVG graph building functionality out of FilterEffec tRenderer, and it should happen in RenderLayer::computeFilterOperations. 6127 // We should extract the SVG graph building functionality out of FilterEffec tRenderer, and it should happen in RenderLayer::computeFilterOperations.
6001 // https://bugs.webkit.org/show_bug.cgi?id=114051 6128 // https://bugs.webkit.org/show_bug.cgi?id=114051
6002 if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter()) 6129 if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter())
6003 backing()->updateFilters(renderer()->style()); 6130 backing()->updateFilters(renderer()->style());
6004 } 6131 }
6005 #endif 6132 #endif
6006 6133
6007 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) 6134 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle)
6008 { 6135 {
6009 bool isNormalFlowOnly = shouldBeNormalFlowOnly();
6010 if (isNormalFlowOnly != m_isNormalFlowOnly) {
6011 m_isNormalFlowOnly = isNormalFlowOnly;
6012 RenderLayer* p = parent();
6013 if (p)
6014 p->dirtyNormalFlowList();
6015 dirtyStackingContainerZOrderLists();
6016 }
6017
6018 if (renderer()->style()->overflowX() == OMARQUEE && renderer()->style()->mar queeBehavior() != MNONE && renderer()->isBox()) { 6136 if (renderer()->style()->overflowX() == OMARQUEE && renderer()->style()->mar queeBehavior() != MNONE && renderer()->isBox()) {
6019 if (!m_marquee) 6137 if (!m_marquee)
6020 m_marquee = adoptPtr(new RenderMarquee(this)); 6138 m_marquee = adoptPtr(new RenderMarquee(this));
6021 FeatureObserver::observe(renderer()->document(), renderer()->isHTMLMarqu ee() ? FeatureObserver::HTMLMarqueeElement : FeatureObserver::CSSOverflowMarquee ); 6139 FeatureObserver::observe(renderer()->document(), renderer()->isHTMLMarqu ee() ? FeatureObserver::HTMLMarqueeElement : FeatureObserver::CSSOverflowMarquee );
6022 m_marquee->updateMarqueeStyle(); 6140 m_marquee->updateMarqueeStyle();
6023 } 6141 }
6024 else if (m_marquee) { 6142 else if (m_marquee) {
6025 m_marquee.clear(); 6143 m_marquee.clear();
6026 } 6144 }
6027 6145
6028 updateScrollbarsAfterStyleChange(oldStyle); 6146 updateScrollbarsAfterStyleChange(oldStyle);
6029 updateStackingContextsAfterStyleChange(oldStyle); 6147 updateStackingContextsAfterStyleChange(oldStyle);
6148 updateVisibilityAfterStyleChange(oldStyle);
6030 // Overlay scrollbars can make this layer self-painting so we need 6149 // Overlay scrollbars can make this layer self-painting so we need
6031 // to recompute the bit once scrollbars have been updated. 6150 // to recompute the bit once scrollbars have been updated.
6032 updateSelfPaintingLayer(); 6151 updateSelfPaintingLayer();
6033 updateOutOfFlowPositioned(oldStyle); 6152 updateOutOfFlowPositioned(oldStyle);
6034 6153
6035 if (!hasReflection() && m_reflection) 6154 if (!hasReflection() && m_reflection)
6036 removeReflection(); 6155 removeReflection();
6037 else if (hasReflection()) { 6156 else if (hasReflection()) {
6038 if (!m_reflection) 6157 if (!m_reflection)
6039 createReflection(); 6158 createReflection();
(...skipping 17 matching lines...) Expand all
6057 #endif 6176 #endif
6058 6177
6059 bool didPaintWithFilters = false; 6178 bool didPaintWithFilters = false;
6060 6179
6061 #if ENABLE(CSS_FILTERS) 6180 #if ENABLE(CSS_FILTERS)
6062 if (paintsWithFilters()) 6181 if (paintsWithFilters())
6063 didPaintWithFilters = true; 6182 didPaintWithFilters = true;
6064 updateFilters(oldStyle, renderer()->style()); 6183 updateFilters(oldStyle, renderer()->style());
6065 #endif 6184 #endif
6066 6185
6067 updateNeedsCompositedScrolling();
6068
6069 const RenderStyle* newStyle = renderer()->style(); 6186 const RenderStyle* newStyle = renderer()->style();
6070 if (compositor()->updateLayerCompositingState(this) 6187 if (compositor()->updateLayerCompositingState(this)
6071 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) 6188 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
6072 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) 6189 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
6073 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) 6190 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters))
6074 compositor()->setCompositingLayersNeedRebuild(); 6191 compositor()->setCompositingLayersNeedRebuild();
6075 else if (isComposited()) 6192 else if (isComposited())
6076 backing()->updateGraphicsLayerGeometry(); 6193 backing()->updateGraphicsLayerGeometry();
6077 } 6194 }
6078 6195
6079 void RenderLayer::updateScrollableAreaSet(bool hasOverflow) 6196 void RenderLayer::updateScrollableAreaSet(bool hasOverflow)
6080 { 6197 {
6081 Frame* frame = renderer()->frame(); 6198 Frame* frame = renderer()->frame();
6082 if (!frame) 6199 if (!frame)
6083 return; 6200 return;
6084 6201
6085 FrameView* frameView = frame->view(); 6202 FrameView* frameView = frame->view();
6086 if (!frameView) 6203 if (!frameView)
6087 return; 6204 return;
6088 6205
6089 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); 6206 bool isVisibleToHitTest = renderer()->visibleToHitTesting();
6090 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) 6207 if (HTMLFrameOwnerElement* owner = frame->ownerElement())
6091 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); 6208 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting();
6092 6209
6093 if (hasOverflow && isVisibleToHitTest ? frameView->addScrollableArea(this) : frameView->removeScrollableArea(this)) 6210 bool updatedScrollableAreaSet = false;
6094 updateNeedsCompositedScrolling(); 6211 if (hasOverflow && isVisibleToHitTest)
6212 updatedScrollableAreaSet = frameView->addScrollableArea(this);
6213 else
6214 updatedScrollableAreaSet = frameView->removeScrollableArea(this);
6215
6216 if (updatedScrollableAreaSet)
6217 requestNeedsCompositedScrollingUpdate();
6095 } 6218 }
6096 6219
6097 void RenderLayer::updateScrollCornerStyle() 6220 void RenderLayer::updateScrollCornerStyle()
6098 { 6221 {
6099 RenderObject* actualRenderer = rendererForScrollbar(renderer()); 6222 RenderObject* actualRenderer = rendererForScrollbar(renderer());
6100 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); 6223 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0);
6101 if (corner) { 6224 if (corner) {
6102 if (!m_scrollCorner) { 6225 if (!m_scrollCorner) {
6103 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument()); 6226 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument());
6104 m_scrollCorner->setParent(renderer()); 6227 m_scrollCorner->setParent(renderer());
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
6345 } 6468 }
6346 } 6469 }
6347 6470
6348 void showLayerTree(const WebCore::RenderObject* renderer) 6471 void showLayerTree(const WebCore::RenderObject* renderer)
6349 { 6472 {
6350 if (!renderer) 6473 if (!renderer)
6351 return; 6474 return;
6352 showLayerTree(renderer->enclosingLayer()); 6475 showLayerTree(renderer->enclosingLayer());
6353 } 6476 }
6354 #endif 6477 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698