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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2465983002: Rename "paint invalidation rect" etc. to "visual rect". (Closed)
Patch Set: - Created 4 years, 1 month 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) 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. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 struct SameSizeAsLayoutObject : DisplayItemClient { 120 struct SameSizeAsLayoutObject : DisplayItemClient {
121 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer. 121 virtual ~SameSizeAsLayoutObject() {} // Allocate vtable pointer.
122 void* pointers[5]; 122 void* pointers[5];
123 Member<void*> members[1]; 123 Member<void*> members[1];
124 #if ENABLE(ASSERT) 124 #if ENABLE(ASSERT)
125 unsigned m_debugBitfields : 2; 125 unsigned m_debugBitfields : 2;
126 #endif 126 #endif
127 unsigned m_bitfields; 127 unsigned m_bitfields;
128 unsigned m_bitfields2; 128 unsigned m_bitfields2;
129 LayoutRect rect; // Stores the previous paint invalidation rect. 129 LayoutRect m_previousVisualRect;
130 LayoutPoint position; // Stores the previous position from the paint 130 LayoutPoint m_previousPosition;
131 // invalidation container.
132 }; 131 };
133 132
134 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject), 133 static_assert(sizeof(LayoutObject) == sizeof(SameSizeAsLayoutObject),
135 "LayoutObject should stay small"); 134 "LayoutObject should stay small");
136 135
137 bool LayoutObject::s_affectsParentBlock = false; 136 bool LayoutObject::s_affectsParentBlock = false;
138 137
139 // The pointer to paint properties is implemented as a global hash map 138 // The pointer to paint properties is implemented as a global hash map
140 // temporarily, to avoid memory regression during the transition towards SPv2. 139 // temporarily, to avoid memory regression during the transition towards SPv2.
141 typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>> 140 typedef HashMap<const LayoutObject*, std::unique_ptr<ObjectPaintProperties>>
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 name.append(decoratedName()); 1087 name.append(decoratedName());
1089 1088
1090 if (const Node* node = this->node()) { 1089 if (const Node* node = this->node()) {
1091 name.append(' '); 1090 name.append(' ');
1092 name.append(node->debugName()); 1091 name.append(node->debugName());
1093 } 1092 }
1094 return name.toString(); 1093 return name.toString();
1095 } 1094 }
1096 1095
1097 LayoutRect LayoutObject::visualRect() const { 1096 LayoutRect LayoutObject::visualRect() const {
1098 return previousPaintInvalidationRect(); 1097 return previousVisualRect();
1099 } 1098 }
1100 1099
1101 bool LayoutObject::isPaintInvalidationContainer() const { 1100 bool LayoutObject::isPaintInvalidationContainer() const {
1102 return hasLayer() && 1101 return hasLayer() &&
1103 toLayoutBoxModelObject(this)->layer()->isPaintInvalidationContainer(); 1102 toLayoutBoxModelObject(this)->layer()->isPaintInvalidationContainer();
1104 } 1103 }
1105 1104
1106 void LayoutObject::invalidateDisplayItemClients( 1105 void LayoutObject::invalidateDisplayItemClients(
1107 PaintInvalidationReason reason) const { 1106 PaintInvalidationReason reason) const {
1108 // This default implementation invalidates only the object itself as a 1107 // This default implementation invalidates only the object itself as a
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 LayoutView* v = view(); 1197 LayoutView* v = view();
1199 if (v->document().printing()) 1198 if (v->document().printing())
1200 return PaintInvalidationNone; // Don't invalidate paints if we're printing. 1199 return PaintInvalidationNone; // Don't invalidate paints if we're printing.
1201 1200
1202 PaintInvalidatorContextAdapter context(paintInvalidationState); 1201 PaintInvalidatorContextAdapter context(paintInvalidationState);
1203 1202
1204 const LayoutBoxModelObject& paintInvalidationContainer = 1203 const LayoutBoxModelObject& paintInvalidationContainer =
1205 paintInvalidationState.paintInvalidationContainer(); 1204 paintInvalidationState.paintInvalidationContainer();
1206 DCHECK(paintInvalidationContainer == containerForPaintInvalidation()); 1205 DCHECK(paintInvalidationContainer == containerForPaintInvalidation());
1207 1206
1208 context.oldBounds = previousPaintInvalidationRect(); 1207 context.oldVisualRect = previousVisualRect();
1209 context.oldLocation = previousPositionFromPaintInvalidationBacking(); 1208 context.oldLocation = previousPositionFromPaintInvalidationBacking();
1210 context.newBounds = 1209 context.newVisualRect = paintInvalidationState.computeVisualRectInBacking();
1211 paintInvalidationState.computePaintInvalidationRectInBacking();
1212 context.newLocation = 1210 context.newLocation =
1213 paintInvalidationState.computePositionFromPaintInvalidationBacking(); 1211 paintInvalidationState.computePositionFromPaintInvalidationBacking();
1214 1212
1215 IntSize adjustment = 1213 IntSize adjustment =
1216 scrollAdjustmentForPaintInvalidation(paintInvalidationContainer); 1214 scrollAdjustmentForPaintInvalidation(paintInvalidationContainer);
1217 context.newLocation.move(adjustment); 1215 context.newLocation.move(adjustment);
1218 context.newBounds.move(adjustment); 1216 context.newVisualRect.move(adjustment);
1219 1217
1220 adjustVisualRectForRasterEffects(context.newBounds); 1218 adjustVisualRectForRasterEffects(context.newVisualRect);
1221 1219
1222 setPreviousPaintInvalidationRect(context.newBounds); 1220 setPreviousVisualRect(context.newVisualRect);
1223 setPreviousPositionFromPaintInvalidationBacking(context.newLocation); 1221 setPreviousPositionFromPaintInvalidationBacking(context.newLocation);
1224 1222
1225 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() && 1223 if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() &&
1226 paintInvalidationState 1224 paintInvalidationState
1227 .forcedSubtreeInvalidationRectUpdateWithinContainerOnly()) { 1225 .forcedSubtreeInvalidationRectUpdateWithinContainerOnly()) {
1228 // We are done updating the paint invalidation rect. No other paint 1226 // We are done updating the visual rect. No other paint invalidation work
1229 // invalidation work to do for this object. 1227 // to do for this object.
1230 return PaintInvalidationNone; 1228 return PaintInvalidationNone;
1231 } 1229 }
1232 1230
1233 return invalidatePaintIfNeeded(context); 1231 return invalidatePaintIfNeeded(context);
1234 } 1232 }
1235 1233
1236 DISABLE_CFI_PERF 1234 DISABLE_CFI_PERF
1237 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded( 1235 PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(
1238 const PaintInvalidatorContext& context) const { 1236 const PaintInvalidatorContext& context) const {
1239 return ObjectPaintInvalidatorWithContext(*this, context) 1237 return ObjectPaintInvalidatorWithContext(*this, context)
1240 .invalidatePaintIfNeeded(); 1238 .invalidatePaintIfNeeded();
1241 } 1239 }
1242 1240
1243 void LayoutObject::adjustInvalidationRectForCompositedScrolling( 1241 void LayoutObject::adjustVisualRectForCompositedScrolling(
1244 LayoutRect& rect, 1242 LayoutRect& rect,
1245 const LayoutBoxModelObject& paintInvalidationContainer) const { 1243 const LayoutBoxModelObject& paintInvalidationContainer) const {
1246 if (compositedScrollsWithRespectTo(paintInvalidationContainer)) { 1244 if (compositedScrollsWithRespectTo(paintInvalidationContainer)) {
1247 LayoutSize offset( 1245 LayoutSize offset(
1248 -toLayoutBox(&paintInvalidationContainer)->scrolledContentOffset()); 1246 -toLayoutBox(&paintInvalidationContainer)->scrolledContentOffset());
1249 rect.move(offset); 1247 rect.move(offset);
1250 } 1248 }
1251 } 1249 }
1252 1250
1253 LayoutRect 1251 LayoutRect LayoutObject::previousVisualRectIncludingCompositedScrolling(
1254 LayoutObject::previousPaintInvalidationRectIncludingCompositedScrolling(
1255 const LayoutBoxModelObject& paintInvalidationContainer) const { 1252 const LayoutBoxModelObject& paintInvalidationContainer) const {
1256 LayoutRect invalidationRect = previousPaintInvalidationRect(); 1253 LayoutRect rect = previousVisualRect();
1257 adjustInvalidationRectForCompositedScrolling(invalidationRect, 1254 adjustVisualRectForCompositedScrolling(rect, paintInvalidationContainer);
1258 paintInvalidationContainer); 1255 return rect;
1259 return invalidationRect;
1260 } 1256 }
1261 1257
1262 void LayoutObject::adjustPreviousPaintInvalidationForScrollIfNeeded( 1258 void LayoutObject::adjustPreviousPaintInvalidationForScrollIfNeeded(
1263 const DoubleSize& scrollDelta) { 1259 const DoubleSize& scrollDelta) {
1264 if (containerForPaintInvalidation().usesCompositedScrolling()) 1260 if (containerForPaintInvalidation().usesCompositedScrolling())
1265 return; 1261 return;
1266 m_previousPaintInvalidationRect.move(LayoutSize(scrollDelta)); 1262 m_previousVisualRect.move(LayoutSize(scrollDelta));
1267 } 1263 }
1268 1264
1269 void LayoutObject::clearPreviousPaintInvalidationRects() { 1265 void LayoutObject::clearPreviousVisualRects() {
1270 setPreviousPaintInvalidationRect(LayoutRect()); 1266 setPreviousVisualRect(LayoutRect());
1271 // After clearing ("invalidating" the paint invalidation rects, mark this 1267 // After clearing ("invalidating" the visual rects, mark this object as
1272 // object as needing to re-compute them. 1268 // needing to re-compute them.
1273 setShouldDoFullPaintInvalidation(); 1269 setShouldDoFullPaintInvalidation();
1274 } 1270 }
1275 1271
1276 LayoutRect LayoutObject::absoluteClippedOverflowRect() const { 1272 LayoutRect LayoutObject::absoluteVisualRect() const {
1277 LayoutRect rect = localOverflowRectForPaintInvalidation(); 1273 LayoutRect rect = localVisualRect();
1278 mapToVisualRectInAncestorSpace(view(), rect); 1274 mapToVisualRectInAncestorSpace(view(), rect);
1279 return rect; 1275 return rect;
1280 } 1276 }
1281 1277
1282 LayoutRect LayoutObject::localOverflowRectForPaintInvalidation() const { 1278 LayoutRect LayoutObject::localVisualRect() const {
1283 ASSERT_NOT_REACHED(); 1279 NOTREACHED();
1284 return LayoutRect(); 1280 return LayoutRect();
1285 } 1281 }
1286 1282
1287 bool LayoutObject::mapToVisualRectInAncestorSpace( 1283 bool LayoutObject::mapToVisualRectInAncestorSpace(
1288 const LayoutBoxModelObject* ancestor, 1284 const LayoutBoxModelObject* ancestor,
1289 LayoutRect& rect, 1285 LayoutRect& rect,
1290 VisualRectFlags visualRectFlags) const { 1286 VisualRectFlags visualRectFlags) const {
1291 // For any layout object that doesn't override this method (the main example 1287 // For any layout object that doesn't override this method (the main example
1292 // is LayoutText), the rect is assumed to be in the parent's coordinate space, 1288 // is LayoutText), the rect is assumed to be in the parent's coordinate space,
1293 // except for container flip. 1289 // except for container flip.
(...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after
3333 const LayoutBlock* containingBlock = this->containingBlock(); 3329 const LayoutBlock* containingBlock = this->containingBlock();
3334 return containingBlock ? !containingBlock->needsLayout() : false; 3330 return containingBlock ? !containingBlock->needsLayout() : false;
3335 } 3331 }
3336 3332
3337 void LayoutObject::setNeedsBoundariesUpdate() { 3333 void LayoutObject::setNeedsBoundariesUpdate() {
3338 if (LayoutObject* layoutObject = parent()) 3334 if (LayoutObject* layoutObject = parent())
3339 layoutObject->setNeedsBoundariesUpdate(); 3335 layoutObject->setNeedsBoundariesUpdate();
3340 } 3336 }
3341 3337
3342 FloatRect LayoutObject::objectBoundingBox() const { 3338 FloatRect LayoutObject::objectBoundingBox() const {
3343 ASSERT_NOT_REACHED(); 3339 NOTREACHED();
3344 return FloatRect(); 3340 return FloatRect();
3345 } 3341 }
3346 3342
3347 FloatRect LayoutObject::strokeBoundingBox() const { 3343 FloatRect LayoutObject::strokeBoundingBox() const {
3348 ASSERT_NOT_REACHED(); 3344 NOTREACHED();
3349 return FloatRect(); 3345 return FloatRect();
3350 } 3346 }
3351 3347
3352 FloatRect LayoutObject::paintInvalidationRectInLocalSVGCoordinates() const { 3348 FloatRect LayoutObject::visualRectInLocalSVGCoordinates() const {
3353 ASSERT_NOT_REACHED(); 3349 NOTREACHED();
3354 return FloatRect(); 3350 return FloatRect();
3355 } 3351 }
3356 3352
3357 AffineTransform LayoutObject::localSVGTransform() const { 3353 AffineTransform LayoutObject::localSVGTransform() const {
3358 static const AffineTransform identity; 3354 static const AffineTransform identity;
3359 return identity; 3355 return identity;
3360 } 3356 }
3361 3357
3362 const AffineTransform& LayoutObject::localToSVGParentTransform() const { 3358 const AffineTransform& LayoutObject::localToSVGParentTransform() const {
3363 static const AffineTransform identity; 3359 static const AffineTransform identity;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3555 const blink::LayoutObject* root = object1; 3551 const blink::LayoutObject* root = object1;
3556 while (root->parent()) 3552 while (root->parent())
3557 root = root->parent(); 3553 root = root->parent();
3558 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3554 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3559 } else { 3555 } else {
3560 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3556 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3561 } 3557 }
3562 } 3558 }
3563 3559
3564 #endif 3560 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698