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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 | 915 |
916 return strokeStyle; | 916 return strokeStyle; |
917 } | 917 } |
918 | 918 |
919 static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition,
const FontMetrics& fontMetrics, const InlineTextBox* inlineTextBox, const float
textDecorationThickness) | 919 static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition,
const FontMetrics& fontMetrics, const InlineTextBox* inlineTextBox, const float
textDecorationThickness) |
920 { | 920 { |
921 // Compute the gap between the font and the underline. Use at least one | 921 // 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. | 922 // pixel gap, if underline is thick then use a bigger gap. |
923 const int gap = std::max<int>(1, ceilf(textDecorationThickness / 2.f)); | 923 const int gap = std::max<int>(1, ceilf(textDecorationThickness / 2.f)); |
924 | 924 |
925 // According to the specification TextUnderlinePositionAuto should default t
o 'alphabetic' for horizontal text | 925 // FIXME: We support only horizontal text for now. |
926 // and to 'under Left' for vertical text (e.g. japanese). We support only ho
rizontal text for now. | |
927 switch (underlinePosition) { | 926 switch (underlinePosition) { |
928 case TextUnderlinePositionAlphabetic: | |
929 case TextUnderlinePositionAuto: | 927 case TextUnderlinePositionAuto: |
930 return fontMetrics.ascent() + gap; // Position underline near the alphab
etic baseline. | 928 return fontMetrics.ascent() + gap; // Position underline near the alphab
etic baseline. |
931 case TextUnderlinePositionUnder: { | 929 case TextUnderlinePositionUnder: { |
932 // Position underline relative to the under edge of the lowest element's
content box. | 930 // Position underline relative to the under edge of the lowest element's
content box. |
933 const float offset = inlineTextBox->root()->maxLogicalTop() - inlineText
Box->logicalTop(); | 931 const float offset = inlineTextBox->root()->maxLogicalTop() - inlineText
Box->logicalTop(); |
934 if (offset > 0) | 932 if (offset > 0) |
935 return inlineTextBox->logicalHeight() + gap + offset; | 933 return inlineTextBox->logicalHeight() + gap + offset; |
936 return inlineTextBox->logicalHeight() + gap; | 934 return inlineTextBox->logicalHeight() + gap; |
937 } | 935 } |
938 } | 936 } |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); | 1565 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); |
1568 const int rendererCharacterOffset = 24; | 1566 const int rendererCharacterOffset = 24; |
1569 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1567 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
1570 fputc(' ', stderr); | 1568 fputc(' ', stderr); |
1571 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 1569 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
1572 } | 1570 } |
1573 | 1571 |
1574 #endif | 1572 #endif |
1575 | 1573 |
1576 } // namespace WebCore | 1574 } // namespace WebCore |
OLD | NEW |