| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 m_firstChild = child; | 100 m_firstChild = child; |
| 101 m_lastChild = child; | 101 m_lastChild = child; |
| 102 } else { | 102 } else { |
| 103 m_lastChild->setNextOnLine(child); | 103 m_lastChild->setNextOnLine(child); |
| 104 child->setPrevOnLine(m_lastChild); | 104 child->setPrevOnLine(m_lastChild); |
| 105 m_lastChild = child; | 105 m_lastChild = child; |
| 106 } | 106 } |
| 107 child->setFirstLineStyleBit(isFirstLineStyle()); | 107 child->setFirstLineStyleBit(isFirstLineStyle()); |
| 108 child->setIsHorizontal(isHorizontal()); | 108 child->setIsHorizontal(isHorizontal()); |
| 109 if (child->isText()) { | 109 if (child->isText()) { |
| 110 if (child->lineLayoutItem().parent() == lineLayoutItem()) | 110 if (child->getLineLayoutItem().parent() == getLineLayoutItem()) |
| 111 m_hasTextChildren = true; | 111 m_hasTextChildren = true; |
| 112 setHasTextDescendantsOnAncestors(this); | 112 setHasTextDescendantsOnAncestors(this); |
| 113 } else if (child->isInlineFlowBox()) { | 113 } else if (child->isInlineFlowBox()) { |
| 114 if (toInlineFlowBox(child)->hasTextDescendants()) | 114 if (toInlineFlowBox(child)->hasTextDescendants()) |
| 115 setHasTextDescendantsOnAncestors(this); | 115 setHasTextDescendantsOnAncestors(this); |
| 116 } | 116 } |
| 117 | 117 |
| 118 if (descendantsHaveSameLineHeightAndBaseline() && !child->lineLayoutItem().i
sOutOfFlowPositioned()) { | 118 if (descendantsHaveSameLineHeightAndBaseline() && !child->getLineLayoutItem(
).isOutOfFlowPositioned()) { |
| 119 const ComputedStyle& parentStyle = lineLayoutItem().styleRef(isFirstLine
Style()); | 119 const ComputedStyle& parentStyle = getLineLayoutItem().styleRef(isFirstL
ineStyle()); |
| 120 const ComputedStyle& childStyle = child->lineLayoutItem().styleRef(isFir
stLineStyle()); | 120 const ComputedStyle& childStyle = child->getLineLayoutItem().styleRef(is
FirstLineStyle()); |
| 121 bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false; | 121 bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false; |
| 122 if (child->lineLayoutItem().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->lineLayoutItem().isBR() || (child->lineLayoutItem().paren
t() != lineLayoutItem())) { | 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.textEmphasisMark() !=
TextEmphasisMarkNone) |
| 132 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; | 132 shouldClearDescendantsHaveSameLineHeightAndBaseline = true; |
| 133 } else { | 133 } else { |
| 134 if (child->lineLayoutItem().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->lineLayoutItem().isOutOfFlowPositioned()) { | 155 if (!child->getLineLayoutItem().isOutOfFlowPositioned()) { |
| 156 if (child->isText()) { | 156 if (child->isText()) { |
| 157 const ComputedStyle& childStyle = child->lineLayoutItem().styleRef(i
sFirstLineStyle()); | 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.textEmphasisMark() != TextEmphasisMarkNone || childStyle.textStrokeWidth
()) |
| 159 child->clearKnownToHaveNoOverflow(); | 159 child->clearKnownToHaveNoOverflow(); |
| 160 } else if (child->lineLayoutItem().isAtomicInlineLevel()) { | 160 } else if (child->getLineLayoutItem().isAtomicInlineLevel()) { |
| 161 LineLayoutBox box = LineLayoutBox(child->lineLayoutItem()); | 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->lineLayoutItem().isBR() && (child->lineLayoutItem().s
tyle(isFirstLineStyle())->boxShadow() || child->boxModelObject().hasSelfPainting
Layer() | 164 } else if (!child->getLineLayoutItem().isBR() && (child->getLineLayoutIt
em().style(isFirstLineStyle())->boxShadow() || child->boxModelObject().hasSelfPa
intingLayer() |
| 165 || (child->lineLayoutItem().isListMarker() && !LineLayoutListMarker(
child->lineLayoutItem()).isInside()) | 165 || (child->getLineLayoutItem().isListMarker() && !LineLayoutListMark
er(child->getLineLayoutItem()).isInside()) |
| 166 || child->lineLayoutItem().style(isFirstLineStyle())->hasBorderImage
Outsets() | 166 || child->getLineLayoutItem().style(isFirstLineStyle())->hasBorderIm
ageOutsets() |
| 167 || child->lineLayoutItem().style(isFirstLineStyle())->hasOutline()))
{ | 167 || child->getLineLayoutItem().style(isFirstLineStyle())->hasOutline(
))) { |
| 168 child->clearKnownToHaveNoOverflow(); | 168 child->clearKnownToHaveNoOverflow(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 if (knownToHaveNoOverflow() && child->isInlineFlowBox() && !toInlineFlow
Box(child)->knownToHaveNoOverflow()) | 171 if (knownToHaveNoOverflow() && child->isInlineFlowBox() && !toInlineFlow
Box(child)->knownToHaveNoOverflow()) |
| 172 clearKnownToHaveNoOverflow(); | 172 clearKnownToHaveNoOverflow(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 checkConsistency(); | 175 checkConsistency(); |
| 176 } | 176 } |
| 177 | 177 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 void InlineFlowBox::attachLineBoxToLayoutObject() | 249 void InlineFlowBox::attachLineBoxToLayoutObject() |
| 250 { | 250 { |
| 251 lineBoxes()->attachLineBox(this); | 251 lineBoxes()->attachLineBox(this); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void InlineFlowBox::move(const LayoutSize& delta) | 254 void InlineFlowBox::move(const LayoutSize& delta) |
| 255 { | 255 { |
| 256 InlineBox::move(delta); | 256 InlineBox::move(delta); |
| 257 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { | 257 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { |
| 258 if (child->lineLayoutItem().isOutOfFlowPositioned()) | 258 if (child->getLineLayoutItem().isOutOfFlowPositioned()) |
| 259 continue; | 259 continue; |
| 260 child->move(delta); | 260 child->move(delta); |
| 261 } | 261 } |
| 262 if (m_overflow) | 262 if (m_overflow) |
| 263 m_overflow->move(delta.width(), delta.height()); // FIXME: Rounding erro
r here since overflow was pixel snapped, but nobody other than list markers pass
es non-integral values here. | 263 m_overflow->move(delta.width(), delta.height()); // FIXME: Rounding erro
r here since overflow was pixel snapped, but nobody other than list markers pass
es non-integral values here. |
| 264 } | 264 } |
| 265 | 265 |
| 266 LineBoxList* InlineFlowBox::lineBoxes() const | 266 LineBoxList* InlineFlowBox::lineBoxes() const |
| 267 { | 267 { |
| 268 return LineLayoutInline(lineLayoutItem()).lineBoxes(); | 268 return LineLayoutInline(getLineLayoutItem()).lineBoxes(); |
| 269 } | 269 } |
| 270 | 270 |
| 271 static inline bool isLastChildForLayoutObject(LineLayoutItem ancestor, LineLayou
tItem child) | 271 static inline bool isLastChildForLayoutObject(LineLayoutItem ancestor, LineLayou
tItem child) |
| 272 { | 272 { |
| 273 if (!child) | 273 if (!child) |
| 274 return false; | 274 return false; |
| 275 | 275 |
| 276 if (child == ancestor) | 276 if (child == ancestor) |
| 277 return true; | 277 return true; |
| 278 | 278 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 304 | 304 |
| 305 void InlineFlowBox::determineSpacingForFlowBoxes(bool lastLine, bool isLogically
LastRunWrapped, LayoutObject* logicallyLastRunLayoutObject) | 305 void InlineFlowBox::determineSpacingForFlowBoxes(bool lastLine, bool isLogically
LastRunWrapped, LayoutObject* logicallyLastRunLayoutObject) |
| 306 { | 306 { |
| 307 // All boxes start off open. They will not apply any margins/border/padding
on | 307 // All boxes start off open. They will not apply any margins/border/padding
on |
| 308 // any side. | 308 // any side. |
| 309 bool includeLeftEdge = false; | 309 bool includeLeftEdge = false; |
| 310 bool includeRightEdge = false; | 310 bool includeRightEdge = false; |
| 311 | 311 |
| 312 // The root inline box never has borders/margins/padding. | 312 // The root inline box never has borders/margins/padding. |
| 313 if (parent()) { | 313 if (parent()) { |
| 314 bool ltr = lineLayoutItem().style()->isLeftToRightDirection(); | 314 bool ltr = getLineLayoutItem().style()->isLeftToRightDirection(); |
| 315 | 315 |
| 316 // Check to see if all initial lines are unconstructed. If so, then | 316 // Check to see if all initial lines are unconstructed. If so, then |
| 317 // we know the inline began on this line (unless we are a continuation). | 317 // we know the inline began on this line (unless we are a continuation). |
| 318 LineBoxList* lineBoxList = lineBoxes(); | 318 LineBoxList* lineBoxList = lineBoxes(); |
| 319 if (!lineBoxList->firstLineBox()->isConstructed() && !lineLayoutItem().i
sInlineElementContinuation()) { | 319 if (!lineBoxList->firstLineBox()->isConstructed() && !getLineLayoutItem(
).isInlineElementContinuation()) { |
| 320 if (lineLayoutItem().style()->boxDecorationBreak() == DCLONE) | 320 if (getLineLayoutItem().style()->boxDecorationBreak() == DCLONE) |
| 321 includeLeftEdge = includeRightEdge = true; | 321 includeLeftEdge = includeRightEdge = true; |
| 322 else if (ltr && lineBoxList->firstLineBox() == this) | 322 else if (ltr && lineBoxList->firstLineBox() == this) |
| 323 includeLeftEdge = true; | 323 includeLeftEdge = true; |
| 324 else if (!ltr && lineBoxList->lastLineBox() == this) | 324 else if (!ltr && lineBoxList->lastLineBox() == this) |
| 325 includeRightEdge = true; | 325 includeRightEdge = true; |
| 326 } | 326 } |
| 327 | 327 |
| 328 if (!lineBoxList->lastLineBox()->isConstructed()) { | 328 if (!lineBoxList->lastLineBox()->isConstructed()) { |
| 329 LineLayoutInline inlineFlow = LineLayoutInline(lineLayoutItem()); | 329 LineLayoutInline inlineFlow = LineLayoutInline(getLineLayoutItem()); |
| 330 LineLayoutItem logicallyLastRunLayoutItem = LineLayoutItem(logically
LastRunLayoutObject); | 330 LineLayoutItem logicallyLastRunLayoutItem = LineLayoutItem(logically
LastRunLayoutObject); |
| 331 bool isLastObjectOnLine = !isAncestorAndWithinBlock(lineLayoutItem()
, logicallyLastRunLayoutItem) || (isLastChildForLayoutObject(lineLayoutItem(), l
ogicallyLastRunLayoutItem) && !isLogicallyLastRunWrapped); | 331 bool isLastObjectOnLine = !isAncestorAndWithinBlock(getLineLayoutIte
m(), logicallyLastRunLayoutItem) || (isLastChildForLayoutObject(getLineLayoutIte
m(), logicallyLastRunLayoutItem) && !isLogicallyLastRunWrapped); |
| 332 | 332 |
| 333 // We include the border under these conditions: | 333 // We include the border under these conditions: |
| 334 // (1) The next line was not created, or it is constructed. We check
the previous line for rtl. | 334 // (1) The next line was not created, or it is constructed. We check
the previous line for rtl. |
| 335 // (2) The logicallyLastRun is not a descendant of this layout objec
t. | 335 // (2) The logicallyLastRun is not a descendant of this layout objec
t. |
| 336 // (3) The logicallyLastRun is a descendant of this layout object, b
ut it is the last child of this layout object and it does not wrap to the next l
ine. | 336 // (3) The logicallyLastRun is a descendant of this layout object, b
ut it is the last child of this layout object and it does not wrap to the next l
ine. |
| 337 // (4) The decoration break is set to clone therefore there will be
borders on every sides. | 337 // (4) The decoration break is set to clone therefore there will be
borders on every sides. |
| 338 if (lineLayoutItem().style()->boxDecorationBreak() == DCLONE) { | 338 if (getLineLayoutItem().style()->boxDecorationBreak() == DCLONE) { |
| 339 includeLeftEdge = includeRightEdge = true; | 339 includeLeftEdge = includeRightEdge = true; |
| 340 } else if (ltr) { | 340 } else if (ltr) { |
| 341 if (!nextLineBox() | 341 if (!nextLineBox() |
| 342 && ((lastLine || isLastObjectOnLine) && !inlineFlow.continua
tion())) | 342 && ((lastLine || isLastObjectOnLine) && !inlineFlow.continua
tion())) |
| 343 includeRightEdge = true; | 343 includeRightEdge = true; |
| 344 } else { | 344 } else { |
| 345 if ((!prevLineBox() || prevLineBox()->isConstructed()) | 345 if ((!prevLineBox() || prevLineBox()->isConstructed()) |
| 346 && ((lastLine || isLastObjectOnLine) && !inlineFlow.continua
tion())) | 346 && ((lastLine || isLastObjectOnLine) && !inlineFlow.continua
tion())) |
| 347 includeLeftEdge = true; | 347 includeLeftEdge = true; |
| 348 } | 348 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 376 logicalLeft += borderLogicalRight() + paddingLogicalRight(); | 376 logicalLeft += borderLogicalRight() + paddingLogicalRight(); |
| 377 endPlacingBoxRangesInInlineDirection(startLogicalLeft, logicalLeft, minLogic
alLeft, maxLogicalRight); | 377 endPlacingBoxRangesInInlineDirection(startLogicalLeft, logicalLeft, minLogic
alLeft, maxLogicalRight); |
| 378 return logicalLeft; | 378 return logicalLeft; |
| 379 } | 379 } |
| 380 | 380 |
| 381 // TODO(wkorman): needsWordSpacing may not need to be a reference in the below.
Seek a test case. | 381 // TODO(wkorman): needsWordSpacing may not need to be a reference in the below.
Seek a test case. |
| 382 void InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inline
Box* lastChild, | 382 void InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inline
Box* lastChild, |
| 383 LayoutUnit& logicalLeft, LayoutUnit& minLogicalLeft, LayoutUnit& maxLogicalR
ight, bool& needsWordSpacing) | 383 LayoutUnit& logicalLeft, LayoutUnit& minLogicalLeft, LayoutUnit& maxLogicalR
ight, bool& needsWordSpacing) |
| 384 { | 384 { |
| 385 for (InlineBox* curr = firstChild; curr && curr != lastChild; curr = curr->n
extOnLine()) { | 385 for (InlineBox* curr = firstChild; curr && curr != lastChild; curr = curr->n
extOnLine()) { |
| 386 if (curr->lineLayoutItem().isText()) { | 386 if (curr->getLineLayoutItem().isText()) { |
| 387 InlineTextBox* text = toInlineTextBox(curr); | 387 InlineTextBox* text = toInlineTextBox(curr); |
| 388 LineLayoutText rt = text->lineLayoutItem(); | 388 LineLayoutText rt = text->getLineLayoutItem(); |
| 389 LayoutUnit space; | 389 LayoutUnit space; |
| 390 if (rt.textLength()) { | 390 if (rt.textLength()) { |
| 391 if (needsWordSpacing && isSpaceOrNewline(rt.characterAt(text->st
art()))) | 391 if (needsWordSpacing && isSpaceOrNewline(rt.characterAt(text->st
art()))) |
| 392 space = LayoutUnit(rt.style(isFirstLineStyle())->font().font
Description().wordSpacing()); | 392 space = LayoutUnit(rt.style(isFirstLineStyle())->font().font
Description().wordSpacing()); |
| 393 needsWordSpacing = !isSpaceOrNewline(rt.characterAt(text->end())
); | 393 needsWordSpacing = !isSpaceOrNewline(rt.characterAt(text->end())
); |
| 394 } | 394 } |
| 395 if (isLeftToRightDirection()) { | 395 if (isLeftToRightDirection()) { |
| 396 logicalLeft += space; | 396 logicalLeft += space; |
| 397 text->setLogicalLeft(logicalLeft); | 397 text->setLogicalLeft(logicalLeft); |
| 398 } else { | 398 } else { |
| 399 text->setLogicalLeft(logicalLeft); | 399 text->setLogicalLeft(logicalLeft); |
| 400 logicalLeft += space; | 400 logicalLeft += space; |
| 401 } | 401 } |
| 402 if (knownToHaveNoOverflow()) | 402 if (knownToHaveNoOverflow()) |
| 403 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); | 403 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); |
| 404 logicalLeft += text->logicalWidth(); | 404 logicalLeft += text->logicalWidth(); |
| 405 if (knownToHaveNoOverflow()) | 405 if (knownToHaveNoOverflow()) |
| 406 maxLogicalRight = std::max(logicalLeft, maxLogicalRight); | 406 maxLogicalRight = std::max(logicalLeft, maxLogicalRight); |
| 407 } else { | 407 } else { |
| 408 if (curr->lineLayoutItem().isOutOfFlowPositioned()) { | 408 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) { |
| 409 if (curr->lineLayoutItem().parent().style()->isLeftToRightDirect
ion()) { | 409 if (curr->getLineLayoutItem().parent().style()->isLeftToRightDir
ection()) { |
| 410 curr->setLogicalLeft(logicalLeft); | 410 curr->setLogicalLeft(logicalLeft); |
| 411 } else { | 411 } else { |
| 412 // Our offset that we cache needs to be from the edge of the
right border box and | 412 // Our offset that we cache needs to be from the edge of the
right border box and |
| 413 // not the left border box. We have to subtract |x| from th
e width of the block | 413 // not the left border box. We have to subtract |x| from th
e width of the block |
| 414 // (which can be obtained from the root line box). | 414 // (which can be obtained from the root line box). |
| 415 curr->setLogicalLeft(root().block().logicalWidth() - logical
Left); | 415 curr->setLogicalLeft(root().block().logicalWidth() - logical
Left); |
| 416 } | 416 } |
| 417 continue; // The positioned object has no effect on the width. | 417 continue; // The positioned object has no effect on the width. |
| 418 } | 418 } |
| 419 if (curr->lineLayoutItem().isLayoutInline()) { | 419 if (curr->getLineLayoutItem().isLayoutInline()) { |
| 420 InlineFlowBox* flow = toInlineFlowBox(curr); | 420 InlineFlowBox* flow = toInlineFlowBox(curr); |
| 421 logicalLeft += flow->marginLogicalLeft(); | 421 logicalLeft += flow->marginLogicalLeft(); |
| 422 if (knownToHaveNoOverflow()) | 422 if (knownToHaveNoOverflow()) |
| 423 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); | 423 minLogicalLeft = std::min(logicalLeft, minLogicalLeft); |
| 424 logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, nee
dsWordSpacing); | 424 logicalLeft = flow->placeBoxesInInlineDirection(logicalLeft, nee
dsWordSpacing); |
| 425 if (knownToHaveNoOverflow()) | 425 if (knownToHaveNoOverflow()) |
| 426 maxLogicalRight = std::max(logicalLeft, maxLogicalRight); | 426 maxLogicalRight = std::max(logicalLeft, maxLogicalRight); |
| 427 logicalLeft += flow->marginLogicalRight(); | 427 logicalLeft += flow->marginLogicalRight(); |
| 428 } else if (!curr->lineLayoutItem().isListMarker() || LineLayoutListM
arker(curr->lineLayoutItem()).isInside()) { | 428 } else if (!curr->getLineLayoutItem().isListMarker() || LineLayoutLi
stMarker(curr->getLineLayoutItem()).isInside()) { |
| 429 // The box can have a different writing-mode than the overall li
ne, so this is a bit complicated. | 429 // The box can have a different writing-mode than the overall li
ne, so this is a bit complicated. |
| 430 // Just get all the physical margin and overflow values by hand
based off |isHorizontal|. | 430 // Just get all the physical margin and overflow values by hand
based off |isHorizontal|. |
| 431 LineLayoutBoxModel box = curr->boxModelObject(); | 431 LineLayoutBoxModel box = curr->boxModelObject(); |
| 432 LayoutUnit logicalLeftMargin; | 432 LayoutUnit logicalLeftMargin; |
| 433 LayoutUnit logicalRightMargin; | 433 LayoutUnit logicalRightMargin; |
| 434 if (isHorizontal()) { | 434 if (isHorizontal()) { |
| 435 logicalLeftMargin = box.marginLeft(); | 435 logicalLeftMargin = box.marginLeft(); |
| 436 logicalRightMargin = box.marginRight(); | 436 logicalRightMargin = box.marginRight(); |
| 437 } else { | 437 } else { |
| 438 logicalLeftMargin = box.marginTop(); | 438 logicalLeftMargin = box.marginTop(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 451 needsWordSpacing = true; | 451 needsWordSpacing = true; |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 | 456 |
| 457 FontBaseline InlineFlowBox::dominantBaseline() const | 457 FontBaseline InlineFlowBox::dominantBaseline() const |
| 458 { | 458 { |
| 459 // Use "central" (Ideographic) baseline if writing-mode is vertical-* and te
xt-orientation is not sideways-*. | 459 // Use "central" (Ideographic) baseline if writing-mode is vertical-* and te
xt-orientation is not sideways-*. |
| 460 // http://dev.w3.org/csswg/css-writing-modes-3/#text-baselines | 460 // http://dev.w3.org/csswg/css-writing-modes-3/#text-baselines |
| 461 if (!isHorizontal() && lineLayoutItem().style(isFirstLineStyle())->fontDescr
iption().isVerticalAnyUpright()) | 461 if (!isHorizontal() && getLineLayoutItem().style(isFirstLineStyle())->fontDe
scription().isVerticalAnyUpright()) |
| 462 return IdeographicBaseline; | 462 return IdeographicBaseline; |
| 463 return AlphabeticBaseline; | 463 return AlphabeticBaseline; |
| 464 } | 464 } |
| 465 | 465 |
| 466 void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i
nt maxPositionTop, int maxPositionBottom) | 466 void InlineFlowBox::adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, i
nt maxPositionTop, int maxPositionBottom) |
| 467 { | 467 { |
| 468 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 468 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 469 // The computed lineheight needs to be extended for the | 469 // The computed lineheight needs to be extended for the |
| 470 // positioned elements | 470 // positioned elements |
| 471 if (curr->lineLayoutItem().isOutOfFlowPositioned()) | 471 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| 472 continue; // Positioned placeholders don't affect calculations. | 472 continue; // Positioned placeholders don't affect calculations. |
| 473 if (curr->verticalAlign() == TOP || curr->verticalAlign() == BOTTOM) { | 473 if (curr->verticalAlign() == TOP || curr->verticalAlign() == BOTTOM) { |
| 474 int lineHeight = curr->lineHeight(); | 474 int lineHeight = curr->lineHeight(); |
| 475 if (curr->verticalAlign() == TOP) { | 475 if (curr->verticalAlign() == TOP) { |
| 476 if (maxAscent + maxDescent < lineHeight) | 476 if (maxAscent + maxDescent < lineHeight) |
| 477 maxDescent = lineHeight - maxAscent; | 477 maxDescent = lineHeight - maxAscent; |
| 478 } else { | 478 } else { |
| 479 if (maxAscent + maxDescent < lineHeight) | 479 if (maxAscent + maxDescent < lineHeight) |
| 480 maxAscent = lineHeight - maxDescent; | 480 maxAscent = lineHeight - maxDescent; |
| 481 } | 481 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 maxDescent = descent; | 523 maxDescent = descent; |
| 524 setMaxDescent = true; | 524 setMaxDescent = true; |
| 525 } | 525 } |
| 526 } | 526 } |
| 527 } | 527 } |
| 528 | 528 |
| 529 if (!checkChildren) | 529 if (!checkChildren) |
| 530 return; | 530 return; |
| 531 | 531 |
| 532 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 532 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 533 if (curr->lineLayoutItem().isOutOfFlowPositioned()) | 533 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| 534 continue; // Positioned placeholders don't affect calculations. | 534 continue; // Positioned placeholders don't affect calculations. |
| 535 | 535 |
| 536 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; | 536 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; |
| 537 | 537 |
| 538 bool affectsAscent = false; | 538 bool affectsAscent = false; |
| 539 bool affectsDescent = false; | 539 bool affectsDescent = false; |
| 540 | 540 |
| 541 // The verticalPositionForBox function returns the distance between the
child box's baseline | 541 // The verticalPositionForBox function returns the distance between the
child box's baseline |
| 542 // and the root box's baseline. The value is negative if the child box'
s baseline is above the | 542 // and the root box's baseline. The value is negative if the child box'
s baseline is above the |
| 543 // root box's baseline, and it is positive if the child box's baseline i
s below the root box's baseline. | 543 // root box's baseline, and it is positive if the child box's baseline i
s below the root box's baseline. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 576 |
| 577 if (inlineFlowBox) | 577 if (inlineFlowBox) |
| 578 inlineFlowBox->computeLogicalBoxHeights(rootBox, maxPositionTop, max
PositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode
, textBoxDataMap, baselineType, verticalPositionCache); | 578 inlineFlowBox->computeLogicalBoxHeights(rootBox, maxPositionTop, max
PositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode
, textBoxDataMap, baselineType, verticalPositionCache); |
| 579 } | 579 } |
| 580 } | 580 } |
| 581 | 581 |
| 582 void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHei
ght, int maxAscent, bool noQuirksMode, LayoutUnit& lineTop, LayoutUnit& lineBott
om, LayoutUnit& selectionBottom, bool& setLineTop, LayoutUnit& lineTopIncludingM
argins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool
& hasAnnotationsAfter, FontBaseline baselineType) | 582 void InlineFlowBox::placeBoxesInBlockDirection(LayoutUnit top, LayoutUnit maxHei
ght, int maxAscent, bool noQuirksMode, LayoutUnit& lineTop, LayoutUnit& lineBott
om, LayoutUnit& selectionBottom, bool& setLineTop, LayoutUnit& lineTopIncludingM
argins, LayoutUnit& lineBottomIncludingMargins, bool& hasAnnotationsBefore, bool
& hasAnnotationsAfter, FontBaseline baselineType) |
| 583 { | 583 { |
| 584 bool isRootBox = isRootInlineBox(); | 584 bool isRootBox = isRootInlineBox(); |
| 585 if (isRootBox) { | 585 if (isRootBox) { |
| 586 const FontMetrics& fontMetrics = lineLayoutItem().style(isFirstLineStyle
())->fontMetrics(); | 586 const FontMetrics& fontMetrics = getLineLayoutItem().style(isFirstLineSt
yle())->fontMetrics(); |
| 587 // RootInlineBoxes are always placed at pixel boundaries in their logica
l y direction. Not doing | 587 // RootInlineBoxes are always placed at pixel boundaries in their logica
l y direction. Not doing |
| 588 // so results in incorrect layout of text decorations, most notably unde
rlines. | 588 // so results in incorrect layout of text decorations, most notably unde
rlines. |
| 589 setLogicalTop(LayoutUnit(roundToInt(top + maxAscent - fontMetrics.ascent
(baselineType)))); | 589 setLogicalTop(LayoutUnit(roundToInt(top + maxAscent - fontMetrics.ascent
(baselineType)))); |
| 590 } | 590 } |
| 591 | 591 |
| 592 LayoutUnit adjustmentForChildrenWithSameLineHeightAndBaseline; | 592 LayoutUnit adjustmentForChildrenWithSameLineHeightAndBaseline; |
| 593 if (descendantsHaveSameLineHeightAndBaseline()) { | 593 if (descendantsHaveSameLineHeightAndBaseline()) { |
| 594 adjustmentForChildrenWithSameLineHeightAndBaseline = logicalTop(); | 594 adjustmentForChildrenWithSameLineHeightAndBaseline = logicalTop(); |
| 595 if (parent()) | 595 if (parent()) |
| 596 adjustmentForChildrenWithSameLineHeightAndBaseline += boxModelObject
().borderAndPaddingOver(); | 596 adjustmentForChildrenWithSameLineHeightAndBaseline += boxModelObject
().borderAndPaddingOver(); |
| 597 } | 597 } |
| 598 | 598 |
| 599 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 599 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 600 if (curr->lineLayoutItem().isOutOfFlowPositioned()) | 600 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| 601 continue; // Positioned placeholders don't affect calculations. | 601 continue; // Positioned placeholders don't affect calculations. |
| 602 | 602 |
| 603 if (descendantsHaveSameLineHeightAndBaseline()) { | 603 if (descendantsHaveSameLineHeightAndBaseline()) { |
| 604 curr->moveInBlockDirection(adjustmentForChildrenWithSameLineHeightAn
dBaseline); | 604 curr->moveInBlockDirection(adjustmentForChildrenWithSameLineHeightAn
dBaseline); |
| 605 continue; | 605 continue; |
| 606 } | 606 } |
| 607 | 607 |
| 608 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; | 608 InlineFlowBox* inlineFlowBox = curr->isInlineFlowBox() ? toInlineFlowBox
(curr) : nullptr; |
| 609 bool childAffectsTopBottomPos = true; | 609 bool childAffectsTopBottomPos = true; |
| 610 if (curr->verticalAlign() == TOP) { | 610 if (curr->verticalAlign() == TOP) { |
| 611 curr->setLogicalTop(top); | 611 curr->setLogicalTop(top); |
| 612 } else if (curr->verticalAlign() == BOTTOM) { | 612 } else if (curr->verticalAlign() == BOTTOM) { |
| 613 curr->setLogicalTop((top + maxHeight - curr->lineHeight())); | 613 curr->setLogicalTop((top + maxHeight - curr->lineHeight())); |
| 614 } else { | 614 } else { |
| 615 if (!noQuirksMode && inlineFlowBox && !inlineFlowBox->hasTextChildre
n() && !curr->boxModelObject().hasInlineDirectionBordersOrPadding() | 615 if (!noQuirksMode && inlineFlowBox && !inlineFlowBox->hasTextChildre
n() && !curr->boxModelObject().hasInlineDirectionBordersOrPadding() |
| 616 && !(inlineFlowBox->descendantsHaveSameLineHeightAndBaseline() &
& inlineFlowBox->hasTextDescendants())) | 616 && !(inlineFlowBox->descendantsHaveSameLineHeightAndBaseline() &
& inlineFlowBox->hasTextDescendants())) |
| 617 childAffectsTopBottomPos = false; | 617 childAffectsTopBottomPos = false; |
| 618 int posAdjust = maxAscent - curr->baselinePosition(baselineType); | 618 int posAdjust = maxAscent - curr->baselinePosition(baselineType); |
| 619 curr->setLogicalTop(curr->logicalTop() + top + posAdjust); | 619 curr->setLogicalTop(curr->logicalTop() + top + posAdjust); |
| 620 } | 620 } |
| 621 | 621 |
| 622 LayoutUnit newLogicalTop = curr->logicalTop(); | 622 LayoutUnit newLogicalTop = curr->logicalTop(); |
| 623 LayoutUnit newLogicalTopIncludingMargins = newLogicalTop; | 623 LayoutUnit newLogicalTopIncludingMargins = newLogicalTop; |
| 624 LayoutUnit boxHeight = curr->logicalHeight(); | 624 LayoutUnit boxHeight = curr->logicalHeight(); |
| 625 LayoutUnit boxHeightIncludingMargins = boxHeight; | 625 LayoutUnit boxHeightIncludingMargins = boxHeight; |
| 626 LayoutUnit borderPaddingHeight; | 626 LayoutUnit borderPaddingHeight; |
| 627 if (curr->isText() || curr->isInlineFlowBox()) { | 627 if (curr->isText() || curr->isInlineFlowBox()) { |
| 628 const FontMetrics& fontMetrics = curr->lineLayoutItem().style(isFirs
tLineStyle())->fontMetrics(); | 628 const FontMetrics& fontMetrics = curr->getLineLayoutItem().style(isF
irstLineStyle())->fontMetrics(); |
| 629 newLogicalTop += curr->baselinePosition(baselineType) - fontMetrics.
ascent(baselineType); | 629 newLogicalTop += curr->baselinePosition(baselineType) - fontMetrics.
ascent(baselineType); |
| 630 if (curr->isInlineFlowBox()) { | 630 if (curr->isInlineFlowBox()) { |
| 631 LineLayoutBoxModel boxObject = LineLayoutBoxModel(curr->lineLayo
utItem()); | 631 LineLayoutBoxModel boxObject = LineLayoutBoxModel(curr->getLineL
ayoutItem()); |
| 632 newLogicalTop -= boxObject.borderAndPaddingOver(); | 632 newLogicalTop -= boxObject.borderAndPaddingOver(); |
| 633 borderPaddingHeight = boxObject.borderAndPaddingLogicalHeight(); | 633 borderPaddingHeight = boxObject.borderAndPaddingLogicalHeight(); |
| 634 } | 634 } |
| 635 newLogicalTopIncludingMargins = newLogicalTop; | 635 newLogicalTopIncludingMargins = newLogicalTop; |
| 636 } else if (!curr->lineLayoutItem().isBR()) { | 636 } else if (!curr->getLineLayoutItem().isBR()) { |
| 637 LineLayoutBox box = LineLayoutBox(curr->lineLayoutItem()); | 637 LineLayoutBox box = LineLayoutBox(curr->getLineLayoutItem()); |
| 638 newLogicalTopIncludingMargins = newLogicalTop; | 638 newLogicalTopIncludingMargins = newLogicalTop; |
| 639 // TODO(kojii): isHorizontal() does not match to m_layoutObject.isHo
rizontalWritingMode(). crbug.com/552954 | 639 // TODO(kojii): isHorizontal() does not match to m_layoutObject.isHo
rizontalWritingMode(). crbug.com/552954 |
| 640 // ASSERT(curr->isHorizontal() == curr->lineLayoutItem().style()->is
HorizontalWritingMode()); | 640 // ASSERT(curr->isHorizontal() == curr->getLineLayoutItem().style()-
>isHorizontalWritingMode()); |
| 641 LayoutUnit overSideMargin = curr->isHorizontal() ? box.marginTop() :
box.marginRight(); | 641 LayoutUnit overSideMargin = curr->isHorizontal() ? box.marginTop() :
box.marginRight(); |
| 642 LayoutUnit underSideMargin = curr->isHorizontal() ? box.marginBottom
() : box.marginLeft(); | 642 LayoutUnit underSideMargin = curr->isHorizontal() ? box.marginBottom
() : box.marginLeft(); |
| 643 newLogicalTop += overSideMargin; | 643 newLogicalTop += overSideMargin; |
| 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->lineLayoutItem().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 (lineLayoutItem().style()->isFlippedLinesWritingMode() == (cu
rr->lineLayoutItem().style()->rubyPosition() == RubyPositionAfter)) | 654 if (getLineLayoutItem().style()->isFlippedLinesWritingMode() ==
(curr->getLineLayoutItem().style()->rubyPosition() == RubyPositionAfter)) |
| 655 hasAnnotationsBefore = true; | 655 hasAnnotationsBefore = true; |
| 656 else | 656 else |
| 657 hasAnnotationsAfter = true; | 657 hasAnnotationsAfter = true; |
| 658 | 658 |
| 659 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->lineLayoutIt
em()); | 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 += !lineLayoutItem().style()->isFlippedLinesWr
itingMode() ? topRubyBaseLeading : bottomRubyBaseLeading; | 663 newLogicalTop += !getLineLayoutItem().style()->isFlippedLine
sWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading; |
| 664 boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading); | 664 boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading); |
| 665 } | 665 } |
| 666 } | 666 } |
| 667 if (curr->isInlineTextBox()) { | 667 if (curr->isInlineTextBox()) { |
| 668 TextEmphasisPosition emphasisMarkPosition; | 668 TextEmphasisPosition emphasisMarkPosition; |
| 669 if (toInlineTextBox(curr)->getEmphasisMarkPosition(curr->lineLay
outItem().styleRef(isFirstLineStyle()), emphasisMarkPosition)) { | 669 if (toInlineTextBox(curr)->getEmphasisMarkPosition(curr->getLine
LayoutItem().styleRef(isFirstLineStyle()), emphasisMarkPosition)) { |
| 670 bool emphasisMarkIsOver = emphasisMarkPosition == TextEmphas
isPositionOver; | 670 bool emphasisMarkIsOver = emphasisMarkPosition == TextEmphas
isPositionOver; |
| 671 if (emphasisMarkIsOver != curr->lineLayoutItem().style(isFir
stLineStyle())->isFlippedLinesWritingMode()) | 671 if (emphasisMarkIsOver != curr->getLineLayoutItem().style(is
FirstLineStyle())->isFlippedLinesWritingMode()) |
| 672 hasAnnotationsBefore = true; | 672 hasAnnotationsBefore = true; |
| 673 else | 673 else |
| 674 hasAnnotationsAfter = true; | 674 hasAnnotationsAfter = true; |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 | 677 |
| 678 if (!setLineTop) { | 678 if (!setLineTop) { |
| 679 setLineTop = true; | 679 setLineTop = true; |
| 680 lineTop = newLogicalTop; | 680 lineTop = newLogicalTop; |
| 681 lineTopIncludingMargins = std::min(lineTop, newLogicalTopIncludi
ngMargins); | 681 lineTopIncludingMargins = std::min(lineTop, newLogicalTopIncludi
ngMargins); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 702 lineTopIncludingMargins = lineTop; | 702 lineTopIncludingMargins = lineTop; |
| 703 } else { | 703 } else { |
| 704 lineTop = std::min(lineTop, LayoutUnit(pixelSnappedLogicalTop())
); | 704 lineTop = std::min(lineTop, LayoutUnit(pixelSnappedLogicalTop())
); |
| 705 lineTopIncludingMargins = std::min(lineTop, lineTopIncludingMarg
ins); | 705 lineTopIncludingMargins = std::min(lineTop, lineTopIncludingMarg
ins); |
| 706 } | 706 } |
| 707 selectionBottom = std::max(selectionBottom, LayoutUnit(pixelSnappedL
ogicalBottom())); | 707 selectionBottom = std::max(selectionBottom, LayoutUnit(pixelSnappedL
ogicalBottom())); |
| 708 lineBottom = std::max(lineBottom, LayoutUnit(pixelSnappedLogicalBott
om())); | 708 lineBottom = std::max(lineBottom, LayoutUnit(pixelSnappedLogicalBott
om())); |
| 709 lineBottomIncludingMargins = std::max(lineBottom, lineBottomIncludin
gMargins); | 709 lineBottomIncludingMargins = std::max(lineBottom, lineBottomIncludin
gMargins); |
| 710 } | 710 } |
| 711 | 711 |
| 712 if (lineLayoutItem().style()->isFlippedLinesWritingMode()) | 712 if (getLineLayoutItem().style()->isFlippedLinesWritingMode()) |
| 713 flipLinesInBlockDirection(lineTopIncludingMargins, lineBottomIncludi
ngMargins); | 713 flipLinesInBlockDirection(lineTopIncludingMargins, lineBottomIncludi
ngMargins); |
| 714 } | 714 } |
| 715 } | 715 } |
| 716 | 716 |
| 717 void InlineFlowBox::computeMaxLogicalTop(LayoutUnit& maxLogicalTop) const | 717 void InlineFlowBox::computeMaxLogicalTop(LayoutUnit& maxLogicalTop) const |
| 718 { | 718 { |
| 719 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 719 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 720 if (curr->lineLayoutItem().isOutOfFlowPositioned()) | 720 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| 721 continue; // Positioned placeholders don't affect calculations. | 721 continue; // Positioned placeholders don't affect calculations. |
| 722 | 722 |
| 723 if (descendantsHaveSameLineHeightAndBaseline()) | 723 if (descendantsHaveSameLineHeightAndBaseline()) |
| 724 continue; | 724 continue; |
| 725 | 725 |
| 726 maxLogicalTop = std::max<LayoutUnit>(maxLogicalTop, curr->y()); | 726 maxLogicalTop = std::max<LayoutUnit>(maxLogicalTop, curr->y()); |
| 727 LayoutUnit localMaxLogicalTop; | 727 LayoutUnit localMaxLogicalTop; |
| 728 if (curr->isInlineFlowBox()) | 728 if (curr->isInlineFlowBox()) |
| 729 toInlineFlowBox(curr)->computeMaxLogicalTop(localMaxLogicalTop); | 729 toInlineFlowBox(curr)->computeMaxLogicalTop(localMaxLogicalTop); |
| 730 maxLogicalTop = std::max<LayoutUnit>(maxLogicalTop, localMaxLogicalTop); | 730 maxLogicalTop = std::max<LayoutUnit>(maxLogicalTop, localMaxLogicalTop); |
| 731 } | 731 } |
| 732 } | 732 } |
| 733 | 733 |
| 734 void InlineFlowBox::flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lin
eBottom) | 734 void InlineFlowBox::flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lin
eBottom) |
| 735 { | 735 { |
| 736 // Flip the box on the line such that the top is now relative to the lineBot
tom instead of the lineTop. | 736 // Flip the box on the line such that the top is now relative to the lineBot
tom instead of the lineTop. |
| 737 setLogicalTop(lineBottom - (logicalTop() - lineTop) - logicalHeight()); | 737 setLogicalTop(lineBottom - (logicalTop() - lineTop) - logicalHeight()); |
| 738 | 738 |
| 739 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 739 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 740 if (curr->lineLayoutItem().isOutOfFlowPositioned()) | 740 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| 741 continue; // Positioned placeholders aren't affected here. | 741 continue; // Positioned placeholders aren't affected here. |
| 742 | 742 |
| 743 if (curr->isInlineFlowBox()) | 743 if (curr->isInlineFlowBox()) |
| 744 toInlineFlowBox(curr)->flipLinesInBlockDirection(lineTop, lineBottom
); | 744 toInlineFlowBox(curr)->flipLinesInBlockDirection(lineTop, lineBottom
); |
| 745 else | 745 else |
| 746 curr->setLogicalTop(lineBottom - (curr->logicalTop() - lineTop) - cu
rr->logicalHeight()); | 746 curr->setLogicalTop(lineBottom - (curr->logicalTop() - lineTop) - cu
rr->logicalHeight()); |
| 747 } | 747 } |
| 748 } | 748 } |
| 749 | 749 |
| 750 inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO
verflow) | 750 inline void InlineFlowBox::addBoxShadowVisualOverflow(LayoutRect& logicalVisualO
verflow) |
| 751 { | 751 { |
| 752 const ComputedStyle& style = lineLayoutItem().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 == lineLayoutItem().style())
) | 756 if (!parent() && (!isFirstLineStyle() || &style == getLineLayoutItem().style
())) |
| 757 return; | 757 return; |
| 758 | 758 |
| 759 WritingMode writingMode = style.writingMode(); | 759 WritingMode writingMode = style.writingMode(); |
| 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 = lineLayoutItem().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 == lineLayoutItem().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.writingMode()); |
| 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 } |
| 799 | 799 |
| 800 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve
rflow) | 800 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve
rflow) |
| 801 { | 801 { |
| 802 // Outline on root line boxes is applied to the block and not to the lines. | 802 // Outline on root line boxes is applied to the block and not to the lines. |
| 803 if (!parent()) | 803 if (!parent()) |
| 804 return; | 804 return; |
| 805 | 805 |
| 806 const ComputedStyle& style = lineLayoutItem().styleRef(isFirstLineStyle()); | 806 const ComputedStyle& style = getLineLayoutItem().styleRef(isFirstLineStyle()
); |
| 807 if (!style.hasOutline()) | 807 if (!style.hasOutline()) |
| 808 return; | 808 return; |
| 809 | 809 |
| 810 logicalVisualOverflow.inflate(style.outlineOutsetExtent()); | 810 logicalVisualOverflow.inflate(style.outlineOutsetExtent()); |
| 811 } | 811 } |
| 812 | 812 |
| 813 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp
hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) | 813 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp
hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) |
| 814 { | 814 { |
| 815 if (textBox->knownToHaveNoOverflow()) | 815 if (textBox->knownToHaveNoOverflow()) |
| 816 return; | 816 return; |
| 817 | 817 |
| 818 const ComputedStyle& style = textBox->lineLayoutItem().styleRef(isFirstLineS
tyle()); | 818 const ComputedStyle& style = textBox->getLineLayoutItem().styleRef(isFirstLi
neStyle()); |
| 819 | 819 |
| 820 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox)
; | 820 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox)
; |
| 821 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? nullptr : &it->v
alue.second; | 821 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? nullptr : &it->v
alue.second; |
| 822 bool isFlippedLine = style.isFlippedLinesWritingMode(); | 822 bool isFlippedLine = style.isFlippedLinesWritingMode(); |
| 823 | 823 |
| 824 float topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom
: glyphOverflow->top) : 0; | 824 float topGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->bottom
: glyphOverflow->top) : 0; |
| 825 float bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top
: glyphOverflow->bottom) : 0; | 825 float bottomGlyphEdge = glyphOverflow ? (isFlippedLine ? glyphOverflow->top
: glyphOverflow->bottom) : 0; |
| 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 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 LayoutUnit logicalLeftVisualOverflow = std::min(LayoutUnit(enclosingLogicalL
eftWithOverflow), logicalVisualOverflow.x()); | 871 LayoutUnit logicalLeftVisualOverflow = std::min(LayoutUnit(enclosingLogicalL
eftWithOverflow), logicalVisualOverflow.x()); |
| 872 LayoutUnit logicalRightVisualOverflow = std::max(LayoutUnit(enclosingLogical
RightWithOverflow), logicalVisualOverflow.maxX()); | 872 LayoutUnit logicalRightVisualOverflow = std::max(LayoutUnit(enclosingLogical
RightWithOverflow), logicalVisualOverflow.maxX()); |
| 873 | 873 |
| 874 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu
alOverflow, logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBotto
mVisualOverflow - logicalTopVisualOverflow); | 874 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu
alOverflow, logicalRightVisualOverflow - logicalLeftVisualOverflow, logicalBotto
mVisualOverflow - logicalTopVisualOverflow); |
| 875 | 875 |
| 876 textBox->setLogicalOverflowRect(logicalVisualOverflow); | 876 textBox->setLogicalOverflowRect(logicalVisualOverflow); |
| 877 } | 877 } |
| 878 | 878 |
| 879 inline void InlineFlowBox::addReplacedChildOverflow(const InlineBox* inlineBox,
LayoutRect& logicalLayoutOverflow, LayoutRect& logicalVisualOverflow) | 879 inline void InlineFlowBox::addReplacedChildOverflow(const InlineBox* inlineBox,
LayoutRect& logicalLayoutOverflow, LayoutRect& logicalVisualOverflow) |
| 880 { | 880 { |
| 881 LineLayoutBox box = LineLayoutBox(inlineBox->lineLayoutItem()); | 881 LineLayoutBox box = LineLayoutBox(inlineBox->getLineLayoutItem()); |
| 882 | 882 |
| 883 // Visual overflow only propagates if the box doesn't have a self-painting l
ayer. This rectangle does not include | 883 // Visual overflow only propagates if the box doesn't have a self-painting l
ayer. This rectangle does not include |
| 884 // transforms or relative positioning (since those objects always have self-
painting layers), but it does need to be adjusted | 884 // transforms or relative positioning (since those objects always have self-
painting layers), but it does need to be adjusted |
| 885 // for writing-mode differences. | 885 // for writing-mode differences. |
| 886 if (!box.hasSelfPaintingLayer()) { | 886 if (!box.hasSelfPaintingLayer()) { |
| 887 LayoutRect childLogicalVisualOverflow = box.logicalVisualOverflowRectFor
Propagation(lineLayoutItem().styleRef()); | 887 LayoutRect childLogicalVisualOverflow = box.logicalVisualOverflowRectFor
Propagation(getLineLayoutItem().styleRef()); |
| 888 childLogicalVisualOverflow.move(inlineBox->logicalLeft(), inlineBox->log
icalTop()); | 888 childLogicalVisualOverflow.move(inlineBox->logicalLeft(), inlineBox->log
icalTop()); |
| 889 logicalVisualOverflow.unite(childLogicalVisualOverflow); | 889 logicalVisualOverflow.unite(childLogicalVisualOverflow); |
| 890 } | 890 } |
| 891 | 891 |
| 892 // Layout overflow internal to the child box only propagates if the child bo
x doesn't have overflow clip set. | 892 // Layout overflow internal to the child box only propagates if the child bo
x doesn't have overflow clip set. |
| 893 // Otherwise the child border box propagates as layout overflow. This recta
ngle must include transforms and relative positioning | 893 // Otherwise the child border box propagates as layout overflow. This recta
ngle must include transforms and relative positioning |
| 894 // and be adjusted for writing-mode differences. | 894 // and be adjusted for writing-mode differences. |
| 895 LayoutRect childLogicalLayoutOverflow = box.logicalLayoutOverflowRectForProp
agation(lineLayoutItem().styleRef()); | 895 LayoutRect childLogicalLayoutOverflow = box.logicalLayoutOverflowRectForProp
agation(getLineLayoutItem().styleRef()); |
| 896 childLogicalLayoutOverflow.move(inlineBox->logicalLeft(), inlineBox->logical
Top()); | 896 childLogicalLayoutOverflow.move(inlineBox->logicalLeft(), inlineBox->logical
Top()); |
| 897 logicalLayoutOverflow.unite(childLogicalLayoutOverflow); | 897 logicalLayoutOverflow.unite(childLogicalLayoutOverflow); |
| 898 } | 898 } |
| 899 | 899 |
| 900 void InlineFlowBox::computeOverflow(LayoutUnit lineTop, LayoutUnit lineBottom, G
lyphOverflowAndFallbackFontsMap& textBoxDataMap) | 900 void InlineFlowBox::computeOverflow(LayoutUnit lineTop, LayoutUnit lineBottom, G
lyphOverflowAndFallbackFontsMap& textBoxDataMap) |
| 901 { | 901 { |
| 902 // If we know we have no overflow, we can just bail. | 902 // If we know we have no overflow, we can just bail. |
| 903 if (knownToHaveNoOverflow()) { | 903 if (knownToHaveNoOverflow()) { |
| 904 ASSERT(!m_overflow); | 904 ASSERT(!m_overflow); |
| 905 return; | 905 return; |
| 906 } | 906 } |
| 907 | 907 |
| 908 if (m_overflow) | 908 if (m_overflow) |
| 909 m_overflow.clear(); | 909 m_overflow.clear(); |
| 910 | 910 |
| 911 // Visual overflow just includes overflow for stuff we need to issues paint
invalidations for ourselves. Self-painting layers are ignored. | 911 // Visual overflow just includes overflow for stuff we need to issues paint
invalidations for ourselves. Self-painting layers are ignored. |
| 912 // Layout overflow is used to determine scrolling extent, so it still includ
es child layers and also factors in | 912 // Layout overflow is used to determine scrolling extent, so it still includ
es child layers and also factors in |
| 913 // transforms, relative positioning, etc. | 913 // transforms, relative positioning, etc. |
| 914 LayoutRect logicalLayoutOverflow(logicalFrameRectIncludingLineHeight(lineTop
, lineBottom)); | 914 LayoutRect logicalLayoutOverflow(logicalFrameRectIncludingLineHeight(lineTop
, lineBottom)); |
| 915 LayoutRect logicalVisualOverflow(logicalLayoutOverflow); | 915 LayoutRect logicalVisualOverflow(logicalLayoutOverflow); |
| 916 | 916 |
| 917 addBoxShadowVisualOverflow(logicalVisualOverflow); | 917 addBoxShadowVisualOverflow(logicalVisualOverflow); |
| 918 addBorderOutsetVisualOverflow(logicalVisualOverflow); | 918 addBorderOutsetVisualOverflow(logicalVisualOverflow); |
| 919 addOutlineVisualOverflow(logicalVisualOverflow); | 919 addOutlineVisualOverflow(logicalVisualOverflow); |
| 920 | 920 |
| 921 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 921 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 922 if (curr->lineLayoutItem().isOutOfFlowPositioned()) | 922 if (curr->getLineLayoutItem().isOutOfFlowPositioned()) |
| 923 continue; // Positioned placeholders don't affect calculations. | 923 continue; // Positioned placeholders don't affect calculations. |
| 924 | 924 |
| 925 if (curr->lineLayoutItem().isText()) { | 925 if (curr->getLineLayoutItem().isText()) { |
| 926 InlineTextBox* text = toInlineTextBox(curr); | 926 InlineTextBox* text = toInlineTextBox(curr); |
| 927 LineLayoutText rt = text->lineLayoutItem(); | 927 LineLayoutText rt = text->getLineLayoutItem(); |
| 928 if (rt.isBR()) | 928 if (rt.isBR()) |
| 929 continue; | 929 continue; |
| 930 LayoutRect textBoxOverflow(text->logicalFrameRect()); | 930 LayoutRect textBoxOverflow(text->logicalFrameRect()); |
| 931 addTextBoxVisualOverflow(text, textBoxDataMap, textBoxOverflow); | 931 addTextBoxVisualOverflow(text, textBoxDataMap, textBoxOverflow); |
| 932 logicalVisualOverflow.unite(textBoxOverflow); | 932 logicalVisualOverflow.unite(textBoxOverflow); |
| 933 } else if (curr->lineLayoutItem().isLayoutInline()) { | 933 } else if (curr->getLineLayoutItem().isLayoutInline()) { |
| 934 InlineFlowBox* flow = toInlineFlowBox(curr); | 934 InlineFlowBox* flow = toInlineFlowBox(curr); |
| 935 flow->computeOverflow(lineTop, lineBottom, textBoxDataMap); | 935 flow->computeOverflow(lineTop, lineBottom, textBoxDataMap); |
| 936 if (!flow->boxModelObject().hasSelfPaintingLayer()) | 936 if (!flow->boxModelObject().hasSelfPaintingLayer()) |
| 937 logicalVisualOverflow.unite(flow->logicalVisualOverflowRect(line
Top, lineBottom)); | 937 logicalVisualOverflow.unite(flow->logicalVisualOverflowRect(line
Top, lineBottom)); |
| 938 LayoutRect childLayoutOverflow = flow->logicalLayoutOverflowRect(lin
eTop, lineBottom); | 938 LayoutRect childLayoutOverflow = flow->logicalLayoutOverflowRect(lin
eTop, lineBottom); |
| 939 childLayoutOverflow.move(flow->boxModelObject().relativePositionLogi
calOffset()); | 939 childLayoutOverflow.move(flow->boxModelObject().relativePositionLogi
calOffset()); |
| 940 logicalLayoutOverflow.unite(childLayoutOverflow); | 940 logicalLayoutOverflow.unite(childLayoutOverflow); |
| 941 } else { | 941 } else { |
| 942 addReplacedChildOverflow(curr, logicalLayoutOverflow, logicalVisualO
verflow); | 942 addReplacedChildOverflow(curr, logicalLayoutOverflow, logicalVisualO
verflow); |
| 943 } | 943 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 // for each inline we additionally need to hit test its culled inline parent
s. | 995 // for each inline we additionally need to hit test its culled inline parent
s. |
| 996 // While hit testing culled inline parents, we can stop once we reach | 996 // While hit testing culled inline parents, we can stop once we reach |
| 997 // a non-inline parent or a culled inline associated with a different inline
box. | 997 // a non-inline parent or a culled inline associated with a different inline
box. |
| 998 InlineBox* prev; | 998 InlineBox* prev; |
| 999 for (InlineBox* curr = lastChild(); curr; curr = prev) { | 999 for (InlineBox* curr = lastChild(); curr; curr = prev) { |
| 1000 prev = curr->prevOnLine(); | 1000 prev = curr->prevOnLine(); |
| 1001 | 1001 |
| 1002 // Layers will handle hit testing themselves. | 1002 // Layers will handle hit testing themselves. |
| 1003 if (!curr->boxModelObject() || !curr->boxModelObject().hasSelfPaintingLa
yer()) { | 1003 if (!curr->boxModelObject() || !curr->boxModelObject().hasSelfPaintingLa
yer()) { |
| 1004 if (curr->nodeAtPoint(result, locationInContainer, accumulatedOffset
, lineTop, lineBottom)) { | 1004 if (curr->nodeAtPoint(result, locationInContainer, accumulatedOffset
, lineTop, lineBottom)) { |
| 1005 lineLayoutItem().updateHitTestResult(result, locationInContainer
.point() - toLayoutSize(accumulatedOffset)); | 1005 getLineLayoutItem().updateHitTestResult(result, locationInContai
ner.point() - toLayoutSize(accumulatedOffset)); |
| 1006 return true; | 1006 return true; |
| 1007 } | 1007 } |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 // If the current inline box's layout object and the previous inline box
's layout object are same, | 1010 // If the current inline box's layout object and the previous inline box
's layout object are same, |
| 1011 // we should yield the hit-test to the previous inline box. | 1011 // we should yield the hit-test to the previous inline box. |
| 1012 if (prev && curr->lineLayoutItem() == prev->lineLayoutItem()) | 1012 if (prev && curr->getLineLayoutItem() == prev->getLineLayoutItem()) |
| 1013 continue; | 1013 continue; |
| 1014 | 1014 |
| 1015 // Hit test the culled inline if necessary. | 1015 // Hit test the culled inline if necessary. |
| 1016 LineLayoutItem currLayoutItem = curr->lineLayoutItem(); | 1016 LineLayoutItem currLayoutItem = curr->getLineLayoutItem(); |
| 1017 while (true) { | 1017 while (true) { |
| 1018 // If the previous inline box is not a descendant of a current inlin
e's parent, | 1018 // If the previous inline box is not a descendant of a current inlin
e's parent, |
| 1019 // the parent is a culled inline and we hit test it. | 1019 // the parent is a culled inline and we hit test it. |
| 1020 // Otherwise, move to the previous inline box because we hit test fi
rst all | 1020 // Otherwise, move to the previous inline box because we hit test fi
rst all |
| 1021 // candidate inline boxes under the parent to take a pre-order tree
traversal in reverse. | 1021 // candidate inline boxes under the parent to take a pre-order tree
traversal in reverse. |
| 1022 bool hasSibling = currLayoutItem.previousSibling() || currLayoutItem
.nextSibling(); | 1022 bool hasSibling = currLayoutItem.previousSibling() || currLayoutItem
.nextSibling(); |
| 1023 LineLayoutItem culledParent = currLayoutItem.parent(); | 1023 LineLayoutItem culledParent = currLayoutItem.parent(); |
| 1024 ASSERT(culledParent); | 1024 ASSERT(culledParent); |
| 1025 | 1025 |
| 1026 if (culledParent == lineLayoutItem() || (hasSibling && prev && prev-
>lineLayoutItem().isDescendantOf(culledParent))) | 1026 if (culledParent == getLineLayoutItem() || (hasSibling && prev && pr
ev->getLineLayoutItem().isDescendantOf(culledParent))) |
| 1027 break; | 1027 break; |
| 1028 | 1028 |
| 1029 if (culledParent.isLayoutInline() && LineLayoutInline(culledParent).
hitTestCulledInline(result, locationInContainer, accumulatedOffset)) | 1029 if (culledParent.isLayoutInline() && LineLayoutInline(culledParent).
hitTestCulledInline(result, locationInContainer, accumulatedOffset)) |
| 1030 return true; | 1030 return true; |
| 1031 | 1031 |
| 1032 currLayoutItem = culledParent; | 1032 currLayoutItem = culledParent; |
| 1033 } | 1033 } |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 if (lineLayoutItem().style()->hasBorderRadius()) { | 1036 if (getLineLayoutItem().style()->hasBorderRadius()) { |
| 1037 LayoutRect borderRect = logicalFrameRect(); | 1037 LayoutRect borderRect = logicalFrameRect(); |
| 1038 borderRect.moveBy(accumulatedOffset); | 1038 borderRect.moveBy(accumulatedOffset); |
| 1039 FloatRoundedRect border = lineLayoutItem().style()->getRoundedBorderFor(
borderRect, includeLogicalLeftEdge(), includeLogicalRightEdge()); | 1039 FloatRoundedRect border = getLineLayoutItem().style()->getRoundedBorderF
or(borderRect, includeLogicalLeftEdge(), includeLogicalRightEdge()); |
| 1040 if (!locationInContainer.intersects(border)) | 1040 if (!locationInContainer.intersects(border)) |
| 1041 return false; | 1041 return false; |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 // Now check ourselves. | 1044 // Now check ourselves. |
| 1045 LayoutRect rect = InlineFlowBoxPainter(*this).frameRectClampedToLineTopAndBo
ttomIfNeeded(); | 1045 LayoutRect rect = InlineFlowBoxPainter(*this).frameRectClampedToLineTopAndBo
ttomIfNeeded(); |
| 1046 | 1046 |
| 1047 flipForWritingMode(rect); | 1047 flipForWritingMode(rect); |
| 1048 rect.moveBy(accumulatedOffset); | 1048 rect.moveBy(accumulatedOffset); |
| 1049 | 1049 |
| 1050 // Pixel snap hit testing. | 1050 // Pixel snap hit testing. |
| 1051 rect = LayoutRect(pixelSnappedIntRect(rect)); | 1051 rect = LayoutRect(pixelSnappedIntRect(rect)); |
| 1052 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContainer.
intersects(rect)) { | 1052 if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContainer.
intersects(rect)) { |
| 1053 lineLayoutItem().updateHitTestResult(result, flipForWritingMode(location
InContainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_topLe
ft here, we want coords in the containing block's space. | 1053 getLineLayoutItem().updateHitTestResult(result, flipForWritingMode(locat
ionInContainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_to
pLeft here, we want coords in the containing block's space. |
| 1054 if (result.addNodeToListBasedTestResult(lineLayoutItem().node(), locatio
nInContainer, rect) == StopHitTesting) | 1054 if (result.addNodeToListBasedTestResult(getLineLayoutItem().node(), loca
tionInContainer, rect) == StopHitTesting) |
| 1055 return true; | 1055 return true; |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 return false; | 1058 return false; |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 void InlineFlowBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset, LayoutUnit lineTop, LayoutUnit lineBottom) const | 1061 void InlineFlowBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOf
fset, LayoutUnit lineTop, LayoutUnit lineBottom) const |
| 1062 { | 1062 { |
| 1063 InlineFlowBoxPainter(*this).paint(paintInfo, paintOffset, lineTop, lineBotto
m); | 1063 InlineFlowBoxPainter(*this).paint(paintInfo, paintOffset, lineTop, lineBotto
m); |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 bool InlineFlowBox::boxShadowCanBeAppliedToBackground(const FillLayer& lastBackg
roundLayer) const | 1066 bool InlineFlowBox::boxShadowCanBeAppliedToBackground(const FillLayer& lastBackg
roundLayer) const |
| 1067 { | 1067 { |
| 1068 // The checks here match how paintFillLayer() decides whether to clip (if it
does, the shadow | 1068 // The checks here match how paintFillLayer() decides whether to clip (if it
does, the shadow |
| 1069 // would be clipped out, so it has to be drawn separately). | 1069 // would be clipped out, so it has to be drawn separately). |
| 1070 StyleImage* image = lastBackgroundLayer.image(); | 1070 StyleImage* image = lastBackgroundLayer.image(); |
| 1071 bool hasFillImage = image && image->canRender(); | 1071 bool hasFillImage = image && image->canRender(); |
| 1072 return (!hasFillImage && !lineLayoutItem().style()->hasBorderRadius()) || (!
prevLineBox() && !nextLineBox()) || !parent(); | 1072 return (!hasFillImage && !getLineLayoutItem().style()->hasBorderRadius()) ||
(!prevLineBox() && !nextLineBox()) || !parent(); |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 InlineBox* InlineFlowBox::firstLeafChild() const | 1075 InlineBox* InlineFlowBox::firstLeafChild() const |
| 1076 { | 1076 { |
| 1077 InlineBox* leaf = nullptr; | 1077 InlineBox* leaf = nullptr; |
| 1078 for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnL
ine()) | 1078 for (InlineBox* child = firstChild(); child && !leaf; child = child->nextOnL
ine()) |
| 1079 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->firstLeafChild(
); | 1079 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->firstLeafChild(
); |
| 1080 return leaf; | 1080 return leaf; |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 InlineBox* InlineFlowBox::lastLeafChild() const | 1083 InlineBox* InlineFlowBox::lastLeafChild() const |
| 1084 { | 1084 { |
| 1085 InlineBox* leaf = nullptr; | 1085 InlineBox* leaf = nullptr; |
| 1086 for (InlineBox* child = lastChild(); child && !leaf; child = child->prevOnLi
ne()) | 1086 for (InlineBox* child = lastChild(); child && !leaf; child = child->prevOnLi
ne()) |
| 1087 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->lastLeafChild()
; | 1087 leaf = child->isLeaf() ? child : toInlineFlowBox(child)->lastLeafChild()
; |
| 1088 return leaf; | 1088 return leaf; |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 SelectionState InlineFlowBox::selectionState() const | 1091 SelectionState InlineFlowBox::getSelectionState() const |
| 1092 { | 1092 { |
| 1093 return SelectionNone; | 1093 return SelectionNone; |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 bool InlineFlowBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsis
Width) const | 1096 bool InlineFlowBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsis
Width) const |
| 1097 { | 1097 { |
| 1098 for (InlineBox* box = firstChild(); box; box = box->nextOnLine()) { | 1098 for (InlineBox* box = firstChild(); box; box = box->nextOnLine()) { |
| 1099 if (!box->canAccommodateEllipsis(ltr, blockEdge, ellipsisWidth)) | 1099 if (!box->canAccommodateEllipsis(ltr, blockEdge, ellipsisWidth)) |
| 1100 return false; | 1100 return false; |
| 1101 } | 1101 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 void InlineFlowBox::clearTruncation() | 1135 void InlineFlowBox::clearTruncation() |
| 1136 { | 1136 { |
| 1137 for (InlineBox* box = firstChild(); box; box = box->nextOnLine()) | 1137 for (InlineBox* box = firstChild(); box; box = box->nextOnLine()) |
| 1138 box->clearTruncation(); | 1138 box->clearTruncation(); |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 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->lineLayoutItem().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->lineLayoutItem().isAtomicInlineLevel() && curr->lineLayoutItem
().isRubyRun() && curr->lineLayoutItem().style()->rubyPosition() == RubyPosition
Before) { | 1151 if (curr->getLineLayoutItem().isAtomicInlineLevel() && curr->getLineLayo
utItem().isRubyRun() && curr->getLineLayoutItem().style()->rubyPosition() == Rub
yPositionBefore) { |
| 1152 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->lineLayoutItem()
); | 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->lineLayoutItem().styleRef(isFirst
LineStyle()); | 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.textEmphasisMark() != TextEmphasisMarkNone && toInlineText
Box(curr)->getEmphasisMarkPosition(style, emphasisMarkPosition) && emphasisMarkP
osition == 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->lineLayoutItem().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->lineLayoutItem().isAtomicInlineLevel() && curr->lineLayoutItem
().isRubyRun() && curr->lineLayoutItem().style()->rubyPosition() == RubyPosition
After) { | 1199 if (curr->getLineLayoutItem().isAtomicInlineLevel() && curr->getLineLayo
utItem().isRubyRun() && curr->getLineLayoutItem().style()->rubyPosition() == Rub
yPositionAfter) { |
| 1200 LineLayoutRubyRun rubyRun = LineLayoutRubyRun(curr->lineLayoutItem()
); | 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->lineLayoutItem().styleRef(isFirst
LineStyle()); | 1221 const ComputedStyle& style = curr->getLineLayoutItem().styleRef(isFi
rstLineStyle()); |
| 1222 if (style.textEmphasisMark() != TextEmphasisMarkNone && style.textEm
phasisPosition() == TextEmphasisPositionUnder) { | 1222 if (style.textEmphasisMark() != TextEmphasisMarkNone && style.textEm
phasisPosition() == 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 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1242 unsigned char minLevel = 128; | 1242 unsigned char minLevel = 128; |
| 1243 unsigned char maxLevel = 0; | 1243 unsigned char maxLevel = 0; |
| 1244 | 1244 |
| 1245 // First find highest and lowest levels, and initialize leafBoxesInLogicalOr
der with the leaf boxes in visual order. | 1245 // First find highest and lowest levels, and initialize leafBoxesInLogicalOr
der with the leaf boxes in visual order. |
| 1246 for (; leaf; leaf = leaf->nextLeafChild()) { | 1246 for (; leaf; leaf = leaf->nextLeafChild()) { |
| 1247 minLevel = std::min(minLevel, leaf->bidiLevel()); | 1247 minLevel = std::min(minLevel, leaf->bidiLevel()); |
| 1248 maxLevel = std::max(maxLevel, leaf->bidiLevel()); | 1248 maxLevel = std::max(maxLevel, leaf->bidiLevel()); |
| 1249 leafBoxesInLogicalOrder.append(leaf); | 1249 leafBoxesInLogicalOrder.append(leaf); |
| 1250 } | 1250 } |
| 1251 | 1251 |
| 1252 if (lineLayoutItem().style()->rtlOrdering() == VisualOrder) | 1252 if (getLineLayoutItem().style()->rtlOrdering() == VisualOrder) |
| 1253 return; | 1253 return; |
| 1254 | 1254 |
| 1255 // Reverse of reordering of the line (L2 according to Bidi spec): | 1255 // Reverse of reordering of the line (L2 according to Bidi spec): |
| 1256 // L2. From the highest level found in the text to the lowest odd level on e
ach line, | 1256 // L2. From the highest level found in the text to the lowest odd level on e
ach line, |
| 1257 // reverse any contiguous sequence of characters that are at that level or h
igher. | 1257 // reverse any contiguous sequence of characters that are at that level or h
igher. |
| 1258 | 1258 |
| 1259 // Reversing the reordering of the line is only done up to the lowest odd le
vel. | 1259 // Reversing the reordering of the line is only done up to the lowest odd le
vel. |
| 1260 if (!(minLevel % 2)) | 1260 if (!(minLevel % 2)) |
| 1261 ++minLevel; | 1261 ++minLevel; |
| 1262 | 1262 |
| (...skipping 51 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 |