Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1157 toLayoutView(&paintInvalidationContainer)->invalidatePaintForRectangle(r , invalidationReason); | 1157 toLayoutView(&paintInvalidationContainer)->invalidatePaintForRectangle(r , invalidationReason); |
| 1158 return; | 1158 return; |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 if (paintInvalidationContainer.view()->usesCompositing()) { | 1161 if (paintInvalidationContainer.view()->usesCompositing()) { |
| 1162 ASSERT(paintInvalidationContainer.isPaintInvalidationContainer()); | 1162 ASSERT(paintInvalidationContainer.isPaintInvalidationContainer()); |
| 1163 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(r, inv alidationReason); | 1163 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(r, inv alidationReason); |
| 1164 } | 1164 } |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const | 1167 void LayoutObject::invalidateDisplayItemClient(const NonLayoutObjectDisplayItemC lientWrapper& displayItemClient) |
| 1168 { | |
| 1169 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 1170 setChildNeedsRepaint(); | |
| 1171 invalidateDisplayItemClientInternal(displayItemClient); | |
| 1172 } | |
| 1173 | |
| 1174 void LayoutObject::invalidateDisplayItemClient(LayoutObject& object) | |
| 1175 { | |
| 1176 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 1177 object.setNeedsRepaint(); | |
| 1178 invalidateDisplayItemClientInternal(object); | |
| 1179 } | |
| 1180 | |
| 1181 void LayoutObject::invalidateDisplayItemClientInternal(const DisplayItemClientWr apper& displayItemClient) | |
| 1168 { | 1182 { |
| 1169 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) | 1183 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) |
| 1170 return; | 1184 return; |
| 1171 | 1185 |
| 1172 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. | 1186 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. |
| 1173 if (const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer()) { | 1187 if (const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer()) { |
| 1174 // This is valid because we want to invalidate the client in the display item list of the current backing. | 1188 // This is valid because we want to invalidate the client in the display item list of the current backing. |
| 1175 DisableCompositingQueryAsserts disabler; | 1189 DisableCompositingQueryAsserts disabler; |
| 1176 if (const DeprecatedPaintLayer* paintInvalidationLayer = enclosingLayer- >enclosingLayerForPaintInvalidationCrossingFrameBoundaries()) | 1190 if (const DeprecatedPaintLayer* paintInvalidationLayer = enclosingLayer- >enclosingLayerForPaintInvalidationCrossingFrameBoundaries()) |
| 1177 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient); | 1191 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient); |
| 1178 } | 1192 } |
| 1179 } | 1193 } |
| 1180 | 1194 |
| 1181 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const | 1195 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) |
| 1182 { | 1196 { |
| 1183 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 1197 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| 1198 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 1199 setNeedsRepaint(); | |
| 1184 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this); | 1200 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this); |
| 1185 } | 1201 } |
| 1186 | 1202 |
| 1203 void LayoutObject::setNeedsRepaint() | |
| 1204 { | |
| 1205 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
|
pdr.
2015/08/20 22:45:05
Can we assert that we're in the appropriate docume
Xianzhu
2015/08/21 00:31:38
Done. The condition will change in next steps for
| |
| 1206 if (!selfNeedsRepaint()) { | |
| 1207 m_bitfields.setSelfNeedsRepaint(true); | |
| 1208 markContainerChainForRepaint(); | |
| 1209 } | |
| 1210 } | |
| 1211 | |
| 1212 void LayoutObject::setChildNeedsRepaint() | |
| 1213 { | |
| 1214 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
| 1215 if (!childNeedsRepaint()) { | |
| 1216 m_bitfields.setChildNeedsRepaint(true); | |
| 1217 markContainerChainForRepaint(); | |
| 1218 } | |
| 1219 } | |
| 1220 | |
| 1221 void LayoutObject::markContainerChainForRepaint() | |
|
pdr.
2015/08/20 22:45:05
markContainerChainForChildNeedsRepaint?
Xianzhu
2015/08/21 00:31:38
Done.
| |
| 1222 { | |
| 1223 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
| 1224 for (LayoutObject* container = this->containerCrossingFrameBoundaries(); con tainer && !container->childNeedsRepaint(); container = container->containerCross ingFrameBoundaries()) | |
| 1225 container->m_bitfields.setChildNeedsRepaint(true); | |
|
trchen
2015/08/21 00:37:29
I think we need to special case fixed-pos elements
Xianzhu
2015/08/21 04:54:51
container() is actually equivalent to paintingAnce
Xianzhu
2015/08/21 05:52:45
Scratch the above. Perhaps I misunderstood paintin
| |
| 1226 } | |
| 1227 | |
| 1228 bool LayoutObject::clearRepaintFlagsRecursively() | |
| 1229 { | |
| 1230 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
| 1231 m_bitfields.setSelfNeedsRepaint(false); | |
| 1232 | |
| 1233 if (!m_bitfields.childNeedsRepaint()) | |
| 1234 return true; | |
| 1235 | |
| 1236 if (clearRepaintFlagsOfSubtrees()) { | |
| 1237 m_bitfields.setChildNeedsRepaint(false); | |
| 1238 return true; | |
| 1239 } | |
| 1240 return false; | |
| 1241 } | |
| 1242 | |
| 1243 bool LayoutObject::clearRepaintFlagsOfSubtrees() | |
| 1244 { | |
| 1245 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
| 1246 bool result = true; | |
| 1247 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { | |
| 1248 if (!child->isOutOfFlowPositioned()) | |
| 1249 result &= child->clearRepaintFlagsRecursively(); | |
| 1250 } | |
| 1251 return result; | |
| 1252 } | |
| 1253 | |
| 1187 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const | 1254 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const |
| 1188 { | 1255 { |
| 1189 if (!paintInvalidationContainer) | 1256 if (!paintInvalidationContainer) |
| 1190 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); | 1257 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); |
| 1191 return DeprecatedPaintLayer::computePaintInvalidationRect(this, paintInvalid ationContainer->layer(), paintInvalidationState); | 1258 return DeprecatedPaintLayer::computePaintInvalidationRect(this, paintInvalid ationContainer->layer(), paintInvalidationState); |
| 1192 } | 1259 } |
| 1193 | 1260 |
| 1194 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& r) const | 1261 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& r) |
| 1195 { | 1262 { |
| 1196 RELEASE_ASSERT(isRooted()); | 1263 RELEASE_ASSERT(isRooted()); |
| 1197 | 1264 |
| 1198 if (r.isEmpty()) | 1265 if (r.isEmpty()) |
| 1199 return nullptr; | 1266 return nullptr; |
| 1200 | 1267 |
| 1201 if (view()->document().printing()) | 1268 if (view()->document().printing()) |
| 1202 return nullptr; // Don't invalidate paints if we're printing. | 1269 return nullptr; // Don't invalidate paints if we're printing. |
| 1203 | 1270 |
| 1204 LayoutRect dirtyRect(r); | 1271 LayoutRect dirtyRect(r); |
| 1205 | 1272 |
| 1206 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree(); | 1273 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree(); |
| 1207 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalida tionContainer, dirtyRect); | 1274 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalida tionContainer, dirtyRect); |
| 1208 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); | 1275 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); |
| 1209 return &paintInvalidationContainer; | 1276 return &paintInvalidationContainer; |
| 1210 } | 1277 } |
| 1211 | 1278 |
| 1212 void LayoutObject::invalidatePaintRectangle(const LayoutRect& r) const | 1279 void LayoutObject::invalidatePaintRectangle(const LayoutRect& r) |
| 1213 { | 1280 { |
| 1214 if (const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaint RectangleInternal(r)) { | 1281 if (const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaint RectangleInternal(r)) { |
| 1215 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 1282 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
| 1216 invalidateDisplayItemClients(*paintInvalidationContainer); | 1283 invalidateDisplayItemClients(*paintInvalidationContainer); |
| 1217 } | 1284 } |
| 1218 } | 1285 } |
| 1219 | 1286 |
| 1220 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) | 1287 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) |
| 1221 { | 1288 { |
| 1222 ASSERT(!needsLayout()); | 1289 ASSERT(!needsLayout()); |
| (...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3279 | 3346 |
| 3280 // If a paint invalidation container is not a stacking context, | 3347 // If a paint invalidation container is not a stacking context, |
| 3281 // some of its descendants may belong to the parent container. | 3348 // some of its descendants may belong to the parent container. |
| 3282 findNonCompositedDescendantLayerToTraverse(*descendant, functor); | 3349 findNonCompositedDescendantLayerToTraverse(*descendant, functor); |
| 3283 descendant = descendant->nextInPreOrderAfterChildren(&object); | 3350 descendant = descendant->nextInPreOrderAfterChildren(&object); |
| 3284 } | 3351 } |
| 3285 } | 3352 } |
| 3286 | 3353 |
| 3287 } // unnamed namespace | 3354 } // unnamed namespace |
| 3288 | 3355 |
| 3289 void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(con st LayoutObject& object) const | 3356 void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(Lay outObject& object) |
| 3290 { | 3357 { |
| 3291 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 3358 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| 3292 | 3359 |
| 3293 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. | 3360 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. |
| 3294 const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer(); | 3361 const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer(); |
| 3295 if (!enclosingLayer) | 3362 if (!enclosingLayer) |
| 3296 return; | 3363 return; |
| 3297 | 3364 |
| 3298 // This is valid because we want to invalidate the client in the display ite m list of the current backing. | 3365 // This is valid because we want to invalidate the client in the display ite m list of the current backing. |
| 3299 DisableCompositingQueryAsserts disabler; | 3366 DisableCompositingQueryAsserts disabler; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3397 const blink::LayoutObject* root = object1; | 3464 const blink::LayoutObject* root = object1; |
| 3398 while (root->parent()) | 3465 while (root->parent()) |
| 3399 root = root->parent(); | 3466 root = root->parent(); |
| 3400 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3467 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
| 3401 } else { | 3468 } else { |
| 3402 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3469 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
| 3403 } | 3470 } |
| 3404 } | 3471 } |
| 3405 | 3472 |
| 3406 #endif | 3473 #endif |
| OLD | NEW |