| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "wtf/text/StringBuilder.h" | 53 #include "wtf/text/StringBuilder.h" |
| 54 | 54 |
| 55 using namespace std; | 55 using namespace std; |
| 56 | 56 |
| 57 namespace WebCore { | 57 namespace WebCore { |
| 58 | 58 |
| 59 struct SameSizeAsInlineTextBox : public InlineBox { | 59 struct SameSizeAsInlineTextBox : public InlineBox { |
| 60 unsigned variables[1]; | 60 unsigned variables[1]; |
| 61 unsigned short variables2[2]; | 61 unsigned short variables2[2]; |
| 62 void* pointers[2]; | 62 void* pointers[2]; |
| 63 float u; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 COMPILE_ASSERT(sizeof(InlineTextBox) == sizeof(SameSizeAsInlineTextBox), InlineT
extBox_should_stay_small); | 66 COMPILE_ASSERT(sizeof(InlineTextBox) == sizeof(SameSizeAsInlineTextBox), InlineT
extBox_should_stay_small); |
| 66 | 67 |
| 67 typedef WTF::HashMap<const InlineTextBox*, LayoutRect> InlineTextBoxOverflowMap; | 68 typedef WTF::HashMap<const InlineTextBox*, LayoutRect> InlineTextBoxOverflowMap; |
| 68 static InlineTextBoxOverflowMap* gTextBoxesWithOverflow; | 69 static InlineTextBoxOverflowMap* gTextBoxesWithOverflow; |
| 69 | 70 |
| 70 static const int misspellingLineThickness = 3; | 71 static const int misspellingLineThickness = 3; |
| 71 | 72 |
| 72 void InlineTextBox::destroy() | 73 void InlineTextBox::destroy() |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 458 |
| 458 if (!containingBlock->parent()->isRubyRun()) | 459 if (!containingBlock->parent()->isRubyRun()) |
| 459 return true; // Cannot get the ruby text. | 460 return true; // Cannot get the ruby text. |
| 460 | 461 |
| 461 RenderRubyText* rubyText = toRenderRubyRun(containingBlock->parent())->rubyT
ext(); | 462 RenderRubyText* rubyText = toRenderRubyRun(containingBlock->parent())->rubyT
ext(); |
| 462 | 463 |
| 463 // The emphasis marks over are suppressed only if there is a ruby text box a
nd it not empty. | 464 // The emphasis marks over are suppressed only if there is a ruby text box a
nd it not empty. |
| 464 return !rubyText || !rubyText->firstLineBox(); | 465 return !rubyText || !rubyText->firstLineBox(); |
| 465 } | 466 } |
| 466 | 467 |
| 467 void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit /*lineTop*/, LayoutUnit /*lineBottom*/) | 468 bool InlineTextBox::isLogicalStartEndCorrect(PaintInfo& paintInfo, const LayoutP
oint& paintOffset) |
| 468 { | 469 { |
| 469 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(&renderer()) || render
er().style()->visibility() != VISIBLE | 470 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(&renderer()) || render
er().style()->visibility() != VISIBLE |
| 470 || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutli
ne || !m_len) | 471 || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutli
ne || !m_len) |
| 471 return; | 472 return false; |
| 472 | |
| 473 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines); | |
| 474 | 473 |
| 475 LayoutUnit logicalLeftSide = logicalLeftVisualOverflow(); | 474 LayoutUnit logicalLeftSide = logicalLeftVisualOverflow(); |
| 476 LayoutUnit logicalRightSide = logicalRightVisualOverflow(); | 475 LayoutUnit logicalRightSide = logicalRightVisualOverflow(); |
| 477 LayoutUnit logicalStart = logicalLeftSide + (isHorizontal() ? paintOffset.x(
) : paintOffset.y()); | 476 LayoutUnit logicalStart = logicalLeftSide + (isHorizontal() ? paintOffset.x(
) : paintOffset.y()); |
| 478 LayoutUnit logicalExtent = logicalRightSide - logicalLeftSide; | 477 LayoutUnit logicalExtent = logicalRightSide - logicalLeftSide; |
| 479 | 478 |
| 480 LayoutUnit paintEnd = isHorizontal() ? paintInfo.rect.maxX() : paintInfo.rec
t.maxY(); | 479 LayoutUnit paintEnd = isHorizontal() ? paintInfo.rect.maxX() : paintInfo.rec
t.maxY(); |
| 481 LayoutUnit paintStart = isHorizontal() ? paintInfo.rect.x() : paintInfo.rect
.y(); | 480 LayoutUnit paintStart = isHorizontal() ? paintInfo.rect.x() : paintInfo.rect
.y(); |
| 482 | 481 |
| 483 LayoutPoint adjustedPaintOffset = roundedIntPoint(paintOffset); | |
| 484 | |
| 485 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart) | 482 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart) |
| 486 return; | 483 return false; |
| 487 | 484 |
| 488 bool isPrinting = textRenderer().document().printing(); | 485 bool isPrinting = textRenderer().document().printing(); |
| 489 | 486 |
| 490 // Determine whether or not we're selected. | 487 // Determine whether or not we're selected. |
| 491 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip &&
selectionState() != RenderObject::SelectionNone; | 488 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip &&
selectionState() != RenderObject::SelectionNone; |
| 492 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) | 489 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) { |
| 493 // When only painting the selection, don't bother to paint if there is n
one. | 490 // When only painting the selection, don't bother to paint if there is n
one. |
| 491 return false; |
| 492 } |
| 493 |
| 494 return true; |
| 495 } |
| 496 void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
LayoutUnit /*lineTop*/, LayoutUnit /*lineBottom*/) |
| 497 { |
| 498 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines); |
| 499 |
| 500 if (!isLogicalStartEndCorrect(paintInfo, paintOffset)) |
| 494 return; | 501 return; |
| 495 | 502 |
| 503 LayoutPoint adjustedPaintOffset = roundedIntPoint(paintOffset); |
| 504 bool isPrinting = textRenderer().document().printing(); |
| 505 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip &&
selectionState() != RenderObject::SelectionNone; |
| 506 |
| 496 if (m_truncation != cNoTruncation) { | 507 if (m_truncation != cNoTruncation) { |
| 497 if (renderer().containingBlock()->style()->isLeftToRightDirection() != i
sLeftToRightDirection()) { | 508 if (renderer().containingBlock()->style()->isLeftToRightDirection() != i
sLeftToRightDirection()) { |
| 498 // Make the visible fragment of text hug the edge closest to the res
t of the run by moving the origin | 509 // Make the visible fragment of text hug the edge closest to the res
t of the run by moving the origin |
| 499 // at which we start drawing text. | 510 // at which we start drawing text. |
| 500 // e.g. In the case of LTR text truncated in an RTL Context, the cor
rect behavior is: | 511 // e.g. In the case of LTR text truncated in an RTL Context, the cor
rect behavior is: |
| 501 // |Hello|CBA| -> |...He|CBA| | 512 // |Hello|CBA| -> |...He|CBA| |
| 502 // In order to draw the fragment "He" aligned to the right edge of i
t's box, we need to start drawing | 513 // In order to draw the fragment "He" aligned to the right edge of i
t's box, we need to start drawing |
| 503 // farther to the right. | 514 // farther to the right. |
| 504 // NOTE: WebKit's behavior differs from that of IE which appears to
just overlay the ellipsis on top of the | 515 // NOTE: WebKit's behavior differs from that of IE which appears to
just overlay the ellipsis on top of the |
| 505 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| | 516 // truncated string i.e. |Hello|CBA| -> |...lo|CBA| |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 int startOffset = combinedText ? 0 : sPos; | 754 int startOffset = combinedText ? 0 : sPos; |
| 744 int endOffset = combinedText ? objectReplacementCharacterTextRun.len
gth() : ePos; | 755 int endOffset = combinedText ? objectReplacementCharacterTextRun.len
gth() : ePos; |
| 745 int paintRunLength = combinedText ? endOffset : length; | 756 int paintRunLength = combinedText ? endOffset : length; |
| 746 paintTextWithShadows(context, rendererToUse, combinedText ? combined
Text->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffs
et, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, sel
ectionShadow, selectionStrokeWidth > 0, isHorizontal()); | 757 paintTextWithShadows(context, rendererToUse, combinedText ? combined
Text->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffs
et, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, sel
ectionShadow, selectionStrokeWidth > 0, isHorizontal()); |
| 747 | 758 |
| 748 if (combinedText) | 759 if (combinedText) |
| 749 context->concatCTM(rotation(boxRect, Counterclockwise)); | 760 context->concatCTM(rotation(boxRect, Counterclockwise)); |
| 750 } | 761 } |
| 751 } | 762 } |
| 752 | 763 |
| 753 // Paint decorations | 764 // lets only store decorations style and underline thickness, painting of de
coration style will be done later |
| 754 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); | 765 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); |
| 755 if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSe
lection) { | 766 if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSe
lection) { |
| 756 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrok
eWidth); | 767 float textDecorationThickness = styleToUse->fontMetrics().underlineThick
ness(); |
| 757 if (combinedText) | 768 int fontHeightInt = (int)(styleToUse->fontMetrics().floatHeight() + 0.5)
; |
| 758 context->concatCTM(rotation(boxRect, Clockwise)); | 769 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fon
tHeightInt >> 1))) |
| 759 paintDecoration(context, boxOrigin, textDecorations, textShadow); | 770 textDecorationThickness = std::max(1.f, styleToUse->computedFontSize
() / 10.f); |
| 760 if (combinedText) | |
| 761 context->concatCTM(rotation(boxRect, Counterclockwise)); | |
| 762 } | |
| 763 | 771 |
| 764 if (paintInfo.phase == PaintPhaseForeground) { | 772 setDecorationThickness(textDecorationThickness); |
| 765 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); | |
| 766 | |
| 767 if (useCustomUnderlines) { | |
| 768 const Vector<CompositionUnderline>& underlines = renderer().frame()-
>inputMethodController().customCompositionUnderlines(); | |
| 769 size_t numUnderlines = underlines.size(); | |
| 770 | |
| 771 for (size_t index = 0; index < numUnderlines; ++index) { | |
| 772 const CompositionUnderline& underline = underlines[index]; | |
| 773 | |
| 774 if (underline.endOffset <= start()) | |
| 775 // underline is completely before this run. This might be a
n underline that sits | |
| 776 // before the first run we draw, or underlines that were wit
hin runs we skipped | |
| 777 // due to truncation. | |
| 778 continue; | |
| 779 | |
| 780 if (underline.startOffset <= end()) { | |
| 781 // underline intersects this run. Paint it. | |
| 782 paintCompositionUnderline(context, boxOrigin, underline); | |
| 783 if (underline.endOffset > end() + 1) | |
| 784 // underline also runs into the next run. Bail now, no m
ore marker advancement. | |
| 785 break; | |
| 786 } else | |
| 787 // underline is completely after this run, bail. A later ru
n will paint it. | |
| 788 break; | |
| 789 } | |
| 790 } | |
| 791 } | 773 } |
| 792 | 774 |
| 793 if (shouldRotate) | 775 if (shouldRotate) |
| 794 context->concatCTM(rotation(boxRect, Counterclockwise)); | 776 context->concatCTM(rotation(boxRect, Counterclockwise)); |
| 795 } | 777 } |
| 796 | 778 |
| 797 void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) | 779 void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) |
| 798 { | 780 { |
| 799 int startPos, endPos; | 781 int startPos, endPos; |
| 800 if (renderer().selectionState() == RenderObject::SelectionInside) { | 782 if (renderer().selectionState() == RenderObject::SelectionInside) { |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 context->setShouldAntialias(antialiasDecoration); | 1068 context->setShouldAntialias(antialiasDecoration); |
| 1087 // Fall through | 1069 // Fall through |
| 1088 default: | 1070 default: |
| 1089 context->drawLineForText(start, width, isPrinting); | 1071 context->drawLineForText(start, width, isPrinting); |
| 1090 | 1072 |
| 1091 if (decoration.style == TextDecorationStyleDouble) | 1073 if (decoration.style == TextDecorationStyleDouble) |
| 1092 context->drawLineForText(start + FloatPoint(0, doubleOffset), width,
isPrinting); | 1074 context->drawLineForText(start + FloatPoint(0, doubleOffset), width,
isPrinting); |
| 1093 } | 1075 } |
| 1094 } | 1076 } |
| 1095 | 1077 |
| 1096 void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint&
boxOrigin, TextDecoration deco, const ShadowList* shadowList) | 1078 void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint&
boxOrigin, TextDecoration deco, const ShadowList* shadowList, float decorationTh
ickness) |
| 1097 { | 1079 { |
| 1098 GraphicsContextStateSaver stateSaver(*context); | 1080 GraphicsContextStateSaver stateSaver(*context); |
| 1099 | 1081 |
| 1100 if (m_truncation == cFullTruncation) | 1082 if (m_truncation == cFullTruncation) |
| 1101 return; | 1083 return; |
| 1102 | 1084 |
| 1103 FloatPoint localOrigin = boxOrigin; | 1085 FloatPoint localOrigin = boxOrigin; |
| 1104 | 1086 |
| 1105 float width = m_logicalWidth; | 1087 float width = m_logicalWidth; |
| 1106 if (m_truncation != cNoTruncation) { | 1088 if (m_truncation != cNoTruncation) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1122 bool linesAreOpaque = !isPrinting && (!(deco & TextDecorationUnderline) || u
nderline.color.alpha() == 255) && (!(deco & TextDecorationOverline) || overline.
color.alpha() == 255) && (!(deco & TextDecorationLineThrough) || linethrough.col
or.alpha() == 255); | 1104 bool linesAreOpaque = !isPrinting && (!(deco & TextDecorationUnderline) || u
nderline.color.alpha() == 255) && (!(deco & TextDecorationOverline) || overline.
color.alpha() == 255) && (!(deco & TextDecorationLineThrough) || linethrough.col
or.alpha() == 255); |
| 1123 | 1105 |
| 1124 RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); | 1106 RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); |
| 1125 int baseline = styleToUse->fontMetrics().ascent(); | 1107 int baseline = styleToUse->fontMetrics().ascent(); |
| 1126 | 1108 |
| 1127 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; | 1109 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; |
| 1128 // Set the thick of the line to be 10% (or something else ?)of the computed
font size and not less than 1px. | 1110 // Set the thick of the line to be 10% (or something else ?)of the computed
font size and not less than 1px. |
| 1129 // Using computedFontSize should take care of zoom as well. | 1111 // Using computedFontSize should take care of zoom as well. |
| 1130 | 1112 |
| 1131 // Update Underline thickness, in case we have Faulty Font Metrics calculati
ng underline thickness by old method. | 1113 // Update Underline thickness, in case we have Faulty Font Metrics calculati
ng underline thickness by old method. |
| 1132 float textDecorationThickness = styleToUse->fontMetrics().underlineThickness
(); | 1114 float textDecorationThickness = 0; |
| 1133 int fontHeightInt = (int)(styleToUse->fontMetrics().floatHeight() + 0.5); | 1115 if (!decorationThickness) { |
| 1134 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fontHei
ghtInt >> 1))) | 1116 textDecorationThickness = styleToUse->fontMetrics().underlineThickness()
; |
| 1135 textDecorationThickness = std::max(1.f, styleToUse->computedFontSize() /
10.f); | 1117 int fontHeightInt = (int)(styleToUse->fontMetrics().floatHeight() + 0.5)
; |
| 1118 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fon
tHeightInt >> 1))) |
| 1119 textDecorationThickness = std::max(1.f, styleToUse->computedFontSize
() / 10.f); |
| 1120 } else { |
| 1121 textDecorationThickness = decorationThickness; |
| 1122 } |
| 1136 | 1123 |
| 1137 context->setStrokeThickness(textDecorationThickness); | 1124 context->setStrokeThickness(textDecorationThickness); |
| 1138 | 1125 |
| 1139 bool antialiasDecoration = shouldSetDecorationAntialias(overline.style, unde
rline.style, linethrough.style) | 1126 bool antialiasDecoration = shouldSetDecorationAntialias(overline.style, unde
rline.style, linethrough.style) |
| 1140 && RenderBoxModelObject::shouldAntialiasLines(context); | 1127 && RenderBoxModelObject::shouldAntialiasLines(context); |
| 1141 | 1128 |
| 1142 float extraOffset = 0; | 1129 float extraOffset = 0; |
| 1143 if (!linesAreOpaque && shadowCount > 1) { | 1130 if (!linesAreOpaque && shadowCount > 1) { |
| 1144 FloatRect clipRect(localOrigin, FloatSize(width, baseline + 2)); | 1131 FloatRect clipRect(localOrigin, FloatSize(width, baseline + 2)); |
| 1145 for (size_t i = shadowCount; i--; ) { | 1132 for (size_t i = shadowCount; i--; ) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 if (deco & TextDecorationOverline) { | 1168 if (deco & TextDecorationOverline) { |
| 1182 paintAppliedDecoration(context, localOrigin, width, -doubleOffset, 1
, overline, textDecorationThickness, antialiasDecoration, isPrinting); | 1169 paintAppliedDecoration(context, localOrigin, width, -doubleOffset, 1
, overline, textDecorationThickness, antialiasDecoration, isPrinting); |
| 1183 } | 1170 } |
| 1184 if (deco & TextDecorationLineThrough) { | 1171 if (deco & TextDecorationLineThrough) { |
| 1185 const float lineThroughOffset = 2 * baseline / 3; | 1172 const float lineThroughOffset = 2 * baseline / 3; |
| 1186 paintAppliedDecoration(context, localOrigin + FloatPoint(0, lineThro
ughOffset), width, doubleOffset, 0, linethrough, textDecorationThickness, antial
iasDecoration, isPrinting); | 1173 paintAppliedDecoration(context, localOrigin + FloatPoint(0, lineThro
ughOffset), width, doubleOffset, 0, linethrough, textDecorationThickness, antial
iasDecoration, isPrinting); |
| 1187 } | 1174 } |
| 1188 } | 1175 } |
| 1189 } | 1176 } |
| 1190 | 1177 |
| 1178 void InlineTextBox::paintDecorationStyle(PaintInfo& paintInfo, const LayoutPoint
& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, float decorationThickn
ess) |
| 1179 { |
| 1180 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines); |
| 1181 |
| 1182 if (!isLogicalStartEndCorrect(paintInfo, paintOffset)) |
| 1183 return; |
| 1184 |
| 1185 LayoutPoint adjustedPaintOffset = roundedIntPoint(paintOffset); |
| 1186 GraphicsContext* context = paintInfo.context; |
| 1187 RenderObject& rendererToUse = renderer(); |
| 1188 RenderStyle* styleToUse = rendererToUse.style(isFirstLineStyle()); |
| 1189 |
| 1190 FloatPoint boxOrigin = locationIncludingFlipping(); |
| 1191 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); |
| 1192 |
| 1193 TextDecoration deco = styleToUse->textDecorationsInEffect(); |
| 1194 const ShadowList* textShadow = (context->printing() || paintInfo.forceBlackT
ext()) ? 0 : styleToUse->textShadow(); |
| 1195 |
| 1196 paintDecoration(context, boxOrigin, deco, textShadow, decorationThickness); |
| 1197 if (paintInfo.phase == PaintPhaseForeground) { |
| 1198 const Font& font = styleToUse->font(); |
| 1199 bool containsComposition = renderer().node() && renderer().frame()->inpu
tMethodController().compositionNode() == renderer().node(); |
| 1200 bool useCustomUnderlines = containsComposition && renderer().frame()->in
putMethodController().compositionUsesCustomUnderlines(); |
| 1201 |
| 1202 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); |
| 1203 |
| 1204 if (useCustomUnderlines) { |
| 1205 const Vector<CompositionUnderline>& underlines = renderer().frame()-
>inputMethodController().customCompositionUnderlines(); |
| 1206 size_t numUnderlines = underlines.size(); |
| 1207 |
| 1208 for (size_t index = 0; index < numUnderlines; ++index) { |
| 1209 const CompositionUnderline& underline = underlines[index]; |
| 1210 |
| 1211 if (underline.endOffset <= start()) { |
| 1212 // underline is completely before this run. This might be an
underline that sits |
| 1213 // before the first run we draw, or underlines that were wit
hin runs we skipped |
| 1214 // due to truncation. |
| 1215 continue; |
| 1216 } |
| 1217 |
| 1218 if (underline.startOffset <= end()) { |
| 1219 // underline intersects this run. Paint it. |
| 1220 paintCompositionUnderline(context, boxOrigin, underline); |
| 1221 if (underline.endOffset > end() + 1) { |
| 1222 // underline also runs into the next run. Bail now, no m
ore marker advancement. |
| 1223 break; |
| 1224 } |
| 1225 } else { |
| 1226 // underline is completely after this run, bail. A later run
will paint it. |
| 1227 break; |
| 1228 } |
| 1229 } |
| 1230 } |
| 1231 } |
| 1232 } |
| 1233 |
| 1234 void InlineTextBox::getPaintDecorationSyle(PaintInfo& paintInfo, const LayoutPoi
nt& paintOffset, float * decorationThickness) |
| 1235 { |
| 1236 *decorationThickness = 0; |
| 1237 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(&renderer()) || render
er().style()->visibility() != VISIBLE |
| 1238 || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutli
ne || !m_len) |
| 1239 return; |
| 1240 |
| 1241 *decorationThickness = getDecorationThickness(); |
| 1242 } |
| 1243 |
| 1191 static GraphicsContext::DocumentMarkerLineStyle lineStyleForMarkerType(DocumentM
arker::MarkerType markerType) | 1244 static GraphicsContext::DocumentMarkerLineStyle lineStyleForMarkerType(DocumentM
arker::MarkerType markerType) |
| 1192 { | 1245 { |
| 1193 switch (markerType) { | 1246 switch (markerType) { |
| 1194 case DocumentMarker::Spelling: | 1247 case DocumentMarker::Spelling: |
| 1195 return GraphicsContext::DocumentMarkerSpellingLineStyle; | 1248 return GraphicsContext::DocumentMarkerSpellingLineStyle; |
| 1196 case DocumentMarker::Grammar: | 1249 case DocumentMarker::Grammar: |
| 1197 return GraphicsContext::DocumentMarkerGrammarLineStyle; | 1250 return GraphicsContext::DocumentMarkerGrammarLineStyle; |
| 1198 default: | 1251 default: |
| 1199 ASSERT_NOT_REACHED(); | 1252 ASSERT_NOT_REACHED(); |
| 1200 return GraphicsContext::DocumentMarkerSpellingLineStyle; | 1253 return GraphicsContext::DocumentMarkerSpellingLineStyle; |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); | 1618 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); |
| 1566 const int rendererCharacterOffset = 24; | 1619 const int rendererCharacterOffset = 24; |
| 1567 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1620 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
| 1568 fputc(' ', stderr); | 1621 fputc(' ', stderr); |
| 1569 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 1622 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 1570 } | 1623 } |
| 1571 | 1624 |
| 1572 #endif | 1625 #endif |
| 1573 | 1626 |
| 1574 } // namespace WebCore | 1627 } // namespace WebCore |
| OLD | NEW |