Changeset 90069 in webkit
- Timestamp:
- Jun 29, 2011 4:59:49 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90068 r90069 1 2011-06-29 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch computeWidth and computeHeight functions to new layout types 6 https://bugs.webkit.org/show_bug.cgi?id=63655 7 8 Switch computeWidth and computeHeight functions over to the new layout unit abstraction. 9 10 Making a point to mark rounding that should eventually be removed by linking to a new 11 tracking bug: 63645. 12 13 No new tests, no functionality changes. 14 15 * rendering/AutoTableLayout.cpp: 16 (WebCore::AutoTableLayout::computePreferredLogicalWidths): 17 * rendering/AutoTableLayout.h: 18 * rendering/FixedTableLayout.cpp: 19 (WebCore::FixedTableLayout::computePreferredLogicalWidths): 20 * rendering/FixedTableLayout.h: 21 * rendering/LayoutTypes.h: 22 * rendering/RenderBlock.cpp: 23 (WebCore::RenderBlock::computePreferredLogicalWidths): 24 (WebCore::RenderBlock::computeInlinePreferredLogicalWidths): 25 (WebCore::RenderBlock::computeBlockPreferredLogicalWidths): 26 * rendering/RenderBox.cpp: 27 (WebCore::RenderBox::computeLogicalWidthUsing): 28 (WebCore::RenderBox::computeLogicalHeight): 29 (WebCore::RenderBox::computeLogicalHeightUsing): 30 (WebCore::RenderBox::computePercentageLogicalHeight): 31 (WebCore::RenderBox::computeReplacedLogicalWidth): 32 (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth): 33 (WebCore::RenderBox::computeReplacedLogicalWidthUsing): 34 (WebCore::RenderBox::computeReplacedLogicalHeight): 35 (WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight): 36 (WebCore::RenderBox::computeReplacedLogicalHeightUsing): 37 * rendering/RenderBox.h: 38 * rendering/RenderIFrame.cpp: 39 (WebCore::RenderIFrame::computeLogicalWidth): 40 * rendering/RenderImage.cpp: 41 (WebCore::RenderImage::computeReplacedLogicalWidth): 42 (WebCore::RenderImage::computeReplacedLogicalHeight): 43 * rendering/RenderImage.h: 44 * rendering/RenderListBox.cpp: 45 (WebCore::RenderListBox::computePreferredLogicalWidths): 46 * rendering/RenderListMarker.cpp: 47 (WebCore::RenderListMarker::computePreferredLogicalWidths): 48 * rendering/RenderMenuList.cpp: 49 (WebCore::RenderMenuList::computePreferredLogicalWidths): 50 * rendering/RenderReplaced.cpp: 51 (WebCore::RenderReplaced::computeReplacedLogicalWidth): 52 (WebCore::RenderReplaced::computeReplacedLogicalHeight): 53 (WebCore::RenderReplaced::computePreferredLogicalWidths): 54 * rendering/RenderReplaced.h: 55 * rendering/RenderSlider.cpp: 56 (WebCore::RenderSlider::computePreferredLogicalWidths): 57 * rendering/RenderTable.cpp: 58 (WebCore::RenderTable::computeLogicalWidth): 59 * rendering/RenderTextControl.cpp: 60 (WebCore::RenderTextControl::computePreferredLogicalWidths): 61 * rendering/RenderVideo.cpp: 62 (WebCore::RenderVideo::computeReplacedLogicalWidth): 63 (WebCore::RenderVideo::computeReplacedLogicalHeight): 64 * rendering/RenderVideo.h: 65 * rendering/svg/RenderSVGForeignObject.cpp: 66 (WebCore::RenderSVGForeignObject::computeLogicalWidth): 67 (WebCore::RenderSVGForeignObject::computeLogicalHeight): 68 * rendering/svg/RenderSVGRoot.cpp: 69 (WebCore::RenderSVGRoot::computePreferredLogicalWidths): 70 (WebCore::RenderSVGRoot::computeIntrinsicWidth): 71 (WebCore::RenderSVGRoot::computeIntrinsicHeight): 72 (WebCore::RenderSVGRoot::computeReplacedLogicalWidth): 73 (WebCore::RenderSVGRoot::computeReplacedLogicalHeight): 74 (WebCore::RenderSVGRoot::layout): 75 * rendering/svg/RenderSVGRoot.h: 76 1 77 2011-06-23 Abhishek Arya <inferno@chromium.org> 2 78 -
trunk/Source/WebCore/rendering/AutoTableLayout.cpp
r84755 r90069 220 220 } 221 221 222 void AutoTableLayout::computePreferredLogicalWidths( int& minWidth, int& maxWidth)222 void AutoTableLayout::computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth) 223 223 { 224 224 fullRecalc(); 225 225 226 int spanMaxLogicalWidth = calcEffectiveLogicalWidth();226 LayoutUnit spanMaxLogicalWidth = calcEffectiveLogicalWidth(); 227 227 minWidth = 0; 228 228 maxWidth = 0; … … 252 252 if (scaleColumns) { 253 253 maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon); 254 maxWidth = max(maxWidth, static_cast<int>(min(maxNonPercent, INT_MAX / 2.0f))); 255 maxWidth = max(maxWidth, static_cast<int>(min(maxPercent, INT_MAX / 2.0f))); 254 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 255 maxWidth = max(maxWidth, static_cast<int>(min(maxNonPercent, numeric_limits<LayoutUnit>::max() / 2.0f))); 256 maxWidth = max(maxWidth, static_cast<int>(min(maxPercent, numeric_limits<LayoutUnit>::max() / 2.0f))); 256 257 } 257 258 258 259 maxWidth = max(maxWidth, spanMaxLogicalWidth); 259 260 260 int bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();261 LayoutUnit bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection(); 261 262 minWidth += bordersPaddingAndSpacing; 262 263 maxWidth += bordersPaddingAndSpacing; -
trunk/Source/WebCore/rendering/AutoTableLayout.h
r71262 r90069 22 22 #define AutoTableLayout_h 23 23 24 #include "LayoutTypes.h" 24 25 #include "Length.h" 25 26 #include "TableLayout.h" … … 36 37 ~AutoTableLayout(); 37 38 38 virtual void computePreferredLogicalWidths( int& minWidth, int& maxWidth);39 virtual void computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth); 39 40 virtual void layout(); 40 41 -
trunk/Source/WebCore/rendering/FixedTableLayout.cpp
r81625 r90069 190 190 #define TABLE_MAX_WIDTH 15000 191 191 192 void FixedTableLayout::computePreferredLogicalWidths( int& minWidth, int& maxWidth)192 void FixedTableLayout::computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth) 193 193 { 194 194 // FIXME: This entire calculation is incorrect for both minwidth and maxwidth. … … 201 201 // 202 202 // The maximum width is max(minWidth, tableWidth). 203 int bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection();204 205 int tableLogicalWidth = m_table->style()->logicalWidth().isFixed() ? m_table->style()->logicalWidth().value() - bordersPaddingAndSpacing : 0;206 int mw = calcWidthArray(tableLogicalWidth) + bordersPaddingAndSpacing;203 LayoutUnit bordersPaddingAndSpacing = m_table->bordersPaddingAndSpacingInRowDirection(); 204 205 LayoutUnit tableLogicalWidth = m_table->style()->logicalWidth().isFixed() ? m_table->style()->logicalWidth().value() - bordersPaddingAndSpacing : 0; 206 LayoutUnit mw = calcWidthArray(tableLogicalWidth) + bordersPaddingAndSpacing; 207 207 208 208 minWidth = max(mw, tableLogicalWidth); -
trunk/Source/WebCore/rendering/FixedTableLayout.h
r71262 r90069 22 22 #define FixedTableLayout_h 23 23 24 #include "LayoutTypes.h" 24 25 #include "Length.h" 25 26 #include "TableLayout.h" … … 34 35 FixedTableLayout(RenderTable*); 35 36 36 virtual void computePreferredLogicalWidths( int& minWidth, int& maxWidth);37 virtual void computePreferredLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth); 37 38 virtual void layout(); 38 39 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r90068 r90069 4640 4640 } 4641 4641 4642 int borderAndPadding = borderAndPaddingLogicalWidth();4642 LayoutUnit borderAndPadding = borderAndPaddingLogicalWidth(); 4643 4643 m_minPreferredLogicalWidth += borderAndPadding; 4644 4644 m_maxPreferredLogicalWidth += borderAndPadding; … … 4756 4756 float inlineMin = 0; 4757 4757 4758 int cw = containingBlock()->contentLogicalWidth();4758 LayoutUnit cw = containingBlock()->contentLogicalWidth(); 4759 4759 4760 4760 // If we are at the start of a line, we want to ignore all white-space. … … 4874 4874 4875 4875 // Add in text-indent. This is added in only once. 4876 int ti = 0;4876 LayoutUnit ti = 0; 4877 4877 if (!addedTextIndent) { 4878 4878 addedTextIndent = true; … … 4945 4945 4946 4946 // Add in text-indent. This is added in only once. 4947 int ti = 0;4947 LayoutUnit ti = 0; 4948 4948 if (!addedTextIndent) { 4949 4949 addedTextIndent = true; … … 5021 5021 5022 5022 RenderObject *child = firstChild(); 5023 int floatLeftWidth = 0, floatRightWidth = 0;5023 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; 5024 5024 while (child) { 5025 5025 // Positioned children don't affect the min/max width … … 5030 5030 5031 5031 if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoidsFloats())) { 5032 int floatTotalWidth = floatLeftWidth + floatRightWidth;5032 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; 5033 5033 if (child->style()->clear() & CLEFT) { 5034 5034 m_maxPreferredLogicalWidth = max(floatTotalWidth, m_maxPreferredLogicalWidth); … … 5046 5046 Length startMarginLength = child->style()->marginStart(); 5047 5047 Length endMarginLength = child->style()->marginEnd(); 5048 int margin = 0;5049 int marginStart = 0;5050 int marginEnd = 0;5048 LayoutUnit margin = 0; 5049 LayoutUnit marginStart = 0; 5050 LayoutUnit marginEnd = 0; 5051 5051 if (startMarginLength.isFixed()) 5052 5052 marginStart += startMarginLength.value(); … … 5055 5055 margin = marginStart + marginEnd; 5056 5056 5057 int w = child->minPreferredLogicalWidth() + margin;5057 LayoutUnit w = child->minPreferredLogicalWidth() + margin; 5058 5058 m_minPreferredLogicalWidth = max(w, m_minPreferredLogicalWidth); 5059 5059 … … 5070 5070 // is smaller than the float width. 5071 5071 bool ltr = containingBlock()->style()->isLeftToRightDirection(); 5072 int marginLogicalLeft = ltr ? marginStart : marginEnd;5073 int marginLogicalRight = ltr ? marginEnd : marginStart;5074 int maxLeft = marginLogicalLeft > 0 ? max(floatLeftWidth, marginLogicalLeft) : floatLeftWidth + marginLogicalLeft;5075 int maxRight = marginLogicalRight > 0 ? max(floatRightWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight;5072 LayoutUnit marginLogicalLeft = ltr ? marginStart : marginEnd; 5073 LayoutUnit marginLogicalRight = ltr ? marginEnd : marginStart; 5074 LayoutUnit maxLeft = marginLogicalLeft > 0 ? max(floatLeftWidth, marginLogicalLeft) : floatLeftWidth + marginLogicalLeft; 5075 LayoutUnit maxRight = marginLogicalRight > 0 ? max(floatRightWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight; 5076 5076 w = child->maxPreferredLogicalWidth() + maxLeft + maxRight; 5077 5077 w = max(w, floatLeftWidth + floatRightWidth); -
trunk/Source/WebCore/rendering/RenderBox.cpp
r90059 r90069 1621 1621 } 1622 1622 1623 int RenderBox::computeLogicalWidthUsing(LogicalWidthType widthType, int availableLogicalWidth)1624 { 1625 int logicalWidthResult = logicalWidth();1623 LayoutUnit RenderBox::computeLogicalWidthUsing(LogicalWidthType widthType, LayoutUnit availableLogicalWidth) 1624 { 1625 LayoutUnit logicalWidthResult = logicalWidth(); 1626 1626 Length logicalWidth; 1627 1627 if (widthType == LogicalWidth) … … 1633 1633 1634 1634 if (logicalWidth.isIntrinsicOrAuto()) { 1635 int marginStart = style()->marginStart().calcMinValue(availableLogicalWidth);1636 int marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth);1635 LayoutUnit marginStart = style()->marginStart().calcMinValue(availableLogicalWidth); 1636 LayoutUnit marginEnd = style()->marginEnd().calcMinValue(availableLogicalWidth); 1637 1637 if (availableLogicalWidth) 1638 1638 logicalWidthResult = availableLogicalWidth - marginStart - marginEnd; … … 1782 1782 } 1783 1783 1784 int heightResult;1784 LayoutUnit heightResult; 1785 1785 if (checkMinMaxHeight) { 1786 1786 heightResult = computeLogicalHeightUsing(style()->logicalHeight()); 1787 1787 if (heightResult == -1) 1788 1788 heightResult = logicalHeight(); 1789 int minH = computeLogicalHeightUsing(style()->logicalMinHeight()); // Leave as -1 if unset.1790 int maxH = style()->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(style()->logicalMaxHeight());1789 LayoutUnit minH = computeLogicalHeightUsing(style()->logicalMinHeight()); // Leave as -1 if unset. 1790 LayoutUnit maxH = style()->logicalMaxHeight().isUndefined() ? heightResult : computeLogicalHeightUsing(style()->logicalMaxHeight()); 1791 1791 if (maxH == -1) 1792 1792 maxH = heightResult; … … 1816 1816 // FIXME: Finish accounting for block flow here. 1817 1817 // https://bugs.webkit.org/show_bug.cgi?id=46603 1818 int margins = collapsedMarginBefore() + collapsedMarginAfter();1819 int visHeight;1818 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter(); 1819 LayoutUnit visHeight; 1820 1820 if (document()->printing()) 1821 visHeight = static_cast< int>(view()->pageLogicalHeight());1821 visHeight = static_cast<LayoutUnit>(view()->pageLogicalHeight()); 1822 1822 else { 1823 1823 if (isHorizontalWritingMode()) … … 1829 1829 setLogicalHeight(max(logicalHeight(), visHeight - margins)); 1830 1830 else { 1831 int marginsBordersPadding = margins + parentBox()->marginBefore() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight();1831 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefore() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight(); 1832 1832 setLogicalHeight(max(logicalHeight(), visHeight - marginsBordersPadding)); 1833 1833 } … … 1835 1835 } 1836 1836 1837 int RenderBox::computeLogicalHeightUsing(const Length& h)1838 { 1839 int logicalHeight = -1;1837 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& h) 1838 { 1839 LayoutUnit logicalHeight = -1; 1840 1840 if (!h.isAuto()) { 1841 1841 if (h.isFixed()) … … 1851 1851 } 1852 1852 1853 int RenderBox::computePercentageLogicalHeight(const Length& height)1854 { 1855 int result = -1;1853 LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) 1854 { 1855 LayoutUnit result = -1; 1856 1856 1857 1857 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing … … 1912 1912 // Don't allow this to affect the block' height() member variable, since this 1913 1913 // can get called while the block is still laying out its kids. 1914 int oldHeight = cb->logicalHeight();1914 LayoutUnit oldHeight = cb->logicalHeight(); 1915 1915 cb->computeLogicalHeight(); 1916 1916 result = cb->contentLogicalHeight(); … … 1934 1934 } 1935 1935 1936 int RenderBox::computeReplacedLogicalWidth(bool includeMaxWidth) const1936 LayoutUnit RenderBox::computeReplacedLogicalWidth(bool includeMaxWidth) const 1937 1937 { 1938 1938 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(style()->logicalWidth()), includeMaxWidth); 1939 1939 } 1940 1940 1941 int RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(int logicalWidth, bool includeMaxWidth) const1942 { 1943 int minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth());1944 int maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());1941 LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth) const 1942 { 1943 LayoutUnit minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth()); 1944 LayoutUnit maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth()); 1945 1945 return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth)); 1946 1946 } 1947 1947 1948 int RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const1948 LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const 1949 1949 { 1950 1950 switch (logicalWidth.type()) { … … 1955 1955 // containing block's block-flow. 1956 1956 // https://bugs.webkit.org/show_bug.cgi?id=46496 1957 const int cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();1957 const LayoutUnit cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent(); 1958 1958 if (cw > 0) 1959 1959 return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw)); … … 1965 1965 } 1966 1966 1967 int RenderBox::computeReplacedLogicalHeight() const1967 LayoutUnit RenderBox::computeReplacedLogicalHeight() const 1968 1968 { 1969 1969 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style()->logicalHeight())); 1970 1970 } 1971 1971 1972 int RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(int logicalHeight) const1973 { 1974 int minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());1975 int maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());1972 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const 1973 { 1974 LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight()); 1975 LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); 1976 1976 return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight)); 1977 1977 } 1978 1978 1979 int RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const1979 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const 1980 1980 { 1981 1981 switch (logicalHeight.type()) { … … 1995 1995 ASSERT(cb->isRenderBlock()); 1996 1996 RenderBlock* block = toRenderBlock(cb); 1997 int oldHeight = block->height();1997 LayoutUnit oldHeight = block->height(); 1998 1998 block->computeLogicalHeight(); 1999 int newHeight = block->computeContentBoxLogicalHeight(block->contentHeight());1999 LayoutUnit newHeight = block->computeContentBoxLogicalHeight(block->contentHeight()); 2000 2000 block->setHeight(oldHeight); 2001 2001 return computeContentBoxLogicalHeight(logicalHeight.calcValue(newHeight)); … … 2005 2005 // containing block's block-flow. 2006 2006 // https://bugs.webkit.org/show_bug.cgi?id=46496 2007 int availableHeight;2007 LayoutUnit availableHeight; 2008 2008 if (isPositioned()) 2009 2009 availableHeight = containingBlockLogicalHeightForPositioned(toRenderBoxModelObject(cb)); -
trunk/Source/WebCore/rendering/RenderBox.h
r90049 r90069 306 306 virtual bool stretchesToMinIntrinsicLogicalWidth() const { return false; } 307 307 308 int computeLogicalWidthUsing(LogicalWidthType, int availableLogicalWidth);309 int computeLogicalHeightUsing(const Length& height);310 int computeReplacedLogicalWidthUsing(Length width) const;311 int computeReplacedLogicalWidthRespectingMinMaxWidth(int logicalWidth, bool includeMaxWidth = true) const;312 int computeReplacedLogicalHeightUsing(Length height) const;313 int computeReplacedLogicalHeightRespectingMinMaxHeight(int logicalHeight) const;314 315 virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;316 virtual int computeReplacedLogicalHeight() const;317 318 int computePercentageLogicalHeight(const Length& height);308 LayoutUnit computeLogicalWidthUsing(LogicalWidthType, LayoutUnit availableLogicalWidth); 309 LayoutUnit computeLogicalHeightUsing(const Length& height); 310 LayoutUnit computeReplacedLogicalWidthUsing(Length width) const; 311 LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth = true) const; 312 LayoutUnit computeReplacedLogicalHeightUsing(Length height) const; 313 LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const; 314 315 virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const; 316 virtual LayoutUnit computeReplacedLogicalHeight() const; 317 318 LayoutUnit computePercentageLogicalHeight(const Length& height); 319 319 320 320 // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.) -
trunk/Source/WebCore/rendering/RenderIFrame.cpp
r88011 r90069 75 75 if (!view) 76 76 return; 77 int border = borderLeft() + borderRight();77 LayoutUnit border = borderLeft() + borderRight(); 78 78 setWidth(max(width(), view->contentsWidth() + border)); 79 79 } -
trunk/Source/WebCore/rendering/RenderImage.cpp
r90048 r90069 461 461 } 462 462 463 int RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const463 LayoutUnit RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const 464 464 { 465 465 if (m_imageResource->imageHasRelativeWidth()) 466 466 if (RenderObject* cb = isPositioned() ? container() : containingBlock()) { 467 467 if (cb->isBox()) 468 m_imageResource->setImageContainerSize( IntSize(toRenderBox(cb)->availableWidth(), toRenderBox(cb)->availableHeight()));468 m_imageResource->setImageContainerSize(LayoutSize(toRenderBox(cb)->availableWidth(), toRenderBox(cb)->availableHeight())); 469 469 } 470 470 471 int logicalWidth;471 LayoutUnit logicalWidth; 472 472 if (isLogicalWidthSpecified()) 473 473 logicalWidth = computeReplacedLogicalWidthUsing(style()->logicalWidth()); 474 474 else if (m_imageResource->usesImageContainerSize()) { 475 IntSize size = m_imageResource->imageSize(style()->effectiveZoom());475 LayoutSize size = m_imageResource->imageSize(style()->effectiveZoom()); 476 476 logicalWidth = style()->isHorizontalWritingMode() ? size.width() : size.height(); 477 477 } else if (m_imageResource->imageHasRelativeWidth()) … … 483 483 } 484 484 485 int RenderImage::computeReplacedLogicalHeight() const486 { 487 int logicalHeight;485 LayoutUnit RenderImage::computeReplacedLogicalHeight() const 486 { 487 LayoutUnit logicalHeight; 488 488 if (isLogicalHeightSpecified()) 489 489 logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight()); 490 490 else if (m_imageResource->usesImageContainerSize()) { 491 IntSize size = m_imageResource->imageSize(style()->effectiveZoom());491 LayoutSize size = m_imageResource->imageSize(style()->effectiveZoom()); 492 492 logicalHeight = style()->isHorizontalWritingMode() ? size.height() : size.width(); 493 493 } else if (m_imageResource->imageHasRelativeHeight()) -
trunk/Source/WebCore/rendering/RenderImage.h
r90048 r90069 84 84 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction); 85 85 86 virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;87 virtual int computeReplacedLogicalHeight() const;86 virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const; 87 virtual LayoutUnit computeReplacedLogicalHeight() const; 88 88 89 89 IntSize imageSizeForError(CachedImage*) const; -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r89984 r90069 200 200 } 201 201 202 int toAdd = borderAndPaddingWidth();202 LayoutUnit toAdd = borderAndPaddingWidth(); 203 203 m_minPreferredLogicalWidth += toAdd; 204 204 m_maxPreferredLogicalWidth += toAdd; -
trunk/Source/WebCore/rendering/RenderListMarker.cpp
r90048 r90069 1349 1349 // FIXME: This is a somewhat arbitrary width. Generated images for markers really won't become particularly useful 1350 1350 // until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box. 1351 int bulletWidth = fontMetrics.ascent() / 2;1352 m_image->setImageContainerSize( IntSize(bulletWidth, bulletWidth));1353 IntSize imageSize = m_image->imageSize(this, style()->effectiveZoom());1351 LayoutUnit bulletWidth = fontMetrics.ascent() / 2; 1352 m_image->setImageContainerSize(LayoutSize(bulletWidth, bulletWidth)); 1353 LayoutSize imageSize = m_image->imageSize(this, style()->effectiveZoom()); 1354 1354 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = style()->isHorizontalWritingMode() ? imageSize.width() : imageSize.height(); 1355 1355 setPreferredLogicalWidthsDirty(false); … … 1358 1358 } 1359 1359 1360 int logicalWidth = 0;1360 LayoutUnit logicalWidth = 0; 1361 1361 EListStyleType type = style()->listStyleType(); 1362 1362 switch (type) { … … 1453 1453 logicalWidth = 0; 1454 1454 else { 1455 int itemWidth = font.width(m_text);1455 LayoutUnit itemWidth = font.width(m_text); 1456 1456 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()), ' ' }; 1457 int suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, style()));1457 LayoutUnit suffixSpaceWidth = font.width(RenderBlock::constructTextRun(this, font, suffixSpace, 2, style())); 1458 1458 logicalWidth = itemWidth + suffixSpaceWidth; 1459 1459 } -
trunk/Source/WebCore/rendering/RenderMenuList.cpp
r88952 r90069 277 277 } 278 278 279 int toAdd = borderAndPaddingWidth();279 LayoutUnit toAdd = borderAndPaddingWidth(); 280 280 m_minPreferredLogicalWidth += toAdd; 281 281 m_maxPreferredLogicalWidth += toAdd; -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r90068 r90069 253 253 if (heightIsAuto) { 254 254 if (contentRenderer) { 255 int logicalHeight = contentRenderer->computeReplacedLogicalHeightUsing(contentRenderStyle->logicalHeight()); 255 LayoutUnit logicalHeight = contentRenderer->computeReplacedLogicalHeightUsing(contentRenderStyle->logicalHeight()); 256 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 256 257 return contentRenderer->computeReplacedLogicalWidthRespectingMinMaxWidth(static_cast<int>(ceilf(logicalHeight * intrinsicRatio.width() / intrinsicRatio.height()))); 257 258 } 258 259 } else { 259 int logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight()); 260 LayoutUnit logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight()); 261 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 260 262 return computeReplacedLogicalWidthRespectingMinMaxWidth(static_cast<int>(ceilf(logicalHeight * intrinsicRatio.width() / intrinsicRatio.height()))); 261 263 } … … 282 284 283 285 // This solves above equation for 'width' (== logicalWidth). 284 int logicalWidth = foundExplicitWidth ? computeIntrinsicLogicalWidth(containingBlock, false) : containingBlock->availableLogicalWidth();285 int marginStart = style()->marginStart().calcMinValue(logicalWidth);286 int marginEnd = style()->marginEnd().calcMinValue(logicalWidth);286 LayoutUnit logicalWidth = foundExplicitWidth ? computeIntrinsicLogicalWidth(containingBlock, false) : containingBlock->availableLogicalWidth(); 287 LayoutUnit marginStart = style()->marginStart().calcMinValue(logicalWidth); 288 LayoutUnit marginEnd = style()->marginEnd().calcMinValue(logicalWidth); 287 289 logicalWidth = max(0, logicalWidth - (marginStart + marginEnd + (width() - clientWidth()))); 288 290 if (isPercentageIntrinsicSize) 291 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 289 292 logicalWidth = static_cast<int>(ceilf(logicalWidth * intrinsicRatio.width() / 100)); 290 293 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth); … … 342 345 // (used width) / (intrinsic ratio) 343 346 if (!intrinsicRatio.isEmpty() && !isPercentageIntrinsicSize) 347 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 344 348 return computeReplacedLogicalHeightRespectingMinMaxHeight(static_cast<int>(ceilf(availableLogicalWidth() * intrinsicRatio.height() / intrinsicRatio.width()))); 345 349 … … 376 380 ASSERT(preferredLogicalWidthsDirty()); 377 381 378 int borderAndPadding = borderAndPaddingWidth();382 LayoutUnit borderAndPadding = borderAndPaddingWidth(); 379 383 m_maxPreferredLogicalWidth = computeReplacedLogicalWidth(false) + borderAndPadding; 380 384 -
trunk/Source/WebCore/rendering/RenderReplaced.h
r90068 r90069 35 35 virtual void destroy(); 36 36 37 virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;38 virtual int computeReplacedLogicalHeight() const;37 virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const; 38 virtual LayoutUnit computeReplacedLogicalHeight() const; 39 39 40 40 protected: -
trunk/Source/WebCore/rendering/RenderSlider.cpp
r88901 r90069 89 89 } 90 90 91 int toAdd = borderAndPaddingWidth();91 LayoutUnit toAdd = borderAndPaddingWidth(); 92 92 m_minPreferredLogicalWidth += toAdd; 93 93 m_maxPreferredLogicalWidth += toAdd; -
trunk/Source/WebCore/rendering/RenderTable.cpp
r90048 r90069 216 216 RenderBlock* cb = containingBlock(); 217 217 218 int availableLogicalWidth = containingBlockLogicalWidthForContent();218 LayoutUnit availableLogicalWidth = containingBlockLogicalWidthForContent(); 219 219 bool hasPerpendicularContainingBlock = cb->style()->isHorizontalWritingMode() != style()->isHorizontalWritingMode(); 220 int containerWidthInInlineDirection = hasPerpendicularContainingBlock ? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth;220 LayoutUnit containerWidthInInlineDirection = hasPerpendicularContainingBlock ? perpendicularContainingBlockLogicalHeight() : availableLogicalWidth; 221 221 222 222 LengthType logicalWidthType = style()->logicalWidth().type(); … … 227 227 } else { 228 228 // Subtract out any fixed margins from our available width for auto width tables. 229 int marginTotal = 0;229 LayoutUnit marginTotal = 0; 230 230 if (!style()->marginStart().isAuto()) 231 231 marginTotal += style()->marginStart().calcValue(availableLogicalWidth); … … 234 234 235 235 // Subtract out our margins to get the available content width. 236 int availableContentLogicalWidth = max(0, containerWidthInInlineDirection - marginTotal);236 LayoutUnit availableContentLogicalWidth = max(0, containerWidthInInlineDirection - marginTotal); 237 237 238 238 // Ensure we aren't bigger than our max width or smaller than our min width. -
trunk/Source/WebCore/rendering/RenderTextControl.cpp
r89983 r90069 566 566 } 567 567 568 int toAdd = borderAndPaddingWidth();568 LayoutUnit toAdd = borderAndPaddingWidth(); 569 569 570 570 m_minPreferredLogicalWidth += toAdd; -
trunk/Source/WebCore/rendering/RenderVideo.cpp
r89983 r90069 254 254 } 255 255 256 int RenderVideo::computeReplacedLogicalWidth(bool includeMaxWidth) const256 LayoutUnit RenderVideo::computeReplacedLogicalWidth(bool includeMaxWidth) const 257 257 { 258 258 return RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth); 259 259 } 260 260 261 int RenderVideo::computeReplacedLogicalHeight() const261 LayoutUnit RenderVideo::computeReplacedLogicalHeight() const 262 262 { 263 263 return RenderReplaced::computeReplacedLogicalHeight(); -
trunk/Source/WebCore/rendering/RenderVideo.h
r89983 r90069 71 71 virtual void layout(); 72 72 73 virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;74 virtual int computeReplacedLogicalHeight() const;73 virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const; 74 virtual LayoutUnit computeReplacedLogicalHeight() const; 75 75 virtual int minimumReplacedHeight() const; 76 76 -
trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
r89754 r90069 87 87 { 88 88 // FIXME: Investigate in size rounding issues 89 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 89 90 setWidth(static_cast<int>(roundf(m_viewport.width()))); 90 91 } … … 93 94 { 94 95 // FIXME: Investigate in size rounding issues 96 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 95 97 setHeight(static_cast<int>(roundf(m_viewport.height()))); 96 98 } -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r90048 r90069 99 99 ASSERT(preferredLogicalWidthsDirty()); 100 100 101 int borderAndPadding = borderAndPaddingWidth();102 int width = computeReplacedLogicalWidth(false) + borderAndPadding;101 LayoutUnit borderAndPadding = borderAndPaddingWidth(); 102 LayoutUnit width = computeReplacedLogicalWidth(false) + borderAndPadding; 103 103 104 104 if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) … … 114 114 } 115 115 116 int RenderSVGRoot::computeIntrinsicWidth(int replacedWidth) const116 LayoutUnit RenderSVGRoot::computeIntrinsicWidth(LayoutUnit replacedWidth) const 117 117 { 118 118 if (!style()->width().isPercent()) 119 119 return replacedWidth; 120 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 120 121 return static_cast<int>(ceilf(replacedWidth * style()->effectiveZoom())); 121 122 } 122 123 123 int RenderSVGRoot::computeIntrinsicHeight(int replacedHeight) const124 LayoutUnit RenderSVGRoot::computeIntrinsicHeight(LayoutUnit replacedHeight) const 124 125 { 125 126 if (!style()->height().isPercent()) 126 127 return replacedHeight; 128 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 127 129 return static_cast<int>(ceilf(replacedHeight * style()->effectiveZoom())); 128 130 } … … 149 151 } 150 152 151 int RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const152 { 153 int replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth);153 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const 154 { 155 LayoutUnit replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth); 154 156 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0; 155 157 if (!frame) … … 190 192 } 191 193 192 int RenderSVGRoot::computeReplacedLogicalHeight() const193 { 194 int replacedHeight = RenderBox::computeReplacedLogicalHeight();194 LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const 195 { 196 LayoutUnit replacedHeight = RenderBox::computeReplacedLogicalHeight(); 195 197 196 198 Frame* frame = node() && node()->document() ? node()->document()->frame() : 0; … … 229 231 LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayout); 230 232 231 IntSize oldSize(width(), height());233 LayoutSize oldSize(width(), height()); 232 234 negotiateSizeWithHostDocumentIfNeeded(); 233 235 computeLogicalWidth(); -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h
r90048 r90069 49 49 50 50 private: 51 int computeIntrinsicWidth(int replacedWidth) const;52 int computeIntrinsicHeight(int replacedHeight) const;51 LayoutUnit computeIntrinsicWidth(LayoutUnit replacedWidth) const; 52 LayoutUnit computeIntrinsicHeight(LayoutUnit replacedHeight) const; 53 53 void negotiateSizeWithHostDocumentIfNeeded(); 54 54 … … 60 60 61 61 virtual void computePreferredLogicalWidths(); 62 virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;63 virtual int computeReplacedLogicalHeight() const;62 virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const; 63 virtual LayoutUnit computeReplacedLogicalHeight() const; 64 64 virtual void layout(); 65 65 virtual void paint(PaintInfo&, const LayoutPoint&);
Note: See TracChangeset
for help on using the changeset viewer.