Changeset 90833 in webkit
- Timestamp:
- Jul 12, 2011 11:42:18 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90832 r90833 1 2011-07-12 Emil A Eklund <eae@chromium.org> 2 3 Switch preferred width/height and columns to to new layout types 4 https://bugs.webkit.org/show_bug.cgi?id=64329 5 6 Reviewed by Eric Seidel. 7 8 No new tests, no new functionality. 9 10 * rendering/LayoutTypes.h: 11 (WebCore::ceiledLayoutUnit): 12 Add ceiledLayoutUnit to go with the floored version. 13 14 * rendering/RenderBlock.cpp: 15 (WebCore::RenderBlock::adjustRectForColumns): 16 (WebCore::RenderBlock::flipForWritingModeIncludingColumns): 17 (WebCore::RenderBlock::adjustStartEdgeForWritingModeIncludingColumns): 18 Rename rect version of flipForWritingModeIncludingColumns to 19 adjustStartEdgeForWritingModeIncludingColumns as it adjust the start edge 20 and does not flip the rect. 21 22 (WebCore::RenderBlock::adjustForColumns): 23 (WebCore::updatePreferredWidth): 24 * rendering/RenderBlock.h: 25 * rendering/RenderBox.cpp: 26 (WebCore::RenderBox::minPreferredLogicalWidth): 27 (WebCore::RenderBox::maxPreferredLogicalWidth): 28 (WebCore::RenderBox::offsetFromContainer): 29 (WebCore::RenderBox::computePercentageLogicalHeight): 30 (WebCore::RenderBox::flipForWritingMode): 31 (WebCore::RenderBox::flipForWritingModeIncludingColumns): 32 * rendering/RenderBox.h: 33 * rendering/RenderListBox.cpp: 34 (WebCore::RenderListBox::itemBoundingBoxRect): 35 * rendering/RenderListBox.h: 36 * rendering/RenderObject.h: 37 (WebCore::RenderObject::minPreferredLogicalWidth): 38 (WebCore::RenderObject::maxPreferredLogicalWidth): 39 (WebCore::RenderObject::adjustForColumns): 40 * rendering/RenderReplaced.cpp: 41 (WebCore::RenderReplaced::computeReplacedLogicalWidth): 42 (WebCore::RenderReplaced::computeReplacedLogicalHeight): 43 * rendering/TableLayout.h: 44 1 45 2011-07-12 Levi Weintraub <leviw@chromium.org> 2 46 -
trunk/Source/WebCore/rendering/LayoutTypes.h
r90600 r90833 72 72 } 73 73 74 inline LayoutUnit ceiledLayoutUnit(float value) 75 { 76 return ceilf(value); 77 } 78 74 79 inline LayoutSize toLayoutSize(const LayoutPoint& p) 75 80 { -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r90800 r90833 4495 4495 } 4496 4496 4497 void RenderBlock::adjustRectForColumns( IntRect& r) const4497 void RenderBlock::adjustRectForColumns(LayoutRect& r) const 4498 4498 { 4499 4499 // Just bail if we have no columns. … … 4504 4504 4505 4505 // Begin with a result rect that is empty. 4506 IntRect result;4506 LayoutRect result; 4507 4507 4508 4508 // Determine which columns we intersect. … … 4511 4511 return; 4512 4512 4513 int logicalLeft = logicalLeftOffsetForContent();4514 int currLogicalOffset = 0;4513 LayoutUnit logicalLeft = logicalLeftOffsetForContent(); 4514 LayoutUnit currLogicalOffset = 0; 4515 4515 4516 4516 for (unsigned i = 0; i < colCount; i++) { 4517 IntRect colRect = columnRectAt(colInfo, i);4518 IntRect repaintRect = r;4517 LayoutRect colRect = columnRectAt(colInfo, i); 4518 LayoutRect repaintRect = r; 4519 4519 if (isHorizontalWritingMode()) { 4520 int currXOffset = colRect.x() - logicalLeft;4520 LayoutUnit currXOffset = colRect.x() - logicalLeft; 4521 4521 repaintRect.move(currXOffset, currLogicalOffset); 4522 4522 currLogicalOffset -= colRect.height(); 4523 4523 } else { 4524 int currYOffset = colRect.y() - logicalLeft;4524 LayoutUnit currYOffset = colRect.y() - logicalLeft; 4525 4525 repaintRect.move(currLogicalOffset, currYOffset); 4526 4526 currLogicalOffset -= colRect.width(); … … 4533 4533 } 4534 4534 4535 IntPoint RenderBlock::flipForWritingModeIncludingColumns(const IntPoint& point) const4535 LayoutPoint RenderBlock::flipForWritingModeIncludingColumns(const LayoutPoint& point) const 4536 4536 { 4537 4537 ASSERT(hasColumns()); … … 4539 4539 return point; 4540 4540 ColumnInfo* colInfo = columnInfo(); 4541 int columnLogicalHeight = colInfo->columnHeight();4542 int expandedLogicalHeight = borderBefore() + paddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollbarLogicalHeight();4541 LayoutUnit columnLogicalHeight = colInfo->columnHeight(); 4542 LayoutUnit expandedLogicalHeight = borderBefore() + paddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollbarLogicalHeight(); 4543 4543 if (isHorizontalWritingMode()) 4544 return IntPoint(point.x(), expandedLogicalHeight - point.y());4545 return IntPoint(expandedLogicalHeight - point.x(), point.y());4546 } 4547 4548 void RenderBlock:: flipForWritingModeIncludingColumns(IntRect& rect) const4544 return LayoutPoint(point.x(), expandedLogicalHeight - point.y()); 4545 return LayoutPoint(expandedLogicalHeight - point.x(), point.y()); 4546 } 4547 4548 void RenderBlock::adjustStartEdgeForWritingModeIncludingColumns(LayoutRect& rect) const 4549 4549 { 4550 4550 ASSERT(hasColumns()); … … 4553 4553 4554 4554 ColumnInfo* colInfo = columnInfo(); 4555 int columnLogicalHeight = colInfo->columnHeight(); 4556 int expandedLogicalHeight = borderBefore() + paddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollbarLogicalHeight(); 4555 LayoutUnit columnLogicalHeight = colInfo->columnHeight(); 4556 LayoutUnit expandedLogicalHeight = borderBefore() + paddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollbarLogicalHeight(); 4557 4557 4558 if (isHorizontalWritingMode()) 4558 4559 rect.setY(expandedLogicalHeight - rect.maxY()); … … 4561 4562 } 4562 4563 4563 void RenderBlock::adjustForColumns( IntSize& offset, const IntPoint& point) const4564 void RenderBlock::adjustForColumns(LayoutSize& offset, const LayoutPoint& point) const 4564 4565 { 4565 4566 if (!hasColumns()) … … 4568 4569 ColumnInfo* colInfo = columnInfo(); 4569 4570 4570 int logicalLeft = logicalLeftOffsetForContent();4571 LayoutUnit logicalLeft = logicalLeftOffsetForContent(); 4571 4572 size_t colCount = columnCount(colInfo); 4572 int colLogicalWidth = colInfo->desiredColumnWidth();4573 int colLogicalHeight = colInfo->columnHeight();4573 LayoutUnit colLogicalWidth = colInfo->desiredColumnWidth(); 4574 LayoutUnit colLogicalHeight = colInfo->columnHeight(); 4574 4575 4575 4576 for (size_t i = 0; i < colCount; ++i) { 4576 4577 // Compute the edges for a given column in the block progression direction. 4577 IntRect sliceRect = IntRect(logicalLeft, borderBefore() + paddingBefore() + i * colLogicalHeight, colLogicalWidth, colLogicalHeight);4578 LayoutRect sliceRect = LayoutRect(logicalLeft, borderBefore() + paddingBefore() + i * colLogicalHeight, colLogicalWidth, colLogicalHeight); 4578 4579 if (!isHorizontalWritingMode()) 4579 4580 sliceRect = sliceRect.transposedRect(); 4580 4581 4581 4582 // If we have a flipped blocks writing mode, then convert the column so that it's coming from the after edge (either top or left edge). 4582 flipForWritingModeIncludingColumns(sliceRect);4583 adjustStartEdgeForWritingModeIncludingColumns(sliceRect); 4583 4584 4584 int logicalOffset = style()->isFlippedBlocksWritingMode() ? (colCount - 1 - i) * colLogicalHeight : i * colLogicalHeight;4585 LayoutUnit logicalOffset = style()->isFlippedBlocksWritingMode() ? (colCount - 1 - i) * colLogicalHeight : i * colLogicalHeight; 4585 4586 4586 4587 // Now we're in the same coordinate space as the point. See if it is inside the rectangle. … … 4759 4760 } 4760 4761 4761 static inline void updatePreferredWidth( int& preferredWidth, float& result)4762 { 4763 int snappedResult = ceilf(result);4762 static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& result) 4763 { 4764 LayoutUnit snappedResult = ceiledLayoutUnit(result); 4764 4765 preferredWidth = max(snappedResult, preferredWidth); 4765 4766 } -
trunk/Source/WebCore/rendering/RenderBlock.h
r90698 r90833 128 128 virtual LayoutUnit availableLogicalWidth() const; 129 129 130 IntPoint flipForWritingModeIncludingColumns(const IntPoint&) const;131 void flipForWritingModeIncludingColumns(IntRect&) const;130 LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const; 131 void adjustStartEdgeForWritingModeIncludingColumns(LayoutRect&) const; 132 132 133 133 RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(firstLineBox()); } … … 150 150 void clearTruncation(); 151 151 152 void adjustRectForColumns( IntRect&) const;153 virtual void adjustForColumns( IntSize&, const IntPoint&) const;152 void adjustRectForColumns(LayoutRect&) const; 153 virtual void adjustForColumns(LayoutSize&, const LayoutPoint&) const; 154 154 155 155 void addContinuationWithOutline(RenderInline*); -
trunk/Source/WebCore/rendering/RenderBox.cpp
r90832 r90833 668 668 } 669 669 670 int RenderBox::minPreferredLogicalWidth() const670 LayoutUnit RenderBox::minPreferredLogicalWidth() const 671 671 { 672 672 if (preferredLogicalWidthsDirty()) … … 676 676 } 677 677 678 int RenderBox::maxPreferredLogicalWidth() const678 LayoutUnit RenderBox::maxPreferredLogicalWidth() const 679 679 { 680 680 if (preferredLogicalWidthsDirty()) … … 1299 1299 if (o->hasColumns()) { 1300 1300 LayoutRect columnRect(frameRect()); 1301 toRenderBlock(o)-> flipForWritingModeIncludingColumns(columnRect);1301 toRenderBlock(o)->adjustStartEdgeForWritingModeIncludingColumns(columnRect); 1302 1302 offset += LayoutSize(columnRect.location().x(), columnRect.location().y()); 1303 1303 columnRect.moveBy(point); … … 1928 1928 // table cells using percentage heights. 1929 1929 result -= borderAndPaddingLogicalHeight(); 1930 result = max (0, result);1930 result = max<LayoutUnit>(0, result); 1931 1931 } 1932 1932 } … … 3394 3394 } 3395 3395 3396 IntPoint RenderBox::flipForWritingMode(const RenderBox* child, const IntPoint& point, FlippingAdjustment adjustment) const3396 LayoutPoint RenderBox::flipForWritingMode(const RenderBox* child, const LayoutPoint& point, FlippingAdjustment adjustment) const 3397 3397 { 3398 3398 if (!style()->isFlippedBlocksWritingMode()) … … 3402 3402 // the right place. 3403 3403 if (isHorizontalWritingMode()) 3404 return IntPoint(point.x(), point.y() + height() - child->height() - child->y() - (adjustment == ParentToChildFlippingAdjustment ? child->y() : 0));3405 return IntPoint(point.x() + width() - child->width() - child->x() - (adjustment == ParentToChildFlippingAdjustment ? child->x() : 0), point.y());3404 return LayoutPoint(point.x(), point.y() + height() - child->height() - child->y() - (adjustment == ParentToChildFlippingAdjustment ? child->y() : 0)); 3405 return LayoutPoint(point.x() + width() - child->width() - child->x() - (adjustment == ParentToChildFlippingAdjustment ? child->x() : 0), point.y()); 3406 3406 } 3407 3407 … … 3431 3431 } 3432 3432 3433 IntPoint RenderBox::flipForWritingModeIncludingColumns(const IntPoint& point) const3433 LayoutPoint RenderBox::flipForWritingModeIncludingColumns(const LayoutPoint& point) const 3434 3434 { 3435 3435 if (!hasColumns() || !style()->isFlippedBlocksWritingMode()) -
trunk/Source/WebCore/rendering/RenderBox.h
r90734 r90833 240 240 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction); 241 241 242 virtual int minPreferredLogicalWidth() const;243 virtual int maxPreferredLogicalWidth() const;242 virtual LayoutUnit minPreferredLogicalWidth() const; 243 virtual LayoutUnit maxPreferredLogicalWidth() const; 244 244 245 245 LayoutSize overrideSize() const; … … 389 389 390 390 enum FlippingAdjustment { ChildToParentFlippingAdjustment, ParentToChildFlippingAdjustment }; 391 IntPoint flipForWritingMode(const RenderBox* child, const IntPoint&, FlippingAdjustment) const;391 LayoutPoint flipForWritingMode(const RenderBox* child, const LayoutPoint&, FlippingAdjustment) const; 392 392 int flipForWritingMode(int position) const; // The offset is in the block direction (y for horizontal writing modes, x for vertical writing modes). 393 393 IntPoint flipForWritingMode(const IntPoint&) const; 394 IntPoint flipForWritingModeIncludingColumns(const IntPoint&) const;394 LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const; 395 395 IntSize flipForWritingMode(const IntSize&) const; 396 396 void flipForWritingMode(IntRect&) const; … … 475 475 476 476 // The preferred logical width of the element if it were to break its lines at every possible opportunity. 477 int m_minPreferredLogicalWidth;477 LayoutUnit m_minPreferredLogicalWidth; 478 478 479 479 // The preferred logical width of the element if it never breaks any lines at all. 480 int m_maxPreferredLogicalWidth;480 LayoutUnit m_maxPreferredLogicalWidth; 481 481 482 482 // For inline replaced elements, the inline box that owns us. -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r90667 r90833 255 255 } 256 256 257 IntRect RenderListBox::itemBoundingBoxRect(const IntPoint& additionalOffset, int index)257 IntRect RenderListBox::itemBoundingBoxRect(const LayoutPoint& additionalOffset, int index) 258 258 { 259 259 return IntRect(additionalOffset.x() + borderLeft() + paddingLeft(), -
trunk/Source/WebCore/rendering/RenderListBox.h
r90667 r90833 47 47 48 48 int listIndexAtOffset(int x, int y); 49 IntRect itemBoundingBoxRect(const IntPoint&, int index);49 IntRect itemBoundingBoxRect(const LayoutPoint&, int index); 50 50 51 51 bool scrollToRevealElementAtListIndex(int index); -
trunk/Source/WebCore/rendering/RenderObject.h
r90773 r90833 605 605 LayoutRect paintingRootRect(LayoutRect& topLevelRect); 606 606 607 virtual int minPreferredLogicalWidth() const { return 0; }608 virtual int maxPreferredLogicalWidth() const { return 0; }607 virtual LayoutUnit minPreferredLogicalWidth() const { return 0; } 608 virtual LayoutUnit maxPreferredLogicalWidth() const { return 0; } 609 609 610 610 RenderStyle* style() const { return m_style.get(); } … … 670 670 // If multiple-column layout results in applying an offset to the given point, add the same 671 671 // offset to the given size. 672 virtual void adjustForColumns( IntSize&, const IntPoint&) const { }672 virtual void adjustForColumns(LayoutSize&, const LayoutPoint&) const { } 673 673 674 674 virtual unsigned int length() const { return 1; } -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r90675 r90833 220 220 } 221 221 222 int RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) const222 LayoutUnit RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) const 223 223 { 224 224 if (style()->logicalWidth().isSpecified()) … … 305 305 } 306 306 307 int RenderReplaced::computeReplacedLogicalHeight() const307 LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const 308 308 { 309 309 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height -
trunk/Source/WebCore/rendering/TableLayout.h
r76248 r90833 39 39 virtual ~TableLayout() { } 40 40 41 virtual void computePreferredLogicalWidths( int& minWidth, int& maxWidth) = 0;41 virtual void computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth) = 0; 42 42 virtual void layout() = 0; 43 43
Note: See TracChangeset
for help on using the changeset viewer.