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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintInvalidator.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/paint/PaintInvalidator.h" 5 #include "core/paint/PaintInvalidator.h"
6 6
7 #include "core/editing/FrameSelection.h" 7 #include "core/editing/FrameSelection.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 return point; 192 return point;
193 } 193 }
194 194
195 void PaintInvalidator::updatePaintingLayer(const LayoutObject& object, 195 void PaintInvalidator::updatePaintingLayer(const LayoutObject& object,
196 PaintInvalidatorContext& context) { 196 PaintInvalidatorContext& context) {
197 if (object.hasLayer() && 197 if (object.hasLayer() &&
198 toLayoutBoxModelObject(object).hasSelfPaintingLayer()) { 198 toLayoutBoxModelObject(object).hasSelfPaintingLayer()) {
199 context.paintingLayer = toLayoutBoxModelObject(object).layer(); 199 context.paintingLayer = toLayoutBoxModelObject(object).layer();
200 } else if (object.isColumnSpanAll() || 200 } else if (object.isColumnSpanAll() ||
201 (object.isFloating() && !object.parent()->isLayoutBlock())) { 201 object.isFloatingWithNonContainingBlockParent()) {
202 // See LayoutObject::paintingLayer() for the special-cases of floating under 202 // See LayoutObject::paintingLayer() for the special-cases of floating under
203 // inline and multicolumn. 203 // inline and multicolumn.
204 context.paintingLayer = object.paintingLayer(); 204 context.paintingLayer = object.paintingLayer();
205 } 205 }
206 206
207 if (object.isLayoutBlockFlow() && toLayoutBlockFlow(object).containsFloats()) 207 if (object.isLayoutBlockFlow() && toLayoutBlockFlow(object).containsFloats())
208 context.paintingLayer->setNeedsPaintPhaseFloat(); 208 context.paintingLayer->setNeedsPaintPhaseFloat();
209 209
210 if (object == context.paintingLayer->layoutObject()) 210 if (object == context.paintingLayer->layoutObject())
211 return; 211 return;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // paintInvalidationContainerForStackedContents is only for stacked 277 // paintInvalidationContainerForStackedContents is only for stacked
278 // descendants in its own frame, because it doesn't establish stacking 278 // descendants in its own frame, because it doesn't establish stacking
279 // context for stacked contents in sub-frames. 279 // context for stacked contents in sub-frames.
280 // Contents stacked in the root stacking context in this frame should use 280 // Contents stacked in the root stacking context in this frame should use
281 // this frame's paintInvalidationContainer. 281 // this frame's paintInvalidationContainer.
282 context.paintInvalidationContainerForStackedContents = 282 context.paintInvalidationContainerForStackedContents =
283 context.paintInvalidationContainer; 283 context.paintInvalidationContainer;
284 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 284 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
285 undoFrameViewContentClipAndScroll.emplace( 285 undoFrameViewContentClipAndScroll.emplace(
286 *toLayoutView(object).frameView(), context); 286 *toLayoutView(object).frameView(), context);
287 } else if (object.isFloating() && !object.parent()->isLayoutBlock()) { 287 } else if (object.isFloatingWithNonContainingBlockParent()) {
288 // See LayoutObject::paintingLayer() for specialty of floating objects.
289 context.paintInvalidationContainer = 288 context.paintInvalidationContainer =
290 &object.containerForPaintInvalidation(); 289 &object.containerForPaintInvalidation();
291 } else if (object.styleRef().isStacked() && 290 } else if (object.styleRef().isStacked() &&
292 // This is to exclude some objects (e.g. LayoutText) inheriting 291 // This is to exclude some objects (e.g. LayoutText) inheriting
293 // stacked style from parent but aren't actually stacked. 292 // stacked style from parent but aren't actually stacked.
294 object.hasLayer() && 293 object.hasLayer() &&
295 context.paintInvalidationContainer != 294 context.paintInvalidationContainer !=
296 context.paintInvalidationContainerForStackedContents) { 295 context.paintInvalidationContainerForStackedContents) {
297 // The current object is stacked, so we should use 296 // The current object is stacked, so we should use
298 // m_paintInvalidationContainerForStackedContents as its paint invalidation 297 // m_paintInvalidationContainerForStackedContents as its paint invalidation
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; 442 PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate;
444 } 443 }
445 444
446 void PaintInvalidator::processPendingDelayedPaintInvalidations() { 445 void PaintInvalidator::processPendingDelayedPaintInvalidations() {
447 for (auto target : m_pendingDelayedPaintInvalidations) 446 for (auto target : m_pendingDelayedPaintInvalidations)
448 target->getMutableForPainting().setShouldDoFullPaintInvalidation( 447 target->getMutableForPainting().setShouldDoFullPaintInvalidation(
449 PaintInvalidationDelayedFull); 448 PaintInvalidationDelayedFull);
450 } 449 }
451 450
452 } // namespace blink 451 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698