Changeset 90882 in webkit
- Timestamp:
- Jul 12, 2011 8:30:36 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90874 r90882 1 2011-07-12 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Make RenderObject::containingBlock virtual for better speed and clarity 4 https://bugs.webkit.org/show_bug.cgi?id=64318 5 6 Reviewed by Darin Adler. 7 8 No new tests, performance refactoring. 9 10 On some of my test cases, this method takes between 3 and 5% of the time spend. 11 The method makes 2 calls to virtual methods which could be moved to their overriden 12 version of containingBlock if we made it virtual. 13 14 That's what this patch does. It saves between 1 and 2% on some synthetic test cases 15 as well as made the current method shorter. 16 17 * rendering/RenderObject.cpp: 18 (WebCore::RenderObject::containingBlock): Removed code for RenderView and RenderTableCell, 19 replaced by ASSERTs. 20 21 * rendering/RenderObject.h: Made containingBlock virtual. 22 23 * rendering/RenderTableCell.h: 24 (WebCore::RenderTableCell::containingBlock): 25 * rendering/RenderView.h: 26 (WebCore::RenderView::containingBlock): 27 The code moved from RenderObject is inlined in those 2 methods. 28 1 29 2011-07-12 James Robinson <jamesr@chromium.org> 2 30 -
trunk/Source/WebCore/rendering/RenderObject.cpp
r90734 r90882 601 601 RenderBlock* RenderObject::containingBlock() const 602 602 { 603 if (isTableCell()) { 604 const RenderTableCell* cell = toRenderTableCell(this); 605 if (parent() && cell->section()) 606 return cell->table(); 607 return 0; 608 } 609 610 if (isRenderView()) 611 return const_cast<RenderView*>(toRenderView(this)); 603 ASSERT(!isTableCell()); 604 ASSERT(!isRenderView()); 612 605 613 606 RenderObject* o = parent(); -
trunk/Source/WebCore/rendering/RenderObject.h
r90833 r90882 572 572 573 573 // returns the containing block level element for this element. 574 RenderBlock* containingBlock() const;574 virtual RenderBlock* containingBlock() const; 575 575 576 576 // Convert the given local point to absolute coordinates -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r90675 r90882 320 320 } 321 321 322 RenderBlock* RenderTableCell::containingBlock() const 323 { 324 if (parent() && section()) 325 return table(); 326 return 0; 327 } 328 322 329 // The following rules apply for resolving conflicts and figuring out which border 323 330 // to use. -
trunk/Source/WebCore/rendering/RenderTableCell.h
r90675 r90882 138 138 virtual bool isTableCell() const { return true; } 139 139 140 virtual RenderBlock* containingBlock() const; 141 140 142 virtual void willBeDestroyed(); 141 143 -
trunk/Source/WebCore/rendering/RenderView.cpp
r90734 r90882 258 258 } 259 259 260 RenderBlock* RenderView::containingBlock() const 261 { 262 return const_cast<RenderView*>(this); 263 } 264 260 265 void RenderView::repaintViewRectangle(const IntRect& ur, bool immediate) 261 266 { -
trunk/Source/WebCore/rendering/RenderView.h
r90734 r90882 171 171 bool shouldRepaint(const IntRect& r) const; 172 172 173 virtual RenderBlock* containingBlock() const; 174 173 175 // These functions may only be accessed by LayoutStateMaintainer. 174 176 bool pushLayoutState(RenderBox* renderer, const IntSize& offset, int pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0)
Note: See TracChangeset
for help on using the changeset viewer.