| 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/layout/Layer.h" |
| 8 #include "core/rendering/RenderInline.h" | 9 #include "core/rendering/RenderInline.h" |
| 9 #include "core/rendering/RenderLayer.h" | |
| 10 #include "core/rendering/RenderView.h" | 10 #include "core/rendering/RenderView.h" |
| 11 #include "core/rendering/svg/RenderSVGModelObject.h" | 11 #include "core/rendering/svg/RenderSVGModelObject.h" |
| 12 #include "core/rendering/svg/RenderSVGRoot.h" | 12 #include "core/rendering/svg/RenderSVGRoot.h" |
| 13 #include "platform/Partitions.h" | 13 #include "platform/Partitions.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 PaintInvalidationState::PaintInvalidationState(const RenderView& renderView) | 17 PaintInvalidationState::PaintInvalidationState(const RenderView& renderView) |
| 18 : m_clipped(false) | 18 : m_clipped(false) |
| 19 , m_cachedOffsetsEnabled(true) | 19 , m_cachedOffsetsEnabled(true) |
| 20 , m_forceCheckForPaintInvalidation(false) | 20 , m_forceCheckForPaintInvalidation(false) |
| 21 , m_paintInvalidationContainer(*renderView.containerForPaintInvalidation()) | 21 , m_paintInvalidationContainer(*renderView.containerForPaintInvalidation()) |
| 22 { | 22 { |
| 23 bool establishesPaintInvalidationContainer = renderView == m_paintInvalidati
onContainer; | 23 bool establishesPaintInvalidationContainer = renderView == m_paintInvalidati
onContainer; |
| 24 if (!establishesPaintInvalidationContainer) { | 24 if (!establishesPaintInvalidationContainer) { |
| 25 if (!renderView.supportsPaintInvalidationStateCachedOffsets()) { | 25 if (!renderView.supportsPaintInvalidationStateCachedOffsets()) { |
| 26 m_cachedOffsetsEnabled = false; | 26 m_cachedOffsetsEnabled = false; |
| 27 return; | 27 return; |
| 28 } | 28 } |
| 29 FloatPoint point = renderView.localToContainerPoint(FloatPoint(), &m_pai
ntInvalidationContainer, TraverseDocumentBoundaries); | 29 FloatPoint point = renderView.localToContainerPoint(FloatPoint(), &m_pai
ntInvalidationContainer, TraverseDocumentBoundaries); |
| 30 m_paintOffset = LayoutSize(point.x(), point.y()); | 30 m_paintOffset = LayoutSize(point.x(), point.y()); |
| 31 } | 31 } |
| 32 m_clipRect = renderView.viewRect(); | 32 m_clipRect = renderView.viewRect(); |
| 33 m_clipRect.move(m_paintOffset); | 33 m_clipRect.move(m_paintOffset); |
| 34 m_clipped = true; | 34 m_clipped = true; |
| 35 } | 35 } |
| 36 | 36 |
| 37 PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& nex
t, RenderLayerModelObject& renderer, const RenderLayerModelObject& paintInvalida
tionContainer) | 37 PaintInvalidationState::PaintInvalidationState(const PaintInvalidationState& nex
t, LayoutLayerModelObject& renderer, const LayoutLayerModelObject& 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) | 47 if (!renderer.supportsPaintInvalidationStateCachedOffsets() || !next.m_cache
dOffsetsEnabled) |
| (...skipping 77 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 |