build: remove enable_osr build flag (#38703)
Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
parent
80a3ba5c68
commit
e37111edcc
14 changed files with 21 additions and 108 deletions
|
@ -83,7 +83,6 @@ BaseWindow::BaseWindow(v8::Isolate* isolate,
|
|||
if (options.Get("parent", &parent) && !parent.IsEmpty())
|
||||
parent_window_.Reset(isolate, parent.ToV8());
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
// Offscreen windows are always created frameless.
|
||||
gin_helper::Dictionary web_preferences;
|
||||
bool offscreen;
|
||||
|
@ -91,7 +90,6 @@ BaseWindow::BaseWindow(v8::Isolate* isolate,
|
|||
web_preferences.Get(options::kOffscreen, &offscreen) && offscreen) {
|
||||
const_cast<gin_helper::Dictionary&>(options).Set(options::kFrame, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Creates NativeWindow.
|
||||
window_.reset(NativeWindow::Create(
|
||||
|
|
|
@ -91,6 +91,8 @@
|
|||
#include "shell/browser/electron_navigation_throttle.h"
|
||||
#include "shell/browser/file_select_helper.h"
|
||||
#include "shell/browser/native_window.h"
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "shell/browser/osr/osr_web_contents_view.h"
|
||||
#include "shell/browser/session_preferences.h"
|
||||
#include "shell/browser/ui/drag_util.h"
|
||||
#include "shell/browser/ui/file_dialog.h"
|
||||
|
@ -140,11 +142,6 @@
|
|||
#include "ui/display/screen.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "shell/browser/osr/osr_web_contents_view.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "shell/browser/native_window_views.h"
|
||||
#endif
|
||||
|
@ -350,10 +347,8 @@ struct Converter<electron::api::WebContents::Type> {
|
|||
*out = Type::kBrowserView;
|
||||
} else if (type == "webview") {
|
||||
*out = Type::kWebView;
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
} else if (type == "offscreen") {
|
||||
*out = Type::kOffScreen;
|
||||
#endif
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -845,11 +840,9 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
// Get type
|
||||
options.Get("type", &type_);
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
bool b = false;
|
||||
if (options.Get(options::kOffscreen, &b) && b)
|
||||
type_ = Type::kOffScreen;
|
||||
#endif
|
||||
|
||||
// Init embedder earlier
|
||||
options.Get("embedder", &embedder_);
|
||||
|
@ -886,7 +879,6 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
std::make_unique<WebViewGuestDelegate>(embedder_->web_contents(), this);
|
||||
params.guest_delegate = guest_delegate_.get();
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
if (embedder_ && embedder_->IsOffScreen()) {
|
||||
auto* view = new OffScreenWebContentsView(
|
||||
false,
|
||||
|
@ -897,9 +889,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
web_contents = content::WebContents::Create(params);
|
||||
view->SetWebContents(web_contents.get());
|
||||
} else {
|
||||
#endif
|
||||
web_contents = content::WebContents::Create(params);
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
}
|
||||
} else if (IsOffScreen()) {
|
||||
// webPreferences does not have a transparent option, so if the window needs
|
||||
|
@ -918,7 +908,6 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
|
||||
web_contents = content::WebContents::Create(params);
|
||||
view->SetWebContents(web_contents.get());
|
||||
#endif
|
||||
} else {
|
||||
content::WebContents::CreateParams params(session->browser_context());
|
||||
params.initially_hidden = !initially_shown;
|
||||
|
@ -2304,11 +2293,9 @@ void WebContents::SetOwnerWindow(content::WebContents* web_contents,
|
|||
owner_window_ = nullptr;
|
||||
web_contents->RemoveUserData(NativeWindowRelay::UserDataKey());
|
||||
}
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
auto* osr_wcv = GetOffScreenWebContentsView();
|
||||
if (osr_wcv)
|
||||
osr_wcv->SetNativeWindow(owner_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
content::WebContents* WebContents::GetWebContents() const {
|
||||
|
@ -3330,9 +3317,7 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
|
|||
blink::WebMouseEvent mouse_event;
|
||||
if (gin::ConvertFromV8(isolate, input_event, &mouse_event)) {
|
||||
if (IsOffScreen()) {
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
GetOffScreenRenderWidgetHostView()->SendMouseEvent(mouse_event);
|
||||
#endif
|
||||
} else {
|
||||
rwh->ForwardMouseEvent(mouse_event);
|
||||
}
|
||||
|
@ -3353,10 +3338,8 @@ void WebContents::SendInputEvent(v8::Isolate* isolate,
|
|||
blink::WebMouseWheelEvent mouse_wheel_event;
|
||||
if (gin::ConvertFromV8(isolate, input_event, &mouse_wheel_event)) {
|
||||
if (IsOffScreen()) {
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
GetOffScreenRenderWidgetHostView()->SendMouseWheelEvent(
|
||||
mouse_wheel_event);
|
||||
#endif
|
||||
} else {
|
||||
// Chromium expects phase info in wheel events (and applies a
|
||||
// DCHECK to verify it). See: https://crbug.com/756524.
|
||||
|
@ -3524,14 +3507,9 @@ void WebContents::AttachToIframe(content::WebContents* embedder_web_contents,
|
|||
}
|
||||
|
||||
bool WebContents::IsOffScreen() const {
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
return type_ == Type::kOffScreen;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
void WebContents::OnPaint(const gfx::Rect& dirty_rect, const SkBitmap& bitmap) {
|
||||
Emit("paint", dirty_rect, gfx::Image::CreateFrom1xBitmap(bitmap));
|
||||
}
|
||||
|
@ -3563,15 +3541,12 @@ int WebContents::GetFrameRate() const {
|
|||
auto* osr_wcv = GetOffScreenWebContentsView();
|
||||
return osr_wcv ? osr_wcv->GetFrameRate() : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void WebContents::Invalidate() {
|
||||
if (IsOffScreen()) {
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
auto* osr_rwhv = GetOffScreenRenderWidgetHostView();
|
||||
if (osr_rwhv)
|
||||
osr_rwhv->Invalidate();
|
||||
#endif
|
||||
} else {
|
||||
auto* const window = owner_window();
|
||||
if (window)
|
||||
|
@ -4301,13 +4276,11 @@ void WebContents::FillObjectTemplate(v8::Isolate* isolate,
|
|||
.SetMethod("attachToIframe", &WebContents::AttachToIframe)
|
||||
.SetMethod("detachFromOuterFrame", &WebContents::DetachFromOuterFrame)
|
||||
.SetMethod("isOffscreen", &WebContents::IsOffScreen)
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
.SetMethod("startPainting", &WebContents::StartPainting)
|
||||
.SetMethod("stopPainting", &WebContents::StopPainting)
|
||||
.SetMethod("isPainting", &WebContents::IsPainting)
|
||||
.SetMethod("setFrameRate", &WebContents::SetFrameRate)
|
||||
.SetMethod("getFrameRate", &WebContents::GetFrameRate)
|
||||
#endif
|
||||
.SetMethod("invalidate", &WebContents::Invalidate)
|
||||
.SetMethod("setZoomLevel", &WebContents::SetZoomLevel)
|
||||
.SetMethod("getZoomLevel", &WebContents::GetZoomLevel)
|
||||
|
|
|
@ -91,11 +91,8 @@ class WebViewGuestDelegate;
|
|||
class FrameSubscriber;
|
||||
class WebDialogHelper;
|
||||
class NativeWindow;
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
class OffScreenRenderWidgetHostView;
|
||||
class OffScreenWebContentsView;
|
||||
#endif
|
||||
|
||||
namespace api {
|
||||
|
||||
|
@ -285,14 +282,12 @@ class WebContents : public ExclusiveAccessContext,
|
|||
|
||||
// Methods for offscreen rendering
|
||||
bool IsOffScreen() const;
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
void OnPaint(const gfx::Rect& dirty_rect, const SkBitmap& bitmap);
|
||||
void StartPainting();
|
||||
void StopPainting();
|
||||
bool IsPainting() const;
|
||||
void SetFrameRate(int frame_rate);
|
||||
int GetFrameRate() const;
|
||||
#endif
|
||||
void Invalidate();
|
||||
gfx::Size GetSizeForNewRenderView(content::WebContents*) override;
|
||||
|
||||
|
@ -653,10 +648,8 @@ class WebContents : public ExclusiveAccessContext,
|
|||
|
||||
void OnElectronBrowserConnectionError();
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
OffScreenWebContentsView* GetOffScreenWebContentsView() const;
|
||||
OffScreenRenderWidgetHostView* GetOffScreenRenderWidgetHostView() const;
|
||||
#endif
|
||||
|
||||
// Called when received a synchronous message from renderer to
|
||||
// get the zoom level.
|
||||
|
|
|
@ -7,11 +7,8 @@
|
|||
#include "content/browser/renderer_host/frame_tree.h" // nogncheck
|
||||
#include "content/browser/renderer_host/frame_tree_node.h" // nogncheck
|
||||
#include "content/browser/web_contents/web_contents_impl.h" // nogncheck
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "shell/browser/osr/osr_web_contents_view.h"
|
||||
#endif
|
||||
|
||||
// Including both web_contents_impl.h and node.h would introduce a error, we
|
||||
// have to isolate the usage of WebContentsImpl into a clean file to fix it:
|
||||
|
@ -31,7 +28,6 @@ void WebContents::DetachFromOuterFrame() {
|
|||
}
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
OffScreenWebContentsView* WebContents::GetOffScreenWebContentsView() const {
|
||||
if (IsOffScreen()) {
|
||||
const auto* impl =
|
||||
|
@ -51,6 +47,5 @@ OffScreenRenderWidgetHostView* WebContents::GetOffScreenRenderWidgetHostView()
|
|||
return nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace electron::api
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include "electron/buildflags/buildflags.h"
|
||||
#include "mojo/public/cpp/bindings/associated_remote.h"
|
||||
#include "shell/browser/native_window_views.h"
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "shell/browser/osr/osr_view_proxy.h"
|
||||
#include "shell/browser/ui/autofill_popup.h"
|
||||
#include "shell/common/api/api.mojom.h"
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
||||
|
@ -25,11 +27,6 @@
|
|||
#include "ui/gfx/geometry/vector2d.h"
|
||||
#include "ui/gfx/text_utils.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
#include "shell/browser/osr/osr_render_widget_host_view.h"
|
||||
#include "shell/browser/osr/osr_view_proxy.h"
|
||||
#endif
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace {
|
||||
|
@ -194,7 +191,6 @@ void AutofillPopup::CreateView(content::RenderFrameHost* frame_host,
|
|||
|
||||
view_ = new AutofillPopupView(this, parent->GetWidget());
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
if (offscreen) {
|
||||
auto* rwhv = frame_host->GetView();
|
||||
if (embedder_frame_host != nullptr) {
|
||||
|
@ -205,7 +201,6 @@ void AutofillPopup::CreateView(content::RenderFrameHost* frame_host,
|
|||
view_->view_proxy_ = std::make_unique<OffscreenViewProxy>(view_);
|
||||
osr_rwhv->AddViewProxy(view_->view_proxy_.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Do this after OSR setup, we check for view_proxy_ when showing
|
||||
view_->Show();
|
||||
|
|
|
@ -48,11 +48,9 @@ AutofillPopupView::~AutofillPopupView() {
|
|||
|
||||
RemoveObserver();
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
if (view_proxy_.get()) {
|
||||
view_proxy_->ResetView();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (GetWidget()) {
|
||||
GetWidget()->Close();
|
||||
|
@ -61,9 +59,7 @@ AutofillPopupView::~AutofillPopupView() {
|
|||
|
||||
void AutofillPopupView::Show() {
|
||||
bool visible = parent_widget_->IsVisible();
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
visible = visible || view_proxy_;
|
||||
#endif
|
||||
if (!popup_ || !visible || parent_widget_->IsClosed())
|
||||
return;
|
||||
|
||||
|
@ -228,11 +224,9 @@ void AutofillPopupView::DoUpdateBoundsAndRedrawPopup() {
|
|||
popup_->popup_bounds_.Union(
|
||||
gfx::Rect(popup_->popup_bounds_.origin(), gfx::Size(1, 1)));
|
||||
GetWidget()->SetBounds(popup_->popup_bounds_);
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
if (view_proxy_.get()) {
|
||||
view_proxy_->SetBounds(popup_->popup_bounds_in_view());
|
||||
}
|
||||
#endif
|
||||
SchedulePaint();
|
||||
}
|
||||
|
||||
|
@ -243,7 +237,6 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
|
|||
gfx::Canvas* draw_canvas = canvas;
|
||||
SkBitmap bitmap;
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
std::unique_ptr<cc::SkiaPaintCanvas> paint_canvas;
|
||||
if (view_proxy_.get()) {
|
||||
bitmap.allocN32Pixels(popup_->popup_bounds_in_view().width(),
|
||||
|
@ -251,7 +244,6 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
|
|||
paint_canvas = std::make_unique<cc::SkiaPaintCanvas>(bitmap);
|
||||
draw_canvas = new gfx::Canvas(paint_canvas.get(), 1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
draw_canvas->DrawColor(
|
||||
GetColorProvider()->GetColor(ui::kColorResultsTableNormalBackground));
|
||||
|
@ -263,12 +255,10 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
|
|||
DrawAutofillEntry(draw_canvas, i, line_rect);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
if (view_proxy_.get()) {
|
||||
view_proxy_->SetBounds(popup_->popup_bounds_in_view());
|
||||
view_proxy_->SetBitmap(bitmap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void AutofillPopupView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "shell/browser/osr/osr_view_proxy.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/accessibility/ax_node_data.h"
|
||||
#include "ui/views/drag_controller.h"
|
||||
|
@ -20,10 +21,6 @@
|
|||
#include "ui/views/widget/widget_delegate.h"
|
||||
#include "ui/views/widget/widget_observer.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
#include "shell/browser/osr/osr_view_proxy.h"
|
||||
#endif
|
||||
|
||||
namespace electron {
|
||||
|
||||
const int kPopupBorderThickness = 1;
|
||||
|
@ -142,9 +139,7 @@ class AutofillPopupView : public views::WidgetDelegateView,
|
|||
// The index of the currently selected line
|
||||
absl::optional<int> selected_line_;
|
||||
|
||||
#if BUILDFLAG(ENABLE_OSR)
|
||||
std::unique_ptr<OffscreenViewProxy> view_proxy_;
|
||||
#endif
|
||||
|
||||
// The registered keypress callback, responsible for switching lines on
|
||||
// key presses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue