[WPE][ThreadedRendering] WPE crashes rendering some pieces of text when using Threade...
authormagomez@igalia.com <magomez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2018 09:49:55 +0000 (09:49 +0000)
committermagomez@igalia.com <magomez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2018 09:49:55 +0000 (09:49 +0000)
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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@233075 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp
Source/WebCore/rendering/mathml/MathOperator.cpp
Source/WebCore/rendering/mathml/RenderMathMLToken.cpp

index 56f26de..25497b0 100644 (file)
@@ -1,3 +1,29 @@
+2018-06-22  Miguel Gomez  <magomez@igalia.com>
+
+        [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):
+
 2018-06-15  Jer Noble  <jer.noble@apple.com>
 
         Address fullscreen api CSS env feedback
index bfbcb83..79c9aa6 100644 (file)
@@ -1430,7 +1430,7 @@ void FontCascade::drawGlyphBuffer(GraphicsContext& context, const GlyphBuffer& g
 
         if (nextFontData != fontData || nextOffset != offset) {
             if (shouldDrawIfLoading(*fontData, customFontNotReadyAction))
-                context.drawGlyphs(*this, *fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
+                context.drawGlyphs(*fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint, m_fontDescription.fontSmoothing());
 
             lastFrom = nextGlyph;
             fontData = nextFontData;
@@ -1444,7 +1444,7 @@ void FontCascade::drawGlyphBuffer(GraphicsContext& context, const GlyphBuffer& g
     }
 
     if (shouldDrawIfLoading(*fontData, customFontNotReadyAction))
-        context.drawGlyphs(*this, *fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
+        context.drawGlyphs(*fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint, m_fontDescription.fontSmoothing());
     point.setX(nextX);
 }
 
index bc3b651..1e0f2b8 100644 (file)
@@ -640,17 +640,17 @@ float GraphicsContext::drawText(const FontCascade& font, const TextRun& run, con
     return font.drawText(*this, run, point, from, to);
 }
 
-void GraphicsContext::drawGlyphs(const FontCascade& fontCascade, const Font& font, const GlyphBuffer& buffer, unsigned from, unsigned numGlyphs, const FloatPoint& point)
+void GraphicsContext::drawGlyphs(const Font& font, const GlyphBuffer& buffer, unsigned from, unsigned numGlyphs, const FloatPoint& point, FontSmoothingMode fontSmoothingMode)
 {
     if (paintingDisabled())
         return;
 
     if (m_impl) {
-        m_impl->drawGlyphs(font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
+        m_impl->drawGlyphs(font, buffer, from, numGlyphs, point, fontSmoothingMode);
         return;
     }
 
-    fontCascade.drawGlyphs(*this, font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
+    FontCascade::drawGlyphs(*this, font, buffer, from, numGlyphs, point, fontSmoothingMode);
 }
 
 void GraphicsContext::drawEmphasisMarks(const FontCascade& font, const TextRun& run, const AtomicString& mark, const FloatPoint& point, unsigned from, std::optional<unsigned> to)
index 61112a0..40a9691 100644 (file)
@@ -396,7 +396,7 @@ public:
     TextDrawingModeFlags textDrawingMode() const { return m_state.textDrawingMode; }
 
     float drawText(const FontCascade&, const TextRun&, const FloatPoint&, unsigned from = 0, std::optional<unsigned> to = std::nullopt);
-    void drawGlyphs(const FontCascade&, const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&);
+    void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint&, FontSmoothingMode);
     void drawEmphasisMarks(const FontCascade&, const TextRun&, const AtomicString& mark, const FloatPoint&, unsigned from = 0, std::optional<unsigned> to = std::nullopt);
     void drawBidiText(const FontCascade&, const TextRun&, const FloatPoint&, FontCascade::CustomFontNotReadyAction = FontCascade::DoNotPaintIfFontNotReady);
 
index e88c448..1fcee8b 100644 (file)
@@ -371,7 +371,7 @@ inline GlyphBuffer DrawGlyphs::generateGlyphBuffer() const
 
 void DrawGlyphs::apply(GraphicsContext& context) const
 {
-    FontCascade::drawGlyphs(context, m_font, generateGlyphBuffer(), 0, m_glyphs.size(), anchorPoint(), m_smoothingMode);
+    context.drawGlyphs(m_font, generateGlyphBuffer(), 0, m_glyphs.size(), anchorPoint(), m_smoothingMode);
 }
 
 void DrawGlyphs::computeBounds()
index 83544fd..85e02a4 100644 (file)
@@ -539,7 +539,7 @@ LayoutRect MathOperator::paintGlyph(const RenderStyle& style, PaintInfo& info, c
 
     GlyphBuffer buffer;
     buffer.add(data.glyph, data.font, advanceWidthForGlyph(data));
-    info.context().drawGlyphs(style.fontCascade(), *data.font, buffer, 0, 1, origin);
+    info.context().drawGlyphs(*data.font, buffer, 0, 1, origin, style.fontCascade().fontDescription().fontSmoothing());
 
     return glyphPaintRect;
 }
@@ -746,7 +746,7 @@ void MathOperator::paint(const RenderStyle& style, PaintInfo& info, const Layout
     LayoutPoint operatorTopLeft = paintOffset;
     FloatRect glyphBounds = boundsForGlyph(glyphData);
     LayoutPoint operatorOrigin(operatorTopLeft.x(), operatorTopLeft.y() - glyphBounds.y());
-    paintInfo.context().drawGlyphs(style.fontCascade(), *glyphData.font, buffer, 0, 1, operatorOrigin);
+    paintInfo.context().drawGlyphs(*glyphData.font, buffer, 0, 1, operatorOrigin, style.fontCascade().fontDescription().fontSmoothing());
 }
 
 }
index 44621f1..64e3a8c 100644 (file)
@@ -607,7 +607,7 @@ void RenderMathMLToken::paint(PaintInfo& info, const LayoutPoint& paintOffset)
     GlyphBuffer buffer;
     buffer.add(mathVariantGlyph.glyph, mathVariantGlyph.font, mathVariantGlyph.font->widthForGlyph(mathVariantGlyph.glyph));
     LayoutUnit glyphAscent = static_cast<int>(lroundf(-mathVariantGlyph.font->boundsForGlyph(mathVariantGlyph.glyph).y()));
-    info.context().drawGlyphs(style().fontCascade(), *mathVariantGlyph.font, buffer, 0, 1, paintOffset + location() + LayoutPoint(0, glyphAscent));
+    info.context().drawGlyphs(*mathVariantGlyph.font, buffer, 0, 1, paintOffset + location() + LayoutPoint(0, glyphAscent), style().fontCascade().fontDescription().fontSmoothing());
 }
 
 void RenderMathMLToken::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect)