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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (child->isText()) { | 112 if (child->isText()) { |
113 if (child->layoutObject().parent() == layoutObject()) | 113 if (child->layoutObject().parent() == layoutObject()) |
114 m_hasTextChildren = true; | 114 m_hasTextChildren = true; |
115 setHasTextDescendantsOnAncestors(this); | 115 setHasTextDescendantsOnAncestors(this); |
116 } else if (child->isInlineFlowBox()) { | 116 } else if (child->isInlineFlowBox()) { |
117 if (toInlineFlowBox(child)->hasTextDescendants()) | 117 if (toInlineFlowBox(child)->hasTextDescendants()) |
118 setHasTextDescendantsOnAncestors(this); | 118 setHasTextDescendantsOnAncestors(this); |
119 } | 119 } |
120 | 120 |
121 if (descendantsHaveSameLineHeightAndBaseline() && !child->layoutObject().isO
utOfFlowPositioned()) { | 121 if (descendantsHaveSameLineHeightAndBaseline() && !child->layoutObject().isO
utOfFlowPositioned()) { |
122 const LayoutStyle& parentStyle = layoutObject().styleRef(isFirstLineStyl
e()); | 122 const ComputedStyle& parentStyle = layoutObject().styleRef(isFirstLineSt
yle()); |
123 const LayoutStyle& childStyle = child->layoutObject().styleRef(isFirstLi
neStyle()); | 123 const ComputedStyle& childStyle = child->layoutObject().styleRef(isFirst
LineStyle()); |
124 bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false; | 124 bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false; |
125 if (child->layoutObject().isReplaced()) { | 125 if (child->layoutObject().isReplaced()) { |
126 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 126 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
127 } else if (child->isText()) { | 127 } else if (child->isText()) { |
128 if (child->layoutObject().isBR() || child->layoutObject().parent() !
= layoutObject()) { | 128 if (child->layoutObject().isBR() || child->layoutObject().parent() !
= layoutObject()) { |
129 if (!parentStyle.font().fontMetrics().hasIdenticalAscentDescentA
ndLineGap(childStyle.font().fontMetrics()) | 129 if (!parentStyle.font().fontMetrics().hasIdenticalAscentDescentA
ndLineGap(childStyle.font().fontMetrics()) |
130 || parentStyle.lineHeight() != childStyle.lineHeight() | 130 || parentStyle.lineHeight() != childStyle.lineHeight() |
131 || (parentStyle.verticalAlign() != BASELINE && !isRootInline
Box()) || childStyle.verticalAlign() != BASELINE) | 131 || (parentStyle.verticalAlign() != BASELINE && !isRootInline
Box()) || childStyle.verticalAlign() != BASELINE) |
132 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 132 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
133 } | 133 } |
(...skipping 16 matching lines...) Expand all Loading... |
150 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 150 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 if (shouldClearDescendantsHaveSameLineHeightAndBaseline) | 154 if (shouldClearDescendantsHaveSameLineHeightAndBaseline) |
155 clearDescendantsHaveSameLineHeightAndBaseline(); | 155 clearDescendantsHaveSameLineHeightAndBaseline(); |
156 } | 156 } |
157 | 157 |
158 if (!child->layoutObject().isOutOfFlowPositioned()) { | 158 if (!child->layoutObject().isOutOfFlowPositioned()) { |
159 if (child->isText()) { | 159 if (child->isText()) { |
160 const LayoutStyle& childStyle = child->layoutObject().styleRef(isFir
stLineStyle()); | 160 const ComputedStyle& childStyle = child->layoutObject().styleRef(isF
irstLineStyle()); |
161 if (childStyle.letterSpacing() < 0 || childStyle.textShadow() || chi
ldStyle.textEmphasisMark() != TextEmphasisMarkNone || childStyle.textStrokeWidth
()) | 161 if (childStyle.letterSpacing() < 0 || childStyle.textShadow() || chi
ldStyle.textEmphasisMark() != TextEmphasisMarkNone || childStyle.textStrokeWidth
()) |
162 child->clearKnownToHaveNoOverflow(); | 162 child->clearKnownToHaveNoOverflow(); |
163 } else if (child->layoutObject().isReplaced()) { | 163 } else if (child->layoutObject().isReplaced()) { |
164 LayoutBox& box = toLayoutBox(child->layoutObject()); | 164 LayoutBox& box = toLayoutBox(child->layoutObject()); |
165 if (box.hasOverflowModel() || box.hasSelfPaintingLayer()) | 165 if (box.hasOverflowModel() || box.hasSelfPaintingLayer()) |
166 child->clearKnownToHaveNoOverflow(); | 166 child->clearKnownToHaveNoOverflow(); |
167 } else if (!child->layoutObject().isBR() && (child->layoutObject().style
(isFirstLineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLay
er() | 167 } else if (!child->layoutObject().isBR() && (child->layoutObject().style
(isFirstLineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLay
er() |
168 || (child->layoutObject().isListMarker() && !toLayoutListMarker(chil
d->layoutObject()).isInside()) | 168 || (child->layoutObject().isListMarker() && !toLayoutListMarker(chil
d->layoutObject()).isInside()) |
169 || child->layoutObject().style(isFirstLineStyle())->hasBorderImageOu
tsets() | 169 || child->layoutObject().style(isFirstLineStyle())->hasBorderImageOu
tsets() |
170 || child->layoutObject().style(isFirstLineStyle())->hasOutline())) { | 170 || child->layoutObject().style(isFirstLineStyle())->hasOutline())) { |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 curr->setLogicalTop(lineBottom - (curr->logicalTop() - lineTop) - cu
rr->logicalHeight()); | 737 curr->setLogicalTop(lineBottom - (curr->logicalTop() - lineTop) - cu
rr->logicalHeight()); |
738 } | 738 } |
739 } | 739 } |
740 | 740 |
741 inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO
verflow) | 741 inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO
verflow) |
742 { | 742 { |
743 // box-shadow on root line boxes is applying to the block and not to the lin
es. | 743 // box-shadow on root line boxes is applying to the block and not to the lin
es. |
744 if (!parent()) | 744 if (!parent()) |
745 return; | 745 return; |
746 | 746 |
747 const LayoutStyle& style = layoutObject().styleRef(isFirstLineStyle()); | 747 const ComputedStyle& style = layoutObject().styleRef(isFirstLineStyle()); |
748 WritingMode writingMode = style.writingMode(); | 748 WritingMode writingMode = style.writingMode(); |
749 ShadowList* boxShadow = style.boxShadow(); | 749 ShadowList* boxShadow = style.boxShadow(); |
750 if (!boxShadow) | 750 if (!boxShadow) |
751 return; | 751 return; |
752 | 752 |
753 LayoutRectOutsets outsets(boxShadow->rectOutsetsIncludingOriginal()); | 753 LayoutRectOutsets outsets(boxShadow->rectOutsetsIncludingOriginal()); |
754 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite shadow that applies, since | 754 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite shadow that applies, since |
755 // the line is "upside down" in terms of block coordinates. | 755 // the line is "upside down" in terms of block coordinates. |
756 LayoutRectOutsets logicalOutsets(outsets.logicalOutsetsWithFlippedLines(writ
ingMode)); | 756 LayoutRectOutsets logicalOutsets(outsets.logicalOutsetsWithFlippedLines(writ
ingMode)); |
757 | 757 |
758 LayoutRect shadowBounds(logicalFrameRect().toLayoutRect()); | 758 LayoutRect shadowBounds(logicalFrameRect().toLayoutRect()); |
759 shadowBounds.expand(logicalOutsets); | 759 shadowBounds.expand(logicalOutsets); |
760 logicalVisualOverflow.unite(shadowBounds); | 760 logicalVisualOverflow.unite(shadowBounds); |
761 } | 761 } |
762 | 762 |
763 inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu
alOverflow) | 763 inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu
alOverflow) |
764 { | 764 { |
765 // border-image-outset on root line boxes is applying to the block and not t
o the lines. | 765 // border-image-outset on root line boxes is applying to the block and not t
o the lines. |
766 if (!parent()) | 766 if (!parent()) |
767 return; | 767 return; |
768 | 768 |
769 const LayoutStyle& style = layoutObject().styleRef(isFirstLineStyle()); | 769 const ComputedStyle& style = layoutObject().styleRef(isFirstLineStyle()); |
770 if (!style.hasBorderImageOutsets()) | 770 if (!style.hasBorderImageOutsets()) |
771 return; | 771 return; |
772 | 772 |
773 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite border that applies, since | 773 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite border that applies, since |
774 // the line is "upside down" in terms of block coordinates. vertical-rl and
horizontal-bt are the flipped line modes. | 774 // the line is "upside down" in terms of block coordinates. vertical-rl and
horizontal-bt are the flipped line modes. |
775 LayoutRectOutsets logicalOutsets = style.borderImageOutsets().logicalOutsets
WithFlippedLines(style.writingMode()); | 775 LayoutRectOutsets logicalOutsets = style.borderImageOutsets().logicalOutsets
WithFlippedLines(style.writingMode()); |
776 | 776 |
777 if (!includeLogicalLeftEdge()) | 777 if (!includeLogicalLeftEdge()) |
778 logicalOutsets.setLeft(LayoutUnit()); | 778 logicalOutsets.setLeft(LayoutUnit()); |
779 if (!includeLogicalRightEdge()) | 779 if (!includeLogicalRightEdge()) |
780 logicalOutsets.setRight(LayoutUnit()); | 780 logicalOutsets.setRight(LayoutUnit()); |
781 | 781 |
782 LayoutRect borderOutsetBounds(logicalFrameRect().toLayoutRect()); | 782 LayoutRect borderOutsetBounds(logicalFrameRect().toLayoutRect()); |
783 borderOutsetBounds.expand(logicalOutsets); | 783 borderOutsetBounds.expand(logicalOutsets); |
784 logicalVisualOverflow.unite(borderOutsetBounds); | 784 logicalVisualOverflow.unite(borderOutsetBounds); |
785 } | 785 } |
786 | 786 |
787 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve
rflow) | 787 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve
rflow) |
788 { | 788 { |
789 // Outline on root line boxes is applied to the block and not to the lines. | 789 // Outline on root line boxes is applied to the block and not to the lines. |
790 if (!parent()) | 790 if (!parent()) |
791 return; | 791 return; |
792 | 792 |
793 const LayoutStyle& style = layoutObject().styleRef(isFirstLineStyle()); | 793 const ComputedStyle& style = layoutObject().styleRef(isFirstLineStyle()); |
794 if (!style.hasOutline()) | 794 if (!style.hasOutline()) |
795 return; | 795 return; |
796 | 796 |
797 logicalVisualOverflow.inflate(style.outlineSize()); | 797 logicalVisualOverflow.inflate(style.outlineSize()); |
798 } | 798 } |
799 | 799 |
800 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp
hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) | 800 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp
hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) |
801 { | 801 { |
802 if (textBox->knownToHaveNoOverflow()) | 802 if (textBox->knownToHaveNoOverflow()) |
803 return; | 803 return; |
804 | 804 |
805 const LayoutStyle& style = textBox->layoutObject().styleRef(isFirstLineStyle
()); | 805 const ComputedStyle& style = textBox->layoutObject().styleRef(isFirstLineSty
le()); |
806 | 806 |
807 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox)
; | 807 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox)
; |
808 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s
econd; | 808 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s
econd; |
809 bool isFlippedLine = style.isFlippedLinesWritingMode(); | 809 bool isFlippedLine = style.isFlippedLinesWritingMode(); |
810 | 810 |
811 int topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom :
glyphOverflow->top) : 0; | 811 int topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom :
glyphOverflow->top) : 0; |
812 int bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top :
glyphOverflow->bottom) : 0; | 812 int bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top :
glyphOverflow->bottom) : 0; |
813 int leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0; | 813 int leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0; |
814 int rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0; | 814 int rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0; |
815 | 815 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 } else { | 1148 } else { |
1149 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); | 1149 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); |
1150 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1150 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
1151 continue; | 1151 continue; |
1152 bottomOfLastRubyTextLine += curr->logicalTop(); | 1152 bottomOfLastRubyTextLine += curr->logicalTop(); |
1153 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); | 1153 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); |
1154 } | 1154 } |
1155 } | 1155 } |
1156 | 1156 |
1157 if (curr->isInlineTextBox()) { | 1157 if (curr->isInlineTextBox()) { |
1158 const LayoutStyle& style = curr->layoutObject().styleRef(isFirstLine
Style()); | 1158 const ComputedStyle& style = curr->layoutObject().styleRef(isFirstLi
neStyle()); |
1159 TextEmphasisPosition emphasisMarkPosition; | 1159 TextEmphasisPosition emphasisMarkPosition; |
1160 if (style.textEmphasisMark() != TextEmphasisMarkNone && toInlineText
Box(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMarkP
osition == TextEmphasisPositionOver) { | 1160 if (style.textEmphasisMark() != TextEmphasisMarkNone && toInlineText
Box(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMarkP
osition == TextEmphasisPositionOver) { |
1161 if (!style.isFlippedLinesWritingMode()) { | 1161 if (!style.isFlippedLinesWritingMode()) { |
1162 int topOfEmphasisMark = curr->logicalTop() - style.font().em
phasisMarkHeight(style.textEmphasisMarkString()); | 1162 int topOfEmphasisMark = curr->logicalTop() - style.font().em
phasisMarkHeight(style.textEmphasisMarkString()); |
1163 result = std::max(result, allowedPosition - topOfEmphasisMar
k); | 1163 result = std::max(result, allowedPosition - topOfEmphasisMar
k); |
1164 } else { | 1164 } else { |
1165 int bottomOfEmphasisMark = curr->logicalBottom() + style.fon
t().emphasisMarkHeight(style.textEmphasisMarkString()); | 1165 int bottomOfEmphasisMark = curr->logicalBottom() + style.fon
t().emphasisMarkHeight(style.textEmphasisMarkString()); |
1166 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); | 1166 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); |
1167 } | 1167 } |
1168 } | 1168 } |
(...skipping 27 matching lines...) Expand all Loading... |
1196 } else { | 1196 } else { |
1197 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); | 1197 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); |
1198 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1198 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
1199 continue; | 1199 continue; |
1200 bottomOfLastRubyTextLine += curr->logicalTop(); | 1200 bottomOfLastRubyTextLine += curr->logicalTop(); |
1201 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); | 1201 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); |
1202 } | 1202 } |
1203 } | 1203 } |
1204 | 1204 |
1205 if (curr->isInlineTextBox()) { | 1205 if (curr->isInlineTextBox()) { |
1206 const LayoutStyle& style = curr->layoutObject().styleRef(isFirstLine
Style()); | 1206 const ComputedStyle& style = curr->layoutObject().styleRef(isFirstLi
neStyle()); |
1207 if (style.textEmphasisMark() != TextEmphasisMarkNone && style.textEm
phasisPosition() == TextEmphasisPositionUnder) { | 1207 if (style.textEmphasisMark() != TextEmphasisMarkNone && style.textEm
phasisPosition() == TextEmphasisPositionUnder) { |
1208 if (!style.isFlippedLinesWritingMode()) { | 1208 if (!style.isFlippedLinesWritingMode()) { |
1209 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + st
yle.font().emphasisMarkHeight(style.textEmphasisMarkString()); | 1209 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + st
yle.font().emphasisMarkHeight(style.textEmphasisMarkString()); |
1210 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); | 1210 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); |
1211 } else { | 1211 } else { |
1212 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style.fo
nt().emphasisMarkHeight(style.textEmphasisMarkString()); | 1212 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style.fo
nt().emphasisMarkHeight(style.textEmphasisMarkString()); |
1213 result = std::max(result, allowedPosition - topOfEmphasisMar
k); | 1213 result = std::max(result, allowedPosition - topOfEmphasisMar
k); |
1214 } | 1214 } |
1215 } | 1215 } |
1216 } | 1216 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 ASSERT(child->prevOnLine() == prev); | 1299 ASSERT(child->prevOnLine() == prev); |
1300 prev = child; | 1300 prev = child; |
1301 } | 1301 } |
1302 ASSERT(prev == m_lastChild); | 1302 ASSERT(prev == m_lastChild); |
1303 #endif | 1303 #endif |
1304 } | 1304 } |
1305 | 1305 |
1306 #endif | 1306 #endif |
1307 | 1307 |
1308 } // namespace blink | 1308 } // namespace blink |
OLD | NEW |