Changeset 121085 in webkit


Ignore:
Timestamp:
Jun 22, 2012 7:02:28 PM (12 years ago)
Author:
benjamin@webkit.org
Message:

Text with text-overflow:ellipsis and text-align:right is left aligned
https://bugs.webkit.org/show_bug.cgi?id=88705

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-06-22
Reviewed by Dan Bernstein.

Source/WebCore:

When building the line of a text with overflow, we do not know if we can place
an ellipsis and where it should be. Because of that, text is laid out as if it does
not have text-overflow: ellipsis.

This causes problems with text-alignement right in LTR and left in RTL. The shortened text
did not follow the allignment.

This patch changes the position of lines with ellipsis after layout to follow the allignment.
In RenderBlock::checkLinesForTextOverflow(), the call to RootInlineBox::placeEllipsis() now
also gives the width of the truncated text. We use this width to re-compute the alignement and
shift the box if necessary.

In RenderBlock::deleteEllipsisLineBoxes() we revert the text to the position computed with the
total width. This way all layout computation is done as usual.

Tests: fast/css/text-overflow-ellipsis-text-align-left.html

fast/css/text-overflow-ellipsis-text-align-right.html

  • rendering/InlineBox.cpp:

(WebCore::InlineBox::canAccommodateEllipsis): Make the method const for readability, truncating is
done later in placeEllipsisBox().
(WebCore::InlineBox::placeEllipsisBox): Add an output argument, truncatedWidth, giving the width
of the text + ellipsis after truncation (if any truncation can be done).

  • rendering/InlineBox.h:

(InlineBox):

  • rendering/InlineFlowBox.cpp:

(WebCore::InlineBox::adjustLogicalPosition): adjustPosition() logical coordinates.
(WebCore::InlineFlowBox::canAccommodateEllipsis):
(WebCore::InlineFlowBox::placeEllipsisBox):

  • rendering/InlineFlowBox.h:

(InlineFlowBox):

  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::placeEllipsisBox):

  • rendering/InlineTextBox.h:

(InlineTextBox):

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::deleteEllipsisLineBoxes): In addition to removing the truncation, we
need to revert the shift introduced by checkLinesForTextOverflow(). This restore the lines
to its original, untruncated position in order to layout the block correctly in RenderBlock::layoutInlineChildren().
(WebCore::RenderBlock::checkLinesForTextOverflow): After we truncate the text, we now recompute the shift we need
for alignment, and move the line accordingly.

  • rendering/RenderDeprecatedFlexibleBox.cpp:

(WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):

  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::placeEllipsis): Return the width of the truncated text + the width of the ellipsis.
(WebCore::RootInlineBox::placeEllipsisBox):
(WebCore::RootInlineBox::adjustPosition):

  • rendering/RootInlineBox.h:

(RootInlineBox):

LayoutTests:

  • fast/css/text-overflow-ellipsis-text-align-center.html: Added.
  • fast/css/text-overflow-ellipsis-text-align-justify.html: Added.
  • fast/css/text-overflow-ellipsis-text-align-left.html: Added.
  • fast/css/text-overflow-ellipsis-text-align-right.html: Added.
  • fast/css/vertical-text-overflow-ellipsis-text-align-center.html: Added.
  • fast/css/vertical-text-overflow-ellipsis-text-align-justify.html: Added.
  • fast/css/vertical-text-overflow-ellipsis-text-align-left.html: Added.
  • fast/css/vertical-text-overflow-ellipsis-text-align-right.html: Added.

The vertical-text tests are incorrect due to other bugs. Add they to track regressions/progressions
going forward.

  • platform/chromium/TestExpectations: The tests need platform specific results.
  • platform/mac/fast/css/text-overflow-ellipsis-text-align-center-expected.txt: Added.
  • platform/mac/fast/css/text-overflow-ellipsis-text-align-justify-expected.txt: Added.
  • platform/mac/fast/css/text-overflow-ellipsis-text-align-left-expected.txt: Added.
  • platform/mac/fast/css/text-overflow-ellipsis-text-align-right-expected.txt: Added.
  • platform/mac/fast/css/text-overflow-ellipsis-text-align-center-expected.txt: Added.
  • platform/mac/fast/css/text-overflow-ellipsis-text-align-justify-expected.txt: Added.
  • platform/mac/fast/css/text-overflow-ellipsis-text-align-left-expected.txt: Added.
  • platform/mac/fast/css/text-overflow-ellipsis-text-align-right-expected.txt: Added.
Location:
trunk
Files:
16 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r121083 r121085  
     12012-06-22  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        Text with text-overflow:ellipsis and text-align:right is left aligned
     4        https://bugs.webkit.org/show_bug.cgi?id=88705
     5
     6        Reviewed by Dan Bernstein.
     7
     8        * fast/css/text-overflow-ellipsis-text-align-center.html: Added.
     9        * fast/css/text-overflow-ellipsis-text-align-justify.html: Added.
     10        * fast/css/text-overflow-ellipsis-text-align-left.html: Added.
     11        * fast/css/text-overflow-ellipsis-text-align-right.html: Added.
     12        * fast/css/vertical-text-overflow-ellipsis-text-align-center.html: Added.
     13        * fast/css/vertical-text-overflow-ellipsis-text-align-justify.html: Added.
     14        * fast/css/vertical-text-overflow-ellipsis-text-align-left.html: Added.
     15        * fast/css/vertical-text-overflow-ellipsis-text-align-right.html: Added.
     16        The vertical-text tests are incorrect due to other bugs. Add they to track regressions/progressions
     17        going forward.
     18
     19        * platform/chromium/TestExpectations: The tests need platform specific results.
     20        * platform/mac/fast/css/text-overflow-ellipsis-text-align-center-expected.txt: Added.
     21        * platform/mac/fast/css/text-overflow-ellipsis-text-align-justify-expected.txt: Added.
     22        * platform/mac/fast/css/text-overflow-ellipsis-text-align-left-expected.txt: Added.
     23        * platform/mac/fast/css/text-overflow-ellipsis-text-align-right-expected.txt: Added.
     24        * platform/mac/fast/css/text-overflow-ellipsis-text-align-center-expected.txt: Added.
     25        * platform/mac/fast/css/text-overflow-ellipsis-text-align-justify-expected.txt: Added.
     26        * platform/mac/fast/css/text-overflow-ellipsis-text-align-left-expected.txt: Added.
     27        * platform/mac/fast/css/text-overflow-ellipsis-text-align-right-expected.txt: Added.
     28
    1292012-06-22  Alexandru Chiculita  <achicu@adobe.com>
    230
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r121080 r121085  
    36713671BUGWK87653 : compositing/geometry/composited-in-columns.html = IMAGE+TEXT
    36723672
     3673// Needs Rebaseline.
     3674BUGWK88705 : fast/css/text-overflow-ellipsis-text-align-center-expected.txt = TEXT
     3675BUGWK88705 : fast/css/text-overflow-ellipsis-text-align-justify-expected.txt = TEXT
     3676BUGWK88705 : fast/css/text-overflow-ellipsis-text-align-left-expected.txt = TEXT
     3677BUGWK88705 : fast/css/text-overflow-ellipsis-text-align-right-expected.txt = TEXT
     3678BUGWK88705 : fast/css/vertical-text-overflow-ellipsis-text-align-center.html = TEXT
     3679BUGWK88705 : fast/css/vertical-text-overflow-ellipsis-text-align-justify.html = TEXT
     3680BUGWK88705 : fast/css/vertical-text-overflow-ellipsis-text-align-left.html = TEXT
     3681BUGWK88705 : fast/css/vertical-text-overflow-ellipsis-text-align-right.html = TEXT
     3682
    36733683// Fails with a mismatch in $("menulist").selectedIndex
    36743684BUGWK87748 MAC : fast/forms/select/optgroup-clicking.html = TEXT
  • trunk/Source/WebCore/ChangeLog

    r121084 r121085  
     12012-06-22  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        Text with text-overflow:ellipsis and text-align:right is left aligned
     4        https://bugs.webkit.org/show_bug.cgi?id=88705
     5
     6        Reviewed by Dan Bernstein.
     7
     8        When building the line of a text with overflow, we do not know if we can place
     9        an ellipsis and where it should be. Because of that, text is laid out as if it does
     10        not have text-overflow: ellipsis.
     11
     12        This causes problems with text-alignement right in LTR and left in RTL. The shortened text
     13        did not follow the allignment.
     14
     15        This patch changes the position of lines with ellipsis after layout to follow the allignment.
     16        In RenderBlock::checkLinesForTextOverflow(), the call to RootInlineBox::placeEllipsis() now
     17        also gives the width of the truncated text. We use this width to re-compute the alignement and
     18        shift the box if necessary.
     19
     20        In RenderBlock::deleteEllipsisLineBoxes() we revert the text to the position computed with the
     21        total width. This way all layout computation is done as usual.
     22
     23        Tests: fast/css/text-overflow-ellipsis-text-align-left.html
     24               fast/css/text-overflow-ellipsis-text-align-right.html
     25
     26        * rendering/InlineBox.cpp:
     27        (WebCore::InlineBox::canAccommodateEllipsis): Make the method const for readability, truncating is
     28        done later in placeEllipsisBox().
     29        (WebCore::InlineBox::placeEllipsisBox): Add an output argument, truncatedWidth, giving the width
     30        of the text + ellipsis after truncation (if any truncation can be done).
     31        * rendering/InlineBox.h:
     32        (InlineBox):
     33        * rendering/InlineFlowBox.cpp:
     34        (WebCore::InlineBox::adjustLogicalPosition): adjustPosition() logical coordinates.
     35        (WebCore::InlineFlowBox::canAccommodateEllipsis):
     36        (WebCore::InlineFlowBox::placeEllipsisBox):
     37        * rendering/InlineFlowBox.h:
     38        (InlineFlowBox):
     39        * rendering/InlineTextBox.cpp:
     40        (WebCore::InlineTextBox::placeEllipsisBox):
     41        * rendering/InlineTextBox.h:
     42        (InlineTextBox):
     43        * rendering/RenderBlockLineLayout.cpp:
     44        (WebCore::RenderBlock::deleteEllipsisLineBoxes): In addition to removing the truncation, we
     45        need to revert the shift introduced by checkLinesForTextOverflow(). This restore the lines
     46        to its original, untruncated position in order to layout the block correctly in RenderBlock::layoutInlineChildren().
     47        (WebCore::RenderBlock::checkLinesForTextOverflow): After we truncate the text, we now recompute the shift we need
     48        for alignment, and move the line accordingly.
     49        * rendering/RenderDeprecatedFlexibleBox.cpp:
     50        (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
     51        * rendering/RootInlineBox.cpp:
     52        (WebCore::RootInlineBox::placeEllipsis): Return the width of the truncated text + the width of the ellipsis.
     53        (WebCore::RootInlineBox::placeEllipsisBox):
     54        (WebCore::RootInlineBox::adjustPosition):
     55        * rendering/RootInlineBox.h:
     56        (RootInlineBox):
     57
    1582012-06-22  Eugene Klyuchnikov  <eustas.big@gmail.com>
    259
  • trunk/Source/WebCore/rendering/InlineBox.cpp

    r120824 r121085  
    323323}
    324324
    325 bool InlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth)
     325bool InlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth) const
    326326{
    327327    // Non-replaced elements can always accommodate an ellipsis.
     
    334334}
    335335
    336 float InlineBox::placeEllipsisBox(bool, float, float, float, bool&)
     336float InlineBox::placeEllipsisBox(bool, float, float, float, float& truncatedWidth, bool&)
    337337{
    338338    // Use -1 to mean "we didn't set the position."
     339    truncatedWidth += logicalWidth();
    339340    return -1;
    340341}
  • trunk/Source/WebCore/rendering/InlineBox.h

    r120824 r121085  
    7373
    7474    virtual void adjustPosition(float dx, float dy);
     75    void adjustLogicalPosition(float deltaLogicalLeft, float deltaLogicalTop)
     76    {
     77        if (isHorizontal())
     78            adjustPosition(deltaLogicalLeft, deltaLogicalTop);
     79        else
     80            adjustPosition(deltaLogicalTop, deltaLogicalLeft);
     81    }
    7582    void adjustLineDirectionPosition(float delta)
    7683    {
     
    262269    virtual RenderObject::SelectionState selectionState();
    263270
    264     virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth);
     271    virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth) const;
    265272    // visibleLeftEdge, visibleRightEdge are in the parent's coordinate system.
    266     virtual float placeEllipsisBox(bool ltr, float visibleLeftEdge, float visibleRightEdge, float ellipsisWidth, bool&);
     273    virtual float placeEllipsisBox(bool ltr, float visibleLeftEdge, float visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool&);
    267274
    268275#ifndef NDEBUG
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r120835 r121085  
    13811381}
    13821382
    1383 bool InlineFlowBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth)
     1383bool InlineFlowBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth) const
    13841384{
    13851385    for (InlineBox *box = firstChild(); box; box = box->nextOnLine()) {
     
    13901390}
    13911391
    1392 float InlineFlowBox::placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, bool& foundBox)
     1392float InlineFlowBox::placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox)
    13931393{
    13941394    float result = -1;
     
    14041404
    14051405    while (box) {
    1406         int currResult = box->placeEllipsisBox(ltr, visibleLeftEdge, visibleRightEdge, ellipsisWidth, foundBox);
     1406        int currResult = box->placeEllipsisBox(ltr, visibleLeftEdge, visibleRightEdge, ellipsisWidth, truncatedWidth, foundBox);
    14071407        if (currResult != -1 && result == -1)
    14081408            result = currResult;
  • trunk/Source/WebCore/rendering/InlineFlowBox.h

    r120824 r121085  
    103103    virtual void removeLineBoxFromRenderObject();
    104104
    105     virtual void clearTruncation();
     105    virtual void clearTruncation() OVERRIDE;
    106106
    107107    IntRect roundedFrameRect() const;
     
    190190    virtual RenderObject::SelectionState selectionState();
    191191
    192     virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth);
    193     virtual float placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, bool&);
     192    virtual bool canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidth) const OVERRIDE;
     193    virtual float placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, float &truncatedWidth, bool&) OVERRIDE;
    194194
    195195    bool hasTextChildren() const { return m_hasTextChildren; }
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r120824 r121085  
    234234}
    235235
    236 float InlineTextBox::placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, float visibleRightEdge, float ellipsisWidth, bool& foundBox)
     236float InlineTextBox::placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, float visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox)
    237237{
    238238    if (foundBox) {
     
    276276            // and the ellipsis edge.
    277277            m_truncation = cFullTruncation;
     278            truncatedWidth += ellipsisWidth;
    278279            return min(ellipsisX, x());
    279280        }
     
    291292        // e.g. In the case of an LTR inline box truncated in an RTL flow then we can
    292293        // have a situation such as |Hello| -> |...He|
     294        truncatedWidth += widthOfVisibleText + ellipsisWidth;
    293295        if (flowIsLTR)
    294296            return left() + widthOfVisibleText;
     
    296298            return right() - widthOfVisibleText - ellipsisWidth;
    297299    }
     300    truncatedWidth += logicalWidth();
    298301    return -1;
    299302}
  • trunk/Source/WebCore/rendering/InlineTextBox.h

    r120824 r121085  
    131131private:
    132132    virtual void clearTruncation() { m_truncation = cNoTruncation; }
    133     virtual float placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, float visibleRightEdge, float ellipsisWidth, bool& foundBox);
     133    virtual float placeEllipsisBox(bool flowIsLTR, float visibleLeftEdge, float visibleRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox) OVERRIDE;
    134134
    135135public:
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r120495 r121085  
    26762676void RenderBlock::deleteEllipsisLineBoxes()
    26772677{
    2678     for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox())
    2679         curr->clearTruncation();
     2678    ETextAlign textAlign = style()->textAlign();
     2679    bool ltr = style()->isLeftToRightDirection();
     2680    bool firstLine = true;
     2681    for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
     2682        if (curr->hasEllipsisBox()) {
     2683            curr->clearTruncation();
     2684
     2685            // Shift the line back where it belongs if we cannot accomodate an ellipsis.
     2686            float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(curr->lineTop(), firstLine);
     2687            float availableLogicalWidth = logicalRightOffsetForLine(curr->lineTop(), false) - logicalLeft;
     2688            float totalLogicalWidth = curr->logicalWidth();
     2689            updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
     2690
     2691            if (ltr)
     2692                curr->adjustLogicalPosition((logicalLeft - curr->logicalLeft()), 0);
     2693            else
     2694                curr->adjustLogicalPosition(-(curr->logicalLeft() - logicalLeft), 0);
     2695        }
     2696        firstLine = false;
     2697    }
    26802698}
    26812699
     
    26952713    // Include the scrollbar for overflow blocks, which means we want to use "contentWidth()"
    26962714    bool ltr = style()->isLeftToRightDirection();
     2715    ETextAlign textAlign = style()->textAlign();
     2716    bool firstLine = true;
    26972717    for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
    2698         LayoutUnit blockRightEdge = logicalRightOffsetForLine(curr->y(), curr == firstRootBox());
    2699         LayoutUnit blockLeftEdge = logicalLeftOffsetForLine(curr->y(), curr == firstRootBox());
     2718        LayoutUnit blockRightEdge = logicalRightOffsetForLine(curr->lineTop(), firstLine);
     2719        LayoutUnit blockLeftEdge = logicalLeftOffsetForLine(curr->lineTop(), firstLine);
    27002720        LayoutUnit lineBoxEdge = ltr ? curr->x() + curr->logicalWidth() : curr->x();
    27012721        if ((ltr && lineBoxEdge > blockRightEdge) || (!ltr && lineBoxEdge < blockLeftEdge)) {
     
    27042724            // accommodate our truncation string, and no replaced elements (images, tables) can overlap the ellipsis
    27052725            // space.
    2706             LayoutUnit width = curr == firstRootBox() ? firstLineEllipsisWidth : ellipsisWidth;
     2726
     2727            LayoutUnit width = firstLine ? firstLineEllipsisWidth : ellipsisWidth;
    27072728            LayoutUnit blockEdge = ltr ? blockRightEdge : blockLeftEdge;
    2708             if (curr->lineCanAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width))
    2709                 curr->placeEllipsis(ellipsisStr, ltr, blockLeftEdge, blockRightEdge, width);
    2710         }
     2729            if (curr->lineCanAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width)) {
     2730                float totalLogicalWidth = curr->placeEllipsis(ellipsisStr, ltr, blockLeftEdge, blockRightEdge, width);
     2731
     2732                float logicalLeft = 0; // We are only intersted in the delta from the base position.
     2733                float truncatedWidth = pixelSnappedLogicalRightOffsetForLine(curr->lineTop(), firstLine);
     2734                updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, truncatedWidth, 0);
     2735                if (ltr)
     2736                    curr->adjustLogicalPosition(logicalLeft, 0);
     2737                else
     2738                    curr->adjustLogicalPosition(-(truncatedWidth - (logicalLeft + totalLogicalWidth)), 0);
     2739            }
     2740        }
     2741        firstLine = false;
    27112742    }
    27122743}
     
    27772808    availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), false) - logicalLeft;
    27782809    float totalLogicalWidth = logicalWidthForChild(child);
    2779     updateLogicalWidthForAlignment(textAlign, 0l, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
     2810    updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
    27802811
    27812812    if (!style()->isLeftToRightDirection())
  • trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp

    r119507 r121085  
    980980
    981981        // Let the truncation code kick in.
     982        // FIXME: the text alignment should be recomputed after the width changes due to truncation.
    982983        lastVisibleLine->placeEllipsis(anchorBox ? ellipsisAndSpaceStr : ellipsisStr, leftToRight, blockLeftEdge, blockRightEdge, totalWidth, anchorBox);
    983984        destBlock->setHasMarkupTruncation(true);
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r120824 r121085  
    123123}
    124124
    125 void RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr,  bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth,
     125float RootInlineBox::placeEllipsis(const AtomicString& ellipsisStr,  bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth,
    126126                                  InlineBox* markupBox)
    127127{
     
    139139    if (ltr && (x() + logicalWidth() + ellipsisWidth) <= blockRightEdge) {
    140140        ellipsisBox->setX(x() + logicalWidth());
    141         return;
     141        return logicalWidth() + ellipsisWidth;
    142142    }
    143143
     
    146146    // truncated).
    147147    bool foundBox = false;
    148     ellipsisBox->setX(placeEllipsisBox(ltr, blockLeftEdge, blockRightEdge, ellipsisWidth, foundBox));
    149 }
    150 
    151 float RootInlineBox::placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, bool& foundBox)
    152 {
    153     float result = InlineFlowBox::placeEllipsisBox(ltr, blockLeftEdge, blockRightEdge, ellipsisWidth, foundBox);
    154     if (result == -1)
     148    float truncatedWidth = 0;
     149    float position = placeEllipsisBox(ltr, blockLeftEdge, blockRightEdge, ellipsisWidth, truncatedWidth, foundBox);
     150    ellipsisBox->setX(position);
     151    return truncatedWidth;
     152}
     153
     154float RootInlineBox::placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox)
     155{
     156    float result = InlineFlowBox::placeEllipsisBox(ltr, blockLeftEdge, blockRightEdge, ellipsisWidth, truncatedWidth, foundBox);
     157    if (result == -1) {
    155158        result = ltr ? blockRightEdge - ellipsisWidth : blockLeftEdge;
     159        truncatedWidth = blockRightEdge - blockLeftEdge;
     160    }
    156161    return result;
    157162}
     
    232237    m_lineTopWithLeading += blockDirectionDelta;
    233238    m_lineBottomWithLeading += blockDirectionDelta;
     239    if (hasEllipsisBox())
     240        ellipsisBox()->adjustPosition(dx, dy);
    234241}
    235242
  • trunk/Source/WebCore/rendering/RootInlineBox.h

    r120824 r121085  
    9393
    9494    bool lineCanAccommodateEllipsis(bool ltr, int blockEdge, int lineBoxEdge, int ellipsisWidth);
    95     void placeEllipsis(const AtomicString& ellipsisStr, bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, InlineBox* markupBox = 0);
    96     virtual float placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, bool& foundBox);
     95    // Return the truncatedWidth, the width of the truncated text + ellipsis.
     96    float placeEllipsis(const AtomicString& ellipsisStr, bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, InlineBox* markupBox = 0);
     97    // Return the position of the EllipsisBox or -1.
     98    virtual float placeEllipsisBox(bool ltr, float blockLeftEdge, float blockRightEdge, float ellipsisWidth, float &truncatedWidth, bool& foundBox) OVERRIDE;
    9799
    98100    using InlineBox::hasEllipsisBox;
     
    101103    void paintEllipsisBox(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) const;
    102104
    103     virtual void clearTruncation();
     105    virtual void clearTruncation() OVERRIDE;
    104106
    105107    bool isHyphenated() const;
     
    185187#endif
    186188private:
    187 
    188189    LayoutUnit lineSnapAdjustment(LayoutUnit delta = 0) const;
    189190
Note: See TracChangeset for help on using the changeset viewer.