| 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 "core/layout/PaintInvalidationState.h" | 5 #include "core/layout/PaintInvalidationState.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/layout/LayoutInline.h" | 10 #include "core/layout/LayoutInline.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 toLayoutBoxModelObject(¤tObject); | 127 toLayoutBoxModelObject(¤tObject); |
| 128 } else if (currentObject.isLayoutView()) { | 128 } else if (currentObject.isLayoutView()) { |
| 129 // m_paintInvalidationContainerForStackedContents is only for stacked | 129 // m_paintInvalidationContainerForStackedContents is only for stacked |
| 130 // descendants in its own frame, because it doesn't establish stacking | 130 // descendants in its own frame, because it doesn't establish stacking |
| 131 // context for stacked contents in sub-frames. Contents stacked in the root | 131 // context for stacked contents in sub-frames. Contents stacked in the root |
| 132 // stacking context in this frame should use this frame's | 132 // stacking context in this frame should use this frame's |
| 133 // paintInvalidationContainer. | 133 // paintInvalidationContainer. |
| 134 m_paintInvalidationContainerForStackedContents = | 134 m_paintInvalidationContainerForStackedContents = |
| 135 m_paintInvalidationContainer; | 135 m_paintInvalidationContainer; |
| 136 } else if (currentObject.isFloating() && | 136 } else if (currentObject.isFloating() && |
| 137 !currentObject.parent()->isLayoutBlock()) { | 137 !currentObject.parent()->canContainFloatingObject(currentObject)) { |
| 138 // See LayoutObject::paintingLayer() for specialty of floating objects. | |
| 139 m_paintInvalidationContainer = | 138 m_paintInvalidationContainer = |
| 140 ¤tObject.containerForPaintInvalidation(); | 139 ¤tObject.containerForPaintInvalidation(); |
| 141 m_cachedOffsetsEnabled = false; | 140 m_cachedOffsetsEnabled = false; |
| 142 } else if (currentObject.styleRef().isStacked() && | 141 } else if (currentObject.styleRef().isStacked() && |
| 143 // This is to exclude some objects (e.g. LayoutText) inheriting | 142 // This is to exclude some objects (e.g. LayoutText) inheriting |
| 144 // stacked style from parent but aren't actually stacked. | 143 // stacked style from parent but aren't actually stacked. |
| 145 currentObject.hasLayer() && | 144 currentObject.hasLayer() && |
| 146 m_paintInvalidationContainer != | 145 m_paintInvalidationContainer != |
| 147 m_paintInvalidationContainerForStackedContents) { | 146 m_paintInvalidationContainerForStackedContents) { |
| 148 // The current object is stacked, so we should use | 147 // The current object is stacked, so we should use |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 updateForCurrentObject(parentState); | 223 updateForCurrentObject(parentState); |
| 225 } | 224 } |
| 226 | 225 |
| 227 PaintLayer& PaintInvalidationState::childPaintingLayer( | 226 PaintLayer& PaintInvalidationState::childPaintingLayer( |
| 228 const LayoutObject& child) const { | 227 const LayoutObject& child) const { |
| 229 if (child.hasLayer() && toLayoutBoxModelObject(child).hasSelfPaintingLayer()) | 228 if (child.hasLayer() && toLayoutBoxModelObject(child).hasSelfPaintingLayer()) |
| 230 return *toLayoutBoxModelObject(child).layer(); | 229 return *toLayoutBoxModelObject(child).layer(); |
| 231 // See LayoutObject::paintingLayer() for the special-cases of floating under | 230 // See LayoutObject::paintingLayer() for the special-cases of floating under |
| 232 // inline and multicolumn. | 231 // inline and multicolumn. |
| 233 if (child.isColumnSpanAll() || | 232 if (child.isColumnSpanAll() || |
| 234 (child.isFloating() && !m_currentObject.isLayoutBlock())) | 233 (child.isFloating() && !child.parent()->canContainFloatingObject(child))) |
| 235 return *child.paintingLayer(); | 234 return *child.paintingLayer(); |
| 236 return m_paintingLayer; | 235 return m_paintingLayer; |
| 237 } | 236 } |
| 238 | 237 |
| 239 void PaintInvalidationState::updateForCurrentObject( | 238 void PaintInvalidationState::updateForCurrentObject( |
| 240 const PaintInvalidationState& parentState) { | 239 const PaintInvalidationState& parentState) { |
| 241 if (!m_cachedOffsetsEnabled) | 240 if (!m_cachedOffsetsEnabled) |
| 242 return; | 241 return; |
| 243 | 242 |
| 244 if (m_currentObject.isLayoutView()) { | 243 if (m_currentObject.isLayoutView()) { |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 } | 631 } |
| 633 | 632 |
| 634 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking( | 633 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking( |
| 635 const LayoutObject& object, | 634 const LayoutObject& object, |
| 636 LayoutRect& rect) const { | 635 LayoutRect& rect) const { |
| 637 DCHECK(&object == &m_paintInvalidationState.currentObject()); | 636 DCHECK(&object == &m_paintInvalidationState.currentObject()); |
| 638 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); | 637 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); |
| 639 } | 638 } |
| 640 | 639 |
| 641 } // namespace blink | 640 } // namespace blink |
| OLD | NEW |