Changeset 92712 in webkit
- Timestamp:
- Aug 9, 2011 2:52:39 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r92709 r92712 1 2011-08-09 Emil A Eklund <eae@chromium.org> 2 3 Switch RenderBlock to to new layout types 4 https://bugs.webkit.org/show_bug.cgi?id=65396 5 6 Reviewed by Eric Seidel. 7 8 No new tests, no new functionality. 9 10 * rendering/RenderBlock.cpp: 11 (WebCore::RenderBlock::MarginInfo::MarginInfo): 12 (WebCore::RenderBlock::layoutBlock): 13 (WebCore::RenderBlock::addOverflowFromChildren): 14 (WebCore::RenderBlock::computeOverflow): 15 (WebCore::RenderBlock::adjustPositionedBlock): 16 (WebCore::RenderBlock::adjustFloatingBlock): 17 (WebCore::RenderBlock::collapseMargins): 18 (WebCore::RenderBlock::clearFloatsIfNeeded): 19 (WebCore::RenderBlock::estimateLogicalTopPosition): 20 (WebCore::RenderBlock::determineLogicalLeftPositionForChild): 21 (WebCore::RenderBlock::setLogicalLeftForChild): 22 (WebCore::RenderBlock::setLogicalTopForChild): 23 (WebCore::RenderBlock::layoutBlockChildren): 24 (WebCore::RenderBlock::layoutBlockChild): 25 (WebCore::RenderBlock::flipFloatForWritingMode): 26 (WebCore::RenderBlock::isPointInOverflowControl): 27 (WebCore::RenderBlock::hitTestFloats): 28 * rendering/RenderBlock.h: 29 (WebCore::RenderBlock::logicalTopForFloat): 30 (WebCore::RenderBlock::logicalBottomForFloat): 31 (WebCore::RenderBlock::logicalLeftForFloat): 32 (WebCore::RenderBlock::logicalRightForFloat): 33 (WebCore::RenderBlock::logicalWidthForFloat): 34 (WebCore::RenderBlock::setLogicalTopForFloat): 35 (WebCore::RenderBlock::setLogicalLeftForFloat): 36 (WebCore::RenderBlock::setLogicalHeightForFloat): 37 (WebCore::RenderBlock::setLogicalWidthForFloat): 38 1 39 2011-08-09 Jeffrey Pfau <jpfau@apple.com> 2 40 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r92696 r92712 82 82 83 83 // Our MarginInfo state used when laying out block children. 84 RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int beforeBorderPadding, int afterBorderPadding)84 RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, LayoutUnit beforeBorderPadding, LayoutUnit afterBorderPadding) 85 85 : m_atBeforeSideOfBlock(true) 86 86 , m_atAfterSideOfBlock(false) … … 1167 1167 } 1168 1168 1169 void RenderBlock::layoutBlock(bool relayoutChildren, int pageLogicalHeight, BlockLayoutPass layoutPass)1169 void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight, BlockLayoutPass layoutPass) 1170 1170 { 1171 1171 ASSERT(needsLayout()); … … 1179 1179 LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout()); 1180 1180 1181 int oldWidth = logicalWidth();1182 int oldColumnWidth = desiredColumnWidth();1181 LayoutUnit oldWidth = logicalWidth(); 1182 LayoutUnit oldColumnWidth = desiredColumnWidth(); 1183 1183 1184 1184 computeLogicalWidth(); … … 1197 1197 clearFloats(floatsLayoutPass); 1198 1198 1199 int previousHeight = logicalHeight();1199 LayoutUnit previousHeight = logicalHeight(); 1200 1200 setLogicalHeight(0); 1201 1201 bool hasSpecifiedPageLogicalHeight = false; … … 1260 1260 } 1261 1261 1262 int repaintLogicalTop = 0;1263 int repaintLogicalBottom = 0;1264 int maxFloatLogicalBottom = 0;1262 LayoutUnit repaintLogicalTop = 0; 1263 LayoutUnit repaintLogicalBottom = 0; 1264 LayoutUnit maxFloatLogicalBottom = 0; 1265 1265 if (!firstChild() && !isAnonymousBlock()) 1266 1266 setChildrenInline(true); … … 1271 1271 1272 1272 // Expand our intrinsic height to encompass floats. 1273 int toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight();1273 LayoutUnit toAdd = borderAfter() + paddingAfter() + scrollbarLogicalHeight(); 1274 1274 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEncloseOverhangingFloats()) 1275 1275 setLogicalHeight(lowestFloatLogicalBottom() + toAdd); … … 1279 1279 1280 1280 // Calculate our new height. 1281 int oldHeight = logicalHeight();1282 int oldClientAfterEdge = clientLogicalBottom();1281 LayoutUnit oldHeight = logicalHeight(); 1282 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); 1283 1283 computeLogicalHeight(); 1284 int newHeight = logicalHeight();1284 LayoutUnit newHeight = logicalHeight(); 1285 1285 if (oldHeight != newHeight) { 1286 1286 if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) { … … 1321 1321 // FIXME: We could tighten up the left and right invalidation points if we let layoutInlineChildren fill them in based off the particular lines 1322 1322 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that case either. 1323 int repaintLogicalLeft = logicalLeftVisualOverflow();1324 int repaintLogicalRight = logicalRightVisualOverflow();1323 LayoutUnit repaintLogicalLeft = logicalLeftVisualOverflow(); 1324 LayoutUnit repaintLogicalRight = logicalRightVisualOverflow(); 1325 1325 if (hasOverflowClip()) { 1326 1326 // If we have clipped overflow, we should use layout overflow as well, since visual overflow from lines didn't propagate to our block's overflow. … … 1331 1331 } 1332 1332 1333 IntRect repaintRect;1333 LayoutRect repaintRect; 1334 1334 if (isHorizontalWritingMode()) 1335 repaintRect = IntRect(repaintLogicalLeft, repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop);1335 repaintRect = LayoutRect(repaintLogicalLeft, repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop); 1336 1336 else 1337 repaintRect = IntRect(repaintLogicalTop, repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft);1337 repaintRect = LayoutRect(repaintLogicalTop, repaintLogicalLeft, repaintLogicalBottom - repaintLogicalTop, repaintLogicalRight - repaintLogicalLeft); 1338 1338 1339 1339 // The repaint rect may be split across columns, in which case adjustRectForColumns() will return the union. … … 1352 1352 // Make sure the rect is still non-empty after intersecting for overflow above 1353 1353 if (!repaintRect.isEmpty()) { 1354 // FIXME: Might need rounding once we switch to float, see https://bugs.webkit.org/show_bug.cgi?id=64021 1354 1355 repaintRectangle(repaintRect); // We need to do a partial repaint of our content. 1355 1356 if (hasReflection()) … … 1377 1378 LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1); 1378 1379 if (isHorizontalWritingMode()) { 1379 int overflowLeft = !style()->isLeftToRightDirection() ? min(0, lastRect.x()) : 0;1380 int overflowRight = style()->isLeftToRightDirection() ? max(width(), lastRect.maxX()) : 0;1381 int overflowHeight = borderBefore() + paddingBefore() + colInfo->columnHeight();1382 addLayoutOverflow( IntRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight));1380 LayoutUnit overflowLeft = !style()->isLeftToRightDirection() ? min<LayoutUnit>(0, lastRect.x()) : 0; 1381 LayoutUnit overflowRight = style()->isLeftToRightDirection() ? max(width(), lastRect.maxX()) : 0; 1382 LayoutUnit overflowHeight = borderBefore() + paddingBefore() + colInfo->columnHeight(); 1383 addLayoutOverflow(LayoutRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight)); 1383 1384 if (!hasOverflowClip()) 1384 addVisualOverflow( IntRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight));1385 addVisualOverflow(LayoutRect(overflowLeft, 0, overflowRight - overflowLeft, overflowHeight)); 1385 1386 } else { 1386 1387 LayoutRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1); 1387 int overflowTop = !style()->isLeftToRightDirection() ? min(0, lastRect.y()) : 0;1388 int overflowBottom = style()->isLeftToRightDirection() ? max(height(), lastRect.maxY()) : 0;1389 int overflowWidth = borderBefore() + paddingBefore() + colInfo->columnHeight();1390 addLayoutOverflow( IntRect(0, overflowTop, overflowWidth, overflowBottom - overflowTop));1388 LayoutUnit overflowTop = !style()->isLeftToRightDirection() ? min<LayoutUnit>(0, lastRect.y()) : 0; 1389 LayoutUnit overflowBottom = style()->isLeftToRightDirection() ? max(height(), lastRect.maxY()) : 0; 1390 LayoutUnit overflowWidth = borderBefore() + paddingBefore() + colInfo->columnHeight(); 1391 addLayoutOverflow(LayoutRect(0, overflowTop, overflowWidth, overflowBottom - overflowTop)); 1391 1392 if (!hasOverflowClip()) 1392 addVisualOverflow( IntRect(0, overflowTop, overflowWidth, overflowBottom - overflowTop));1393 addVisualOverflow(LayoutRect(0, overflowTop, overflowWidth, overflowBottom - overflowTop)); 1393 1394 } 1394 1395 } … … 1396 1397 } 1397 1398 1398 void RenderBlock::computeOverflow( int oldClientAfterEdge, bool recomputeFloats)1399 void RenderBlock::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats) 1399 1400 { 1400 1401 // Add overflow from children. … … 1411 1412 // and bottom padding. Set the axis we don't care about to be 1, since we want this overflow to always 1412 1413 // be considered reachable. 1413 IntRect clientRect(clientBoxRect());1414 IntRect rectToApply;1414 LayoutRect clientRect(clientBoxRect()); 1415 LayoutRect rectToApply; 1415 1416 if (isHorizontalWritingMode()) 1416 rectToApply = IntRect(clientRect.x(), clientRect.y(), 1, max(0, oldClientAfterEdge - clientRect.y()));1417 rectToApply = LayoutRect(clientRect.x(), clientRect.y(), 1, max(0, oldClientAfterEdge - clientRect.y())); 1417 1418 else 1418 rectToApply = IntRect(clientRect.x(), clientRect.y(), max(0, oldClientAfterEdge - clientRect.x()), 1);1419 rectToApply = LayoutRect(clientRect.x(), clientRect.y(), max(0, oldClientAfterEdge - clientRect.x()), 1); 1419 1420 addLayoutOverflow(rectToApply); 1420 1421 } … … 1477 1478 childLayer->setStaticInlinePosition(borderAndPaddingStart()); 1478 1479 1479 int logicalTop = logicalHeight();1480 LayoutUnit logicalTop = logicalHeight(); 1480 1481 if (!marginInfo.canCollapseWithMarginBefore()) { 1481 1482 child->computeBlockDirectionMargins(this); 1482 int marginBefore = marginBeforeForChild(child);1483 int collapsedBeforePos = marginInfo.positiveMargin();1484 int collapsedBeforeNeg = marginInfo.negativeMargin();1483 LayoutUnit marginBefore = marginBeforeForChild(child); 1484 LayoutUnit collapsedBeforePos = marginInfo.positiveMargin(); 1485 LayoutUnit collapsedBeforeNeg = marginInfo.negativeMargin(); 1485 1486 if (marginBefore > 0) { 1486 1487 if (marginBefore > collapsedBeforePos) … … 1514 1515 // http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/046.html for 1515 1516 // an example of this scenario. 1516 int marginOffset = marginInfo.canCollapseWithMarginBefore() ? 0 : marginInfo.margin();1517 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? 0 : marginInfo.margin(); 1517 1518 setLogicalHeight(logicalHeight() + marginOffset); 1518 1519 positionNewFloats(); … … 1610 1611 } 1611 1612 1612 int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)1613 LayoutUnit RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo) 1613 1614 { 1614 1615 // Get the four margin values for the child and cache them. … … 1616 1617 1617 1618 // Get our max pos and neg top margins. 1618 int posTop = childMargins.positiveMarginBefore();1619 int negTop = childMargins.negativeMarginBefore();1619 LayoutUnit posTop = childMargins.positiveMarginBefore(); 1620 LayoutUnit negTop = childMargins.negativeMarginBefore(); 1620 1621 1621 1622 // For self-collapsing blocks, collapse our bottom margins into our … … 1658 1659 marginInfo.setMarginBeforeQuirk(topQuirk); 1659 1660 1660 int beforeCollapseLogicalTop = logicalHeight();1661 int logicalTop = beforeCollapseLogicalTop;1661 LayoutUnit beforeCollapseLogicalTop = logicalHeight(); 1662 LayoutUnit logicalTop = beforeCollapseLogicalTop; 1662 1663 if (child->isSelfCollapsingBlock()) { 1663 1664 // This child has no height. We need to compute our 1664 1665 // position before we collapse the child's margins together, 1665 1666 // so that we can get an accurate position for the zero-height block. 1666 int collapsedBeforePos = max(marginInfo.positiveMargin(), childMargins.positiveMarginBefore());1667 int collapsedBeforeNeg = max(marginInfo.negativeMargin(), childMargins.negativeMarginBefore());1667 LayoutUnit collapsedBeforePos = max(marginInfo.positiveMargin(), childMargins.positiveMarginBefore()); 1668 LayoutUnit collapsedBeforeNeg = max(marginInfo.negativeMargin(), childMargins.negativeMarginBefore()); 1668 1669 marginInfo.setMargin(collapsedBeforePos, collapsedBeforeNeg); 1669 1670 … … 1705 1706 LayoutState* layoutState = view()->layoutState(); 1706 1707 if (layoutState->isPaginated() && layoutState->pageLogicalHeight() && logicalTop > beforeCollapseLogicalTop) { 1707 int oldLogicalTop = logicalTop;1708 LayoutUnit oldLogicalTop = logicalTop; 1708 1709 logicalTop = min(logicalTop, nextPageLogicalTopExcludingBoundaryPoint(beforeCollapseLogicalTop)); 1709 1710 setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); … … 1712 1713 } 1713 1714 1714 int RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, int oldTopPosMargin, int oldTopNegMargin, int yPos)1715 { 1716 int heightIncrease = getClearDelta(child, yPos);1715 LayoutUnit RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, int oldTopPosMargin, int oldTopNegMargin, int yPos) 1716 { 1717 LayoutUnit heightIncrease = getClearDelta(child, yPos); 1717 1718 if (!heightIncrease) 1718 1719 return yPos; … … 1743 1744 // Adjust our height such that we are ready to be collapsed with subsequent siblings (or the bottom 1744 1745 // of the parent block). 1745 setLogicalHeight(child->y() - max (0, marginInfo.margin()));1746 setLogicalHeight(child->y() - max<LayoutUnit>(0, marginInfo.margin())); 1746 1747 } else 1747 1748 // Increase our height by the amount we had to clear. … … 1761 1762 } 1762 1763 1763 int RenderBlock::estimateLogicalTopPosition(RenderBox* child, const MarginInfo& marginInfo)1764 LayoutUnit RenderBlock::estimateLogicalTopPosition(RenderBox* child, const MarginInfo& marginInfo) 1764 1765 { 1765 1766 // FIXME: We need to eliminate the estimation of vertical position, because when it's wrong we sometimes trigger a pathological 1766 1767 // relayout if there are intruding floats. 1767 int logicalTopEstimate = logicalHeight();1768 LayoutUnit logicalTopEstimate = logicalHeight(); 1768 1769 if (!marginInfo.canCollapseWithMarginBefore()) { 1769 int childMarginBefore = child->selfNeedsLayout() ? marginBeforeForChild(child) : collapsedMarginBeforeForChild(child);1770 LayoutUnit childMarginBefore = child->selfNeedsLayout() ? marginBeforeForChild(child) : collapsedMarginBeforeForChild(child); 1770 1771 logicalTopEstimate += max(marginInfo.margin(), childMarginBefore); 1771 1772 } … … 1795 1796 void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child) 1796 1797 { 1797 int startPosition = borderStart() + paddingStart();1798 int totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth();1798 LayoutUnit startPosition = borderStart() + paddingStart(); 1799 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth(); 1799 1800 1800 1801 // Add in our start margin. 1801 int childMarginStart = marginStartForChild(child);1802 int newPosition = startPosition + childMarginStart;1802 LayoutUnit childMarginStart = marginStartForChild(child); 1803 LayoutUnit newPosition = startPosition + childMarginStart; 1803 1804 1804 1805 // Some objects (e.g., tables, horizontal rules, overflow:auto blocks) avoid floats. They need 1805 1806 // to shift over as necessary to dodge any floats that might get in the way. 1806 1807 if (child->avoidsFloats()) { 1807 int startOff = style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(logicalHeight(), false) : totalAvailableLogicalWidth - logicalRightOffsetForLine(logicalHeight(), false);1808 LayoutUnit startOff = style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(logicalHeight(), false) : totalAvailableLogicalWidth - logicalRightOffsetForLine(logicalHeight(), false); 1808 1809 if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsing(style()).isAuto()) { 1809 1810 if (childMarginStart < 0) 1810 1811 startOff += childMarginStart; 1811 1812 newPosition = max(newPosition, startOff); // Let the float sit in the child's margin if it can fit. 1813 // FIXME: Needs to use epsilon once we switch to float, see https://bugs.webkit.org/show_bug.cgi?id=64021 1812 1814 } else if (startOff != startPosition) { 1813 1815 // The object is shifting to the "end" side of the block. The object might be centered, so we need to … … 1862 1864 } 1863 1865 1864 void RenderBlock::setLogicalLeftForChild(RenderBox* child, int logicalLeft, ApplyLayoutDeltaMode applyDelta)1866 void RenderBlock::setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft, ApplyLayoutDeltaMode applyDelta) 1865 1867 { 1866 1868 if (isHorizontalWritingMode()) { 1867 1869 if (applyDelta == ApplyLayoutDelta) 1868 view()->addLayoutDelta( IntSize(child->x() - logicalLeft, 0));1870 view()->addLayoutDelta(LayoutSize(child->x() - logicalLeft, 0)); 1869 1871 child->setX(logicalLeft); 1870 1872 } else { 1871 1873 if (applyDelta == ApplyLayoutDelta) 1872 view()->addLayoutDelta( IntSize(0, child->y() - logicalLeft));1874 view()->addLayoutDelta(LayoutSize(0, child->y() - logicalLeft)); 1873 1875 child->setY(logicalLeft); 1874 1876 } 1875 1877 } 1876 1878 1877 void RenderBlock::setLogicalTopForChild(RenderBox* child, int logicalTop, ApplyLayoutDeltaMode applyDelta)1879 void RenderBlock::setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop, ApplyLayoutDeltaMode applyDelta) 1878 1880 { 1879 1881 if (isHorizontalWritingMode()) { 1880 1882 if (applyDelta == ApplyLayoutDelta) 1881 view()->addLayoutDelta( IntSize(0, child->y() - logicalTop));1883 view()->addLayoutDelta(LayoutSize(0, child->y() - logicalTop)); 1882 1884 child->setY(logicalTop); 1883 1885 } else { 1884 1886 if (applyDelta == ApplyLayoutDelta) 1885 view()->addLayoutDelta( IntSize(child->x() - logicalTop, 0));1887 view()->addLayoutDelta(LayoutSize(child->x() - logicalTop, 0)); 1886 1888 child->setX(logicalTop); 1887 1889 } 1888 1890 } 1889 1891 1890 void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatLogicalBottom)1892 void RenderBlock::layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom) 1891 1893 { 1892 1894 if (gPercentHeightDescendantsMap) { … … 1908 1910 } 1909 1911 1910 int beforeEdge = borderBefore() + paddingBefore();1911 int afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeight();1912 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); 1913 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeight(); 1912 1914 1913 1915 setLogicalHeight(beforeEdge); … … 1921 1923 RenderObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren); 1922 1924 1923 int previousFloatLogicalBottom = 0;1925 LayoutUnit previousFloatLogicalBottom = 0; 1924 1926 maxFloatLogicalBottom = 0; 1925 1927 … … 1957 1959 } 1958 1960 1959 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int& previousFloatLogicalBottom, int& maxFloatLogicalBottom)1960 { 1961 int oldPosMarginBefore = maxPositiveMarginBefore();1962 int oldNegMarginBefore = maxNegativeMarginBefore();1961 void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom) 1962 { 1963 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); 1964 LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore(); 1963 1965 1964 1966 // The child is a normal flow object. Compute the margins we will use for collapsing now. … … 1974 1976 // be correct. Only if we're wrong (when we compute the real logical top position) 1975 1977 // will we have to potentially relayout. 1976 int logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo);1978 LayoutUnit logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo); 1977 1979 1978 1980 // Cache our old rect so that we can dirty the proper repaint rects if the child moves. 1979 IntRect oldRect(child->x(), child->y() , child->width(), child->height());1980 int oldLogicalTop = logicalTopForChild(child);1981 LayoutRect oldRect(child->x(), child->y() , child->width(), child->height()); 1982 LayoutUnit oldLogicalTop = logicalTopForChild(child); 1981 1983 1982 1984 #ifndef NDEBUG 1983 IntSize oldLayoutDelta = view()->layoutDelta();1985 LayoutSize oldLayoutDelta = view()->layoutDelta(); 1984 1986 #endif 1985 1987 // Go ahead and position the child as though it didn't collapse with the top. … … 1993 1995 // If an element might be affected by the presence of floats, then always mark it for 1994 1996 // layout. 1995 int fb = max(previousFloatLogicalBottom, lowestFloatLogicalBottomIncludingPositionedFloats());1997 LayoutUnit fb = max(previousFloatLogicalBottom, lowestFloatLogicalBottomIncludingPositionedFloats()); 1996 1998 if (fb > logicalTopEstimate) 1997 1999 markDescendantsWithFloats = true; … … 2018 2020 // Now determine the correct ypos based off examination of collapsing margin 2019 2021 // values. 2020 int logicalTopBeforeClear = collapseMargins(child, marginInfo);2022 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo); 2021 2023 2022 2024 // Now check for clear. 2023 int logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, oldPosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear);2025 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, oldPosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear); 2024 2026 2025 2027 bool paginated = view()->layoutState()->isPaginated(); 2026 2028 if (paginated) { 2027 int oldTop = logicalTopAfterClear;2029 LayoutUnit oldTop = logicalTopAfterClear; 2028 2030 2029 2031 // If the object has a page or column break value of "before", then we should shift to the top of the next page. … … 2031 2033 2032 2034 // For replaced elements and scrolled elements, we want to shift them to the next page if they don't fit on the current one. 2033 int logicalTopBeforeUnsplittableAdjustment = logicalTopAfterClear;2034 int logicalTopAfterUnsplittableAdjustment = adjustForUnsplittableChild(child, logicalTopAfterClear);2035 LayoutUnit logicalTopBeforeUnsplittableAdjustment = logicalTopAfterClear; 2036 LayoutUnit logicalTopAfterUnsplittableAdjustment = adjustForUnsplittableChild(child, logicalTopAfterClear); 2035 2037 2036 int paginationStrut = 0;2037 int unsplittableAdjustmentDelta = logicalTopAfterUnsplittableAdjustment - logicalTopBeforeUnsplittableAdjustment;2038 LayoutUnit paginationStrut = 0; 2039 LayoutUnit unsplittableAdjustmentDelta = logicalTopAfterUnsplittableAdjustment - logicalTopBeforeUnsplittableAdjustment; 2038 2040 if (unsplittableAdjustmentDelta) 2039 2041 paginationStrut = unsplittableAdjustmentDelta; … … 2100 2102 maxFloatLogicalBottom = max(maxFloatLogicalBottom, addOverhangingFloats(toRenderBlock(child), -child->logicalLeft(), -child->logicalTop(), !childNeededLayout)); 2101 2103 2102 IntSize childOffset(child->x() - oldRect.x(), child->y() - oldRect.y());2104 LayoutSize childOffset(child->x() - oldRect.x(), child->y() - oldRect.y()); 2103 2105 if (childOffset.width() || childOffset.height()) { 2104 2106 view()->addLayoutDelta(childOffset); … … 2118 2120 if (paginated) { 2119 2121 // Check for an after page/column break. 2120 int newHeight = applyAfterBreak(child, logicalHeight(), marginInfo);2122 LayoutUnit newHeight = applyAfterBreak(child, logicalHeight(), marginInfo); 2121 2123 if (newHeight != height()) 2122 2124 setLogicalHeight(newHeight); 2123 2125 } 2124 2126 2127 // FIXME: Needs to use epsilon once we move to float, see https://bugs.webkit.org/show_bug.cgi?id=64021 2125 2128 ASSERT(oldLayoutDelta == view()->layoutDelta()); 2126 2129 } … … 2610 2613 } 2611 2614 2612 IntPoint RenderBlock::flipFloatForWritingMode(const FloatingObject* child, const IntPoint& point) const2615 LayoutPoint RenderBlock::flipFloatForWritingMode(const FloatingObject* child, const LayoutPoint& point) const 2613 2616 { 2614 2617 if (!style()->isFlippedBlocksWritingMode()) … … 2619 2622 // case. 2620 2623 if (isHorizontalWritingMode()) 2621 return IntPoint(point.x(), point.y() + height() - child->renderer()->height() - 2 * yPositionForFloatIncludingMargin(child));2622 return IntPoint(point.x() + width() - child->width() - 2 * xPositionForFloatIncludingMargin(child), point.y());2624 return LayoutPoint(point.x(), point.y() + height() - child->renderer()->height() - 2 * yPositionForFloatIncludingMargin(child)); 2625 return LayoutPoint(point.x() + width() - child->width() - 2 * xPositionForFloatIncludingMargin(child), point.y()); 2623 2626 } 2624 2627 … … 4009 4012 return false; 4010 4013 4011 return layer()->hitTestOverflowControls(result, pointInContainer - to Size(accumulatedOffset));4014 return layer()->hitTestOverflowControls(result, pointInContainer - toLayoutSize(accumulatedOffset)); 4012 4015 } 4013 4016 … … 4078 4081 LayoutPoint adjustedLocation = accumulatedOffset; 4079 4082 if (isRenderView()) { 4080 adjustedLocation += to Size(toRenderView(this)->frameView()->scrollPosition());4083 adjustedLocation += toLayoutSize(toRenderView(this)->frameView()->scrollPosition()); 4081 4084 } 4082 4085 -
trunk/Source/WebCore/rendering/RenderBlock.h
r92696 r92712 98 98 99 99 enum BlockLayoutPass { NormalLayoutPass, PositionedFloatLayoutPass }; 100 virtual void layoutBlock(bool relayoutChildren, int pageLogicalHeight = 0, BlockLayoutPass = NormalLayoutPass);100 virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0, BlockLayoutPass = NormalLayoutPass); 101 101 102 102 void insertPositionedObject(RenderBox*); … … 208 208 int logicalTopForChild(RenderBox* child) { return isHorizontalWritingMode() ? child->y() : child->x(); } 209 209 int logicalLeftForChild(RenderBox* child) { return isHorizontalWritingMode() ? child->x() : child->y(); } 210 void setLogicalLeftForChild(RenderBox* child, int logicalLeft, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);211 void setLogicalTopForChild(RenderBox* child, int logicalTop, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);210 void setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta); 211 void setLogicalTopForChild(RenderBox* child, LayoutUnit logicalTop, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta); 212 212 LayoutUnit marginBeforeForChild(RenderBoxModelObject* child) const; 213 213 LayoutUnit marginAfterForChild(RenderBoxModelObject* child) const; … … 343 343 void simplifiedNormalFlowLayout(); 344 344 345 void computeOverflow( int oldClientAfterEdge, bool recomputeFloats = false);345 void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false); 346 346 virtual void addOverflowFromChildren(); 347 347 void addOverflowFromFloats(); … … 389 389 virtual void repaintOverhangingFloats(bool paintAllDescendants); 390 390 391 void layoutBlockChildren(bool relayoutChildren, int& maxFloatLogicalBottom);391 void layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom); 392 392 void layoutInlineChildren(bool relayoutChildren, int& repaintLogicalTop, int& repaintLogicalBottom); 393 393 BidiRun* handleTrailingSpaces(BidiRunList<BidiRun>&, BidiContext*); … … 496 496 }; 497 497 498 IntPoint flipFloatForWritingMode(const FloatingObject*, const IntPoint&) const;499 500 int logicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() : child->x(); }501 int logicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxY() : child->maxX(); }502 int logicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->x() : child->y(); }503 int logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); }504 int logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); }505 void setLogicalTopForFloat(FloatingObject* child, int logicalTop)498 LayoutPoint flipFloatForWritingMode(const FloatingObject*, const LayoutPoint&) const; 499 500 LayoutUnit logicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() : child->x(); } 501 LayoutUnit logicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxY() : child->maxX(); } 502 LayoutUnit logicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->x() : child->y(); } 503 LayoutUnit logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); } 504 LayoutUnit logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); } 505 void setLogicalTopForFloat(FloatingObject* child, LayoutUnit logicalTop) 506 506 { 507 507 if (isHorizontalWritingMode()) … … 510 510 child->setX(logicalTop); 511 511 } 512 void setLogicalLeftForFloat(FloatingObject* child, int logicalLeft)512 void setLogicalLeftForFloat(FloatingObject* child, LayoutUnit logicalLeft) 513 513 { 514 514 if (isHorizontalWritingMode()) … … 517 517 child->setY(logicalLeft); 518 518 } 519 void setLogicalHeightForFloat(FloatingObject* child, int logicalHeight)519 void setLogicalHeightForFloat(FloatingObject* child, LayoutUnit logicalHeight) 520 520 { 521 521 if (isHorizontalWritingMode()) … … 524 524 child->setWidth(logicalHeight); 525 525 } 526 void setLogicalWidthForFloat(FloatingObject* child, int logicalWidth)526 void setLogicalWidthForFloat(FloatingObject* child, LayoutUnit logicalWidth) 527 527 { 528 528 if (isHorizontalWritingMode()) … … 743 743 744 744 public: 745 MarginInfo(RenderBlock* b, int beforeBorderPadding, int afterBorderPadding);745 MarginInfo(RenderBlock*, LayoutUnit beforeBorderPadding, LayoutUnit afterBorderPadding); 746 746 747 747 void setAtBeforeSideOfBlock(bool b) { m_atBeforeSideOfBlock = b; } … … 772 772 }; 773 773 774 void layoutBlockChild(RenderBox* child, MarginInfo&, int& previousFloatLogicalBottom, int& maxFloatLogicalBottom);774 void layoutBlockChild(RenderBox* child, MarginInfo&, LayoutUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom); 775 775 void adjustPositionedBlock(RenderBox* child, const MarginInfo&); 776 776 void adjustFloatingBlock(const MarginInfo&); … … 779 779 bool handlePositionedChild(RenderBox* child, const MarginInfo&); 780 780 bool handleRunInChild(RenderBox* child); 781 int collapseMargins(RenderBox* child, MarginInfo&);782 int clearFloatsIfNeeded(RenderBox* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin, int yPos);783 int estimateLogicalTopPosition(RenderBox* child, const MarginInfo&);781 LayoutUnit collapseMargins(RenderBox* child, MarginInfo&); 782 LayoutUnit clearFloatsIfNeeded(RenderBox* child, MarginInfo&, int oldTopPosMargin, int oldTopNegMargin, int yPos); 783 LayoutUnit estimateLogicalTopPosition(RenderBox* child, const MarginInfo&); 784 784 void determineLogicalLeftPositionForChild(RenderBox* child); 785 785 void handleAfterSideOfBlock(int top, int bottom, MarginInfo&);
Note: See TracChangeset
for help on using the changeset viewer.