| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; | 87 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; |
| 88 | 88 |
| 89 } // namespace | 89 } // namespace |
| 90 | 90 |
| 91 RenderLayer::RenderLayer(RenderLayerModelObject* renderer, LayerType type) | 91 RenderLayer::RenderLayer(RenderLayerModelObject* renderer, LayerType type) |
| 92 : m_layerType(type) | 92 : m_layerType(type) |
| 93 , m_hasSelfPaintingLayerDescendant(false) | 93 , m_hasSelfPaintingLayerDescendant(false) |
| 94 , m_hasSelfPaintingLayerDescendantDirty(false) | 94 , m_hasSelfPaintingLayerDescendantDirty(false) |
| 95 , m_isRootLayer(renderer->isRenderView()) | 95 , m_isRootLayer(renderer->isRenderView()) |
| 96 , m_usedTransparency(false) | 96 , m_usedTransparency(false) |
| 97 , m_hasVisibleNonLayerContent(false) | |
| 98 , m_3DTransformedDescendantStatusDirty(true) | 97 , m_3DTransformedDescendantStatusDirty(true) |
| 99 , m_has3DTransformedDescendant(false) | 98 , m_has3DTransformedDescendant(false) |
| 100 , m_containsDirtyOverlayScrollbars(false) | 99 , m_containsDirtyOverlayScrollbars(false) |
| 101 , m_hasFilterInfo(false) | 100 , m_hasFilterInfo(false) |
| 102 , m_needsAncestorDependentCompositingInputsUpdate(true) | 101 , m_needsAncestorDependentCompositingInputsUpdate(true) |
| 103 , m_needsDescendantDependentCompositingInputsUpdate(true) | 102 , m_needsDescendantDependentCompositingInputsUpdate(true) |
| 104 , m_childNeedsCompositingInputsUpdate(true) | 103 , m_childNeedsCompositingInputsUpdate(true) |
| 105 , m_hasCompositingDescendant(false) | 104 , m_hasCompositingDescendant(false) |
| 106 , m_hasNonCompositedChild(false) | |
| 107 , m_shouldIsolateCompositedDescendants(false) | 105 , m_shouldIsolateCompositedDescendants(false) |
| 108 , m_lostGroupedMapping(false) | 106 , m_lostGroupedMapping(false) |
| 109 , m_renderer(renderer) | 107 , m_renderer(renderer) |
| 110 , m_parent(0) | 108 , m_parent(0) |
| 111 , m_previous(0) | 109 , m_previous(0) |
| 112 , m_next(0) | 110 , m_next(0) |
| 113 , m_first(0) | 111 , m_first(0) |
| 114 , m_last(0) | 112 , m_last(0) |
| 115 , m_staticInlinePosition(0) | 113 , m_staticInlinePosition(0) |
| 116 , m_staticBlockPosition(0) | 114 , m_staticBlockPosition(0) |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 LayoutRect RenderLayer::computePaintInvalidationRect(const RenderObject* renderO
bject, const RenderLayer* paintInvalidationContainer, const PaintInvalidationSta
te* paintInvalidationState) | 415 LayoutRect RenderLayer::computePaintInvalidationRect(const RenderObject* renderO
bject, const RenderLayer* paintInvalidationContainer, const PaintInvalidationSta
te* paintInvalidationState) |
| 418 { | 416 { |
| 419 if (!paintInvalidationContainer->groupedMapping()) | 417 if (!paintInvalidationContainer->groupedMapping()) |
| 420 return renderObject->computePaintInvalidationRect(paintInvalidationConta
iner->renderer(), paintInvalidationState); | 418 return renderObject->computePaintInvalidationRect(paintInvalidationConta
iner->renderer(), paintInvalidationState); |
| 421 | 419 |
| 422 LayoutRect rect = renderObject->clippedOverflowRectForPaintInvalidation(pain
tInvalidationContainer->renderer(), paintInvalidationState); | 420 LayoutRect rect = renderObject->clippedOverflowRectForPaintInvalidation(pain
tInvalidationContainer->renderer(), paintInvalidationState); |
| 423 mapRectToPaintBackingCoordinates(paintInvalidationContainer->renderer(), rec
t); | 421 mapRectToPaintBackingCoordinates(paintInvalidationContainer->renderer(), rec
t); |
| 424 return rect; | 422 return rect; |
| 425 } | 423 } |
| 426 | 424 |
| 427 // FIXME: this is quite brute-force. We could be more efficient if we were to | |
| 428 // track state and update it as appropriate as changes are made in the Render tr
ee. | |
| 429 void RenderLayer::updateScrollingStateAfterCompositingChange() | |
| 430 { | |
| 431 TRACE_EVENT0("blink", "RenderLayer::updateScrollingStateAfterCompositingChan
ge"); | |
| 432 m_hasVisibleNonLayerContent = false; | |
| 433 for (RenderObject* r = renderer()->slowFirstChild(); r; r = r->nextSibling()
) { | |
| 434 if (!r->hasLayer()) { | |
| 435 m_hasVisibleNonLayerContent = true; | |
| 436 break; | |
| 437 } | |
| 438 } | |
| 439 | |
| 440 m_hasNonCompositedChild = false; | |
| 441 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
{ | |
| 442 if (child->compositingState() == NotComposited || child->compositingStat
e() == HasOwnBackingButPaintsIntoAncestor) { | |
| 443 m_hasNonCompositedChild = true; | |
| 444 return; | |
| 445 } | |
| 446 } | |
| 447 } | |
| 448 | |
| 449 void RenderLayer::dirty3DTransformedDescendantStatus() | 425 void RenderLayer::dirty3DTransformedDescendantStatus() |
| 450 { | 426 { |
| 451 RenderLayerStackingNode* stackingNode = m_stackingNode->ancestorStackingCont
extNode(); | 427 RenderLayerStackingNode* stackingNode = m_stackingNode->ancestorStackingCont
extNode(); |
| 452 if (!stackingNode) | 428 if (!stackingNode) |
| 453 return; | 429 return; |
| 454 | 430 |
| 455 stackingNode->layer()->m_3DTransformedDescendantStatusDirty = true; | 431 stackingNode->layer()->m_3DTransformedDescendantStatusDirty = true; |
| 456 | 432 |
| 457 // This propagates up through preserve-3d hierarchies to the enclosing flatt
ening layer. | 433 // This propagates up through preserve-3d hierarchies to the enclosing flatt
ening layer. |
| 458 // Note that preserves3D() creates stacking context, so we can just run up t
he stacking containers. | 434 // Note that preserves3D() creates stacking context, so we can just run up t
he stacking containers. |
| (...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 2121 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
| 2146 child->invalidatePaintForBlockSelectionGaps(); | 2122 child->invalidatePaintForBlockSelectionGaps(); |
| 2147 | 2123 |
| 2148 if (m_blockSelectionGapsBounds.isEmpty()) | 2124 if (m_blockSelectionGapsBounds.isEmpty()) |
| 2149 return; | 2125 return; |
| 2150 | 2126 |
| 2151 LayoutRect rect = m_blockSelectionGapsBounds; | 2127 LayoutRect rect = m_blockSelectionGapsBounds; |
| 2152 if (renderer()->hasOverflowClip()) { | 2128 if (renderer()->hasOverflowClip()) { |
| 2153 RenderBox* box = renderBox(); | 2129 RenderBox* box = renderBox(); |
| 2154 rect.move(-box->scrolledContentOffset()); | 2130 rect.move(-box->scrolledContentOffset()); |
| 2155 if (!scrollableArea()->usesCompositedScrolling()) | 2131 rect.intersect(box->overflowClipRect(LayoutPoint())); |
| 2156 rect.intersect(box->overflowClipRect(LayoutPoint())); | |
| 2157 } | 2132 } |
| 2158 if (renderer()->hasClip()) | 2133 if (renderer()->hasClip()) |
| 2159 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); | 2134 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); |
| 2160 if (!rect.isEmpty()) | 2135 if (!rect.isEmpty()) |
| 2161 renderer()->invalidatePaintRectangle(rect); | 2136 renderer()->invalidatePaintRectangle(rect); |
| 2162 } | 2137 } |
| 2163 | 2138 |
| 2164 IntRect RenderLayer::blockSelectionGapsBounds() const | 2139 IntRect RenderLayer::blockSelectionGapsBounds() const |
| 2165 { | 2140 { |
| 2166 if (!renderer()->isRenderBlock()) | 2141 if (!renderer()->isRenderBlock()) |
| 2167 return IntRect(); | 2142 return IntRect(); |
| 2168 | 2143 |
| 2169 RenderBlock* renderBlock = toRenderBlock(renderer()); | 2144 RenderBlock* renderBlock = toRenderBlock(renderer()); |
| 2170 LayoutRect gapRects = renderBlock->selectionGapRectsForPaintInvalidation(ren
derBlock); | 2145 LayoutRect gapRects = renderBlock->selectionGapRectsForPaintInvalidation(ren
derBlock); |
| 2171 | 2146 |
| 2172 return pixelSnappedIntRect(gapRects); | 2147 return pixelSnappedIntRect(gapRects); |
| 2173 } | 2148 } |
| 2174 | 2149 |
| 2175 bool RenderLayer::hasBlockSelectionGapBounds() const | |
| 2176 { | |
| 2177 // FIXME: it would be more accurate to return !blockSelectionGapsBounds().is
Empty(), but this is impossible | |
| 2178 // at the moment because it causes invalid queries to layout-dependent code
(crbug.com/372802). | |
| 2179 // ASSERT(renderer()->document().lifecycle().state() >= DocumentLifecycle::L
ayoutClean); | |
| 2180 | |
| 2181 if (!renderer()->isRenderBlock()) | |
| 2182 return false; | |
| 2183 | |
| 2184 return toRenderBlock(renderer())->shouldPaintSelectionGaps(); | |
| 2185 } | |
| 2186 | |
| 2187 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo
utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR
oot) const | 2150 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo
utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR
oot) const |
| 2188 { | 2151 { |
| 2189 // Always examine the canvas and the root. | 2152 // Always examine the canvas and the root. |
| 2190 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the RenderView | 2153 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the RenderView |
| 2191 // paints the root's background. | 2154 // paints the root's background. |
| 2192 if (isRootLayer() || renderer()->isDocumentElement()) | 2155 if (isRootLayer() || renderer()->isDocumentElement()) |
| 2193 return true; | 2156 return true; |
| 2194 | 2157 |
| 2195 // If we aren't an inline flow, and our layer bounds do intersect the damage
rect, then we | 2158 // If we aren't an inline flow, and our layer bounds do intersect the damage
rect, then we |
| 2196 // can go ahead and return true. | 2159 // can go ahead and return true. |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2777 } | 2740 } |
| 2778 } | 2741 } |
| 2779 | 2742 |
| 2780 void showLayerTree(const blink::RenderObject* renderer) | 2743 void showLayerTree(const blink::RenderObject* renderer) |
| 2781 { | 2744 { |
| 2782 if (!renderer) | 2745 if (!renderer) |
| 2783 return; | 2746 return; |
| 2784 showLayerTree(renderer->enclosingLayer()); | 2747 showLayerTree(renderer->enclosingLayer()); |
| 2785 } | 2748 } |
| 2786 #endif | 2749 #endif |
| OLD | NEW |