Changeset 110070 in webkit
- Timestamp:
- Mar 7, 2012 10:59:46 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r110067 r110070 1 2012-03-07 Levi Weintraub <leviw@chromium.org> 2 3 Update usage of LayoutUnits in InlineBox and InlineFlowBox 4 https://bugs.webkit.org/show_bug.cgi?id=80051 5 6 Reviewed by Eric Seidel. 7 8 Updating LayoutUnit vs Integer usage in InlineBox and InlineFlowBox. While the 9 line box tree remains floating point, margins are now subpixel, and rects from 10 the render tree use LayoutUnits. For more information, see the LayoutUnit wiki 11 page: https://trac.webkit.org/wiki/LayoutUnit 12 13 No new tests. No change in behavior. 14 15 * rendering/InlineBox.cpp: 16 (WebCore::InlineBox::flipForWritingMode): Changing over to LayoutUnits. 17 * rendering/InlineBox.h: 18 (InlineBox): 19 * rendering/InlineFlowBox.cpp: 20 (WebCore::InlineFlowBox::getFlowSpacingLogicalWidth): Returning a LayoutUnit 21 instead of an integer, as it uses margin which is a LayoutUnit. 22 (WebCore::InlineFlowBox::placeBoxesInInlineDirection): Using a LayoutUnit for 23 margin. 24 (WebCore::InlineFlowBox::placeBoxesInBlockDirection): Build fixes for when 25 LayoutUnits are subpixel. 26 (WebCore::InlineFlowBox::paintFillLayer): Ditto. 27 * rendering/InlineFlowBox.h: 28 (WebCore::InlineFlowBox::marginBorderPaddingLogicalLeft): Returning a LayoutUnit 29 instead of an integer since margin is a LayoutUnit. 30 (WebCore::InlineFlowBox::marginBorderPaddingLogicalRight): Ditto. 31 (InlineFlowBox): 32 (WebCore::InlineFlowBox::logicalLeftLayoutOverflow): Adding a static_cast that's 33 redundant now, but required when we switch to subpixel LayoutUnits. 34 (WebCore::InlineFlowBox::logicalRightLayoutOverflow): Ditto. 35 (WebCore::InlineFlowBox::logicalLeftVisualOverflow): Ditto. 36 (WebCore::InlineFlowBox::logicalRightVisualOverflow): Ditto. 37 1 38 2012-03-07 Qi Zhang <qi.2.zhang@nokia.com> 2 39 -
trunk/Source/WebCore/rendering/InlineBox.cpp
r109593 r110070 366 366 } 367 367 368 void InlineBox::flipForWritingMode( IntRect& rect)368 void InlineBox::flipForWritingMode(LayoutRect& rect) 369 369 { 370 370 if (!renderer()->style()->isFlippedBlocksWritingMode()) … … 373 373 } 374 374 375 IntPoint InlineBox::flipForWritingMode(const IntPoint& point)375 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point) 376 376 { 377 377 if (!renderer()->style()->isFlippedBlocksWritingMode()) -
trunk/Source/WebCore/rendering/InlineBox.h
r109593 r110070 318 318 void flipForWritingMode(FloatRect&); 319 319 FloatPoint flipForWritingMode(const FloatPoint&); 320 void flipForWritingMode( IntRect&);321 IntPoint flipForWritingMode(const IntPoint&);320 void flipForWritingMode(LayoutRect&); 321 LayoutPoint flipForWritingMode(const LayoutPoint&); 322 322 323 323 bool knownToHaveNoOverflow() const { return m_knownToHaveNoOverflow; } -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r107880 r110070 57 57 #endif 58 58 59 int InlineFlowBox::getFlowSpacingLogicalWidth()60 { 61 int totWidth = marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight();59 LayoutUnit InlineFlowBox::getFlowSpacingLogicalWidth() 60 { 61 LayoutUnit totWidth = marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight(); 62 62 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 63 63 if (curr->isInlineFlowBox()) … … 398 398 // The box can have a different writing-mode than the overall line, so this is a bit complicated. 399 399 // Just get all the physical margin and overflow values by hand based off |isVertical|. 400 int logicalLeftMargin = isHorizontal() ? curr->boxModelObject()->marginLeft() : curr->boxModelObject()->marginTop();401 int logicalRightMargin = isHorizontal() ? curr->boxModelObject()->marginRight() : curr->boxModelObject()->marginBottom();400 LayoutUnit logicalLeftMargin = isHorizontal() ? curr->boxModelObject()->marginLeft() : curr->boxModelObject()->marginTop(); 401 LayoutUnit logicalRightMargin = isHorizontal() ? curr->boxModelObject()->marginRight() : curr->boxModelObject()->marginBottom(); 402 402 403 403 logicalLeft += logicalLeftMargin; … … 701 701 lineTopIncludingMargins = lineTop; 702 702 } else { 703 lineTop = min (lineTop, pixelSnappedLogicalTop());703 lineTop = min<LayoutUnit>(lineTop, pixelSnappedLogicalTop()); 704 704 lineTopIncludingMargins = min(lineTop, lineTopIncludingMargins); 705 705 } 706 lineBottom = max (lineBottom, pixelSnappedLogicalBottom());706 lineBottom = max<LayoutUnit>(lineBottom, pixelSnappedLogicalBottom()); 707 707 lineBottomIncludingMargins = max(lineBottom, lineBottomIncludingMargins); 708 708 } … … 1119 1119 LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : zeroLayoutUnit); 1120 1120 LayoutUnit stripY = rect.y() - (isHorizontal() ? zeroLayoutUnit : logicalOffsetOnLine); 1121 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : width();1122 LayoutUnit stripHeight = isHorizontal() ? height() : totalLogicalWidth;1121 LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : static_cast<LayoutUnit>(width()); 1122 LayoutUnit stripHeight = isHorizontal() ? static_cast<LayoutUnit>(height()) : totalLogicalWidth; 1123 1123 1124 1124 GraphicsContextStateSaver stateSaver(*paintInfo.context); -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r107874 r110070 120 120 121 121 // logicalLeft = left in a horizontal line and top in a vertical line. 122 int marginBorderPaddingLogicalLeft() const { return marginLogicalLeft() + borderLogicalLeft() + paddingLogicalLeft(); }123 int marginBorderPaddingLogicalRight() const { return marginLogicalRight() + borderLogicalRight() + paddingLogicalRight(); }122 LayoutUnit marginBorderPaddingLogicalLeft() const { return marginLogicalLeft() + borderLogicalLeft() + paddingLogicalLeft(); } 123 LayoutUnit marginBorderPaddingLogicalRight() const { return marginLogicalRight() + borderLogicalRight() + paddingLogicalRight(); } 124 124 LayoutUnit marginLogicalLeft() const 125 125 { … … 169 169 // Helper functions used during line construction and placement. 170 170 void determineSpacingForFlowBoxes(bool lastLine, bool isLogicallyLastRunWrapped, RenderObject* logicallyLastRunRenderer); 171 int getFlowSpacingLogicalWidth();171 LayoutUnit getFlowSpacingLogicalWidth(); 172 172 float placeBoxesInInlineDirection(float logicalLeft, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); 173 173 void computeLogicalBoxHeights(RootInlineBox*, LayoutUnit& maxPositionTop, LayoutUnit& maxPositionBottom, … … 208 208 return m_overflow ? m_overflow->layoutOverflowRect() : enclosingLayoutRect(frameRectIncludingLineHeight(lineTop, lineBottom)); 209 209 } 210 LayoutUnit logicalLeftLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXLayoutOverflow() : m_overflow->minYLayoutOverflow()) : logicalLeft(); }211 LayoutUnit logicalRightLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXLayoutOverflow() : m_overflow->maxYLayoutOverflow()) : ceilf(logicalRight()); }210 LayoutUnit logicalLeftLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXLayoutOverflow() : m_overflow->minYLayoutOverflow()) : static_cast<LayoutUnit>(logicalLeft()); } 211 LayoutUnit logicalRightLayoutOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXLayoutOverflow() : m_overflow->maxYLayoutOverflow()) : static_cast<LayoutUnit>(ceilf(logicalRight())); } 212 212 LayoutUnit logicalTopLayoutOverflow(LayoutUnit lineTop) const 213 213 { … … 234 234 return m_overflow ? m_overflow->visualOverflowRect() : enclosingLayoutRect(frameRectIncludingLineHeight(lineTop, lineBottom)); 235 235 } 236 LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXVisualOverflow() : m_overflow->minYVisualOverflow()) : logicalLeft(); }237 LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXVisualOverflow() : m_overflow->maxYVisualOverflow()) : ceilf(logicalRight()); }236 LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->minXVisualOverflow() : m_overflow->minYVisualOverflow()) : static_cast<LayoutUnit>(logicalLeft()); } 237 LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->maxXVisualOverflow() : m_overflow->maxYVisualOverflow()) : static_cast<LayoutUnit>(ceilf(logicalRight())); } 238 238 LayoutUnit logicalTopVisualOverflow(LayoutUnit lineTop) const 239 239 {
Note: See TracChangeset
for help on using the changeset viewer.