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 // According to the specification TextUnderlinePositionAuto should default t o 'alphabetic' for horizontal text |
Julien - ping for review
2013/11/04 16:06:43
This comment should be updated as 'alphabetic' was
abinader
2013/11/04 16:38:02
Ack!
| |
926 // and to 'under Left' for vertical text (e.g. japanese). We support only ho rizontal 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) { | 927 switch (underlinePosition) { |
928 case TextUnderlinePositionAlphabetic: | |
929 case TextUnderlinePositionAuto: | 928 case TextUnderlinePositionAuto: |
930 return fontMetrics.ascent() + gap; // Position underline near the alphab etic baseline. | 929 // Position underline near the alphabetic baseline. |
930 return fontMetrics.ascent() + gap; | |
931 case TextUnderlinePositionUnder: { | 931 case TextUnderlinePositionUnder: { |
932 // Position underline relative to the under edge of the lowest element's content box. | 932 // Position underline relative to the under edge of the lowest element's content box. |
933 const float offset = inlineTextBox->root()->maxLogicalTop() - inlineText Box->logicalTop(); | 933 const float offset = inlineTextBox->root()->maxLogicalTop() - inlineText Box->logicalTop(); |
934 if (offset > 0) | 934 if (offset > 0) |
935 return inlineTextBox->logicalHeight() + gap + offset; | 935 return inlineTextBox->logicalHeight() + gap + offset; |
936 return inlineTextBox->logicalHeight() + gap; | 936 return inlineTextBox->logicalHeight() + gap; |
937 } | 937 } |
938 } | 938 } |
939 | 939 |
940 ASSERT_NOT_REACHED(); | 940 ASSERT_NOT_REACHED(); |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1567 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); | 1567 printedCharacters = fprintf(stderr, "\t%s %p", obj->renderName(), obj); |
1568 const int rendererCharacterOffset = 24; | 1568 const int rendererCharacterOffset = 24; |
1569 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1569 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
1570 fputc(' ', stderr); | 1570 fputc(' ', stderr); |
1571 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); | 1571 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); |
1572 } | 1572 } |
1573 | 1573 |
1574 #endif | 1574 #endif |
1575 | 1575 |
1576 } // namespace WebCore | 1576 } // namespace WebCore |
OLD | NEW |