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

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

Issue 1161913002: Remove outdated FIXME (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add comments Created 5 years, 6 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 | « Source/core/layout/LayoutObject.h ('k') | Source/core/layout/LayoutObjectChildList.cpp » ('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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 void LayoutObject::paint(const PaintInfo&, const LayoutPoint&) 1038 void LayoutObject::paint(const PaintInfo&, const LayoutPoint&)
1039 { 1039 {
1040 } 1040 }
1041 1041
1042 const LayoutBoxModelObject* LayoutObject::containerForPaintInvalidation() const 1042 const LayoutBoxModelObject* LayoutObject::containerForPaintInvalidation() const
1043 { 1043 {
1044 RELEASE_ASSERT(isRooted()); 1044 RELEASE_ASSERT(isRooted());
1045 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta iner()); 1045 return adjustCompositedContainerForSpecialAncestors(enclosingCompositedConta iner());
1046 } 1046 }
1047 1047
1048 const LayoutBoxModelObject& LayoutObject::containerForPaintInvalidationOnRootedT ree() const
1049 {
1050 RELEASE_ASSERT(isRooted());
1051
1052 const LayoutBoxModelObject* paintInvalidationContainer = containerForPaintIn validation();
1053 ASSERT(paintInvalidationContainer);
1054
1055 return *paintInvalidationContainer;
1056 }
1057
1048 const LayoutBoxModelObject* LayoutObject::enclosingCompositedContainer() const 1058 const LayoutBoxModelObject* LayoutObject::enclosingCompositedContainer() const
1049 { 1059 {
1050 LayoutBoxModelObject* container = 0; 1060 LayoutBoxModelObject* container = 0;
1051 // FIXME: CompositingState is not necessarily up to date for many callers of this function. 1061 // FIXME: CompositingState is not necessarily up to date for many callers of this function.
1052 DisableCompositingQueryAsserts disabler; 1062 DisableCompositingQueryAsserts disabler;
1053 1063
1054 if (DeprecatedPaintLayer* compositingLayer = enclosingLayer()->enclosingLaye rForPaintInvalidationCrossingFrameBoundaries()) 1064 if (DeprecatedPaintLayer* compositingLayer = enclosingLayer()->enclosingLaye rForPaintInvalidationCrossingFrameBoundaries())
1055 container = compositingLayer->layoutObject(); 1065 container = compositingLayer->layoutObject();
1056 return container; 1066 return container;
1057 } 1067 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 addJsonObjectForRect(value.get(), "rect", rect); 1143 addJsonObjectForRect(value.get(), "rect", rect);
1134 value->setString("invalidation_reason", invalidationReason); 1144 value->setString("invalidation_reason", invalidationReason);
1135 return value; 1145 return value;
1136 } 1146 }
1137 1147
1138 LayoutRect LayoutObject::computePaintInvalidationRect(const LayoutBoxModelObject * paintInvalidationContainer, const PaintInvalidationState* paintInvalidationSta te) const 1148 LayoutRect LayoutObject::computePaintInvalidationRect(const LayoutBoxModelObject * paintInvalidationContainer, const PaintInvalidationState* paintInvalidationSta te) const
1139 { 1149 {
1140 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, p aintInvalidationState); 1150 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, p aintInvalidationState);
1141 } 1151 }
1142 1152
1143 void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject* pai ntInvalidationContainer, const LayoutRect& r, PaintInvalidationReason invalidati onReason) const 1153 void LayoutObject::invalidatePaintUsingContainer(const LayoutBoxModelObject& pai ntInvalidationContainer, const LayoutRect& r, PaintInvalidationReason invalidati onReason) const
1144 { 1154 {
1145 ASSERT(gDisablePaintInvalidationStateAsserts || document().lifecycle().state () == DocumentLifecycle::InPaintInvalidation); 1155 ASSERT(gDisablePaintInvalidationStateAsserts || document().lifecycle().state () == DocumentLifecycle::InPaintInvalidation);
1146 1156
1147 if (r.isEmpty()) 1157 if (r.isEmpty())
1148 return; 1158 return;
1149 1159
1150 RELEASE_ASSERT(isRooted()); 1160 RELEASE_ASSERT(isRooted());
1151 1161
1152 // FIXME: Unify "devtools.timeline.invalidationTracking" and "blink.invalida tion". crbug.com/413527. 1162 // FIXME: Unify "devtools.timeline.invalidationTracking" and "blink.invalida tion". crbug.com/413527.
1153 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidati onTracking"), 1163 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidati onTracking"),
1154 "PaintInvalidationTracking", 1164 "PaintInvalidationTracking",
1155 TRACE_EVENT_SCOPE_THREAD, 1165 TRACE_EVENT_SCOPE_THREAD,
1156 "data", InspectorPaintInvalidationTrackingEvent::data(this, paintInvalid ationContainer)); 1166 "data", InspectorPaintInvalidationTrackingEvent::data(this, paintInvalid ationContainer));
1157 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()", 1167 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintUsingContainer()",
1158 "object", this->debugName().ascii(), 1168 "object", this->debugName().ascii(),
1159 "info", jsonObjectForPaintInvalidationInfo(r, paintInvalidationReasonToS tring(invalidationReason))); 1169 "info", jsonObjectForPaintInvalidationInfo(r, paintInvalidationReasonToS tring(invalidationReason)));
1160 1170
1161 if (paintInvalidationContainer->isLayoutView()) { 1171 if (paintInvalidationContainer.isLayoutView()) {
1162 toLayoutView(paintInvalidationContainer)->invalidatePaintForRectangle(r, invalidationReason); 1172 toLayoutView(&paintInvalidationContainer)->invalidatePaintForRectangle(r , invalidationReason);
1163 return; 1173 return;
1164 } 1174 }
1165 1175
1166 if (paintInvalidationContainer->view()->usesCompositing()) { 1176 if (paintInvalidationContainer.view()->usesCompositing()) {
1167 ASSERT(paintInvalidationContainer->isPaintInvalidationContainer()); 1177 ASSERT(paintInvalidationContainer.isPaintInvalidationContainer());
1168 paintInvalidationContainer->setBackingNeedsPaintInvalidationInRect(r, in validationReason); 1178 paintInvalidationContainer.setBackingNeedsPaintInvalidationInRect(r, inv alidationReason);
1169 } 1179 }
1170 } 1180 }
1171 1181
1172 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const 1182 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& d isplayItemClient) const
1173 { 1183 {
1174 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) 1184 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
1175 return; 1185 return;
1176 1186
1177 // 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.
1178 if (const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer()) { 1188 if (const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer()) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 RELEASE_ASSERT(isRooted()); 1233 RELEASE_ASSERT(isRooted());
1224 1234
1225 if (r.isEmpty()) 1235 if (r.isEmpty())
1226 return nullptr; 1236 return nullptr;
1227 1237
1228 if (view()->document().printing()) 1238 if (view()->document().printing())
1229 return nullptr; // Don't invalidate paints if we're printing. 1239 return nullptr; // Don't invalidate paints if we're printing.
1230 1240
1231 LayoutRect dirtyRect(r); 1241 LayoutRect dirtyRect(r);
1232 1242
1233 const LayoutBoxModelObject* paintInvalidationContainer = containerForPaintIn validation(); 1243 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree();
1234 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, paintInvalidat ionContainer, dirtyRect); 1244 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalida tionContainer, dirtyRect);
1235 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle); 1245 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintIn validationRectangle);
1236 return paintInvalidationContainer; 1246 return &paintInvalidationContainer;
1237 } 1247 }
1238 1248
1239 void LayoutObject::invalidatePaintRectangle(const LayoutRect& r) const 1249 void LayoutObject::invalidatePaintRectangle(const LayoutRect& r) const
1240 { 1250 {
1241 if (const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaint RectangleInternal(r)) { 1251 if (const LayoutBoxModelObject* paintInvalidationContainer = invalidatePaint RectangleInternal(r)) {
1242 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) 1252 if (RuntimeEnabledFeatures::slimmingPaintEnabled())
1243 invalidateDisplayItemClients(*paintInvalidationContainer); 1253 invalidateDisplayItemClients(*paintInvalidationContainer);
1244 } 1254 }
1245 } 1255 }
1246 1256
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 1432
1423 return PaintInvalidationIncremental; 1433 return PaintInvalidationIncremental;
1424 } 1434 }
1425 1435
1426 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds , const LayoutPoint& positionFromPaintInvalidationBacking) 1436 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds , const LayoutPoint& positionFromPaintInvalidationBacking)
1427 { 1437 {
1428 ASSERT(oldBounds.location() == newBounds.location()); 1438 ASSERT(oldBounds.location() == newBounds.location());
1429 1439
1430 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); 1440 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
1431 if (deltaRight > 0) 1441 if (deltaRight > 0)
1432 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), PaintInvalidatio nIncremental); 1442 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(old Bounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), PaintInvalidation Incremental);
1433 else if (deltaRight < 0) 1443 else if (deltaRight < 0)
1434 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), PaintInvalidati onIncremental); 1444 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(new Bounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), PaintInvalidatio nIncremental);
1435 1445
1436 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); 1446 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
1437 if (deltaBottom > 0) 1447 if (deltaBottom > 0)
1438 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), PaintInvalidatio nIncremental); 1448 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(new Bounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), PaintInvalidation Incremental);
1439 else if (deltaBottom < 0) 1449 else if (deltaBottom < 0)
1440 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), PaintInvalidati onIncremental); 1450 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(old Bounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), PaintInvalidatio nIncremental);
1441 } 1451 }
1442 1452
1443 void LayoutObject::fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalid ationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& ol dBounds, const LayoutRect& newBounds) 1453 void LayoutObject::fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalid ationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& ol dBounds, const LayoutRect& newBounds)
1444 { 1454 {
1445 // Otherwise do full paint invalidation. 1455 // Otherwise do full paint invalidation.
1446 invalidatePaintUsingContainer(&paintInvalidationContainer, oldBounds, invali dationReason); 1456 invalidatePaintUsingContainer(paintInvalidationContainer, oldBounds, invalid ationReason);
1447 if (newBounds != oldBounds) 1457 if (newBounds != oldBounds)
1448 invalidatePaintUsingContainer(&paintInvalidationContainer, newBounds, in validationReason); 1458 invalidatePaintUsingContainer(paintInvalidationContainer, newBounds, inv alidationReason);
1449 } 1459 }
1450 1460
1451 void LayoutObject::invalidatePaintForOverflow() 1461 void LayoutObject::invalidatePaintForOverflow()
1452 { 1462 {
1453 } 1463 }
1454 1464
1455 void LayoutObject::invalidatePaintForOverflowIfNeeded() 1465 void LayoutObject::invalidatePaintForOverflowIfNeeded()
1456 { 1466 {
1457 if (shouldInvalidateOverflowForPaint()) 1467 if (shouldInvalidateOverflowForPaint())
1458 invalidatePaintForOverflow(); 1468 invalidatePaintForOverflow();
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 { 2158 {
2149 TransformState transformState(TransformState::ApplyTransformDirection, local Point); 2159 TransformState transformState(TransformState::ApplyTransformDirection, local Point);
2150 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms, wasFixed, paintInvalidationState); 2160 mapLocalToContainer(paintInvalidationContainer, transformState, mode | Apply ContainerFlip | UseTransforms, wasFixed, paintInvalidationState);
2151 transformState.flatten(); 2161 transformState.flatten();
2152 2162
2153 return transformState.lastPlanarPoint(); 2163 return transformState.lastPlanarPoint();
2154 } 2164 }
2155 2165
2156 FloatPoint LayoutObject::localToInvalidationBackingPoint(const LayoutPoint& loca lPoint, DeprecatedPaintLayer** backingLayer) 2166 FloatPoint LayoutObject::localToInvalidationBackingPoint(const LayoutPoint& loca lPoint, DeprecatedPaintLayer** backingLayer)
2157 { 2167 {
2158 const LayoutBoxModelObject* paintInvalidationContainer = containerForPaintIn validation(); 2168 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validationOnRootedTree();
2159 ASSERT(paintInvalidationContainer); 2169 ASSERT(paintInvalidationContainer.layer());
2160 ASSERT(paintInvalidationContainer->layer());
2161 2170
2162 if (backingLayer) 2171 if (backingLayer)
2163 *backingLayer = paintInvalidationContainer->layer(); 2172 *backingLayer = paintInvalidationContainer.layer();
2164 FloatPoint containerPoint = localToContainerPoint(FloatPoint(localPoint), pa intInvalidationContainer, TraverseDocumentBoundaries); 2173 FloatPoint containerPoint = localToContainerPoint(FloatPoint(localPoint), &p aintInvalidationContainer, TraverseDocumentBoundaries);
2165 2174
2166 // A layoutObject can have no invalidation backing if it is from a detached frame, 2175 // A layoutObject can have no invalidation backing if it is from a detached frame,
2167 // or when forced compositing is disabled. 2176 // or when forced compositing is disabled.
2168 if (paintInvalidationContainer->layer()->compositingState() == NotComposited ) 2177 if (paintInvalidationContainer.layer()->compositingState() == NotComposited)
2169 return containerPoint; 2178 return containerPoint;
2170 2179
2171 DeprecatedPaintLayer::mapPointToPaintBackingCoordinates(paintInvalidationCon tainer, containerPoint); 2180 DeprecatedPaintLayer::mapPointToPaintBackingCoordinates(&paintInvalidationCo ntainer, containerPoint);
2172 return containerPoint; 2181 return containerPoint;
2173 } 2182 }
2174 2183
2175 LayoutSize LayoutObject::offsetFromContainer(const LayoutObject* o, const Layout Point& point, bool* offsetDependsOnPoint) const 2184 LayoutSize LayoutObject::offsetFromContainer(const LayoutObject* o, const Layout Point& point, bool* offsetDependsOnPoint) const
2176 { 2185 {
2177 ASSERT(o == container()); 2186 ASSERT(o == container());
2178 2187
2179 LayoutSize offset = o->columnOffset(point); 2188 LayoutSize offset = o->columnOffset(point);
2180 2189
2181 if (o->hasOverflowClip()) 2190 if (o->hasOverflowClip())
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
3246 } 3255 }
3247 3256
3248 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() 3257 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts()
3249 : m_disabler(gDisablePaintInvalidationStateAsserts, true) 3258 : m_disabler(gDisablePaintInvalidationStateAsserts, true)
3250 { 3259 {
3251 } 3260 }
3252 3261
3253 // Since we're only painting non-composited layers, we know that they all share the same paintInvalidationContainer. 3262 // Since we're only painting non-composited layers, we know that they all share the same paintInvalidationContainer.
3254 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() 3263 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
3255 { 3264 {
3256 invalidatePaintIncludingNonCompositingDescendantsInternal(containerForPaintI nvalidation()); 3265 invalidatePaintIncludingNonCompositingDescendantsInternal(containerForPaintI nvalidationOnRootedTree());
3257 } 3266 }
3258 3267
3259 void LayoutObject::invalidatePaintIncludingNonCompositingDescendantsInternal(con st LayoutBoxModelObject* paintInvalidationContainer) 3268 void LayoutObject::invalidatePaintIncludingNonCompositingDescendantsInternal(con st LayoutBoxModelObject& paintInvalidationContainer)
3260 { 3269 {
3261 invalidatePaintUsingContainer(paintInvalidationContainer, previousPaintInval idationRect(), PaintInvalidationLayer); 3270 invalidatePaintUsingContainer(paintInvalidationContainer, previousPaintInval idationRect(), PaintInvalidationLayer);
3262 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) 3271 if (RuntimeEnabledFeatures::slimmingPaintEnabled())
3263 invalidateDisplayItemClients(*paintInvalidationContainer); 3272 invalidateDisplayItemClients(paintInvalidationContainer);
3264 3273
3265 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { 3274 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
3266 if (!child->isPaintInvalidationContainer()) 3275 if (!child->isPaintInvalidationContainer())
3267 child->invalidatePaintIncludingNonCompositingDescendantsInternal(pai ntInvalidationContainer); 3276 child->invalidatePaintIncludingNonCompositingDescendantsInternal(pai ntInvalidationContainer);
3268 } 3277 }
3269 } 3278 }
3270 3279
3271 3280
3272 } // namespace blink 3281 } // namespace blink
3273 3282
(...skipping 26 matching lines...) Expand all
3300 const blink::LayoutObject* root = object1; 3309 const blink::LayoutObject* root = object1;
3301 while (root->parent()) 3310 while (root->parent())
3302 root = root->parent(); 3311 root = root->parent();
3303 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3312 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3304 } else { 3313 } else {
3305 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3314 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3306 } 3315 }
3307 } 3316 }
3308 3317
3309 #endif 3318 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutObject.h ('k') | Source/core/layout/LayoutObjectChildList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698