mirror of
https://github.com/aphrody-labs/cef.git
synced 2026-10-13 21:07:07 +00:00
- Windows SDK 10.0.28000.2270 is now required - CefRegisterExtension is deprecated due to https://crbug.com/40347662
87 lines
3.5 KiB
Diff
87 lines
3.5 KiB
Diff
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
index 98013c7c0835ee6f163d4c233abacdb223da02c3..be7928977ab7eec3f7196cb60974d33b61bf72a1 100644
|
|
--- content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
|
|
@@ -8,6 +8,7 @@
|
|
#include <memory>
|
|
#include <set>
|
|
#include <string_view>
|
|
+#include <tuple>
|
|
#include <utility>
|
|
|
|
#include "base/auto_reset.h"
|
|
@@ -56,6 +57,7 @@
|
|
#include "content/public/browser/content_browser_client.h"
|
|
#include "content/public/browser/device_service.h"
|
|
#include "content/public/browser/render_view_host.h"
|
|
+#include "content/public/browser/web_contents.h"
|
|
#include "content/public/common/page_visibility_state.h"
|
|
#include "services/service_manager/public/cpp/interface_provider.h"
|
|
#include "third_party/blink/public/common/input/web_input_event.h"
|
|
@@ -862,6 +864,9 @@ gfx::Rect RenderWidgetHostViewAura::GetViewBoundsWithoutTransform() {
|
|
void RenderWidgetHostViewAura::UpdateBackgroundColor() {
|
|
CHECK(GetBackgroundColor());
|
|
|
|
+ if (!window_) {
|
|
+ return;
|
|
+ }
|
|
SkColor4f background_color =
|
|
SkColor4f::FromColor(GetBackgroundColor().value());
|
|
window_->layer()->SetFillsBoundsOpaquely(background_color.isOpaque());
|
|
@@ -1247,6 +1252,12 @@ void RenderWidgetHostViewAura::TransformPointToRootSurface(gfx::PointF* point) {
|
|
}
|
|
|
|
gfx::Rect RenderWidgetHostViewAura::GetBoundsInScreen() {
|
|
+ if (!root_window_bounds_callback_.is_null()) {
|
|
+ if (auto bounds = root_window_bounds_callback_.Run()) {
|
|
+ return *bounds;
|
|
+ }
|
|
+ }
|
|
+
|
|
aura::Window* top_level = window_->GetToplevelWindow();
|
|
gfx::Rect bounds(top_level->GetBoundsInScreen());
|
|
|
|
@@ -2980,6 +2991,16 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
|
|
window_->layer()->SetFillsBoundsOpaquely(background_color.isOpaque());
|
|
window_->layer()->AsSurface()->SetFallbackBackgroundColor(background_color);
|
|
UpdateFrameSinkIdRegistration();
|
|
+
|
|
+ // Do this after |window_| is created to avoid crashes on Win10.
|
|
+ // See https://crbug.com/761389.
|
|
+ auto* web_contents =
|
|
+ WebContents::FromRenderViewHost(RenderViewHost::From(host()));
|
|
+ if (web_contents) {
|
|
+ // TODO(mostynb): actually use prefs. Landing this as a separate CL
|
|
+ // first to rebaseline some unreliable layout tests.
|
|
+ std::ignore = web_contents->GetOrCreateWebPreferences();
|
|
+ }
|
|
}
|
|
|
|
void RenderWidgetHostViewAura::UpdateFrameSinkIdRegistration() {
|
|
diff --git content/browser/renderer_host/render_widget_host_view_aura.h content/browser/renderer_host/render_widget_host_view_aura.h
|
|
index 21422e7e2d44aa4766d081da2e42e7ba5ebd82f4..ffea7823346063f5307927377987df84c18e95ed 100644
|
|
--- content/browser/renderer_host/render_widget_host_view_aura.h
|
|
+++ content/browser/renderer_host/render_widget_host_view_aura.h
|
|
@@ -482,6 +482,12 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
|
|
|
|
bool ShouldUseDefaultDeadlineOnResize() const;
|
|
|
|
+ using RootWindowBoundsCallback =
|
|
+ base::RepeatingCallback<std::optional<gfx::Rect>()>;
|
|
+ void SetRootWindowBoundsCallback(const RootWindowBoundsCallback& callback) {
|
|
+ root_window_bounds_callback_ = callback;
|
|
+ }
|
|
+
|
|
protected:
|
|
~RenderWidgetHostViewAura() override;
|
|
|
|
@@ -909,6 +915,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
|
|
|
|
bool use_default_deadline_on_resize_ = false;
|
|
|
|
+ RootWindowBoundsCallback root_window_bounds_callback_;
|
|
+
|
|
base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_{this};
|
|
};
|
|
|