Skip to content

Commit 4b791c9

Browse files
authored
[iOS] Fix #36431: Fix crash on send screen in wallet (uplift to 1.64.x) (#22480)
Uplift of #22434 (squashed) to beta
1 parent 83575d3 commit 4b791c9

File tree

4 files changed

+46
-35
lines changed

4 files changed

+46
-35
lines changed

ios/browser/svg/BUILD.gn

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,23 @@
33
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
44
# You can obtain one at http://mozilla.org/MPL/2.0/.
55

6+
import("//brave/ios/browser/svg/svg.gni")
7+
import("//third_party/skia/modules/skottie/skottie.gni")
8+
import("//third_party/skia/modules/skresources/skresources.gni")
9+
import("//third_party/skia/modules/sksg/sksg.gni")
10+
import("//third_party/skia/modules/skshaper/skshaper.gni")
611
import("//third_party/skia/modules/svg/svg.gni")
712

813
source_set("svg") {
14+
# //skia:skia does the same thing
15+
# There is no other way to include the skia/module files
16+
check_includes = false
17+
18+
defines = [
19+
"SK_SHAPER_CORETEXT_AVAILABLE",
20+
"SK_SHAPER_PRIMITIVE_AVAILABLE",
21+
]
22+
923
cflags_cc = [
1024
"-Wno-extra-semi",
1125
"-Wno-unreachable-code-aggressive",
@@ -17,32 +31,6 @@ source_set("svg") {
1731
]
1832

1933
sources += [
20-
"//third_party/skia/src/codec/SkBmpBaseCodec.cpp",
21-
"//third_party/skia/src/codec/SkBmpCodec.cpp",
22-
"//third_party/skia/src/codec/SkBmpMaskCodec.cpp",
23-
"//third_party/skia/src/codec/SkBmpRLECodec.cpp",
24-
"//third_party/skia/src/codec/SkBmpStandardCodec.cpp",
25-
"//third_party/skia/src/codec/SkCodec.cpp",
26-
"//third_party/skia/src/codec/SkCodecImageGenerator.cpp",
27-
"//third_party/skia/src/codec/SkCodecImageGenerator.h",
28-
"//third_party/skia/src/codec/SkCodecPriv.h",
29-
"//third_party/skia/src/codec/SkColorPalette.cpp",
30-
"//third_party/skia/src/codec/SkColorPalette.h",
31-
"//third_party/skia/src/codec/SkEncodedInfo.cpp",
32-
"//third_party/skia/src/codec/SkFrameHolder.h",
33-
"//third_party/skia/src/codec/SkIcoCodec.cpp",
34-
"//third_party/skia/src/codec/SkMaskSwizzler.cpp",
35-
"//third_party/skia/src/codec/SkMaskSwizzler.h",
36-
"//third_party/skia/src/codec/SkParseEncodedOrigin.cpp",
37-
"//third_party/skia/src/codec/SkPixmapUtils.cpp",
38-
"//third_party/skia/src/codec/SkPixmapUtilsPriv.h",
39-
"//third_party/skia/src/codec/SkPngCodec.cpp",
40-
"//third_party/skia/src/codec/SkSampler.cpp",
41-
"//third_party/skia/src/codec/SkSampler.h",
42-
"//third_party/skia/src/codec/SkSwizzler.cpp",
43-
"//third_party/skia/src/codec/SkSwizzler.h",
44-
"//third_party/skia/src/codec/SkWbmpCodec.cpp",
45-
"//third_party/skia/src/codec/SkWebpCodec.cpp",
4634
"//third_party/skia/src/ports/SkImageGenerator_skia.cpp",
4735
"//third_party/skia/src/utils/SkOSPath.h",
4836
"//third_party/skia/src/utils/SkParsePath.cpp",
@@ -56,6 +44,16 @@ source_set("svg") {
5644

5745
sources += skia_svg_public
5846
sources += skia_svg_sources
47+
sources += skia_skottie_sources
48+
sources += skia_skresources_sources
49+
sources += skia_sksg_sources
50+
sources += skia_shaper_primitive_sources
51+
sources += skia_shaper_coretext_sources
52+
53+
include_dirs = [
54+
"//third_party/skia",
55+
"$root_gen_dir/third_party/skia",
56+
]
5957

6058
deps = [
6159
"//base",
@@ -66,4 +64,9 @@ source_set("svg") {
6664
"//third_party/libwebp:libwebp_webp",
6765
"//ui/gfx",
6866
]
67+
68+
frameworks = [
69+
"CoreFoundation.framework",
70+
"CoreText.framework",
71+
]
6972
}

ios/browser/svg/DEPS

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
include_rules = [
2-
"+skia/ext/skia_utils_ios.h",
3-
"+third_party/skia/include/core/SkBitmap.h",
4-
"+third_party/skia/include/core/SkCanvas.h",
5-
"+third_party/skia/include/core/SkRefCnt.h",
6-
"+third_party/skia/include/core/SkStream.h",
7-
"+third_party/skia/modules/svg/include/SkSVGDOM.h",
8-
"+third_party/skia/modules/svg/include/SkSVGRenderContext.h",
9-
"+third_party/skia/modules/svg/include/SkSVGSVG.h",
2+
"+skia/ext/font_utils.h",
3+
"+third_party/skia/include/core/SkFontMgr.h",
4+
"+third_party/skia/include/core/SkSurface.h",
105
"+ui/gfx",
116
]

ios/browser/svg/svg.gni

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 The Brave Authors. All rights reserved.
2+
# This Source Code Form is subject to the terms of the Mozilla Public
3+
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
4+
# You can obtain one at https://mozilla.org/MPL/2.0/.
5+
6+
declare_args() {
7+
skia_use_fonthost_mac = true
8+
}

ios/browser/svg/svg_image.mm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55

66
#import "brave/ios/browser/svg/svg_image.h"
77

8+
#include "skia/ext/font_utils.h"
89
#include "third_party/skia/include/core/SkBitmap.h"
910
#include "third_party/skia/include/core/SkCanvas.h"
11+
#include "third_party/skia/include/core/SkFontMgr.h"
1012
#include "third_party/skia/include/core/SkRefCnt.h"
1113
#include "third_party/skia/include/core/SkStream.h"
1214
#include "third_party/skia/modules/svg/include/SkSVGDOM.h"
1315
#include "third_party/skia/modules/svg/include/SkSVGRenderContext.h"
1416
#include "third_party/skia/modules/svg/include/SkSVGSVG.h"
1517
#include "ui/gfx/image/image.h"
1618

19+
#include "third_party/skia/include/core/SkSurface.h"
20+
1721
#if !defined(__has_feature) || !__has_feature(objc_arc)
1822
#error "This file requires ARC support."
1923
#endif
@@ -68,7 +72,8 @@ SkBitmap MakeFromData(const NSData* data,
6872
return SkBitmap();
6973
}
7074

71-
sk_sp<SkSVGDOM> document = SkSVGDOM::MakeFromStream(*stream);
75+
sk_sp<SkSVGDOM> document =
76+
SkSVGDOM::Builder().setFontManager(skia::DefaultFontMgr()).make(*stream);
7277
if (!document || !document->getRoot()) {
7378
return SkBitmap();
7479
}

0 commit comments

Comments
 (0)