| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 | 861 |
| 862 LineDirectionMode lineDirection = parent->isHorizontalWritingMode() ? Ho
rizontalLine : VerticalLine; | 862 LineDirectionMode lineDirection = parent->isHorizontalWritingMode() ? Ho
rizontalLine : VerticalLine; |
| 863 | 863 |
| 864 if (verticalAlign == SUB) | 864 if (verticalAlign == SUB) |
| 865 verticalPosition += fontSize / 5 + 1; | 865 verticalPosition += fontSize / 5 + 1; |
| 866 else if (verticalAlign == SUPER) | 866 else if (verticalAlign == SUPER) |
| 867 verticalPosition -= fontSize / 3 + 1; | 867 verticalPosition -= fontSize / 3 + 1; |
| 868 else if (verticalAlign == TEXT_TOP) | 868 else if (verticalAlign == TEXT_TOP) |
| 869 verticalPosition += renderer->baselinePosition(baselineType(), first
Line, lineDirection) - fontMetrics.ascent(baselineType()); | 869 verticalPosition += renderer->baselinePosition(baselineType(), first
Line, lineDirection) - fontMetrics.ascent(baselineType()); |
| 870 else if (verticalAlign == MIDDLE) | 870 else if (verticalAlign == MIDDLE) |
| 871 verticalPosition += -static_cast<int>(fontMetrics.xHeight() / 2) - r
enderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(b
aselineType(), firstLine, lineDirection); | 871 verticalPosition = (verticalPosition - static_cast<LayoutUnit>(fontM
etrics.xHeight() / 2) - renderer->lineHeight(firstLine, lineDirection) / 2 + ren
derer->baselinePosition(baselineType(), firstLine, lineDirection)).round(); |
| 872 else if (verticalAlign == TEXT_BOTTOM) { | 872 else if (verticalAlign == TEXT_BOTTOM) { |
| 873 verticalPosition += fontMetrics.descent(baselineType()); | 873 verticalPosition += fontMetrics.descent(baselineType()); |
| 874 // lineHeight - baselinePosition is always 0 for replaced elements (
except inline blocks), so don't bother wasting time in that case. | 874 // lineHeight - baselinePosition is always 0 for replaced elements (
except inline blocks), so don't bother wasting time in that case. |
| 875 if (!renderer->isReplaced() || renderer->isInlineBlockOrInlineTable(
)) | 875 if (!renderer->isReplaced() || renderer->isInlineBlockOrInlineTable(
)) |
| 876 verticalPosition -= (renderer->lineHeight(firstLine, lineDirecti
on) - renderer->baselinePosition(baselineType(), firstLine, lineDirection)); | 876 verticalPosition -= (renderer->lineHeight(firstLine, lineDirecti
on) - renderer->baselinePosition(baselineType(), firstLine, lineDirection)); |
| 877 } else if (verticalAlign == BASELINE_MIDDLE) | 877 } else if (verticalAlign == BASELINE_MIDDLE) |
| 878 verticalPosition += -renderer->lineHeight(firstLine, lineDirection)
/ 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection); | 878 verticalPosition += -renderer->lineHeight(firstLine, lineDirection)
/ 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection); |
| 879 else if (verticalAlign == LENGTH) | 879 else if (verticalAlign == LENGTH) |
| 880 verticalPosition -= valueForLength(renderer->style()->verticalAlignL
ength(), renderer->lineHeight(firstLine, lineDirection), renderer->view()); | 880 verticalPosition -= valueForLength(renderer->style()->verticalAlignL
ength(), renderer->lineHeight(firstLine, lineDirection), renderer->view()); |
| 881 } | 881 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 } | 974 } |
| 975 | 975 |
| 976 #ifndef NDEBUG | 976 #ifndef NDEBUG |
| 977 const char* RootInlineBox::boxName() const | 977 const char* RootInlineBox::boxName() const |
| 978 { | 978 { |
| 979 return "RootInlineBox"; | 979 return "RootInlineBox"; |
| 980 } | 980 } |
| 981 #endif | 981 #endif |
| 982 | 982 |
| 983 } // namespace WebCore | 983 } // namespace WebCore |
| OLD | NEW |