Changeset 273798 in webkit
- Timestamp:
- Mar 2, 2021, 7:09:02 PM (6 years ago)
- Location:
- branches/safari-612.1.5-branch
- Files:
-
- 4 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/text/canvas-font-resolution-2-expected.html (added)
-
LayoutTests/fast/text/canvas-font-resolution-2.html (added)
-
LayoutTests/fast/text/canvas-font-resolution-expected.txt (added)
-
LayoutTests/fast/text/canvas-font-resolution.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (modified) (2 diffs)
-
Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h (modified) (1 diff)
-
Source/WebCore/style/StyleResolveForFontRaw.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612.1.5-branch/LayoutTests/ChangeLog
r273794 r273798 1 2021-03-02 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r273512. rdar://problem/74953022 4 5 REGRESSION(r269957): Empty font names passed to canvas2d cause all text routines to crash 6 https://bugs.webkit.org/show_bug.cgi?id=222402 7 <rdar://problem/72621268> 8 9 Reviewed by Darin Adler and Chris Lord. 10 11 Source/WebCore: 12 13 It looks like it was simply an oversight from that patch. If the font name is empty, 14 CanvasRenderingContext2D::setFont() will set the font object to one that doesn't have 15 its internal FontCascadeFonts pointer set. 16 17 Tests: fast/text/canvas-font-resolution-2.html 18 fast/text/canvas-font-resolution.html 19 20 * html/canvas/CanvasRenderingContext2D.cpp: 21 (WebCore::CanvasRenderingContext2D::setFont): 22 * html/canvas/CanvasRenderingContext2DBase.h: 23 (WebCore::CanvasRenderingContext2DBase::FontProxy::isPopulated const): 24 * style/StyleResolveForFontRaw.cpp: 25 (WebCore::Style::resolveForFontRaw): 26 27 LayoutTests: 28 29 * fast/text/canvas-font-resolution-2-expected.html: Added. 30 * fast/text/canvas-font-resolution-2.html: Added. 31 * fast/text/canvas-font-resolution-expected.txt: Added. 32 * fast/text/canvas-font-resolution.html: Added. 33 34 35 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273512 268f45cc-cd09-0410-ab3c-d52691b4dbfc 36 37 2021-02-25 Myles C. Maxfield <mmaxfield@apple.com> 38 39 REGRESSION(r269957): Empty font names passed to canvas2d cause all text routines to crash 40 https://bugs.webkit.org/show_bug.cgi?id=222402 41 <rdar://problem/72621268> 42 43 Reviewed by Darin Adler and Chris Lord. 44 45 * fast/text/canvas-font-resolution-2-expected.html: Added. 46 * fast/text/canvas-font-resolution-2.html: Added. 47 * fast/text/canvas-font-resolution-expected.txt: Added. 48 * fast/text/canvas-font-resolution.html: Added. 49 1 50 2021-03-02 Alan Coon <alancoon@apple.com> 2 51 -
branches/safari-612.1.5-branch/Source/WebCore/ChangeLog
r273797 r273798 1 2021-03-02 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r273512. rdar://problem/74953022 4 5 REGRESSION(r269957): Empty font names passed to canvas2d cause all text routines to crash 6 https://bugs.webkit.org/show_bug.cgi?id=222402 7 <rdar://problem/72621268> 8 9 Reviewed by Darin Adler and Chris Lord. 10 11 Source/WebCore: 12 13 It looks like it was simply an oversight from that patch. If the font name is empty, 14 CanvasRenderingContext2D::setFont() will set the font object to one that doesn't have 15 its internal FontCascadeFonts pointer set. 16 17 Tests: fast/text/canvas-font-resolution-2.html 18 fast/text/canvas-font-resolution.html 19 20 * html/canvas/CanvasRenderingContext2D.cpp: 21 (WebCore::CanvasRenderingContext2D::setFont): 22 * html/canvas/CanvasRenderingContext2DBase.h: 23 (WebCore::CanvasRenderingContext2DBase::FontProxy::isPopulated const): 24 * style/StyleResolveForFontRaw.cpp: 25 (WebCore::Style::resolveForFontRaw): 26 27 LayoutTests: 28 29 * fast/text/canvas-font-resolution-2-expected.html: Added. 30 * fast/text/canvas-font-resolution-2.html: Added. 31 * fast/text/canvas-font-resolution-expected.txt: Added. 32 * fast/text/canvas-font-resolution.html: Added. 33 34 35 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273512 268f45cc-cd09-0410-ab3c-d52691b4dbfc 36 37 2021-02-25 Myles C. Maxfield <mmaxfield@apple.com> 38 39 REGRESSION(r269957): Empty font names passed to canvas2d cause all text routines to crash 40 https://bugs.webkit.org/show_bug.cgi?id=222402 41 <rdar://problem/72621268> 42 43 Reviewed by Darin Adler and Chris Lord. 44 45 It looks like it was simply an oversight from that patch. If the font name is empty, 46 CanvasRenderingContext2D::setFont() will set the font object to one that doesn't have 47 its internal FontCascadeFonts pointer set. 48 49 Tests: fast/text/canvas-font-resolution-2.html 50 fast/text/canvas-font-resolution.html 51 52 * html/canvas/CanvasRenderingContext2D.cpp: 53 (WebCore::CanvasRenderingContext2D::setFont): 54 * html/canvas/CanvasRenderingContext2DBase.h: 55 (WebCore::CanvasRenderingContext2DBase::FontProxy::isPopulated const): 56 * style/StyleResolveForFontRaw.cpp: 57 (WebCore::Style::resolveForFontRaw): 58 1 59 2021-03-02 Alan Coon <alancoon@apple.com> 2 60 -
branches/safari-612.1.5-branch/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r270197 r273798 113 113 return; 114 114 115 // The parse succeeded.116 String newFontSafeCopy(newFont); // Create a string copy since newFont can be deleted inside realizeSaves.117 realizeSaves();118 modifiableState().unparsedFont = newFontSafeCopy;119 120 115 // Map the <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work 121 116 // relative to the canvas. … … 132 127 } 133 128 134 if (auto fontStyle = Style::resolveForFontRaw(*fontRaw, WTFMove(fontDescription), document)) 135 modifiableState().font.initialize(document.fontSelector(), *fontStyle); 129 auto fontStyle = Style::resolveForFontRaw(*fontRaw, WTFMove(fontDescription), document); 130 if (!fontStyle) 131 return; 132 133 String newFontSafeCopy(newFont); // Create a string copy since newFont can be deleted inside realizeSaves. 134 realizeSaves(); 135 modifiableState().unparsedFont = newFontSafeCopy; 136 137 modifiableState().font.initialize(document.fontSelector(), *fontStyle); 138 ASSERT(state().font.realized()); 139 ASSERT(state().font.isPopulated()); 136 140 } 137 141 -
branches/safari-612.1.5-branch/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h
r271646 r273798 242 242 void drawBidiText(GraphicsContext&, const TextRun&, const FloatPoint&, FontCascade::CustomFontNotReadyAction) const; 243 243 244 #if ASSERT_ENABLED 245 bool isPopulated() const { return m_font.fonts(); } 246 #endif 247 244 248 private: 245 249 void update(FontSelector&); -
branches/safari-612.1.5-branch/Source/WebCore/style/StyleResolveForFontRaw.cpp
r272805 r273798 74 74 switchOn(item, [&] (CSSValueID ident) { 75 75 isGenericFamily = ident != CSSValueWebkitBody; 76 family = isGenericFamily ? CSSPropertyParserHelpers::genericFontFamilyFromValueID(ident) 77 : AtomString(document.settings().standardFontFamily()); 76 family = isGenericFamily ? CSSPropertyParserHelpers::genericFontFamilyFromValueID(ident) : AtomString(document.settings().standardFontFamily()); 78 77 }, [&] (const String& familyString) { 79 78 family = familyString;
Note:
See TracChangeset
for help on using the changeset viewer.