Changeset 142335 in webkit


Ignore:
Timestamp:
Feb 8, 2013 5:48:09 PM (11 years ago)
Author:
aestes@apple.com
Message:

Restore pre-r118852 behavior for EllipsisBox::nodeAtPoint()
https://bugs.webkit.org/show_bug.cgi?id=109277

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/flexbox/line-clamp-link-after-ellipsis.html

Roll out r118852. Enough time has passed that this can't be done
mechanically, so transcribe the old method definition to current
WebCore interfaces.

  • rendering/EllipsisBox.cpp:

(WebCore::EllipsisBox::markupBox): EllipsisBox no longer has
m_markupBox, so break the logic for finding the markup box from
paintMarkupBox() into its own function.
(WebCore::EllipsisBox::paintMarkupBox): Call markupBox().
(WebCore::EllipsisBox::nodeAtPoint): Transcribe the pre-r118852 implementation.

  • rendering/EllipsisBox.h:

(EllipsisBox): Declare markupBox().

LayoutTests:

Remove test added by r118852 and add a test that verifies the original
expected behavior.

  • fast/css/text-overflow-ellipsis-hit-test-expected.txt: Removed.
  • fast/css/text-overflow-ellipsis-hit-test.html: Removed.
  • fast/flexbox/line-clamp-link-after-ellipsis-expected.txt: Added.
  • fast/flexbox/line-clamp-link-after-ellipsis.html: Added.
Location:
trunk
Files:
2 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142332 r142335  
     12013-02-08  Andy Estes  <aestes@apple.com>
     2
     3        Restore pre-r118852 behavior for EllipsisBox::nodeAtPoint()
     4        https://bugs.webkit.org/show_bug.cgi?id=109277
     5
     6        Reviewed by Simon Fraser.
     7
     8        Remove test added by r118852 and add a test that verifies the original
     9        expected behavior.
     10
     11        * fast/css/text-overflow-ellipsis-hit-test-expected.txt: Removed.
     12        * fast/css/text-overflow-ellipsis-hit-test.html: Removed.
     13        * fast/flexbox/line-clamp-link-after-ellipsis-expected.txt: Added.
     14        * fast/flexbox/line-clamp-link-after-ellipsis.html: Added.
     15
    1162013-02-08  Stephen Chenney  <schenney@chromium.org>
    217
  • trunk/Source/WebCore/ChangeLog

    r142334 r142335  
     12013-02-08  Andy Estes  <aestes@apple.com>
     2
     3        Restore pre-r118852 behavior for EllipsisBox::nodeAtPoint()
     4        https://bugs.webkit.org/show_bug.cgi?id=109277
     5
     6        Reviewed by Simon Fraser.
     7
     8        Test: fast/flexbox/line-clamp-link-after-ellipsis.html
     9
     10        Roll out r118852. Enough time has passed that this can't be done
     11        mechanically, so transcribe the old method definition to current
     12        WebCore interfaces.
     13
     14        * rendering/EllipsisBox.cpp:
     15        (WebCore::EllipsisBox::markupBox): EllipsisBox no longer has
     16        m_markupBox, so break the logic for finding the markup box from
     17        paintMarkupBox() into its own function.
     18        (WebCore::EllipsisBox::paintMarkupBox): Call markupBox().
     19        (WebCore::EllipsisBox::nodeAtPoint): Transcribe the pre-r118852 implementation.
     20        * rendering/EllipsisBox.h:
     21        (EllipsisBox): Declare markupBox().
     22
    1232013-02-08  Eric Carlson  <eric.carlson@apple.com>
    224
  • trunk/Source/WebCore/rendering/EllipsisBox.cpp

    r139908 r142335  
    7070}
    7171
    72 void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle* style)
     72InlineBox* EllipsisBox::markupBox() const
    7373{
    7474    if (!m_shouldPaintMarkupBox || !m_renderer->isRenderBlock())
    75         return;
     75        return 0;
    7676
    7777    RenderBlock* block = toRenderBlock(m_renderer);
    7878    RootInlineBox* lastLine = block->lineAtIndex(block->lineCount() - 1);
    7979    if (!lastLine)
    80         return;
     80        return 0;
    8181
    8282    // If the last line-box on the last line of a block is a link, -webkit-line-clamp paints that box after the ellipsis.
     
    8484    InlineBox* anchorBox = lastLine->lastChild();
    8585    if (!anchorBox || !anchorBox->renderer()->style()->isLink())
     86        return 0;
     87
     88    return anchorBox;
     89}
     90
     91void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle* style)
     92{
     93    InlineBox* markupBox = this->markupBox();
     94    if (!markupBox)
    8695        return;
    8796
    8897    LayoutPoint adjustedPaintOffset = paintOffset;
    89     adjustedPaintOffset.move(x() + m_logicalWidth - anchorBox->x(),
    90         y() + style->fontMetrics().ascent() - (anchorBox->y() + anchorBox->renderer()->style(isFirstLineStyle())->fontMetrics().ascent()));
    91     anchorBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom);
     98    adjustedPaintOffset.move(x() + m_logicalWidth - markupBox->x(),
     99        y() + style->fontMetrics().ascent() - (markupBox->y() + markupBox->renderer()->style(isFirstLineStyle())->fontMetrics().ascent()));
     100    markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom);
    92101}
    93102
     
    122131}
    123132
    124 bool EllipsisBox::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, LayoutUnit, LayoutUnit)
     133bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
    125134{
     135    LayoutPoint adjustedLocation = accumulatedOffset + roundedLayoutPoint(topLeft());
     136
     137    // Hit test the markup box.
     138    if (InlineBox* markupBox = this->markupBox()) {
     139        RenderStyle* style = m_renderer->style(isFirstLineStyle());
     140        LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x();
     141        LayoutUnit mty = adjustedLocation.y() + style->fontMetrics().ascent() - (markupBox->y() + markupBox->renderer()->style(isFirstLineStyle())->fontMetrics().ascent());
     142        if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) {
     143            renderer()->updateHitTestResult(result, locationInContainer.point() - LayoutSize(mtx, mty));
     144            return true;
     145        }
     146    }
     147
     148    LayoutRect boundsRect(adjustedLocation, LayoutSize(m_logicalWidth, m_height));
     149    if (visibleToHitTesting() && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
     150        renderer()->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
     151        if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, locationInContainer, boundsRect))
     152            return true;
     153    }
     154
    126155    return false;
    127156}
  • trunk/Source/WebCore/rendering/EllipsisBox.h

    r126859 r142335  
    5050    virtual RenderObject::SelectionState selectionState() { return m_selectionState; }
    5151    void paintSelection(GraphicsContext*, const LayoutPoint&, RenderStyle*, const Font&);
     52    InlineBox* markupBox() const;
    5253
    5354    bool m_shouldPaintMarkupBox;
Note: See TracChangeset for help on using the changeset viewer.