| 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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 | 1100 |
| 1101 // Use a special function for underlines to get the positioning exactly righ
t. | 1101 // Use a special function for underlines to get the positioning exactly righ
t. |
| 1102 bool isPrinting = textRenderer()->document()->printing(); | 1102 bool isPrinting = textRenderer()->document()->printing(); |
| 1103 context->setStrokeThickness(textDecorationThickness); | 1103 context->setStrokeThickness(textDecorationThickness); |
| 1104 | 1104 |
| 1105 bool linesAreOpaque = !isPrinting && (!(deco & TextDecorationUnderline) || u
nderline.alpha() == 255) && (!(deco & TextDecorationOverline) || overline.alpha(
) == 255) && (!(deco & TextDecorationLineThrough) || linethrough.alpha() == 255)
; | 1105 bool linesAreOpaque = !isPrinting && (!(deco & TextDecorationUnderline) || u
nderline.alpha() == 255) && (!(deco & TextDecorationOverline) || overline.alpha(
) == 255) && (!(deco & TextDecorationLineThrough) || linethrough.alpha() == 255)
; |
| 1106 | 1106 |
| 1107 RenderStyle* styleToUse = renderer()->style(isFirstLineStyle()); | 1107 RenderStyle* styleToUse = renderer()->style(isFirstLineStyle()); |
| 1108 int baseline = styleToUse->fontMetrics().ascent(); | 1108 int baseline = styleToUse->fontMetrics().ascent(); |
| 1109 | 1109 |
| 1110 int extraOffset = 0; | 1110 LayoutUnit extraOffset = 0; |
| 1111 if (!linesAreOpaque && shadow && shadow->next()) { | 1111 if (!linesAreOpaque && shadow && shadow->next()) { |
| 1112 FloatRect clipRect(localOrigin, FloatSize(width, baseline + 2)); | 1112 FloatRect clipRect(localOrigin, FloatSize(width, baseline + 2)); |
| 1113 for (const ShadowData* s = shadow; s; s = s->next()) { | 1113 for (const ShadowData* s = shadow; s; s = s->next()) { |
| 1114 FloatRect shadowRect(localOrigin, FloatSize(width, baseline + 2)); | 1114 FloatRect shadowRect(localOrigin, FloatSize(width, baseline + 2)); |
| 1115 shadowRect.inflate(s->blur()); | 1115 shadowRect.inflate(s->blur()); |
| 1116 int shadowX = isHorizontal() ? s->x() : s->y(); | 1116 LayoutUnit shadowX = isHorizontal() ? s->x() : s->y(); |
| 1117 int shadowY = isHorizontal() ? s->y() : -s->x(); | 1117 LayoutUnit shadowY = isHorizontal() ? s->y() : -s->x(); |
| 1118 shadowRect.move(shadowX, shadowY); | 1118 shadowRect.move(shadowX, shadowY); |
| 1119 clipRect.unite(shadowRect); | 1119 clipRect.unite(shadowRect); |
| 1120 extraOffset = max(extraOffset, max(0, shadowY) + s->blur()); | 1120 extraOffset = max(extraOffset, max(LayoutUnit(0), shadowY) + s->blur
()); |
| 1121 } | 1121 } |
| 1122 context->clip(clipRect); | 1122 context->clip(clipRect); |
| 1123 extraOffset += baseline + 2; | 1123 extraOffset += baseline + 2; |
| 1124 localOrigin.move(0, extraOffset); | 1124 localOrigin.move(0, extraOffset); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 do { | 1127 do { |
| 1128 if (shadow) { | 1128 if (shadow) { |
| 1129 if (!shadow->next()) { | 1129 if (!shadow->next()) { |
| 1130 // The last set of lines paints normally inside the clip. | 1130 // The last set of lines paints normally inside the clip. |
| 1131 localOrigin.move(0, -extraOffset); | 1131 localOrigin.move(0, -extraOffset); |
| 1132 extraOffset = 0; | 1132 extraOffset = 0; |
| 1133 } | 1133 } |
| 1134 int shadowX = isHorizontal() ? shadow->x() : shadow->y(); | 1134 LayoutUnit shadowX = isHorizontal() ? shadow->x() : shadow->y(); |
| 1135 int shadowY = isHorizontal() ? shadow->y() : -shadow->x(); | 1135 LayoutUnit shadowY = isHorizontal() ? shadow->y() : -shadow->x(); |
| 1136 context->setShadow(FloatSize(shadowX, shadowY - extraOffset), shadow
->blur(), | 1136 context->setShadow(FloatSize(shadowX, shadowY - extraOffset), shadow
->blur(), |
| 1137 renderer()->resolveColor(shadow->color(), Color::stdShadowColor)
); | 1137 renderer()->resolveColor(shadow->color(), Color::stdShadowColor)
); |
| 1138 shadow = shadow->next(); | 1138 shadow = shadow->next(); |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 // Offset between lines - always non-zero, so lines never cross each oth
er. | 1141 // Offset between lines - always non-zero, so lines never cross each oth
er. |
| 1142 float doubleOffset = textDecorationThickness + 1.f; | 1142 float doubleOffset = textDecorationThickness + 1.f; |
| 1143 context->setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle
)); | 1143 context->setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle
)); |
| 1144 if (deco & TextDecorationUnderline) { | 1144 if (deco & TextDecorationUnderline) { |
| 1145 context->setStrokeColor(underline); | 1145 context->setStrokeColor(underline); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); | 1554 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); |
| 1555 const int rendererCharacterOffset = 24; | 1555 const int rendererCharacterOffset = 24; |
| 1556 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1556 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
| 1557 fputc(' ', stderr); | 1557 fputc(' ', stderr); |
| 1558 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 1558 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 #endif | 1561 #endif |
| 1562 | 1562 |
| 1563 } // namespace WebCore | 1563 } // namespace WebCore |
| OLD | NEW |