Changeset 81404 in webkit
- Timestamp:
- Mar 17, 2011 4:11:48 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r81399 r81404 1 2011-03-17 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Beth Dakin. 4 5 <rdar://problem/9052166> Emphasis marks appear over combined text rather than beside it 6 https://bugs.webkit.org/show_bug.cgi?id=56480 7 8 * fast/text/emphasis-combined-text.html: Added. 9 * platform/mac/fast/text/emphasis-combined-text-expected.checksum: Added. 10 * platform/mac/fast/text/emphasis-combined-text-expected.png: Added. 11 * platform/mac/fast/text/emphasis-combined-text-expected.txt: Added. 12 1 13 2011-03-17 Jian Li <jianli@chromium.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r81399 r81404 1 2011-03-17 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Beth Dakin. 4 5 <rdar://problem/9052166> Emphasis marks appear over combined text rather than beside it 6 https://bugs.webkit.org/show_bug.cgi?id=56480 7 8 Test: fast/text/emphasis-combined-text.html 9 10 * rendering/InlineTextBox.cpp: 11 (WebCore::rotation): Added this helper. 12 (WebCore::InlineTextBox::paint): Paint a single emphasis mark beside the combined text, 13 centered vertically. 14 1 15 2011-03-17 Jian Li <jianli@chromium.org> 2 16 -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r79936 r81404 428 428 } 429 429 430 enum RotationDirection { Counterclockwise, Clockwise }; 431 432 static inline AffineTransform rotation(const FloatRect& boxRect, RotationDirection clockwise) 433 { 434 return clockwise ? AffineTransform(0, 1, -1, 0, boxRect.x() + boxRect.maxY(), boxRect.maxY() - boxRect.x()) 435 : AffineTransform(0, -1, 1, 0, boxRect.x() - boxRect.maxY(), boxRect.x() + boxRect.maxY()); 436 } 437 430 438 void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty) 431 439 { … … 486 494 boxOrigin.move(tx, ty); 487 495 FloatRect boxRect(boxOrigin, IntSize(logicalWidth(), logicalHeight())); 488 FloatPoint textOrigin = FloatPoint(boxOrigin.x(), boxOrigin.y() + styleToUse->fontMetrics().ascent()); 489 490 RenderCombineText* combinedText = styleToUse->hasTextCombine() ? toRenderCombineText(textRenderer()) : 0; 491 bool shouldRotate = !isHorizontal() && (!combinedText || !combinedText->isCombined()); 492 if (shouldRotate) { 493 context->save(); 494 context->translate(boxRect.x(), boxRect.maxY()); 495 context->rotate(static_cast<float>(deg2rad(90.))); 496 context->translate(-boxRect.x(), -boxRect.maxY()); 497 } 498 499 496 497 RenderCombineText* combinedText = styleToUse->hasTextCombine() && toRenderCombineText(textRenderer())->isCombined() ? toRenderCombineText(textRenderer()) : 0; 498 499 bool shouldRotate = !isHorizontal() && !combinedText; 500 if (shouldRotate) 501 context->concatCTM(rotation(boxRect, Clockwise)); 502 500 503 // Determine whether or not we have composition underlines to draw. 501 504 bool containsComposition = renderer()->node() && renderer()->frame()->editor()->compositionNode() == renderer()->node(); … … 503 506 504 507 // Set our font. 505 int d = styleToUse->textDecorationsInEffect();506 508 const Font& font = styleToUse->font(); 509 510 FloatPoint textOrigin = FloatPoint(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent()); 507 511 508 512 if (combinedText) … … 654 658 if (!emphasisMark.isEmpty()) { 655 659 updateGraphicsContext(context, emphasisMarkColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace()); 660 661 static TextRun objectReplacementCharacterTextRun(&objectReplacementCharacter, 1); 662 TextRun& emphasisMarkTextRun = combinedText ? objectReplacementCharacterTextRun : textRun; 663 FloatPoint emphasisMarkTextOrigin = combinedText ? FloatPoint(boxOrigin.x() + boxRect.width() / 2, boxOrigin.y() + font.fontMetrics().ascent()) : textOrigin; 664 if (combinedText) 665 context->concatCTM(rotation(boxRect, Clockwise)); 666 656 667 if (!paintSelectedTextSeparately || ePos <= sPos) { 657 668 // FIXME: Truncate right-to-left text correctly. 658 paintTextWithShadows(context, font, textRun, emphasisMark, emphasisMarkOffset, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal());669 paintTextWithShadows(context, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, 0, length, length, emphasisMarkTextOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal()); 659 670 } else 660 paintTextWithShadows(context, font, textRun, emphasisMark, emphasisMarkOffset, ePos, sPos, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal()); 671 paintTextWithShadows(context, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, ePos, sPos, length, emphasisMarkTextOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal()); 672 673 if (combinedText) 674 context->concatCTM(rotation(boxRect, Counterclockwise)); 661 675 } 662 676 … … 674 688 if (!emphasisMark.isEmpty()) { 675 689 updateGraphicsContext(context, selectionEmphasisMarkColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace()); 676 paintTextWithShadows(context, font, textRun, emphasisMark, emphasisMarkOffset, sPos, ePos, length, textOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, isHorizontal()); 690 691 static TextRun objectReplacementCharacterTextRun(&objectReplacementCharacter, 1); 692 TextRun& emphasisMarkTextRun = combinedText ? objectReplacementCharacterTextRun : textRun; 693 FloatPoint emphasisMarkTextOrigin = combinedText ? FloatPoint(boxOrigin.x() + boxRect.width() / 2, boxOrigin.y() + font.fontMetrics().ascent()) : textOrigin; 694 if (combinedText) 695 context->concatCTM(rotation(boxRect, Clockwise)); 696 697 paintTextWithShadows(context, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, sPos, ePos, length, emphasisMarkTextOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, isHorizontal()); 698 699 if (combinedText) 700 context->concatCTM(rotation(boxRect, Counterclockwise)); 677 701 } 678 702 if (selectionStrokeWidth > 0) … … 681 705 682 706 // Paint decorations 683 if (d != TDNONE && paintInfo.phase != PaintPhaseSelection) { 707 int textDecorations = styleToUse->textDecorationsInEffect(); 708 if (textDecorations != TDNONE && paintInfo.phase != PaintPhaseSelection) { 684 709 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWidth, styleToUse->colorSpace()); 685 paintDecoration(context, boxOrigin, d, textShadow);710 paintDecoration(context, boxOrigin, textDecorations, textShadow); 686 711 } 687 712 … … 716 741 717 742 if (shouldRotate) 718 context-> restore();743 context->concatCTM(rotation(boxRect, Counterclockwise)); 719 744 } 720 745
Note: See TracChangeset
for help on using the changeset viewer.