| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/rendering/PaintInvalidationState.h" | 6 #include "core/rendering/PaintInvalidationState.h" |
| 7 | 7 |
| 8 #include "core/rendering/RenderInline.h" | 8 #include "core/rendering/RenderInline.h" |
| 9 #include "core/rendering/RenderLayer.h" | 9 #include "core/rendering/RenderLayer.h" |
| 10 #include "core/rendering/RenderView.h" | 10 #include "core/rendering/RenderView.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& nex
t, RenderLayerModelObject& renderer, const RenderLayerModelObject& paintInvalida
tionContainer) | 37 PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& nex
t, RenderLayerModelObject& renderer, const RenderLayerModelObject& paintInvalida
tionContainer) |
| 38 : m_clipped(false) | 38 : m_clipped(false) |
| 39 , m_cachedOffsetsEnabled(true) | 39 , m_cachedOffsetsEnabled(true) |
| 40 , m_forceCheckForPaintInvalidation(next.m_forceCheckForPaintInvalidation) | 40 , m_forceCheckForPaintInvalidation(next.m_forceCheckForPaintInvalidation) |
| 41 , m_paintInvalidationContainer(paintInvalidationContainer) | 41 , m_paintInvalidationContainer(paintInvalidationContainer) |
| 42 { | 42 { |
| 43 // FIXME: SVG could probably benefit from a stack-based optimization like ht
ml does. crbug.com/391054 | 43 // FIXME: SVG could probably benefit from a stack-based optimization like ht
ml does. crbug.com/391054 |
| 44 bool establishesPaintInvalidationContainer = renderer == m_paintInvalidation
Container; | 44 bool establishesPaintInvalidationContainer = renderer == m_paintInvalidation
Container; |
| 45 bool fixed = renderer.style()->position() == FixedPosition; | 45 bool fixed = renderer.style()->position() == FixedPosition; |
| 46 | 46 |
| 47 if (!renderer.supportsPaintInvalidationStateCachedOffsets() || !next.m_cache
dOffsetsEnabled) |
| 48 m_cachedOffsetsEnabled = false; |
| 47 if (establishesPaintInvalidationContainer) { | 49 if (establishesPaintInvalidationContainer) { |
| 48 // When we hit a new paint invalidation container, we don't need to | 50 // When we hit a new paint invalidation container, we don't need to |
| 49 // continue forcing a check for paint invalidation because movement | 51 // continue forcing a check for paint invalidation because movement |
| 50 // from our parents will just move the whole invalidation container. | 52 // from our parents will just move the whole invalidation container. |
| 51 m_forceCheckForPaintInvalidation = false; | 53 m_forceCheckForPaintInvalidation = false; |
| 52 } else { | 54 } else { |
| 53 if (!renderer.supportsPaintInvalidationStateCachedOffsets() || !next.m_c
achedOffsetsEnabled) { | 55 if (m_cachedOffsetsEnabled) { |
| 54 m_cachedOffsetsEnabled = false; | |
| 55 } else { | |
| 56 if (fixed) { | 56 if (fixed) { |
| 57 FloatPoint fixedOffset = renderer.localToContainerPoint(FloatPoi
nt(), &m_paintInvalidationContainer, TraverseDocumentBoundaries); | 57 FloatPoint fixedOffset = renderer.localToContainerPoint(FloatPoi
nt(), &m_paintInvalidationContainer, TraverseDocumentBoundaries); |
| 58 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); | 58 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); |
| 59 } else { | 59 } else { |
| 60 LayoutSize offset = renderer.isBox() && !renderer.isTableRow() ?
toRenderBox(renderer).locationOffset() : LayoutSize(); | 60 LayoutSize offset = renderer.isBox() && !renderer.isTableRow() ?
toRenderBox(renderer).locationOffset() : LayoutSize(); |
| 61 m_paintOffset = next.m_paintOffset + offset; | 61 m_paintOffset = next.m_paintOffset + offset; |
| 62 } | 62 } |
| 63 | 63 |
| 64 if (renderer.isOutOfFlowPositioned() && !fixed) { | 64 if (renderer.isOutOfFlowPositioned() && !fixed) { |
| 65 if (RenderObject* container = renderer.container()) { | 65 if (RenderObject* container = renderer.container()) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // to be always invalidated in-time. | 125 // to be always invalidated in-time. |
| 126 if (box.usesCompositedScrolling()) | 126 if (box.usesCompositedScrolling()) |
| 127 ASSERT(!m_clipped); // The box should establish paint invalidation conta
iner, so no m_clipped inherited. | 127 ASSERT(!m_clipped); // The box should establish paint invalidation conta
iner, so no m_clipped inherited. |
| 128 else | 128 else |
| 129 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); | 129 addClipRectRelativeToPaintOffset(LayoutSize(box.layer()->size())); |
| 130 | 130 |
| 131 m_paintOffset -= box.scrolledContentOffset(); | 131 m_paintOffset -= box.scrolledContentOffset(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace blink | 134 } // namespace blink |
| OLD | NEW |