chore: bump chromium to 131.0.6776.0 (main) (#44137)

* chore: bump chromium in DEPS to 131.0.6763.0

* chore: bump chromium in DEPS to 131.0.6764.0

* update patches

* chore: bump chromium in DEPS to 131.0.6766.0

* chore: update patches

* Use PathInfo in FileSystemAccess code

Refs 5872329

* Modernize image utilities.

Refs 5905226

* [DevTools] move feature flags to the devtools directory

Refs 5913878

* chore: bump chromium in DEPS to 131.0.6768.0

* chore: update patches

* Remove experimental credshelper flags

Refs 4017a6c8b4

* Change gfx::[PNG|JPEG]Codec::Decode to return a SkBitmap

Refs 5917286
Refs 5905621

* chore: script/gen-libc++-filenames.js

* chore: bump chromium in DEPS to 131.0.6770.0

* chore: update patches

* chore: bump chromium in DEPS to 131.0.6772.0

* chore: update patches

* [UI] Add alias for mojo version of `MenuSourceType`

Refs 5803393

* Update Background Color for Task Manager Refresh

Refs 5875259

* chore: bump chromium in DEPS to 131.0.6774.0

* chore: bump chromium in DEPS to 131.0.6776.0

* chore: update patches

* chore: update filenames.libcxx.gni

* esm: remove --no-import-harmony-assertions

https://github.com/nodejs/node/pull/54890

* 5507047: [import-attributes] Remove support for import assertions

 | 5507047

* fixup: Change gfx::[PNG|JPEG]Codec::Decode to return a SkBitmap

* chore: bump chromium in DEPS to 131.0.6778.0

* Revert "chore: bump chromium in DEPS to 131.0.6778.0"

This reverts commit fb9092fc51700651aa4a245931f71ec1ca55a274.

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Rose <nornagon@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
electron-roller[bot] 2024-10-15 11:51:11 -04:00 committed by GitHub
parent 72802c374b
commit 36b7cf341e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 395 additions and 325 deletions

View file

@ -244,8 +244,7 @@ gfx::Image Clipboard::ReadImage(gin_helper::Arguments* args) {
base::BindOnce(
[](std::optional<gfx::Image>* image, base::RepeatingClosure cb,
const std::vector<uint8_t>& result) {
SkBitmap bitmap;
gfx::PNGCodec::Decode(result.data(), result.size(), &bitmap);
SkBitmap bitmap = gfx::PNGCodec::Decode(result);
image->emplace(gfx::Image::CreateFrom1xBitmap(bitmap));
std::move(cb).Run();
},

View file

@ -238,10 +238,12 @@ v8::Local<v8::Value> NativeImage::ToPNG(gin::Arguments* args) {
const SkBitmap bitmap =
image_.AsImageSkia().GetRepresentation(scale_factor).GetBitmap();
std::vector<unsigned char> encoded;
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &encoded);
const char* data = reinterpret_cast<char*>(encoded.data());
size_t size = encoded.size();
std::optional<std::vector<uint8_t>> encoded =
gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false);
if (!encoded.has_value())
return node::Buffer::New(args->isolate(), 0).ToLocalChecked();
const char* data = reinterpret_cast<char*>(encoded->data());
size_t size = encoded->size();
return node::Buffer::Copy(args->isolate(), data, size).ToLocalChecked();
}
@ -265,13 +267,13 @@ v8::Local<v8::Value> NativeImage::ToBitmap(gin::Arguments* args) {
}
v8::Local<v8::Value> NativeImage::ToJPEG(v8::Isolate* isolate, int quality) {
std::vector<unsigned char> output;
gfx::JPEG1xEncodedDataFromImage(image_, quality, &output);
if (output.empty())
std::optional<std::vector<uint8_t>> encoded_image =
gfx::JPEG1xEncodedDataFromImage(image_, quality);
if (!encoded_image.has_value())
return node::Buffer::New(isolate, 0).ToLocalChecked();
return node::Buffer::Copy(isolate,
reinterpret_cast<const char*>(&output.front()),
output.size())
return node::Buffer::Copy(
isolate, reinterpret_cast<const char*>(&encoded_image->front()),
encoded_image->size())
.ToLocalChecked();
}

View file

@ -21,28 +21,31 @@
#include "shell/common/gin_helper/dictionary.h"
#include "third_party/blink/public/common/context_menu_data/untrustworthy_context_menu_params.h"
#include "third_party/blink/public/mojom/permissions/permission_status.mojom.h"
#include "ui/base/mojom/menu_source_type.mojom.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/keycodes/keyboard_code_conversion.h"
namespace gin {
static constexpr auto MenuSourceTypes =
base::MakeFixedFlatMap<std::string_view, ui::MenuSourceType>({
{"adjustSelection", ui::MENU_SOURCE_ADJUST_SELECTION},
{"adjustSelectionReset", ui::MENU_SOURCE_ADJUST_SELECTION_RESET},
{"keyboard", ui::MENU_SOURCE_KEYBOARD},
{"longPress", ui::MENU_SOURCE_LONG_PRESS},
{"longTap", ui::MENU_SOURCE_LONG_TAP},
{"mouse", ui::MENU_SOURCE_MOUSE},
{"none", ui::MENU_SOURCE_NONE},
{"stylus", ui::MENU_SOURCE_STYLUS},
{"touch", ui::MENU_SOURCE_TOUCH},
{"touchHandle", ui::MENU_SOURCE_TOUCH_HANDLE},
{"touchMenu", ui::MENU_SOURCE_TOUCH_EDIT_MENU},
base::MakeFixedFlatMap<std::string_view, ui::mojom::MenuSourceType>({
{"adjustSelection", ui::mojom::MenuSourceType::kAdjustSelection},
{"adjustSelectionReset",
ui::mojom::MenuSourceType::kAdjustSelectionReset},
{"keyboard", ui::mojom::MenuSourceType::kKeyboard},
{"longPress", ui::mojom::MenuSourceType::kLongPress},
{"longTap", ui::mojom::MenuSourceType::kLongTap},
{"mouse", ui::mojom::MenuSourceType::kMouse},
{"none", ui::mojom::MenuSourceType::kNone},
{"stylus", ui::mojom::MenuSourceType::kStylus},
{"touch", ui::mojom::MenuSourceType::kTouch},
{"touchHandle", ui::mojom::MenuSourceType::kTouchHandle},
{"touchMenu", ui::mojom::MenuSourceType::kTouchEditMenu},
});
// let us know when upstream changes & we need to update MenuSourceTypes
static_assert(std::size(MenuSourceTypes) == ui::MENU_SOURCE_TYPE_LAST + 1U);
static_assert(std::size(MenuSourceTypes) ==
static_cast<int32_t>(ui::mojom::MenuSourceType::kMaxValue) + 1);
// static
v8::Local<v8::Value> Converter<ui::MenuSourceType>::ToV8(

View file

@ -58,8 +58,8 @@ float GetScaleFactorFromPath(const base::FilePath& path) {
bool AddImageSkiaRepFromPNG(gfx::ImageSkia* image,
const base::span<const uint8_t> data,
double scale_factor) {
SkBitmap bitmap;
if (!gfx::PNGCodec::Decode(data.data(), data.size(), &bitmap))
SkBitmap bitmap = gfx::PNGCodec::Decode(data);
if (bitmap.isNull())
return false;
image->AddRepresentation(gfx::ImageSkiaRep(bitmap, scale_factor));
@ -69,8 +69,8 @@ bool AddImageSkiaRepFromPNG(gfx::ImageSkia* image,
bool AddImageSkiaRepFromJPEG(gfx::ImageSkia* image,
const base::span<const uint8_t> data,
double scale_factor) {
auto bitmap = gfx::JPEGCodec::Decode(data.data(), data.size());
if (!bitmap)
auto bitmap = gfx::JPEGCodec::Decode(data);
if (bitmap.isNull())
return false;
// `JPEGCodec::Decode()` doesn't tell `SkBitmap` instance it creates
@ -80,9 +80,9 @@ bool AddImageSkiaRepFromJPEG(gfx::ImageSkia* image,
// TODO(alexeykuzmin): This workaround should be removed
// when the `JPEGCodec::Decode()` code is fixed.
// See https://github.com/electron/electron/issues/11294.
bitmap->setAlphaType(SkAlphaType::kOpaque_SkAlphaType);
bitmap.setAlphaType(SkAlphaType::kOpaque_SkAlphaType);
image->AddRepresentation(gfx::ImageSkiaRep(*bitmap, scale_factor));
image->AddRepresentation(gfx::ImageSkiaRep(bitmap, scale_factor));
return true;
}