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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 | 790 |
791 // Examine the font box for inline flows and text boxes to see if any pa
rt of it is above the baseline. | 791 // Examine the font box for inline flows and text boxes to see if any pa
rt of it is above the baseline. |
792 // If the top of our font box relative to the root box baseline is above
the root box baseline, then | 792 // If the top of our font box relative to the root box baseline is above
the root box baseline, then |
793 // we are contributing to the maxAscent value. Descent is similar. If an
y part of our font box is below | 793 // we are contributing to the maxAscent value. Descent is similar. If an
y part of our font box is below |
794 // the root box's baseline, then we contribute to the maxDescent value. | 794 // the root box's baseline, then we contribute to the maxDescent value. |
795 affectsAscent = ascentWithLeading - box->logicalTop() > 0; | 795 affectsAscent = ascentWithLeading - box->logicalTop() > 0; |
796 affectsDescent = descentWithLeading + box->logicalTop() > 0; | 796 affectsDescent = descentWithLeading + box->logicalTop() > 0; |
797 } | 797 } |
798 | 798 |
799 if (includeFontForBox(box) && !setUsedFont) { | 799 if (includeFontForBox(box) && !setUsedFont) { |
800 int fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics
().ascent(); | 800 int fontAscent = box->renderer()->style(isFirstLineStyle())->fontMetrics
().ascent(baselineType()); |
801 int fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetric
s().descent(); | 801 int fontDescent = box->renderer()->style(isFirstLineStyle())->fontMetric
s().descent(baselineType()); |
802 setAscentAndDescent(ascent, descent, fontAscent, fontDescent, ascentDesc
entSet); | 802 setAscentAndDescent(ascent, descent, fontAscent, fontDescent, ascentDesc
entSet); |
803 affectsAscent = fontAscent - box->logicalTop() > 0; | 803 affectsAscent = fontAscent - box->logicalTop() > 0; |
804 affectsDescent = fontDescent + box->logicalTop() > 0; | 804 affectsDescent = fontDescent + box->logicalTop() > 0; |
805 } | 805 } |
806 | 806 |
807 if (includeGlyphsForBox(box) && glyphOverflow && glyphOverflow->computeBound
s) { | 807 if (includeGlyphsForBox(box) && glyphOverflow && glyphOverflow->computeBound
s) { |
808 setAscentAndDescent(ascent, descent, glyphOverflow->top, glyphOverflow->
bottom, ascentDescentSet); | 808 setAscentAndDescent(ascent, descent, glyphOverflow->top, glyphOverflow->
bottom, ascentDescentSet); |
809 affectsAscent = glyphOverflow->top - box->logicalTop() > 0; | 809 affectsAscent = glyphOverflow->top - box->logicalTop() > 0; |
810 affectsDescent = glyphOverflow->bottom + box->logicalTop() > 0; | 810 affectsDescent = glyphOverflow->bottom + box->logicalTop() > 0; |
811 glyphOverflow->top = min(glyphOverflow->top, max(0, glyphOverflow->top -
box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent())); | 811 glyphOverflow->top = min(glyphOverflow->top, max(0, glyphOverflow->top -
box->renderer()->style(isFirstLineStyle())->fontMetrics().ascent(baselineType()
))); |
812 glyphOverflow->bottom = min(glyphOverflow->bottom, max(0, glyphOverflow-
>bottom - box->renderer()->style(isFirstLineStyle())->fontMetrics().descent())); | 812 glyphOverflow->bottom = min(glyphOverflow->bottom, max(0, glyphOverflow-
>bottom - box->renderer()->style(isFirstLineStyle())->fontMetrics().descent(base
lineType()))); |
813 } | 813 } |
814 | 814 |
815 if (includeMarginForBox(box)) { | 815 if (includeMarginForBox(box)) { |
816 LayoutUnit ascentWithMargin = box->renderer()->style(isFirstLineStyle())
->fontMetrics().ascent(); | 816 LayoutUnit ascentWithMargin = box->renderer()->style(isFirstLineStyle())
->fontMetrics().ascent(baselineType()); |
817 LayoutUnit descentWithMargin = box->renderer()->style(isFirstLineStyle()
)->fontMetrics().descent(); | 817 LayoutUnit descentWithMargin = box->renderer()->style(isFirstLineStyle()
)->fontMetrics().descent(baselineType()); |
818 if (box->parent() && !box->renderer()->isText()) { | 818 if (box->parent() && !box->renderer()->isText()) { |
819 ascentWithMargin += box->boxModelObject()->borderBefore() + box->box
ModelObject()->paddingBefore() + box->boxModelObject()->marginBefore(); | 819 ascentWithMargin += box->boxModelObject()->borderBefore() + box->box
ModelObject()->paddingBefore() + box->boxModelObject()->marginBefore(); |
820 descentWithMargin += box->boxModelObject()->borderAfter() + box->box
ModelObject()->paddingAfter() + box->boxModelObject()->marginAfter(); | 820 descentWithMargin += box->boxModelObject()->borderAfter() + box->box
ModelObject()->paddingAfter() + box->boxModelObject()->marginAfter(); |
821 } | 821 } |
822 setAscentAndDescent(ascent, descent, ascentWithMargin, descentWithMargin
, ascentDescentSet); | 822 setAscentAndDescent(ascent, descent, ascentWithMargin, descentWithMargin
, ascentDescentSet); |
823 | 823 |
824 // Treat like a replaced element, since we're using the margin box. | 824 // Treat like a replaced element, since we're using the margin box. |
825 affectsAscent = true; | 825 affectsAscent = true; |
826 affectsDescent = true; | 826 affectsDescent = true; |
827 } | 827 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 } | 986 } |
987 | 987 |
988 #ifndef NDEBUG | 988 #ifndef NDEBUG |
989 const char* RootInlineBox::boxName() const | 989 const char* RootInlineBox::boxName() const |
990 { | 990 { |
991 return "RootInlineBox"; | 991 return "RootInlineBox"; |
992 } | 992 } |
993 #endif | 993 #endif |
994 | 994 |
995 } // namespace WebCore | 995 } // namespace WebCore |
OLD | NEW |