Changeset 40771 in webkit
- Timestamp:
- Feb 7, 2009 11:03:43 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r40770 r40771 1 2009-02-07 David Hyatt <hyatt@apple.com> 2 3 Shrink the size of all InlineTextBoxes and all InlineBoxes (for images and replaced elements) by four bytes. 4 Change the overflow variable on InlineFlowBoxes into a short and move the bits for InlineFlowBoxes out of the 5 base InlineBox class. Since the number of bits in the base class was 35, shoving the 3 bits for InlineFlowBoxes 6 back down into that class (into the 16 bits exposed by making the overflow variable into a short), all text 7 boxes and image boxes shrink by 4 bytes. 8 9 Reviewed by Anders 10 11 * rendering/InlineBox.h: 12 (WebCore::InlineBox::InlineBox): 13 * rendering/InlineFlowBox.cpp: 14 (WebCore::InlineFlowBox::placeBoxesHorizontally): 15 (WebCore::InlineFlowBox::computeLogicalBoxHeights): 16 (WebCore::InlineFlowBox::placeBoxesVertically): 17 * rendering/InlineFlowBox.h: 18 (WebCore::InlineFlowBox::InlineFlowBox): 19 (WebCore::InlineFlowBox::maxHorizontalVisualOverflow): 20 (WebCore::InlineFlowBox::hasTextChildren): 21 1 22 2009-02-07 Dean Jackson <dino@apple.com> 2 23 -
trunk/WebCore/rendering/InlineBox.h
r40769 r40771 51 51 , m_dirty(false) 52 52 , m_extracted(false) 53 , m_includeLeftEdge(false)54 , m_includeRightEdge(false)55 , m_hasTextChildren(true)56 53 , m_endsWithBreak(false) 57 54 , m_hasSelectedChildren(false) … … 86 83 , m_dirty(dirty) 87 84 , m_extracted(extracted) 88 , m_includeLeftEdge(false)89 , m_includeRightEdge(false)90 , m_hasTextChildren(true)91 85 , m_endsWithBreak(false) 92 86 , m_hasSelectedChildren(false) … … 205 199 int baseline() const { return m_baseline; } 206 200 207 bool hasTextChildren() const { return m_hasTextChildren; }208 209 201 virtual int topOverflow() { return yPos(); } 210 202 virtual int bottomOverflow() { return yPos() + height(); } … … 274 266 bool m_dirty : 1; 275 267 bool m_extracted : 1; 276 277 // for InlineFlowBox278 bool m_includeLeftEdge : 1;279 bool m_includeRightEdge : 1;280 bool m_hasTextChildren : 1;281 268 282 269 // for RootInlineBox -
trunk/WebCore/rendering/InlineFlowBox.cpp
r40769 r40771 319 319 leftPosition = min(x + visualOverflowLeft, leftPosition); 320 320 rightPosition = max(x + text->width() + visualOverflowRight, rightPosition); 321 m_maxHorizontalVisualOverflow = max(max(visualOverflowRight, -visualOverflowLeft), m_maxHorizontalVisualOverflow);321 m_maxHorizontalVisualOverflow = max(max(visualOverflowRight, -visualOverflowLeft), (int)m_maxHorizontalVisualOverflow); 322 322 x += text->width(); 323 323 } else { … … 446 446 continue; // Positioned placeholders don't affect calculations. 447 447 448 bool isInlineFlow = curr->isInlineFlowBox(); 449 448 450 curr->setHeight(curr->object()->lineHeight(m_firstLine)); 449 451 curr->setBaseline(curr->object()->baselinePosition(m_firstLine)); … … 457 459 maxPositionBottom = curr->height(); 458 460 } 459 else if ( curr->hasTextChildren() || curr->boxModelObject()->hasHorizontalBordersOrPadding() || strictMode) {461 else if ((!isInlineFlow || static_cast<InlineFlowBox*>(curr)->hasTextChildren()) || curr->boxModelObject()->hasHorizontalBordersOrPadding() || strictMode) { 460 462 int ascent = curr->baseline() - curr->yPos(); 461 463 int descent = curr->height() - ascent; … … 483 485 // Adjust boxes to use their real box y/height and not the logical height (as dictated by 484 486 // line-height). 485 if (curr->isInlineFlowBox()) 487 bool isInlineFlow = curr->isInlineFlowBox(); 488 if (isInlineFlow) 486 489 static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent, strictMode, topPosition, bottomPosition, selectionTop, selectionBottom); 487 490 … … 492 495 curr->setYPos(y + maxHeight - curr->height()); 493 496 else { 494 if ( !curr->hasTextChildren() && !curr->boxModelObject()->hasHorizontalBordersOrPadding() && !strictMode)497 if ((isInlineFlow && !static_cast<InlineFlowBox*>(curr)->hasTextChildren()) && !curr->boxModelObject()->hasHorizontalBordersOrPadding() && !strictMode) 495 498 childAffectsTopBottomPos = false; 496 499 curr->setYPos(curr->yPos() + y + maxAscent - curr->baseline()); -
trunk/WebCore/rendering/InlineFlowBox.h
r40769 r40771 37 37 , m_lastChild(0) 38 38 , m_maxHorizontalVisualOverflow(0) 39 , m_includeLeftEdge(false) 40 , m_includeRightEdge(false) 41 , m_hasTextChildren(true) 39 42 #ifndef NDEBUG 40 43 , m_hasBadChildList(false) … … 131 134 virtual void setVerticalOverflowPositions(int /*top*/, int /*bottom*/) { } 132 135 virtual void setVerticalSelectionPositions(int /*top*/, int /*bottom*/) { } 133 int maxHorizontalVisualOverflow() const { return m_maxHorizontalVisualOverflow; }136 short maxHorizontalVisualOverflow() const { return m_maxHorizontalVisualOverflow; } 134 137 135 138 void removeChild(InlineBox* child); … … 140 143 virtual int placeEllipsisBox(bool ltr, int blockEdge, int ellipsisWidth, bool&); 141 144 145 bool hasTextChildren() const { return m_hasTextChildren; } 146 142 147 void checkConsistency() const; 143 148 void setHasBadChildList(); … … 146 151 InlineBox* m_firstChild; 147 152 InlineBox* m_lastChild; 148 int m_maxHorizontalVisualOverflow; 153 short m_maxHorizontalVisualOverflow; 154 155 bool m_includeLeftEdge : 1; 156 bool m_includeRightEdge : 1; 157 bool m_hasTextChildren : 1; 149 158 150 159 #ifndef NDEBUG
Note: See TracChangeset
for help on using the changeset viewer.