mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
views: Add support for absolute positioned overlay views.
To test: Run `cefclient.exe --use-views --hide-frame --hide-controls` Add `--enable-chrome-runtime` for the same behavior using the Chrome location bar instead of a text field.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/ui/browser_command_controller.cc chrome/browser/ui/browser_command_controller.cc
|
||||
index 9188154824c4d..d01f610a64135 100644
|
||||
index 9188154824c4..d01f610a6413 100644
|
||||
--- chrome/browser/ui/browser_command_controller.cc
|
||||
+++ chrome/browser/ui/browser_command_controller.cc
|
||||
@@ -351,8 +351,10 @@ bool BrowserCommandController::ExecuteCommandWithDisposition(
|
||||
@ -31,7 +31,7 @@ index 9188154824c4d..d01f610a64135 100644
|
||||
|
||||
void BrowserCommandController::InitCommandState() {
|
||||
diff --git chrome/browser/ui/views/frame/browser_frame.cc chrome/browser/ui/views/frame/browser_frame.cc
|
||||
index 2c4624fb0cd05..57c087dcbaaee 100644
|
||||
index 2c4624fb0cd0..57c087dcbaae 100644
|
||||
--- chrome/browser/ui/views/frame/browser_frame.cc
|
||||
+++ chrome/browser/ui/views/frame/browser_frame.cc
|
||||
@@ -69,15 +69,23 @@ bool IsUsingGtkTheme(Profile* profile) {
|
||||
@ -106,7 +106,7 @@ index 2c4624fb0cd05..57c087dcbaaee 100644
|
||||
// or not we always use the dark ui instance.
|
||||
if (base::FeatureList::IsEnabled(
|
||||
diff --git chrome/browser/ui/views/frame/browser_frame.h chrome/browser/ui/views/frame/browser_frame.h
|
||||
index 0ce7abdeb7d9f..8197a6bb7da98 100644
|
||||
index 0ce7abdeb7d9..8197a6bb7da9 100644
|
||||
--- chrome/browser/ui/views/frame/browser_frame.h
|
||||
+++ chrome/browser/ui/views/frame/browser_frame.h
|
||||
@@ -54,7 +54,9 @@ enum class TabDragKind {
|
||||
@ -120,10 +120,25 @@ index 0ce7abdeb7d9f..8197a6bb7da98 100644
|
||||
|
||||
// Initialize the frame (creates the underlying native window).
|
||||
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
|
||||
index f0b0bd645a3ce..0d8475b411512 100644
|
||||
index f0b0bd645a3c..ae1449aa9986 100644
|
||||
--- chrome/browser/ui/views/frame/browser_view.cc
|
||||
+++ chrome/browser/ui/views/frame/browser_view.cc
|
||||
@@ -593,11 +593,22 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {
|
||||
@@ -274,11 +274,10 @@ using content::WebContents;
|
||||
using views::ColumnSet;
|
||||
using web_modal::WebContentsModalDialogHost;
|
||||
|
||||
-namespace {
|
||||
+// static
|
||||
+const char BrowserView::kBrowserViewKey[] = "__BROWSER_VIEW__";
|
||||
|
||||
-// The name of a key to store on the window handle so that other code can
|
||||
-// locate this object using just the handle.
|
||||
-const char* const kBrowserViewKey = "__BROWSER_VIEW__";
|
||||
+namespace {
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
// UMA histograms that record animation smoothness for tab loading animation.
|
||||
@@ -593,11 +592,22 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// BrowserView, public:
|
||||
|
||||
@ -147,7 +162,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
|
||||
SetShowIcon(::ShouldShowWindowIcon(browser_.get()));
|
||||
|
||||
// In forced app mode, all size controls are always disabled. Otherwise, use
|
||||
@@ -611,7 +622,6 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
||||
@@ -611,7 +621,6 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
||||
}
|
||||
|
||||
browser_->tab_strip_model()->AddObserver(this);
|
||||
@ -155,7 +170,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
|
||||
|
||||
// Top container holds tab strip region and toolbar and lives at the front of
|
||||
// the view hierarchy.
|
||||
@@ -655,8 +665,15 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
||||
@@ -655,8 +664,15 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
||||
contents_container->SetLayoutManager(std::make_unique<ContentsLayoutManager>(
|
||||
devtools_web_view_, contents_web_view_));
|
||||
|
||||
@ -173,7 +188,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
|
||||
|
||||
contents_separator_ =
|
||||
top_container_->AddChildView(std::make_unique<ContentsSeparator>());
|
||||
@@ -1440,6 +1457,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
|
||||
@@ -1440,6 +1456,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
|
||||
if (immersive_mode_controller_->IsEnabled())
|
||||
return false;
|
||||
|
||||
@ -182,7 +197,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
|
||||
return frame_->GetFrameView()->ShouldHideTopUIForFullscreen();
|
||||
}
|
||||
|
||||
@@ -2482,7 +2501,8 @@ BrowserView::GetNativeViewHostsForTopControlsSlide() const {
|
||||
@@ -2482,7 +2500,8 @@ BrowserView::GetNativeViewHostsForTopControlsSlide() const {
|
||||
}
|
||||
|
||||
void BrowserView::ReparentTopContainerForEndOfImmersive() {
|
||||
@ -192,7 +207,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
|
||||
top_container()->DestroyLayer();
|
||||
AddChildViewAt(top_container(), 0);
|
||||
EnsureFocusOrder();
|
||||
@@ -2934,8 +2954,10 @@ void BrowserView::Layout() {
|
||||
@@ -2934,8 +2953,10 @@ void BrowserView::Layout() {
|
||||
|
||||
// TODO(jamescook): Why was this in the middle of layout code?
|
||||
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
|
||||
@ -205,7 +220,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
|
||||
|
||||
// Some of the situations when the BrowserView is laid out are:
|
||||
// - Enter/exit immersive fullscreen mode.
|
||||
@@ -2998,6 +3020,11 @@ void BrowserView::AddedToWidget() {
|
||||
@@ -2998,6 +3019,11 @@ void BrowserView::AddedToWidget() {
|
||||
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
|
||||
#endif
|
||||
|
||||
@ -217,7 +232,7 @@ index f0b0bd645a3ce..0d8475b411512 100644
|
||||
toolbar_->Init();
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
@@ -3033,13 +3060,9 @@ void BrowserView::AddedToWidget() {
|
||||
@@ -3033,13 +3059,9 @@ void BrowserView::AddedToWidget() {
|
||||
|
||||
EnsureFocusOrder();
|
||||
|
||||
@ -234,10 +249,10 @@ index f0b0bd645a3ce..0d8475b411512 100644
|
||||
|
||||
MaybeInitializeWebUITabStrip();
|
||||
diff --git chrome/browser/ui/views/frame/browser_view.h chrome/browser/ui/views/frame/browser_view.h
|
||||
index 021f04720e567..8c4f2cbf34f25 100644
|
||||
index 021f04720e56..98097fd4f11f 100644
|
||||
--- chrome/browser/ui/views/frame/browser_view.h
|
||||
+++ chrome/browser/ui/views/frame/browser_view.h
|
||||
@@ -114,7 +114,9 @@ class BrowserView : public BrowserWindow,
|
||||
@@ -114,11 +114,16 @@ class BrowserView : public BrowserWindow,
|
||||
public webapps::AppBannerManager::Observer {
|
||||
public:
|
||||
METADATA_HEADER(BrowserView);
|
||||
@ -247,7 +262,14 @@ index 021f04720e567..8c4f2cbf34f25 100644
|
||||
BrowserView(const BrowserView&) = delete;
|
||||
BrowserView& operator=(const BrowserView&) = delete;
|
||||
~BrowserView() override;
|
||||
@@ -668,6 +670,12 @@ class BrowserView : public BrowserWindow,
|
||||
|
||||
+ // Key used to bind BrowserView to the Widget with which it is associated.
|
||||
+ static const char kBrowserViewKey[];
|
||||
+
|
||||
void set_frame(BrowserFrame* frame) { frame_ = frame; }
|
||||
BrowserFrame* frame() const { return frame_; }
|
||||
|
||||
@@ -668,6 +673,12 @@ class BrowserView : public BrowserWindow,
|
||||
return accessibility_focus_highlight_.get();
|
||||
}
|
||||
|
||||
@ -261,15 +283,25 @@ index 021f04720e567..8c4f2cbf34f25 100644
|
||||
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
|
||||
// interface to keep these two classes decoupled and testable.
|
||||
diff --git chrome/browser/ui/views/frame/browser_view_layout.cc chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||
index 18a85f436bd97..0d6e4c9f916e7 100644
|
||||
index 18a85f436bd9..cf880936a8ed 100644
|
||||
--- chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||
+++ chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||
@@ -441,6 +441,12 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
|
||||
@@ -39,6 +39,10 @@
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/window/client_view.h"
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+#include "cef/libcef/browser/chrome/views/chrome_views_util.h"
|
||||
+#endif
|
||||
+
|
||||
using views::View;
|
||||
using web_modal::WebContentsModalDialogHost;
|
||||
using web_modal::ModalDialogHostObserver;
|
||||
@@ -441,6 +445,11 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
|
||||
|
||||
int BrowserViewLayout::LayoutToolbar(int top) {
|
||||
TRACE_EVENT0("ui", "BrowserViewLayout::LayoutToolbar");
|
||||
+ if (toolbar_->parent() && toolbar_->parent()->GetLayoutManager() != this &&
|
||||
+ toolbar_->parent()->GetLayoutManager() != nullptr) {
|
||||
+ if (cef::IsCefView(toolbar_)) {
|
||||
+ // CEF may take ownership of the toolbar. Early exit to avoid the DCHECK
|
||||
+ // in LayoutManager::SetViewVisibility().
|
||||
+ return top;
|
||||
@ -278,7 +310,7 @@ index 18a85f436bd97..0d6e4c9f916e7 100644
|
||||
bool toolbar_visible = delegate_->IsToolbarVisible();
|
||||
int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;
|
||||
diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
|
||||
index 5e516ea5873ca..b9890fbe050af 100644
|
||||
index 5e516ea5873c..b9890fbe050a 100644
|
||||
--- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
|
||||
+++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
|
||||
@@ -587,37 +587,53 @@ gfx::Range BrowserTabStripController::ListTabsInGroup(
|
||||
@ -336,7 +368,7 @@ index 5e516ea5873ca..b9890fbe050af 100644
|
||||
}
|
||||
|
||||
diff --git chrome/browser/ui/views/toolbar/toolbar_view.cc chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
index 7bc5cd3dabf7d..ea706584db609 100644
|
||||
index 7bc5cd3dabf7..ea706584db60 100644
|
||||
--- chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
+++ chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
@@ -162,12 +162,13 @@ auto& GetViewCommandMap() {
|
||||
@ -365,7 +397,7 @@ index 7bc5cd3dabf7d..ea706584db609 100644
|
||||
size_animation_.Reset(1);
|
||||
|
||||
diff --git chrome/browser/ui/views/toolbar/toolbar_view.h chrome/browser/ui/views/toolbar/toolbar_view.h
|
||||
index 8346b612cfbe6..d7fc5440af829 100644
|
||||
index 8346b612cfbe..d7fc5440af82 100644
|
||||
--- chrome/browser/ui/views/toolbar/toolbar_view.h
|
||||
+++ chrome/browser/ui/views/toolbar/toolbar_view.h
|
||||
@@ -90,7 +90,8 @@ class ToolbarView : public views::AccessiblePaneView,
|
||||
|
Reference in New Issue
Block a user