| 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; |
| 64 TextDecorationStyle t; |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 COMPILE_ASSERT(sizeof(InlineTextBox) == sizeof(SameSizeAsInlineTextBox), InlineT
extBox_should_stay_small); | 67 COMPILE_ASSERT(sizeof(InlineTextBox) == sizeof(SameSizeAsInlineTextBox), InlineT
extBox_should_stay_small); |
| 66 | 68 |
| 67 typedef WTF::HashMap<const InlineTextBox*, LayoutRect> InlineTextBoxOverflowMap; | 69 typedef WTF::HashMap<const InlineTextBox*, LayoutRect> InlineTextBoxOverflowMap; |
| 68 static InlineTextBoxOverflowMap* gTextBoxesWithOverflow; | 70 static InlineTextBoxOverflowMap* gTextBoxesWithOverflow; |
| 69 | 71 |
| 70 static const int misspellingLineThickness = 3; | 72 static const int misspellingLineThickness = 3; |
| 71 | 73 |
| 72 void InlineTextBox::destroy() | 74 void InlineTextBox::destroy() |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 int startOffset = combinedText ? 0 : sPos; | 745 int startOffset = combinedText ? 0 : sPos; |
| 744 int endOffset = combinedText ? objectReplacementCharacterTextRun.len
gth() : ePos; | 746 int endOffset = combinedText ? objectReplacementCharacterTextRun.len
gth() : ePos; |
| 745 int paintRunLength = combinedText ? endOffset : length; | 747 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()); | 748 paintTextWithShadows(context, rendererToUse, combinedText ? combined
Text->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffs
et, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, sel
ectionShadow, selectionStrokeWidth > 0, isHorizontal()); |
| 747 | 749 |
| 748 if (combinedText) | 750 if (combinedText) |
| 749 context->concatCTM(rotation(boxRect, Counterclockwise)); | 751 context->concatCTM(rotation(boxRect, Counterclockwise)); |
| 750 } | 752 } |
| 751 } | 753 } |
| 752 | 754 |
| 753 // Paint decorations | 755 // lets only store decorations style and underline thickness, painting of de
coration style will be done later |
| 754 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); | 756 TextDecoration textDecorations = styleToUse->textDecorationsInEffect(); |
| 755 if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSe
lection) { | 757 if (textDecorations != TextDecorationNone && paintInfo.phase != PaintPhaseSe
lection) { |
| 756 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrok
eWidth); | 758 float textDecorationThickness = styleToUse->fontMetrics().underlineThick
ness(); |
| 757 if (combinedText) | 759 int fontHeightInt = (int)(styleToUse->fontMetrics().floatHeight() + 0.5)
; |
| 758 context->concatCTM(rotation(boxRect, Clockwise)); | 760 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fon
tHeightInt >> 1))) |
| 759 paintDecoration(context, boxOrigin, textDecorations, styleToUse->textDec
orationStyle(), textShadow); | 761 textDecorationThickness = std::max(1.f, styleToUse->computedFontSize
() / 10.f); |
| 760 if (combinedText) | |
| 761 context->concatCTM(rotation(boxRect, Counterclockwise)); | |
| 762 } | |
| 763 | 762 |
| 764 if (paintInfo.phase == PaintPhaseForeground) { | 763 setUnderlineThickness(textDecorationThickness); |
| 765 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); | 764 setTextDecoration(styleToUse->textDecorationStyle()); |
| 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 } | 765 } |
| 792 | 766 |
| 793 if (shouldRotate) | 767 if (shouldRotate) |
| 794 context->concatCTM(rotation(boxRect, Counterclockwise)); | 768 context->concatCTM(rotation(boxRect, Counterclockwise)); |
| 795 } | 769 } |
| 796 | 770 |
| 797 void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) | 771 void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) |
| 798 { | 772 { |
| 799 int startPos, endPos; | 773 int startPos, endPos; |
| 800 if (renderer().selectionState() == RenderObject::SelectionInside) { | 774 if (renderer().selectionState() == RenderObject::SelectionInside) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 break; | 878 break; |
| 905 case TextDecorationStyleDotted: | 879 case TextDecorationStyleDotted: |
| 906 strokeStyle = DottedStroke; | 880 strokeStyle = DottedStroke; |
| 907 break; | 881 break; |
| 908 case TextDecorationStyleDashed: | 882 case TextDecorationStyleDashed: |
| 909 strokeStyle = DashedStroke; | 883 strokeStyle = DashedStroke; |
| 910 break; | 884 break; |
| 911 case TextDecorationStyleWavy: | 885 case TextDecorationStyleWavy: |
| 912 strokeStyle = WavyStroke; | 886 strokeStyle = WavyStroke; |
| 913 break; | 887 break; |
| 888 case TextDecorationStyleNone: |
| 889 break; |
| 914 } | 890 } |
| 915 | 891 |
| 916 return strokeStyle; | 892 return strokeStyle; |
| 917 } | 893 } |
| 918 | 894 |
| 919 static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition,
const FontMetrics& fontMetrics, const InlineTextBox* inlineTextBox, const float
textDecorationThickness) | 895 static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition,
const FontMetrics& fontMetrics, const InlineTextBox* inlineTextBox, const float
textDecorationThickness) |
| 920 { | 896 { |
| 921 // Compute the gap between the font and the underline. Use at least one | 897 // Compute the gap between the font and the underline. Use at least one |
| 922 // pixel gap, if underline is thick then use a bigger gap. | 898 // pixel gap, if underline is thick then use a bigger gap. |
| 923 const int gap = std::max<int>(1, ceilf(textDecorationThickness / 2.f)); | 899 const int gap = std::max<int>(1, ceilf(textDecorationThickness / 2.f)); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 controlPoint2.setX(x + step); | 1030 controlPoint2.setX(x + step); |
| 1055 x += 2 * step; | 1031 x += 2 * step; |
| 1056 path.addBezierCurveTo(controlPoint1, controlPoint2, FloatPoint(x, yA
xis)); | 1032 path.addBezierCurveTo(controlPoint1, controlPoint2, FloatPoint(x, yA
xis)); |
| 1057 } | 1033 } |
| 1058 } | 1034 } |
| 1059 | 1035 |
| 1060 context->setShouldAntialias(true); | 1036 context->setShouldAntialias(true); |
| 1061 context->strokePath(path); | 1037 context->strokePath(path); |
| 1062 } | 1038 } |
| 1063 | 1039 |
| 1064 void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint&
boxOrigin, TextDecoration deco, TextDecorationStyle decorationStyle, const Shado
wList* shadowList) | 1040 void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint&
boxOrigin, TextDecoration deco, TextDecorationStyle decorationStyle, const Shado
wList* shadowList, float underlineThickness) |
| 1065 { | 1041 { |
| 1066 GraphicsContextStateSaver stateSaver(*context); | 1042 GraphicsContextStateSaver stateSaver(*context); |
| 1067 | 1043 |
| 1068 if (m_truncation == cFullTruncation) | 1044 if (m_truncation == cFullTruncation) |
| 1069 return; | 1045 return; |
| 1070 | 1046 |
| 1071 FloatPoint localOrigin = boxOrigin; | 1047 FloatPoint localOrigin = boxOrigin; |
| 1072 | 1048 |
| 1073 float width = m_logicalWidth; | 1049 float width = m_logicalWidth; |
| 1074 if (m_truncation != cNoTruncation) { | 1050 if (m_truncation != cNoTruncation) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1089 bool linesAreOpaque = !isPrinting && (!(deco & TextDecorationUnderline) || u
nderline.alpha() == 255) && (!(deco & TextDecorationOverline) || overline.alpha(
) == 255) && (!(deco & TextDecorationLineThrough) || linethrough.alpha() == 255)
; | 1065 bool linesAreOpaque = !isPrinting && (!(deco & TextDecorationUnderline) || u
nderline.alpha() == 255) && (!(deco & TextDecorationOverline) || overline.alpha(
) == 255) && (!(deco & TextDecorationLineThrough) || linethrough.alpha() == 255)
; |
| 1090 | 1066 |
| 1091 RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); | 1067 RenderStyle* styleToUse = renderer().style(isFirstLineStyle()); |
| 1092 int baseline = styleToUse->fontMetrics().ascent(); | 1068 int baseline = styleToUse->fontMetrics().ascent(); |
| 1093 | 1069 |
| 1094 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; | 1070 size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; |
| 1095 // Set the thick of the line to be 10% (or something else ?)of the computed
font size and not less than 1px. | 1071 // Set the thick of the line to be 10% (or something else ?)of the computed
font size and not less than 1px. |
| 1096 // Using computedFontSize should take care of zoom as well. | 1072 // Using computedFontSize should take care of zoom as well. |
| 1097 | 1073 |
| 1098 // Update Underline thickness, in case we have Faulty Font Metrics calculati
ng underline thickness by old method. | 1074 // Update Underline thickness, in case we have Faulty Font Metrics calculati
ng underline thickness by old method. |
| 1099 float textDecorationThickness = styleToUse->fontMetrics().underlineThickness
(); | 1075 float textDecorationThickness = 0; |
| 1100 int fontHeightInt = (int)(styleToUse->fontMetrics().floatHeight() + 0.5); | 1076 if (!underlineThickness) { |
| 1101 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fontHei
ghtInt >> 1))) | 1077 textDecorationThickness = styleToUse->fontMetrics().underlineThickness()
; |
| 1102 textDecorationThickness = std::max(1.f, styleToUse->computedFontSize() /
10.f); | 1078 int fontHeightInt = (int)(styleToUse->fontMetrics().floatHeight() + 0.5)
; |
| 1079 if ((textDecorationThickness == 0.f) || (textDecorationThickness >= (fon
tHeightInt >> 1))) |
| 1080 textDecorationThickness = std::max(1.f, styleToUse->computedFontSize
() / 10.f); |
| 1081 } else { |
| 1082 textDecorationThickness = underlineThickness; |
| 1083 } |
| 1103 | 1084 |
| 1104 context->setStrokeThickness(textDecorationThickness); | 1085 context->setStrokeThickness(textDecorationThickness); |
| 1105 | 1086 |
| 1106 switch (decorationStyle) { | 1087 switch (decorationStyle) { |
| 1107 case TextDecorationStyleDotted: | 1088 case TextDecorationStyleDotted: |
| 1108 case TextDecorationStyleDashed: | 1089 case TextDecorationStyleDashed: |
| 1109 context->setShouldAntialias(RenderBoxModelObject::shouldAntialiasLines(c
ontext)); | 1090 context->setShouldAntialias(RenderBoxModelObject::shouldAntialiasLines(c
ontext)); |
| 1110 break; | 1091 break; |
| 1111 case TextDecorationStyleSolid: | 1092 case TextDecorationStyleSolid: |
| 1112 case TextDecorationStyleDouble: | 1093 case TextDecorationStyleDouble: |
| 1113 case TextDecorationStyleWavy: | 1094 case TextDecorationStyleWavy: |
| 1095 case TextDecorationStyleNone: |
| 1114 break; | 1096 break; |
| 1115 } | 1097 } |
| 1116 | 1098 |
| 1117 float extraOffset = 0; | 1099 float extraOffset = 0; |
| 1118 if (!linesAreOpaque && shadowCount > 1) { | 1100 if (!linesAreOpaque && shadowCount > 1) { |
| 1119 FloatRect clipRect(localOrigin, FloatSize(width, baseline + 2)); | 1101 FloatRect clipRect(localOrigin, FloatSize(width, baseline + 2)); |
| 1120 for (size_t i = shadowCount; i--; ) { | 1102 for (size_t i = shadowCount; i--; ) { |
| 1121 const ShadowData& s = shadowList->shadows()[i]; | 1103 const ShadowData& s = shadowList->shadows()[i]; |
| 1122 FloatRect shadowRect(localOrigin, FloatSize(width, baseline + 2)); | 1104 FloatRect shadowRect(localOrigin, FloatSize(width, baseline + 2)); |
| 1123 shadowRect.inflate(s.blur()); | 1105 shadowRect.inflate(s.blur()); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 } | 1174 } |
| 1193 default: | 1175 default: |
| 1194 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin
.y() + 2 * baseline / 3), width, isPrinting); | 1176 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin
.y() + 2 * baseline / 3), width, isPrinting); |
| 1195 if (decorationStyle == TextDecorationStyleDouble) | 1177 if (decorationStyle == TextDecorationStyleDouble) |
| 1196 context->drawLineForText(FloatPoint(localOrigin.x(), localOr
igin.y() + doubleOffset + 2 * baseline / 3), width, isPrinting); | 1178 context->drawLineForText(FloatPoint(localOrigin.x(), localOr
igin.y() + doubleOffset + 2 * baseline / 3), width, isPrinting); |
| 1197 } | 1179 } |
| 1198 } | 1180 } |
| 1199 } | 1181 } |
| 1200 } | 1182 } |
| 1201 | 1183 |
| 1184 void InlineTextBox::paintDecorationStyle(PaintInfo& paintInfo, const LayoutPoint
& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, float underlineThickne
ss) |
| 1185 { |
| 1186 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(&renderer()) || render
er().style()->visibility() != VISIBLE |
| 1187 || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutli
ne || !m_len) |
| 1188 return; |
| 1189 |
| 1190 ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP
haseChildOutlines); |
| 1191 |
| 1192 LayoutUnit logicalLeftSide = logicalLeftVisualOverflow(); |
| 1193 LayoutUnit logicalRightSide = logicalRightVisualOverflow(); |
| 1194 LayoutUnit logicalStart = logicalLeftSide + (isHorizontal() ? paintOffset.x(
) : paintOffset.y()); |
| 1195 LayoutUnit logicalExtent = logicalRightSide - logicalLeftSide; |
| 1196 |
| 1197 LayoutUnit paintEnd = isHorizontal() ? paintInfo.rect.maxX() : paintInfo.rec
t.maxY(); |
| 1198 LayoutUnit paintStart = isHorizontal() ? paintInfo.rect.x() : paintInfo.rect
.y(); |
| 1199 |
| 1200 LayoutPoint adjustedPaintOffset = roundedIntPoint(paintOffset); |
| 1201 bool isPrinting = textRenderer().document().printing(); |
| 1202 |
| 1203 if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart) |
| 1204 return; |
| 1205 |
| 1206 // Determine whether or not we have composition underlines to draw. |
| 1207 bool containsComposition = renderer().node() && renderer().frame()->inputMet
hodController().compositionNode() == renderer().node(); |
| 1208 bool useCustomUnderlines = containsComposition && renderer().frame()->inputM
ethodController().compositionUsesCustomUnderlines(); |
| 1209 |
| 1210 // Determine whether or not we're selected. |
| 1211 bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip &&
selectionState() != RenderObject::SelectionNone; |
| 1212 if (!haveSelection && paintInfo.phase == PaintPhaseSelection) { |
| 1213 // When only painting the selection, don't bother to paint if there is n
one. |
| 1214 return; |
| 1215 } |
| 1216 |
| 1217 GraphicsContext* context = paintInfo.context; |
| 1218 RenderObject& rendererToUse = renderer(); |
| 1219 RenderStyle* styleToUse = rendererToUse.style(isFirstLineStyle()); |
| 1220 |
| 1221 // Set our font. |
| 1222 const Font& font = styleToUse->font(); |
| 1223 FloatPoint boxOrigin = locationIncludingFlipping(); |
| 1224 // FIXME: Shouldn't these offsets be rounded? |
| 1225 boxOrigin.move(adjustedPaintOffset.x().toFloat(), adjustedPaintOffset.y().to
Float()); |
| 1226 FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight())); |
| 1227 |
| 1228 TextDecoration deco = styleToUse->textDecorationsInEffect(); |
| 1229 TextDecorationStyle decorationStyle = styleToUse->textDecorationStyle(); |
| 1230 const ShadowList* textShadow = (context->printing() || paintInfo.forceBlackT
ext()) ? 0 : styleToUse->textShadow(); |
| 1231 |
| 1232 // Determine the text colors and selection colors. |
| 1233 Color textFillColor; |
| 1234 Color textStrokeColor; |
| 1235 Color emphasisMarkColor; |
| 1236 float textStrokeWidth = styleToUse->textStrokeWidth(); |
| 1237 |
| 1238 if (paintInfo.forceBlackText()) { |
| 1239 textFillColor = Color::black; |
| 1240 textStrokeColor = Color::black; |
| 1241 emphasisMarkColor = Color::black; |
| 1242 } else { |
| 1243 textFillColor = rendererToUse.resolveColor(styleToUse, CSSPropertyWebkit
TextFillColor); |
| 1244 |
| 1245 bool forceBackgroundToWhite = false; |
| 1246 if (isPrinting) { |
| 1247 if (styleToUse->printColorAdjust() == PrintColorAdjustEconomy) |
| 1248 forceBackgroundToWhite = true; |
| 1249 if (textRenderer().document().settings() && textRenderer().document(
).settings()->shouldPrintBackgrounds()) |
| 1250 forceBackgroundToWhite = false; |
| 1251 } |
| 1252 |
| 1253 // Make the text fill color legible against a white background |
| 1254 if (forceBackgroundToWhite) |
| 1255 textFillColor = correctedTextColor(textFillColor, Color::white); |
| 1256 |
| 1257 textStrokeColor = rendererToUse.resolveColor(styleToUse, CSSPropertyWebk
itTextStrokeColor); |
| 1258 |
| 1259 // Make the text stroke color legible against a white background |
| 1260 if (forceBackgroundToWhite) |
| 1261 textStrokeColor = correctedTextColor(textStrokeColor, Color::white); |
| 1262 |
| 1263 emphasisMarkColor = rendererToUse.resolveColor(styleToUse, CSSPropertyWe
bkitTextEmphasisColor); |
| 1264 |
| 1265 // Make the text stroke color legible against a white background |
| 1266 if (forceBackgroundToWhite) |
| 1267 emphasisMarkColor = correctedTextColor(emphasisMarkColor, Color::whi
te); |
| 1268 } |
| 1269 updateGraphicsContext(context, textFillColor, textStrokeColor, textStrokeWid
th); |
| 1270 paintDecoration(context, boxOrigin, deco, decorationStyle, textShadow, under
lineThickness); |
| 1271 |
| 1272 if (paintInfo.phase == PaintPhaseForeground) { |
| 1273 paintDocumentMarkers(context, boxOrigin, styleToUse, font, false); |
| 1274 |
| 1275 if (useCustomUnderlines) { |
| 1276 const Vector<CompositionUnderline>& underlines = renderer().frame()-
>inputMethodController().customCompositionUnderlines(); |
| 1277 size_t numUnderlines = underlines.size(); |
| 1278 |
| 1279 for (size_t index = 0; index < numUnderlines; ++index) { |
| 1280 const CompositionUnderline& underline = underlines[index]; |
| 1281 |
| 1282 if (underline.endOffset <= start()) { |
| 1283 // underline is completely before this run. This might be an
underline that sits |
| 1284 // before the first run we draw, or underlines that were wit
hin runs we skipped |
| 1285 // due to truncation. |
| 1286 continue; |
| 1287 } |
| 1288 |
| 1289 if (underline.startOffset <= end()) { |
| 1290 // underline intersects this run. Paint it. |
| 1291 paintCompositionUnderline(context, boxOrigin, underline); |
| 1292 if (underline.endOffset > end() + 1) { |
| 1293 // underline also runs into the next run. Bail now, no m
ore marker advancement. |
| 1294 break; |
| 1295 } |
| 1296 } else { |
| 1297 // underline is completely after this run, bail. A later run
will paint it. |
| 1298 break; |
| 1299 } |
| 1300 } |
| 1301 } |
| 1302 } |
| 1303 } |
| 1304 |
| 1305 void InlineTextBox::getPaintDecorationSyle(PaintInfo& paintInfo, const LayoutPoi
nt& paintOffset, float * underlineThickness, TextDecorationStyle * style) |
| 1306 { |
| 1307 *underlineThickness = 0; |
| 1308 if (isLineBreak() || !paintInfo.shouldPaintWithinRoot(&renderer()) || render
er().style()->visibility() != VISIBLE |
| 1309 || m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutli
ne || !m_len) |
| 1310 return; |
| 1311 |
| 1312 *underlineThickness = getUnderlineThickness(); |
| 1313 *style = getTextDecorations(); |
| 1314 } |
| 1315 |
| 1202 static GraphicsContext::DocumentMarkerLineStyle lineStyleForMarkerType(DocumentM
arker::MarkerType markerType) | 1316 static GraphicsContext::DocumentMarkerLineStyle lineStyleForMarkerType(DocumentM
arker::MarkerType markerType) |
| 1203 { | 1317 { |
| 1204 switch (markerType) { | 1318 switch (markerType) { |
| 1205 case DocumentMarker::Spelling: | 1319 case DocumentMarker::Spelling: |
| 1206 return GraphicsContext::DocumentMarkerSpellingLineStyle; | 1320 return GraphicsContext::DocumentMarkerSpellingLineStyle; |
| 1207 case DocumentMarker::Grammar: | 1321 case DocumentMarker::Grammar: |
| 1208 return GraphicsContext::DocumentMarkerGrammarLineStyle; | 1322 return GraphicsContext::DocumentMarkerGrammarLineStyle; |
| 1209 default: | 1323 default: |
| 1210 ASSERT_NOT_REACHED(); | 1324 ASSERT_NOT_REACHED(); |
| 1211 return GraphicsContext::DocumentMarkerSpellingLineStyle; | 1325 return GraphicsContext::DocumentMarkerSpellingLineStyle; |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); | 1690 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); |
| 1577 const int rendererCharacterOffset = 24; | 1691 const int rendererCharacterOffset = 24; |
| 1578 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1692 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
| 1579 fputc(' ', stderr); | 1693 fputc(' ', stderr); |
| 1580 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 1694 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 1581 } | 1695 } |
| 1582 | 1696 |
| 1583 #endif | 1697 #endif |
| 1584 | 1698 |
| 1585 } // namespace WebCore | 1699 } // namespace WebCore |
| OLD | NEW |