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:
@@ -299,6 +299,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/values.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/border.h"
|
||||
#include "ui/views/view.h"
|
||||
|
||||
// Helpers for template boiler-plate.
|
||||
@@ -384,6 +385,8 @@ CEF_VIEW_IMPL_T class CefViewImpl : public CefViewAdapter, public CefViewClass {
|
||||
CefSize GetSize() override;
|
||||
void SetPosition(const CefPoint& position) override;
|
||||
CefPoint GetPosition() override;
|
||||
void SetInsets(const CefInsets& insets) override;
|
||||
CefInsets GetInsets() override;
|
||||
CefSize GetPreferredSize() override;
|
||||
void SizeToPreferredSize() override;
|
||||
CefSize GetMinimumSize() override;
|
||||
@@ -571,6 +574,20 @@ CEF_VIEW_IMPL_T CefPoint CEF_VIEW_IMPL_D::GetPosition() {
|
||||
return CefPoint(bounds.x, bounds.y);
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T void CEF_VIEW_IMPL_D::SetInsets(const CefInsets& insets) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
gfx::Insets gfx_insets(insets.top, insets.left, insets.bottom, insets.right);
|
||||
root_view()->SetBorder(
|
||||
gfx_insets.IsEmpty() ? nullptr : views::CreateEmptyBorder(gfx_insets));
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T CefInsets CEF_VIEW_IMPL_D::GetInsets() {
|
||||
CEF_REQUIRE_VALID_RETURN(CefInsets());
|
||||
const auto insets = root_view()->GetInsets();
|
||||
return CefInsets(insets.top(), insets.left(), insets.bottom(),
|
||||
insets.right());
|
||||
}
|
||||
|
||||
CEF_VIEW_IMPL_T CefSize CEF_VIEW_IMPL_D::GetPreferredSize() {
|
||||
CEF_REQUIRE_VALID_RETURN(CefSize());
|
||||
const gfx::Size& size = root_view()->GetPreferredSize();
|
||||
|
Reference in New Issue
Block a user