WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
232645
REGRESSION(
r283863
): `<attachment>` with a long `action` do not render correctly
https://bugs.webkit.org/show_bug.cgi?id=232645
Summary
REGRESSION(r283863): `<attachment>` with a long `action` do not render correctly
Devin Rousso
Reported
2021-11-02 15:46:01 PDT
.
Attachments
Patch
(5.91 KB, patch)
2021-11-02 16:12 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(11.61 KB, patch)
2021-11-10 13:49 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(11.62 KB, patch)
2021-11-10 13:57 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Devin Rousso
Comment 1
2021-11-02 15:46:16 PDT
<
rdar://problem/84558377
>
Devin Rousso
Comment 2
2021-11-02 16:12:40 PDT
Created
attachment 443141
[details]
Patch
Myles C. Maxfield
Comment 3
2021-11-03 15:55:34 PDT
I'll review this today.
Myles C. Maxfield
Comment 4
2021-11-04 00:35:34 PDT
I didn't get to it today; I'll review it tomorrow.
Myles C. Maxfield
Comment 5
2021-11-05 20:31:30 PDT
Comment on
attachment 443141
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443141&action=review
> Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:321 > + if (m_deriveFontFromContext == DeriveFontFromContext::No) > + ctmFixup *= currentTextMatrix;
I'm pretty sure this is wrong, but I'm still investigating to figure out what's right. I'm discussing with Devin offline.
Myles C. Maxfield
Comment 6
2021-11-05 20:44:12 PDT
Comment on
attachment 443141
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443141&action=review
>> Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:321 >> + ctmFixup *= currentTextMatrix; > > I'm pretty sure this is wrong, but I'm still investigating to figure out what's right. I'm discussing with Devin offline.
I think I know what's wrong. It's the line below "m_owner.drawGlyphsAndCacheFont(...)". It's passing the wrong matrix into computeAdvancesFromPositions() and mapPoint().
Myles C. Maxfield
Comment 7
2021-11-05 23:47:13 PDT
Comment on
attachment 443141
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443141&action=review
> LayoutTests/fast/attachment/attachment-truncated-action.html:4 > +<attachment action="this is very very very very very very very very very very long action" title="title"></attachment>
I ran this test and it passed with no code change. Am I doing something wrong?
Myles C. Maxfield
Comment 8
2021-11-05 23:48:06 PDT
Comment on
attachment 443141
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443141&action=review
> Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:326 > inverseCTMFixup = inverse.value();
I believe the fix is for line 336 to change from m_owner.drawGlyphsAndCacheFont(font, glyphs, computeAdvancesFromPositions(positions, count, currentTextMatrix).data(), count, currentTextMatrix.mapPoint(positions[0]), m_smoothingMode); to m_owner.drawGlyphsAndCacheFont(font, glyphs, computeAdvancesFromPositions(positions, count, m_originalTextMatrix).data(), count, m_originalTextMatrix.mapPoint(positions[0]), m_smoothingMode); but I haven't tested this.
Myles C. Maxfield
Comment 9
2021-11-06 00:49:00 PDT
Comment on
attachment 443141
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443141&action=review
>> Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:326 >> inverseCTMFixup = inverse.value(); > > I believe the fix is for line 336 to change from > > m_owner.drawGlyphsAndCacheFont(font, glyphs, computeAdvancesFromPositions(positions, count, currentTextMatrix).data(), count, currentTextMatrix.mapPoint(positions[0]), m_smoothingMode); > > to > > m_owner.drawGlyphsAndCacheFont(font, glyphs, computeAdvancesFromPositions(positions, count, m_originalTextMatrix).data(), count, m_originalTextMatrix.mapPoint(positions[0]), m_smoothingMode); > > but I haven't tested this.
I just verified that this fix solves the problem. Please update the test to make sure it fails with no code change before uploading the next patch.
Myles C. Maxfield
Comment 10
2021-11-06 00:53:42 PDT
Comment on
attachment 443141
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443141&action=review
>>> Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:326 >>> inverseCTMFixup = inverse.value(); >> >> I believe the fix is for line 336 to change from >> >> m_owner.drawGlyphsAndCacheFont(font, glyphs, computeAdvancesFromPositions(positions, count, currentTextMatrix).data(), count, currentTextMatrix.mapPoint(positions[0]), m_smoothingMode); >> >> to >> >> m_owner.drawGlyphsAndCacheFont(font, glyphs, computeAdvancesFromPositions(positions, count, m_originalTextMatrix).data(), count, m_originalTextMatrix.mapPoint(positions[0]), m_smoothingMode); >> >> but I haven't tested this. > > I just verified that this fix solves the problem. Please update the test to make sure it fails with no code change before uploading the next patch.
I'd also suggest adding a comment above this line: // When replaying, drawGlyphs() transforms the glyph positions according to fillVectorWithHorizontalGlyphPositions(). Here, we apply the inverse transformation to make the positions round-trip correctly. I also don't think this specific one-line change is sufficient, because drawGlyphs() can call fillVectorWithVerticalGlyphPositions() instead of fillVectorWithHorizontalGlyphPositions(). We would likely need to determine here which of those two would be called, and apply the inverse transformation of whichever the right one is.
Devin Rousso
Comment 11
2021-11-10 13:49:34 PST
Created
attachment 443860
[details]
Patch
Myles C. Maxfield
Comment 12
2021-11-10 13:54:10 PST
Comment on
attachment 443860
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443860&action=review
> Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:340 > + // positions by reversing the operations applied to the original advances.
Nit: I'd somehow work in the word "inverse" rather than "reverse".
> Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:344 > + // FIXME: <
https://webkit.org/b/232917
> (`DrawGlyphsRecorder` should be able to record+replay vertical text)
🤔
> Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:121 > +static void fillVectorWithHorizontalGlyphPositions(Vector<CGPoint, 256>& positions, CGContextRef context, const CGSize* advances, unsigned count, const FloatPoint& point)
heh cool
Devin Rousso
Comment 13
2021-11-10 13:54:24 PST
Comment on
attachment 443860
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=443860&action=review
> LayoutTests/fast/attachment/attachment-truncated-action.html:4 > +<attachment action="this is very very very very very very very very very very long action" title="title" style="clip-path: inset(45% 25% 40% 50%)"></attachment>
rather than try to emulate the structure/style of `<attachment>` using CSS, this just clips out everything before the "...", meaning that without this patch it would appear as empty space and with this patch it would have the text "...ng action"
Devin Rousso
Comment 14
2021-11-10 13:57:19 PST
Created
attachment 443861
[details]
Patch
EWS
Comment 15
2021-11-10 22:12:14 PST
Committed
r285620
(
244121@main
): <
https://commits.webkit.org/244121@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 443861
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug