| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 gTextBoxesWithOverflow = new InlineTextBoxOverflowMap; | 94 gTextBoxesWithOverflow = new InlineTextBoxOverflowMap; |
| 95 gTextBoxesWithOverflow->add(this, rect); | 95 gTextBoxesWithOverflow->add(this, rect); |
| 96 } | 96 } |
| 97 | 97 |
| 98 int InlineTextBox::baselinePosition(FontBaseline baselineType) const | 98 int InlineTextBox::baselinePosition(FontBaseline baselineType) const |
| 99 { | 99 { |
| 100 if (!isText() || !parent()) | 100 if (!isText() || !parent()) |
| 101 return 0; | 101 return 0; |
| 102 if (parent()->renderer() == renderer().parent()) | 102 if (parent()->renderer() == renderer().parent()) |
| 103 return parent()->baselinePosition(baselineType); | 103 return parent()->baselinePosition(baselineType); |
| 104 return toRenderBoxModelObject(renderer().parent())->baselinePosition(baselin
eType, isFirstLineStyle(), isHorizontal() ? HorizontalLine : VerticalLine, Posit
ionOnContainingLine); | 104 return toRenderBoxModelObject(renderer().parent())->baselinePosition(baselin
eType, isFirstLineStyle(), HorizontalLine, PositionOnContainingLine); |
| 105 } | 105 } |
| 106 | 106 |
| 107 LayoutUnit InlineTextBox::lineHeight() const | 107 LayoutUnit InlineTextBox::lineHeight() const |
| 108 { | 108 { |
| 109 if (!isText() || !renderer().parent()) | 109 if (!isText() || !renderer().parent()) |
| 110 return 0; | 110 return 0; |
| 111 if (parent()->renderer() == renderer().parent()) | 111 if (parent()->renderer() == renderer().parent()) |
| 112 return parent()->lineHeight(); | 112 return parent()->lineHeight(); |
| 113 return toRenderBoxModelObject(renderer().parent())->lineHeight(isFirstLineSt
yle(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine)
; | 113 return toRenderBoxModelObject(renderer().parent())->lineHeight(isFirstLineSt
yle(), HorizontalLine, PositionOnContainingLine); |
| 114 } | 114 } |
| 115 | 115 |
| 116 LayoutUnit InlineTextBox::selectionTop() | 116 LayoutUnit InlineTextBox::selectionTop() |
| 117 { | 117 { |
| 118 return root().selectionTop(); | 118 return root().selectionTop(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 LayoutUnit InlineTextBox::selectionBottom() | 121 LayoutUnit InlineTextBox::selectionBottom() |
| 122 { | 122 { |
| 123 return root().selectionBottom(); | 123 return root().selectionBottom(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 r = enclosingIntRect(font.selectionRectForText(textRun, startingPoint, s
elHeight, sPos, ePos)); | 208 r = enclosingIntRect(font.selectionRectForText(textRun, startingPoint, s
elHeight, sPos, ePos)); |
| 209 else // Avoid computing the font width when the entire line box is selected
as an optimization. | 209 else // Avoid computing the font width when the entire line box is selected
as an optimization. |
| 210 r = enclosingIntRect(FloatRect(startingPoint, FloatSize(m_logicalWidth,
selHeight.toFloat()))); | 210 r = enclosingIntRect(FloatRect(startingPoint, FloatSize(m_logicalWidth,
selHeight.toFloat()))); |
| 211 | 211 |
| 212 LayoutUnit logicalWidth = r.width(); | 212 LayoutUnit logicalWidth = r.width(); |
| 213 if (r.x() > logicalRight()) | 213 if (r.x() > logicalRight()) |
| 214 logicalWidth = 0; | 214 logicalWidth = 0; |
| 215 else if (r.maxX() > logicalRight()) | 215 else if (r.maxX() > logicalRight()) |
| 216 logicalWidth = logicalRight() - r.x(); | 216 logicalWidth = logicalRight() - r.x(); |
| 217 | 217 |
| 218 LayoutPoint topPoint = isHorizontal() ? LayoutPoint(r.x(), selTop) : LayoutP
oint(selTop, r.x()); | 218 LayoutPoint topPoint = LayoutPoint(r.x(), selTop); |
| 219 LayoutUnit width = isHorizontal() ? logicalWidth : selHeight; | 219 return LayoutRect(topPoint, LayoutSize(logicalWidth, selHeight)); |
| 220 LayoutUnit height = isHorizontal() ? selHeight : logicalWidth; | |
| 221 | |
| 222 return LayoutRect(topPoint, LayoutSize(width, height)); | |
| 223 } | 220 } |
| 224 | 221 |
| 225 void InlineTextBox::deleteLine() | 222 void InlineTextBox::deleteLine() |
| 226 { | 223 { |
| 227 renderer().removeTextBox(this); | 224 renderer().removeTextBox(this); |
| 228 destroy(); | 225 destroy(); |
| 229 } | 226 } |
| 230 | 227 |
| 231 void InlineTextBox::extractLine() | 228 void InlineTextBox::extractLine() |
| 232 { | 229 { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 if (haveSelection) { | 402 if (haveSelection) { |
| 406 if (!forceBlackText) { | 403 if (!forceBlackText) { |
| 407 selectionStyle.fillColor = renderer.selectionForegroundColor(); | 404 selectionStyle.fillColor = renderer.selectionForegroundColor(); |
| 408 selectionStyle.emphasisMarkColor = renderer.selectionEmphasisMarkCol
or(); | 405 selectionStyle.emphasisMarkColor = renderer.selectionEmphasisMarkCol
or(); |
| 409 } | 406 } |
| 410 } | 407 } |
| 411 | 408 |
| 412 return selectionStyle; | 409 return selectionStyle; |
| 413 } | 410 } |
| 414 | 411 |
| 415 void updateGraphicsContext(GraphicsContext* context, const TextPaintingStyle& te
xtStyle, bool horizontal, GraphicsContextStateSaver& stateSaver) | 412 void updateGraphicsContext(GraphicsContext* context, const TextPaintingStyle& te
xtStyle, GraphicsContextStateSaver& stateSaver) |
| 416 { | 413 { |
| 417 TextDrawingModeFlags mode = context->textDrawingMode(); | 414 TextDrawingModeFlags mode = context->textDrawingMode(); |
| 418 if (textStyle.strokeWidth > 0) { | 415 if (textStyle.strokeWidth > 0) { |
| 419 TextDrawingModeFlags newMode = mode | TextModeStroke; | 416 TextDrawingModeFlags newMode = mode | TextModeStroke; |
| 420 if (mode != newMode) { | 417 if (mode != newMode) { |
| 421 if (!stateSaver.saved()) | 418 if (!stateSaver.saved()) |
| 422 stateSaver.save(); | 419 stateSaver.save(); |
| 423 context->setTextDrawingMode(newMode); | 420 context->setTextDrawingMode(newMode); |
| 424 mode = newMode; | 421 mode = newMode; |
| 425 } | 422 } |
| 426 } | 423 } |
| 427 | 424 |
| 428 if (mode & TextModeFill && textStyle.fillColor != context->fillColor()) | 425 if (mode & TextModeFill && textStyle.fillColor != context->fillColor()) |
| 429 context->setFillColor(textStyle.fillColor); | 426 context->setFillColor(textStyle.fillColor); |
| 430 | 427 |
| 431 if (mode & TextModeStroke) { | 428 if (mode & TextModeStroke) { |
| 432 if (textStyle.strokeColor != context->strokeColor()) | 429 if (textStyle.strokeColor != context->strokeColor()) |
| 433 context->setStrokeColor(textStyle.strokeColor); | 430 context->setStrokeColor(textStyle.strokeColor); |
| 434 if (textStyle.strokeWidth != context->strokeThickness()) | 431 if (textStyle.strokeWidth != context->strokeThickness()) |
| 435 context->setStrokeThickness(textStyle.strokeWidth); | 432 context->setStrokeThickness(textStyle.strokeWidth); |
| 436 } | 433 } |
| 437 | 434 |
| 438 if (textStyle.shadow) { | 435 if (textStyle.shadow) { |
| 439 if (!stateSaver.saved()) | 436 if (!stateSaver.saved()) |
| 440 stateSaver.save(); | 437 stateSaver.save(); |
| 441 context->setDrawLooper(textStyle.shadow->createDrawLooper(DrawLooperBuil
der::ShadowIgnoresAlpha, horizontal)); | 438 context->setDrawLooper(textStyle.shadow->createDrawLooper(DrawLooperBuil
der::ShadowIgnoresAlpha)); |
| 442 } | 439 } |
| 443 } | 440 } |
| 444 | 441 |
| 445 void paintText(GraphicsContext* context, | 442 void paintText(GraphicsContext* context, |
| 446 const Font& font, const TextRun& textRun, | 443 const Font& font, const TextRun& textRun, |
| 447 const AtomicString& emphasisMark, int emphasisMarkOffset, | 444 const AtomicString& emphasisMark, int emphasisMarkOffset, |
| 448 int startOffset, int endOffset, int truncationPoint, | 445 int startOffset, int endOffset, int truncationPoint, |
| 449 const FloatPoint& textOrigin, const FloatRect& boxRect) | 446 const FloatPoint& textOrigin, const FloatRect& boxRect) |
| 450 { | 447 { |
| 451 TextRunPaintInfo textRunPaintInfo(textRun); | 448 TextRunPaintInfo textRunPaintInfo(textRun); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 const Font& font, const TextRun& textRun, | 480 const Font& font, const TextRun& textRun, |
| 484 const FloatPoint& textOrigin, const FloatRect& boxRect) | 481 const FloatPoint& textOrigin, const FloatRect& boxRect) |
| 485 { | 482 { |
| 486 ASSERT(!emphasisMark.isEmpty()); | 483 ASSERT(!emphasisMark.isEmpty()); |
| 487 paintText(context, font, textRun, emphasisMark, emphasisMarkOffset, startOff
set, endOffset, paintRunLength, textOrigin, boxRect); | 484 paintText(context, font, textRun, emphasisMark, emphasisMarkOffset, startOff
set, endOffset, paintRunLength, textOrigin, boxRect); |
| 488 } | 485 } |
| 489 | 486 |
| 490 void paintTextWithEmphasisMark( | 487 void paintTextWithEmphasisMark( |
| 491 GraphicsContext* context, const Font& font, const TextPaintingStyle& textSty
le, const TextRun& textRun, | 488 GraphicsContext* context, const Font& font, const TextPaintingStyle& textSty
le, const TextRun& textRun, |
| 492 const AtomicString& emphasisMark, int emphasisMarkOffset, int startOffset, i
nt endOffset, int length, | 489 const AtomicString& emphasisMark, int emphasisMarkOffset, int startOffset, i
nt endOffset, int length, |
| 493 const FloatPoint& textOrigin, const FloatRect& boxRect, bool horizontal) | 490 const FloatPoint& textOrigin, const FloatRect& boxRect) |
| 494 { | 491 { |
| 495 GraphicsContextStateSaver stateSaver(*context, false); | 492 GraphicsContextStateSaver stateSaver(*context, false); |
| 496 updateGraphicsContext(context, textStyle, horizontal, stateSaver); | 493 updateGraphicsContext(context, textStyle, stateSaver); |
| 497 paintText(context, font, textRun, nullAtom, 0, startOffset, endOffset, lengt
h, textOrigin, boxRect); | 494 paintText(context, font, textRun, nullAtom, 0, startOffset, endOffset, lengt
h, textOrigin, boxRect); |
| 498 | 495 |
| 499 if (!emphasisMark.isEmpty()) { | 496 if (!emphasisMark.isEmpty()) { |
| 500 if (textStyle.emphasisMarkColor != textStyle.fillColor) | 497 if (textStyle.emphasisMarkColor != textStyle.fillColor) |
| 501 context->setFillColor(textStyle.emphasisMarkColor); | 498 context->setFillColor(textStyle.emphasisMarkColor); |
| 502 paintEmphasisMark(context, emphasisMark, emphasisMarkOffset, startOffset
, endOffset, length, font, textRun, textOrigin, boxRect); | 499 paintEmphasisMark(context, emphasisMark, emphasisMarkOffset, startOffset
, endOffset, length, font, textRun, textOrigin, boxRect); |
| 503 } | 500 } |
| 504 } | 501 } |
| 505 | 502 |
| 506 } // namespace | 503 } // namespace |
| 507 | 504 |
| 508 void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit /*lineTop*/, LayoutUnit /*lineBottom*/) | 505 void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit /*lineTop*/, LayoutUnit /*lineBottom*/) |
| 509 { | 506 { |
| 510 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(&renderer()) | 507 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(&renderer()) |
| 511 || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutli
ne || !m_len) | 508 || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutli
ne || !m_len) |
| 512 return; | 509 return; |
| 513 | 510 |
| 514 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines); | 511 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines); |
| 515 | 512 |
| 516 LayoutRect logicalVisualOverflow = logicalOverflowRect(); | 513 LayoutRect logicalVisualOverflow = logicalOverflowRect(); |
| 517 LayoutUnit logicalStart = logicalVisualOverflow.x() + (isHorizontal() ? pain
tOffset.x() : paintOffset.y()); | 514 LayoutUnit logicalStart = logicalVisualOverflow.x() + paintOffset.x(); |
| 518 LayoutUnit logicalExtent = logicalVisualOverflow.width(); | 515 LayoutUnit logicalExtent = logicalVisualOverflow.width(); |
| 519 | 516 |
| 520 LayoutUnit paintEnd = isHorizontal() ? paintInfo.rect.maxX() : paintInfo.rec
t.maxY(); | 517 LayoutUnit paintEnd = paintInfo.rect.maxX(); |
| 521 LayoutUnit paintStart = isHorizontal() ? paintInfo.rect.x() : paintInfo.rect
.y(); | 518 LayoutUnit paintStart = paintInfo.rect.x(); |
| 522 | 519 |
| 523 // When subpixel font scaling is enabled text runs are positioned at | 520 // When subpixel font scaling is enabled text runs are positioned at |
| 524 // subpixel boundaries on the x-axis and thus there is no reason to | 521 // subpixel boundaries on the x-axis and thus there is no reason to |
| 525 // snap the x value. We still round the y-axis to ensure consistent | 522 // snap the x value. We still round the y-axis to ensure consistent |
| 526 // line heights. | 523 // line heights. |
| 527 LayoutPoint adjustedPaintOffset = RuntimeEnabledFeatures::subpixelFontScalin
gEnabled() | 524 LayoutPoint adjustedPaintOffset = RuntimeEnabledFeatures::subpixelFontScalin
gEnabled() |
| 528 ? LayoutPoint(paintOffset.x(), paintOffset.y().round()) | 525 ? LayoutPoint(paintOffset.x(), paintOffset.y().round()) |
| 529 : roundedIntPoint(paintOffset); | 526 : roundedIntPoint(paintOffset); |
| 530 | 527 |
| 531 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart) | 528 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 544 // e.g. In the case of LTR text truncated in an RTL Context, the cor
rect behavior is: | 541 // e.g. In the case of LTR text truncated in an RTL Context, the cor
rect behavior is: |
| 545 // |Hello|CBA| -> |...He|CBA| | 542 // |Hello|CBA| -> |...He|CBA| |
| 546 // In order to draw the fragment "He" aligned to the right edge of i
t's box, we need to start drawing | 543 // In order to draw the fragment "He" aligned to the right edge of i
t's box, we need to start drawing |
| 547 // farther to the right. | 544 // farther to the right. |
| 548 // NOTE: WebKit's behavior differs from that of IE which appears to
just overlay the ellipsis on top of the | 545 // NOTE: WebKit's behavior differs from that of IE which appears to
just overlay the ellipsis on top of the |
| 549 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| | 546 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| |
| 550 LayoutUnit widthOfVisibleText = renderer().width(m_start, m_truncati
on, textPos(), isLeftToRightDirection() ? LTR : RTL, isFirstLineStyle()); | 547 LayoutUnit widthOfVisibleText = renderer().width(m_start, m_truncati
on, textPos(), isLeftToRightDirection() ? LTR : RTL, isFirstLineStyle()); |
| 551 LayoutUnit widthOfHiddenText = m_logicalWidth - widthOfVisibleText; | 548 LayoutUnit widthOfHiddenText = m_logicalWidth - widthOfVisibleText; |
| 552 // FIXME: The hit testing logic also needs to take this translation
into account. | 549 // FIXME: The hit testing logic also needs to take this translation
into account. |
| 553 LayoutSize truncationOffset(isLeftToRightDirection() ? widthOfHidden
Text : -widthOfHiddenText, 0); | 550 LayoutSize truncationOffset(isLeftToRightDirection() ? widthOfHidden
Text : -widthOfHiddenText, 0); |
| 554 adjustedPaintOffset.move(isHorizontal() ? truncationOffset : truncat
ionOffset.transposedSize()); | 551 adjustedPaintOffset.move(truncationOffset); |
| 555 } | 552 } |
| 556 } | 553 } |
| 557 | 554 |
| 558 GraphicsContext* context = paintInfo.context; | 555 GraphicsContext* context = paintInfo.context; |
| 559 RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); | 556 RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); |
| 560 | 557 |
| 561 FloatPoint boxOrigin = locationIncludingFlipping(); | 558 FloatPoint boxOrigin = locationIncludingFlipping(); |
| 562 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); | 559 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); |
| 563 FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight())); | 560 FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight())); |
| 564 | 561 |
| 565 bool shouldRotate = !isHorizontal(); | |
| 566 if (shouldRotate) | |
| 567 context->concatCTM(rotation(boxRect, Clockwise)); | |
| 568 | |
| 569 // Determine whether or not we have composition underlines to draw. | 562 // Determine whether or not we have composition underlines to draw. |
| 570 bool containsComposition = renderer().node() && renderer().frame()->inputMet
hodController().compositionNode() == renderer().node(); | 563 bool containsComposition = renderer().node() && renderer().frame()->inputMet
hodController().compositionNode() == renderer().node(); |
| 571 bool useCustomUnderlines = containsComposition && renderer().frame()->inputM
ethodController().compositionUsesCustomUnderlines(); | 564 bool useCustomUnderlines = containsComposition && renderer().frame()->inputM
ethodController().compositionUsesCustomUnderlines(); |
| 572 | 565 |
| 573 // Determine text colors. | 566 // Determine text colors. |
| 574 TextPaintingStyle textStyle = textPaintingStyle(renderer(), styleToUse, pain
tInfo.forceBlackText()); | 567 TextPaintingStyle textStyle = textPaintingStyle(renderer(), styleToUse, pain
tInfo.forceBlackText()); |
| 575 TextPaintingStyle selectionStyle = selectionPaintingStyle(renderer(), haveSe
lection, paintInfo.forceBlackText(), textStyle); | 568 TextPaintingStyle selectionStyle = selectionPaintingStyle(renderer(), haveSe
lection, paintInfo.forceBlackText(), textStyle); |
| 576 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); | 569 bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection); |
| 577 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se
lectionStyle; | 570 bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != se
lectionStyle; |
| 578 | 571 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 emphasisMarkOffset = emphasisMarkPosition == TextEmphasisPositionOver ?
-font.fontMetrics().ascent() - font.emphasisMarkDescent(emphasisMark) : font.fon
tMetrics().descent() + font.emphasisMarkAscent(emphasisMark); | 623 emphasisMarkOffset = emphasisMarkPosition == TextEmphasisPositionOver ?
-font.fontMetrics().ascent() - font.emphasisMarkDescent(emphasisMark) : font.fon
tMetrics().descent() + font.emphasisMarkAscent(emphasisMark); |
| 631 | 624 |
| 632 if (!paintSelectedTextOnly) { | 625 if (!paintSelectedTextOnly) { |
| 633 // FIXME: Truncate right-to-left text correctly. | 626 // FIXME: Truncate right-to-left text correctly. |
| 634 int startOffset = 0; | 627 int startOffset = 0; |
| 635 int endOffset = length; | 628 int endOffset = length; |
| 636 if (paintSelectedTextSeparately && ePos > sPos) { | 629 if (paintSelectedTextSeparately && ePos > sPos) { |
| 637 startOffset = ePos; | 630 startOffset = ePos; |
| 638 endOffset = sPos; | 631 endOffset = sPos; |
| 639 } | 632 } |
| 640 paintTextWithEmphasisMark(context, font, textStyle, textRun, emphasisMar
k, emphasisMarkOffset, startOffset, endOffset, length, textOrigin, boxRect, isHo
rizontal()); | 633 paintTextWithEmphasisMark(context, font, textStyle, textRun, emphasisMar
k, emphasisMarkOffset, startOffset, endOffset, length, textOrigin, boxRect); |
| 641 } | 634 } |
| 642 | 635 |
| 643 if ((paintSelectedTextOnly || paintSelectedTextSeparately) && sPos < ePos) { | 636 if ((paintSelectedTextOnly || paintSelectedTextSeparately) && sPos < ePos) { |
| 644 // paint only the text that is selected | 637 // paint only the text that is selected |
| 645 paintTextWithEmphasisMark(context, font, selectionStyle, textRun, emphas
isMark, emphasisMarkOffset, sPos, ePos, length, textOrigin, boxRect, isHorizonta
l()); | 638 paintTextWithEmphasisMark(context, font, selectionStyle, textRun, emphas
isMark, emphasisMarkOffset, sPos, ePos, length, textOrigin, boxRect); |
| 646 } | 639 } |
| 647 | 640 |
| 648 // Paint decorations | 641 // Paint decorations |
| 649 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); | 642 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); |
| 650 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) { | 643 if (textDecorations != TextDecorationNone && !paintSelectedTextOnly) { |
| 651 GraphicsContextStateSaver stateSaver(*context, false); | 644 GraphicsContextStateSaver stateSaver(*context, false); |
| 652 updateGraphicsContext(context, textStyle, isHorizontal(), stateSaver); | 645 updateGraphicsContext(context, textStyle, stateSaver); |
| 653 paintDecoration(context, boxOrigin, textDecorations); | 646 paintDecoration(context, boxOrigin, textDecorations); |
| 654 } | 647 } |
| 655 | 648 |
| 656 if (paintInfo.phase == PaintPhaseForeground) { | 649 if (paintInfo.phase == PaintPhaseForeground) { |
| 657 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); | 650 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); |
| 658 | 651 |
| 659 // Paint custom underlines for compositions. | 652 // Paint custom underlines for compositions. |
| 660 if (useCustomUnderlines) { | 653 if (useCustomUnderlines) { |
| 661 const Vector<CompositionUnderline>& underlines = renderer().frame()-
>inputMethodController().customCompositionUnderlines(); | 654 const Vector<CompositionUnderline>& underlines = renderer().frame()-
>inputMethodController().customCompositionUnderlines(); |
| 662 CompositionUnderlineRangeFilter filter(underlines, start(), end()); | 655 CompositionUnderlineRangeFilter filter(underlines, start(), end()); |
| 663 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begi
n(); it != filter.end(); ++it) { | 656 for (CompositionUnderlineRangeFilter::ConstIterator it = filter.begi
n(); it != filter.end(); ++it) { |
| 664 if (it->color == Color::transparent) | 657 if (it->color == Color::transparent) |
| 665 continue; | 658 continue; |
| 666 paintCompositionUnderline(context, boxOrigin, *it); | 659 paintCompositionUnderline(context, boxOrigin, *it); |
| 667 } | 660 } |
| 668 } | 661 } |
| 669 } | 662 } |
| 670 | |
| 671 if (shouldRotate) | |
| 672 context->concatCTM(rotation(boxRect, Counterclockwise)); | |
| 673 } | 663 } |
| 674 | 664 |
| 675 void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) | 665 void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) |
| 676 { | 666 { |
| 677 int startPos, endPos; | 667 int startPos, endPos; |
| 678 if (renderer().selectionState() == RenderObject::SelectionInside) { | 668 if (renderer().selectionState() == RenderObject::SelectionInside) { |
| 679 startPos = 0; | 669 startPos = 0; |
| 680 endPos = renderer().textLength(); | 670 endPos = renderer().textLength(); |
| 681 } else { | 671 } else { |
| 682 renderer().selectionStartEnd(startPos, endPos); | 672 renderer().selectionStartEnd(startPos, endPos); |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); | 1385 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); |
| 1396 const int rendererCharacterOffset = 24; | 1386 const int rendererCharacterOffset = 24; |
| 1397 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1387 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
| 1398 fputc(' ', stderr); | 1388 fputc(' ', stderr); |
| 1399 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 1389 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 1400 } | 1390 } |
| 1401 | 1391 |
| 1402 #endif | 1392 #endif |
| 1403 | 1393 |
| 1404 } // namespace blink | 1394 } // namespace blink |
| OLD | NEW |