| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 if (child == m_firstChild) | 190 if (child == m_firstChild) |
| 191 m_firstChild = child->nextOnLine(); | 191 m_firstChild = child->nextOnLine(); |
| 192 if (child == m_lastChild) | 192 if (child == m_lastChild) |
| 193 m_lastChild = child->prevOnLine(); | 193 m_lastChild = child->prevOnLine(); |
| 194 if (child->nextOnLine()) | 194 if (child->nextOnLine()) |
| 195 child->nextOnLine()->setPrevOnLine(child->prevOnLine()); | 195 child->nextOnLine()->setPrevOnLine(child->prevOnLine()); |
| 196 if (child->prevOnLine()) | 196 if (child->prevOnLine()) |
| 197 child->prevOnLine()->setNextOnLine(child->nextOnLine()); | 197 child->prevOnLine()->setNextOnLine(child->nextOnLine()); |
| 198 | 198 |
| 199 child->setParent(0); | 199 child->setParent(nullptr); |
| 200 | 200 |
| 201 checkConsistency(); | 201 checkConsistency(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void InlineFlowBox::deleteLine() | 204 void InlineFlowBox::deleteLine() |
| 205 { | 205 { |
| 206 InlineBox* child = firstChild(); | 206 InlineBox* child = firstChild(); |
| 207 InlineBox* next = 0; | 207 InlineBox* next = nullptr; |
| 208 while (child) { | 208 while (child) { |
| 209 ASSERT(this == child->parent()); | 209 ASSERT(this == child->parent()); |
| 210 next = child->nextOnLine(); | 210 next = child->nextOnLine(); |
| 211 #if ENABLE(ASSERT) | 211 #if ENABLE(ASSERT) |
| 212 child->setParent(0); | 212 child->setParent(nullptr); |
| 213 #endif | 213 #endif |
| 214 child->deleteLine(); | 214 child->deleteLine(); |
| 215 child = next; | 215 child = next; |
| 216 } | 216 } |
| 217 #if ENABLE(ASSERT) | 217 #if ENABLE(ASSERT) |
| 218 m_firstChild = 0; | 218 m_firstChild = nullptr; |
| 219 m_lastChild = 0; | 219 m_lastChild = nullptr; |
| 220 #endif | 220 #endif |
| 221 | 221 |
| 222 removeLineBoxFromLayoutObject(); | 222 removeLineBoxFromLayoutObject(); |
| 223 destroy(); | 223 destroy(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void InlineFlowBox::removeLineBoxFromLayoutObject() | 226 void InlineFlowBox::removeLineBoxFromLayoutObject() |
| 227 { | 227 { |
| 228 lineBoxes()->removeLineBox(this); | 228 lineBoxes()->removeLineBox(this); |
| 229 } | 229 } |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 521 } |
| 522 } | 522 } |
| 523 | 523 |
| 524 if (!checkChildren) | 524 if (!checkChildren) |
| 525 return; | 525 return; |
| 526 | 526 |
| 527 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 527 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 528 if (curr->layoutObject().isOutOfFlowPositioned()) | 528 if (curr->layoutObject().isOutOfFlowPositioned()) |
| 529 continue; // Positioned placeholders don't affect calculations. | 529 continue; // Positioned placeholders don't affect calculations. |
| 530 | 530 |
| 531 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : 0; | 531 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; |
| 532 | 532 |
| 533 bool affectsAscent = false; | 533 bool affectsAscent = false; |
| 534 bool affectsDescent = false; | 534 bool affectsDescent = false; |
| 535 | 535 |
| 536 // The verticalPositionForBox function returns the distance between the
child box's baseline | 536 // The verticalPositionForBox function returns the distance between the
child box's baseline |
| 537 // and the root box's baseline. The value is negative if the child box'
s baseline is above the | 537 // and the root box's baseline. The value is negative if the child box'
s baseline is above the |
| 538 // root box's baseline, and it is positive if the child box's baseline i
s below the root box's baseline. | 538 // root box's baseline, and it is positive if the child box's baseline i
s below the root box's baseline. |
| 539 curr->setLogicalTop(rootBox->verticalPositionForBox(curr, verticalPositi
onCache).toFloat()); | 539 curr->setLogicalTop(rootBox->verticalPositionForBox(curr, verticalPositi
onCache).toFloat()); |
| 540 | 540 |
| 541 int ascent = 0; | 541 int ascent = 0; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 | 593 |
| 594 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 594 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 595 if (curr->layoutObject().isOutOfFlowPositioned()) | 595 if (curr->layoutObject().isOutOfFlowPositioned()) |
| 596 continue; // Positioned placeholders don't affect calculations. | 596 continue; // Positioned placeholders don't affect calculations. |
| 597 | 597 |
| 598 if (descendantsHaveSameLineHeightAndBaseline()) { | 598 if (descendantsHaveSameLineHeightAndBaseline()) { |
| 599 curr->adjustBlockDirectionPosition(adjustmentForChildrenWithSameLine
HeightAndBaseline.toFloat()); | 599 curr->adjustBlockDirectionPosition(adjustmentForChildrenWithSameLine
HeightAndBaseline.toFloat()); |
| 600 continue; | 600 continue; |
| 601 } | 601 } |
| 602 | 602 |
| 603 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : 0; | 603 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; |
| 604 bool childAffectsTopBottomPos = true; | 604 bool childAffectsTopBottomPos = true; |
| 605 if (curr->verticalAlign() == TOP) { | 605 if (curr->verticalAlign() == TOP) { |
| 606 curr->setLogicalTop(top.toFloat()); | 606 curr->setLogicalTop(top.toFloat()); |
| 607 } else if (curr->verticalAlign() == BOTTOM) { | 607 } else if (curr->verticalAlign() == BOTTOM) { |
| 608 curr->setLogicalTop((top + maxHeight - curr->lineHeight()).toFloat()
); | 608 curr->setLogicalTop((top + maxHeight - curr->lineHeight()).toFloat()
); |
| 609 } else { | 609 } else { |
| 610 if (!strictMode && inlineFlowBox && !inlineFlowBox->hasTextChildren(
) && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding() | 610 if (!strictMode && inlineFlowBox && !inlineFlowBox->hasTextChildren(
) && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding() |
| 611 && !(inlineFlowBox->descendantsHaveSameLineHeightAndBaseline() &
& inlineFlowBox->hasTextDescendants())) | 611 && !(inlineFlowBox->descendantsHaveSameLineHeightAndBaseline() &
& inlineFlowBox->hasTextDescendants())) |
| 612 childAffectsTopBottomPos = false; | 612 childAffectsTopBottomPos = false; |
| 613 LayoutUnit posAdjust = maxAscent - curr->baselinePosition(baselineTy
pe); | 613 LayoutUnit posAdjust = maxAscent - curr->baselinePosition(baselineTy
pe); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 } | 801 } |
| 802 | 802 |
| 803 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp
hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) | 803 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp
hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) |
| 804 { | 804 { |
| 805 if (textBox->knownToHaveNoOverflow()) | 805 if (textBox->knownToHaveNoOverflow()) |
| 806 return; | 806 return; |
| 807 | 807 |
| 808 const ComputedStyle& style = textBox->layoutObject().styleRef(isFirstLineSty
le()); | 808 const ComputedStyle& style = textBox->layoutObject().styleRef(isFirstLineSty
le()); |
| 809 | 809 |
| 810 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox)
; | 810 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox)
; |
| 811 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s
econd; | 811 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? nullptr : &it->v
alue.second; |
| 812 bool isFlippedLine = style.isFlippedLinesWritingMode(); | 812 bool isFlippedLine = style.isFlippedLinesWritingMode(); |
| 813 | 813 |
| 814 int topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom :
glyphOverflow->top) : 0; | 814 int topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom :
glyphOverflow->top) : 0; |
| 815 int bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top :
glyphOverflow->bottom) : 0; | 815 int bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top :
glyphOverflow->bottom) : 0; |
| 816 int leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0; | 816 int leftGlyphEdge = glyphOverflow ? glyphOverflow->left : 0; |
| 817 int rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0; | 817 int rightGlyphEdge = glyphOverflow ? glyphOverflow->right : 0; |
| 818 | 818 |
| 819 int strokeOverflow = static_cast<int>(ceilf(style.textStrokeWidth() / 2.0f))
; | 819 int strokeOverflow = static_cast<int>(ceilf(style.textStrokeWidth() / 2.0f))
; |
| 820 int topGlyphOverflow = -strokeOverflow - topGlyphEdge; | 820 int topGlyphOverflow = -strokeOverflow - topGlyphEdge; |
| 821 int bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge; | 821 int bottomGlyphOverflow = strokeOverflow + bottomGlyphEdge; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 { | 1064 { |
| 1065 // The checks here match how paintFillLayer() decides whether to clip (if it
does, the shadow | 1065 // The checks here match how paintFillLayer() decides whether to clip (if it
does, the shadow |
| 1066 // would be clipped out, so it has to be drawn separately). | 1066 // would be clipped out, so it has to be drawn separately). |
| 1067 StyleImage* image = lastBackgroundLayer.image(); | 1067 StyleImage* image = lastBackgroundLayer.image(); |
| 1068 bool hasFillImage = image && image->canRender(layoutObject(), layoutObject()
.style()->effectiveZoom()); | 1068 bool hasFillImage = image && image->canRender(layoutObject(), layoutObject()
.style()->effectiveZoom()); |
| 1069 return (!hasFillImage && !layoutObject().style()->hasBorderRadius()) || (!pr
evLineBox() && !nextLineBox()) || !parent(); | 1069 return (!hasFillImage && !layoutObject().style()->hasBorderRadius()) || (!pr
evLineBox() && !nextLineBox()) || !parent(); |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 InlineBox* InlineFlowBox::firstLeafChild() const | 1072 InlineBox* InlineFlowBox::firstLeafChild() const |
| 1073 { | 1073 { |
| 1074 InlineBox* leaf = 0; | 1074 InlineBox* leaf = nullptr; |
| 1075 for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnL
ine()) | 1075 for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnL
ine()) |
| 1076 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->firstLeafChild(
); | 1076 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->firstLeafChild(
); |
| 1077 return leaf; | 1077 return leaf; |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 InlineBox* InlineFlowBox::lastLeafChild() const | 1080 InlineBox* InlineFlowBox::lastLeafChild() const |
| 1081 { | 1081 { |
| 1082 InlineBox* leaf = 0; | 1082 InlineBox* leaf = nullptr; |
| 1083 for (InlineBox* child = lastChild(); child && !leaf; child = child->prevOnLi
ne()) | 1083 for (InlineBox* child = lastChild(); child && !leaf; child = child->prevOnLi
ne()) |
| 1084 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->lastLeafChild()
; | 1084 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->lastLeafChild()
; |
| 1085 return leaf; | 1085 return leaf; |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 LayoutObject::SelectionState InlineFlowBox::selectionState() const | 1088 LayoutObject::SelectionState InlineFlowBox::selectionState() const |
| 1089 { | 1089 { |
| 1090 return LayoutObject::SelectionNone; | 1090 return LayoutObject::SelectionNone; |
| 1091 } | 1091 } |
| 1092 | 1092 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 box->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLab
el2, obj, depth + 1); | 1297 box->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLab
el2, obj, depth + 1); |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 #endif | 1300 #endif |
| 1301 | 1301 |
| 1302 #if ENABLE(ASSERT) | 1302 #if ENABLE(ASSERT) |
| 1303 void InlineFlowBox::checkConsistency() const | 1303 void InlineFlowBox::checkConsistency() const |
| 1304 { | 1304 { |
| 1305 #ifdef CHECK_CONSISTENCY | 1305 #ifdef CHECK_CONSISTENCY |
| 1306 ASSERT(!m_hasBadChildList); | 1306 ASSERT(!m_hasBadChildList); |
| 1307 const InlineBox* prev = 0; | 1307 const InlineBox* prev = nullptr; |
| 1308 for (const InlineBox* child = m_firstChild; child; child = child->nextOnLine
()) { | 1308 for (const InlineBox* child = m_firstChild; child; child = child->nextOnLine
()) { |
| 1309 ASSERT(child->parent() == this); | 1309 ASSERT(child->parent() == this); |
| 1310 ASSERT(child->prevOnLine() == prev); | 1310 ASSERT(child->prevOnLine() == prev); |
| 1311 prev = child; | 1311 prev = child; |
| 1312 } | 1312 } |
| 1313 ASSERT(prev == m_lastChild); | 1313 ASSERT(prev == m_lastChild); |
| 1314 #endif | 1314 #endif |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 #endif | 1317 #endif |
| 1318 | 1318 |
| 1319 } // namespace blink | 1319 } // namespace blink |
| OLD | NEW |