[webkit-reviews] review granted: [Bug 48537] Fonts with no vertical metrics should synthesize baselines : [Attachment 74124] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 17 11:45:35 PST 2010


Sam Weinig <sam at webkit.org> has granted Dave Hyatt <hyatt at apple.com>'s request
for review:
Bug 48537: Fonts with no vertical metrics should synthesize baselines
https://bugs.webkit.org/show_bug.cgi?id=48537

Attachment 74124: Patch
https://bugs.webkit.org/attachment.cgi?id=74124&action=review

------- Additional Comments from Sam Weinig <sam at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=74124&action=review

> WebCore/rendering/InlineFlowBox.cpp:484
> +	       if (verticalAlign == SUB)
> +		   verticalPosition += fontSize / 5 + 1;
> +	       else if (verticalAlign == SUPER)
> +		   verticalPosition -= fontSize / 3 + 1;
> +	       else if (verticalAlign == TEXT_TOP)
> +		   verticalPosition += renderer->baselinePosition(baselineType,
firstLine, lineDirection) - font.ascent(baselineType);
> +	       else if (verticalAlign == MIDDLE)
> +		   verticalPosition += -static_cast<int>(font.xHeight() / 2) -
renderer->lineHeight(firstLine, lineDirection) / 2 +
renderer->baselinePosition(baselineType, firstLine, lineDirection);
> +	       else if (verticalAlign == TEXT_BOTTOM) {
> +		   verticalPosition += font.descent(baselineType);
> +		   // lineHeight - baselinePosition is always 0 for replaced
elements (except inline blocks), so don't bother wasting time in that case.
> +		   if (!renderer->isReplaced() ||
renderer->isInlineBlockOrInlineTable())
> +		       verticalPosition -= (renderer->lineHeight(firstLine,
lineDirection) - renderer->baselinePosition(baselineType, firstLine,
lineDirection));
> +	       } else if (verticalAlign == BASELINE_MIDDLE)
> +		   verticalPosition += -renderer->lineHeight(firstLine,
lineDirection) / 2 + renderer->baselinePosition(baselineType, firstLine,
lineDirection);
> +	       else if (verticalAlign == LENGTH)
> +		   verticalPosition -=
renderer->style()->verticalAlignLength().calcValue(renderer->lineHeight(firstLi
ne, lineDirection));
> +	   }

If you wanted, you could change this to a switch statement.


More information about the webkit-reviews mailing list