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

Side by Side Diff: sky/engine/core/rendering/RenderObject.cpp

Issue 844023003: Delete InvalidationReason. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « sky/engine/core/rendering/RenderObject.h ('k') | sky/engine/core/rendering/RenderView.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 // FIXME(sky): Remove 1233 // FIXME(sky): Remove
1234 void RenderObject::invalidatePaintRectangle(const LayoutRect& r) const 1234 void RenderObject::invalidatePaintRectangle(const LayoutRect& r) const
1235 { 1235 {
1236 } 1236 }
1237 1237
1238 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const 1238 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const
1239 { 1239 {
1240 return pixelSnappedIntRect(absoluteClippedOverflowRect()); 1240 return pixelSnappedIntRect(absoluteClippedOverflowRect());
1241 } 1241 }
1242 1242
1243 const char* RenderObject::invalidationReasonToString(InvalidationReason reason) const
1244 {
1245 switch (reason) {
1246 case InvalidationNone:
1247 return "none";
1248 case InvalidationIncremental:
1249 return "incremental";
1250 case InvalidationFull:
1251 return "full";
1252 case InvalidationBorderBoxChange:
1253 return "border box change";
1254 case InvalidationBoundsChange:
1255 return "bounds change";
1256 case InvalidationLocationChange:
1257 return "location change";
1258 case InvalidationScroll:
1259 return "scroll";
1260 case InvalidationSelection:
1261 return "selection";
1262 case InvalidationLayer:
1263 return "layer";
1264 case InvalidationPaint:
1265 return "invalidate paint";
1266 case InvalidationPaintRectangle:
1267 return "invalidate paint rectangle";
1268 }
1269 ASSERT_NOT_REACHED();
1270 return "";
1271 }
1272
1273 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) 1243 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState)
1274 { 1244 {
1275 // If we didn't need paint invalidation then our children don't need as well . 1245 // If we didn't need paint invalidation then our children don't need as well .
1276 // Skip walking down the tree as everything should be fine below us. 1246 // Skip walking down the tree as everything should be fine below us.
1277 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) 1247 if (!shouldCheckForPaintInvalidation(paintInvalidationState))
1278 return; 1248 return;
1279 1249
1280 clearPaintInvalidationState(paintInvalidationState); 1250 clearPaintInvalidationState(paintInvalidationState);
1281 1251
1282 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { 1252 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
1283 if (!child->isOutOfFlowPositioned()) 1253 if (!child->isOutOfFlowPositioned())
1284 child->invalidateTreeIfNeeded(paintInvalidationState); 1254 child->invalidateTreeIfNeeded(paintInvalidationState);
1285 } 1255 }
1286 } 1256 }
1287 1257
1288 InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod elObject& paintInvalidationContainer,
1289 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec t& newBounds, const LayoutPoint& newLocation)
1290 {
1291 if (shouldDoFullPaintInvalidation())
1292 return InvalidationFull;
1293
1294 if (newLocation != oldLocation)
1295 return InvalidationLocationChange;
1296
1297 // If the bounds are the same then we know that none of the statements below
1298 // can match, so we can early out since we will not need to do any
1299 // invalidation.
1300 if (oldBounds == newBounds)
1301 return InvalidationNone;
1302
1303 // If we shifted, we don't know the exact reason so we are conservative and trigger a full invalidation. Shifting could
1304 // be caused by some layout property (left / top) or some in-flow renderer i nserted / removed before us in the tree.
1305 if (newBounds.location() != oldBounds.location())
1306 return InvalidationBoundsChange;
1307
1308 // If the size is zero on one of our bounds then we know we're going to have
1309 // to do a full invalidation of either old bounds or new bounds. If we fall
1310 // into the incremental invalidation we'll issue two invalidations instead
1311 // of one.
1312 if (oldBounds.size().isZero() || newBounds.size().isZero())
1313 return InvalidationBoundsChange;
1314
1315 // This covers the case where we mark containing blocks for layout
1316 // and they change size but don't have anything to paint. This is
1317 // a pretty common case for <body> as we add / remove children
1318 // (and the default background is done by FrameView).
1319 if (skipInvalidationWhenLaidOutChildren() && !mayNeedPaintInvalidation())
1320 return InvalidationNone;
1321
1322 return InvalidationIncremental;
1323 }
1324
1325 void RenderObject::invalidatePaintForOverflow()
1326 {
1327 }
1328
1329 void RenderObject::invalidatePaintForOverflowIfNeeded()
1330 {
1331 if (shouldInvalidateOverflowForPaint())
1332 invalidatePaintForOverflow();
1333 }
1334
1335 bool RenderObject::checkForPaintInvalidation() const 1258 bool RenderObject::checkForPaintInvalidation() const
1336 { 1259 {
1337 return !document().view()->needsFullPaintInvalidation() && everHadLayout(); 1260 return !document().view()->needsFullPaintInvalidation() && everHadLayout();
1338 } 1261 }
1339 1262
1340 LayoutRect RenderObject::rectWithOutlineForPaintInvalidation(const RenderLayerMo delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval idationState* paintInvalidationState) const 1263 LayoutRect RenderObject::rectWithOutlineForPaintInvalidation(const RenderLayerMo delObject* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInval idationState* paintInvalidationState) const
1341 { 1264 {
1342 LayoutRect r(clippedOverflowRectForPaintInvalidation(paintInvalidationContai ner, paintInvalidationState)); 1265 LayoutRect r(clippedOverflowRectForPaintInvalidation(paintInvalidationContai ner, paintInvalidationState));
1343 r.inflate(outlineWidth); 1266 r.inflate(outlineWidth);
1344 return r; 1267 return r;
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 { 2343 {
2421 if (object1) { 2344 if (object1) {
2422 const blink::RenderObject* root = object1; 2345 const blink::RenderObject* root = object1;
2423 while (root->parent()) 2346 while (root->parent())
2424 root = root->parent(); 2347 root = root->parent();
2425 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 2348 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
2426 } 2349 }
2427 } 2350 }
2428 2351
2429 #endif 2352 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderObject.h ('k') | sky/engine/core/rendering/RenderView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698