Changeset 199516 in webkit


Ignore:
Timestamp:
Apr 13, 2016 3:11:46 PM (8 years ago)
Author:
Alan Bujtas
Message:

Text on compositing layer with negative letter-spacing is truncated.
https://bugs.webkit.org/show_bug.cgi?id=156550
<rdar://problem/24212140>

Reviewed by Antti Koivisto.

Negative letter-spacing affects the right edge of content's visual overflow (for both RTL and LTR).
This is similar to how normal line layout adjusts it at InlineFlowBox::addTextBoxVisualOverflow().

Source/WebCore:

Test: fast/text/negative-letter-spacing-visual-overflow.html

  • rendering/SimpleLineLayoutFunctions.cpp:

(WebCore::SimpleLineLayout::computeOverflow):
(WebCore::SimpleLineLayout::paintFlow):
(WebCore::SimpleLineLayout::collectFlowOverflow):

LayoutTests:

  • fast/text/negative-letter-spacing-visual-overflow-expected.html: Added.
  • fast/text/negative-letter-spacing-visual-overflow.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r199515 r199516  
     12016-04-13  Zalan Bujtas  <zalan@apple.com>
     2
     3        Text on compositing layer with negative letter-spacing is truncated.
     4        https://bugs.webkit.org/show_bug.cgi?id=156550
     5        <rdar://problem/24212140>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Negative letter-spacing affects the right edge of content's visual overflow (for both RTL and LTR).
     10        This is similar to how normal line layout adjusts it at InlineFlowBox::addTextBoxVisualOverflow().
     11
     12        * fast/text/negative-letter-spacing-visual-overflow-expected.html: Added.
     13        * fast/text/negative-letter-spacing-visual-overflow.html: Added.
     14
    1152016-04-13  Eric Carlson  <eric.carlson@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r199515 r199516  
     12016-04-13  Zalan Bujtas  <zalan@apple.com>
     2
     3        Text on compositing layer with negative letter-spacing is truncated.
     4        https://bugs.webkit.org/show_bug.cgi?id=156550
     5        <rdar://problem/24212140>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Negative letter-spacing affects the right edge of content's visual overflow (for both RTL and LTR).
     10        This is similar to how normal line layout adjusts it at InlineFlowBox::addTextBoxVisualOverflow().
     11
     12        Test: fast/text/negative-letter-spacing-visual-overflow.html
     13
     14        * rendering/SimpleLineLayoutFunctions.cpp:
     15        (WebCore::SimpleLineLayout::computeOverflow):
     16        (WebCore::SimpleLineLayout::paintFlow):
     17        (WebCore::SimpleLineLayout::collectFlowOverflow):
     18
    1192016-04-13  Eric Carlson  <eric.carlson@apple.com>
    220
  • trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp

    r197987 r199516  
    6666}
    6767
     68static FloatRect computeOverflow(const RenderBlockFlow& flow, const FloatRect& layoutRect)
     69{
     70    auto overflowRect = layoutRect;
     71    auto strokeOverflow = std::ceil(flow.style().textStrokeWidth());
     72    overflowRect.inflate(strokeOverflow);
     73
     74    auto letterSpacing = flow.style().fontCascade().letterSpacing();
     75    if (letterSpacing >= 0)
     76        return overflowRect;
     77    // Last letter's negative spacing shrinks layout rect. Push it to visual overflow.
     78    overflowRect.expand(-letterSpacing, 0);
     79    return overflowRect;
     80}
     81
    6882void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
    6983{
     
    95109
    96110    auto resolver = runResolver(flow, layout);
    97     float strokeOverflow = std::ceil(flow.style().textStrokeWidth());
    98111    float deviceScaleFactor = flow.document().deviceScaleFactor();
    99112    for (auto run : resolver.rangeForRect(paintRect)) {
     
    102115
    103116        FloatRect rect = run.rect();
    104         FloatRect visualOverflowRect = rect;
    105         visualOverflowRect.inflate(strokeOverflow);
     117        FloatRect visualOverflowRect = computeOverflow(flow, rect);
    106118        if (paintRect.y() > visualOverflowRect.maxY() || paintRect.maxY() < visualOverflowRect.y())
    107119            continue;
     
    152164void collectFlowOverflow(RenderBlockFlow& flow, const Layout& layout)
    153165{
    154     float strokeOverflow = std::ceil(flow.style().textStrokeWidth());
    155     for (FloatRect lineRect : lineResolver(flow, layout)) {
    156         LayoutRect inflatedLineRect(lineRect);
    157         inflatedLineRect.inflate(strokeOverflow);
    158         flow.addLayoutOverflow(inflatedLineRect);
    159         flow.addVisualOverflow(inflatedLineRect);
     166    for (auto lineRect : lineResolver(flow, layout)) {
     167        LayoutRect visualOverflowRect = LayoutRect(computeOverflow(flow, lineRect));
     168        flow.addLayoutOverflow(LayoutRect(lineRect));
     169        flow.addVisualOverflow(visualOverflowRect);
    160170    }
    161171}
Note: See TracChangeset for help on using the changeset viewer.