Title: [283577] trunk/Source/WebCore

Diff

Modified: trunk/Source/WebCore/ChangeLog (283576 => 283577)


--- trunk/Source/WebCore/ChangeLog	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/ChangeLog	2021-10-05 22:29:22 UTC (rev 283577)
@@ -1,3 +1,16 @@
+2021-10-05  Ayumi Kojima  <[email protected]>
+
+        Unreviewed, reverting r283339.
+
+        Reverting because this commit may have caused fast/attachment
+        tests to crash
+
+        Reverted changeset:
+
+        "[iOS][GPU Process] support `<attachment>`"
+        https://bugs.webkit.org/show_bug.cgi?id=230781
+        https://commits.webkit.org/r283339
+
 2021-10-05  Patrick Angle  <[email protected]>
 
         Web Inspector: Show color space for canvases in the Graphics tab on the overview cards

Modified: trunk/Source/WebCore/PAL/ChangeLog (283576 => 283577)


--- trunk/Source/WebCore/PAL/ChangeLog	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/PAL/ChangeLog	2021-10-05 22:29:22 UTC (rev 283577)
@@ -1,3 +1,16 @@
+2021-10-05  Ayumi Kojima  <[email protected]>
+
+        Unreviewed, reverting r283339.
+
+        Reverting because this commit may have caused fast/attachment
+        tests to crash
+
+        Reverted changeset:
+
+        "[iOS][GPU Process] support `<attachment>`"
+        https://bugs.webkit.org/show_bug.cgi?id=230781
+        https://commits.webkit.org/r283339
+
 2021-10-03  David Kilzer  <[email protected]>
 
         Build fix: Attribute IOSurfaces created by camera and decoders to responsible WebProcess

Modified: trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h (283576 => 283577)


--- trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h	2021-10-05 22:29:22 UTC (rev 283577)
@@ -270,7 +270,6 @@
 void CGContextDelegateRelease(CGContextDelegateRef);
 CGFloat CGGStateGetAlpha(CGGStateRef);
 CGFontRef CGGStateGetFont(CGGStateRef);
-CGFloat CGGStateGetFontSize(CGGStateRef);
 const CGAffineTransform *CGGStateGetCTM(CGGStateRef);
 CGColorRef CGGStateGetFillColor(CGGStateRef);
 CGColorRef CGGStateGetStrokeColor(CGGStateRef);

Modified: trunk/Source/WebCore/platform/graphics/DrawGlyphsRecorder.h (283576 => 283577)


--- trunk/Source/WebCore/platform/graphics/DrawGlyphsRecorder.h	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/platform/graphics/DrawGlyphsRecorder.h	2021-10-05 22:29:22 UTC (rev 283577)
@@ -35,12 +35,6 @@
 
 #if USE(CORE_TEXT)
 #include <CoreGraphics/CoreGraphics.h>
-#include <CoreText/CoreText.h>
-#if PLATFORM(WIN)
-#include <pal/spi/win/CoreTextSPIWin.h>
-#else
-#include <pal/spi/cf/CoreTextSPI.h>
-#endif
 #include <pal/spi/cg/CoreGraphicsSPI.h>
 #endif
 
@@ -53,15 +47,15 @@
 
 class DrawGlyphsRecorder {
 public:
-    enum class DeconstructDrawGlyphs : bool { No, Yes };
-    enum class DeriveFontFromContext : bool { No, Yes };
-    explicit DrawGlyphsRecorder(GraphicsContext&, DeconstructDrawGlyphs = DeconstructDrawGlyphs::No, DeriveFontFromContext = DeriveFontFromContext::No);
+    enum class DrawGlyphsDeconstruction {
+        Deconstruct,
+        DontDeconstruct
+    };
+    explicit DrawGlyphsRecorder(GraphicsContext&, DrawGlyphsDeconstruction);
 
     void drawGlyphs(const Font&, const GlyphBufferGlyph*, const GlyphBufferAdvance*, unsigned numGlyphs, const FloatPoint& anchorPoint, FontSmoothingMode);
 
 #if USE(CORE_TEXT) && !PLATFORM(WIN)
-    void drawNativeText(CTFontRef, CGFloat fontSize, CTLineRef, CGRect lineRect);
-
     void recordBeginLayer(CGRenderingStateRef, CGGStateRef, CGRect);
     void recordEndLayer(CGRenderingStateRef, CGGStateRef);
     void recordDrawGlyphs(CGRenderingStateRef, CGGStateRef, const CGAffineTransform*, const CGGlyph[], const CGPoint positions[], size_t count);
@@ -68,7 +62,7 @@
     void recordDrawImage(CGRenderingStateRef, CGGStateRef, CGRect, CGImageRef);
 #endif
 
-    DeconstructDrawGlyphs deconstructDrawGlyphs() const { return m_deconstructDrawGlyphs; }
+    DrawGlyphsDeconstruction drawGlyphsDeconstruction() const { return m_drawGlyphsDeconstruction; }
 
 private:
 #if USE(CORE_TEXT) && !PLATFORM(WIN)
@@ -95,8 +89,7 @@
 #endif
 
     GraphicsContext& m_owner;
-    DeconstructDrawGlyphs m_deconstructDrawGlyphs;
-    DeriveFontFromContext m_deriveFontFromContext;
+    DrawGlyphsDeconstruction m_drawGlyphsDeconstruction;
 
 #if USE(CORE_TEXT) && !PLATFORM(WIN)
     UniqueRef<GraphicsContext> m_internalContext;

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (283576 => 283577)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2021-10-05 22:29:22 UTC (rev 283577)
@@ -213,7 +213,7 @@
         return nullptr;
     
     std::unique_ptr<DisplayList::InMemoryDisplayList> displayList = makeUnique<DisplayList::InMemoryDisplayList>();
-    DisplayList::Recorder recordingContext(*displayList, context.state(), FloatRect(), AffineTransform(), nullptr, DrawGlyphsRecorder::DeconstructDrawGlyphs::No);
+    DisplayList::Recorder recordingContext(*displayList, context.state(), FloatRect(), AffineTransform(), nullptr, DrawGlyphsRecorder::DrawGlyphsDeconstruction::DontDeconstruct);
     
     FloatPoint startPoint = toFloatPoint(WebCore::size(glyphBuffer.initialAdvance()));
     drawGlyphBuffer(recordingContext, glyphBuffer, startPoint, customFontNotReadyAction);

Modified: trunk/Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp (283576 => 283577)


--- trunk/Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp	2021-10-05 22:29:22 UTC (rev 283577)
@@ -31,7 +31,6 @@
 #include "FloatPoint.h"
 #include "Font.h"
 #include "FontCascade.h"
-#include "FontPlatformData.h"
 #include "GlyphBuffer.h"
 #include "GraphicsContextCG.h"
 
@@ -85,10 +84,9 @@
     return makeUniqueRef<GraphicsContextCG>(context.get());
 }
 
-DrawGlyphsRecorder::DrawGlyphsRecorder(GraphicsContext& owner, DeconstructDrawGlyphs deconstructDrawGlyphs, DeriveFontFromContext deriveFontFromContext)
+DrawGlyphsRecorder::DrawGlyphsRecorder(GraphicsContext& owner, DrawGlyphsDeconstruction drawGlyphsDeconstruction)
     : m_owner(owner)
-    , m_deconstructDrawGlyphs(deconstructDrawGlyphs)
-    , m_deriveFontFromContext(deriveFontFromContext)
+    , m_drawGlyphsDeconstruction(drawGlyphsDeconstruction)
     , m_internalContext(createInternalContext())
 {
 }
@@ -291,13 +289,11 @@
 
 void DrawGlyphsRecorder::recordDrawGlyphs(CGRenderingStateRef, CGGStateRef gstate, const CGAffineTransform*, const CGGlyph glyphs[], const CGPoint positions[], size_t count)
 {
-    ASSERT_IMPLIES(m_deriveFontFromContext == DeriveFontFromContext::No, m_originalFont);
-
     if (!count)
         return;
 
     CGFontRef usedFont = CGGStateGetFont(gstate);
-    if (m_deriveFontFromContext == DeriveFontFromContext::No && usedFont != adoptCF(CTFontCopyGraphicsFont(m_originalFont->platformData().ctFont(), nullptr)).get())
+    if (usedFont != adoptCF(CTFontCopyGraphicsFont(m_originalFont->platformData().ctFont(), nullptr)).get())
         return;
 
 #if ASSERT_ENABLED
@@ -337,9 +333,7 @@
     updateStrokeColor(Color::createAndPreserveColorSpace(strokeColor));
     updateShadow(CGGStateGetStyle(gstate));
 
-    auto fontSize = CGGStateGetFontSize(gstate);
-    Ref font = m_deriveFontFromContext == DeriveFontFromContext::No ? *m_originalFont : Font::create(FontPlatformData(adoptCF(CTFontCreateWithGraphicsFont(usedFont, fontSize, nullptr, nullptr)), fontSize));
-    m_owner.drawGlyphsAndCacheFont(font, glyphs, computeAdvancesFromPositions(positions, count, currentTextMatrix).data(), count, currentTextMatrix.mapPoint(positions[0]), m_smoothingMode);
+    m_owner.drawGlyphsAndCacheFont(*m_originalFont, glyphs, computeAdvancesFromPositions(positions, count, currentTextMatrix).data(), count, currentTextMatrix.mapPoint(positions[0]), m_smoothingMode);
 
     m_owner.concatCTM(inverseCTMFixup);
 }
@@ -416,12 +410,12 @@
 
 void DrawGlyphsRecorder::drawGlyphs(const Font& font, const GlyphBufferGlyph* glyphs, const GlyphBufferAdvance* advances, unsigned numGlyphs, const FloatPoint& startPoint, FontSmoothingMode smoothingMode)
 {
-    if (m_deconstructDrawGlyphs == DeconstructDrawGlyphs::No) {
+    if (m_drawGlyphsDeconstruction == DrawGlyphsDeconstruction::DontDeconstruct) {
         m_owner.drawGlyphsAndCacheFont(font, glyphs, advances, numGlyphs, startPoint, smoothingMode);
         return;
     }
 
-    ASSERT(m_deconstructDrawGlyphs == DeconstructDrawGlyphs::Yes);
+    ASSERT(m_drawGlyphsDeconstruction == DrawGlyphsDeconstruction::Deconstruct);
 
     // FIXME: <rdar://problem/70166552> Record OTSVG glyphs.
     GlyphsAndAdvances glyphsAndAdvancesWithoutOTSVGGlyphs = filterOutOTSVGGlyphs(font, glyphs, advances, numGlyphs);
@@ -433,19 +427,4 @@
     concludeInternalContext();
 }
 
-void DrawGlyphsRecorder::drawNativeText(CTFontRef font, CGFloat fontSize, CTLineRef line, CGRect lineRect)
-{
-    ASSERT(m_deconstructDrawGlyphs == DeconstructDrawGlyphs::Yes);
-
-    GraphicsContextStateSaver saver(m_owner);
-
-    m_owner.translate(lineRect.origin.x, lineRect.origin.y + lineRect.size.height);
-    m_owner.scale(FloatSize(1, -1));
-
-    prepareInternalContext(Font::create(FontPlatformData(font, fontSize)), FontSmoothingMode::SubpixelAntialiased);
-    CGContextSetTextPosition(m_internalContext->platformContext(), 0, 0);
-    CTLineDraw(line, m_internalContext->platformContext());
-    concludeInternalContext();
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (283576 => 283577)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2021-10-05 22:29:22 UTC (rev 283577)
@@ -40,11 +40,11 @@
 namespace WebCore {
 namespace DisplayList {
 
-Recorder::Recorder(DisplayList& displayList, const GraphicsContextState& state, const FloatRect& initialClip, const AffineTransform& initialCTM, Delegate* delegate, DrawGlyphsRecorder::DeconstructDrawGlyphs deconstructDrawGlyphs)
+Recorder::Recorder(DisplayList& displayList, const GraphicsContextState& state, const FloatRect& initialClip, const AffineTransform& initialCTM, Delegate* delegate, DrawGlyphsRecorder::DrawGlyphsDeconstruction drawGlyphsDeconstruction)
     : m_displayList(displayList)
     , m_delegate(delegate)
     , m_isNested(false)
-    , m_drawGlyphsRecorder(*this, deconstructDrawGlyphs)
+    , m_drawGlyphsRecorder(*this, drawGlyphsDeconstruction)
 {
     LOG_WITH_STREAM(DisplayLists, stream << "\nRecording with clip " << initialClip);
     m_stateStack.append({ state, initialCTM, initialClip });
@@ -54,7 +54,7 @@
     : m_displayList(parent.m_displayList)
     , m_delegate(parent.m_delegate)
     , m_isNested(true)
-    , m_drawGlyphsRecorder(*this, parent.m_drawGlyphsRecorder.deconstructDrawGlyphs())
+    , m_drawGlyphsRecorder(*this, parent.m_drawGlyphsRecorder.drawGlyphsDeconstruction())
 {
     m_stateStack.append({ state, initialCTM, initialClip });
 }

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (283576 => 283577)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2021-10-05 22:29:22 UTC (rev 283577)
@@ -55,7 +55,7 @@
     WTF_MAKE_NONCOPYABLE(Recorder);
 public:
     class Delegate;
-    WEBCORE_EXPORT Recorder(DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, Delegate* = nullptr, DrawGlyphsRecorder::DeconstructDrawGlyphs = DrawGlyphsRecorder::DeconstructDrawGlyphs::Yes);
+    WEBCORE_EXPORT Recorder(DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&, Delegate* = nullptr, DrawGlyphsRecorder::DrawGlyphsDeconstruction = DrawGlyphsRecorder::DrawGlyphsDeconstruction::Deconstruct);
     WEBCORE_EXPORT virtual ~Recorder();
 
     WEBCORE_EXPORT void getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& sourceRect);

Modified: trunk/Source/WebCore/platform/graphics/harfbuzz/DrawGlyphsRecorderHarfBuzz.cpp (283576 => 283577)


--- trunk/Source/WebCore/platform/graphics/harfbuzz/DrawGlyphsRecorderHarfBuzz.cpp	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/platform/graphics/harfbuzz/DrawGlyphsRecorderHarfBuzz.cpp	2021-10-05 22:29:22 UTC (rev 283577)
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-DrawGlyphsRecorder::DrawGlyphsRecorder(GraphicsContext& owner, DeconstructDrawGlyphs, DeriveFontFromContext)
+DrawGlyphsRecorder::DrawGlyphsRecorder(GraphicsContext& owner, DrawGlyphsDeconstruction)
     : m_owner(owner)
 {
 }

Modified: trunk/Source/WebCore/platform/graphics/win/DrawGlyphsRecorderWin.cpp (283576 => 283577)


--- trunk/Source/WebCore/platform/graphics/win/DrawGlyphsRecorderWin.cpp	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/platform/graphics/win/DrawGlyphsRecorderWin.cpp	2021-10-05 22:29:22 UTC (rev 283577)
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-DrawGlyphsRecorder::DrawGlyphsRecorder(GraphicsContext& owner, DeconstructDrawGlyphs, DeriveFontFromContext)
+DrawGlyphsRecorder::DrawGlyphsRecorder(GraphicsContext& owner, DrawGlyphsDeconstruction)
     : m_owner(owner)
 {
 }

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (283576 => 283577)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2021-10-05 22:26:08 UTC (rev 283576)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2021-10-05 22:29:22 UTC (rev 283577)
@@ -37,7 +37,6 @@
 #import "ColorIOS.h"
 #import "DateComponents.h"
 #import "Document.h"
-#import "DrawGlyphsRecorder.h"
 #import "File.h"
 #import "FloatRoundedRect.h"
 #import "FontCache.h"
@@ -1537,7 +1536,6 @@
     struct LabelLine {
         FloatRect rect;
         RetainPtr<CTLineRef> line;
-        RetainPtr<CTFontRef> font;
     };
     Vector<LabelLine> lines;
 
@@ -1547,10 +1545,10 @@
     void buildWrappedLines(const String&, CTFontRef, UIColor *, unsigned maximumLineCount);
     void buildSingleLine(const String&, CTFontRef, UIColor *);
 
-    void addLine(CTFontRef, CTLineRef);
+    void addLine(CTLineRef);
 };
 
-void RenderAttachmentInfo::addLine(CTFontRef font, CTLineRef line)
+void RenderAttachmentInfo::addLine(CTLineRef line)
 {
     CGRect lineBounds = CTLineGetBoundsWithOptions(line, kCTLineBoundsExcludeTypographicLeading);
     CGFloat trailingWhitespaceWidth = CTLineGetTrailingWhitespaceWidth(line);
@@ -1559,7 +1557,6 @@
 
     CGFloat xOffset = (attachmentRect.width() / 2) - (lineWidthIgnoringTrailingWhitespace / 2);
     LabelLine labelLine;
-    labelLine.font = font;
     labelLine.line = line;
     labelLine.rect = FloatRect(xOffset, 0, lineWidthIgnoringTrailingWhitespace, lineHeight);
 
@@ -1594,7 +1591,7 @@
     CFIndex lineIndex = 0;
     CFIndex nonTruncatedLineCount = std::min<CFIndex>(maximumLineCount - 1, lineCount);
     for (; lineIndex < nonTruncatedLineCount; ++lineIndex)
-        addLine(font, (CTLineRef)CFArrayGetValueAtIndex(ctLines, lineIndex));
+        addLine((CTLineRef)CFArrayGetValueAtIndex(ctLines, lineIndex));
 
     if (lineIndex == lineCount)
         return;
@@ -1614,7 +1611,7 @@
     if (!truncatedLine)
         truncatedLine = remainingLine;
 
-    addLine(font, truncatedLine.get());
+    addLine(truncatedLine.get());
 }
 
 void RenderAttachmentInfo::buildSingleLine(const String& text, CTFontRef font, UIColor *color)
@@ -1628,7 +1625,7 @@
     };
     RetainPtr<NSAttributedString> attributedText = adoptNS([[NSAttributedString alloc] initWithString:text attributes:textAttributes]);
 
-    addLine(font, adoptCF(CTLineCreateWithAttributedString((CFAttributedStringRef)attributedText.get())).get());
+    addLine(adoptCF(CTLineCreateWithAttributedString((CFAttributedStringRef)attributedText.get())).get());
 }
 
 static BOOL getAttachmentProgress(const RenderAttachment& attachment, float& progress)
@@ -1769,10 +1766,15 @@
 
 static void paintAttachmentText(GraphicsContext& context, RenderAttachmentInfo& info)
 {
-    DrawGlyphsRecorder recorder(context, DrawGlyphsRecorder::DeconstructDrawGlyphs::Yes, DrawGlyphsRecorder::DeriveFontFromContext::Yes);
+    for (const auto& line : info.lines) {
+        GraphicsContextStateSaver saver(context);
 
-    for (const auto& line : info.lines)
-        recorder.drawNativeText(line.font.get(), CTFontGetSize(line.font.get()), line.line.get(), line.rect);
+        context.translate(toFloatSize(line.rect.minXMaxYCorner()));
+        context.scale(FloatSize(1, -1));
+
+        CGContextSetTextPosition(context.platformContext(), 0, 0);
+        CTLineDraw(line.line.get(), context.platformContext());
+    }
 }
 
 static void paintAttachmentProgress(GraphicsContext& context, RenderAttachmentInfo& info)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to