OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false; | 121 bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false; |
122 if (child->getLineLayoutItem().isAtomicInlineLevel()) { | 122 if (child->getLineLayoutItem().isAtomicInlineLevel()) { |
123 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 123 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
124 } else if (child->isText()) { | 124 } else if (child->isText()) { |
125 if (child->getLineLayoutItem().isBR() || (child->getLineLayoutItem()
.parent() != getLineLayoutItem())) { | 125 if (child->getLineLayoutItem().isBR() || (child->getLineLayoutItem()
.parent() != getLineLayoutItem())) { |
126 if (!parentStyle.font().fontMetrics().hasIdenticalAscentDescentA
ndLineGap(childStyle.font().fontMetrics()) | 126 if (!parentStyle.font().fontMetrics().hasIdenticalAscentDescentA
ndLineGap(childStyle.font().fontMetrics()) |
127 || parentStyle.lineHeight() != childStyle.lineHeight() | 127 || parentStyle.lineHeight() != childStyle.lineHeight() |
128 || (parentStyle.verticalAlign() != BASELINE && !isRootInline
Box()) || childStyle.verticalAlign() != BASELINE) | 128 || (parentStyle.verticalAlign() != BASELINE && !isRootInline
Box()) || childStyle.verticalAlign() != BASELINE) |
129 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 129 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
130 } | 130 } |
131 if (childStyle.hasTextCombine() || childStyle.textEmphasisMark() !=
TextEmphasisMarkNone) | 131 if (childStyle.hasTextCombine() || childStyle.getTextEmphasisMark()
!= TextEmphasisMarkNone) |
132 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 132 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
133 } else { | 133 } else { |
134 if (child->getLineLayoutItem().isBR()) { | 134 if (child->getLineLayoutItem().isBR()) { |
135 // FIXME: This is dumb. We only turn off because current layout
test results expect the <br> to be 0-height on the baseline. | 135 // FIXME: This is dumb. We only turn off because current layout
test results expect the <br> to be 0-height on the baseline. |
136 // Other than making a zillion tests have to regenerate results,
there's no reason to ditch the optimization here. | 136 // Other than making a zillion tests have to regenerate results,
there's no reason to ditch the optimization here. |
137 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 137 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
138 } else { | 138 } else { |
139 ASSERT(isInlineFlowBox()); | 139 ASSERT(isInlineFlowBox()); |
140 InlineFlowBox* childFlowBox = toInlineFlowBox(child); | 140 InlineFlowBox* childFlowBox = toInlineFlowBox(child); |
141 // Check the child's bit, and then also check for differences in
font, line-height, vertical-align | 141 // Check the child's bit, and then also check for differences in
font, line-height, vertical-align |
142 if (!childFlowBox->descendantsHaveSameLineHeightAndBaseline() | 142 if (!childFlowBox->descendantsHaveSameLineHeightAndBaseline() |
143 || !parentStyle.font().fontMetrics().hasIdenticalAscentDesce
ntAndLineGap(childStyle.font().fontMetrics()) | 143 || !parentStyle.font().fontMetrics().hasIdenticalAscentDesce
ntAndLineGap(childStyle.font().fontMetrics()) |
144 || parentStyle.lineHeight() != childStyle.lineHeight() | 144 || parentStyle.lineHeight() != childStyle.lineHeight() |
145 || (parentStyle.verticalAlign() != BASELINE && !isRootInline
Box()) || childStyle.verticalAlign() != BASELINE | 145 || (parentStyle.verticalAlign() != BASELINE && !isRootInline
Box()) || childStyle.verticalAlign() != BASELINE |
146 || childStyle.hasBorder() || childStyle.hasPadding() || chil
dStyle.hasTextCombine()) | 146 || childStyle.hasBorder() || childStyle.hasPadding() || chil
dStyle.hasTextCombine()) |
147 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 147 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 if (shouldClearDescendantsHaveSameLineHeightAndBaseline) | 151 if (shouldClearDescendantsHaveSameLineHeightAndBaseline) |
152 clearDescendantsHaveSameLineHeightAndBaseline(); | 152 clearDescendantsHaveSameLineHeightAndBaseline(); |
153 } | 153 } |
154 | 154 |
155 if (!child->getLineLayoutItem().isOutOfFlowPositioned()) { | 155 if (!child->getLineLayoutItem().isOutOfFlowPositioned()) { |
156 if (child->isText()) { | 156 if (child->isText()) { |
157 const ComputedStyle& childStyle = child->getLineLayoutItem().styleRe
f(isFirstLineStyle()); | 157 const ComputedStyle& childStyle = child->getLineLayoutItem().styleRe
f(isFirstLineStyle()); |
158 if (childStyle.letterSpacing() < 0 || childStyle.textShadow() || chi
ldStyle.textEmphasisMark() != TextEmphasisMarkNone || childStyle.textStrokeWidth
()) | 158 if (childStyle.letterSpacing() < 0 || childStyle.textShadow() || chi
ldStyle.getTextEmphasisMark() != TextEmphasisMarkNone || childStyle.textStrokeWi
dth()) |
159 child->clearKnownToHaveNoOverflow(); | 159 child->clearKnownToHaveNoOverflow(); |
160 } else if (child->getLineLayoutItem().isAtomicInlineLevel()) { | 160 } else if (child->getLineLayoutItem().isAtomicInlineLevel()) { |
161 LineLayoutBox box = LineLayoutBox(child->getLineLayoutItem()); | 161 LineLayoutBox box = LineLayoutBox(child->getLineLayoutItem()); |
162 if (box.hasOverflowModel() || box.hasSelfPaintingLayer()) | 162 if (box.hasOverflowModel() || box.hasSelfPaintingLayer()) |
163 child->clearKnownToHaveNoOverflow(); | 163 child->clearKnownToHaveNoOverflow(); |
164 } else if (!child->getLineLayoutItem().isBR() && (child->getLineLayoutIt
em().style(isFirstLineStyle())->boxShadow() || child->boxModelObject().hasSelfPa
intingLayer() | 164 } else if (!child->getLineLayoutItem().isBR() && (child->getLineLayoutIt
em().style(isFirstLineStyle())->boxShadow() || child->boxModelObject().hasSelfPa
intingLayer() |
165 || (child->getLineLayoutItem().isListMarker() && !LineLayoutListMark
er(child->getLineLayoutItem()).isInside()) | 165 || (child->getLineLayoutItem().isListMarker() && !LineLayoutListMark
er(child->getLineLayoutItem()).isInside()) |
166 || child->getLineLayoutItem().style(isFirstLineStyle())->hasBorderIm
ageOutsets() | 166 || child->getLineLayoutItem().style(isFirstLineStyle())->hasBorderIm
ageOutsets() |
167 || child->getLineLayoutItem().style(isFirstLineStyle())->hasOutline(
))) { | 167 || child->getLineLayoutItem().style(isFirstLineStyle())->hasOutline(
))) { |
168 child->clearKnownToHaveNoOverflow(); | 168 child->clearKnownToHaveNoOverflow(); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 boxHeightIncludingMargins += overSideMargin + underSideMargin; | 644 boxHeightIncludingMargins += overSideMargin + underSideMargin; |
645 } | 645 } |
646 | 646 |
647 curr->setLogicalTop(newLogicalTop); | 647 curr->setLogicalTop(newLogicalTop); |
648 | 648 |
649 if (childAffectsTopBottomPos) { | 649 if (childAffectsTopBottomPos) { |
650 if (curr->getLineLayoutItem().isRubyRun()) { | 650 if (curr->getLineLayoutItem().isRubyRun()) { |
651 // Treat the leading on the first and last lines of ruby runs as
not being part of the overall lineTop/lineBottom. | 651 // Treat the leading on the first and last lines of ruby runs as
not being part of the overall lineTop/lineBottom. |
652 // Really this is a workaround hack for the fact that ruby shoul
d have been done as line layout and not done using | 652 // Really this is a workaround hack for the fact that ruby shoul
d have been done as line layout and not done using |
653 // inline-block. | 653 // inline-block. |
654 if (getLineLayoutItem().style()->isFlippedLinesWritingMode() ==
(curr->getLineLayoutItem().style()->rubyPosition() == RubyPositionAfter)) | 654 if (getLineLayoutItem().style()->isFlippedLinesWritingMode() ==
(curr->getLineLayoutItem().style()->getRubyPosition() == RubyPositionAfter)) |
655 hasAnnotationsBefore = true; | 655 hasAnnotationsBefore = true; |
656 else | 656 else |
657 hasAnnotationsAfter = true; | 657 hasAnnotationsAfter = true; |
658 | 658 |
659 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayou
tItem()); | 659 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayou
tItem()); |
660 if (LayoutRubyBase* rubyBase = rubyRun.rubyBase()) { | 660 if (LayoutRubyBase* rubyBase = rubyRun.rubyBase()) { |
661 LayoutUnit bottomRubyBaseLeading = (curr->logicalHeight() -
rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox(
) ? rubyBase->lastRootBox()->lineBottom() : LayoutUnit()); | 661 LayoutUnit bottomRubyBaseLeading = (curr->logicalHeight() -
rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox(
) ? rubyBase->lastRootBox()->lineBottom() : LayoutUnit()); |
662 LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (ru
byBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : LayoutUnit()); | 662 LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (ru
byBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : LayoutUnit()); |
663 newLogicalTop += !getLineLayoutItem().style()->isFlippedLine
sWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading; | 663 newLogicalTop += !getLineLayoutItem().style()->isFlippedLine
sWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading; |
664 boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading); | 664 boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 749 |
750 inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO
verflow) | 750 inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO
verflow) |
751 { | 751 { |
752 const ComputedStyle& style = getLineLayoutItem().styleRef(isFirstLineStyle()
); | 752 const ComputedStyle& style = getLineLayoutItem().styleRef(isFirstLineStyle()
); |
753 | 753 |
754 // box-shadow on the block element applies to the block and not to the lines
, | 754 // box-shadow on the block element applies to the block and not to the lines
, |
755 // unless it is modified by :first-line pseudo element. | 755 // unless it is modified by :first-line pseudo element. |
756 if (!parent() && (!isFirstLineStyle() || &style == getLineLayoutItem().style
())) | 756 if (!parent() && (!isFirstLineStyle() || &style == getLineLayoutItem().style
())) |
757 return; | 757 return; |
758 | 758 |
759 WritingMode writingMode = style.writingMode(); | 759 WritingMode writingMode = style.getWritingMode(); |
760 ShadowList* boxShadow = style.boxShadow(); | 760 ShadowList* boxShadow = style.boxShadow(); |
761 if (!boxShadow) | 761 if (!boxShadow) |
762 return; | 762 return; |
763 | 763 |
764 LayoutRectOutsets outsets(boxShadow->rectOutsetsIncludingOriginal()); | 764 LayoutRectOutsets outsets(boxShadow->rectOutsetsIncludingOriginal()); |
765 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite shadow that applies, since | 765 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite shadow that applies, since |
766 // the line is "upside down" in terms of block coordinates. | 766 // the line is "upside down" in terms of block coordinates. |
767 LayoutRectOutsets logicalOutsets(outsets.logicalOutsetsWithFlippedLines(writ
ingMode)); | 767 LayoutRectOutsets logicalOutsets(outsets.logicalOutsetsWithFlippedLines(writ
ingMode)); |
768 | 768 |
769 LayoutRect shadowBounds(logicalFrameRect()); | 769 LayoutRect shadowBounds(logicalFrameRect()); |
770 shadowBounds.expand(logicalOutsets); | 770 shadowBounds.expand(logicalOutsets); |
771 logicalVisualOverflow.unite(shadowBounds); | 771 logicalVisualOverflow.unite(shadowBounds); |
772 } | 772 } |
773 | 773 |
774 inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu
alOverflow) | 774 inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu
alOverflow) |
775 { | 775 { |
776 const ComputedStyle& style = getLineLayoutItem().styleRef(isFirstLineStyle()
); | 776 const ComputedStyle& style = getLineLayoutItem().styleRef(isFirstLineStyle()
); |
777 | 777 |
778 // border-image-outset on the block element applies to the block and not to
the lines, | 778 // border-image-outset on the block element applies to the block and not to
the lines, |
779 // unless it is modified by :first-line pseudo element. | 779 // unless it is modified by :first-line pseudo element. |
780 if (!parent() && (!isFirstLineStyle() || &style == getLineLayoutItem().style
())) | 780 if (!parent() && (!isFirstLineStyle() || &style == getLineLayoutItem().style
())) |
781 return; | 781 return; |
782 | 782 |
783 if (!style.hasBorderImageOutsets()) | 783 if (!style.hasBorderImageOutsets()) |
784 return; | 784 return; |
785 | 785 |
786 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite border that applies, since | 786 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite border that applies, since |
787 // the line is "upside down" in terms of block coordinates. vertical-rl and
horizontal-bt are the flipped line modes. | 787 // the line is "upside down" in terms of block coordinates. vertical-rl and
horizontal-bt are the flipped line modes. |
788 LayoutRectOutsets logicalOutsets = style.borderImageOutsets().logicalOutsets
WithFlippedLines(style.writingMode()); | 788 LayoutRectOutsets logicalOutsets = style.borderImageOutsets().logicalOutsets
WithFlippedLines(style.getWritingMode()); |
789 | 789 |
790 if (!includeLogicalLeftEdge()) | 790 if (!includeLogicalLeftEdge()) |
791 logicalOutsets.setLeft(LayoutUnit()); | 791 logicalOutsets.setLeft(LayoutUnit()); |
792 if (!includeLogicalRightEdge()) | 792 if (!includeLogicalRightEdge()) |
793 logicalOutsets.setRight(LayoutUnit()); | 793 logicalOutsets.setRight(LayoutUnit()); |
794 | 794 |
795 LayoutRect borderOutsetBounds(logicalFrameRect()); | 795 LayoutRect borderOutsetBounds(logicalFrameRect()); |
796 borderOutsetBounds.expand(logicalOutsets); | 796 borderOutsetBounds.expand(logicalOutsets); |
797 logicalVisualOverflow.unite(borderOutsetBounds); | 797 logicalVisualOverflow.unite(borderOutsetBounds); |
798 } | 798 } |
(...skipping 27 matching lines...) Expand all Loading... |
826 float leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0; | 826 float leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0; |
827 float rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0; | 827 float rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0; |
828 | 828 |
829 float strokeOverflow = style.textStrokeWidth() / 2.0f; | 829 float strokeOverflow = style.textStrokeWidth() / 2.0f; |
830 float topGlyphOverflow = -strokeOverflow - topGlyphEdge; | 830 float topGlyphOverflow = -strokeOverflow - topGlyphEdge; |
831 float bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge; | 831 float bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge; |
832 float leftGlyphOverflow = -strokeOverflow - leftGlyphEdge; | 832 float leftGlyphOverflow = -strokeOverflow - leftGlyphEdge; |
833 float rightGlyphOverflow = strokeOverflow + rightGlyphEdge; | 833 float rightGlyphOverflow = strokeOverflow + rightGlyphEdge; |
834 | 834 |
835 TextEmphasisPosition emphasisMarkPosition; | 835 TextEmphasisPosition emphasisMarkPosition; |
836 if (style.textEmphasisMark() != TextEmphasisMarkNone && textBox->getEmphasis
MarkPosition(style, emphasisMarkPosition)) { | 836 if (style.getTextEmphasisMark() != TextEmphasisMarkNone && textBox->getEmpha
sisMarkPosition(style, emphasisMarkPosition)) { |
837 float emphasisMarkHeight = style.font().emphasisMarkHeight(style.textEmp
hasisMarkString()); | 837 float emphasisMarkHeight = style.font().emphasisMarkHeight(style.textEmp
hasisMarkString()); |
838 if ((emphasisMarkPosition == TextEmphasisPositionOver) == (!style.isFlip
pedLinesWritingMode())) | 838 if ((emphasisMarkPosition == TextEmphasisPositionOver) == (!style.isFlip
pedLinesWritingMode())) |
839 topGlyphOverflow = std::min(topGlyphOverflow, -emphasisMarkHeight); | 839 topGlyphOverflow = std::min(topGlyphOverflow, -emphasisMarkHeight); |
840 else | 840 else |
841 bottomGlyphOverflow = std::max(bottomGlyphOverflow, emphasisMarkHeig
ht); | 841 bottomGlyphOverflow = std::max(bottomGlyphOverflow, emphasisMarkHeig
ht); |
842 } | 842 } |
843 | 843 |
844 // If letter-spacing is negative, we should factor that into right layout ov
erflow. Even in RTL, letter-spacing is | 844 // If letter-spacing is negative, we should factor that into right layout ov
erflow. Even in RTL, letter-spacing is |
845 // applied to the right, so this is not an issue with left overflow. | 845 // applied to the right, so this is not an issue with left overflow. |
846 rightGlyphOverflow -= std::min(0.0f, style.font().fontDescription().letterSp
acing()); | 846 rightGlyphOverflow -= std::min(0.0f, style.font().fontDescription().letterSp
acing()); |
847 | 847 |
848 LayoutRectOutsets textShadowLogicalOutsets; | 848 LayoutRectOutsets textShadowLogicalOutsets; |
849 if (ShadowList* textShadow = style.textShadow()) | 849 if (ShadowList* textShadow = style.textShadow()) |
850 textShadowLogicalOutsets = LayoutRectOutsets(textShadow->rectOutsetsIncl
udingOriginal()).logicalOutsets(style.writingMode()); | 850 textShadowLogicalOutsets = LayoutRectOutsets(textShadow->rectOutsetsIncl
udingOriginal()).logicalOutsets(style.getWritingMode()); |
851 | 851 |
852 // FIXME: This code currently uses negative values for expansion of the top | 852 // FIXME: This code currently uses negative values for expansion of the top |
853 // and left edges. This should be cleaned up. | 853 // and left edges. This should be cleaned up. |
854 LayoutUnit textShadowLogicalTop = -textShadowLogicalOutsets.top(); | 854 LayoutUnit textShadowLogicalTop = -textShadowLogicalOutsets.top(); |
855 LayoutUnit textShadowLogicalBottom = textShadowLogicalOutsets.bottom(); | 855 LayoutUnit textShadowLogicalBottom = textShadowLogicalOutsets.bottom(); |
856 LayoutUnit textShadowLogicalLeft = -textShadowLogicalOutsets.left(); | 856 LayoutUnit textShadowLogicalLeft = -textShadowLogicalOutsets.left(); |
857 LayoutUnit textShadowLogicalRight = textShadowLogicalOutsets.right(); | 857 LayoutUnit textShadowLogicalRight = textShadowLogicalOutsets.right(); |
858 | 858 |
859 LayoutUnit childOverflowLogicalTop(std::min(textShadowLogicalTop + topGlyphO
verflow, topGlyphOverflow)); | 859 LayoutUnit childOverflowLogicalTop(std::min(textShadowLogicalTop + topGlyphO
verflow, topGlyphOverflow)); |
860 LayoutUnit childOverflowLogicalBottom(std::max(textShadowLogicalBottom + bot
tomGlyphOverflow, bottomGlyphOverflow)); | 860 LayoutUnit childOverflowLogicalBottom(std::max(textShadowLogicalBottom + bot
tomGlyphOverflow, bottomGlyphOverflow)); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi
tion) const | 1141 LayoutUnit InlineFlowBox::computeOverAnnotationAdjustment(LayoutUnit allowedPosi
tion) const |
1142 { | 1142 { |
1143 LayoutUnit result; | 1143 LayoutUnit result; |
1144 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 1144 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
1145 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) | 1145 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
1146 continue; // Positioned placeholders don't affect calculations. | 1146 continue; // Positioned placeholders don't affect calculations. |
1147 | 1147 |
1148 if (curr->isInlineFlowBox()) | 1148 if (curr->isInlineFlowBox()) |
1149 result = std::max(result, toInlineFlowBox(curr)->computeOverAnnotati
onAdjustment(allowedPosition)); | 1149 result = std::max(result, toInlineFlowBox(curr)->computeOverAnnotati
onAdjustment(allowedPosition)); |
1150 | 1150 |
1151 if (curr->getLineLayoutItem().isAtomicInlineLevel() && curr->getLineLayo
utItem().isRubyRun() && curr->getLineLayoutItem().style()->rubyPosition() == Rub
yPositionBefore) { | 1151 if (curr->getLineLayoutItem().isAtomicInlineLevel() && curr->getLineLayo
utItem().isRubyRun() && curr->getLineLayoutItem().style()->getRubyPosition() ==
RubyPositionBefore) { |
1152 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayoutIte
m()); | 1152 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayoutIte
m()); |
1153 LayoutRubyText* rubyText = rubyRun.rubyText(); | 1153 LayoutRubyText* rubyText = rubyRun.rubyText(); |
1154 if (!rubyText) | 1154 if (!rubyText) |
1155 continue; | 1155 continue; |
1156 | 1156 |
1157 if (!rubyRun.style()->isFlippedLinesWritingMode()) { | 1157 if (!rubyRun.style()->isFlippedLinesWritingMode()) { |
1158 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru
byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); | 1158 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru
byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); |
1159 if (topOfFirstRubyTextLine >= 0) | 1159 if (topOfFirstRubyTextLine >= 0) |
1160 continue; | 1160 continue; |
1161 topOfFirstRubyTextLine += curr->logicalTop(); | 1161 topOfFirstRubyTextLine += curr->logicalTop(); |
1162 result = std::max(result, allowedPosition - topOfFirstRubyTextLi
ne); | 1162 result = std::max(result, allowedPosition - topOfFirstRubyTextLi
ne); |
1163 } else { | 1163 } else { |
1164 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); | 1164 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); |
1165 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1165 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
1166 continue; | 1166 continue; |
1167 bottomOfLastRubyTextLine += curr->logicalTop(); | 1167 bottomOfLastRubyTextLine += curr->logicalTop(); |
1168 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); | 1168 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); |
1169 } | 1169 } |
1170 } | 1170 } |
1171 | 1171 |
1172 if (curr->isInlineTextBox()) { | 1172 if (curr->isInlineTextBox()) { |
1173 const ComputedStyle& style = curr->getLineLayoutItem().styleRef(isFi
rstLineStyle()); | 1173 const ComputedStyle& style = curr->getLineLayoutItem().styleRef(isFi
rstLineStyle()); |
1174 TextEmphasisPosition emphasisMarkPosition; | 1174 TextEmphasisPosition emphasisMarkPosition; |
1175 if (style.textEmphasisMark() != TextEmphasisMarkNone && toInlineText
Box(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMarkP
osition == TextEmphasisPositionOver) { | 1175 if (style.getTextEmphasisMark() != TextEmphasisMarkNone && toInlineT
extBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMa
rkPosition == TextEmphasisPositionOver) { |
1176 if (!style.isFlippedLinesWritingMode()) { | 1176 if (!style.isFlippedLinesWritingMode()) { |
1177 int topOfEmphasisMark = curr->logicalTop() - style.font().em
phasisMarkHeight(style.textEmphasisMarkString()); | 1177 int topOfEmphasisMark = curr->logicalTop() - style.font().em
phasisMarkHeight(style.textEmphasisMarkString()); |
1178 result = std::max(result, allowedPosition - topOfEmphasisMar
k); | 1178 result = std::max(result, allowedPosition - topOfEmphasisMar
k); |
1179 } else { | 1179 } else { |
1180 int bottomOfEmphasisMark = curr->logicalBottom() + style.fon
t().emphasisMarkHeight(style.textEmphasisMarkString()); | 1180 int bottomOfEmphasisMark = curr->logicalBottom() + style.fon
t().emphasisMarkHeight(style.textEmphasisMarkString()); |
1181 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); | 1181 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); |
1182 } | 1182 } |
1183 } | 1183 } |
1184 } | 1184 } |
1185 } | 1185 } |
1186 return result; | 1186 return result; |
1187 } | 1187 } |
1188 | 1188 |
1189 LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos
ition) const | 1189 LayoutUnit InlineFlowBox::computeUnderAnnotationAdjustment(LayoutUnit allowedPos
ition) const |
1190 { | 1190 { |
1191 LayoutUnit result; | 1191 LayoutUnit result; |
1192 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 1192 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
1193 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) | 1193 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
1194 continue; // Positioned placeholders don't affect calculations. | 1194 continue; // Positioned placeholders don't affect calculations. |
1195 | 1195 |
1196 if (curr->isInlineFlowBox()) | 1196 if (curr->isInlineFlowBox()) |
1197 result = std::max(result, toInlineFlowBox(curr)->computeUnderAnnotat
ionAdjustment(allowedPosition)); | 1197 result = std::max(result, toInlineFlowBox(curr)->computeUnderAnnotat
ionAdjustment(allowedPosition)); |
1198 | 1198 |
1199 if (curr->getLineLayoutItem().isAtomicInlineLevel() && curr->getLineLayo
utItem().isRubyRun() && curr->getLineLayoutItem().style()->rubyPosition() == Rub
yPositionAfter) { | 1199 if (curr->getLineLayoutItem().isAtomicInlineLevel() && curr->getLineLayo
utItem().isRubyRun() && curr->getLineLayoutItem().style()->getRubyPosition() ==
RubyPositionAfter) { |
1200 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayoutIte
m()); | 1200 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->getLineLayoutIte
m()); |
1201 LayoutRubyText* rubyText = rubyRun.rubyText(); | 1201 LayoutRubyText* rubyText = rubyRun.rubyText(); |
1202 if (!rubyText) | 1202 if (!rubyText) |
1203 continue; | 1203 continue; |
1204 | 1204 |
1205 if (rubyRun.style()->isFlippedLinesWritingMode()) { | 1205 if (rubyRun.style()->isFlippedLinesWritingMode()) { |
1206 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru
byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); | 1206 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (ru
byText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); |
1207 if (topOfFirstRubyTextLine >= 0) | 1207 if (topOfFirstRubyTextLine >= 0) |
1208 continue; | 1208 continue; |
1209 topOfFirstRubyTextLine += curr->logicalTop(); | 1209 topOfFirstRubyTextLine += curr->logicalTop(); |
1210 result = std::max(result, allowedPosition - topOfFirstRubyTextLi
ne); | 1210 result = std::max(result, allowedPosition - topOfFirstRubyTextLi
ne); |
1211 } else { | 1211 } else { |
1212 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); | 1212 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); |
1213 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1213 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
1214 continue; | 1214 continue; |
1215 bottomOfLastRubyTextLine += curr->logicalTop(); | 1215 bottomOfLastRubyTextLine += curr->logicalTop(); |
1216 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); | 1216 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); |
1217 } | 1217 } |
1218 } | 1218 } |
1219 | 1219 |
1220 if (curr->isInlineTextBox()) { | 1220 if (curr->isInlineTextBox()) { |
1221 const ComputedStyle& style = curr->getLineLayoutItem().styleRef(isFi
rstLineStyle()); | 1221 const ComputedStyle& style = curr->getLineLayoutItem().styleRef(isFi
rstLineStyle()); |
1222 if (style.textEmphasisMark() != TextEmphasisMarkNone && style.textEm
phasisPosition() == TextEmphasisPositionUnder) { | 1222 if (style.getTextEmphasisMark() != TextEmphasisMarkNone && style.get
TextEmphasisPosition() == TextEmphasisPositionUnder) { |
1223 if (!style.isFlippedLinesWritingMode()) { | 1223 if (!style.isFlippedLinesWritingMode()) { |
1224 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + st
yle.font().emphasisMarkHeight(style.textEmphasisMarkString()); | 1224 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + st
yle.font().emphasisMarkHeight(style.textEmphasisMarkString()); |
1225 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); | 1225 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); |
1226 } else { | 1226 } else { |
1227 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style.fo
nt().emphasisMarkHeight(style.textEmphasisMarkString()); | 1227 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style.fo
nt().emphasisMarkHeight(style.textEmphasisMarkString()); |
1228 result = std::max(result, allowedPosition - topOfEmphasisMar
k); | 1228 result = std::max(result, allowedPosition - topOfEmphasisMar
k); |
1229 } | 1229 } |
1230 } | 1230 } |
1231 } | 1231 } |
1232 } | 1232 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 ASSERT(child->prevOnLine() == prev); | 1314 ASSERT(child->prevOnLine() == prev); |
1315 prev = child; | 1315 prev = child; |
1316 } | 1316 } |
1317 ASSERT(prev == m_lastChild); | 1317 ASSERT(prev == m_lastChild); |
1318 #endif | 1318 #endif |
1319 } | 1319 } |
1320 | 1320 |
1321 #endif | 1321 #endif |
1322 | 1322 |
1323 } // namespace blink | 1323 } // namespace blink |
OLD | NEW |