Changeset 113221 in webkit
- Timestamp:
- Apr 4, 2012 11:54:38 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r113220 r113221 1 2012-04-04 Emil A Eklund <eae@chromium.org> 2 3 Convert RootInlineBox to LayoutUnits in preparation for turning on subpixel layout 4 https://bugs.webkit.org/show_bug.cgi?id=83054 5 6 Reviewed by Eric Seidel. 7 8 Convert RootInlineBox over to LayoutUnits, this mostly involves updating 9 the alignment and adjustment code to be subpixel aware. 10 11 No new tests, no change in functionality. 12 13 * rendering/RootInlineBox.cpp: 14 (WebCore::RootInlineBox::alignBoxesInBlockDirection): 15 Change beforeAnnotationsAdjustment to LayoutUnit. 16 17 (WebCore::RootInlineBox::beforeAnnotationsAdjustment): 18 Change method to return LayoutUnit as it is computed from values with 19 subpixel precision. 20 21 (WebCore::RootInlineBox::lineSnapAdjustment): 22 Round values before computing remainder. 23 24 (WebCore::RootInlineBox::ascentAndDescentForBox): 25 Change ascent and decent calculation to use LayoutUnits as they are 26 computed from values with subpixel precision. 27 28 (WebCore::RootInlineBox::verticalPositionForBox): 29 Change verticalPosition to LayoutUnit. 30 31 * rendering/RootInlineBox.h: 32 (RootInlineBox): 33 1 34 2012-04-05 Joseph Pecoraro <pecoraro@apple.com> 2 35 -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r112512 r113221 289 289 setPaginatedLineWidth(block()->availableLogicalWidthForContent(heightOfBlock)); 290 290 291 int annotationsAdjustment = beforeAnnotationsAdjustment();291 LayoutUnit annotationsAdjustment = beforeAnnotationsAdjustment(); 292 292 if (annotationsAdjustment) { 293 293 // FIXME: Need to handle pagination here. We might have to move to the next page/column as a result of the … … 306 306 } 307 307 308 int RootInlineBox::beforeAnnotationsAdjustment() const309 { 310 int result = 0;308 LayoutUnit RootInlineBox::beforeAnnotationsAdjustment() const 309 { 310 LayoutUnit result = 0; 311 311 312 312 if (!renderer()->style()->isFlippedLinesWritingMode()) { … … 319 319 320 320 // Annotations over this line may push us further down. 321 int highestAllowedPosition = prevRootBox() ? min(prevRootBox()->lineBottom(), lineTop()) + result : block()->borderBefore();321 LayoutUnit highestAllowedPosition = prevRootBox() ? min(prevRootBox()->lineBottom(), lineTop()) + result : static_cast<LayoutUnit>(block()->borderBefore()); 322 322 result = computeOverAnnotationAdjustment(highestAllowedPosition); 323 323 } else { 324 324 // Annotations under this line may push us up. 325 325 if (hasAnnotationsBefore()) 326 result = computeUnderAnnotationAdjustment(prevRootBox() ? prevRootBox()->lineBottom() : block()->borderBefore());326 result = computeUnderAnnotationAdjustment(prevRootBox() ? prevRootBox()->lineBottom() : static_cast<LayoutUnit>(block()->borderBefore())); 327 327 328 328 if (!prevRootBox() || !prevRootBox()->hasAnnotationsAfter()) … … 330 330 331 331 // We have to compute the expansion for annotations over the previous line to see how much we should move. 332 int lowestAllowedPosition = max(prevRootBox()->lineBottom(), lineTop()) - result;332 LayoutUnit lowestAllowedPosition = max(prevRootBox()->lineBottom(), lineTop()) - result; 333 333 result = prevRootBox()->computeOverAnnotationAdjustment(lowestAllowedPosition); 334 334 } … … 410 410 // Otherwise we're in the middle of the grid somewhere. Just push to the next line. 411 411 LayoutUnit baselineOffset = currentBaselinePosition - firstBaselinePosition; 412 LayoutUnit remainder = baselineOffset % gridLineHeight;412 LayoutUnit remainder = roundToInt(baselineOffset) % roundToInt(gridLineHeight); 413 413 LayoutUnit result = delta; 414 414 if (remainder) … … 757 757 // If leading is included for the box, then we compute that box. 758 758 if (includeLeading && !setUsedFontWithLeading) { 759 int ascentWithLeading = box->baselinePosition(baselineType());760 int descentWithLeading = box->lineHeight() - ascentWithLeading;759 LayoutUnit ascentWithLeading = box->baselinePosition(baselineType()); 760 LayoutUnit descentWithLeading = box->lineHeight() - ascentWithLeading; 761 761 setAscentAndDescent(ascent, descent, ascentWithLeading, descentWithLeading, ascentDescentSet); 762 762 … … 770 770 771 771 if (includeFontForBox(box) && !setUsedFont) { 772 int fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent();773 int fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent();772 LayoutUnit fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent(); 773 LayoutUnit fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent(); 774 774 setAscentAndDescent(ascent, descent, fontAscent, fontDescent, ascentDescentSet); 775 775 affectsAscent = fontAscent - box->logicalTop() > 0; … … 786 786 787 787 if (includeMarginForBox(box)) { 788 int ascentWithMargin = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent();789 int descentWithMargin = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent();788 LayoutUnit ascentWithMargin = box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent(); 789 LayoutUnit descentWithMargin = box->renderer()->style(isFirstLineStyle())->fontMetrics().descent(); 790 790 if (box->parent() && !box->renderer()->isText()) { 791 791 ascentWithMargin += box->boxModelObject()->borderBefore() + box->boxModelObject()->paddingBefore() + box->boxModelObject()->marginBefore(); … … 823 823 } 824 824 825 int verticalPosition = 0;825 LayoutUnit verticalPosition = 0; 826 826 EVerticalAlign verticalAlign = renderer->style()->verticalAlign(); 827 827 if (verticalAlign == TOP || verticalAlign == BOTTOM) -
trunk/Source/WebCore/rendering/RootInlineBox.h
r112512 r113221 185 185 LayoutUnit lineSnapAdjustment(LayoutUnit delta = 0) const; 186 186 187 int beforeAnnotationsAdjustment() const;187 LayoutUnit beforeAnnotationsAdjustment() const; 188 188 189 189 // This folds into the padding at the end of InlineFlowBox on 64-bit.
Note: See TracChangeset
for help on using the changeset viewer.