Skip to content
  • commit-queue@webkit.org's avatar
    Initial implementation of text-decoration-skip ink · 07c5362f
    commit-queue@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=121806
    
    Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2013-11-01
    Reviewed by Darin Adler.
    
    Source/WebCore:
    
    text-decoration-skip: ink is implemented by the following steps:
    1. Before drawing any decorations, figure out the bounding box for the decorations that will be drawn
    2. Create an ImageBuffer with these dimensions
    3. Draw text into this ImageBuffer with a thicker stroke
    4. Apply the ImageBuffer as a mask to the context
    5. Draw decorations like normal
    6. Clean up
    
    Test: fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink.html
    
    * platform/graphics/cg/GraphicsContextCG.cpp:
    (WebCore::computeLineBoundsAndAntialiasingModeForText): Don't call GraphicsContext::roundToDevicePixels
    when painting is disabled
    * rendering/InlineTextBox.cpp:
    (WebCore::InlineTextBox::paint): Pass the TextPainter to paintDecoration
    (WebCore::computeUnderlineOffset): Small cleanup
    (WebCore::getWavyStrokeControlPointDistance): Pulling out of strokeWavyTextDecoration()
    (WebCore::getWavyStrokeStep): Ditto
    (WebCore::strokeWavyTextDecoration): Use the previous 2 functions
    (WebCore::getSingleDecorationBoundingBox): Pulling out repeated code into a function
    (WebCore::getDecorationBoundingBox): Compute the bounding box for an underline which
    hasn't been drawn yet
    (WebCore::InlineTextBox::paintDecoration): Construct a mask and apply it to the GraphicsContext
    * rendering/InlineTextBox.h: paintDecoration needs the TextPainter
    * rendering/style/RenderStyle.cpp:
    (WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline): Redraw the underline when
    text-decoration-skip changes
    
    LayoutTests:
    
    Adding a test which draws a very large "p" with text-decoration-skip:ink. The
    viewport is restricted to be just hugging the place where an underline would
    intersect the descender of the "p". This should look the same as if there was
    no underline at all (because of the skipping underline).
    
    * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink-expected.html: Added.
    * fast/css3-text/css3-text-decoration/text-decoration-skip/text-decoration-skip-ink.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158467 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    07c5362f