Changeset 151575 in webkit
- Timestamp:
- Jun 13, 2013, 5:39:36 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r151572 r151575 1 2013-06-13 Zoltan Horvath <zoltan@webkit.org> 2 3 Use borderAndPadding[Before,After]() instead of border[Before,After]() + padding[Before,After]() 4 https://bugs.webkit.org/show_bug.cgi?id=117611 5 6 Reviewed by Dirk Schulze. 7 8 I added a new function called borderAndPaddingAfter(), since we already had borderAndPaddingBefore(). I changed 9 every separate additions to the old/new function. This change makes the code shorter and more straightforward. 10 11 Behavior hasn't changed, no new tests were needed. 12 13 * rendering/InlineFlowBox.cpp: 14 (WebCore::InlineFlowBox::placeBoxesInBlockDirection): 15 * rendering/RenderBlock.cpp: 16 (WebCore::RenderBlock::layoutBlock): 17 (WebCore::RenderBlock::marginBeforeEstimateForChild): 18 (WebCore::RenderBlock::layoutBlockChildren): 19 (WebCore::RenderBlock::paintColumnRules): 20 (WebCore::RenderBlock::columnRectAt): 21 (WebCore::RenderBlock::relayoutForPagination): 22 (WebCore::RenderBlock::adjustRectForColumns): 23 (WebCore::RenderBlock::flipForWritingModeIncludingColumns): 24 (WebCore::RenderBlock::adjustStartEdgeForWritingModeIncludingColumns): 25 (WebCore::RenderBlock::adjustForColumns): 26 * rendering/RenderBlockLineLayout.cpp: 27 (WebCore::RenderBlock::updateShapeAndSegmentsForCurrentLineInFlowThread): 28 (WebCore::RenderBlock::layoutInlineChildren): 29 * rendering/RenderBoxModelObject.h: 30 (WebCore::RenderBoxModelObject::borderAndPaddingStart): 31 (WebCore::RenderBoxModelObject::borderAndPaddingBefore): 32 (WebCore::RenderBoxModelObject::borderAndPaddingAfter): 33 (WebCore::RenderBoxModelObject::borderAndPaddingLogicalHeight): 34 * rendering/RenderMultiColumnBlock.cpp: 35 (WebCore::RenderMultiColumnBlock::layoutSpecialExcludedChild): 36 * rendering/RenderMultiColumnSet.cpp: 37 (WebCore::RenderMultiColumnSet::heightAdjustedForSetOffset): 38 (WebCore::RenderMultiColumnSet::prepareForLayout): 39 (WebCore::RenderMultiColumnSet::columnRectAt): 40 * rendering/RenderTableCell.cpp: 41 (WebCore::RenderTableCell::computeIntrinsicPadding): 42 (WebCore::RenderTableCell::cellBaselinePosition): 43 * rendering/RenderTableSection.cpp: 44 (WebCore::RenderTableSection::calcRowLogicalHeight): 45 (WebCore::RenderTableSection::layoutRows): 46 (WebCore::RenderTableSection::firstLineBoxBaseline): 47 * rendering/RootInlineBox.cpp: 48 (WebCore::RootInlineBox::lineSnapAdjustment): 49 (WebCore::RootInlineBox::selectionTop): 50 (WebCore::RootInlineBox::ascentAndDescentForBox): 51 1 52 2013-06-13 Andreas Kling <akling@apple.com> 2 53 -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r150355 r151575 628 628 adjustmentForChildrenWithSameLineHeightAndBaseline = logicalTop(); 629 629 if (parent()) 630 adjustmentForChildrenWithSameLineHeightAndBaseline += (boxModelObject()->border Before() + boxModelObject()->paddingBefore());630 adjustmentForChildrenWithSameLineHeightAndBaseline += (boxModelObject()->borderAndPaddingBefore()); 631 631 } 632 632 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r151545 r151575 1653 1653 1654 1654 // Expand our intrinsic height to encompass floats. 1655 LayoutUnit toAdd = borderA fter() + paddingAfter() + scrollbarLogicalHeight();1655 LayoutUnit toAdd = borderAndPaddingAfter() + scrollbarLogicalHeight(); 1656 1656 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && expandsToEncloseOverhangingFloats()) 1657 1657 setLogicalHeight(lowestFloatLogicalBottom() + toAdd); … … 2313 2313 return; 2314 2314 2315 MarginInfo childMarginInfo(childBlock, childBlock->border Before() + childBlock->paddingBefore(), childBlock->borderAfter() + childBlock->paddingAfter());2315 MarginInfo childMarginInfo(childBlock, childBlock->borderAndPaddingBefore(), childBlock->borderAndPaddingAfter()); 2316 2316 if (!childMarginInfo.canCollapseMarginBeforeWithChildren()) 2317 2317 return; … … 2538 2538 } 2539 2539 2540 LayoutUnit beforeEdge = border Before() + paddingBefore();2541 LayoutUnit afterEdge = borderA fter() + paddingAfter() + scrollbarLogicalHeight();2540 LayoutUnit beforeEdge = borderAndPaddingBefore(); 2541 LayoutUnit afterEdge = borderAndPaddingAfter() + scrollbarLogicalHeight(); 2542 2542 2543 2543 setLogicalHeight(beforeEdge); … … 3036 3036 LayoutUnit ruleLeft = isHorizontalWritingMode() 3037 3037 ? borderLeft() + paddingLeft() 3038 : colGap / 2 - colGap - ruleThickness / 2 + (!colInfo->progressionIsReversed() ? border Before() + paddingBefore() : borderAfter() + paddingAfter());3038 : colGap / 2 - colGap - ruleThickness / 2 + (!colInfo->progressionIsReversed() ? borderAndPaddingBefore() : borderAndPaddingAfter()); 3039 3039 LayoutUnit ruleWidth = isHorizontalWritingMode() ? contentWidth() : ruleThickness; 3040 3040 LayoutUnit ruleTop = isHorizontalWritingMode() 3041 ? colGap / 2 - colGap - ruleThickness / 2 + (!colInfo->progressionIsReversed() ? border Before() + paddingBefore() : borderAfter() + paddingAfter())3041 ? colGap / 2 - colGap - ruleThickness / 2 + (!colInfo->progressionIsReversed() ? borderAndPaddingBefore() : borderAndPaddingAfter()) 3042 3042 : borderStart() + paddingStart(); 3043 3043 LayoutUnit ruleHeight = isHorizontalWritingMode() ? ruleThickness : contentHeight(); … … 5583 5583 LayoutUnit colLogicalWidth = colInfo->desiredColumnWidth(); 5584 5584 LayoutUnit colLogicalHeight = colInfo->columnHeight(); 5585 LayoutUnit colLogicalTop = border Before() + paddingBefore();5585 LayoutUnit colLogicalTop = borderAndPaddingBefore(); 5586 5586 LayoutUnit colLogicalLeft = logicalLeftOffsetForContent(); 5587 5587 LayoutUnit colGap = columnGap(); … … 5613 5613 else 5614 5614 addOverflowFromBlockChildren(); 5615 LayoutUnit layoutOverflowLogicalBottom = (isHorizontalWritingMode() ? layoutOverflowRect().maxY() : layoutOverflowRect().maxX()) - border Before() - paddingBefore();5615 LayoutUnit layoutOverflowLogicalBottom = (isHorizontalWritingMode() ? layoutOverflowRect().maxY() : layoutOverflowRect().maxX()) - borderAndPaddingBefore(); 5616 5616 5617 5617 // FIXME: We don't balance properly at all in the presence of forced page breaks. We need to understand what … … 5627 5627 if (!pageLogicalHeight) { 5628 5628 LayoutUnit distanceBetweenBreaks = max<LayoutUnit>(colInfo->maximumDistanceBetweenForcedBreaks(), 5629 view()->layoutState()->pageLogicalOffset(this, borderBefore() + paddingBefore() + layoutOverflowLogicalBottom) - colInfo->forcedBreakOffset());5629 view()->layoutState()->pageLogicalOffset(this, borderAndPaddingBefore() + layoutOverflowLogicalBottom) - colInfo->forcedBreakOffset()); 5630 5630 columnHeight = max(colInfo->minimumColumnHeight(), distanceBetweenBreaks); 5631 5631 } … … 5647 5647 5648 5648 if (columnCount(colInfo)) { 5649 setLogicalHeight(border Before() + paddingBefore() + colInfo->columnHeight() + borderAfter() + paddingAfter() + scrollbarLogicalHeight());5649 setLogicalHeight(borderAndPaddingBefore() + colInfo->columnHeight() + borderAndPaddingAfter() + scrollbarLogicalHeight()); 5650 5650 m_overflow.clear(); 5651 5651 } else … … 5759 5759 5760 5760 bool isHorizontal = isHorizontalWritingMode(); 5761 LayoutUnit beforeBorderPadding = border Before() + paddingBefore();5761 LayoutUnit beforeBorderPadding = borderAndPaddingBefore(); 5762 5762 LayoutUnit colHeight = colInfo->columnHeight(); 5763 5763 if (!colHeight) … … 5808 5808 ColumnInfo* colInfo = columnInfo(); 5809 5809 LayoutUnit columnLogicalHeight = colInfo->columnHeight(); 5810 LayoutUnit expandedLogicalHeight = border Before() + paddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollbarLogicalHeight();5810 LayoutUnit expandedLogicalHeight = borderAndPaddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAndPaddingAfter() + scrollbarLogicalHeight(); 5811 5811 if (isHorizontalWritingMode()) 5812 5812 return LayoutPoint(point.x(), expandedLogicalHeight - point.y()); … … 5822 5822 ColumnInfo* colInfo = columnInfo(); 5823 5823 LayoutUnit columnLogicalHeight = colInfo->columnHeight(); 5824 LayoutUnit expandedLogicalHeight = border Before() + paddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAfter() + paddingAfter() + scrollbarLogicalHeight();5824 LayoutUnit expandedLogicalHeight = borderAndPaddingBefore() + columnCount(colInfo) * columnLogicalHeight + borderAndPaddingAfter() + scrollbarLogicalHeight(); 5825 5825 5826 5826 if (isHorizontalWritingMode()) … … 5844 5844 for (unsigned i = 0; i < colCount; ++i) { 5845 5845 // Compute the edges for a given column in the block progression direction. 5846 LayoutRect sliceRect = LayoutRect(logicalLeft, border Before() + paddingBefore() + i * colLogicalHeight, colLogicalWidth, colLogicalHeight);5846 LayoutRect sliceRect = LayoutRect(logicalLeft, borderAndPaddingBefore() + i * colLogicalHeight, colLogicalWidth, colLogicalHeight); 5847 5847 if (!isHorizontalWritingMode()) 5848 5848 sliceRect = sliceRect.transposedRect(); … … 5856 5856 offset.expand(columnRectAt(colInfo, i).x() - logicalLeft, -logicalOffset); 5857 5857 else 5858 offset.expand(0, columnRectAt(colInfo, i).y() - logicalOffset - border Before() - paddingBefore());5858 offset.expand(0, columnRectAt(colInfo, i).y() - logicalOffset - borderAndPaddingBefore()); 5859 5859 return; 5860 5860 } … … 5864 5864 offset.expand(-logicalOffset, columnRectAt(colInfo, i).y() - logicalLeft); 5865 5865 else 5866 offset.expand(columnRectAt(colInfo, i).x() - logicalOffset - border Before() - paddingBefore(), 0);5866 offset.expand(columnRectAt(colInfo, i).x() - logicalOffset - borderAndPaddingBefore(), 0); 5867 5867 return; 5868 5868 } -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r151570 r151575 1688 1688 LayoutUnit logicalLineBottomInFlowThread = logicalLineTopInFlowThread + lineHeight; 1689 1689 LayoutUnit logicalRegionTopInFlowThread = currentRegion->logicalTopForFlowThreadContent(); 1690 LayoutUnit logicalRegionBottomInFlowThread = logicalRegionTopInFlowThread + currentRegion->logicalHeight() - currentRegion->borderAndPaddingBefore() - currentRegion->borderA fter() - currentRegion->paddingAfter();1690 LayoutUnit logicalRegionBottomInFlowThread = logicalRegionTopInFlowThread + currentRegion->logicalHeight() - currentRegion->borderAndPaddingBefore() - currentRegion->borderAndPaddingAfter(); 1691 1691 1692 1692 // We only want to deal regions with shapes, so we look up for the next region whether it has a shape … … 1718 1718 logicalLineBottomInFlowThread = logicalLineTopInFlowThread + lineHeight; 1719 1719 logicalRegionTopInFlowThread = currentRegion->logicalTopForFlowThreadContent(); 1720 logicalRegionBottomInFlowThread = logicalRegionTopInFlowThread + currentRegion->logicalHeight() - currentRegion->borderAndPaddingBefore() - currentRegion->borderA fter() - currentRegion->paddingAfter();1720 logicalRegionBottomInFlowThread = logicalRegionTopInFlowThread + currentRegion->logicalHeight() - currentRegion->borderAndPaddingBefore() - currentRegion->borderAndPaddingAfter(); 1721 1721 } 1722 1722 … … 1744 1744 if (currentRegion->isLastRegion() && !lineOverflowsFromShapeInside && (lineTop + lineHeight) > shapeInsideInfo->shapeLogicalBottom()) { 1745 1745 lineOverflowsFromShapeInside = true; 1746 LayoutUnit newLogicalHeight = this->logicalHeight() + (shapeInsideInfo->shapeContainingBlockHeight() - (lineTop + currentRegion->borderA fter() + currentRegion->paddingAfter()));1746 LayoutUnit newLogicalHeight = this->logicalHeight() + (shapeInsideInfo->shapeContainingBlockHeight() - (lineTop + currentRegion->borderAndPaddingAfter())); 1747 1747 setLogicalHeight(newLogicalHeight); 1748 1748 } … … 2092 2092 void RenderBlock::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom) 2093 2093 { 2094 setLogicalHeight(border Before() + paddingBefore());2094 setLogicalHeight(borderAndPaddingBefore()); 2095 2095 2096 2096 // Lay out our hypothetical grid line as though it occurs at the top of the block. … … 2183 2183 2184 2184 // Now add in the bottom border/padding. 2185 setLogicalHeight(logicalHeight() + lastLineAnnotationsAdjustment + borderA fter() + paddingAfter() + scrollbarLogicalHeight());2185 setLogicalHeight(logicalHeight() + lastLineAnnotationsAdjustment + borderAndPaddingAfter() + scrollbarLogicalHeight()); 2186 2186 2187 2187 if (!firstLineBox() && hasLineIfEmpty()) -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r150312 r151575 123 123 virtual int borderEnd() const { return style()->borderEndWidth(); } 124 124 125 LayoutUnit borderAndPaddingStart() const { return borderStart() + paddingStart(); } 126 LayoutUnit borderAndPaddingBefore() const { return borderBefore() + paddingBefore(); } 127 LayoutUnit borderAndPaddingAfter() const { return borderAfter() + paddingAfter(); } 128 125 129 LayoutUnit borderAndPaddingHeight() const { return borderTop() + borderBottom() + paddingTop() + paddingBottom(); } 126 130 LayoutUnit borderAndPaddingWidth() const { return borderLeft() + borderRight() + paddingLeft() + paddingRight(); } 127 LayoutUnit borderAndPaddingLogicalHeight() const { return border Before() + borderAfter() + paddingBefore() + paddingAfter(); }131 LayoutUnit borderAndPaddingLogicalHeight() const { return borderAndPaddingBefore() + borderAndPaddingAfter(); } 128 132 LayoutUnit borderAndPaddingLogicalWidth() const { return borderStart() + borderEnd() + paddingStart() + paddingEnd(); } 129 133 LayoutUnit borderAndPaddingLogicalLeft() const { return style()->isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } 130 134 131 LayoutUnit borderAndPaddingStart() const { return borderStart() + paddingStart(); }132 LayoutUnit borderAndPaddingBefore() const { return borderBefore() + paddingBefore(); }133 135 LayoutUnit borderLogicalLeft() const { return style()->isHorizontalWritingMode() ? borderLeft() : borderTop(); } 134 136 LayoutUnit borderLogicalRight() const { return style()->isHorizontalWritingMode() ? borderRight() : borderBottom(); } -
trunk/Source/WebCore/rendering/RenderMultiColumnBlock.cpp
r151545 r151575 173 173 m_flowThread->setChildNeedsLayout(true, MarkOnlyThis); 174 174 175 setLogicalTopForChild(m_flowThread, border Before() + paddingBefore());175 setLogicalTopForChild(m_flowThread, borderAndPaddingBefore()); 176 176 m_flowThread->layoutIfNeeded(); 177 177 determineLogicalLeftPositionForChild(m_flowThread); -
trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp
r151545 r151575 61 61 { 62 62 RenderMultiColumnBlock* multicolBlock = toRenderMultiColumnBlock(parent()); 63 LayoutUnit contentLogicalTop = logicalTop() - multicolBlock->border Before() - multicolBlock->paddingBefore();63 LayoutUnit contentLogicalTop = logicalTop() - multicolBlock->borderAndPaddingBefore(); 64 64 65 65 height -= contentLogicalTop; … … 164 164 // Set box logical top. 165 165 ASSERT(!previousSiblingBox() || !previousSiblingBox()->isRenderMultiColumnSet()); // FIXME: multiple set not implemented; need to examine previous set to calculate the correct logical top. 166 setLogicalTop(multicolBlock->border Before() + multicolBlock->paddingBefore());166 setLogicalTop(multicolBlock->borderAndPaddingBefore()); 167 167 168 168 // Set box width. … … 222 222 LayoutUnit colLogicalWidth = computedColumnWidth(); 223 223 LayoutUnit colLogicalHeight = computedColumnHeight(); 224 LayoutUnit colLogicalTop = border Before() + paddingBefore();224 LayoutUnit colLogicalTop = borderAndPaddingBefore(); 225 225 LayoutUnit colLogicalLeft = borderAndPaddingLogicalLeft(); 226 226 LayoutUnit colGap = columnGap(); -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r149553 r151575 196 196 case BASELINE: { 197 197 LayoutUnit baseline = cellBaselinePosition(); 198 if (baseline > border Before() + paddingBefore())198 if (baseline > borderAndPaddingBefore()) 199 199 intrinsicPaddingBefore = section()->rowBaseline(rowIndex()) - (baseline - oldIntrinsicPaddingBefore); 200 200 break; … … 392 392 if (firstLineBaseline != -1) 393 393 return firstLineBaseline; 394 return paddingBefore() + borderBefore() + contentLogicalHeight();394 return borderAndPaddingBefore() + contentLogicalHeight(); 395 395 } 396 396 -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r151444 r151575 337 337 if (cell->isBaselineAligned()) { 338 338 LayoutUnit baselinePosition = cell->cellBaselinePosition(); 339 if (baselinePosition > cell->border Before() + cell->paddingBefore()) {339 if (baselinePosition > cell->borderAndPaddingBefore()) { 340 340 m_grid[cellStartRow].baseline = max(m_grid[cellStartRow].baseline, baselinePosition); 341 341 // The descent of a cell that spans multiple rows does not affect the height of the first row it spans, so don't let it … … 604 604 if (cell->isBaselineAligned()) { 605 605 LayoutUnit baseline = cell->cellBaselinePosition(); 606 if (baseline > cell->border Before() + cell->paddingBefore())606 if (baseline > cell->borderAndPaddingBefore()) 607 607 m_grid[r].baseline = max(m_grid[r].baseline, baseline); 608 608 } … … 918 918 // Only cells with content have a baseline 919 919 if (cell && cell->contentLogicalHeight()) 920 firstLineBaseline = max<int>(firstLineBaseline, cell->logicalTop() + cell-> paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight());920 firstLineBaseline = max<int>(firstLineBaseline, cell->logicalTop() + cell->borderAndPaddingBefore() + cell->contentLogicalHeight()); 921 921 } 922 922 -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r150365 r151575 431 431 pageLogicalTop = block()->pageLogicalTopForOffset(lineTopWithLeading() + delta); 432 432 if (pageLogicalTop > firstLineTopWithLeading) 433 firstTextTop = pageLogicalTop + lineGridBox->logicalTop() - lineGrid->border Before() - lineGrid->paddingBefore() + lineGridPaginationOrigin;433 firstTextTop = pageLogicalTop + lineGridBox->logicalTop() - lineGrid->borderAndPaddingBefore() + lineGridPaginationOrigin; 434 434 } 435 435 … … 582 582 return selectionTop; 583 583 584 LayoutUnit prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : block()->border Before() + block()->paddingBefore();584 LayoutUnit prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : block()->borderAndPaddingBefore(); 585 585 if (prevBottom < selectionTop && block()->containsFloats()) { 586 586 // This line has actually been moved further down, probably from a large line-height, but possibly because the … … 869 869 LayoutUnit descentWithMargin = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent(baselineType()); 870 870 if (box->parent() && !box->renderer()->isText()) { 871 ascentWithMargin += box->boxModelObject()->border Before() + box->boxModelObject()->paddingBefore() + box->boxModelObject()->marginBefore();872 descentWithMargin += box->boxModelObject()->borderA fter() + box->boxModelObject()->paddingAfter() + box->boxModelObject()->marginAfter();871 ascentWithMargin += box->boxModelObject()->borderAndPaddingBefore() + box->boxModelObject()->marginBefore(); 872 descentWithMargin += box->boxModelObject()->borderAndPaddingAfter() + box->boxModelObject()->marginAfter(); 873 873 } 874 874 setAscentAndDescent(ascent, descent, ascentWithMargin, descentWithMargin, ascentDescentSet);
Note:
See TracChangeset
for help on using the changeset viewer.