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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (child->isText()) { | 113 if (child->isText()) { |
114 if (child->renderer().parent() == renderer()) | 114 if (child->renderer().parent() == renderer()) |
115 m_hasTextChildren = true; | 115 m_hasTextChildren = true; |
116 setHasTextDescendantsOnAncestors(this); | 116 setHasTextDescendantsOnAncestors(this); |
117 } else if (child->isInlineFlowBox()) { | 117 } else if (child->isInlineFlowBox()) { |
118 if (toInlineFlowBox(child)->hasTextDescendants()) | 118 if (toInlineFlowBox(child)->hasTextDescendants()) |
119 setHasTextDescendantsOnAncestors(this); | 119 setHasTextDescendantsOnAncestors(this); |
120 } | 120 } |
121 | 121 |
122 if (descendantsHaveSameLineHeightAndBaseline() && !child->renderer().isOutOf
FlowPositioned()) { | 122 if (descendantsHaveSameLineHeightAndBaseline() && !child->renderer().isOutOf
FlowPositioned()) { |
123 RenderStyle* parentStyle = renderer().style(isFirstLineStyle()); | 123 const RenderStyle* parentStyle = renderer().style(isFirstLineStyle()); |
124 RenderStyle* childStyle = child->renderer().style(isFirstLineStyle()); | 124 const RenderStyle* childStyle = child->renderer().style(isFirstLineStyle
()); |
125 bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false; | 125 bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false; |
126 if (child->renderer().isReplaced()) | 126 if (child->renderer().isReplaced()) |
127 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 127 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
128 else if (child->isText()) { | 128 else if (child->isText()) { |
129 if (child->renderer().isBR() || child->renderer().parent() != render
er()) { | 129 if (child->renderer().isBR() || child->renderer().parent() != render
er()) { |
130 if (!parentStyle->font().fontMetrics().hasIdenticalAscentDescent
AndLineGap(childStyle->font().fontMetrics()) | 130 if (!parentStyle->font().fontMetrics().hasIdenticalAscentDescent
AndLineGap(childStyle->font().fontMetrics()) |
131 || parentStyle->lineHeight() != childStyle->lineHeight() | 131 || parentStyle->lineHeight() != childStyle->lineHeight() |
132 || (parentStyle->verticalAlign() != BASELINE && !isRootInlin
eBox()) || childStyle->verticalAlign() != BASELINE) | 132 || (parentStyle->verticalAlign() != BASELINE && !isRootInlin
eBox()) || childStyle->verticalAlign() != BASELINE) |
133 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 133 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
134 } | 134 } |
(...skipping 16 matching lines...) Expand all Loading... |
151 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 151 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 if (shouldClearDescendantsHaveSameLineHeightAndBaseline) | 155 if (shouldClearDescendantsHaveSameLineHeightAndBaseline) |
156 clearDescendantsHaveSameLineHeightAndBaseline(); | 156 clearDescendantsHaveSameLineHeightAndBaseline(); |
157 } | 157 } |
158 | 158 |
159 if (!child->renderer().isOutOfFlowPositioned()) { | 159 if (!child->renderer().isOutOfFlowPositioned()) { |
160 if (child->isText()) { | 160 if (child->isText()) { |
161 RenderStyle* childStyle = child->renderer().style(isFirstLineStyle()
); | 161 const RenderStyle* childStyle = child->renderer().style(isFirstLineS
tyle()); |
162 if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || c
hildStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeW
idth()) | 162 if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || c
hildStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeW
idth()) |
163 child->clearKnownToHaveNoOverflow(); | 163 child->clearKnownToHaveNoOverflow(); |
164 } else if (child->renderer().isReplaced()) { | 164 } else if (child->renderer().isReplaced()) { |
165 RenderBox& box = toRenderBox(child->renderer()); | 165 RenderBox& box = toRenderBox(child->renderer()); |
166 if (box.hasRenderOverflow() || box.hasSelfPaintingLayer()) | 166 if (box.hasRenderOverflow() || box.hasSelfPaintingLayer()) |
167 child->clearKnownToHaveNoOverflow(); | 167 child->clearKnownToHaveNoOverflow(); |
168 } else if (!child->renderer().isBR() && (child->renderer().style(isFirst
LineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLayer() | 168 } else if (!child->renderer().isBR() && (child->renderer().style(isFirst
LineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLayer() |
169 || (child->renderer().isListMarker() && !toRenderListMarker(child->r
enderer()).isInside()) | 169 || (child->renderer().isListMarker() && !toRenderListMarker(child->r
enderer()).isInside()) |
170 || child->renderer().style(isFirstLineStyle())->hasBorderImageOutset
s() | 170 || child->renderer().style(isFirstLineStyle())->hasBorderImageOutset
s() |
171 || child->renderer().style(isFirstLineStyle())->hasOutline())) { | 171 || child->renderer().style(isFirstLineStyle())->hasOutline())) { |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 curr->setLogicalTop(lineBottom - (curr->logicalTop() - lineTop) - cu
rr->logicalHeight()); | 776 curr->setLogicalTop(lineBottom - (curr->logicalTop() - lineTop) - cu
rr->logicalHeight()); |
777 } | 777 } |
778 } | 778 } |
779 | 779 |
780 inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO
verflow) | 780 inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO
verflow) |
781 { | 781 { |
782 // box-shadow on root line boxes is applying to the block and not to the lin
es. | 782 // box-shadow on root line boxes is applying to the block and not to the lin
es. |
783 if (!parent()) | 783 if (!parent()) |
784 return; | 784 return; |
785 | 785 |
786 RenderStyle* style = renderer().style(isFirstLineStyle()); | 786 const RenderStyle* style = renderer().style(isFirstLineStyle()); |
787 WritingMode writingMode = style->writingMode(); | 787 WritingMode writingMode = style->writingMode(); |
788 ShadowList* boxShadow = style->boxShadow(); | 788 ShadowList* boxShadow = style->boxShadow(); |
789 if (!boxShadow) | 789 if (!boxShadow) |
790 return; | 790 return; |
791 | 791 |
792 LayoutRectOutsets outsets(boxShadow->rectOutsetsIncludingOriginal()); | 792 LayoutRectOutsets outsets(boxShadow->rectOutsetsIncludingOriginal()); |
793 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite shadow that applies, since | 793 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite shadow that applies, since |
794 // the line is "upside down" in terms of block coordinates. | 794 // the line is "upside down" in terms of block coordinates. |
795 LayoutRectOutsets logicalOutsets(outsets.logicalOutsetsWithFlippedLines(writ
ingMode)); | 795 LayoutRectOutsets logicalOutsets(outsets.logicalOutsetsWithFlippedLines(writ
ingMode)); |
796 | 796 |
797 LayoutRect shadowBounds(logicalFrameRect().toLayoutRect()); | 797 LayoutRect shadowBounds(logicalFrameRect().toLayoutRect()); |
798 shadowBounds.expand(logicalOutsets); | 798 shadowBounds.expand(logicalOutsets); |
799 logicalVisualOverflow.unite(shadowBounds); | 799 logicalVisualOverflow.unite(shadowBounds); |
800 } | 800 } |
801 | 801 |
802 inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu
alOverflow) | 802 inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu
alOverflow) |
803 { | 803 { |
804 // border-image-outset on root line boxes is applying to the block and not t
o the lines. | 804 // border-image-outset on root line boxes is applying to the block and not t
o the lines. |
805 if (!parent()) | 805 if (!parent()) |
806 return; | 806 return; |
807 | 807 |
808 RenderStyle* style = renderer().style(isFirstLineStyle()); | 808 const RenderStyle* style = renderer().style(isFirstLineStyle()); |
809 if (!style->hasBorderImageOutsets()) | 809 if (!style->hasBorderImageOutsets()) |
810 return; | 810 return; |
811 | 811 |
812 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite border that applies, since | 812 // Similar to how glyph overflow works, if our lines are flipped, then it's
actually the opposite border that applies, since |
813 // the line is "upside down" in terms of block coordinates. vertical-rl and
horizontal-bt are the flipped line modes. | 813 // the line is "upside down" in terms of block coordinates. vertical-rl and
horizontal-bt are the flipped line modes. |
814 LayoutRectOutsets logicalOutsets = style->borderImageOutsets().logicalOutset
sWithFlippedLines(style->writingMode()); | 814 LayoutRectOutsets logicalOutsets = style->borderImageOutsets().logicalOutset
sWithFlippedLines(style->writingMode()); |
815 | 815 |
816 if (!includeLogicalLeftEdge()) | 816 if (!includeLogicalLeftEdge()) |
817 logicalOutsets.setLeft(LayoutUnit()); | 817 logicalOutsets.setLeft(LayoutUnit()); |
818 if (!includeLogicalRightEdge()) | 818 if (!includeLogicalRightEdge()) |
819 logicalOutsets.setRight(LayoutUnit()); | 819 logicalOutsets.setRight(LayoutUnit()); |
820 | 820 |
821 LayoutRect borderOutsetBounds(logicalFrameRect().toLayoutRect()); | 821 LayoutRect borderOutsetBounds(logicalFrameRect().toLayoutRect()); |
822 borderOutsetBounds.expand(logicalOutsets); | 822 borderOutsetBounds.expand(logicalOutsets); |
823 logicalVisualOverflow.unite(borderOutsetBounds); | 823 logicalVisualOverflow.unite(borderOutsetBounds); |
824 } | 824 } |
825 | 825 |
826 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve
rflow) | 826 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve
rflow) |
827 { | 827 { |
828 // Outline on root line boxes is applied to the block and not to the lines. | 828 // Outline on root line boxes is applied to the block and not to the lines. |
829 if (!parent()) | 829 if (!parent()) |
830 return; | 830 return; |
831 | 831 |
832 RenderStyle* style = renderer().style(isFirstLineStyle()); | 832 const RenderStyle* style = renderer().style(isFirstLineStyle()); |
833 if (!style->hasOutline()) | 833 if (!style->hasOutline()) |
834 return; | 834 return; |
835 | 835 |
836 logicalVisualOverflow.inflate(style->outlineSize()); | 836 logicalVisualOverflow.inflate(style->outlineSize()); |
837 } | 837 } |
838 | 838 |
839 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp
hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) | 839 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp
hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) |
840 { | 840 { |
841 if (textBox->knownToHaveNoOverflow()) | 841 if (textBox->knownToHaveNoOverflow()) |
842 return; | 842 return; |
843 | 843 |
844 RenderStyle* style = textBox->renderer().style(isFirstLineStyle()); | 844 const RenderStyle* style = textBox->renderer().style(isFirstLineStyle()); |
845 | 845 |
846 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox)
; | 846 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox)
; |
847 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s
econd; | 847 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s
econd; |
848 bool isFlippedLine = style->isFlippedLinesWritingMode(); | 848 bool isFlippedLine = style->isFlippedLinesWritingMode(); |
849 | 849 |
850 int topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom :
glyphOverflow->top) : 0; | 850 int topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom :
glyphOverflow->top) : 0; |
851 int bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top :
glyphOverflow->bottom) : 0; | 851 int bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top :
glyphOverflow->bottom) : 0; |
852 int leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0; | 852 int leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0; |
853 int rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0; | 853 int rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0; |
854 | 854 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 } else { | 1189 } else { |
1190 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); | 1190 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); |
1191 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1191 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
1192 continue; | 1192 continue; |
1193 bottomOfLastRubyTextLine += curr->logicalTop(); | 1193 bottomOfLastRubyTextLine += curr->logicalTop(); |
1194 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); | 1194 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); |
1195 } | 1195 } |
1196 } | 1196 } |
1197 | 1197 |
1198 if (curr->isInlineTextBox()) { | 1198 if (curr->isInlineTextBox()) { |
1199 RenderStyle* style = curr->renderer().style(isFirstLineStyle()); | 1199 const RenderStyle* style = curr->renderer().style(isFirstLineStyle()
); |
1200 TextEmphasisPosition emphasisMarkPosition; | 1200 TextEmphasisPosition emphasisMarkPosition; |
1201 if (style->textEmphasisMark() != TextEmphasisMarkNone && toInlineTex
tBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMark
Position == TextEmphasisPositionOver) { | 1201 if (style->textEmphasisMark() != TextEmphasisMarkNone && toInlineTex
tBox(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMark
Position == TextEmphasisPositionOver) { |
1202 if (!style->isFlippedLinesWritingMode()) { | 1202 if (!style->isFlippedLinesWritingMode()) { |
1203 int topOfEmphasisMark = curr->logicalTop() - style->font().e
mphasisMarkHeight(style->textEmphasisMarkString()); | 1203 int topOfEmphasisMark = curr->logicalTop() - style->font().e
mphasisMarkHeight(style->textEmphasisMarkString()); |
1204 result = std::max(result, allowedPosition - topOfEmphasisMar
k); | 1204 result = std::max(result, allowedPosition - topOfEmphasisMar
k); |
1205 } else { | 1205 } else { |
1206 int bottomOfEmphasisMark = curr->logicalBottom() + style->fo
nt().emphasisMarkHeight(style->textEmphasisMarkString()); | 1206 int bottomOfEmphasisMark = curr->logicalBottom() + style->fo
nt().emphasisMarkHeight(style->textEmphasisMarkString()); |
1207 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); | 1207 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); |
1208 } | 1208 } |
1209 } | 1209 } |
(...skipping 27 matching lines...) Expand all Loading... |
1237 } else { | 1237 } else { |
1238 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); | 1238 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (
rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logi
calHeight()); |
1239 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) | 1239 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) |
1240 continue; | 1240 continue; |
1241 bottomOfLastRubyTextLine += curr->logicalTop(); | 1241 bottomOfLastRubyTextLine += curr->logicalTop(); |
1242 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); | 1242 result = std::max(result, bottomOfLastRubyTextLine - allowedPosi
tion); |
1243 } | 1243 } |
1244 } | 1244 } |
1245 | 1245 |
1246 if (curr->isInlineTextBox()) { | 1246 if (curr->isInlineTextBox()) { |
1247 RenderStyle* style = curr->renderer().style(isFirstLineStyle()); | 1247 const RenderStyle* style = curr->renderer().style(isFirstLineStyle()
); |
1248 if (style->textEmphasisMark() != TextEmphasisMarkNone && style->text
EmphasisPosition() == TextEmphasisPositionUnder) { | 1248 if (style->textEmphasisMark() != TextEmphasisMarkNone && style->text
EmphasisPosition() == TextEmphasisPositionUnder) { |
1249 if (!style->isFlippedLinesWritingMode()) { | 1249 if (!style->isFlippedLinesWritingMode()) { |
1250 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + st
yle->font().emphasisMarkHeight(style->textEmphasisMarkString()); | 1250 LayoutUnit bottomOfEmphasisMark = curr->logicalBottom() + st
yle->font().emphasisMarkHeight(style->textEmphasisMarkString()); |
1251 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); | 1251 result = std::max(result, bottomOfEmphasisMark - allowedPosi
tion); |
1252 } else { | 1252 } else { |
1253 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style->f
ont().emphasisMarkHeight(style->textEmphasisMarkString()); | 1253 LayoutUnit topOfEmphasisMark = curr->logicalTop() - style->f
ont().emphasisMarkHeight(style->textEmphasisMarkString()); |
1254 result = std::max(result, allowedPosition - topOfEmphasisMar
k); | 1254 result = std::max(result, allowedPosition - topOfEmphasisMar
k); |
1255 } | 1255 } |
1256 } | 1256 } |
1257 } | 1257 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 ASSERT(child->prevOnLine() == prev); | 1339 ASSERT(child->prevOnLine() == prev); |
1340 prev = child; | 1340 prev = child; |
1341 } | 1341 } |
1342 ASSERT(prev == m_lastChild); | 1342 ASSERT(prev == m_lastChild); |
1343 #endif | 1343 #endif |
1344 } | 1344 } |
1345 | 1345 |
1346 #endif | 1346 #endif |
1347 | 1347 |
1348 } // namespace blink | 1348 } // namespace blink |
OLD | NEW |