Changeset 215124 in webkit


Ignore:
Timestamp:
Apr 7, 2017 3:48:22 PM (7 years ago)
Author:
Alan Bujtas
Message:

Simple line layout: FlowContents::segmentIndexForRunSlow skips empty runs.
https://bugs.webkit.org/show_bug.cgi?id=170552

Reviewed by Antti Koivisto.

Source/WebCore:

The compare function passed to std::lower_bound completely misses empty runs.

Test: fast/text/simple-line-layout-hover-over-subsequent-linebreaks.html

  • rendering/SimpleLineLayoutFlowContents.cpp:

(WebCore::SimpleLineLayout::FlowContents::segmentIndexForRunSlow):

LayoutTests:

  • fast/text/simple-line-layout-hover-over-subsequent-linebreaks-expected.txt: Added.
  • fast/text/simple-line-layout-hover-over-subsequent-linebreaks.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r215122 r215124  
     12017-04-07  Zalan Bujtas  <zalan@apple.com>
     2
     3        Simple line layout: FlowContents::segmentIndexForRunSlow skips empty runs.
     4        https://bugs.webkit.org/show_bug.cgi?id=170552
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/text/simple-line-layout-hover-over-subsequent-linebreaks-expected.txt: Added.
     9        * fast/text/simple-line-layout-hover-over-subsequent-linebreaks.html: Added.
     10
    1112017-04-07  Ryan Haddad  <ryanhaddad@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r215123 r215124  
     12017-04-07  Zalan Bujtas  <zalan@apple.com>
     2
     3        Simple line layout: FlowContents::segmentIndexForRunSlow skips empty runs.
     4        https://bugs.webkit.org/show_bug.cgi?id=170552
     5
     6        Reviewed by Antti Koivisto.
     7
     8        The compare function passed to std::lower_bound completely misses empty runs.
     9
     10        Test: fast/text/simple-line-layout-hover-over-subsequent-linebreaks.html
     11
     12        * rendering/SimpleLineLayoutFlowContents.cpp:
     13        (WebCore::SimpleLineLayout::FlowContents::segmentIndexForRunSlow):
     14
    1152017-04-07  Chris Dumez  <cdumez@apple.com>
    216
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp

    r211738 r215124  
    6969unsigned FlowContents::segmentIndexForRunSlow(unsigned start, unsigned end) const
    7070{
    71     auto it = std::lower_bound(m_segments.begin(), m_segments.end(), start, [](const Segment& segment, unsigned start) {
    72         return segment.end <= start;
     71    auto isEmptyRange = start == end;
     72    auto it = std::lower_bound(m_segments.begin(), m_segments.end(), start, [isEmptyRange](const Segment& segment, unsigned start) {
     73        // FIXME: This always find the first empty run (.vs subsequent <br> elements)
     74        return (isEmptyRange && segment.start == segment.end) ? segment.start < start : segment.end <= start;
    7375    });
    7476    ASSERT(it != m_segments.end());
    75     ASSERT_UNUSED(end, end <= it->end);
    76     auto index = it - m_segments.begin();
    77     m_lastSegmentIndex = index;
    78     return index;
     77    ASSERT(end <= it->end);
     78    m_lastSegmentIndex = it - m_segments.begin();
     79    return m_lastSegmentIndex;
    7980}
    8081
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp

    r215054 r215124  
    156156        auto lineRect = *it;
    157157        lineRect.moveBy(accumulatedOffset);
     158        auto& renderer = const_cast<RenderObject&>(it.renderer());
    158159        if (!locationInContainer.intersects(lineRect))
    159160            continue;
    160         auto& renderer = const_cast<RenderObject&>(it.renderer());
    161161        renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
    162162        if (!result.addNodeToRectBasedTestResult(renderer.node(), request, locationInContainer, lineRect))
Note: See TracChangeset for help on using the changeset viewer.