| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/rendering/AbstractInlineTextBox.h" | 37 #include "core/rendering/AbstractInlineTextBox.h" |
| 38 #include "core/rendering/EllipsisBox.h" | 38 #include "core/rendering/EllipsisBox.h" |
| 39 #include "core/rendering/HitTestResult.h" | 39 #include "core/rendering/HitTestResult.h" |
| 40 #include "core/rendering/PaintInfo.h" | 40 #include "core/rendering/PaintInfo.h" |
| 41 #include "core/rendering/RenderBR.h" | 41 #include "core/rendering/RenderBR.h" |
| 42 #include "core/rendering/RenderBlock.h" | 42 #include "core/rendering/RenderBlock.h" |
| 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/TextPainter.h" |
| 47 #include "core/rendering/style/ShadowList.h" | 48 #include "core/rendering/style/ShadowList.h" |
| 48 #include "core/rendering/svg/SVGTextRunRenderingContext.h" | 49 #include "core/rendering/svg/SVGTextRunRenderingContext.h" |
| 49 #include "platform/RuntimeEnabledFeatures.h" | 50 #include "platform/RuntimeEnabledFeatures.h" |
| 50 #include "platform/fonts/FontCache.h" | 51 #include "platform/fonts/FontCache.h" |
| 51 #include "platform/fonts/GlyphBuffer.h" | 52 #include "platform/fonts/GlyphBuffer.h" |
| 52 #include "platform/fonts/WidthIterator.h" | 53 #include "platform/fonts/WidthIterator.h" |
| 53 #include "platform/graphics/GraphicsContextStateSaver.h" | 54 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 54 #include "wtf/Vector.h" | 55 #include "wtf/Vector.h" |
| 55 #include "wtf/text/CString.h" | 56 #include "wtf/text/CString.h" |
| 56 #include "wtf/text/StringBuilder.h" | 57 #include "wtf/text/StringBuilder.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 return true; // Cannot get the ruby text. | 369 return true; // Cannot get the ruby text. |
| 369 | 370 |
| 370 RenderRubyText* rubyText = toRenderRubyRun(containingBlock->parent())->rubyT
ext(); | 371 RenderRubyText* rubyText = toRenderRubyRun(containingBlock->parent())->rubyT
ext(); |
| 371 | 372 |
| 372 // The emphasis marks over are suppressed only if there is a ruby text box a
nd it not empty. | 373 // The emphasis marks over are suppressed only if there is a ruby text box a
nd it not empty. |
| 373 return !rubyText || !rubyText->firstLineBox(); | 374 return !rubyText || !rubyText->firstLineBox(); |
| 374 } | 375 } |
| 375 | 376 |
| 376 namespace { | 377 namespace { |
| 377 | 378 |
| 378 struct TextPaintingStyle { | 379 TextPainter::Style textPaintingStyle(RenderText& renderer, RenderStyle* style, b
ool forceBlackText, bool isPrinting) |
| 379 Color fillColor; | |
| 380 Color strokeColor; | |
| 381 Color emphasisMarkColor; | |
| 382 float strokeWidth; | |
| 383 const ShadowList* shadow; | |
| 384 | |
| 385 bool operator==(const TextPaintingStyle& other) | |
| 386 { | |
| 387 return fillColor == other.fillColor | |
| 388 && strokeColor == other.strokeColor | |
| 389 && emphasisMarkColor == other.emphasisMarkColor | |
| 390 && strokeWidth == other.strokeWidth | |
| 391 && shadow == other.shadow; | |
| 392 } | |
| 393 bool operator!=(const TextPaintingStyle& other) { return !(*this == other);
} | |
| 394 }; | |
| 395 | |
| 396 TextPaintingStyle textPaintingStyle(RenderText& renderer, RenderStyle* style, bo
ol forceBlackText, bool isPrinting) | |
| 397 { | 380 { |
| 398 TextPaintingStyle textStyle; | 381 TextPainter::Style textStyle; |
| 399 | 382 |
| 400 if (forceBlackText) { | 383 if (forceBlackText) { |
| 401 textStyle.fillColor = Color::black; | 384 textStyle.fillColor = Color::black; |
| 402 textStyle.strokeColor = Color::black; | 385 textStyle.strokeColor = Color::black; |
| 403 textStyle.emphasisMarkColor = Color::black; | 386 textStyle.emphasisMarkColor = Color::black; |
| 404 textStyle.strokeWidth = style->textStrokeWidth(); | 387 textStyle.strokeWidth = style->textStrokeWidth(); |
| 405 textStyle.shadow = 0; | 388 textStyle.shadow = 0; |
| 406 } else { | 389 } else { |
| 407 textStyle.fillColor = renderer.resolveColor(style, CSSPropertyWebkitText
FillColor); | 390 textStyle.fillColor = renderer.resolveColor(style, CSSPropertyWebkitText
FillColor); |
| 408 textStyle.strokeColor = renderer.resolveColor(style, CSSPropertyWebkitTe
xtStrokeColor); | 391 textStyle.strokeColor = renderer.resolveColor(style, CSSPropertyWebkitTe
xtStrokeColor); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 425 } | 408 } |
| 426 | 409 |
| 427 // Text shadows are disabled when printing. http://crbug.com/258321 | 410 // Text shadows are disabled when printing. http://crbug.com/258321 |
| 428 if (isPrinting) | 411 if (isPrinting) |
| 429 textStyle.shadow = 0; | 412 textStyle.shadow = 0; |
| 430 } | 413 } |
| 431 | 414 |
| 432 return textStyle; | 415 return textStyle; |
| 433 } | 416 } |
| 434 | 417 |
| 435 TextPaintingStyle selectionPaintingStyle(RenderText& renderer, bool haveSelectio
n, bool forceBlackText, bool isPrinting, const TextPaintingStyle& textStyle) | 418 TextPainter::Style selectionPaintingStyle(RenderText& renderer, bool haveSelecti
on, bool forceBlackText, bool isPrinting, const TextPainter::Style& textStyle) |
| 436 { | 419 { |
| 437 TextPaintingStyle selectionStyle = textStyle; | 420 TextPainter::Style selectionStyle = textStyle; |
| 438 | 421 |
| 439 if (haveSelection) { | 422 if (haveSelection) { |
| 440 if (!forceBlackText) { | 423 if (!forceBlackText) { |
| 441 selectionStyle.fillColor = renderer.selectionForegroundColor(); | 424 selectionStyle.fillColor = renderer.selectionForegroundColor(); |
| 442 selectionStyle.emphasisMarkColor = renderer.selectionEmphasisMarkCol
or(); | 425 selectionStyle.emphasisMarkColor = renderer.selectionEmphasisMarkCol
or(); |
| 443 } | 426 } |
| 444 | 427 |
| 445 if (RenderStyle* pseudoStyle = renderer.getCachedPseudoStyle(SELECTION))
{ | 428 if (RenderStyle* pseudoStyle = renderer.getCachedPseudoStyle(SELECTION))
{ |
| 446 selectionStyle.strokeColor = forceBlackText ? Color::black : rendere
r.resolveColor(pseudoStyle, CSSPropertyWebkitTextStrokeColor); | 429 selectionStyle.strokeColor = forceBlackText ? Color::black : rendere
r.resolveColor(pseudoStyle, CSSPropertyWebkitTextStrokeColor); |
| 447 selectionStyle.strokeWidth = pseudoStyle->textStrokeWidth(); | 430 selectionStyle.strokeWidth = pseudoStyle->textStrokeWidth(); |
| 448 selectionStyle.shadow = forceBlackText ? 0 : pseudoStyle->textShadow
(); | 431 selectionStyle.shadow = forceBlackText ? 0 : pseudoStyle->textShadow
(); |
| 449 } | 432 } |
| 450 | 433 |
| 451 // Text shadows are disabled when printing. http://crbug.com/258321 | 434 // Text shadows are disabled when printing. http://crbug.com/258321 |
| 452 if (isPrinting) | 435 if (isPrinting) |
| 453 selectionStyle.shadow = 0; | 436 selectionStyle.shadow = 0; |
| 454 } | 437 } |
| 455 | 438 |
| 456 return selectionStyle; | 439 return selectionStyle; |
| 457 } | 440 } |
| 458 | 441 |
| 459 void updateGraphicsContext(GraphicsContext* context, const TextPaintingStyle& te
xtStyle, bool horizontal, GraphicsContextStateSaver& stateSaver) | |
| 460 { | |
| 461 TextDrawingModeFlags mode = context->textDrawingMode(); | |
| 462 if (textStyle.strokeWidth > 0) { | |
| 463 TextDrawingModeFlags newMode = mode | TextModeStroke; | |
| 464 if (mode != newMode) { | |
| 465 if (!stateSaver.saved()) | |
| 466 stateSaver.save(); | |
| 467 context->setTextDrawingMode(newMode); | |
| 468 mode = newMode; | |
| 469 } | |
| 470 } | |
| 471 | |
| 472 if (mode & TextModeFill && textStyle.fillColor != context->fillColor()) | |
| 473 context->setFillColor(textStyle.fillColor); | |
| 474 | |
| 475 if (mode & TextModeStroke) { | |
| 476 if (textStyle.strokeColor != context->strokeColor()) | |
| 477 context->setStrokeColor(textStyle.strokeColor); | |
| 478 if (textStyle.strokeWidth != context->strokeThickness()) | |
| 479 context->setStrokeThickness(textStyle.strokeWidth); | |
| 480 } | |
| 481 | |
| 482 // Text shadows are disabled when printing. http://crbug.com/258321 | |
| 483 if (textStyle.shadow && !context->printing()) { | |
| 484 if (!stateSaver.saved()) | |
| 485 stateSaver.save(); | |
| 486 context->setDrawLooper(textStyle.shadow->createDrawLooper(DrawLooperBuil
der::ShadowIgnoresAlpha, horizontal)); | |
| 487 } | |
| 488 } | |
| 489 | |
| 490 void paintText(GraphicsContext* context, | |
| 491 const Font& font, const TextRun& textRun, | |
| 492 const AtomicString& emphasisMark, int emphasisMarkOffset, | |
| 493 int startOffset, int endOffset, int truncationPoint, | |
| 494 const FloatPoint& textOrigin, const FloatRect& boxRect) | |
| 495 { | |
| 496 TextRunPaintInfo textRunPaintInfo(textRun); | |
| 497 textRunPaintInfo.bounds = boxRect; | |
| 498 if (startOffset <= endOffset) { | |
| 499 textRunPaintInfo.from = startOffset; | |
| 500 textRunPaintInfo.to = endOffset; | |
| 501 if (emphasisMark.isEmpty()) | |
| 502 context->drawText(font, textRunPaintInfo, textOrigin); | |
| 503 else | |
| 504 context->drawEmphasisMarks(font, textRunPaintInfo, emphasisMark, tex
tOrigin + IntSize(0, emphasisMarkOffset)); | |
| 505 } else { | |
| 506 if (endOffset > 0) { | |
| 507 textRunPaintInfo.from = 0; | |
| 508 textRunPaintInfo.to = endOffset; | |
| 509 if (emphasisMark.isEmpty()) | |
| 510 context->drawText(font, textRunPaintInfo, textOrigin); | |
| 511 else | |
| 512 context->drawEmphasisMarks(font, textRunPaintInfo, emphasisMark,
textOrigin + IntSize(0, emphasisMarkOffset)); | |
| 513 } | |
| 514 if (startOffset < truncationPoint) { | |
| 515 textRunPaintInfo.from = startOffset; | |
| 516 textRunPaintInfo.to = truncationPoint; | |
| 517 if (emphasisMark.isEmpty()) | |
| 518 context->drawText(font, textRunPaintInfo, textOrigin); | |
| 519 else | |
| 520 context->drawEmphasisMarks(font, textRunPaintInfo, emphasisMark,
textOrigin + IntSize(0, emphasisMarkOffset)); | |
| 521 } | |
| 522 } | |
| 523 } | |
| 524 | |
| 525 inline void paintEmphasisMark(GraphicsContext* context, | |
| 526 const AtomicString& emphasisMark, int emphasisMarkOffset, | |
| 527 int startOffset, int endOffset, int paintRunLength, | |
| 528 const Font& font, RenderCombineText* combinedText, const TextRun& textRun, | |
| 529 const FloatPoint& textOrigin, const FloatRect& boxRect) | |
| 530 { | |
| 531 ASSERT(!emphasisMark.isEmpty()); | |
| 532 | |
| 533 if (combinedText) { | |
| 534 DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (&object
ReplacementCharacter, 1)); | |
| 535 FloatPoint emphasisMarkTextOrigin(boxRect.x() + boxRect.width() / 2, box
Rect.y() + font.fontMetrics().ascent()); | |
| 536 context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clock
wise)); | |
| 537 paintText(context, combinedText->originalFont(), objectReplacementCharac
terTextRun, emphasisMark, emphasisMarkOffset, 0, 1, 1, emphasisMarkTextOrigin, b
oxRect); | |
| 538 context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Count
erclockwise)); | |
| 539 } else { | |
| 540 paintText(context, font, textRun, emphasisMark, emphasisMarkOffset, star
tOffset, endOffset, paintRunLength, textOrigin, boxRect); | |
| 541 } | |
| 542 } | |
| 543 | |
| 544 void paintTextWithEmphasisMark( | |
| 545 GraphicsContext* context, const Font& font, const TextPaintingStyle& textSty
le, const TextRun& textRun, | |
| 546 const AtomicString& emphasisMark, int emphasisMarkOffset, int startOffset, i
nt endOffset, int length, | |
| 547 RenderCombineText* combinedText, const FloatPoint& textOrigin, const FloatRe
ct& boxRect, bool horizontal) | |
| 548 { | |
| 549 GraphicsContextStateSaver stateSaver(*context, false); | |
| 550 updateGraphicsContext(context, textStyle, horizontal, stateSaver); | |
| 551 paintText(context, font, textRun, nullAtom, 0, startOffset, endOffset, lengt
h, textOrigin, boxRect); | |
| 552 | |
| 553 if (!emphasisMark.isEmpty()) { | |
| 554 if (textStyle.emphasisMarkColor != textStyle.fillColor) | |
| 555 context->setFillColor(textStyle.emphasisMarkColor); | |
| 556 paintEmphasisMark(context, emphasisMark, emphasisMarkOffset, startOffset
, endOffset, length, font, combinedText, textRun, textOrigin, boxRect); | |
| 557 } | |
| 558 } | |
| 559 | |
| 560 } // namespace | 442 } // namespace |
| 561 | 443 |
| 562 void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit /*lineTop*/, LayoutUnit /*lineBottom*/) | 444 void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit /*lineTop*/, LayoutUnit /*lineBottom*/) |
| 563 { | 445 { |
| 564 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(&renderer()) || render
er().style()->visibility() != VISIBLE | 446 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(&renderer()) || render
er().style()->visibility() != VISIBLE |
| 565 || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutli
ne || !m_len) | 447 || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutli
ne || !m_len) |
| 566 return; | 448 return; |
| 567 | 449 |
| 568 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines); | 450 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines); |
| 569 | 451 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 | 506 |
| 625 bool shouldRotate = !isHorizontal() && !combinedText; | 507 bool shouldRotate = !isHorizontal() && !combinedText; |
| 626 if (shouldRotate) | 508 if (shouldRotate) |
| 627 context->concatCTM(rotation(boxRect, Clockwise)); | 509 context->concatCTM(rotation(boxRect, Clockwise)); |
| 628 | 510 |
| 629 // Determine whether or not we have composition underlines to draw. | 511 // Determine whether or not we have composition underlines to draw. |
| 630 bool containsComposition = renderer().node() && renderer().frame()->inputMet
hodController().compositionNode() == renderer().node(); | 512 bool containsComposition = renderer().node() && renderer().frame()->inputMet
hodController().compositionNode() == renderer().node(); |
| 631 bool useCustomUnderlines = containsComposition && renderer().frame()->inputM
ethodController().compositionUsesCustomUnderlines(); | 513 bool useCustomUnderlines = containsComposition && renderer().frame()->inputM
ethodController().compositionUsesCustomUnderlines(); |
| 632 | 514 |
| 633 // Determine text colors. | 515 // Determine text colors. |
| 634 TextPaintingStyle textStyle = textPaintingStyle(renderer(), styleToUse, pain
tInfo.forceBlackText(), isPrinting); | 516 TextPainter::Style textStyle = textPaintingStyle(renderer(), styleToUse, pai
ntInfo.forceBlackText(), isPrinting); |
| 635 TextPaintingStyle selectionStyle = selectionPaintingStyle(renderer(), haveSe
lection, paintInfo.forceBlackText(), isPrinting, textStyle); | 517 TextPainter::Style selectionStyle = selectionPaintingStyle(renderer(), haveS
election, paintInfo.forceBlackText(), isPrinting, textStyle); |
| 636 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); | 518 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); |
| 637 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se
lectionStyle; | 519 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se
lectionStyle; |
| 638 | 520 |
| 639 // Set our font. | 521 // Set our font. |
| 640 const Font& font = styleToUse->font(); | 522 const Font& font = styleToUse->font(); |
| 641 | 523 |
| 642 FloatPoint textOrigin = FloatPoint(boxOrigin.x(), boxOrigin.y() + font.fontM
etrics().ascent()); | 524 FloatPoint textOrigin = FloatPoint(boxOrigin.x(), boxOrigin.y() + font.fontM
etrics().ascent()); |
| 643 if (combinedText) | 525 if (combinedText) |
| 644 combinedText->adjustTextOrigin(textOrigin, boxRect); | 526 combinedText->adjustTextOrigin(textOrigin, boxRect); |
| 645 | 527 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 668 } else { | 550 } else { |
| 669 combinedText->getStringToRender(m_start, string, length); | 551 combinedText->getStringToRender(m_start, string, length); |
| 670 maximumLength = length; | 552 maximumLength = length; |
| 671 } | 553 } |
| 672 | 554 |
| 673 StringBuilder charactersWithHyphen; | 555 StringBuilder charactersWithHyphen; |
| 674 TextRun textRun = constructTextRun(styleToUse, font, string, maximumLength,
hasHyphen() ? &charactersWithHyphen : 0); | 556 TextRun textRun = constructTextRun(styleToUse, font, string, maximumLength,
hasHyphen() ? &charactersWithHyphen : 0); |
| 675 if (hasHyphen()) | 557 if (hasHyphen()) |
| 676 length = textRun.length(); | 558 length = textRun.length(); |
| 677 | 559 |
| 678 int sPos = 0; | 560 int selectionStart = 0; |
| 679 int ePos = 0; | 561 int selectionEnd = 0; |
| 680 if (paintSelectedTextOnly || paintSelectedTextSeparately) | 562 if (paintSelectedTextOnly || paintSelectedTextSeparately) |
| 681 selectionStartEnd(sPos, ePos); | 563 selectionStartEnd(selectionStart, selectionEnd); |
| 682 | 564 |
| 683 bool respectHyphen = ePos == m_len && hasHyphen(); | 565 bool respectHyphen = selectionEnd == m_len && hasHyphen(); |
| 684 if (respectHyphen) | 566 if (respectHyphen) |
| 685 ePos = textRun.length(); | 567 selectionEnd = textRun.length(); |
| 686 | 568 |
| 687 if (m_truncation != cNoTruncation) { | 569 if (m_truncation != cNoTruncation) { |
| 688 sPos = std::min<int>(sPos, m_truncation); | 570 selectionStart = std::min<int>(selectionStart, m_truncation); |
| 689 ePos = std::min<int>(ePos, m_truncation); | 571 selectionEnd = std::min<int>(selectionEnd, m_truncation); |
| 690 length = m_truncation; | 572 length = m_truncation; |
| 691 } | 573 } |
| 692 | 574 |
| 693 int emphasisMarkOffset = 0; | 575 TextPainter textPainter(context, font, textRun, textOrigin, boxRect, isHoriz
ontal()); |
| 694 TextEmphasisPosition emphasisMarkPosition; | 576 TextEmphasisPosition emphasisMarkPosition; |
| 695 bool hasTextEmphasis = getEmphasisMarkPosition(styleToUse, emphasisMarkPosit
ion); | 577 bool hasTextEmphasis = getEmphasisMarkPosition(styleToUse, emphasisMarkPosit
ion); |
| 696 const AtomicString& emphasisMark = hasTextEmphasis ? styleToUse->textEmphasi
sMarkString() : nullAtom; | 578 if (hasTextEmphasis) |
| 697 if (!emphasisMark.isEmpty()) | 579 textPainter.setEmphasisMark(styleToUse->textEmphasisMarkString(), emphas
isMarkPosition); |
| 698 emphasisMarkOffset = emphasisMarkPosition == TextEmphasisPositionOver ?
-font.fontMetrics().ascent() - font.emphasisMarkDescent(emphasisMark) : font.fon
tMetrics().descent() + font.emphasisMarkAscent(emphasisMark); | 580 if (combinedText) |
| 581 textPainter.setCombinedText(combinedText); |
| 699 | 582 |
| 700 if (!paintSelectedTextOnly) { | 583 if (!paintSelectedTextOnly) { |
| 701 // FIXME: Truncate right-to-left text correctly. | 584 // FIXME: Truncate right-to-left text correctly. |
| 702 int startOffset = 0; | 585 int startOffset = 0; |
| 703 int endOffset = length; | 586 int endOffset = length; |
| 704 if (paintSelectedTextSeparately && ePos > sPos) { | 587 if (paintSelectedTextSeparately && selectionStart < selectionEnd) { |
| 705 startOffset = ePos; | 588 startOffset = selectionEnd; |
| 706 endOffset = sPos; | 589 endOffset = selectionStart; |
| 707 } | 590 } |
| 708 paintTextWithEmphasisMark(context, font, textStyle, textRun, emphasisMar
k, emphasisMarkOffset, startOffset, endOffset, length, combinedText, textOrigin,
boxRect, isHorizontal()); | 591 textPainter.paint(startOffset, endOffset, length, textStyle); |
| 709 } | 592 } |
| 710 | 593 |
| 711 if ((paintSelectedTextOnly || paintSelectedTextSeparately) && sPos < ePos) { | 594 if ((paintSelectedTextOnly || paintSelectedTextSeparately) && selectionStart
< selectionEnd) { |
| 712 // paint only the text that is selected | 595 // paint only the text that is selected |
| 713 paintTextWithEmphasisMark(context, font, selectionStyle, textRun, emphas
isMark, emphasisMarkOffset, sPos, ePos, length, combinedText, textOrigin, boxRec
t, isHorizontal()); | 596 textPainter.paint(selectionStart, selectionEnd, length, selectionStyle); |
| 714 } | 597 } |
| 715 | 598 |
| 716 // Paint decorations | 599 // Paint decorations |
| 717 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); | 600 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); |
| 718 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) { | 601 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) { |
| 719 GraphicsContextStateSaver stateSaver(*context, false); | 602 GraphicsContextStateSaver stateSaver(*context, false); |
| 720 updateGraphicsContext(context, textStyle, isHorizontal(), stateSaver); | 603 TextPainter::updateGraphicsContext(context, textStyle, isHorizontal(), s
tateSaver); |
| 721 if (combinedText) | 604 if (combinedText) |
| 722 context->concatCTM(rotation(boxRect, Clockwise)); | 605 context->concatCTM(rotation(boxRect, Clockwise)); |
| 723 paintDecoration(context, boxOrigin, textDecorations); | 606 paintDecoration(context, boxOrigin, textDecorations); |
| 724 if (combinedText) | 607 if (combinedText) |
| 725 context->concatCTM(rotation(boxRect, Counterclockwise)); | 608 context->concatCTM(rotation(boxRect, Counterclockwise)); |
| 726 } | 609 } |
| 727 | 610 |
| 728 if (paintInfo.phase == PaintPhaseForeground) { | 611 if (paintInfo.phase == PaintPhaseForeground) { |
| 729 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); | 612 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); |
| 730 | 613 |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); | 1369 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); |
| 1487 const int rendererCharacterOffset = 24; | 1370 const int rendererCharacterOffset = 24; |
| 1488 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1371 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
| 1489 fputc(' ', stderr); | 1372 fputc(' ', stderr); |
| 1490 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 1373 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 1491 } | 1374 } |
| 1492 | 1375 |
| 1493 #endif | 1376 #endif |
| 1494 | 1377 |
| 1495 } // namespace blink | 1378 } // namespace blink |
| OLD | NEW |