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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 , m_previous(0) | 159 , m_previous(0) |
160 , m_next(0) | 160 , m_next(0) |
161 , m_first(0) | 161 , m_first(0) |
162 , m_last(0) | 162 , m_last(0) |
163 , m_staticInlinePosition(0) | 163 , m_staticInlinePosition(0) |
164 , m_staticBlockPosition(0) | 164 , m_staticBlockPosition(0) |
165 , m_reflection(0) | 165 , m_reflection(0) |
166 , m_scrollCorner(0) | 166 , m_scrollCorner(0) |
167 , m_resizer(0) | 167 , m_resizer(0) |
168 , m_enclosingPaginationLayer(0) | 168 , m_enclosingPaginationLayer(0) |
| 169 , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling) |
169 { | 170 { |
170 m_isNormalFlowOnly = shouldBeNormalFlowOnly(); | 171 m_isNormalFlowOnly = shouldBeNormalFlowOnly(); |
171 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 172 m_isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
172 | 173 |
173 // Non-stacking containers should have empty z-order lists. As this is alrea
dy the case, | 174 // Non-stacking containers should have empty z-order lists. As this is alrea
dy the case, |
174 // there is no need to dirty / recompute these lists. | 175 // there is no need to dirty / recompute these lists. |
175 m_zOrderListsDirty = isStackingContainer(); | 176 m_zOrderListsDirty = isStackingContainer(); |
176 | 177 |
177 ScrollableArea::setConstrainsScrollingToContentEdge(false); | 178 ScrollableArea::setConstrainsScrollingToContentEdge(false); |
178 | 179 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 // in this case, there is no need to dirty our ancestors further. | 460 // in this case, there is no need to dirty our ancestors further. |
460 if (layer->isSelfPaintingLayer()) { | 461 if (layer->isSelfPaintingLayer()) { |
461 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->hasSelfPaintingLayerDescendant()); | 462 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->hasSelfPaintingLayerDescendant()); |
462 break; | 463 break; |
463 } | 464 } |
464 } | 465 } |
465 } | 466 } |
466 | 467 |
467 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const | 468 bool RenderLayer::acceleratedCompositingForOverflowScrollEnabled() const |
468 { | 469 { |
469 return renderer()->frame() | 470 const Settings* settings = renderer()->document()->settings(); |
470 && renderer()->frame()->page() | 471 return settings && settings->acceleratedCompositingForOverflowScrollEnabled(
); |
471 && renderer()->frame()->page()->settings()->acceleratedCompositingForOve
rflowScrollEnabled(); | |
472 } | 472 } |
473 | 473 |
474 // If we are a stacking container, then this function will determine if our | 474 // If we are a stacking container, then this function will determine if our |
475 // descendants for a contiguous block in stacking order. This is required in | 475 // descendants for a contiguous block in stacking order. This is required in |
476 // order for an element to be safely promoted to a stacking container. It is saf
e | 476 // order for an element to be safely promoted to a stacking container. It is saf
e |
477 // to become a stacking container if this change would not alter the stacking | 477 // to become a stacking container if this change would not alter the stacking |
478 // order of layers on the page. That can only happen if a non-descendant appear | 478 // order of layers on the page. That can only happen if a non-descendant appear |
479 // between us and our descendants in stacking order. Here's an example: | 479 // between us and our descendants in stacking order. Here's an example: |
480 // | 480 // |
481 // this | 481 // this |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 rect.move(-delta.x(), -delta.y()); | 2039 rect.move(-delta.x(), -delta.y()); |
2040 } | 2040 } |
2041 | 2041 |
2042 bool RenderLayer::usesCompositedScrolling() const | 2042 bool RenderLayer::usesCompositedScrolling() const |
2043 { | 2043 { |
2044 return isComposited() && backing()->scrollingLayer(); | 2044 return isComposited() && backing()->scrollingLayer(); |
2045 } | 2045 } |
2046 | 2046 |
2047 bool RenderLayer::needsCompositedScrolling() const | 2047 bool RenderLayer::needsCompositedScrolling() const |
2048 { | 2048 { |
| 2049 switch (m_forceNeedsCompositedScrolling) { |
| 2050 case DoNotForceCompositedScrolling: |
| 2051 return m_needsCompositedScrolling; |
| 2052 case CompositedScrollingAlwaysOn: |
| 2053 return true; |
| 2054 case CompositedScrollingAlwaysOff: |
| 2055 return false; |
| 2056 } |
| 2057 |
| 2058 ASSERT_NOT_REACHED(); |
2049 return m_needsCompositedScrolling; | 2059 return m_needsCompositedScrolling; |
2050 } | 2060 } |
2051 | 2061 |
2052 void RenderLayer::updateNeedsCompositedScrolling() | 2062 void RenderLayer::updateNeedsCompositedScrolling() |
2053 { | 2063 { |
2054 bool needsCompositedScrolling = false; | 2064 bool needsCompositedScrolling = false; |
2055 | 2065 |
2056 FrameView* frameView = renderer()->view()->frameView(); | 2066 FrameView* frameView = renderer()->view()->frameView(); |
2057 if (frameView && frameView->containsScrollableArea(this)) { | 2067 if (frameView && frameView->containsScrollableArea(this)) { |
2058 updateDescendantDependentFlags(); | 2068 updateDescendantDependentFlags(); |
(...skipping 13 matching lines...) Expand all Loading... |
2072 // number of composited overflow divs. | 2082 // number of composited overflow divs. |
2073 if (acceleratedCompositingForOverflowScrollEnabled()) | 2083 if (acceleratedCompositingForOverflowScrollEnabled()) |
2074 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro
lling", needsCompositedScrolling, 2); | 2084 HistogramSupport::histogramEnumeration("Renderer.NeedsCompositedScro
lling", needsCompositedScrolling, 2); |
2075 } | 2085 } |
2076 | 2086 |
2077 if (m_needsCompositedScrolling == needsCompositedScrolling) | 2087 if (m_needsCompositedScrolling == needsCompositedScrolling) |
2078 return; | 2088 return; |
2079 | 2089 |
2080 m_needsCompositedScrolling = needsCompositedScrolling; | 2090 m_needsCompositedScrolling = needsCompositedScrolling; |
2081 | 2091 |
| 2092 // Note, the z-order lists may need to be rebuilt, but our code guarantees |
| 2093 // that we have not affected stacking, so we will not dirty |
| 2094 // m_canBePromotedToStackingContainer for either us or our stacking context |
| 2095 // or container. |
| 2096 didUpdateNeedsCompositedScrolling(); |
| 2097 } |
| 2098 |
| 2099 void RenderLayer::setForceNeedsCompositedScrolling(RenderLayer::ForceNeedsCompos
itedScrollingMode mode) |
| 2100 { |
| 2101 if (m_forceNeedsCompositedScrolling == mode) |
| 2102 return; |
| 2103 |
| 2104 m_forceNeedsCompositedScrolling = mode; |
| 2105 didUpdateNeedsCompositedScrolling(); |
| 2106 } |
| 2107 |
| 2108 void RenderLayer::didUpdateNeedsCompositedScrolling() |
| 2109 { |
2082 updateIsNormalFlowOnly(); | 2110 updateIsNormalFlowOnly(); |
2083 updateSelfPaintingLayer(); | 2111 updateSelfPaintingLayer(); |
2084 | 2112 |
2085 if (isStackingContainer()) | 2113 if (isStackingContainer()) |
2086 dirtyZOrderLists(); | 2114 dirtyZOrderLists(); |
2087 else | 2115 else |
2088 clearZOrderLists(); | 2116 clearZOrderLists(); |
2089 | 2117 |
2090 dirtyStackingContainerZOrderLists(); | 2118 dirtyStackingContainerZOrderLists(); |
2091 | 2119 |
(...skipping 4352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6444 } | 6472 } |
6445 } | 6473 } |
6446 | 6474 |
6447 void showLayerTree(const WebCore::RenderObject* renderer) | 6475 void showLayerTree(const WebCore::RenderObject* renderer) |
6448 { | 6476 { |
6449 if (!renderer) | 6477 if (!renderer) |
6450 return; | 6478 return; |
6451 showLayerTree(renderer->enclosingLayer()); | 6479 showLayerTree(renderer->enclosingLayer()); |
6452 } | 6480 } |
6453 #endif | 6481 #endif |
OLD | NEW |