Changeset 159345 in webkit


Ignore:
Timestamp:
Nov 15, 2013 10:32:34 AM (10 years ago)
Author:
Antti Koivisto
Message:

Hovering over text using simple line path should not cause switch to line boxes
https://bugs.webkit.org/show_bug.cgi?id=124418

Reviewed by Anders Carlsson.

Source/WebCore:

Test: fast/text/simple-lines-hover.html

  • rendering/RenderText.cpp:

(WebCore::RenderText::absoluteRects):
(WebCore::RenderText::absoluteQuadsClippedToEllipsis):
(WebCore::RenderText::absoluteQuads):

Collect quads and rects directly from simple lines without requiring the line box switch.

  • rendering/SimpleLineLayoutFunctions.cpp:

(WebCore::SimpleLineLayout::collectTextAbsoluteRects):
(WebCore::SimpleLineLayout::collectTextAbsoluteQuads):

Add these.

  • rendering/SimpleLineLayoutFunctions.h:
  • rendering/SimpleLineLayoutResolver.h:

(WebCore::SimpleLineLayout::RunResolver::Run::start):
(WebCore::SimpleLineLayout::RunResolver::Run::end):

For future use.

LayoutTests:

  • fast/text/simple-lines-hover-expected.html: Added.
  • fast/text/simple-lines-hover.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159344 r159345  
     12013-11-15  Antti Koivisto  <antti@apple.com>
     2
     3        Hovering over text using simple line path should not cause switch to line boxes
     4        https://bugs.webkit.org/show_bug.cgi?id=124418
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * fast/text/simple-lines-hover-expected.html: Added.
     9        * fast/text/simple-lines-hover.html: Added.
     10
    1112013-11-15  Zoltan Horvath  <zoltan@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r159337 r159345  
     12013-11-15  Antti Koivisto  <antti@apple.com>
     2
     3        Hovering over text using simple line path should not cause switch to line boxes
     4        https://bugs.webkit.org/show_bug.cgi?id=124418
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Test: fast/text/simple-lines-hover.html
     9
     10        * rendering/RenderText.cpp:
     11        (WebCore::RenderText::absoluteRects):
     12        (WebCore::RenderText::absoluteQuadsClippedToEllipsis):
     13        (WebCore::RenderText::absoluteQuads):
     14       
     15            Collect quads and rects directly from simple lines without requiring the line box switch.
     16
     17        * rendering/SimpleLineLayoutFunctions.cpp:
     18        (WebCore::SimpleLineLayout::collectTextAbsoluteRects):
     19        (WebCore::SimpleLineLayout::collectTextAbsoluteQuads):
     20       
     21            Add these.
     22
     23        * rendering/SimpleLineLayoutFunctions.h:
     24        * rendering/SimpleLineLayoutResolver.h:
     25        (WebCore::SimpleLineLayout::RunResolver::Run::start):
     26        (WebCore::SimpleLineLayout::RunResolver::Run::end):
     27       
     28            For future use.
     29
    1302013-11-15  Radu Stavila  <stavila@adobe.com>
    231
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r159027 r159345  
    277277void RenderText::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
    278278{
    279     // FIXME: These will go away when simple layout can do everything.
    280     const_cast<RenderText&>(*this).ensureLineBoxes();
    281 
     279    if (auto layout = simpleLineLayout()) {
     280        rects.appendVector(collectTextAbsoluteRects(*this, *layout, accumulatedOffset));
     281        return;
     282    }
    282283    rects.appendVector(m_lineBoxes.absoluteRects(accumulatedOffset));
    283284}
     
    302303Vector<FloatQuad> RenderText::absoluteQuadsClippedToEllipsis() const
    303304{
    304     const_cast<RenderText&>(*this).ensureLineBoxes();
    305 
     305    if (auto layout = simpleLineLayout()) {
     306        ASSERT(style().textOverflow() != TextOverflowEllipsis);
     307        return collectTextAbsoluteQuads(*this, *layout, nullptr);
     308    }
    306309    return m_lineBoxes.absoluteQuads(*this, nullptr, RenderTextLineBoxes::ClipToEllipsis);
    307310}
     
    309312void RenderText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
    310313{
    311     const_cast<RenderText&>(*this).ensureLineBoxes();
    312 
     314    if (auto layout = simpleLineLayout()) {
     315        quads.appendVector(collectTextAbsoluteQuads(*this, *layout, wasFixed));
     316        return;
     317    }
    313318    quads.appendVector(m_lineBoxes.absoluteQuads(*this, wasFixed, RenderTextLineBoxes::NoClipping));
    314319}
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp

    r159030 r159345  
    156156}
    157157
     158Vector<IntRect> collectTextAbsoluteRects(const RenderText& textRenderer, const Layout& layout, const LayoutPoint& accumulatedOffset)
     159{
     160    Vector<IntRect> rects;
     161    auto resolver = runResolver(toRenderBlockFlow(*textRenderer.parent()), layout);
     162    for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
     163        auto run = *it;
     164        auto rect = run.rect();
     165        rects.append(enclosingIntRect(FloatRect(accumulatedOffset + rect.location(), rect.size())));
     166    }
     167    return rects;
     168}
     169
     170Vector<FloatQuad> collectTextAbsoluteQuads(const RenderText& textRenderer, const Layout& layout, bool* wasFixed)
     171{
     172    Vector<FloatQuad> quads;
     173    auto resolver = runResolver(toRenderBlockFlow(*textRenderer.parent()), layout);
     174    for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) {
     175        auto run = *it;
     176        auto rect = run.rect();
     177        quads.append(textRenderer.localToAbsoluteQuad(FloatQuad(rect), 0, wasFixed));
     178    }
     179    return quads;
     180}
     181
    158182}
    159183}
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h

    r159032 r159345  
    5656unsigned findTextCaretMaximumOffset(const RenderText&, const Layout&);
    5757IntRect computeTextBoundingBox(const RenderText&, const Layout&);
     58
     59Vector<IntRect> collectTextAbsoluteRects(const RenderText&, const Layout&, const LayoutPoint& accumulatedOffset);
     60Vector<FloatQuad> collectTextAbsoluteQuads(const RenderText&, const Layout&, bool* wasFixed);
    5861
    5962LayoutUnit lineHeightFromFlow(const RenderBlockFlow&);
  • trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h

    r159105 r159345  
    4545        explicit Run(const Iterator&);
    4646
     47        unsigned start() const;
     48        unsigned end() const;
     49
    4750        LayoutRect rect() const;
    4851        FloatPoint baseline() const;
     
    126129}
    127130
     131inline unsigned RunResolver::Run::start() const
     132{
     133    return m_iterator.simpleRun().start;
     134}
     135
     136inline unsigned RunResolver::Run::end() const
     137{
     138    return m_iterator.simpleRun().end;
     139}
     140
    128141inline LayoutRect RunResolver::Run::rect() const
    129142{
Note: See TracChangeset for help on using the changeset viewer.