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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 1862313002: Update PaintLayer::needsPaintPhaseXXX flags when add/remove layer on style change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 if (child->stackingNode()->isStacked() || child->firstChild()) { 1191 if (child->stackingNode()->isStacked() || child->firstChild()) {
1192 // Dirty the z-order list in which we are contained. The ancestorStackin gContextNode() can be null in the 1192 // Dirty the z-order list in which we are contained. The ancestorStackin gContextNode() can be null in the
1193 // case where we're building up generated content layers. This is ok, si nce the lists will start 1193 // case where we're building up generated content layers. This is ok, si nce the lists will start
1194 // off dirty in that case anyway. 1194 // off dirty in that case anyway.
1195 child->stackingNode()->dirtyStackingContextZOrderLists(); 1195 child->stackingNode()->dirtyStackingContextZOrderLists();
1196 } 1196 }
1197 1197
1198 // Non-self-painting children paint into this layer, so the visible contents status of this layer is affected. 1198 // Non-self-painting children paint into this layer, so the visible contents status of this layer is affected.
1199 if (!child->isSelfPaintingLayer()) 1199 if (!child->isSelfPaintingLayer())
1200 dirtyVisibleContentStatus(); 1200 dirtyVisibleContentStatus();
1201 else if (PaintLayer* enclosingSelfPaintingLayer = this->enclosingSelfPaintin gLayer())
1202 child->mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer);
1201 1203
1202 dirtyAncestorChainVisibleDescendantStatus(); 1204 dirtyAncestorChainVisibleDescendantStatus();
1203 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 1205 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1204 1206
1205 child->setNeedsRepaint(); 1207 child->setNeedsRepaint();
1206 1208
1207 child->updateDescendantDependentFlags(); 1209 child->updateDescendantDependentFlags();
1208 } 1210 }
1209 1211
1210 PaintLayer* PaintLayer::removeChild(PaintLayer* oldChild) 1212 PaintLayer* PaintLayer::removeChild(PaintLayer* oldChild)
(...skipping 29 matching lines...) Expand all
1240 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 1242 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1241 1243
1242 oldChild->updateDescendantDependentFlags(); 1244 oldChild->updateDescendantDependentFlags();
1243 1245
1244 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) 1246 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
1245 dirtyAncestorChainVisibleDescendantStatus(); 1247 dirtyAncestorChainVisibleDescendantStatus();
1246 1248
1247 if (oldChild->enclosingPaginationLayer()) 1249 if (oldChild->enclosingPaginationLayer())
1248 oldChild->clearPaginationRecursive(); 1250 oldChild->clearPaginationRecursive();
1249 1251
1252 if (oldChild->isSelfPaintingLayer()) {
1253 if (PaintLayer* enclosingSelfPaintingLayer = this->enclosingSelfPainting Layer())
pdr. 2016/04/08 04:19:00 enclosingSelfPaintingLayer is O(n) so it looks lik
Xianzhu 2016/04/08 18:08:48 Because except for non-composited non-stacked over
1254 enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*oldChild) ;
pdr. 2016/04/08 04:19:00 I'm new to this code... does "removeChild" always
Xianzhu 2016/04/08 18:08:48 Good catch. We should avoid the operation when thi
pdr. 2016/04/08 19:46:07 Because PaintLayer::{insert,remove}OnlyThisLayer()
Xianzhu 2016/04/08 21:30:55 Done renaming.
1255 }
1256
1250 setNeedsRepaint(); 1257 setNeedsRepaint();
1251 1258
1252 return oldChild; 1259 return oldChild;
1253 } 1260 }
1254 1261
1255 void PaintLayer::removeOnlyThisLayer() 1262 void PaintLayer::removeOnlyThisLayer()
1256 { 1263 {
1257 if (!m_parent) 1264 if (!m_parent)
1258 return; 1265 return;
1259 1266
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 } 2433 }
2427 2434
2428 void PaintLayer::updateSelfPaintingLayer() 2435 void PaintLayer::updateSelfPaintingLayer()
2429 { 2436 {
2430 bool isSelfPaintingLayer = shouldBeSelfPaintingLayer(); 2437 bool isSelfPaintingLayer = shouldBeSelfPaintingLayer();
2431 if (this->isSelfPaintingLayer() == isSelfPaintingLayer) 2438 if (this->isSelfPaintingLayer() == isSelfPaintingLayer)
2432 return; 2439 return;
2433 2440
2434 m_isSelfPaintingLayer = isSelfPaintingLayer; 2441 m_isSelfPaintingLayer = isSelfPaintingLayer;
2435 2442
2436 if (parent()) 2443 if (PaintLayer* parent = this->parent()) {
2437 parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 2444 parent->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
2445
2446 if (PaintLayer* enclosingSelfPaintingLayer = parent->enclosingSelfPainti ngLayer()) {
pdr. 2016/04/08 04:19:00 Are these codepaths tested? I removed these lines
Xianzhu 2016/04/08 18:08:48 Added these code because I was afraid there were c
2447 if (isSelfPaintingLayer) {
2448 mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer);
2449 } else {
2450 enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this) ;
2451 clearNeedsPaintPhaseFlags();
2452 }
2453 }
2454 }
pdr. 2016/04/08 04:19:00 Is the call to clearNeedsPaintPhaseFlags needed or
Xianzhu 2016/04/08 18:08:48 Good questions. I think this affects how accuratel
2438 } 2455 }
2439 2456
2440 PaintLayer* PaintLayer::enclosingSelfPaintingLayer() 2457 PaintLayer* PaintLayer::enclosingSelfPaintingLayer()
2441 { 2458 {
2442 PaintLayer* layer = this; 2459 PaintLayer* layer = this;
2443 while (layer && !layer->isSelfPaintingLayer()) 2460 while (layer && !layer->isSelfPaintingLayer())
2444 layer = layer->parent(); 2461 layer = layer->parent();
2445 return layer; 2462 return layer;
2446 } 2463 }
2447 2464
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 2895
2879 void showLayerTree(const blink::LayoutObject* layoutObject) 2896 void showLayerTree(const blink::LayoutObject* layoutObject)
2880 { 2897 {
2881 if (!layoutObject) { 2898 if (!layoutObject) {
2882 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2899 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2883 return; 2900 return;
2884 } 2901 }
2885 showLayerTree(layoutObject->enclosingLayer()); 2902 showLayerTree(layoutObject->enclosingLayer());
2886 } 2903 }
2887 #endif 2904 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698