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 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1158 toLayoutView(&paintInvalidationContainer)->invalidatePaintForRectangle(r , invalidationReason); | 1158 toLayoutView(&paintInvalidationContainer)->invalidatePaintForRectangle(r , invalidationReason); |
1159 return; | 1159 return; |
1160 } | 1160 } |
1161 | 1161 |
1162 if (paintInvalidationContainer.view()->usesCompositing()) { | 1162 if (paintInvalidationContainer.view()->usesCompositing()) { |
1163 ASSERT(paintInvalidationContainer.isPaintInvalidationContainer()); | 1163 ASSERT(paintInvalidationContainer.isPaintInvalidationContainer()); |
1164 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(r, inv alidationReason); | 1164 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(r, inv alidationReason); |
1165 } | 1165 } |
1166 } | 1166 } |
1167 | 1167 |
1168 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const | 1168 void LayoutObject::invalidateDisplayItemClient(const NonLayoutObjectDisplayItemC lientWrapper& displayItemClient) |
1169 { | |
1170 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
1171 setChildNeedsRepaint(); | |
1172 invalidateDisplayItemClientInternal(displayItemClient); | |
1173 } | |
1174 | |
1175 void LayoutObject::invalidateDisplayItemClient(LayoutObject& object) | |
1176 { | |
1177 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
1178 object.setNeedsRepaint(); | |
1179 invalidateDisplayItemClientInternal(object); | |
1180 } | |
1181 | |
1182 void LayoutObject::invalidateDisplayItemClientInternal(const DisplayItemClientWr apper& displayItemClient) | |
1169 { | 1183 { |
1170 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) | 1184 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) |
1171 return; | 1185 return; |
1172 | 1186 |
1173 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. | 1187 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. |
1174 if (const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer()) { | 1188 if (const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer()) { |
1175 // This is valid because we want to invalidate the client in the display item list of the current backing. | 1189 // This is valid because we want to invalidate the client in the display item list of the current backing. |
1176 DisableCompositingQueryAsserts disabler; | 1190 DisableCompositingQueryAsserts disabler; |
1177 if (const DeprecatedPaintLayer* paintInvalidationLayer = enclosingLayer- >enclosingLayerForPaintInvalidationCrossingFrameBoundaries()) | 1191 if (const DeprecatedPaintLayer* paintInvalidationLayer = enclosingLayer- >enclosingLayerForPaintInvalidationCrossingFrameBoundaries()) |
1178 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient); | 1192 paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientO nBacking(displayItemClient); |
1179 } | 1193 } |
1180 } | 1194 } |
1181 | 1195 |
1182 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) const | 1196 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer) |
1183 { | 1197 { |
1184 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 1198 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
1199 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
1200 setNeedsRepaint(); | |
1185 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this); | 1201 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this); |
1186 } | 1202 } |
1187 | 1203 |
1204 void LayoutObject::setNeedsRepaint() | |
1205 { | |
1206 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
1207 ASSERT(document().lifecycle().state() <= DocumentLifecycle::InPaintInvalidat ion); | |
1208 | |
1209 if (!selfNeedsRepaint()) { | |
1210 m_bitfields.setSelfNeedsRepaint(true); | |
1211 markContainerChainForChildNeedsRepaint(); | |
1212 } | |
1213 } | |
1214 | |
1215 void LayoutObject::setChildNeedsRepaint() | |
1216 { | |
1217 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
1218 ASSERT(document().lifecycle().state() <= DocumentLifecycle::InPaintInvalidat ion); | |
1219 | |
1220 if (!childNeedsRepaint()) { | |
1221 m_bitfields.setChildNeedsRepaint(true); | |
1222 markContainerChainForChildNeedsRepaint(); | |
1223 } | |
1224 } | |
1225 | |
1226 void LayoutObject::markContainerChainForChildNeedsRepaint() | |
1227 { | |
1228 // TODO(wangxianzhu): This should be "markPaintContainerChainForChildNeedsRe paint" | |
1229 // (which returns the painting container instead of positioning container fo r fixed-pos) | |
1230 // when we remove DeprecatedPaintLayer. Currently DeprecatedPaintLayer paint s fixed-pos | |
1231 // object which is not fully controlled by normal LayoutBlock subtree repain t flags. | |
trchen
2015/08/25 06:30:38
Sorry I just realized that fixed-pos element is no
Xianzhu
2015/08/25 15:55:03
This is not too hard, but it'll need non-constant
chrishtr
2015/08/25 20:49:52
I'm not sure all the complexity of encoding paint
| |
1232 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
1233 for (LayoutObject* container = this->containerCrossingFrameBoundaries(); con tainer && !container->childNeedsRepaint(); container = container->containerCross ingFrameBoundaries()) | |
1234 container->m_bitfields.setChildNeedsRepaint(true); | |
1235 } | |
1236 | |
1237 void LayoutObject::clearRepaintFlagsRecursively() | |
1238 { | |
1239 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
1240 ASSERT(document().lifecycle().state() == DocumentLifecycle::InPaintForSlimmi ngPaintV2); | |
1241 | |
1242 m_bitfields.setSelfNeedsRepaint(false); | |
1243 | |
1244 if (!m_bitfields.childNeedsRepaint()) | |
1245 return; | |
1246 | |
1247 clearRepaintFlagsOfSubtrees(); | |
1248 m_bitfields.setChildNeedsRepaint(false); | |
1249 } | |
1250 | |
1251 void LayoutObject::clearRepaintFlagsOfSubtrees() | |
1252 { | |
1253 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
1254 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { | |
1255 if (!child->isOutOfFlowPositioned()) | |
1256 child->clearRepaintFlagsRecursively(); | |
1257 } | |
1258 } | |
1259 | |
1188 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const | 1260 LayoutRect LayoutObject::boundsRectForPaintInvalidation(const LayoutBoxModelObje ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS tate) const |
1189 { | 1261 { |
1190 if (!paintInvalidationContainer) | 1262 if (!paintInvalidationContainer) |
1191 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); | 1263 return computePaintInvalidationRect(paintInvalidationContainer, paintInv alidationState); |
1192 return DeprecatedPaintLayer::computePaintInvalidationRect(this, paintInvalid ationContainer->layer(), paintInvalidationState); | 1264 return DeprecatedPaintLayer::computePaintInvalidationRect(this, paintInvalid ationContainer->layer(), paintInvalidationState); |
1193 } | 1265 } |
1194 | 1266 |
1195 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& r) const | 1267 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& r) |
1196 { | 1268 { |
1197 RELEASE_ASSERT(isRooted()); | 1269 RELEASE_ASSERT(isRooted()); |
1198 | 1270 |
1199 if (r.isEmpty()) | 1271 if (r.isEmpty()) |
1200 return nullptr; | 1272 return nullptr; |
1201 | 1273 |
1202 if (view()->document().printing()) | 1274 if (view()->document().printing()) |
1203 return nullptr; // Don't invalidate paints if we're printing. | 1275 return nullptr; // Don't invalidate paints if we're printing. |
1204 | 1276 |
1205 LayoutRect dirtyRect(r); | 1277 LayoutRect dirtyRect(r); |
1206 | 1278 |
1207 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree(); | 1279 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree(); |
1208 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalida tionContainer, dirtyRect); | 1280 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalida tionContainer, dirtyRect); |
1209 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); | 1281 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); |
1210 return &paintInvalidationContainer; | 1282 return &paintInvalidationContainer; |
1211 } | 1283 } |
1212 | 1284 |
1213 void LayoutObject::invalidatePaintRectangle(const LayoutRect& r) const | 1285 void LayoutObject::invalidatePaintRectangle(const LayoutRect& r) |
1214 { | 1286 { |
1215 if (const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaint RectangleInternal(r)) { | 1287 if (const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaint RectangleInternal(r)) { |
1216 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 1288 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
1217 invalidateDisplayItemClients(*paintInvalidationContainer); | 1289 invalidateDisplayItemClients(*paintInvalidationContainer); |
1218 } | 1290 } |
1219 } | 1291 } |
1220 | 1292 |
1221 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) | 1293 void LayoutObject::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidat ionState) |
1222 { | 1294 { |
1223 ASSERT(!needsLayout()); | 1295 ASSERT(!needsLayout()); |
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3266 | 3338 |
3267 // If a paint invalidation container is not a stacking context, | 3339 // If a paint invalidation container is not a stacking context, |
3268 // some of its descendants may belong to the parent container. | 3340 // some of its descendants may belong to the parent container. |
3269 findNonCompositedDescendantLayerToTraverse(*descendant, functor); | 3341 findNonCompositedDescendantLayerToTraverse(*descendant, functor); |
3270 descendant = descendant->nextInPreOrderAfterChildren(&object); | 3342 descendant = descendant->nextInPreOrderAfterChildren(&object); |
3271 } | 3343 } |
3272 } | 3344 } |
3273 | 3345 |
3274 } // unnamed namespace | 3346 } // unnamed namespace |
3275 | 3347 |
3276 void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(con st LayoutObject& object) const | 3348 void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(Lay outObject& object) |
3277 { | 3349 { |
3278 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 3350 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
3279 | 3351 |
3280 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. | 3352 // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree. |
3281 const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer(); | 3353 const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer(); |
3282 if (!enclosingLayer) | 3354 if (!enclosingLayer) |
3283 return; | 3355 return; |
3284 | 3356 |
3285 // This is valid because we want to invalidate the client in the display ite m list of the current backing. | 3357 // This is valid because we want to invalidate the client in the display ite m list of the current backing. |
3286 DisableCompositingQueryAsserts disabler; | 3358 DisableCompositingQueryAsserts disabler; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3384 const blink::LayoutObject* root = object1; | 3456 const blink::LayoutObject* root = object1; |
3385 while (root->parent()) | 3457 while (root->parent()) |
3386 root = root->parent(); | 3458 root = root->parent(); |
3387 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3459 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3388 } else { | 3460 } else { |
3389 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3461 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3390 } | 3462 } |
3391 } | 3463 } |
3392 | 3464 |
3393 #endif | 3465 #endif |
OLD | NEW |