fix: color select eyedropper not working within DevTools (#29729)
This commit is contained in:
parent
f00a2d0629
commit
c841247815
5 changed files with 37 additions and 1 deletions
|
@ -3473,6 +3473,30 @@ void WebContents::DevToolsSearchInPath(int request_id,
|
|||
file_system_path));
|
||||
}
|
||||
|
||||
void WebContents::DevToolsSetEyeDropperActive(bool active) {
|
||||
auto* web_contents = GetWebContents();
|
||||
if (!web_contents)
|
||||
return;
|
||||
|
||||
if (active) {
|
||||
eye_dropper_ = std::make_unique<DevToolsEyeDropper>(
|
||||
web_contents, base::BindRepeating(&WebContents::ColorPickedInEyeDropper,
|
||||
base::Unretained(this)));
|
||||
} else {
|
||||
eye_dropper_.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void WebContents::ColorPickedInEyeDropper(int r, int g, int b, int a) {
|
||||
base::DictionaryValue color;
|
||||
color.SetInteger("r", r);
|
||||
color.SetInteger("g", g);
|
||||
color.SetInteger("b", b);
|
||||
color.SetInteger("a", a);
|
||||
inspectable_web_contents_->CallClientFunction(
|
||||
"DevToolsAPI.eyeDropperPickedColor", &color, nullptr, nullptr);
|
||||
}
|
||||
|
||||
#if defined(TOOLKIT_VIEWS) && !defined(OS_MAC)
|
||||
ui::ImageModel WebContents::GetDevToolsWindowIcon() {
|
||||
return owner_window() ? owner_window()->GetWindowAppIcon() : ui::ImageModel{};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue