| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 393     const FloatPoint& textOrigin, const FloatRect& boxRect, | 393     const FloatPoint& textOrigin, const FloatRect& boxRect, | 
| 394     const ShadowList* shadowList, bool stroked, bool horizontal) | 394     const ShadowList* shadowList, bool stroked, bool horizontal) | 
| 395 { | 395 { | 
| 396     // Text shadows are disabled when printing. http://crbug.com/258321 | 396     // Text shadows are disabled when printing. http://crbug.com/258321 | 
| 397     bool hasShadow = shadowList && !context->printing(); | 397     bool hasShadow = shadowList && !context->printing(); | 
| 398 | 398 | 
| 399     if (hasShadow) { | 399     if (hasShadow) { | 
| 400         DrawLooper drawLooper; | 400         DrawLooper drawLooper; | 
| 401         for (size_t i = shadowList->shadows().size(); i--; ) { | 401         for (size_t i = shadowList->shadows().size(); i--; ) { | 
| 402             const ShadowData& shadow = shadowList->shadows()[i]; | 402             const ShadowData& shadow = shadowList->shadows()[i]; | 
| 403             int shadowX = horizontal ? shadow.x() : shadow.y(); | 403             float shadowX = horizontal ? shadow.x() : shadow.y(); | 
| 404             int shadowY = horizontal ? shadow.y() : -shadow.x(); | 404             float shadowY = horizontal ? shadow.y() : -shadow.x(); | 
| 405             FloatSize offset(shadowX, shadowY); | 405             FloatSize offset(shadowX, shadowY); | 
| 406             drawLooper.addShadow(offset, shadow.blur(), renderer->resolveColor(s
      hadow.color()), | 406             drawLooper.addShadow(offset, shadow.blur(), renderer->resolveColor(s
      hadow.color()), | 
| 407                 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA
      lpha); | 407                 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresA
      lpha); | 
| 408         } | 408         } | 
| 409         drawLooper.addUnmodifiedContent(); | 409         drawLooper.addUnmodifiedContent(); | 
| 410         context->setDrawLooper(drawLooper); | 410         context->setDrawLooper(drawLooper); | 
| 411     } | 411     } | 
| 412 | 412 | 
| 413     TextRunPaintInfo textRunPaintInfo(textRun); | 413     TextRunPaintInfo textRunPaintInfo(textRun); | 
| 414     textRunPaintInfo.bounds = boxRect; | 414     textRunPaintInfo.bounds = boxRect; | 
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1080 | 1080 | 
| 1081     RenderStyle* styleToUse = renderer()->style(isFirstLineStyle()); | 1081     RenderStyle* styleToUse = renderer()->style(isFirstLineStyle()); | 
| 1082     int baseline = styleToUse->fontMetrics().ascent(); | 1082     int baseline = styleToUse->fontMetrics().ascent(); | 
| 1083 | 1083 | 
| 1084     size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; | 1084     size_t shadowCount = shadowList ? shadowList->shadows().size() : 0; | 
| 1085     // Set the thick of the line to be 10% (or something else ?)of the computed 
      font size and not less than 1px. | 1085     // Set the thick of the line to be 10% (or something else ?)of the computed 
      font size and not less than 1px. | 
| 1086     // Using computedFontSize should take care of zoom as well. | 1086     // Using computedFontSize should take care of zoom as well. | 
| 1087     const float textDecorationThickness = std::max(1.f, styleToUse->computedFont
      Size() / 10.f); | 1087     const float textDecorationThickness = std::max(1.f, styleToUse->computedFont
      Size() / 10.f); | 
| 1088     context->setStrokeThickness(textDecorationThickness); | 1088     context->setStrokeThickness(textDecorationThickness); | 
| 1089 | 1089 | 
| 1090     int extraOffset = 0; | 1090     float extraOffset = 0; | 
| 1091     if (!linesAreOpaque && shadowCount > 1) { | 1091     if (!linesAreOpaque && shadowCount > 1) { | 
| 1092         FloatRect clipRect(localOrigin, FloatSize(width, baseline + 2)); | 1092         FloatRect clipRect(localOrigin, FloatSize(width, baseline + 2)); | 
| 1093         for (size_t i = shadowCount; i--; ) { | 1093         for (size_t i = shadowCount; i--; ) { | 
| 1094             const ShadowData& s = shadowList->shadows()[i]; | 1094             const ShadowData& s = shadowList->shadows()[i]; | 
| 1095             FloatRect shadowRect(localOrigin, FloatSize(width, baseline + 2)); | 1095             FloatRect shadowRect(localOrigin, FloatSize(width, baseline + 2)); | 
| 1096             shadowRect.inflate(s.blur()); | 1096             shadowRect.inflate(s.blur()); | 
| 1097             int shadowX = isHorizontal() ? s.x() : s.y(); | 1097             float shadowX = isHorizontal() ? s.x() : s.y(); | 
| 1098             int shadowY = isHorizontal() ? s.y() : -s.x(); | 1098             float shadowY = isHorizontal() ? s.y() : -s.x(); | 
| 1099             shadowRect.move(shadowX, shadowY); | 1099             shadowRect.move(shadowX, shadowY); | 
| 1100             clipRect.unite(shadowRect); | 1100             clipRect.unite(shadowRect); | 
| 1101             extraOffset = max(extraOffset, max(0, shadowY) + s.blur()); | 1101             extraOffset = max(extraOffset, max(0.0f, shadowY) + s.blur()); | 
| 1102         } | 1102         } | 
| 1103         context->clip(clipRect); | 1103         context->clip(clipRect); | 
| 1104         extraOffset += baseline + 2; | 1104         extraOffset += baseline + 2; | 
| 1105         localOrigin.move(0, extraOffset); | 1105         localOrigin.move(0, extraOffset); | 
| 1106     } | 1106     } | 
| 1107 | 1107 | 
| 1108     for (size_t i = max(static_cast<size_t>(1), shadowCount); i--; ) { | 1108     for (size_t i = max(static_cast<size_t>(1), shadowCount); i--; ) { | 
| 1109         // Even if we have no shadows, we still want to run the code below this 
      once. | 1109         // Even if we have no shadows, we still want to run the code below this 
      once. | 
| 1110         if (i < shadowCount) { | 1110         if (i < shadowCount) { | 
| 1111             if (!i) { | 1111             if (!i) { | 
| 1112                 // The last set of lines paints normally inside the clip. | 1112                 // The last set of lines paints normally inside the clip. | 
| 1113                 localOrigin.move(0, -extraOffset); | 1113                 localOrigin.move(0, -extraOffset); | 
| 1114                 extraOffset = 0; | 1114                 extraOffset = 0; | 
| 1115             } | 1115             } | 
| 1116             const ShadowData& shadow = shadowList->shadows()[i]; | 1116             const ShadowData& shadow = shadowList->shadows()[i]; | 
| 1117             int shadowX = isHorizontal() ? shadow.x() : shadow.y(); | 1117             float shadowX = isHorizontal() ? shadow.x() : shadow.y(); | 
| 1118             int shadowY = isHorizontal() ? shadow.y() : -shadow.x(); | 1118             float shadowY = isHorizontal() ? shadow.y() : -shadow.x(); | 
| 1119             context->setShadow(FloatSize(shadowX, shadowY - extraOffset), shadow
      .blur(), shadow.color()); | 1119             context->setShadow(FloatSize(shadowX, shadowY - extraOffset), shadow
      .blur(), shadow.color()); | 
| 1120         } | 1120         } | 
| 1121 | 1121 | 
| 1122         // Offset between lines - always non-zero, so lines never cross each oth
      er. | 1122         // Offset between lines - always non-zero, so lines never cross each oth
      er. | 
| 1123         float doubleOffset = textDecorationThickness + 1.f; | 1123         float doubleOffset = textDecorationThickness + 1.f; | 
| 1124         context->setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle
      )); | 1124         context->setStrokeStyle(textDecorationStyleToStrokeStyle(decorationStyle
      )); | 
| 1125         if (deco & TextDecorationUnderline) { | 1125         if (deco & TextDecorationUnderline) { | 
| 1126             context->setStrokeColor(underline); | 1126             context->setStrokeColor(underline); | 
| 1127             const int underlineOffset = computeUnderlineOffset(styleToUse->textU
      nderlinePosition(), styleToUse->fontMetrics(), this, textDecorationThickness); | 1127             const int underlineOffset = computeUnderlineOffset(styleToUse->textU
      nderlinePosition(), styleToUse->fontMetrics(), this, textDecorationThickness); | 
| 1128             switch (decorationStyle) { | 1128             switch (decorationStyle) { | 
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1555     printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); | 1555     printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); | 
| 1556     const int rendererCharacterOffset = 24; | 1556     const int rendererCharacterOffset = 24; | 
| 1557     for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1557     for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 
| 1558         fputc(' ', stderr); | 1558         fputc(' ', stderr); | 
| 1559     fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
      ata()); | 1559     fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
      ata()); | 
| 1560 } | 1560 } | 
| 1561 | 1561 | 
| 1562 #endif | 1562 #endif | 
| 1563 | 1563 | 
| 1564 } // namespace WebCore | 1564 } // namespace WebCore | 
| OLD | NEW | 
|---|