| Index: third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
|
| index ab7e8b01ebab2e21126cbee1ec5a99d4c9e871d7..5385c343d13ac23fc7f2ef6505ef25235f910390 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
|
| @@ -2422,10 +2422,11 @@ void LayoutBlockFlow::checkLinesForTextOverflow() {
|
| LayoutUnit blockEdge = ltr ? blockRightEdge : blockLeftEdge;
|
| if (curr->lineCanAccommodateEllipsis(ltr, blockEdge, lineBoxEdge,
|
| width)) {
|
| - LayoutUnit totalLogicalWidth = curr->placeEllipsis(
|
| - selectedEllipsisStr, ltr, blockLeftEdge, blockRightEdge, width);
|
| + LayoutUnit totalLogicalWidth =
|
| + curr->placeEllipsis(selectedEllipsisStr, ltr, blockLeftEdge,
|
| + blockRightEdge, width, LayoutUnit(), false);
|
| LayoutUnit logicalLeft; // We are only interested in the delta from the
|
| - // base position.
|
| + // base position.
|
| LayoutUnit availableLogicalWidth = blockRightEdge - blockLeftEdge;
|
| updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft,
|
| totalLogicalWidth, availableLogicalWidth,
|
| @@ -2435,12 +2436,84 @@ void LayoutBlockFlow::checkLinesForTextOverflow() {
|
| else
|
| curr->moveInInlineDirection(
|
| logicalLeft - (availableLogicalWidth - totalLogicalWidth));
|
| + } else {
|
| + tryPlacingEllipsisOnAtomicInlines(curr, blockRightEdge, blockLeftEdge,
|
| + width, selectedEllipsisStr);
|
| }
|
| }
|
| indentText = DoNotIndentText;
|
| }
|
| }
|
|
|
| +void LayoutBlockFlow::tryPlacingEllipsisOnAtomicInlines(
|
| + RootInlineBox* root,
|
| + LayoutUnit blockRightEdge,
|
| + LayoutUnit blockLeftEdge,
|
| + LayoutUnit ellipsisWidth,
|
| + const AtomicString& selectedEllipsisStr) {
|
| + bool ltr = style()->isLeftToRightDirection();
|
| + LayoutUnit logicalLeftOffset = blockLeftEdge;
|
| +
|
| + // Each atomic inline block (e.g. a <span>) inside a blockflow is managed by
|
| + // an
|
| + // InlineBox that allows us to access the lineboxes that live inside the
|
| + // atomic
|
| + // inline block.
|
| + bool foundBox = false;
|
| + for (InlineBox* box = ltr ? root->firstChild() : root->lastChild(); box;
|
| + box = ltr ? box->nextOnLine() : box->prevOnLine()) {
|
| + if (!box->getLineLayoutItem().isAtomicInlineLevel() ||
|
| + !box->getLineLayoutItem().isLayoutBlockFlow())
|
| + continue;
|
| +
|
| + RootInlineBox* firstRootBox =
|
| + LineLayoutBlockFlow(box->getLineLayoutItem()).firstRootBox();
|
| + if (!firstRootBox)
|
| + continue;
|
| +
|
| + bool placedEllipsis = false;
|
| + // Move the right edge of the block in so that we can test it against the
|
| + // width of the root line boxes. We don't resize or move the linebox to
|
| + // respect text-align because it is the final one of a sequence on the line.
|
| + if (ltr) {
|
| + for (RootInlineBox* curr = firstRootBox; curr;
|
| + curr = curr->nextRootBox()) {
|
| + LayoutUnit currLogicalLeft = logicalLeftOffset + curr->logicalLeft();
|
| + LayoutUnit ellipsisEdge =
|
| + currLogicalLeft + curr->logicalWidth() + ellipsisWidth;
|
| + if (ellipsisEdge <= blockRightEdge)
|
| + continue;
|
| + curr->placeEllipsis(selectedEllipsisStr, ltr, blockLeftEdge,
|
| + blockRightEdge, ellipsisWidth, logicalLeftOffset,
|
| + foundBox);
|
| + placedEllipsis = true;
|
| + }
|
| + } else {
|
| + LayoutUnit maxRootBoxWidth;
|
| + for (RootInlineBox* curr = firstRootBox; curr;
|
| + curr = curr->nextRootBox()) {
|
| + LayoutUnit ellipsisEdge =
|
| + box->logicalLeft() + curr->logicalLeft() - ellipsisWidth;
|
| + if (ellipsisEdge >= blockLeftEdge)
|
| + continue;
|
| + // Root boxes can vary in width so move our offset out to allow
|
| + // comparison with the right hand edge of the block.
|
| + LayoutUnit logicalLeftOffset = box->logicalLeft();
|
| + maxRootBoxWidth =
|
| + std::max<LayoutUnit>(curr->logicalWidth(), maxRootBoxWidth);
|
| + if (logicalLeftOffset < 0)
|
| + logicalLeftOffset += maxRootBoxWidth - curr->logicalWidth();
|
| + curr->placeEllipsis(selectedEllipsisStr, ltr, blockLeftEdge,
|
| + blockRightEdge, ellipsisWidth,
|
| + LayoutUnit(logicalLeftOffset.ceil()), foundBox);
|
| + placedEllipsis = true;
|
| + }
|
| + }
|
| + foundBox |= placedEllipsis;
|
| + logicalLeftOffset += box->logicalWidth();
|
| + }
|
| +}
|
| +
|
| void LayoutBlockFlow::markLinesDirtyInBlockRange(LayoutUnit logicalTop,
|
| LayoutUnit logicalBottom,
|
| RootInlineBox* highest) {
|
|
|