Changeset 233075 in webkit


Ignore:
Timestamp:
Jun 22, 2018 2:49:55 AM (6 years ago)
Author:
magomez@igalia.com
Message:

[WPE][ThreadedRendering] WPE crashes rendering some pieces of text when using ThreadedRendering
https://bugs.webkit.org/show_bug.cgi?id=186886

Reviewed by Žan Doberšek.

Modify DisplayList DrawGlyphs element to use a GraphicsContext for replaying. To do so, modify
GraphicsContext::drawGlyphs() API so it doesn't require a FontCascade, and update all the calls
to it.

Covered by existent tests.

  • platform/graphics/FontCascade.cpp:

(WebCore::FontCascade::drawGlyphBuffer const):

  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::drawGlyphs):

  • platform/graphics/GraphicsContext.h:
  • platform/graphics/displaylists/DisplayListItems.cpp:

(WebCore::DisplayList::DrawGlyphs::apply const):

  • rendering/mathml/MathOperator.cpp:

(WebCore::MathOperator::paintGlyph):
(WebCore::MathOperator::paint):

  • rendering/mathml/RenderMathMLToken.cpp:

(WebCore::RenderMathMLToken::paint):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r233066 r233075  
     12018-06-22  Miguel Gomez  <magomez@igalia.com>
     2
     3        [WPE][ThreadedRendering] WPE crashes rendering some pieces of text when using ThreadedRendering
     4        https://bugs.webkit.org/show_bug.cgi?id=186886
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Modify DisplayList DrawGlyphs element to use a GraphicsContext for replaying. To do so, modify
     9        GraphicsContext::drawGlyphs() API so it doesn't require a FontCascade, and update all the calls
     10        to it.
     11
     12        Covered by existent tests.
     13
     14        * platform/graphics/FontCascade.cpp:
     15        (WebCore::FontCascade::drawGlyphBuffer const):
     16        * platform/graphics/GraphicsContext.cpp:
     17        (WebCore::GraphicsContext::drawGlyphs):
     18        * platform/graphics/GraphicsContext.h:
     19        * platform/graphics/displaylists/DisplayListItems.cpp:
     20        (WebCore::DisplayList::DrawGlyphs::apply const):
     21        * rendering/mathml/MathOperator.cpp:
     22        (WebCore::MathOperator::paintGlyph):
     23        (WebCore::MathOperator::paint):
     24        * rendering/mathml/RenderMathMLToken.cpp:
     25        (WebCore::RenderMathMLToken::paint):
     26
    1272018-06-15  Jer Noble  <jer.noble@apple.com>
    228
  • trunk/Source/WebCore/platform/graphics/FontCascade.cpp

    r232175 r233075  
    14311431        if (nextFontData != fontData || nextOffset != offset) {
    14321432            if (shouldDrawIfLoading(*fontData, customFontNotReadyAction))
    1433                 context.drawGlyphs(*this, *fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
     1433                context.drawGlyphs(*fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint, m_fontDescription.fontSmoothing());
    14341434
    14351435            lastFrom = nextGlyph;
     
    14451445
    14461446    if (shouldDrawIfLoading(*fontData, customFontNotReadyAction))
    1447         context.drawGlyphs(*this, *fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
     1447        context.drawGlyphs(*fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint, m_fontDescription.fontSmoothing());
    14481448    point.setX(nextX);
    14491449}
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r232246 r233075  
    641641}
    642642
    643 void GraphicsContext::drawGlyphs(const FontCascade& fontCascade, const Font& font, const GlyphBuffer& buffer, unsigned from, unsigned numGlyphs, const FloatPoint& point)
    644 {
    645     if (paintingDisabled())
    646         return;
    647 
    648     if (m_impl) {
    649         m_impl->drawGlyphs(font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
    650         return;
    651     }
    652 
    653     fontCascade.drawGlyphs(*this, font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
     643void GraphicsContext::drawGlyphs(const Font& font, const GlyphBuffer& buffer, unsigned from, unsigned numGlyphs, const FloatPoint& point, FontSmoothingMode fontSmoothingMode)
     644{
     645    if (paintingDisabled())
     646        return;
     647
     648    if (m_impl) {
     649        m_impl->drawGlyphs(font, buffer, from, numGlyphs, point, fontSmoothingMode);
     650        return;
     651    }
     652
     653    FontCascade::drawGlyphs(*this, font, buffer, from, numGlyphs, point, fontSmoothingMode);
    654654}
    655655
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r232246 r233075  
    397397
    398398    float drawText(const FontCascade&, const TextRun&, const FloatPoint&, unsigned from = 0, std::optional<unsigned> to = std::nullopt);
    399     void drawGlyphs(const FontCascade&, const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&);
     399    void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&, FontSmoothingMode);
    400400    void drawEmphasisMarks(const FontCascade&, const TextRun&, const AtomicString& mark, const FloatPoint&, unsigned from = 0, std::optional<unsigned> to = std::nullopt);
    401401    void drawBidiText(const FontCascade&, const TextRun&, const FloatPoint&, FontCascade::CustomFontNotReadyAction = FontCascade::DoNotPaintIfFontNotReady);
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp

    r222610 r233075  
    372372void DrawGlyphs::apply(GraphicsContext& context) const
    373373{
    374     FontCascade::drawGlyphs(context, m_font, generateGlyphBuffer(), 0, m_glyphs.size(), anchorPoint(), m_smoothingMode);
     374    context.drawGlyphs(m_font, generateGlyphBuffer(), 0, m_glyphs.size(), anchorPoint(), m_smoothingMode);
    375375}
    376376
  • trunk/Source/WebCore/rendering/mathml/MathOperator.cpp

    r232178 r233075  
    540540    GlyphBuffer buffer;
    541541    buffer.add(data.glyph, data.font, advanceWidthForGlyph(data));
    542     info.context().drawGlyphs(style.fontCascade(), *data.font, buffer, 0, 1, origin);
     542    info.context().drawGlyphs(*data.font, buffer, 0, 1, origin, style.fontCascade().fontDescription().fontSmoothing());
    543543
    544544    return glyphPaintRect;
     
    747747    FloatRect glyphBounds = boundsForGlyph(glyphData);
    748748    LayoutPoint operatorOrigin(operatorTopLeft.x(), operatorTopLeft.y() - glyphBounds.y());
    749     paintInfo.context().drawGlyphs(style.fontCascade(), *glyphData.font, buffer, 0, 1, operatorOrigin);
     749    paintInfo.context().drawGlyphs(*glyphData.font, buffer, 0, 1, operatorOrigin, style.fontCascade().fontDescription().fontSmoothing());
    750750}
    751751
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp

    r232178 r233075  
    608608    buffer.add(mathVariantGlyph.glyph, mathVariantGlyph.font, mathVariantGlyph.font->widthForGlyph(mathVariantGlyph.glyph));
    609609    LayoutUnit glyphAscent = static_cast<int>(lroundf(-mathVariantGlyph.font->boundsForGlyph(mathVariantGlyph.glyph).y()));
    610     info.context().drawGlyphs(style().fontCascade(), *mathVariantGlyph.font, buffer, 0, 1, paintOffset + location() + LayoutPoint(0, glyphAscent));
     610    info.context().drawGlyphs(*mathVariantGlyph.font, buffer, 0, 1, paintOffset + location() + LayoutPoint(0, glyphAscent), style().fontCascade().fontDescription().fontSmoothing());
    611611}
    612612
Note: See TracChangeset for help on using the changeset viewer.