Changeset 168624 in webkit


Ignore:
Timestamp:
May 12, 2014 10:56:17 AM (10 years ago)
Author:
Antti Koivisto
Message:

REGRESSION (r159560): Text clips on tile border if line-height < font-size
https://bugs.webkit.org/show_bug.cgi?id=132822

Reviewed by Andreas Kling.

Source/WebCore:

The first line of simple line layout run range was miscomputed.

Test: fast/text/simple-lines-range-low-line-height.html

  • rendering/SimpleLineLayoutResolver.h:

(WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):

Lines may overlap if line-height < font-size. Apply different adjustment when searching for range begin
so that overflowing earlier lines are taken into account.

(WebCore::SimpleLineLayout::RunResolver::rangeForRect):

LayoutTests:

  • fast/text/simple-lines-range-low-line-height-expected.html: Added.
  • fast/text/simple-lines-range-low-line-height.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r168622 r168624  
     12014-05-12  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r159560): Text clips on tile border if line-height < font-size
     4        https://bugs.webkit.org/show_bug.cgi?id=132822
     5
     6        Reviewed by Andreas Kling.
     7
     8        * fast/text/simple-lines-range-low-line-height-expected.html: Added.
     9        * fast/text/simple-lines-range-low-line-height.html: Added.
     10
    1112014-05-12  Krzysztof Wolanski  <k.wolanski@samsung.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r168621 r168624  
     12014-05-12  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r159560): Text clips on tile border if line-height < font-size
     4        https://bugs.webkit.org/show_bug.cgi?id=132822
     5
     6        Reviewed by Andreas Kling.
     7       
     8        The first line of simple line layout run range was miscomputed.
     9
     10        Test: fast/text/simple-lines-range-low-line-height.html
     11
     12        * rendering/SimpleLineLayoutResolver.h:
     13        (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
     14       
     15            Lines may overlap if line-height < font-size. Apply different adjustment when searching for range begin
     16            so that overflowing earlier lines are taken into account.
     17
     18        (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
     19
    1202014-05-12  Radu Stavila  <stavila@adobe.com>
    221
  • trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h

    r167580 r168624  
    103103
    104104private:
    105     unsigned lineIndexForHeight(LayoutUnit) const;
     105    enum class IndexType { First, Last };
     106    unsigned lineIndexForHeight(LayoutUnit, IndexType) const;
    106107
    107108    const Layout& m_layout;
     
    271272}
    272273
    273 inline unsigned RunResolver::lineIndexForHeight(LayoutUnit height) const
     274inline unsigned RunResolver::lineIndexForHeight(LayoutUnit height, IndexType type) const
    274275{
    275276    ASSERT(m_lineHeight);
    276     float y = std::max<float>(height - m_borderAndPaddingBefore - m_baseline + m_ascent, 0);
     277    float y = height - m_borderAndPaddingBefore;
     278    // Lines may overlap, adjust to get the first or last line at this height.
     279    if (type == IndexType::First)
     280        y += m_lineHeight - (m_baseline + m_descent);
     281    else
     282        y -= m_baseline - m_ascent;
     283    y = std::max<float>(y, 0);
    277284    return std::min<unsigned>(y / m_lineHeight, m_layout.lineCount() - 1);
    278285}
     
    283290        return Range<Iterator>(begin(), end());
    284291
    285     unsigned firstLine = lineIndexForHeight(rect.y());
    286     unsigned lastLine = std::max(firstLine, lineIndexForHeight(rect.maxY()));
     292    unsigned firstLine = lineIndexForHeight(rect.y(), IndexType::First);
     293    unsigned lastLine = std::max(firstLine, lineIndexForHeight(rect.maxY(), IndexType::Last));
    287294
    288295    auto rangeBegin = begin().advanceLines(firstLine);
Note: See TracChangeset for help on using the changeset viewer.