1
1
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
2
- index 97cf24ad5f4a6..022d02c8cacf9 100644
2
+ index 97cf24ad5f4a6..ab3f90752b11a 100644
3
3
--- a/content/renderer/render_frame_impl.cc
4
4
+++ b/content/renderer/render_frame_impl.cc
5
5
@@ -256,6 +256,15 @@
@@ -18,7 +18,7 @@ index 97cf24ad5f4a6..022d02c8cacf9 100644
18
18
using base::Time;
19
19
using blink::ContextMenuData;
20
20
using blink::WebContentDecryptionModule;
21
- @@ -3822,6 +3831,134 @@ void RenderFrameImpl::DidClearWindowObject() {
21
+ @@ -3822,6 +3831,135 @@ void RenderFrameImpl::DidClearWindowObject() {
22
22
23
23
for (auto& observer : observers_)
24
24
observer.DidClearWindowObject();
@@ -43,6 +43,7 @@ index 97cf24ad5f4a6..022d02c8cacf9 100644
43
43
+ std::memcpy(&fBytes[fBytesBuffered], &buffer[size - remaining], length);
44
44
+
45
45
+ remaining -= length;
46
+ + fBytesWritten += length;
46
47
+ fBytesBuffered += length;
47
48
+
48
49
+ if (fBytesBuffered == bufferSize) {
@@ -226,71 +227,117 @@ index cb2b900c4ff50..765153f982c29 100644
226
227
227
228
UkmParameters HTMLCanvasElement::GetUkmParameters() {
228
229
diff --git a/third_party/blink/renderer/platform/fonts/font.cc b/third_party/blink/renderer/platform/fonts/font.cc
229
- index 67ba540bfc2b0..f22e6988cf488 100644
230
+ index 67ba540bfc2b0..19e909d455835 100644
230
231
--- a/third_party/blink/renderer/platform/fonts/font.cc
231
232
+++ b/third_party/blink/renderer/platform/fonts/font.cc
232
- @@ -230,15 +230,22 @@ void Font::DrawText(cc::PaintCanvas* canvas,
233
+ @@ -47,6 +47,8 @@
234
+ #include "third_party/skia/include/core/SkTextBlob.h"
235
+ #include "ui/gfx/geometry/rect_f.h"
236
+
237
+ + #include "third_party/skia/include/utils/SkBase64.h"
238
+ +
239
+ namespace blink {
240
+
241
+ namespace {
242
+ @@ -153,7 +155,11 @@ void DrawBlobs(cc::PaintCanvas* canvas,
243
+ const cc::PaintFlags& flags,
244
+ const ShapeResultBloberizer::BlobBuffer& blobs,
245
+ const gfx::PointF& point,
246
+ - cc::NodeId node_id = cc::kInvalidNodeId) {
247
+ + cc::NodeId node_id = cc::kInvalidNodeId) {
248
+ + if (getenv("html2svg_svg_mode") != nullptr) {
249
+ + return;
250
+ + }
251
+ +
252
+ for (const auto& blob_info : blobs) {
253
+ DCHECK(blob_info.blob);
254
+ cc::PaintCanvasAutoRestore auto_restore(canvas, false);
255
+ @@ -198,8 +204,7 @@ void DrawBlobs(cc::PaintCanvas* canvas,
256
+ }
257
+ }
258
+ if (node_id != cc::kInvalidNodeId) {
259
+ - canvas->drawTextBlob(blob_info.blob, point.x(), point.y(), node_id,
260
+ - flags);
261
+ + canvas->drawTextBlob(blob_info.blob, point.x(), point.y(), node_id, flags);
262
+ } else {
263
+ canvas->drawTextBlob(blob_info.blob, point.x(), point.y(), flags);
264
+ }
265
+ @@ -230,6 +235,37 @@ void Font::DrawText(cc::PaintCanvas* canvas,
233
266
if (ShouldSkipDrawing())
234
267
return;
235
268
236
- - CachingWordShaper word_shaper(*this);
237
- - ShapeResultBuffer buffer;
238
- - word_shaper.FillResultBuffer(run_info, &buffer);
239
- - ShapeResultBloberizer::FillGlyphs bloberizer(
240
- - GetFontDescription(), device_scale_factor > 1.0f, run_info, buffer,
241
- - draw_type == Font::DrawType::kGlyphsOnly
242
- - ? ShapeResultBloberizer::Type::kNormal
243
- - : ShapeResultBloberizer::Type::kEmitText);
244
- - DrawBlobs(canvas, flags, bloberizer.Blobs(), point, node_id);
245
- + // Bypass HarfBuzz text shaping for the html2svg Skia back-end
246
- + auto blob = SkTextBlob::MakeFromString(
247
- + StringView(run_info.run.ToStringView(), run_info.from, run_info.to - run_info.from).
248
- + ToString().
249
- + Utf8().
250
- + c_str(),
251
- + PrimaryFont()->
252
- + PlatformData().
253
- + CreateSkFont(false, &font_description_)
254
- + );
269
+ + if (getenv("html2svg_svg_mode") != nullptr) {
270
+ + auto string = StringView(
271
+ + run_info.run.ToStringView(),
272
+ + run_info.from,
273
+ + run_info.to - run_info.from
274
+ + ).ToString().Utf8();
275
+ + auto* utf8 = string.c_str();
276
+ + size_t length = std::strlen(utf8) + 1;
277
+ + size_t buffer_length = SkBase64::Encode(utf8, length, nullptr);
278
+ + auto buffer = std::make_unique<char[]>(buffer_length + 1);
279
+ +
280
+ + SkBase64::Encode(utf8, length, buffer.get());
281
+ + buffer[buffer_length] = '\0';
282
+ +
283
+ + // Bypass HarfBuzz text shaping for the html2svg Skia back-end
284
+ + auto blob = SkTextBlob::MakeFromString(
285
+ + buffer.get(),
286
+ + PrimaryFont()->
287
+ + PlatformData().
288
+ + CreateSkFont(false, &font_description_)
289
+ + );
290
+ +
291
+ + if (node_id != cc::kInvalidNodeId) {
292
+ + canvas->drawTextBlob(blob, point.x(), point.y(), node_id, flags);
293
+ + } else {
294
+ + canvas->drawTextBlob(blob, point.x(), point.y(), flags);
295
+ + }
255
296
+
256
- + if (node_id != cc::kInvalidNodeId) {
257
- + canvas->drawTextBlob(blob, point.x(), point.y(), node_id, flags);
258
- + } else {
259
- + canvas->drawTextBlob(blob, point.x(), point.y(), flags);
297
+ + return;
260
298
+ }
261
- }
262
-
263
- void Font::DrawText(cc::PaintCanvas* canvas,
264
- @@ -253,13 +260,22 @@ void Font::DrawText(cc::PaintCanvas* canvas,
299
+ +
300
+ CachingWordShaper word_shaper(*this);
301
+ ShapeResultBuffer buffer;
302
+ word_shaper.FillResultBuffer(run_info, &buffer);
303
+ @@ -253,6 +289,37 @@ void Font::DrawText(cc::PaintCanvas* canvas,
265
304
if (ShouldSkipDrawing())
266
305
return;
267
306
268
- - ShapeResultBloberizer::FillGlyphsNG bloberizer(
269
- - GetFontDescription(), device_scale_factor > 1.0f, text_info.text,
270
- - text_info.from, text_info.to, text_info.shape_result,
271
- - draw_type == Font::DrawType::kGlyphsOnly
272
- - ? ShapeResultBloberizer::Type::kNormal
273
- - : ShapeResultBloberizer::Type::kEmitText);
274
- - DrawBlobs(canvas, flags, bloberizer.Blobs(), point, node_id);
275
- + // Bypass HarfBuzz text shaping for the html2svg Skia back-end
276
- + auto blob = SkTextBlob::MakeFromString(
277
- + StringView(text_info.text, text_info.from, text_info.Length()).
278
- + ToString().
279
- + Utf8().
280
- + c_str(),
281
- + PrimaryFont()->
282
- + PlatformData().
283
- + CreateSkFont(false, &font_description_)
284
- + );
307
+ + if (getenv("html2svg_svg_mode") != nullptr) {
308
+ + auto string = StringView(
309
+ + text_info.text,
310
+ + text_info.from,
311
+ + text_info.Length()
312
+ + ).ToString().Utf8();
313
+ + auto* utf8 = string.c_str();
314
+ + size_t length = std::strlen(utf8) + 1;
315
+ + size_t buffer_length = SkBase64::Encode(utf8, length, nullptr);
316
+ + auto buffer = std::make_unique<char[]>(buffer_length + 1);
317
+ +
318
+ + SkBase64::Encode(utf8, length, buffer.get());
319
+ + buffer[buffer_length] = '\0';
320
+ +
321
+ + // Bypass HarfBuzz text shaping for the html2svg Skia back-end
322
+ + auto blob = SkTextBlob::MakeFromString(
323
+ + buffer.get(),
324
+ + PrimaryFont()->
325
+ + PlatformData().
326
+ + CreateSkFont(false, &font_description_)
327
+ + );
285
328
+
286
- + if (node_id != cc::kInvalidNodeId) {
287
- + canvas->drawTextBlob(blob, point.x(), point.y(), node_id, flags);
288
- + } else {
289
- + canvas->drawTextBlob(blob, point.x(), point.y(), flags);
329
+ + if (node_id != cc::kInvalidNodeId) {
330
+ + canvas->drawTextBlob(blob, point.x(), point.y(), node_id, flags);
331
+ + } else {
332
+ + canvas->drawTextBlob(blob, point.x(), point.y(), flags);
333
+ + }
334
+ +
335
+ + return;
290
336
+ }
291
- }
292
-
293
- bool Font::DrawBidiText(cc::PaintCanvas* canvas,
337
+ +
338
+ ShapeResultBloberizer::FillGlyphsNG bloberizer(
339
+ GetFontDescription(), device_scale_factor > 1.0f, text_info.text,
340
+ text_info.from, text_info.to, text_info.shape_result,
294
341
diff --git a/ui/gfx/linux/gpu_memory_buffer_support_x11.cc b/ui/gfx/linux/gpu_memory_buffer_support_x11.cc
295
342
index a03a63e305027..4335b751e0cf4 100644
296
343
--- a/ui/gfx/linux/gpu_memory_buffer_support_x11.cc
0 commit comments