| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "core/rendering/RenderCombineText.h" | 43 #include "core/rendering/RenderCombineText.h" |
| 44 #include "core/rendering/RenderRubyRun.h" | 44 #include "core/rendering/RenderRubyRun.h" |
| 45 #include "core/rendering/RenderRubyText.h" | 45 #include "core/rendering/RenderRubyText.h" |
| 46 #include "core/rendering/RenderTheme.h" | 46 #include "core/rendering/RenderTheme.h" |
| 47 #include "core/rendering/style/ShadowList.h" | 47 #include "core/rendering/style/ShadowList.h" |
| 48 #include "core/rendering/svg/SVGTextRunRenderingContext.h" | 48 #include "core/rendering/svg/SVGTextRunRenderingContext.h" |
| 49 #include "platform/RuntimeEnabledFeatures.h" | 49 #include "platform/RuntimeEnabledFeatures.h" |
| 50 #include "platform/fonts/FontCache.h" | 50 #include "platform/fonts/FontCache.h" |
| 51 #include "platform/fonts/GlyphBuffer.h" | 51 #include "platform/fonts/GlyphBuffer.h" |
| 52 #include "platform/fonts/WidthIterator.h" | 52 #include "platform/fonts/WidthIterator.h" |
| 53 #include "platform/graphics/DrawLooperBuilder.h" | |
| 54 #include "platform/graphics/GraphicsContextStateSaver.h" | 53 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 55 #include "wtf/Vector.h" | 54 #include "wtf/Vector.h" |
| 56 #include "wtf/text/CString.h" | 55 #include "wtf/text/CString.h" |
| 57 #include "wtf/text/StringBuilder.h" | 56 #include "wtf/text/StringBuilder.h" |
| 58 | 57 |
| 59 #include <algorithm> | 58 #include <algorithm> |
| 60 | 59 |
| 61 namespace WebCore { | 60 namespace WebCore { |
| 62 | 61 |
| 63 struct SameSizeAsInlineTextBox : public InlineBox { | 62 struct SameSizeAsInlineTextBox : public InlineBox { |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 FloatRect rect(boxOrigin, size()); | 380 FloatRect rect(boxOrigin, size()); |
| 382 if (m_truncation != cFullTruncation && visibleToHitTestRequest(request) && l
ocationInContainer.intersects(rect)) { | 381 if (m_truncation != cFullTruncation && visibleToHitTestRequest(request) && l
ocationInContainer.intersects(rect)) { |
| 383 renderer().updateHitTestResult(result, flipForWritingMode(locationInCont
ainer.point() - toLayoutSize(accumulatedOffset))); | 382 renderer().updateHitTestResult(result, flipForWritingMode(locationInCont
ainer.point() - toLayoutSize(accumulatedOffset))); |
| 384 if (!result.addNodeToRectBasedTestResult(renderer().node(), request, loc
ationInContainer, rect)) | 383 if (!result.addNodeToRectBasedTestResult(renderer().node(), request, loc
ationInContainer, rect)) |
| 385 return true; | 384 return true; |
| 386 } | 385 } |
| 387 return false; | 386 return false; |
| 388 } | 387 } |
| 389 | 388 |
| 390 static void paintTextWithShadows(GraphicsContext* context, | 389 static void paintTextWithShadows(GraphicsContext* context, |
| 391 const RenderObject& renderer, const Font& font, const TextRun& textRun, | 390 const Font& font, const TextRun& textRun, |
| 392 const AtomicString& emphasisMark, int emphasisMarkOffset, | 391 const AtomicString& emphasisMark, int emphasisMarkOffset, |
| 393 int startOffset, int endOffset, int truncationPoint, | 392 int startOffset, int endOffset, int truncationPoint, |
| 394 const FloatPoint& textOrigin, const FloatRect& boxRect, | 393 const FloatPoint& textOrigin, const FloatRect& boxRect, |
| 395 const ShadowList* shadowList, bool stroked, bool horizontal) | 394 const ShadowList* shadowList, bool horizontal) |
| 396 { | 395 { |
| 397 // Text shadows are disabled when printing. http://crbug.com/258321 | 396 // Text shadows are disabled when printing. http://crbug.com/258321 |
| 398 bool hasShadow = shadowList && !context->printing(); | 397 bool hasShadow = shadowList && !context->printing(); |
| 399 | 398 if (hasShadow) |
| 400 if (hasShadow) { | 399 context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::S
hadowIgnoresAlpha, horizontal)); |
| 401 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(
); | |
| 402 for (size_t i = shadowList->shadows().size(); i--; ) { | |
| 403 const ShadowData& shadow = shadowList->shadows()[i]; | |
| 404 float shadowX = horizontal ? shadow.x() : shadow.y(); | |
| 405 float shadowY = horizontal ? shadow.y() : -shadow.x(); | |
| 406 FloatSize offset(shadowX, shadowY); | |
| 407 drawLooperBuilder->addShadow(offset, shadow.blur(), shadow.color(), | |
| 408 DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::
ShadowIgnoresAlpha); | |
| 409 } | |
| 410 drawLooperBuilder->addUnmodifiedContent(); | |
| 411 context->setDrawLooper(drawLooperBuilder.release()); | |
| 412 } | |
| 413 | 400 |
| 414 TextRunPaintInfo textRunPaintInfo(textRun); | 401 TextRunPaintInfo textRunPaintInfo(textRun); |
| 415 textRunPaintInfo.bounds = boxRect; | 402 textRunPaintInfo.bounds = boxRect; |
| 416 if (startOffset <= endOffset) { | 403 if (startOffset <= endOffset) { |
| 417 textRunPaintInfo.from = startOffset; | 404 textRunPaintInfo.from = startOffset; |
| 418 textRunPaintInfo.to = endOffset; | 405 textRunPaintInfo.to = endOffset; |
| 419 if (emphasisMark.isEmpty()) | 406 if (emphasisMark.isEmpty()) |
| 420 context->drawText(font, textRunPaintInfo, textOrigin); | 407 context->drawText(font, textRunPaintInfo, textOrigin); |
| 421 else | 408 else |
| 422 context->drawEmphasisMarks(font, textRunPaintInfo, emphasisMark, tex
tOrigin + IntSize(0, emphasisMarkOffset)); | 409 context->drawEmphasisMarks(font, textRunPaintInfo, emphasisMark, tex
tOrigin + IntSize(0, emphasisMarkOffset)); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| | 499 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| |
| 513 LayoutUnit widthOfVisibleText = toRenderText(renderer()).width(m_sta
rt, m_truncation, textPos(), isLeftToRightDirection() ? LTR : RTL, isFirstLineSt
yle()); | 500 LayoutUnit widthOfVisibleText = toRenderText(renderer()).width(m_sta
rt, m_truncation, textPos(), isLeftToRightDirection() ? LTR : RTL, isFirstLineSt
yle()); |
| 514 LayoutUnit widthOfHiddenText = m_logicalWidth - widthOfVisibleText; | 501 LayoutUnit widthOfHiddenText = m_logicalWidth - widthOfVisibleText; |
| 515 // FIXME: The hit testing logic also needs to take this translation
into account. | 502 // FIXME: The hit testing logic also needs to take this translation
into account. |
| 516 LayoutSize truncationOffset(isLeftToRightDirection() ? widthOfHidden
Text : -widthOfHiddenText, 0); | 503 LayoutSize truncationOffset(isLeftToRightDirection() ? widthOfHidden
Text : -widthOfHiddenText, 0); |
| 517 adjustedPaintOffset.move(isHorizontal() ? truncationOffset : truncat
ionOffset.transposedSize()); | 504 adjustedPaintOffset.move(isHorizontal() ? truncationOffset : truncat
ionOffset.transposedSize()); |
| 518 } | 505 } |
| 519 } | 506 } |
| 520 | 507 |
| 521 GraphicsContext* context = paintInfo.context; | 508 GraphicsContext* context = paintInfo.context; |
| 522 | 509 RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); |
| 523 RenderObject& rendererToUse = renderer(); | |
| 524 RenderStyle* styleToUse = rendererToUse.style(isFirstLineStyle()); | |
| 525 | 510 |
| 526 adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? 0 : -log
icalHeight()); | 511 adjustedPaintOffset.move(0, styleToUse->isHorizontalWritingMode() ? 0 : -log
icalHeight()); |
| 527 | 512 |
| 528 FloatPoint boxOrigin = locationIncludingFlipping(); | 513 FloatPoint boxOrigin = locationIncludingFlipping(); |
| 529 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); | 514 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); |
| 530 FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight())); | 515 FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight())); |
| 531 | 516 |
| 532 RenderCombineText* combinedText = styleToUse->hasTextCombine() && textRender
er().isCombineText() && toRenderCombineText(textRenderer()).isCombined() ? &toRe
nderCombineText(textRenderer()) : 0; | 517 RenderCombineText* combinedText = styleToUse->hasTextCombine() && textRender
er().isCombineText() && toRenderCombineText(textRenderer()).isCombined() ? &toRe
nderCombineText(textRenderer()) : 0; |
| 533 | 518 |
| 534 bool shouldRotate = !isHorizontal() && !combinedText; | 519 bool shouldRotate = !isHorizontal() && !combinedText; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 546 float textStrokeWidth = styleToUse->textStrokeWidth(); | 531 float textStrokeWidth = styleToUse->textStrokeWidth(); |
| 547 | 532 |
| 548 // Text shadows are disabled when printing. http://crbug.com/258321 | 533 // Text shadows are disabled when printing. http://crbug.com/258321 |
| 549 const ShadowList* textShadow = (context->printing() || paintInfo.forceBlackT
ext()) ? 0 : styleToUse->textShadow(); | 534 const ShadowList* textShadow = (context->printing() || paintInfo.forceBlackT
ext()) ? 0 : styleToUse->textShadow(); |
| 550 | 535 |
| 551 if (paintInfo.forceBlackText()) { | 536 if (paintInfo.forceBlackText()) { |
| 552 textFillColor = Color::black; | 537 textFillColor = Color::black; |
| 553 textStrokeColor = Color::black; | 538 textStrokeColor = Color::black; |
| 554 emphasisMarkColor = Color::black; | 539 emphasisMarkColor = Color::black; |
| 555 } else { | 540 } else { |
| 556 textFillColor = rendererToUse.resolveColor(styleToUse, CSSPropertyWebkit
TextFillColor); | 541 textFillColor = renderer().resolveColor(styleToUse, CSSPropertyWebkitTex
tFillColor); |
| 557 | 542 |
| 558 bool forceBackgroundToWhite = false; | 543 bool forceBackgroundToWhite = false; |
| 559 if (isPrinting) { | 544 if (isPrinting) { |
| 560 if (styleToUse->printColorAdjust() == PrintColorAdjustEconomy) | 545 if (styleToUse->printColorAdjust() == PrintColorAdjustEconomy) |
| 561 forceBackgroundToWhite = true; | 546 forceBackgroundToWhite = true; |
| 562 if (textRenderer().document().settings() && textRenderer().document(
).settings()->shouldPrintBackgrounds()) | 547 if (textRenderer().document().settings() && textRenderer().document(
).settings()->shouldPrintBackgrounds()) |
| 563 forceBackgroundToWhite = false; | 548 forceBackgroundToWhite = false; |
| 564 } | 549 } |
| 565 | 550 |
| 566 // Make the text fill color legible against a white background | 551 // Make the text fill color legible against a white background |
| 567 if (forceBackgroundToWhite) | 552 if (forceBackgroundToWhite) |
| 568 textFillColor = correctedTextColor(textFillColor, Color::white); | 553 textFillColor = correctedTextColor(textFillColor, Color::white); |
| 569 | 554 |
| 570 textStrokeColor = rendererToUse.resolveColor(styleToUse, CSSPropertyWebk
itTextStrokeColor); | 555 textStrokeColor = renderer().resolveColor(styleToUse, CSSPropertyWebkitT
extStrokeColor); |
| 571 | 556 |
| 572 // Make the text stroke color legible against a white background | 557 // Make the text stroke color legible against a white background |
| 573 if (forceBackgroundToWhite) | 558 if (forceBackgroundToWhite) |
| 574 textStrokeColor = correctedTextColor(textStrokeColor, Color::white); | 559 textStrokeColor = correctedTextColor(textStrokeColor, Color::white); |
| 575 | 560 |
| 576 emphasisMarkColor = rendererToUse.resolveColor(styleToUse, CSSPropertyWe
bkitTextEmphasisColor); | 561 emphasisMarkColor = renderer().resolveColor(styleToUse, CSSPropertyWebki
tTextEmphasisColor); |
| 577 | 562 |
| 578 // Make the text stroke color legible against a white background | 563 // Make the text stroke color legible against a white background |
| 579 if (forceBackgroundToWhite) | 564 if (forceBackgroundToWhite) |
| 580 emphasisMarkColor = correctedTextColor(emphasisMarkColor, Color::whi
te); | 565 emphasisMarkColor = correctedTextColor(emphasisMarkColor, Color::whi
te); |
| 581 } | 566 } |
| 582 | 567 |
| 583 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); | 568 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); |
| 584 bool paintSelectedTextSeparately = false; | 569 bool paintSelectedTextSeparately = false; |
| 585 | 570 |
| 586 Color selectionFillColor = textFillColor; | 571 Color selectionFillColor = textFillColor; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 613 selectionShadow = shadow; | 598 selectionShadow = shadow; |
| 614 } | 599 } |
| 615 | 600 |
| 616 float strokeWidth = pseudoStyle->textStrokeWidth(); | 601 float strokeWidth = pseudoStyle->textStrokeWidth(); |
| 617 if (strokeWidth != selectionStrokeWidth) { | 602 if (strokeWidth != selectionStrokeWidth) { |
| 618 if (!paintSelectedTextOnly) | 603 if (!paintSelectedTextOnly) |
| 619 paintSelectedTextSeparately = true; | 604 paintSelectedTextSeparately = true; |
| 620 selectionStrokeWidth = strokeWidth; | 605 selectionStrokeWidth = strokeWidth; |
| 621 } | 606 } |
| 622 | 607 |
| 623 Color stroke = paintInfo.forceBlackText() ? Color::black : rendererT
oUse.resolveColor(pseudoStyle, CSSPropertyWebkitTextStrokeColor); | 608 Color stroke = paintInfo.forceBlackText() ? Color::black : renderer(
).resolveColor(pseudoStyle, CSSPropertyWebkitTextStrokeColor); |
| 624 if (stroke != selectionStrokeColor) { | 609 if (stroke != selectionStrokeColor) { |
| 625 if (!paintSelectedTextOnly) | 610 if (!paintSelectedTextOnly) |
| 626 paintSelectedTextSeparately = true; | 611 paintSelectedTextSeparately = true; |
| 627 selectionStrokeColor = stroke; | 612 selectionStrokeColor = stroke; |
| 628 } | 613 } |
| 629 } | 614 } |
| 630 } | 615 } |
| 631 | 616 |
| 632 // Set our font. | 617 // Set our font. |
| 633 const Font& font = styleToUse->font(); | 618 const Font& font = styleToUse->font(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 emphasisMarkOffset = emphasisMarkPosition == TextEmphasisPositionOver ?
-font.fontMetrics().ascent() - font.emphasisMarkDescent(emphasisMark) : font.fon
tMetrics().descent() + font.emphasisMarkAscent(emphasisMark); | 673 emphasisMarkOffset = emphasisMarkPosition == TextEmphasisPositionOver ?
-font.fontMetrics().ascent() - font.emphasisMarkDescent(emphasisMark) : font.fon
tMetrics().descent() + font.emphasisMarkAscent(emphasisMark); |
| 689 | 674 |
| 690 if (!paintSelectedTextOnly) { | 675 if (!paintSelectedTextOnly) { |
| 691 // For stroked painting, we have to change the text drawing mode. It's
probably dangerous to leave that mutated as a side | 676 // For stroked painting, we have to change the text drawing mode. It's
probably dangerous to leave that mutated as a side |
| 692 // effect, so only when we know we're stroking, do a save/restore. | 677 // effect, so only when we know we're stroking, do a save/restore. |
| 693 GraphicsContextStateSaver stateSaver(*context, textStrokeWidth > 0); | 678 GraphicsContextStateSaver stateSaver(*context, textStrokeWidth > 0); |
| 694 | 679 |
| 695 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrok
eWidth); | 680 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrok
eWidth); |
| 696 if (!paintSelectedTextSeparately || ePos <= sPos) { | 681 if (!paintSelectedTextSeparately || ePos <= sPos) { |
| 697 // FIXME: Truncate right-to-left text correctly. | 682 // FIXME: Truncate right-to-left text correctly. |
| 698 paintTextWithShadows(context, rendererToUse, font, textRun, nullAtom
, 0, 0, length, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, is
Horizontal()); | 683 paintTextWithShadows(context, font, textRun, nullAtom, 0, 0, length,
length, textOrigin, boxRect, textShadow, isHorizontal()); |
| 699 } else { | 684 } else { |
| 700 paintTextWithShadows(context, rendererToUse, font, textRun, nullAtom
, 0, ePos, sPos, length, textOrigin, boxRect, textShadow, textStrokeWidth > 0, i
sHorizontal()); | 685 paintTextWithShadows(context, font, textRun, nullAtom, 0, ePos, sPos
, length, textOrigin, boxRect, textShadow, isHorizontal()); |
| 701 } | 686 } |
| 702 | 687 |
| 703 if (!emphasisMark.isEmpty()) { | 688 if (!emphasisMark.isEmpty()) { |
| 704 updateGraphicsContext(context, emphasisMarkColor, textStrokeColor, t
extStrokeWidth); | 689 updateGraphicsContext(context, emphasisMarkColor, textStrokeColor, t
extStrokeWidth); |
| 705 | 690 |
| 706 DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (&ob
jectReplacementCharacter, 1)); | 691 DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (&ob
jectReplacementCharacter, 1)); |
| 707 TextRun& emphasisMarkTextRun = combinedText ? objectReplacementChara
cterTextRun : textRun; | 692 TextRun& emphasisMarkTextRun = combinedText ? objectReplacementChara
cterTextRun : textRun; |
| 708 FloatPoint emphasisMarkTextOrigin = combinedText ? FloatPoint(boxOri
gin.x() + boxRect.width() / 2, boxOrigin.y() + font.fontMetrics().ascent()) : te
xtOrigin; | 693 FloatPoint emphasisMarkTextOrigin = combinedText ? FloatPoint(boxOri
gin.x() + boxRect.width() / 2, boxOrigin.y() + font.fontMetrics().ascent()) : te
xtOrigin; |
| 709 if (combinedText) | 694 if (combinedText) |
| 710 context->concatCTM(rotation(boxRect, Clockwise)); | 695 context->concatCTM(rotation(boxRect, Clockwise)); |
| 711 | 696 |
| 712 int startOffset = 0; | 697 int startOffset = 0; |
| 713 int endOffset = length; | 698 int endOffset = length; |
| 714 int paintRunLength = length; | 699 int paintRunLength = length; |
| 715 if (combinedText) { | 700 if (combinedText) { |
| 716 startOffset = 0; | 701 startOffset = 0; |
| 717 endOffset = objectReplacementCharacterTextRun.length(); | 702 endOffset = objectReplacementCharacterTextRun.length(); |
| 718 paintRunLength = endOffset; | 703 paintRunLength = endOffset; |
| 719 } else if (paintSelectedTextSeparately && ePos > sPos) { | 704 } else if (paintSelectedTextSeparately && ePos > sPos) { |
| 720 startOffset = ePos; | 705 startOffset = ePos; |
| 721 endOffset = sPos; | 706 endOffset = sPos; |
| 722 } | 707 } |
| 723 // FIXME: Truncate right-to-left text correctly. | 708 // FIXME: Truncate right-to-left text correctly. |
| 724 paintTextWithShadows(context, rendererToUse, combinedText ? combined
Text->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffs
et, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, tex
tShadow, textStrokeWidth > 0, isHorizontal()); | 709 paintTextWithShadows(context, combinedText ? combinedText->originalF
ont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, startOffset
, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, textShadow, isHori
zontal()); |
| 725 | 710 |
| 726 if (combinedText) | 711 if (combinedText) |
| 727 context->concatCTM(rotation(boxRect, Counterclockwise)); | 712 context->concatCTM(rotation(boxRect, Counterclockwise)); |
| 728 } | 713 } |
| 729 } | 714 } |
| 730 | 715 |
| 731 if ((paintSelectedTextOnly || paintSelectedTextSeparately) && sPos < ePos) { | 716 if ((paintSelectedTextOnly || paintSelectedTextSeparately) && sPos < ePos) { |
| 732 // paint only the text that is selected | 717 // paint only the text that is selected |
| 733 GraphicsContextStateSaver stateSaver(*context, selectionStrokeWidth > 0)
; | 718 GraphicsContextStateSaver stateSaver(*context, selectionStrokeWidth > 0)
; |
| 734 | 719 |
| 735 updateGraphicsContext(context, selectionFillColor, selectionStrokeColor,
selectionStrokeWidth); | 720 updateGraphicsContext(context, selectionFillColor, selectionStrokeColor,
selectionStrokeWidth); |
| 736 paintTextWithShadows(context, rendererToUse, font, textRun, nullAtom, 0,
sPos, ePos, length, textOrigin, boxRect, selectionShadow, selectionStrokeWidth
> 0, isHorizontal()); | 721 paintTextWithShadows(context, font, textRun, nullAtom, 0, sPos, ePos, le
ngth, textOrigin, boxRect, selectionShadow, isHorizontal()); |
| 737 if (!emphasisMark.isEmpty()) { | 722 if (!emphasisMark.isEmpty()) { |
| 738 updateGraphicsContext(context, selectionEmphasisMarkColor, textStrok
eColor, textStrokeWidth); | 723 updateGraphicsContext(context, selectionEmphasisMarkColor, textStrok
eColor, textStrokeWidth); |
| 739 | 724 |
| 740 DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (&ob
jectReplacementCharacter, 1)); | 725 DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (&ob
jectReplacementCharacter, 1)); |
| 741 TextRun& emphasisMarkTextRun = combinedText ? objectReplacementChara
cterTextRun : textRun; | 726 TextRun& emphasisMarkTextRun = combinedText ? objectReplacementChara
cterTextRun : textRun; |
| 742 FloatPoint emphasisMarkTextOrigin = combinedText ? FloatPoint(boxOri
gin.x() + boxRect.width() / 2, boxOrigin.y() + font.fontMetrics().ascent()) : te
xtOrigin; | 727 FloatPoint emphasisMarkTextOrigin = combinedText ? FloatPoint(boxOri
gin.x() + boxRect.width() / 2, boxOrigin.y() + font.fontMetrics().ascent()) : te
xtOrigin; |
| 743 if (combinedText) | 728 if (combinedText) |
| 744 context->concatCTM(rotation(boxRect, Clockwise)); | 729 context->concatCTM(rotation(boxRect, Clockwise)); |
| 745 | 730 |
| 746 int startOffset = combinedText ? 0 : sPos; | 731 int startOffset = combinedText ? 0 : sPos; |
| 747 int endOffset = combinedText ? objectReplacementCharacterTextRun.len
gth() : ePos; | 732 int endOffset = combinedText ? objectReplacementCharacterTextRun.len
gth() : ePos; |
| 748 int paintRunLength = combinedText ? endOffset : length; | 733 int paintRunLength = combinedText ? endOffset : length; |
| 749 paintTextWithShadows(context, rendererToUse, combinedText ? combined
Text->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffs
et, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, sel
ectionShadow, selectionStrokeWidth > 0, isHorizontal()); | 734 paintTextWithShadows(context, combinedText ? combinedText->originalF
ont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, startOffset
, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, selectionShadow, i
sHorizontal()); |
| 750 | 735 |
| 751 if (combinedText) | 736 if (combinedText) |
| 752 context->concatCTM(rotation(boxRect, Counterclockwise)); | 737 context->concatCTM(rotation(boxRect, Counterclockwise)); |
| 753 } | 738 } |
| 754 } | 739 } |
| 755 | 740 |
| 756 // Paint decorations | 741 // Paint decorations |
| 757 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); | 742 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); |
| 758 if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSe
lection) { | 743 if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSe
lection) { |
| 759 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrok
eWidth); | 744 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrok
eWidth); |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); | 1566 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); |
| 1582 const int rendererCharacterOffset = 24; | 1567 const int rendererCharacterOffset = 24; |
| 1583 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1568 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
| 1584 fputc(' ', stderr); | 1569 fputc(' ', stderr); |
| 1585 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 1570 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 1586 } | 1571 } |
| 1587 | 1572 |
| 1588 #endif | 1573 #endif |
| 1589 | 1574 |
| 1590 } // namespace WebCore | 1575 } // namespace WebCore |
| OLD | NEW |