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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(toIn
lineTextBox(box)); | 566 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(toIn
lineTextBox(box)); |
567 usedFonts = it == textBoxDataMap.end() ? 0 : &it->value.first; | 567 usedFonts = it == textBoxDataMap.end() ? 0 : &it->value.first; |
568 } | 568 } |
569 | 569 |
570 bool includeLeading = includeLeadingForBox(box); | 570 bool includeLeading = includeLeadingForBox(box); |
571 bool setUsedFontWithLeading = false; | 571 bool setUsedFontWithLeading = false; |
572 | 572 |
573 if (usedFonts && !usedFonts->isEmpty() && (box->getLineLayoutItem().style(is
FirstLineStyle())->lineHeight().isNegative() && includeLeading)) { | 573 if (usedFonts && !usedFonts->isEmpty() && (box->getLineLayoutItem().style(is
FirstLineStyle())->lineHeight().isNegative() && includeLeading)) { |
574 usedFonts->append(box->getLineLayoutItem().style(isFirstLineStyle())->fo
nt().primaryFont()); | 574 usedFonts->append(box->getLineLayoutItem().style(isFirstLineStyle())->fo
nt().primaryFont()); |
575 for (size_t i = 0; i < usedFonts->size(); ++i) { | 575 for (size_t i = 0; i < usedFonts->size(); ++i) { |
576 const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics(); | 576 const FontMetrics& fontMetrics = usedFonts->at(i)->getFontMetrics(); |
577 int usedFontAscent = fontMetrics.ascent(baselineType()); | 577 int usedFontAscent = fontMetrics.ascent(baselineType()); |
578 int usedFontDescent = fontMetrics.descent(baselineType()); | 578 int usedFontDescent = fontMetrics.descent(baselineType()); |
579 int halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height())
/ 2; | 579 int halfLeading = (fontMetrics.lineSpacing() - fontMetrics.height())
/ 2; |
580 int usedFontAscentAndLeading = usedFontAscent + halfLeading; | 580 int usedFontAscentAndLeading = usedFontAscent + halfLeading; |
581 int usedFontDescentAndLeading = fontMetrics.lineSpacing() - usedFont
AscentAndLeading; | 581 int usedFontDescentAndLeading = fontMetrics.lineSpacing() - usedFont
AscentAndLeading; |
582 if (includeLeading) { | 582 if (includeLeading) { |
583 setAscentAndDescent(ascent, descent, usedFontAscentAndLeading, u
sedFontDescentAndLeading, ascentDescentSet); | 583 setAscentAndDescent(ascent, descent, usedFontAscentAndLeading, u
sedFontDescentAndLeading, ascentDescentSet); |
584 setUsedFontWithLeading = true; | 584 setUsedFontWithLeading = true; |
585 } | 585 } |
586 if (!affectsAscent) | 586 if (!affectsAscent) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 EVerticalAlign verticalAlign = boxModel.style()->verticalAlign(); | 632 EVerticalAlign verticalAlign = boxModel.style()->verticalAlign(); |
633 if (verticalAlign == VerticalAlignTop || verticalAlign == VerticalAlignBotto
m) | 633 if (verticalAlign == VerticalAlignTop || verticalAlign == VerticalAlignBotto
m) |
634 return LayoutUnit(); | 634 return LayoutUnit(); |
635 | 635 |
636 LineLayoutItem parent = boxModel.parent(); | 636 LineLayoutItem parent = boxModel.parent(); |
637 if (parent.isLayoutInline() && parent.style()->verticalAlign() != VerticalAl
ignTop && parent.style()->verticalAlign() != VerticalAlignBottom) | 637 if (parent.isLayoutInline() && parent.style()->verticalAlign() != VerticalAl
ignTop && parent.style()->verticalAlign() != VerticalAlignBottom) |
638 verticalPosition = box->parent()->logicalTop(); | 638 verticalPosition = box->parent()->logicalTop(); |
639 | 639 |
640 if (verticalAlign != VerticalAlignBaseline) { | 640 if (verticalAlign != VerticalAlignBaseline) { |
641 const Font& font = parent.style(firstLine)->font(); | 641 const Font& font = parent.style(firstLine)->font(); |
642 const FontMetrics& fontMetrics = font.fontMetrics(); | 642 const FontMetrics& fontMetrics = font.getFontMetrics(); |
643 int fontSize = font.fontDescription().computedPixelSize(); | 643 int fontSize = font.getFontDescription().computedPixelSize(); |
644 | 644 |
645 LineDirectionMode lineDirection = parent.isHorizontalWritingMode() ? Hor
izontalLine : VerticalLine; | 645 LineDirectionMode lineDirection = parent.isHorizontalWritingMode() ? Hor
izontalLine : VerticalLine; |
646 | 646 |
647 if (verticalAlign == VerticalAlignSub) { | 647 if (verticalAlign == VerticalAlignSub) { |
648 verticalPosition += fontSize / 5 + 1; | 648 verticalPosition += fontSize / 5 + 1; |
649 } else if (verticalAlign == VerticalAlignSuper) { | 649 } else if (verticalAlign == VerticalAlignSuper) { |
650 verticalPosition -= fontSize / 3 + 1; | 650 verticalPosition -= fontSize / 3 + 1; |
651 } else if (verticalAlign == VerticalAlignTextTop) { | 651 } else if (verticalAlign == VerticalAlignTextTop) { |
652 verticalPosition += boxModel.baselinePosition(baselineType(), firstL
ine, lineDirection) - fontMetrics.ascent(baselineType()); | 652 verticalPosition += boxModel.baselinePosition(baselineType(), firstL
ine, lineDirection) - fontMetrics.ascent(baselineType()); |
653 } else if (verticalAlign == VerticalAlignMiddle) { | 653 } else if (verticalAlign == VerticalAlignMiddle) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 endBox = nullptr; | 711 endBox = nullptr; |
712 return nullptr; | 712 return nullptr; |
713 } | 713 } |
714 | 714 |
715 const char* RootInlineBox::boxName() const | 715 const char* RootInlineBox::boxName() const |
716 { | 716 { |
717 return "RootInlineBox"; | 717 return "RootInlineBox"; |
718 } | 718 } |
719 | 719 |
720 } // namespace blink | 720 } // namespace blink |
OLD | NEW |