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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 return hitTestLocation.intersects(m_rect); | 139 return hitTestLocation.intersects(m_rect); |
| 140 } | 140 } |
| 141 | 141 |
| 142 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) | 142 RenderLayer::RenderLayer(RenderLayerModelObject* renderer) |
| 143 : m_inResizeMode(false) | 143 : m_inResizeMode(false) |
| 144 , m_scrollDimensionsDirty(true) | 144 , m_scrollDimensionsDirty(true) |
| 145 , m_normalFlowListDirty(true) | 145 , m_normalFlowListDirty(true) |
| 146 , m_hasSelfPaintingLayerDescendant(false) | 146 , m_hasSelfPaintingLayerDescendant(false) |
| 147 , m_hasSelfPaintingLayerDescendantDirty(false) | 147 , m_hasSelfPaintingLayerDescendantDirty(false) |
| 148 , m_hasOutOfFlowPositionedDescendant(false) | 148 , m_hasOutOfFlowPositionedDescendant(false) |
| 149 , m_hasOutOfFlowPositionedDescendantDirty(true) | 149 , m_hasOutOfFlowPositionedDescendantDirty(false) |
| 150 , m_needsCompositedScrolling(false) | 150 , m_needsCompositedScrolling(false) |
| 151 , m_descendantsAreContiguousInStackingOrder(false) | 151 , m_descendantsAreContiguousInStackingOrder(false) |
|
hartmanng
2013/04/10 17:34:05
should be true by default
Ian Vollick
2013/04/11 16:36:03
Done.
| |
| 152 , m_descendantsAreContiguousInStackingOrderDirty(false) | |
| 152 , m_isRootLayer(renderer->isRenderView()) | 153 , m_isRootLayer(renderer->isRenderView()) |
| 153 , m_usedTransparency(false) | 154 , m_usedTransparency(false) |
| 154 , m_paintingInsideReflection(false) | 155 , m_paintingInsideReflection(false) |
| 155 , m_inOverflowRelayout(false) | 156 , m_inOverflowRelayout(false) |
| 156 , m_repaintStatus(NeedsNormalRepaint) | 157 , m_repaintStatus(NeedsNormalRepaint) |
| 157 , m_visibleContentStatusDirty(true) | 158 , m_visibleContentStatusDirty(true) |
| 158 , m_hasVisibleContent(false) | 159 , m_hasVisibleContent(false) |
| 159 , m_visibleDescendantStatusDirty(false) | 160 , m_visibleDescendantStatusDirty(false) |
| 160 , m_hasVisibleDescendant(false) | 161 , m_hasVisibleDescendant(false) |
| 161 , m_isPaginated(false) | 162 , m_isPaginated(false) |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 // numSCDecendants = 3 | 589 // numSCDecendants = 3 |
| 589 // | 590 // |
| 590 // and so, | 591 // and so, |
| 591 // maxStackIndex - minStackIndex == numSCDescendants | 592 // maxStackIndex - minStackIndex == numSCDescendants |
| 592 // ===> 3 - 0 == 3 | 593 // ===> 3 - 0 == 3 |
| 593 // ===> 3 == 3 | 594 // ===> 3 == 3 |
| 594 // | 595 // |
| 595 // And we would conclude that C could be promoted. | 596 // And we would conclude that C could be promoted. |
| 596 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() | 597 void RenderLayer::updateDescendantsAreContiguousInStackingOrder() |
| 597 { | 598 { |
| 598 if (!isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled( )) | 599 if (!m_descendantsAreContiguousInStackingOrderDirty || !isStackingContext() || !acceleratedCompositingForOverflowScrollEnabled()) { |
| 600 m_descendantsAreContiguousInStackingOrderDirty = false; | |
| 599 return; | 601 return; |
| 600 | 602 } |
| 601 ASSERT(!m_normalFlowListDirty); | |
| 602 ASSERT(!m_zOrderListsDirty); | |
| 603 | 603 |
| 604 OwnPtr<Vector<RenderLayer*> > posZOrderList; | 604 OwnPtr<Vector<RenderLayer*> > posZOrderList; |
| 605 OwnPtr<Vector<RenderLayer*> > negZOrderList; | 605 OwnPtr<Vector<RenderLayer*> > negZOrderList; |
| 606 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); | 606 rebuildZOrderLists(StopAtStackingContexts, posZOrderList, negZOrderList); |
| 607 | 607 |
| 608 // Create a reverse lookup. | 608 // Create a reverse lookup. |
| 609 HashMap<const RenderLayer*, int> lookup; | 609 HashMap<const RenderLayer*, int> lookup; |
| 610 | 610 |
| 611 if (negZOrderList) { | 611 if (negZOrderList) { |
| 612 int stackingOrderIndex = -1; | 612 int stackingOrderIndex = -1; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 628 continue; | 628 continue; |
| 629 lookup.set(currentLayer, stackingOrderIndex++); | 629 lookup.set(currentLayer, stackingOrderIndex++); |
| 630 } | 630 } |
| 631 } | 631 } |
| 632 | 632 |
| 633 int minIndex = 0; | 633 int minIndex = 0; |
| 634 int maxIndex = 0; | 634 int maxIndex = 0; |
| 635 int count = 0; | 635 int count = 0; |
| 636 bool firstIteration = true; | 636 bool firstIteration = true; |
| 637 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max Index, count, firstIteration); | 637 updateDescendantsAreContiguousInStackingOrderRecursive(lookup, minIndex, max Index, count, firstIteration); |
| 638 | |
| 639 m_descendantsAreContiguousInStackingOrderDirty = false; | |
| 638 } | 640 } |
| 639 | 641 |
| 640 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun t, bool firstIteration) | 642 void RenderLayer::updateDescendantsAreContiguousInStackingOrderRecursive(const H ashMap<const RenderLayer*, int>& lookup, int& minIndex, int& maxIndex, int& coun t, bool firstIteration) |
| 641 { | 643 { |
| 644 m_descendantsAreContiguousInStackingOrderDirty = false; | |
| 645 | |
| 642 if (isStackingContext() && !firstIteration) { | 646 if (isStackingContext() && !firstIteration) { |
| 643 if (lookup.contains(this)) { | 647 if (lookup.contains(this)) { |
| 644 minIndex = std::min(minIndex, lookup.get(this)); | 648 minIndex = std::min(minIndex, lookup.get(this)); |
| 645 maxIndex = std::max(maxIndex, lookup.get(this)); | 649 maxIndex = std::max(maxIndex, lookup.get(this)); |
| 646 count++; | 650 count++; |
| 647 } | 651 } |
| 648 return; | 652 return; |
| 649 } | 653 } |
| 650 | 654 |
| 651 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { | 655 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) { |
| 652 int childMinIndex = 0; | 656 int childMinIndex = 0; |
| 653 int childMaxIndex = 0; | 657 int childMaxIndex = 0; |
| 654 int childCount = 0; | 658 int childCount = 0; |
| 655 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch ildMinIndex, childMaxIndex, childCount, false); | 659 child->updateDescendantsAreContiguousInStackingOrderRecursive(lookup, ch ildMinIndex, childMaxIndex, childCount, false); |
| 656 if (childCount) { | 660 if (childCount) { |
| 657 count += childCount; | 661 count += childCount; |
| 658 minIndex = std::min(minIndex, childMinIndex); | 662 minIndex = std::min(minIndex, childMinIndex); |
| 659 maxIndex = std::max(maxIndex, childMaxIndex); | 663 maxIndex = std::max(maxIndex, childMaxIndex); |
| 660 } | 664 } |
| 661 } | 665 } |
| 662 | 666 |
| 663 if (!isStackingContext()) { | 667 if (!isStackingContext()) { |
| 664 bool newValue = maxIndex - minIndex == count; | 668 m_descendantsAreContiguousInStackingOrder = maxIndex - minIndex == count ; |
| 665 bool didUpdate = newValue != m_descendantsAreContiguousInStackingOrder; | |
| 666 m_descendantsAreContiguousInStackingOrder = newValue; | |
| 667 if (didUpdate) | |
| 668 updateNeedsCompositedScrolling(); | |
| 669 } | 669 } |
| 670 } | 670 } |
| 671 | 671 |
| 672 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap) | 672 void RenderLayer::computeRepaintRects(const RenderLayerModelObject* repaintConta iner, const RenderGeometryMap* geometryMap) |
| 673 { | 673 { |
| 674 ASSERT(!m_visibleContentStatusDirty); | 674 ASSERT(!m_visibleContentStatusDirty); |
| 675 | 675 |
| 676 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); | 676 m_repaintRect = renderer()->clippedOverflowRectForRepaint(repaintContainer); |
| 677 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap); | 677 m_outlineBox = renderer()->outlineBoundsForRepaint(repaintContainer, geometr yMap); |
| 678 } | 678 } |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 964 if (curr == ancestorStackingContainer) | 964 if (curr == ancestorStackingContainer) |
| 965 return; | 965 return; |
| 966 } | 966 } |
| 967 } | 967 } |
| 968 | 968 |
| 969 bool RenderLayer::canBeStackingContainer() const | 969 bool RenderLayer::canBeStackingContainer() const |
| 970 { | 970 { |
| 971 if (isStackingContext() || !stackingContainer()) | 971 if (isStackingContext() || !stackingContainer()) |
| 972 return true; | 972 return true; |
| 973 | 973 |
| 974 ASSERT(!m_descendantsAreContiguousInStackingOrderDirty); | |
| 974 return m_descendantsAreContiguousInStackingOrder; | 975 return m_descendantsAreContiguousInStackingOrder; |
| 975 } | 976 } |
| 976 | 977 |
| 977 void RenderLayer::setHasVisibleContent() | 978 void RenderLayer::setHasVisibleContent() |
| 978 { | 979 { |
| 979 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { | 980 if (m_hasVisibleContent && !m_visibleContentStatusDirty) { |
| 980 ASSERT(!parent() || parent()->hasVisibleDescendant()); | 981 ASSERT(!parent() || parent()->hasVisibleDescendant()); |
| 981 return; | 982 return; |
| 982 } | 983 } |
| 983 | 984 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1044 childOutOfFlowDescendantContainingBlocks.add(child->renderer()-> containingBlock()); | 1045 childOutOfFlowDescendantContainingBlocks.add(child->renderer()-> containingBlock()); |
| 1045 | 1046 |
| 1046 if (outOfFlowDescendantContainingBlocks) { | 1047 if (outOfFlowDescendantContainingBlocks) { |
| 1047 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow DescendantContainingBlocks.begin(); | 1048 HashSet<const RenderObject*>::const_iterator it = childOutOfFlow DescendantContainingBlocks.begin(); |
| 1048 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i t) | 1049 for (; it != childOutOfFlowDescendantContainingBlocks.end(); ++i t) |
| 1049 outOfFlowDescendantContainingBlocks->add(*it); | 1050 outOfFlowDescendantContainingBlocks->add(*it); |
| 1050 } | 1051 } |
| 1051 | 1052 |
| 1052 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; | 1053 bool hasVisibleDescendant = child->m_hasVisibleContent || child->m_h asVisibleDescendant; |
| 1053 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); | 1054 bool hasSelfPaintingLayerDescendant = child->isSelfPaintingLayer() | | child->hasSelfPaintingLayerDescendant(); |
| 1054 bool hasOutOfFlowPositionedDescendant = !childOutOfFlowDescendantCon tainingBlocks.isEmpty(); | 1055 bool hasOutOfFlowPositionedDescendant = !childOutOfFlowDescendantCon tainingBlocks.isEmpty() || child->hasOutOfFlowPositionedDescendant(); |
| 1055 | 1056 |
| 1056 m_hasVisibleDescendant |= hasVisibleDescendant; | 1057 m_hasVisibleDescendant |= hasVisibleDescendant; |
| 1057 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; | 1058 m_hasSelfPaintingLayerDescendant |= hasSelfPaintingLayerDescendant; |
| 1058 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt; | 1059 m_hasOutOfFlowPositionedDescendant |= hasOutOfFlowPositionedDescenda nt; |
| 1059 | 1060 |
| 1060 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_ hasOutOfFlowPositionedDescendant) | 1061 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && m_ hasOutOfFlowPositionedDescendant) |
| 1061 break; | 1062 break; |
| 1062 } | 1063 } |
| 1063 | 1064 |
| 1064 if (outOfFlowDescendantContainingBlocks && renderer()) | 1065 if (outOfFlowDescendantContainingBlocks && renderer()) |
| 1065 outOfFlowDescendantContainingBlocks->remove(renderer()); | 1066 outOfFlowDescendantContainingBlocks->remove(renderer()); |
| 1066 | 1067 |
| 1067 m_visibleDescendantStatusDirty = false; | 1068 m_visibleDescendantStatusDirty = false; |
| 1068 m_hasSelfPaintingLayerDescendantDirty = false; | 1069 m_hasSelfPaintingLayerDescendantDirty = false; |
| 1069 | |
| 1070 if (m_hasOutOfFlowPositionedDescendantDirty) | |
| 1071 updateNeedsCompositedScrolling(); | |
| 1072 | |
| 1073 m_hasOutOfFlowPositionedDescendantDirty = false; | 1070 m_hasOutOfFlowPositionedDescendantDirty = false; |
| 1074 } | 1071 } |
| 1075 | 1072 |
| 1076 if (m_visibleContentStatusDirty) { | 1073 if (m_visibleContentStatusDirty) { |
| 1077 if (renderer()->style()->visibility() == VISIBLE) | 1074 if (renderer()->style()->visibility() == VISIBLE) |
| 1078 m_hasVisibleContent = true; | 1075 m_hasVisibleContent = true; |
| 1079 else { | 1076 else { |
| 1080 // layer may be hidden but still have some visible content, check fo r this | 1077 // layer may be hidden but still have some visible content, check fo r this |
| 1081 m_hasVisibleContent = false; | 1078 m_hasVisibleContent = false; |
| 1082 RenderObject* r = renderer()->firstChild(); | 1079 RenderObject* r = renderer()->firstChild(); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1670 child->setParent(this); | 1667 child->setParent(this); |
| 1671 | 1668 |
| 1672 if (child->isNormalFlowOnly()) | 1669 if (child->isNormalFlowOnly()) |
| 1673 dirtyNormalFlowList(); | 1670 dirtyNormalFlowList(); |
| 1674 | 1671 |
| 1675 if (!child->isNormalFlowOnly() || child->firstChild()) { | 1672 if (!child->isNormalFlowOnly() || child->firstChild()) { |
| 1676 // Dirty the z-order list in which we are contained. The stackingContain er() can be null in the | 1673 // 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 | 1674 // 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. | 1675 // off dirty in that case anyway. |
| 1679 child->dirtyStackingContainerZOrderLists(); | 1676 child->dirtyStackingContainerZOrderLists(); |
| 1677 child->m_descendantsAreContiguousInStackingOrderDirty = true; | |
| 1680 } | 1678 } |
| 1681 | 1679 |
| 1682 child->updateDescendantDependentFlags(); | 1680 child->updateDescendantDependentFlags(); |
| 1683 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) | 1681 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) |
| 1684 setAncestorChainHasVisibleDescendant(); | 1682 setAncestorChainHasVisibleDescendant(); |
| 1685 | 1683 |
| 1686 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) | 1684 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) |
| 1687 setAncestorChainHasSelfPaintingLayerDescendant(); | 1685 setAncestorChainHasSelfPaintingLayerDescendant(); |
| 1688 | 1686 |
| 1689 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil d->hasOutOfFlowPositionedDescendant())) | 1687 if (child->renderer() && (child->renderer()->isOutOfFlowPositioned() || chil d->hasOutOfFlowPositionedDescendant())) |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1703 if (oldChild->nextSibling()) | 1701 if (oldChild->nextSibling()) |
| 1704 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; | 1702 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()) ; |
| 1705 | 1703 |
| 1706 if (m_first == oldChild) | 1704 if (m_first == oldChild) |
| 1707 m_first = oldChild->nextSibling(); | 1705 m_first = oldChild->nextSibling(); |
| 1708 if (m_last == oldChild) | 1706 if (m_last == oldChild) |
| 1709 m_last = oldChild->previousSibling(); | 1707 m_last = oldChild->previousSibling(); |
| 1710 | 1708 |
| 1711 if (oldChild->isNormalFlowOnly()) | 1709 if (oldChild->isNormalFlowOnly()) |
| 1712 dirtyNormalFlowList(); | 1710 dirtyNormalFlowList(); |
| 1713 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { | 1711 if (!oldChild->isNormalFlowOnly() || oldChild->firstChild()) { |
| 1714 // Dirty the z-order list in which we are contained. When called via th e | 1712 // 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 | 1713 // 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. | 1714 // from the main layer tree, so we need to null-check the |stackingConta iner| value. |
| 1717 oldChild->dirtyStackingContainerZOrderLists(); | 1715 oldChild->dirtyStackingContainerZOrderLists(); |
| 1716 m_descendantsAreContiguousInStackingOrderDirty = true; | |
| 1718 } | 1717 } |
| 1719 | 1718 |
| 1720 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned()) || oldChild->hasOutOfFlowPositionedDescendant()) | 1719 if ((oldChild->renderer() && oldChild->renderer()->isOutOfFlowPositioned()) || oldChild->hasOutOfFlowPositionedDescendant()) |
| 1721 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 1720 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
| 1722 | 1721 |
| 1723 oldChild->setPreviousSibling(0); | 1722 oldChild->setPreviousSibling(0); |
| 1724 oldChild->setNextSibling(0); | 1723 oldChild->setNextSibling(0); |
| 1725 oldChild->setParent(0); | 1724 oldChild->setParent(0); |
| 1726 | 1725 |
| 1727 oldChild->updateDescendantDependentFlags(); | 1726 oldChild->updateDescendantDependentFlags(); |
| 1728 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1727 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
| 1729 dirtyAncestorChainVisibleDescendantStatus(); | 1728 dirtyAncestorChainVisibleDescendantStatus(); |
| 1730 | 1729 |
| 1731 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) | 1730 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) |
| 1732 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1731 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 1733 | 1732 |
| 1734 return oldChild; | 1733 return oldChild; |
| 1735 } | 1734 } |
| 1736 | 1735 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1932 rect.move(-delta.x(), -delta.y()); | 1931 rect.move(-delta.x(), -delta.y()); |
| 1933 } | 1932 } |
| 1934 | 1933 |
| 1935 bool RenderLayer::usesCompositedScrolling() const | 1934 bool RenderLayer::usesCompositedScrolling() const |
| 1936 { | 1935 { |
| 1937 return isComposited() && backing()->scrollingLayer(); | 1936 return isComposited() && backing()->scrollingLayer(); |
| 1938 } | 1937 } |
| 1939 | 1938 |
| 1940 bool RenderLayer::needsCompositedScrolling() const | 1939 bool RenderLayer::needsCompositedScrolling() const |
| 1941 { | 1940 { |
| 1941 ASSERT(!m_descendantsAreContiguousInStackingOrderDirty); | |
| 1942 ASSERT(!m_hasOutOfFlowPositionedDescendantDirty); | |
| 1942 return m_needsCompositedScrolling; | 1943 return m_needsCompositedScrolling; |
| 1943 } | 1944 } |
| 1944 | 1945 |
| 1945 void RenderLayer::updateNeedsCompositedScrolling() | 1946 void RenderLayer::updateNeedsCompositedScrolling() |
| 1946 { | 1947 { |
| 1947 bool oldNeedsCompositedScrolling = m_needsCompositedScrolling; | 1948 bool needsCompositedScrolling = false; |
| 1948 | 1949 |
| 1949 FrameView* frameView = renderer()->view()->frameView(); | 1950 FrameView* frameView = renderer()->view()->frameView(); |
| 1950 if (!frameView || !frameView->containsScrollableArea(this)) | 1951 if (frameView && frameView->containsScrollableArea(this)) { |
| 1951 m_needsCompositedScrolling = false; | |
| 1952 else { | |
| 1953 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() | 1952 bool forceUseCompositedScrolling = acceleratedCompositingForOverflowScro llEnabled() |
| 1954 && canBeStackingContainer() | 1953 && canBeStackingContainer() |
| 1955 && !hasOutOfFlowPositionedDescendant(); | 1954 && !hasOutOfFlowPositionedDescendant(); |
| 1956 | 1955 |
| 1957 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) | 1956 #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) |
| 1958 m_needsCompositedScrolling = forceUseCompositedScrolling || renderer()-> style()->useTouchOverflowScrolling(); | 1957 needsCompositedScrolling = forceUseCompositedScrolling || renderer()->st yle()->useTouchOverflowScrolling(); |
| 1959 #else | 1958 #else |
| 1960 m_needsCompositedScrolling = forceUseCompositedScrolling; | 1959 needsCompositedScrolling = forceUseCompositedScrolling; |
| 1961 #endif | 1960 #endif |
| 1962 // We gather a boolean value for use with Google UMA histograms to | |
| 1963 // quantify the actual effects of a set of patches attempting to | |
| 1964 // relax composited scrolling requirements, thereby increasing the | |
| 1965 // number of composited overflow divs. | |
| 1966 if (acceleratedCompositingForOverflowScrollEnabled()) | |
| 1967 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro lling", m_needsCompositedScrolling, 2); | |
| 1968 } | 1961 } |
| 1969 | 1962 |
| 1970 if (oldNeedsCompositedScrolling != m_needsCompositedScrolling) { | 1963 setNeedsCompositedScrolling(needsCompositedScrolling); |
| 1971 updateSelfPaintingLayer(); | 1964 } |
| 1972 if (isStackingContainer()) | |
| 1973 dirtyZOrderLists(); | |
| 1974 else | |
| 1975 clearZOrderLists(); | |
| 1976 | 1965 |
| 1977 dirtyStackingContainerZOrderLists(); | 1966 void RenderLayer::setNeedsCompositedScrolling(bool needsCompositedScrolling) |
| 1967 { | |
| 1968 // We gather a boolean value for use with Google UMA histograms to | |
| 1969 // quantify the actual effects of a set of patches attempting to | |
| 1970 // relax composited scrolling requirements, thereby increasing the | |
| 1971 // number of composited overflow divs. | |
| 1972 if (acceleratedCompositingForOverflowScrollEnabled()) | |
| 1973 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScrollin g", needsCompositedScrolling, 2); | |
|
hartmanng
2013/04/10 17:34:05
this should only be set for scrollable divs, not a
Ian Vollick
2013/04/11 16:36:03
Done.
| |
| 1978 | 1974 |
| 1979 compositor()->setShouldReevaluateCompositingAfterLayout(); | 1975 if (m_needsCompositedScrolling == needsCompositedScrolling) |
| 1980 compositor()->setCompositingLayersNeedRebuild(); | 1976 return; |
| 1981 } | 1977 |
| 1978 m_needsCompositedScrolling = needsCompositedScrolling; | |
| 1979 | |
| 1980 updateIsNormalFlowOnly(); | |
| 1981 updateSelfPaintingLayer(); | |
| 1982 | |
| 1983 if (isStackingContainer()) | |
| 1984 dirtyZOrderLists(); | |
| 1985 else | |
| 1986 clearZOrderLists(); | |
| 1987 | |
| 1988 dirtyStackingContainerZOrderLists(); | |
| 1989 | |
| 1990 compositor()->setShouldReevaluateCompositingAfterLayout(); | |
| 1991 compositor()->setCompositingLayersNeedRebuild(); | |
| 1982 } | 1992 } |
| 1983 | 1993 |
| 1984 static inline int adjustedScrollDelta(int beginningDelta) { | 1994 static inline int adjustedScrollDelta(int beginningDelta) { |
| 1985 // This implemention matches Firefox's. | 1995 // This implemention matches Firefox's. |
| 1986 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml #856. | 1996 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml #856. |
| 1987 const int speedReducer = 12; | 1997 const int speedReducer = 12; |
| 1988 | 1998 |
| 1989 int adjustedDelta = beginningDelta / speedReducer; | 1999 int adjustedDelta = beginningDelta / speedReducer; |
| 1990 if (adjustedDelta > 1) | 2000 if (adjustedDelta > 1) |
| 1991 adjustedDelta = static_cast<int>(adjustedDelta * sqrt(static_cast<double >(adjustedDelta))) - 1; | 2001 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(); | 2276 frameView->resumeScheduledEvents(); |
| 2267 } | 2277 } |
| 2268 | 2278 |
| 2269 void RenderLayer::updateCompositingLayersAfterScroll() | 2279 void RenderLayer::updateCompositingLayersAfterScroll() |
| 2270 { | 2280 { |
| 2271 if (compositor()->inCompositingMode()) { | 2281 if (compositor()->inCompositingMode()) { |
| 2272 // Our stacking container is guaranteed to contain all of our descendant s that may need | 2282 // Our stacking container is guaranteed to contain all of our descendant s that may need |
| 2273 // repositioning, so update compositing layers from there. | 2283 // repositioning, so update compositing layers from there. |
| 2274 if (RenderLayer* compositingAncestor = stackingContainer()->enclosingCom positingLayer()) { | 2284 if (RenderLayer* compositingAncestor = stackingContainer()->enclosingCom positingLayer()) { |
| 2275 if (compositor()->compositingConsultsOverlap()) { | 2285 if (compositor()->compositingConsultsOverlap()) { |
| 2276 if (usesCompositedScrolling() && !hasOutOfFlowPositionedDescenda nt()) | 2286 if (usesCompositedScrolling()) |
| 2277 compositor()->updateCompositingLayers(CompositingUpdateOnCom positedScroll, compositingAncestor); | 2287 compositor()->updateCompositingLayers(CompositingUpdateOnCom positedScroll, compositingAncestor); |
| 2278 else | 2288 else |
| 2279 compositor()->updateCompositingLayers(CompositingUpdateOnScr oll, compositingAncestor); | 2289 compositor()->updateCompositingLayers(CompositingUpdateOnScr oll, compositingAncestor); |
| 2280 } else | 2290 } else |
| 2281 compositingAncestor->backing()->updateAfterLayout(RenderLayerBac king::IsUpdateRoot); | 2291 compositingAncestor->backing()->updateAfterLayout(RenderLayerBac king::IsUpdateRoot); |
| 2282 } | 2292 } |
| 2283 } | 2293 } |
| 2284 } | 2294 } |
| 2285 | 2295 |
| 2286 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const Lay outRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& align Y) | 2296 LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const Lay outRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& align Y) |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3101 // to pull our scroll offsets back to the max (or push them up to the mi n). | 3111 // to pull our scroll offsets back to the max (or push them up to the mi n). |
| 3102 IntSize clampedScrollOffset = clampScrollOffset(scrollOffset()); | 3112 IntSize clampedScrollOffset = clampScrollOffset(scrollOffset()); |
| 3103 if (clampedScrollOffset != scrollOffset()) | 3113 if (clampedScrollOffset != scrollOffset()) |
| 3104 scrollToOffset(clampedScrollOffset); | 3114 scrollToOffset(clampedScrollOffset); |
| 3105 } | 3115 } |
| 3106 | 3116 |
| 3107 updateScrollbarsAfterLayout(); | 3117 updateScrollbarsAfterLayout(); |
| 3108 | 3118 |
| 3109 if (originalScrollOffset != scrollOffset()) | 3119 if (originalScrollOffset != scrollOffset()) |
| 3110 scrollToOffsetWithoutAnimation(IntPoint(scrollOffset())); | 3120 scrollToOffsetWithoutAnimation(IntPoint(scrollOffset())); |
| 3111 | |
| 3112 // Composited scrolling may need to be enabled or disabled if the amount of overflow changed. | |
| 3113 if (renderer()->view() && compositor()->updateLayerCompositingState(this)) | |
| 3114 compositor()->setCompositingLayersNeedRebuild(); | |
| 3115 } | 3121 } |
| 3116 | 3122 |
| 3117 bool RenderLayer::overflowControlsIntersectRect(const IntRect& localRect) const | 3123 bool RenderLayer::overflowControlsIntersectRect(const IntRect& localRect) const |
| 3118 { | 3124 { |
| 3119 const IntRect borderBox = renderBox()->pixelSnappedBorderBoxRect(); | 3125 const IntRect borderBox = renderBox()->pixelSnappedBorderBoxRect(); |
| 3120 | 3126 |
| 3121 if (rectForHorizontalScrollbar(borderBox).intersects(localRect)) | 3127 if (rectForHorizontalScrollbar(borderBox).intersects(localRect)) |
| 3122 return true; | 3128 return true; |
| 3123 | 3129 |
| 3124 if (rectForVerticalScrollbar(borderBox).intersects(localRect)) | 3130 if (rectForVerticalScrollbar(borderBox).intersects(localRect)) |
| (...skipping 2364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5489 | 5495 |
| 5490 // Helper for the sorting of layers by z-index. | 5496 // Helper for the sorting of layers by z-index. |
| 5491 static inline bool compareZIndex(RenderLayer* first, RenderLayer* second) | 5497 static inline bool compareZIndex(RenderLayer* first, RenderLayer* second) |
| 5492 { | 5498 { |
| 5493 return first->zIndex() < second->zIndex(); | 5499 return first->zIndex() < second->zIndex(); |
| 5494 } | 5500 } |
| 5495 | 5501 |
| 5496 void RenderLayer::dirtyZOrderLists() | 5502 void RenderLayer::dirtyZOrderLists() |
| 5497 { | 5503 { |
| 5498 ASSERT(m_layerListMutationAllowed); | 5504 ASSERT(m_layerListMutationAllowed); |
| 5499 ASSERT(isStackingContainer()); | |
| 5500 | 5505 |
| 5501 if (m_posZOrderList) | 5506 if (m_posZOrderList) |
| 5502 m_posZOrderList->clear(); | 5507 m_posZOrderList->clear(); |
| 5503 if (m_negZOrderList) | 5508 if (m_negZOrderList) |
| 5504 m_negZOrderList->clear(); | 5509 m_negZOrderList->clear(); |
| 5505 m_zOrderListsDirty = true; | 5510 m_zOrderListsDirty = true; |
| 5506 | 5511 |
| 5512 m_descendantsAreContiguousInStackingOrderDirty = true; | |
| 5513 | |
| 5507 if (!renderer()->documentBeingDestroyed()) { | 5514 if (!renderer()->documentBeingDestroyed()) { |
| 5508 compositor()->setCompositingLayersNeedRebuild(); | 5515 compositor()->setCompositingLayersNeedRebuild(); |
| 5509 if (acceleratedCompositingForOverflowScrollEnabled()) | 5516 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 5510 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5517 compositor()->setShouldReevaluateCompositingAfterLayout(); |
| 5511 } | 5518 } |
| 5512 } | 5519 } |
| 5513 | 5520 |
| 5514 void RenderLayer::dirtyStackingContainerZOrderLists() | 5521 void RenderLayer::dirtyStackingContainerZOrderLists() |
|
hartmanng
2013/04/10 17:34:05
rename to dirtyStackingContextZOrderLists. Also ad
Ian Vollick
2013/04/11 16:36:03
I think the function name still works, but I expla
| |
| 5515 { | 5522 { |
| 5516 RenderLayer* sc = stackingContainer(); | 5523 for (RenderLayer* layer = parent(); layer; layer = layer->parent()) { |
| 5517 if (sc) | 5524 layer->dirtyZOrderLists(); |
| 5518 sc->dirtyZOrderLists(); | 5525 if (layer->isStackingContext()) |
| 5526 break; | |
| 5527 } | |
| 5519 } | 5528 } |
| 5520 | 5529 |
| 5521 void RenderLayer::dirtyNormalFlowList() | 5530 void RenderLayer::dirtyNormalFlowList() |
| 5522 { | 5531 { |
| 5523 ASSERT(m_layerListMutationAllowed); | 5532 ASSERT(m_layerListMutationAllowed); |
| 5524 | 5533 |
| 5525 if (m_normalFlowList) | 5534 if (m_normalFlowList) |
| 5526 m_normalFlowList->clear(); | 5535 m_normalFlowList->clear(); |
| 5527 m_normalFlowListDirty = true; | 5536 m_normalFlowListDirty = true; |
| 5528 | 5537 |
| 5538 m_descendantsAreContiguousInStackingOrderDirty = true; | |
| 5529 if (!renderer()->documentBeingDestroyed()) { | 5539 if (!renderer()->documentBeingDestroyed()) { |
| 5530 compositor()->setCompositingLayersNeedRebuild(); | 5540 compositor()->setCompositingLayersNeedRebuild(); |
| 5531 if (acceleratedCompositingForOverflowScrollEnabled()) | 5541 if (acceleratedCompositingForOverflowScrollEnabled()) |
| 5532 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5542 compositor()->setShouldReevaluateCompositingAfterLayout(); |
| 5533 } | 5543 } |
| 5534 } | 5544 } |
| 5535 | 5545 |
| 5536 void RenderLayer::rebuildZOrderLists() | 5546 void RenderLayer::rebuildZOrderLists() |
| 5537 { | 5547 { |
| 5538 ASSERT(m_layerListMutationAllowed); | 5548 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()) { | 5631 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) { |
| 5622 // Ignore reflections. | 5632 // Ignore reflections. |
| 5623 if (!m_reflection || reflectionLayer() != child) | 5633 if (!m_reflection || reflectionLayer() != child) |
| 5624 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer); | 5634 child->collectLayers(includeHiddenLayers, behavior, posBuffer, n egBuffer); |
| 5625 } | 5635 } |
| 5626 } | 5636 } |
| 5627 } | 5637 } |
| 5628 | 5638 |
| 5629 void RenderLayer::updateLayerListsIfNeeded() | 5639 void RenderLayer::updateLayerListsIfNeeded() |
| 5630 { | 5640 { |
| 5631 bool shouldUpdateDescendantsAreContiguousInStackingOrder = isStackingContext () && (m_zOrderListsDirty || m_normalFlowListDirty); | 5641 bool shouldUpdateDescendantsAreContiguousInStackingOrder = acceleratedCompos itingForOverflowScrollEnabled() && isStackingContext() && (m_zOrderListsDirty || m_normalFlowListDirty) && m_descendantsAreContiguousInStackingOrderDirty; |
| 5632 updateZOrderLists(); | 5642 updateZOrderLists(); |
| 5633 updateNormalFlowList(); | 5643 updateNormalFlowList(); |
| 5634 | 5644 |
| 5635 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { | 5645 if (RenderLayer* reflectionLayer = this->reflectionLayer()) { |
| 5636 reflectionLayer->updateZOrderLists(); | 5646 reflectionLayer->updateZOrderLists(); |
| 5637 reflectionLayer->updateNormalFlowList(); | 5647 reflectionLayer->updateNormalFlowList(); |
| 5638 } | 5648 } |
| 5639 | 5649 |
| 5640 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { | 5650 if (shouldUpdateDescendantsAreContiguousInStackingOrder) { |
| 5641 updateDescendantsAreContiguousInStackingOrder(); | 5651 updateDescendantsAreContiguousInStackingOrder(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5717 && !renderer()->hasBlendMode() | 5727 && !renderer()->hasBlendMode() |
| 5718 #endif | 5728 #endif |
| 5719 && !isTransparent() | 5729 && !isTransparent() |
| 5720 && !needsCompositedScrolling() | 5730 && !needsCompositedScrolling() |
| 5721 #if ENABLE(CSS_EXCLUSIONS) | 5731 #if ENABLE(CSS_EXCLUSIONS) |
| 5722 && !renderer()->isFloatingWithShapeOutside() | 5732 && !renderer()->isFloatingWithShapeOutside() |
| 5723 #endif | 5733 #endif |
| 5724 ; | 5734 ; |
| 5725 } | 5735 } |
| 5726 | 5736 |
| 5737 void RenderLayer::updateIsNormalFlowOnly() | |
| 5738 { | |
| 5739 bool isNormalFlowOnly = shouldBeNormalFlowOnly(); | |
| 5740 if (isNormalFlowOnly == m_isNormalFlowOnly) | |
| 5741 return; | |
| 5742 | |
| 5743 m_isNormalFlowOnly = isNormalFlowOnly; | |
| 5744 RenderLayer* p = parent(); | |
| 5745 if (p) | |
| 5746 p->dirtyNormalFlowList(); | |
| 5747 dirtyStackingContainerZOrderLists(); | |
| 5748 } | |
| 5749 | |
| 5727 bool RenderLayer::shouldBeSelfPaintingLayer() const | 5750 bool RenderLayer::shouldBeSelfPaintingLayer() const |
| 5728 { | 5751 { |
| 5729 return !isNormalFlowOnly() | 5752 return !isNormalFlowOnly() |
| 5730 || hasOverlayScrollbars() | 5753 || hasOverlayScrollbars() |
| 5731 || needsCompositedScrolling() | 5754 || needsCompositedScrolling() |
| 5732 || renderer()->hasReflection() | 5755 || renderer()->hasReflection() |
| 5733 || renderer()->hasMask() | 5756 || renderer()->hasMask() |
| 5734 || renderer()->isTableRow() | 5757 || renderer()->isTableRow() |
| 5735 || renderer()->isCanvas() | 5758 || renderer()->isCanvas() |
| 5736 || renderer()->isVideo() | 5759 || renderer()->isVideo() |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5801 return true; | 5824 return true; |
| 5802 | 5825 |
| 5803 if (hasVisibleBoxDecorations()) | 5826 if (hasVisibleBoxDecorations()) |
| 5804 return true; | 5827 return true; |
| 5805 | 5828 |
| 5806 return false; | 5829 return false; |
| 5807 } | 5830 } |
| 5808 | 5831 |
| 5809 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle) | 5832 void RenderLayer::updateStackingContextsAfterStyleChange(const RenderStyle* oldS tyle) |
| 5810 { | 5833 { |
| 5811 if (!oldStyle) | 5834 bool wasStackingContext = oldStyle ? isStackingContext(oldStyle) : false; |
| 5812 return; | 5835 EVisibility oldVisibility = oldStyle ? oldStyle->visibility() : VISIBLE; |
| 5813 | 5836 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 | 5837 |
| 5825 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could | 5838 // FIXME: RenderLayer already handles visibility changes through our visibli ty dirty bits. This logic could |
| 5826 // likely be folded along with the rest. | 5839 // likely be folded along with the rest. |
| 5827 if (oldStyle->zIndex() != renderer()->style()->zIndex() || oldStyle->visibil ity() != renderer()->style()->visibility()) { | 5840 bool isStackingContext = this->isStackingContext(); |
| 5828 dirtyStackingContainerZOrderLists(); | 5841 if (isStackingContext == wasStackingContext && oldVisibility == renderer()-> style()->visibility() && oldZIndex == renderer()->style()->zIndex()) |
| 5829 if (isStackingContext) | 5842 return; |
| 5830 dirtyZOrderLists(); | 5843 |
| 5831 } | 5844 dirtyStackingContainerZOrderLists(); |
| 5845 if (isStackingContainer()) | |
| 5846 dirtyZOrderLists(); | |
| 5832 } | 5847 } |
| 5833 | 5848 |
| 5834 static bool overflowRequiresScrollbar(EOverflow overflow) | 5849 static bool overflowRequiresScrollbar(EOverflow overflow) |
| 5835 { | 5850 { |
| 5836 return overflow == OSCROLL; | 5851 return overflow == OSCROLL; |
| 5837 } | 5852 } |
| 5838 | 5853 |
| 5839 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 5854 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
| 5840 { | 5855 { |
| 5841 return overflow == OAUTO || overflow == OOVERLAY; | 5856 return overflow == OAUTO || overflow == OOVERLAY; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5878 } | 5893 } |
| 5879 | 5894 |
| 5880 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containingBlock) | 5895 void RenderLayer::setAncestorChainHasOutOfFlowPositionedDescendant(RenderObject* containingBlock) |
| 5881 { | 5896 { |
| 5882 for (RenderLayer* layer = this; layer; layer = layer->parent()) { | 5897 for (RenderLayer* layer = this; layer; layer = layer->parent()) { |
| 5883 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl owPositionedDescendant()) | 5898 if (!layer->m_hasOutOfFlowPositionedDescendantDirty && layer->hasOutOfFl owPositionedDescendant()) |
| 5884 break; | 5899 break; |
| 5885 | 5900 |
| 5886 layer->m_hasOutOfFlowPositionedDescendantDirty = false; | 5901 layer->m_hasOutOfFlowPositionedDescendantDirty = false; |
| 5887 layer->m_hasOutOfFlowPositionedDescendant = true; | 5902 layer->m_hasOutOfFlowPositionedDescendant = true; |
| 5888 layer->updateNeedsCompositedScrolling(); | |
| 5889 | 5903 |
| 5890 if (layer->renderer() && layer->renderer() == containingBlock) | 5904 if (layer->renderer() && layer->renderer() == containingBlock) |
| 5891 break; | 5905 break; |
| 5892 } | 5906 } |
| 5893 } | 5907 } |
| 5894 | 5908 |
| 5895 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() | 5909 void RenderLayer::dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() |
| 5896 { | 5910 { |
| 5897 m_hasOutOfFlowPositionedDescendantDirty = true; | 5911 if (m_hasOutOfFlowPositionedDescendant) |
| 5912 m_hasOutOfFlowPositionedDescendantDirty = true; | |
| 5913 | |
| 5898 if (parent()) | 5914 if (parent()) |
| 5899 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 5915 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
| 5900 } | 5916 } |
| 5901 | 5917 |
| 5902 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) | 5918 void RenderLayer::updateOutOfFlowPositioned(const RenderStyle* oldStyle) |
| 5903 { | 5919 { |
| 5904 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition); | 5920 bool wasOutOfFlowPositioned = oldStyle && (oldStyle->position() == AbsoluteP osition || oldStyle->position() == FixedPosition); |
| 5905 if (parent() && ((renderer() && renderer()->isOutOfFlowPositioned()) != wasO utOfFlowPositioned)) { | 5921 bool isOutOfFlowPositioned = renderer()->isOutOfFlowPositioned(); |
| 5906 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 5922 if (parent() && isOutOfFlowPositioned != wasOutOfFlowPositioned) { |
| 5907 if (!renderer()->documentBeingDestroyed() && acceleratedCompositingForOv erflowScrollEnabled()) | 5923 if (isOutOfFlowPositioned) |
| 5908 compositor()->setShouldReevaluateCompositingAfterLayout(); | 5924 parent()->setAncestorChainHasOutOfFlowPositionedDescendant(renderer( )->containingBlock()); |
| 5925 else | |
| 5926 parent()->dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus() ; | |
| 5909 } | 5927 } |
| 5910 } | 5928 } |
| 5911 | 5929 |
| 5912 #if ENABLE(CSS_FILTERS) | 5930 #if ENABLE(CSS_FILTERS) |
| 5913 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle) | 5931 static bool hasOrHadFilters(const RenderStyle* oldStyle, const RenderStyle* newS tyle) |
| 5914 { | 5932 { |
| 5915 ASSERT(newStyle); | 5933 ASSERT(newStyle); |
| 5916 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); | 5934 return (oldStyle && oldStyle->hasFilter()) || newStyle->hasFilter(); |
| 5917 } | 5935 } |
| 5918 #endif | 5936 #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. | 6000 // 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. | 6001 // 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 | 6002 // https://bugs.webkit.org/show_bug.cgi?id=114051 |
| 5985 if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter()) | 6003 if (shouldUpdateFilters && newStyle->filter().hasReferenceFilter()) |
| 5986 backing()->updateFilters(renderer()->style()); | 6004 backing()->updateFilters(renderer()->style()); |
| 5987 } | 6005 } |
| 5988 #endif | 6006 #endif |
| 5989 | 6007 |
| 5990 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) | 6008 void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) |
| 5991 { | 6009 { |
| 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()) { | 6010 if (renderer()->style()->overflowX() == OMARQUEE && renderer()->style()->mar queeBehavior() != MNONE && renderer()->isBox()) { |
| 6002 if (!m_marquee) | 6011 if (!m_marquee) |
| 6003 m_marquee = adoptPtr(new RenderMarquee(this)); | 6012 m_marquee = adoptPtr(new RenderMarquee(this)); |
| 6004 FeatureObserver::observe(renderer()->document(), renderer()->isHTMLMarqu ee() ? FeatureObserver::HTMLMarqueeElement : FeatureObserver::CSSOverflowMarquee ); | 6013 FeatureObserver::observe(renderer()->document(), renderer()->isHTMLMarqu ee() ? FeatureObserver::HTMLMarqueeElement : FeatureObserver::CSSOverflowMarquee ); |
| 6005 m_marquee->updateMarqueeStyle(); | 6014 m_marquee->updateMarqueeStyle(); |
| 6006 } | 6015 } |
| 6007 else if (m_marquee) { | 6016 else if (m_marquee) { |
| 6008 m_marquee.clear(); | 6017 m_marquee.clear(); |
| 6009 } | 6018 } |
| 6010 | 6019 |
| 6011 updateScrollbarsAfterStyleChange(oldStyle); | 6020 updateScrollbarsAfterStyleChange(oldStyle); |
| 6012 updateStackingContextsAfterStyleChange(oldStyle); | 6021 updateStackingContextsAfterStyleChange(oldStyle); |
| 6022 | |
| 6013 // Overlay scrollbars can make this layer self-painting so we need | 6023 // Overlay scrollbars can make this layer self-painting so we need |
| 6014 // to recompute the bit once scrollbars have been updated. | 6024 // to recompute the bit once scrollbars have been updated. |
| 6015 updateSelfPaintingLayer(); | 6025 updateSelfPaintingLayer(); |
| 6016 updateOutOfFlowPositioned(oldStyle); | 6026 updateOutOfFlowPositioned(oldStyle); |
| 6017 | 6027 |
| 6018 if (!hasReflection() && m_reflection) | 6028 if (!hasReflection() && m_reflection) |
| 6019 removeReflection(); | 6029 removeReflection(); |
| 6020 else if (hasReflection()) { | 6030 else if (hasReflection()) { |
| 6021 if (!m_reflection) | 6031 if (!m_reflection) |
| 6022 createReflection(); | 6032 createReflection(); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 6040 #endif | 6050 #endif |
| 6041 | 6051 |
| 6042 bool didPaintWithFilters = false; | 6052 bool didPaintWithFilters = false; |
| 6043 | 6053 |
| 6044 #if ENABLE(CSS_FILTERS) | 6054 #if ENABLE(CSS_FILTERS) |
| 6045 if (paintsWithFilters()) | 6055 if (paintsWithFilters()) |
| 6046 didPaintWithFilters = true; | 6056 didPaintWithFilters = true; |
| 6047 updateFilters(oldStyle, renderer()->style()); | 6057 updateFilters(oldStyle, renderer()->style()); |
| 6048 #endif | 6058 #endif |
| 6049 | 6059 |
| 6050 updateNeedsCompositedScrolling(); | 6060 // FIXME(vollick) this requires updates that won't happen until after layout. |
| 6051 | 6061 // Will this just fall out of the updateCompositingLayers call that will be |
| 6052 const RenderStyle* newStyle = renderer()->style(); | 6062 // coming anyway? |
| 6053 if (compositor()->updateLayerCompositingState(this) | 6063 // const RenderStyle* newStyle = renderer()->style(); |
| 6054 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 6064 // if (compositor()->updateLayerCompositingState(this) |
| 6055 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 6065 // || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) |
| 6056 || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPaintW ithFilters)) | 6066 // || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
| 6057 compositor()->setCompositingLayersNeedRebuild(); | 6067 // || needsCompositingLayersRebuiltForFilters(oldStyle, newStyle, didPain tWithFilters)) |
| 6058 else if (isComposited()) | 6068 // compositor()->setCompositingLayersNeedRebuild(); |
| 6059 backing()->updateGraphicsLayerGeometry(); | 6069 // else if (isComposited()) |
| 6070 // backing()->updateGraphicsLayerGeometry(); | |
| 6071 // | |
| 6060 } | 6072 } |
| 6061 | 6073 |
| 6062 void RenderLayer::updateScrollableAreaSet(bool hasOverflow) | 6074 void RenderLayer::updateScrollableAreaSet(bool hasOverflow) |
| 6063 { | 6075 { |
| 6064 Frame* frame = renderer()->frame(); | 6076 Frame* frame = renderer()->frame(); |
| 6065 if (!frame) | 6077 if (!frame) |
| 6066 return; | 6078 return; |
| 6067 | 6079 |
| 6068 FrameView* frameView = frame->view(); | 6080 FrameView* frameView = frame->view(); |
| 6069 if (!frameView) | 6081 if (!frameView) |
| 6070 return; | 6082 return; |
| 6071 | 6083 |
| 6072 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); | 6084 bool isVisibleToHitTest = renderer()->visibleToHitTesting(); |
| 6073 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) | 6085 if (HTMLFrameOwnerElement* owner = frame->ownerElement()) |
| 6074 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); | 6086 isVisibleToHitTest &= owner->renderer() && owner->renderer()->visibleToH itTesting(); |
| 6075 | 6087 |
| 6076 if (hasOverflow && isVisibleToHitTest ? frameView->addScrollableArea(this) : frameView->removeScrollableArea(this)) | 6088 if (hasOverflow && isVisibleToHitTest) |
|
hartmanng
2013/04/10 17:34:05
frameView->{add,remove}ScrollableArea() no longer
hartmanng
2013/04/12 03:51:42
I think you missed this comment
| |
| 6077 updateNeedsCompositedScrolling(); | 6089 frameView->addScrollableArea(this); |
| 6090 else | |
| 6091 frameView->removeScrollableArea(this); | |
| 6078 } | 6092 } |
| 6079 | 6093 |
| 6080 void RenderLayer::updateScrollCornerStyle() | 6094 void RenderLayer::updateScrollCornerStyle() |
| 6081 { | 6095 { |
| 6082 RenderObject* actualRenderer = rendererForScrollbar(renderer()); | 6096 RenderObject* actualRenderer = rendererForScrollbar(renderer()); |
| 6083 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); | 6097 RefPtr<RenderStyle> corner = renderer()->hasOverflowClip() ? actualRenderer- >getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualRenderer->st yle()) : PassRefPtr<RenderStyle>(0); |
| 6084 if (corner) { | 6098 if (corner) { |
| 6085 if (!m_scrollCorner) { | 6099 if (!m_scrollCorner) { |
| 6086 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument()); | 6100 m_scrollCorner = RenderScrollbarPart::createAnonymous(renderer()->do cument()); |
| 6087 m_scrollCorner->setParent(renderer()); | 6101 m_scrollCorner->setParent(renderer()); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6320 } | 6334 } |
| 6321 } | 6335 } |
| 6322 | 6336 |
| 6323 void showLayerTree(const WebCore::RenderObject* renderer) | 6337 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6324 { | 6338 { |
| 6325 if (!renderer) | 6339 if (!renderer) |
| 6326 return; | 6340 return; |
| 6327 showLayerTree(renderer->enclosingLayer()); | 6341 showLayerTree(renderer->enclosingLayer()); |
| 6328 } | 6342 } |
| 6329 #endif | 6343 #endif |
| OLD | NEW |