Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp

Issue 2650873002: Refactor PaintLayer location and offset calculation especially for floats (Closed)
Patch Set: - Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 m_paintInvalidationContainerForStackedContents = 126 m_paintInvalidationContainerForStackedContents =
127 toLayoutBoxModelObject(&currentObject); 127 toLayoutBoxModelObject(&currentObject);
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.isFloatingWithNonContainingBlockParent()) {
137 !currentObject.parent()->isLayoutBlock()) {
138 // See LayoutObject::paintingLayer() for specialty of floating objects.
139 m_paintInvalidationContainer = 137 m_paintInvalidationContainer =
140 &currentObject.containerForPaintInvalidation(); 138 &currentObject.containerForPaintInvalidation();
141 m_cachedOffsetsEnabled = false; 139 m_cachedOffsetsEnabled = false;
142 } else if (currentObject.styleRef().isStacked() && 140 } else if (currentObject.styleRef().isStacked() &&
143 // This is to exclude some objects (e.g. LayoutText) inheriting 141 // This is to exclude some objects (e.g. LayoutText) inheriting
144 // stacked style from parent but aren't actually stacked. 142 // stacked style from parent but aren't actually stacked.
145 currentObject.hasLayer() && 143 currentObject.hasLayer() &&
146 m_paintInvalidationContainer != 144 m_paintInvalidationContainer !=
147 m_paintInvalidationContainerForStackedContents) { 145 m_paintInvalidationContainerForStackedContents) {
148 // The current object is stacked, so we should use 146 // The current object is stacked, so we should use
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 221
224 updateForCurrentObject(parentState); 222 updateForCurrentObject(parentState);
225 } 223 }
226 224
227 PaintLayer& PaintInvalidationState::childPaintingLayer( 225 PaintLayer& PaintInvalidationState::childPaintingLayer(
228 const LayoutObject& child) const { 226 const LayoutObject& child) const {
229 if (child.hasLayer() && toLayoutBoxModelObject(child).hasSelfPaintingLayer()) 227 if (child.hasLayer() && toLayoutBoxModelObject(child).hasSelfPaintingLayer())
230 return *toLayoutBoxModelObject(child).layer(); 228 return *toLayoutBoxModelObject(child).layer();
231 // See LayoutObject::paintingLayer() for the special-cases of floating under 229 // See LayoutObject::paintingLayer() for the special-cases of floating under
232 // inline and multicolumn. 230 // inline and multicolumn.
233 if (child.isColumnSpanAll() || 231 if (child.isColumnSpanAll() || child.isFloatingWithNonContainingBlockParent())
234 (child.isFloating() && !m_currentObject.isLayoutBlock()))
235 return *child.paintingLayer(); 232 return *child.paintingLayer();
236 return m_paintingLayer; 233 return m_paintingLayer;
237 } 234 }
238 235
239 void PaintInvalidationState::updateForCurrentObject( 236 void PaintInvalidationState::updateForCurrentObject(
240 const PaintInvalidationState& parentState) { 237 const PaintInvalidationState& parentState) {
241 if (!m_cachedOffsetsEnabled) 238 if (!m_cachedOffsetsEnabled)
242 return; 239 return;
243 240
244 if (m_currentObject.isLayoutView()) { 241 if (m_currentObject.isLayoutView()) {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 } 629 }
633 630
634 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking( 631 void PaintInvalidatorContextAdapter::mapLocalRectToPaintInvalidationBacking(
635 const LayoutObject& object, 632 const LayoutObject& object,
636 LayoutRect& rect) const { 633 LayoutRect& rect) const {
637 DCHECK(&object == &m_paintInvalidationState.currentObject()); 634 DCHECK(&object == &m_paintInvalidationState.currentObject());
638 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect); 635 m_paintInvalidationState.mapLocalRectToPaintInvalidationBacking(rect);
639 } 636 }
640 637
641 } // namespace blink 638 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698