Changeset 90169 in webkit
- Timestamp:
- Jun 30, 2011 3:15:25 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90167 r90169 1 2011-06-30 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch paintingRootRect and RenderObject repaint methods to new layout types 6 https://bugs.webkit.org/show_bug.cgi?id=63746 7 8 Switching paintingRootRect and RenderObject repaint functions over to the 9 new layout unit abstraction. 10 11 No new tests, no functionality changes. 12 13 * rendering/RenderBox.cpp: 14 (WebCore::RenderBox::repaintDuringLayoutIfMoved): 15 * rendering/RenderBox.h: 16 * rendering/RenderObject.cpp: 17 (WebCore::RenderObject::paintingRootRect): 18 (WebCore::RenderObject::paint): 19 (WebCore::RenderObject::repaintUsingContainer): 20 (WebCore::RenderObject::repaintRectangle): 21 (WebCore::RenderObject::repaintAfterLayoutIfNeeded): 22 (WebCore::RenderObject::repaintDuringLayoutIfMoved): 23 * rendering/RenderObject.h: 24 1 25 2011-06-30 Cary Clark <caryclark@google.com> 2 26 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r90144 r90169 1514 1514 } 1515 1515 1516 void RenderBox::repaintDuringLayoutIfMoved(const IntRect& rect)1517 { 1518 int newX = x();1519 int newY = y();1520 int newWidth = width();1521 int newHeight = height();1516 void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& rect) 1517 { 1518 LayoutUnit newX = x(); 1519 LayoutUnit newY = y(); 1520 LayoutUnit newWidth = width(); 1521 LayoutUnit newHeight = height(); 1522 1522 if (rect.x() != newX || rect.y() != newY) { 1523 1523 // The child moved. Invalidate the object's old and new positions. We have to do this … … 1526 1526 repaint(); 1527 1527 repaintOverhangingFloats(true); 1528 m_frameRect = IntRect(newX, newY, newWidth, newHeight);1528 m_frameRect = LayoutRect(newX, newY, newWidth, newHeight); 1529 1529 repaint(); 1530 1530 repaintOverhangingFloats(true); -
trunk/Source/WebCore/rendering/RenderBox.h
r90144 r90169 284 284 virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false); 285 285 286 virtual void repaintDuringLayoutIfMoved(const IntRect&);286 virtual void repaintDuringLayoutIfMoved(const LayoutRect&); 287 287 288 288 virtual int containingBlockLogicalWidthForContent() const; -
trunk/Source/WebCore/rendering/RenderObject.cpp
r89754 r90169 1137 1137 } 1138 1138 1139 IntRect RenderObject::paintingRootRect(IntRect& topLevelRect)1140 { 1141 IntRect result = absoluteBoundingBoxRect();1139 LayoutRect RenderObject::paintingRootRect(LayoutRect& topLevelRect) 1140 { 1141 LayoutRect result = absoluteBoundingBoxRect(); 1142 1142 topLevelRect = result; 1143 1143 for (RenderObject* current = firstChild(); current; current = current->nextSibling()) … … 1146 1146 } 1147 1147 1148 void RenderObject::paint(PaintInfo&, const IntPoint&)1148 void RenderObject::paint(PaintInfo&, const LayoutPoint&) 1149 1149 { 1150 1150 } … … 1164 1164 } 1165 1165 1166 void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect& r, bool immediate)1166 void RenderObject::repaintUsingContainer(RenderBoxModelObject* repaintContainer, const LayoutRect& r, bool immediate) 1167 1167 { 1168 1168 if (!repaintContainer) { … … 1177 1177 bool viewHasCompositedLayer = v->hasLayer() && v->layer()->isComposited(); 1178 1178 if (!viewHasCompositedLayer || v->layer()->backing()->paintingGoesToWindow()) { 1179 IntRect repaintRectangle = r;1179 LayoutRect repaintRectangle = r; 1180 1180 if (viewHasCompositedLayer && v->layer()->transform()) 1181 1181 repaintRectangle = v->layer()->transform()->mapRect(r); … … 1209 1209 } 1210 1210 1211 void RenderObject::repaintRectangle(const IntRect& r, bool immediate)1211 void RenderObject::repaintRectangle(const LayoutRect& r, bool immediate) 1212 1212 { 1213 1213 // Don't repaint if we're unrooted (note that view() still returns the view when unrooted) … … 1219 1219 return; // Don't repaint if we're printing. 1220 1220 1221 IntRect dirtyRect(r);1221 LayoutRect dirtyRect(r); 1222 1222 1223 1223 // FIXME: layoutDelta needs to be applied in parts before/after transforms and … … 1230 1230 } 1231 1231 1232 bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const IntRect& oldBounds, const IntRect& oldOutlineBox, const IntRect* newBoundsPtr, const IntRect* newOutlineBoxRectPtr)1232 bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr, const LayoutRect* newOutlineBoxRectPtr) 1233 1233 { 1234 1234 RenderView* v = view(); … … 1238 1238 // This ASSERT fails due to animations. See https://bugs.webkit.org/show_bug.cgi?id=37048 1239 1239 // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForRepaint(repaintContainer)); 1240 IntRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectForRepaint(repaintContainer);1241 IntRect newOutlineBox;1240 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectForRepaint(repaintContainer); 1241 LayoutRect newOutlineBox; 1242 1242 1243 1243 bool fullRepaint = selfNeedsLayout(); … … 1266 1266 return false; 1267 1267 1268 int deltaLeft = newBounds.x() - oldBounds.x();1268 LayoutUnit deltaLeft = newBounds.x() - oldBounds.x(); 1269 1269 if (deltaLeft > 0) 1270 repaintUsingContainer(repaintContainer, IntRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()));1270 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height())); 1271 1271 else if (deltaLeft < 0) 1272 repaintUsingContainer(repaintContainer, IntRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()));1273 1274 int deltaRight = newBounds.maxX() - oldBounds.maxX();1272 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height())); 1273 1274 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); 1275 1275 if (deltaRight > 0) 1276 repaintUsingContainer(repaintContainer, IntRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()));1276 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height())); 1277 1277 else if (deltaRight < 0) 1278 repaintUsingContainer(repaintContainer, IntRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()));1279 1280 int deltaTop = newBounds.y() - oldBounds.y();1278 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height())); 1279 1280 LayoutUnit deltaTop = newBounds.y() - oldBounds.y(); 1281 1281 if (deltaTop > 0) 1282 repaintUsingContainer(repaintContainer, IntRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop));1282 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop)); 1283 1283 else if (deltaTop < 0) 1284 repaintUsingContainer(repaintContainer, IntRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop));1285 1286 int deltaBottom = newBounds.maxY() - oldBounds.maxY();1284 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop)); 1285 1286 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); 1287 1287 if (deltaBottom > 0) 1288 repaintUsingContainer(repaintContainer, IntRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom));1288 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom)); 1289 1289 else if (deltaBottom < 0) 1290 repaintUsingContainer(repaintContainer, IntRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom));1290 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom)); 1291 1291 1292 1292 if (newOutlineBox == oldOutlineBox) … … 1296 1296 // two rectangles (but typically only one). 1297 1297 RenderStyle* outlineStyle = outlineStyleForRepaint(); 1298 int ow = outlineStyle->outlineSize();1299 int width = abs(newOutlineBox.width() - oldOutlineBox.width());1298 LayoutUnit ow = outlineStyle->outlineSize(); 1299 LayoutUnit width = abs(newOutlineBox.width() - oldOutlineBox.width()); 1300 1300 if (width) { 1301 int shadowLeft;1302 int shadowRight;1301 LayoutUnit shadowLeft; 1302 LayoutUnit shadowRight; 1303 1303 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); 1304 1304 1305 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;1306 int boxWidth = isBox() ? toRenderBox(this)->width() : 0;1307 int borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight, max(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);1308 IntRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,1305 LayoutUnit borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; 1306 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : 0; 1307 LayoutUnit borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight, max(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight); 1308 LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth, 1309 1309 newOutlineBox.y(), 1310 1310 width + borderWidth, 1311 1311 max(newOutlineBox.height(), oldOutlineBox.height())); 1312 int right = min(newBounds.maxX(), oldBounds.maxX());1312 LayoutUnit right = min(newBounds.maxX(), oldBounds.maxX()); 1313 1313 if (rightRect.x() < right) { 1314 1314 rightRect.setWidth(min(rightRect.width(), right - rightRect.x())); … … 1316 1316 } 1317 1317 } 1318 int height = abs(newOutlineBox.height() - oldOutlineBox.height());1318 LayoutUnit height = abs(newOutlineBox.height() - oldOutlineBox.height()); 1319 1319 if (height) { 1320 int shadowTop;1321 int shadowBottom;1320 LayoutUnit shadowTop; 1321 LayoutUnit shadowBottom; 1322 1322 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); 1323 1323 1324 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;1325 int boxHeight = isBox() ? toRenderBox(this)->height() : 0;1326 int borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom, max(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);1327 IntRect bottomRect(newOutlineBox.x(),1324 LayoutUnit borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; 1325 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : 0; 1326 LayoutUnit borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom, max(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom); 1327 LayoutRect bottomRect(newOutlineBox.x(), 1328 1328 min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - borderHeight, 1329 1329 max(newOutlineBox.width(), oldOutlineBox.width()), 1330 1330 height + borderHeight); 1331 int bottom = min(newBounds.maxY(), oldBounds.maxY());1331 LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY()); 1332 1332 if (bottomRect.y() < bottom) { 1333 1333 bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y())); … … 1338 1338 } 1339 1339 1340 void RenderObject::repaintDuringLayoutIfMoved(const IntRect&)1340 void RenderObject::repaintDuringLayoutIfMoved(const LayoutRect&) 1341 1341 { 1342 1342 } -
trunk/Source/WebCore/rendering/RenderObject.h
r90048 r90169 604 604 605 605 // the rect that will be painted if this object is passed as the paintingRoot 606 IntRect paintingRootRect(IntRect& topLevelRect);606 LayoutRect paintingRootRect(LayoutRect& topLevelRect); 607 607 608 608 virtual int minPreferredLogicalWidth() const { return 0; } … … 630 630 // Actually do the repaint of rect r for this object which has been computed in the coordinate space 631 631 // of repaintContainer. If repaintContainer is 0, repaint via the view. 632 void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const IntRect& r, bool immediate = false);632 void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const LayoutRect&, bool immediate = false); 633 633 634 634 // Repaint the entire object. Called when, e.g., the color of a border changes, or when a border … … 637 637 638 638 // Repaint a specific subrectangle within a given object. The rect |r| is in the object's coordinate space. 639 void repaintRectangle(const IntRect&, bool immediate = false);639 void repaintRectangle(const LayoutRect&, bool immediate = false); 640 640 641 641 // Repaint only if our old bounds and new bounds are different. The caller may pass in newBounds and newOutlineBox if they are known. 642 bool repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const IntRect& oldBounds, const IntRect& oldOutlineBox, const IntRect* newBoundsPtr = 0, const IntRect* newOutlineBoxPtr = 0);642 bool repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr = 0, const LayoutRect* newOutlineBoxPtr = 0); 643 643 644 644 // Repaint only if the object moved. 645 virtual void repaintDuringLayoutIfMoved(const IntRect& rect);645 virtual void repaintDuringLayoutIfMoved(const LayoutRect&); 646 646 647 647 // Called to repaint a block's floats.
Note: See TracChangeset
for help on using the changeset viewer.