fix: WCO occlusion of DevTools (#35209)
This commit is contained in:
parent
eab7ab2c47
commit
4d54cadb28
2 changed files with 11 additions and 0 deletions
|
@ -1568,6 +1568,8 @@ Opens the devtools.
|
||||||
When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
|
When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
|
||||||
explicitly passing an empty `mode` can force using last used dock state.
|
explicitly passing an empty `mode` can force using last used dock state.
|
||||||
|
|
||||||
|
On Windows, if Windows Control Overlay is enabled, Devtools will be opened with `mode: 'detach'`.
|
||||||
|
|
||||||
#### `contents.closeDevTools()`
|
#### `contents.closeDevTools()`
|
||||||
|
|
||||||
Closes the devtools.
|
Closes the devtools.
|
||||||
|
|
|
@ -175,6 +175,7 @@
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
#include "printing/backend/win_helper.h"
|
#include "printing/backend/win_helper.h"
|
||||||
|
#include "shell/browser/native_window_views.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2419,6 +2420,14 @@ void WebContents::OpenDevTools(gin::Arguments* args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BUILDFLAG(IS_WIN)
|
||||||
|
auto* win = static_cast<NativeWindowViews*>(owner_window());
|
||||||
|
// Force a detached state when WCO is enabled to match Chrome
|
||||||
|
// behavior and prevent occlusion of DevTools.
|
||||||
|
if (win && win->IsWindowControlsOverlayEnabled())
|
||||||
|
state = "detach";
|
||||||
|
#endif
|
||||||
|
|
||||||
DCHECK(inspectable_web_contents_);
|
DCHECK(inspectable_web_contents_);
|
||||||
inspectable_web_contents_->SetDockState(state);
|
inspectable_web_contents_->SetDockState(state);
|
||||||
inspectable_web_contents_->ShowDevTools(activate);
|
inspectable_web_contents_->ShowDevTools(activate);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue