electron/shell/browser/osr/osr_render_widget_host_view.cc

1038 lines
33 KiB
C++
Raw Normal View History

2016-07-30 19:35:14 +00:00
// Copyright (c) 2016 GitHub, Inc.
2016-07-05 19:33:22 +00:00
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/osr/osr_render_widget_host_view.h"
2016-07-29 12:50:27 +00:00
#include <algorithm>
2017-06-29 23:50:55 +00:00
#include <memory>
#include <utility>
2016-07-31 10:19:56 +00:00
#include <vector>
2016-08-03 04:46:34 +00:00
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/optional.h"
2016-08-03 04:46:34 +00:00
#include "base/single_thread_task_runner.h"
#include "base/task/post_task.h"
2016-08-03 04:46:34 +00:00
#include "base/time/time.h"
2018-05-15 01:59:22 +00:00
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
#include "components/viz/common/gl_helper.h"
#include "components/viz/common/quads/render_pass.h"
#include "content/browser/renderer_host/cursor_manager.h" // nogncheck
#include "content/browser/renderer_host/input/synthetic_gesture_target.h" // nogncheck
#include "content/browser/renderer_host/render_widget_host_delegate.h" // nogncheck
#include "content/browser/renderer_host/render_widget_host_owner_delegate.h" // nogncheck
2016-07-05 19:33:22 +00:00
#include "content/common/view_messages.h"
#include "content/public/browser/browser_task_traits.h"
2016-08-03 04:46:34 +00:00
#include "content/public/browser/browser_thread.h"
2016-07-05 19:33:22 +00:00
#include "content/public/browser/context_factory.h"
#include "content/public/browser/gpu_data_manager.h"
2018-05-15 01:59:22 +00:00
#include "content/public/browser/render_process_host.h"
2017-04-05 08:31:22 +00:00
#include "media/base/video_frame.h"
chore: bump chromium to 279aeeec3c9fe2237bc31f776f269 (master) (#21521) * chore: bump chromium in DEPS to 46d2d82e84d73806da623c5333dae4dd218172df * chore: bump chromium in DEPS to cbafe74731a5d1e59844ca59e0fc28f4a5f80a33 * chore: bump chromium in DEPS to d5dcd6b5cc76f4e1732083d775cdd7b533f0abe9 * Update patches * update for lint * Fix compilation errors * chore: bump chromium in DEPS to 1c19360fdaaf65d4ed006736c7f9804104095990 * Replace removed constant * chore: bump chromium in DEPS to 3b6639f5da26c1772c5d4f3ba634aca65df75fec * chore: bump chromium in DEPS to cc6b1b930d4b5eca06701820dac54fa0f41e8999 * chore: bump chromium in DEPS to 7d1445641ad1032c67f731ba6ff7798f29349ade * chore: bump chromium in DEPS to 6f7e5e79cefe982ad84a88927565a88db2e592be * chore: bump chromium in DEPS to bfb25dafff19cb41bf9781331d19ef0be819d1e4 * chore: bump chromium in DEPS to 1a8196b39f0e0cdc4935fd122fff5625d5fab06e * chore: bump chromium in DEPS to 9a03d8d2bb38ad8c0cbb9550ca81b2f94ff60c15 * chore: bump chromium in DEPS to 4c67f3505dab2d5457adb418cd3270a4f3236fd0 * chore: bump chromium in DEPS to 652394e7626fc1ae895a53fb34c64070494e648e * chore: bump chromium in DEPS to 07653652c58cc019af7f833bd63eb0c2eceaab5e * chore: bump chromium in DEPS to 451a1c5fec1fb073a5bae12a033bb342c72c905f * chore: bump chromium in DEPS to 86cdba00e233899a232868b412b333d08db63478 * chore: bump chromium in DEPS to 7c322faad1aee8abef2330d74aabf09ecf8c11af * Update patches * chore: bump chromium in DEPS to d0044fae7efc29eb201cfdd5fdbed77d48aba212 * Replace IsProcessingUserGesture with HasTransientUserActivation https://chromium.googlesource.com/chromium/src/+/4baa9a6e85e6c1784fd20d196c1c3c85fdb40101 * Fix 10.15 sdk build https://chromium.googlesource.com/chromium/src/+/0eaa6db358ca97b1cd358934068ade9a249c83db * Remove CancelPrerender https://chromium.googlesource.com/chromium/src/+/5eb33297194c3d3d6a7f2d744b3811033463194e * Remove no longer used WebFloatPoint https://chromium.googlesource.com/chromium/src/+/43ab96ce6bfc78440e5b1617a9974386a54c750c * Use base::span<const uint8_t> for devtools messages in content/public https://chromium.googlesource.com/chromium/src/+/21e19401af0b12d13ddc14d4a167f1b02ec65a6b * Update renamed header files * TODO: update with upstream changes This code needs to be updated to handle the changes made in: https://chromium.googlesource.com/chromium/src/+/19be6547a9a898104cd172de77184e243643ee19 * chore: bump chromium in DEPS to 82e5a2c6bd33c2e53634a09fbcbc9fcac1e7ff93 * chore: bump chromium in DEPS to 91f877cadd2995201c276e952b3bf2c60b226c64 * chore: bump chromium in DEPS to 43fcd2ab2677a06d38246b42761dc5b40cf87177 * chore: bump chromium in DEPS to e30957dcb710c0977a7ff95b8d3cf65843df12ca * chore: bump chromium in DEPS to 6a8335a56db12aae2fd06296f82579d804d92217 * chore: bump chromium in DEPS to a4a436cbc28ace88d71752f8f479e59559e54e46 * chore: bump chromium in DEPS to 982bbd0e4b2e1d57d515f384f6483ffc0d7073ad * chore: bump chromium in DEPS to 92bb7a99f84ffcdf41d4edca57e90b1f0c7c6c8b * update patches * add checkout_google_benchmark gclient var * FIXME: workaround grit bug * chore: bump chromium in DEPS to d3623fc53615739e6b59340a5d349e4b397cb7c5 * update patches * Remove color arg from DidChangeThemeColor(). https://chromium-review.googlesource.com/c/chromium/src/+/1982623 * update CreateFileURLLoader with new suffix CL: https://chromium-review.googlesource.com/c/chromium/src/+/1981414 * add node patch for removal of task API in v8 CL: https://chromium-review.googlesource.com/c/v8/v8/+/1868620 * add disable_secure_dns param for WillCreateURLLoaderFactory CL: https://chromium-review.googlesource.com/c/chromium/src/+/1888099 * switch to mojo-ified PrintMsg_PrintPreview CL: https://chromium-review.googlesource.com/c/chromium/src/+/1972307 * chore: bump chromium in DEPS to e7a6d173632660b6aeb9806e9132c34a315331c2 * update missing chrome/browser/ssl:proto dependency after chrome removal CL: https://chromium-review.googlesource.com/c/chromium/src/+/1986082 * chore: add libvulkan.so to the linux manifest CL: https://chromium-review.googlesource.com/c/chromium/src/+/1973042 * revert DidChangeThemeColor ternary change due to templates * match Chrome's mojo-ified implementation in geolocation_permission_context.cc CL: https://chromium-review.googlesource.com/c/chromium/src/+/1963371 * add vulkan-1.dll to zips https://github.com/KhronosGroup/Vulkan-Loader/commit/2d6f74c6d4319e94cf1fa33954c619ab4428f2b8 * add bug link to fixme_grit_conflicts.patch * Introduce device.mojom.DeviceService https://chromium-review.googlesource.com/c/chromium/src/+/1956277 * PDF Compositor rename to Print Compositor https://chromium-review.googlesource.com/c/chromium/src/+/1981135 * chore: bump chromium_version 00362ea584735b4acf4c5a0e1912d7987f8645ab * chore: update patches * Use a virtual base class to provide GetWidget(). https://chromium-review.googlesource.com/c/chromium/src/+/1996948 * [base] Remove usage of base::CurrentThread https://chromium-review.googlesource.com/c/chromium/src/+/1962019 * chore: gn format * Revert "ci: Use Visual Studio Build Tools instead of VS Studio (#21771)" This reverts commit 9c1310dadc09f88daf8866b38af9ebb385a2e9d3. * fix: trigger resize when iframe requests fullscreen * fix: Locking scheme registry is not necessary https://chromium-review.googlesource.com/c/chromium/src/+/1973198 * chore: bump chromium f707f1d6d428f84cf14b64bc2ca74372e25c6ce7 * chore: update patches * ui/base/clipboard: Remove redundant ANSI format functions https://chromium-review.googlesource.com/c/chromium/src/+/1992015 * [base] Prepare //chrome for Value::GetList() switch https://chromium-review.googlesource.com/c/chromium/src/+/1962255 Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: loc <andy@slack-corp.com> Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net> Co-authored-by: Robo <hop2deep@gmail.com>
2020-01-17 18:41:52 +00:00
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/skia/include/core/SkCanvas.h"
2017-01-26 07:10:28 +00:00
#include "ui/compositor/compositor.h"
2016-07-05 19:33:22 +00:00
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_type.h"
#include "ui/display/screen.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event_constants.h"
#include "ui/gfx/canvas.h"
2016-08-03 04:46:34 +00:00
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/image/image_skia.h"
2016-07-05 19:33:22 +00:00
#include "ui/gfx/native_widget_types.h"
2017-03-05 15:18:57 +00:00
#include "ui/gfx/skbitmap_operations.h"
#include "ui/latency/latency_info.h"
2016-07-29 22:51:19 +00:00
namespace electron {
2016-08-03 05:09:38 +00:00
namespace {
2016-07-18 14:16:23 +00:00
2016-08-03 05:09:38 +00:00
const float kDefaultScaleFactor = 1.0;
2016-07-18 14:16:23 +00:00
ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
ui::EventType type = ui::EventType::ET_UNKNOWN;
2017-06-16 20:42:33 +00:00
switch (event.GetType()) {
case blink::WebInputEvent::kMouseDown:
type = ui::EventType::ET_MOUSE_PRESSED;
break;
2017-06-16 20:42:33 +00:00
case blink::WebInputEvent::kMouseUp:
type = ui::EventType::ET_MOUSE_RELEASED;
break;
2017-06-16 20:42:33 +00:00
case blink::WebInputEvent::kMouseMove:
type = ui::EventType::ET_MOUSE_MOVED;
break;
2017-06-16 20:42:33 +00:00
case blink::WebInputEvent::kMouseEnter:
type = ui::EventType::ET_MOUSE_ENTERED;
break;
2017-06-16 20:42:33 +00:00
case blink::WebInputEvent::kMouseLeave:
type = ui::EventType::ET_MOUSE_EXITED;
break;
2017-06-16 20:42:33 +00:00
case blink::WebInputEvent::kMouseWheel:
type = ui::EventType::ET_MOUSEWHEEL;
break;
default:
type = ui::EventType::ET_UNKNOWN;
break;
}
int button_flags = 0;
switch (event.button) {
2017-06-16 20:42:33 +00:00
case blink::WebMouseEvent::Button::kBack:
button_flags |= ui::EventFlags::EF_BACK_MOUSE_BUTTON;
break;
2017-06-16 20:42:33 +00:00
case blink::WebMouseEvent::Button::kForward:
button_flags |= ui::EventFlags::EF_FORWARD_MOUSE_BUTTON;
break;
2017-06-16 20:42:33 +00:00
case blink::WebMouseEvent::Button::kLeft:
button_flags |= ui::EventFlags::EF_LEFT_MOUSE_BUTTON;
break;
2017-06-16 20:42:33 +00:00
case blink::WebMouseEvent::Button::kMiddle:
button_flags |= ui::EventFlags::EF_MIDDLE_MOUSE_BUTTON;
break;
2017-06-16 20:42:33 +00:00
case blink::WebMouseEvent::Button::kRight:
button_flags |= ui::EventFlags::EF_RIGHT_MOUSE_BUTTON;
break;
default:
button_flags = 0;
break;
}
ui::MouseEvent ui_event(type,
gfx::Point(std::floor(event.PositionInWidget().x()),
std::floor(event.PositionInWidget().y())),
gfx::Point(std::floor(event.PositionInWidget().x()),
std::floor(event.PositionInWidget().y())),
2017-06-29 23:50:55 +00:00
ui::EventTimeForNow(), button_flags, button_flags);
2017-06-16 20:42:33 +00:00
ui_event.SetClickCount(event.click_count);
return ui_event;
}
ui::MouseWheelEvent UiMouseWheelEventFromWebMouseEvent(
blink::WebMouseWheelEvent event) {
return ui::MouseWheelEvent(UiMouseEventFromWebMouseEvent(event),
2018-04-18 01:55:30 +00:00
std::floor(event.delta_x),
std::floor(event.delta_y));
}
2016-08-03 05:09:38 +00:00
} // namespace
2016-07-05 19:33:22 +00:00
class ElectronDelegatedFrameHostClient
: public content::DelegatedFrameHostClient {
public:
explicit ElectronDelegatedFrameHostClient(OffScreenRenderWidgetHostView* view)
: view_(view) {}
ui::Layer* DelegatedFrameHostGetLayer() const override {
return view_->GetRootLayer();
}
bool DelegatedFrameHostIsVisible() const override {
return view_->IsShowing();
}
SkColor DelegatedFrameHostGetGutterColor() const override {
if (view_->render_widget_host()->delegate() &&
view_->render_widget_host()->delegate()->IsFullscreenForCurrentTab()) {
return SK_ColorWHITE;
}
return *view_->GetBackgroundColor();
}
void OnFrameTokenChanged(uint32_t frame_token) override {
view_->render_widget_host()->DidProcessFrame(frame_token);
}
float GetDeviceScaleFactor() const override {
return view_->GetDeviceScaleFactor();
}
std::vector<viz::SurfaceId> CollectSurfaceIdsForEviction() override {
return view_->render_widget_host()->CollectSurfaceIdsForEviction();
}
2019-02-04 13:33:47 +00:00
bool ShouldShowStaleContentOnEviction() override { return false; }
void InvalidateLocalSurfaceIdOnEviction() override {}
private:
OffScreenRenderWidgetHostView* const view_;
DISALLOW_COPY_AND_ASSIGN(ElectronDelegatedFrameHostClient);
};
2016-07-29 12:50:27 +00:00
OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
2016-08-03 04:46:34 +00:00
bool transparent,
bool painting,
int frame_rate,
const OnPaintCallback& callback,
2016-08-03 04:46:34 +00:00
content::RenderWidgetHost* host,
OffScreenRenderWidgetHostView* parent_host_view,
gfx::Size initial_size)
2018-08-30 22:44:35 +00:00
: content::RenderWidgetHostViewBase(host),
render_widget_host_(content::RenderWidgetHostImpl::From(host)),
parent_host_view_(parent_host_view),
transparent_(transparent),
callback_(callback),
frame_rate_(frame_rate),
size_(initial_size),
painting_(painting),
is_showing_(false),
cursor_manager_(new content::CursorManager(this)),
2018-08-30 22:44:35 +00:00
mouse_wheel_phase_handler_(this),
backing_(new SkBitmap),
2016-08-03 04:46:34 +00:00
weak_ptr_factory_(this) {
2016-07-13 15:43:00 +00:00
DCHECK(render_widget_host_);
DCHECK(!render_widget_host_->GetView());
current_device_scale_factor_ = kDefaultScaleFactor;
delegated_frame_host_allocator_.GenerateId();
delegated_frame_host_allocation_ =
delegated_frame_host_allocator_.GetCurrentLocalSurfaceIdAllocation();
compositor_allocator_.GenerateId();
compositor_allocation_ =
compositor_allocator_.GetCurrentLocalSurfaceIdAllocation();
delegated_frame_host_client_ =
std::make_unique<ElectronDelegatedFrameHostClient>(this);
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(), delegated_frame_host_client_.get(),
2018-05-15 01:59:22 +00:00
true /* should_register_frame_sink_id */);
2017-01-26 07:10:28 +00:00
root_layer_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR);
2018-08-30 22:44:35 +00:00
bool opaque = SkColorGetA(background_color_) == SK_AlphaOPAQUE;
2018-08-30 22:44:35 +00:00
GetRootLayer()->SetFillsBoundsOpaquely(opaque);
GetRootLayer()->SetColor(background_color_);
2018-08-30 22:44:35 +00:00
2017-04-05 08:31:22 +00:00
ui::ContextFactoryPrivate* context_factory_private =
content::GetContextFactoryPrivate();
compositor_ = std::make_unique<ui::Compositor>(
context_factory_private->AllocateFrameSinkId(),
content::GetContextFactory(), context_factory_private,
base::ThreadTaskRunnerHandle::Get(), false /* enable_pixel_canvas */,
false /* use_external_begin_frame_control */);
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
compositor_->SetDelegate(this);
2016-07-13 15:43:00 +00:00
compositor_->SetRootLayer(root_layer_.get());
ResizeRootLayer(false);
render_widget_host_->SetView(this);
InstallTransparency();
if (content::GpuDataManager::GetInstance()->HardwareAccelerationEnabled()) {
video_consumer_ = std::make_unique<OffScreenVideoConsumer>(
this, base::BindRepeating(&OffScreenRenderWidgetHostView::OnPaint,
weak_ptr_factory_.GetWeakPtr()));
video_consumer_->SetActive(IsPainting());
video_consumer_->SetFrameRate(GetFrameRate());
}
2016-07-22 11:55:58 +00:00
}
2016-07-18 14:16:23 +00:00
2016-07-29 22:51:19 +00:00
OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
2016-09-07 08:33:09 +00:00
// Marking the DelegatedFrameHost as removed from the window hierarchy is
// necessary to remove all connections to its old ui::Compositor.
2016-07-29 22:51:19 +00:00
if (is_showing_)
delegated_frame_host_->WasHidden(
content::DelegatedFrameHost::HiddenCause::kOther);
2018-11-07 19:17:53 +00:00
delegated_frame_host_->DetachFromCompositor();
2017-03-05 15:18:57 +00:00
delegated_frame_host_.reset();
compositor_.reset();
root_layer_.reset();
2016-07-18 14:16:23 +00:00
}
content::BrowserAccessibilityManager*
OffScreenRenderWidgetHostView::CreateBrowserAccessibilityManager(
content::BrowserAccessibilityDelegate*,
bool) {
return nullptr;
}
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::InitAsChild(gfx::NativeView) {
DCHECK(parent_host_view_);
if (parent_host_view_->child_host_view_) {
parent_host_view_->child_host_view_->CancelWidget();
}
2017-03-05 15:18:57 +00:00
parent_host_view_->set_child_host_view(this);
parent_host_view_->Hide();
ResizeRootLayer(false);
SetPainting(parent_host_view_->IsPainting());
2016-07-05 19:33:22 +00:00
}
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::SetSize(const gfx::Size& size) {
2016-07-13 15:43:00 +00:00
size_ = size;
SynchronizeVisualProperties();
2016-07-05 19:33:22 +00:00
}
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) {
SetSize(new_bounds.size());
2016-07-05 19:33:22 +00:00
}
chore: bump chromium to 1e9f9a24aa12 (master) (#17880) * chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
2019-04-20 17:20:37 +00:00
gfx::NativeView OffScreenRenderWidgetHostView::GetNativeView() {
2016-07-27 16:02:54 +00:00
return gfx::NativeView();
2016-07-05 19:33:22 +00:00
}
2016-07-29 22:51:19 +00:00
gfx::NativeViewAccessible
2016-08-03 04:46:34 +00:00
OffScreenRenderWidgetHostView::GetNativeViewAccessible() {
2016-07-13 15:43:00 +00:00
return gfx::NativeViewAccessible();
2016-07-05 19:33:22 +00:00
}
2016-07-29 12:50:27 +00:00
ui::TextInputClient* OffScreenRenderWidgetHostView::GetTextInputClient() {
2016-07-05 19:33:22 +00:00
return nullptr;
}
2018-04-18 01:55:30 +00:00
void OffScreenRenderWidgetHostView::Focus() {}
2016-07-05 19:33:22 +00:00
chore: bump chromium to 1e9f9a24aa12 (master) (#17880) * chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
2019-04-20 17:20:37 +00:00
bool OffScreenRenderWidgetHostView::HasFocus() {
2016-07-31 23:01:55 +00:00
return false;
2016-07-05 19:33:22 +00:00
}
chore: bump chromium to 1e9f9a24aa12 (master) (#17880) * chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
2019-04-20 17:20:37 +00:00
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() {
2017-04-05 08:31:22 +00:00
return GetDelegatedFrameHost()->CanCopyFromCompositingSurface();
2016-07-05 19:33:22 +00:00
}
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::Show() {
2016-07-13 15:43:00 +00:00
if (is_showing_)
return;
2016-07-05 19:33:22 +00:00
2016-07-13 15:43:00 +00:00
is_showing_ = true;
2016-09-07 08:33:09 +00:00
2018-11-07 19:17:53 +00:00
delegated_frame_host_->AttachToCompositor(compositor_.get());
delegated_frame_host_->WasShown(
GetLocalSurfaceIdAllocation().local_surface_id(),
GetRootLayer()->bounds().size(), base::nullopt);
2016-09-07 08:33:09 +00:00
if (render_widget_host_)
render_widget_host_->WasShown(base::nullopt);
2016-07-05 19:33:22 +00:00
}
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::Hide() {
2016-07-13 15:43:00 +00:00
if (!is_showing_)
return;
2016-07-18 14:16:23 +00:00
if (render_widget_host_)
render_widget_host_->WasHidden();
2016-09-07 08:33:09 +00:00
// TODO(deermichel): correct or kOther?
GetDelegatedFrameHost()->WasHidden(
content::DelegatedFrameHost::HiddenCause::kOccluded);
2018-11-07 19:17:53 +00:00
GetDelegatedFrameHost()->DetachFromCompositor();
2016-09-07 08:33:09 +00:00
2016-07-13 15:43:00 +00:00
is_showing_ = false;
2016-07-05 19:33:22 +00:00
}
2016-07-29 12:50:27 +00:00
bool OffScreenRenderWidgetHostView::IsShowing() {
2016-07-13 15:43:00 +00:00
return is_showing_;
2016-07-05 19:33:22 +00:00
}
void OffScreenRenderWidgetHostView::EnsureSurfaceSynchronizedForWebTest() {
++latest_capture_sequence_number_;
SynchronizeVisualProperties();
}
chore: bump chromium to 1e9f9a24aa12 (master) (#17880) * chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
2019-04-20 17:20:37 +00:00
gfx::Rect OffScreenRenderWidgetHostView::GetViewBounds() {
if (IsPopupWidget())
return popup_position_;
2016-07-05 19:33:22 +00:00
return gfx::Rect(size_);
}
2016-08-01 11:27:39 +00:00
void OffScreenRenderWidgetHostView::SetBackgroundColor(SkColor color) {
2017-07-08 19:25:15 +00:00
// The renderer will feed its color back to us with the first CompositorFrame.
// We short-cut here to show a sensible color before that happens.
UpdateBackgroundColorFromRenderer(color);
2016-08-01 11:27:39 +00:00
2019-02-04 13:33:47 +00:00
if (render_widget_host_ && render_widget_host_->owner_delegate()) {
render_widget_host_->owner_delegate()->SetBackgroundOpaque(
SkColorGetA(color) == SK_AlphaOPAQUE);
2017-07-08 19:25:15 +00:00
}
}
2016-08-01 11:27:39 +00:00
chore: bump chromium to 1e9f9a24aa12 (master) (#17880) * chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
2019-04-20 17:20:37 +00:00
base::Optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor() {
2017-07-08 19:25:15 +00:00
return background_color_;
2016-08-01 11:27:39 +00:00
}
void OffScreenRenderWidgetHostView::UpdateBackgroundColor() {
NOTREACHED();
}
chore: bump chromium to 1e9f9a24aa12 (master) (#17880) * chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
2019-04-20 17:20:37 +00:00
gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() {
2016-07-05 19:33:22 +00:00
return size_;
}
2018-04-18 01:55:30 +00:00
void OffScreenRenderWidgetHostView::SetInsets(const gfx::Insets& insets) {}
2016-07-05 19:33:22 +00:00
bool OffScreenRenderWidgetHostView::LockMouse(
bool request_unadjusted_movement) {
2016-07-05 19:33:22 +00:00
return false;
}
2018-04-18 01:55:30 +00:00
void OffScreenRenderWidgetHostView::UnlockMouse() {}
2016-07-05 19:33:22 +00:00
2018-08-30 22:44:35 +00:00
void OffScreenRenderWidgetHostView::TakeFallbackContentFrom(
content::RenderWidgetHostView* view) {
DCHECK(!static_cast<content::RenderWidgetHostViewBase*>(view)
->IsRenderWidgetHostViewChildFrame());
OffScreenRenderWidgetHostView* view_osr =
static_cast<OffScreenRenderWidgetHostView*>(view);
SetBackgroundColor(view_osr->background_color_);
2018-08-30 22:44:35 +00:00
if (GetDelegatedFrameHost() && view_osr->GetDelegatedFrameHost()) {
GetDelegatedFrameHost()->TakeFallbackContentFrom(
view_osr->GetDelegatedFrameHost());
}
host()->GetContentRenderingTimeoutFrom(view_osr->host());
}
2018-11-07 19:17:53 +00:00
void OffScreenRenderWidgetHostView::ResetFallbackToFirstNavigationSurface() {
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
}
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::InitAsPopup(
2018-04-18 01:55:30 +00:00
content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) {
DCHECK_EQ(parent_host_view_, parent_host_view);
DCHECK_EQ(widget_type_, content::WidgetType::kPopup);
2017-03-05 15:18:57 +00:00
if (parent_host_view_->popup_host_view_) {
parent_host_view_->popup_host_view_->CancelWidget();
}
2017-03-05 15:18:57 +00:00
parent_host_view_->set_popup_host_view(this);
2018-04-18 01:55:30 +00:00
parent_callback_ =
base::BindRepeating(&OffScreenRenderWidgetHostView::OnPopupPaint,
parent_host_view_->weak_ptr_factory_.GetWeakPtr());
2017-03-05 15:18:57 +00:00
popup_position_ = pos;
2017-03-05 15:18:57 +00:00
ResizeRootLayer(false);
SetPainting(parent_host_view_->IsPainting());
if (video_consumer_) {
video_consumer_->SizeChanged();
}
Show();
2016-07-05 19:33:22 +00:00
}
2016-07-29 22:51:19 +00:00
void OffScreenRenderWidgetHostView::InitAsFullscreen(
2018-04-18 01:55:30 +00:00
content::RenderWidgetHostView*) {}
2016-07-05 19:33:22 +00:00
2018-04-18 01:55:30 +00:00
void OffScreenRenderWidgetHostView::UpdateCursor(const content::WebCursor&) {}
2016-07-05 19:33:22 +00:00
content::CursorManager* OffScreenRenderWidgetHostView::GetCursorManager() {
return cursor_manager_.get();
}
2018-04-18 01:55:30 +00:00
void OffScreenRenderWidgetHostView::SetIsLoading(bool loading) {}
2016-07-05 19:33:22 +00:00
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::TextInputStateChanged(
2018-04-18 01:55:30 +00:00
const content::TextInputState& params) {}
2016-07-05 19:33:22 +00:00
2018-04-18 01:55:30 +00:00
void OffScreenRenderWidgetHostView::ImeCancelComposition() {}
2016-07-05 19:33:22 +00:00
void OffScreenRenderWidgetHostView::RenderProcessGone() {
2016-07-05 19:33:22 +00:00
Destroy();
}
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::Destroy() {
if (!is_destroyed_) {
is_destroyed_ = true;
if (parent_host_view_ != nullptr) {
CancelWidget();
} else {
if (popup_host_view_)
popup_host_view_->CancelWidget();
if (child_host_view_)
child_host_view_->CancelWidget();
2017-07-08 19:25:15 +00:00
if (!guest_host_views_.empty()) {
// Guest RWHVs will be destroyed when the associated RWHVGuest is
// destroyed. This parent RWHV may be destroyed first, so disassociate
// the guest RWHVs here without destroying them.
2018-05-04 06:45:12 +00:00
for (auto* guest_host_view : guest_host_views_)
2017-07-08 19:25:15 +00:00
guest_host_view->parent_host_view_ = nullptr;
guest_host_views_.clear();
}
2018-05-04 06:45:12 +00:00
for (auto* proxy_view : proxy_views_)
proxy_view->RemoveObserver();
Hide();
}
}
2017-03-05 15:18:57 +00:00
2016-07-30 19:25:49 +00:00
delete this;
2016-07-05 19:33:22 +00:00
}
2018-04-18 01:55:30 +00:00
void OffScreenRenderWidgetHostView::SetTooltipText(const base::string16&) {}
2016-07-05 19:33:22 +00:00
uint32_t OffScreenRenderWidgetHostView::GetCaptureSequenceNumber() const {
return latest_capture_sequence_number_;
}
2017-04-05 08:31:22 +00:00
void OffScreenRenderWidgetHostView::CopyFromSurface(
2018-05-15 01:59:22 +00:00
const gfx::Rect& src_rect,
const gfx::Size& output_size,
base::OnceCallback<void(const SkBitmap&)> callback) {
GetDelegatedFrameHost()->CopyFromCompositingSurface(src_rect, output_size,
std::move(callback));
2016-07-05 19:33:22 +00:00
}
2018-05-15 01:59:22 +00:00
void OffScreenRenderWidgetHostView::GetScreenInfo(
chore: bump chromium to 1e9f9a24aa12 (master) (#17880) * chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
2019-04-20 17:20:37 +00:00
content::ScreenInfo* screen_info) {
2018-05-15 01:59:22 +00:00
screen_info->depth = 24;
screen_info->depth_per_component = 8;
screen_info->orientation_angle = 0;
screen_info->device_scale_factor = current_device_scale_factor_;
2018-05-15 01:59:22 +00:00
screen_info->orientation_type =
content::SCREEN_ORIENTATION_VALUES_LANDSCAPE_PRIMARY;
screen_info->rect = gfx::Rect(size_);
screen_info->available_rect = gfx::Rect(size_);
2016-07-05 19:33:22 +00:00
}
void OffScreenRenderWidgetHostView::TransformPointToRootSurface(
gfx::PointF* point) {}
2016-07-05 19:33:22 +00:00
2016-07-29 12:50:27 +00:00
gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() {
2016-07-05 19:33:22 +00:00
return gfx::Rect(size_);
}
2018-05-15 01:59:22 +00:00
viz::SurfaceId OffScreenRenderWidgetHostView::GetCurrentSurfaceId() const {
return GetDelegatedFrameHost()
? GetDelegatedFrameHost()->GetCurrentSurfaceId()
: viz::SurfaceId();
}
std::unique_ptr<content::SyntheticGestureTarget>
OffScreenRenderWidgetHostView::CreateSyntheticGestureTarget() {
NOTIMPLEMENTED();
return nullptr;
}
2016-07-29 12:50:27 +00:00
void OffScreenRenderWidgetHostView::ImeCompositionRangeChanged(
2018-04-18 01:55:30 +00:00
const gfx::Range&,
const std::vector<gfx::Rect>&) {}
2016-07-05 19:33:22 +00:00
chore: bump chromium to 1e9f9a24aa12 (master) (#17880) * chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
2019-04-20 17:20:37 +00:00
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize() {
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
current_device_scale_factor_);
2016-07-13 15:43:00 +00:00
}
content::RenderWidgetHostViewBase*
2018-04-18 01:55:30 +00:00
OffScreenRenderWidgetHostView::CreateViewForWidget(
content::RenderWidgetHost* render_widget_host,
content::RenderWidgetHost* embedder_render_widget_host,
content::WebContentsView* web_contents_view) {
if (render_widget_host->GetView()) {
return static_cast<content::RenderWidgetHostViewBase*>(
render_widget_host->GetView());
}
OffScreenRenderWidgetHostView* embedder_host_view = nullptr;
if (embedder_render_widget_host) {
embedder_host_view = static_cast<OffScreenRenderWidgetHostView*>(
embedder_render_widget_host->GetView());
}
return new OffScreenRenderWidgetHostView(
2018-04-18 01:55:30 +00:00
transparent_, true, embedder_host_view->GetFrameRate(), callback_,
render_widget_host, embedder_host_view, size());
}
const viz::FrameSinkId& OffScreenRenderWidgetHostView::GetFrameSinkId() const {
return GetDelegatedFrameHost()->frame_sink_id();
}
void OffScreenRenderWidgetHostView::DidNavigate() {
ResizeRootLayer(true);
if (delegated_frame_host_)
delegated_frame_host_->DidNavigate();
}
2017-04-05 08:31:22 +00:00
bool OffScreenRenderWidgetHostView::TransformPointToCoordSpaceForView(
2018-05-15 01:59:22 +00:00
const gfx::PointF& point,
2017-04-05 08:31:22 +00:00
RenderWidgetHostViewBase* target_view,
gfx::PointF* transformed_point) {
2017-04-05 08:31:22 +00:00
if (target_view == this) {
*transformed_point = point;
return true;
}
2018-11-07 19:17:53 +00:00
return false;
2017-04-05 08:31:22 +00:00
}
void OffScreenRenderWidgetHostView::CancelWidget() {
if (render_widget_host_)
2017-03-05 15:18:57 +00:00
render_widget_host_->LostCapture();
Hide();
2017-03-05 15:18:57 +00:00
if (parent_host_view_) {
if (parent_host_view_->popup_host_view_ == this) {
parent_host_view_->set_popup_host_view(nullptr);
} else if (parent_host_view_->child_host_view_ == this) {
parent_host_view_->set_child_host_view(nullptr);
parent_host_view_->Show();
} else {
parent_host_view_->RemoveGuestHostView(this);
}
parent_host_view_ = nullptr;
}
2017-03-05 15:18:57 +00:00
if (render_widget_host_ && !is_destroyed_) {
is_destroyed_ = true;
// Results in a call to Destroy().
render_widget_host_->ShutdownAndDestroyWidget(true);
}
}
void OffScreenRenderWidgetHostView::AddGuestHostView(
OffScreenRenderWidgetHostView* guest_host) {
guest_host_views_.insert(guest_host);
}
void OffScreenRenderWidgetHostView::RemoveGuestHostView(
OffScreenRenderWidgetHostView* guest_host) {
guest_host_views_.erase(guest_host);
}
void OffScreenRenderWidgetHostView::AddViewProxy(OffscreenViewProxy* proxy) {
proxy->SetObserver(this);
proxy_views_.insert(proxy);
}
void OffScreenRenderWidgetHostView::RemoveViewProxy(OffscreenViewProxy* proxy) {
proxy->RemoveObserver();
proxy_views_.erase(proxy);
}
void OffScreenRenderWidgetHostView::ProxyViewDestroyed(
OffscreenViewProxy* proxy) {
proxy_views_.erase(proxy);
Invalidate();
}
std::unique_ptr<viz::HostDisplayClient>
OffScreenRenderWidgetHostView::CreateHostDisplayClient(
2016-07-31 10:19:56 +00:00
ui::Compositor* compositor) {
host_display_client_ = new OffScreenHostDisplayClient(
gfx::kNullAcceleratedWidget,
base::BindRepeating(&OffScreenRenderWidgetHostView::OnPaint,
weak_ptr_factory_.GetWeakPtr()));
host_display_client_->SetActive(IsPainting());
return base::WrapUnique(host_display_client_);
2016-07-27 16:24:58 +00:00
}
2016-07-05 19:33:22 +00:00
2016-08-03 04:46:34 +00:00
bool OffScreenRenderWidgetHostView::InstallTransparency() {
if (transparent_) {
SetBackgroundColor(SkColor());
compositor_->SetBackgroundColor(SK_ColorTRANSPARENT);
2016-08-03 04:46:34 +00:00
return true;
}
return false;
}
#if defined(OS_MACOSX)
void OffScreenRenderWidgetHostView::SetActive(bool active) {}
void OffScreenRenderWidgetHostView::ShowDefinitionForSelection() {}
void OffScreenRenderWidgetHostView::SpeakSelection() {}
bool OffScreenRenderWidgetHostView::UpdateNSViewAndDisplay() {
return false;
2018-05-15 01:59:22 +00:00
}
#endif
2018-05-15 01:59:22 +00:00
2018-04-18 01:55:30 +00:00
void OffScreenRenderWidgetHostView::OnPaint(const gfx::Rect& damage_rect,
const SkBitmap& bitmap) {
backing_ = std::make_unique<SkBitmap>();
backing_->allocN32Pixels(bitmap.width(), bitmap.height(), !transparent_);
bitmap.readPixels(backing_->pixmap());
if (IsPopupWidget() && parent_callback_) {
parent_callback_.Run(this->popup_position_);
} else {
CompositeFrame(damage_rect);
}
}
2017-03-05 15:19:51 +00:00
gfx::Size OffScreenRenderWidgetHostView::SizeInPixels() {
if (IsPopupWidget()) {
return gfx::ConvertSizeToPixel(current_device_scale_factor_,
popup_position_.size());
} else {
return gfx::ConvertSizeToPixel(current_device_scale_factor_,
GetViewBounds().size());
}
}
2017-04-12 18:54:03 +00:00
void OffScreenRenderWidgetHostView::CompositeFrame(
const gfx::Rect& damage_rect) {
HoldResize();
gfx::Size size_in_pixels = SizeInPixels();
SkBitmap frame;
// Optimize for the case when there is no popup
if (proxy_views_.size() == 0 && !popup_host_view_) {
frame = GetBacking();
} else {
frame.allocN32Pixels(size_in_pixels.width(), size_in_pixels.height(),
false);
if (!GetBacking().drawsNothing()) {
SkCanvas canvas(frame);
canvas.writePixels(GetBacking(), 0, 0);
if (popup_host_view_ && !popup_host_view_->GetBacking().drawsNothing()) {
gfx::Rect rect = popup_host_view_->popup_position_;
gfx::Point origin_in_pixels = gfx::ConvertPointToPixel(
current_device_scale_factor_, rect.origin());
canvas.writePixels(popup_host_view_->GetBacking(), origin_in_pixels.x(),
origin_in_pixels.y());
}
2017-04-12 18:54:03 +00:00
for (auto* proxy_view : proxy_views_) {
gfx::Rect rect = proxy_view->GetBounds();
gfx::Point origin_in_pixels = gfx::ConvertPointToPixel(
current_device_scale_factor_, rect.origin());
canvas.writePixels(*proxy_view->GetBitmap(), origin_in_pixels.x(),
origin_in_pixels.y());
}
}
}
2017-03-05 15:18:57 +00:00
paint_callback_running_ = true;
callback_.Run(gfx::IntersectRects(gfx::Rect(size_in_pixels), damage_rect),
frame);
paint_callback_running_ = false;
ReleaseResize();
}
void OffScreenRenderWidgetHostView::OnPopupPaint(const gfx::Rect& damage_rect) {
InvalidateBounds(
gfx::ConvertRectToPixel(current_device_scale_factor_, damage_rect));
}
void OffScreenRenderWidgetHostView::OnProxyViewPaint(
const gfx::Rect& damage_rect) {
InvalidateBounds(
gfx::ConvertRectToPixel(current_device_scale_factor_, damage_rect));
}
void OffScreenRenderWidgetHostView::HoldResize() {
if (!hold_resize_)
hold_resize_ = true;
}
void OffScreenRenderWidgetHostView::ReleaseResize() {
if (!hold_resize_)
return;
hold_resize_ = false;
if (pending_resize_) {
pending_resize_ = false;
base::PostTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(
&OffScreenRenderWidgetHostView::SynchronizeVisualProperties,
weak_ptr_factory_.GetWeakPtr()));
}
}
void OffScreenRenderWidgetHostView::SynchronizeVisualProperties() {
if (hold_resize_) {
if (!pending_resize_)
pending_resize_ = true;
return;
}
2017-03-05 15:18:57 +00:00
ResizeRootLayer(true);
}
2018-05-15 01:59:22 +00:00
void OffScreenRenderWidgetHostView::SendMouseEvent(
const blink::WebMouseEvent& event) {
2018-05-04 06:45:12 +00:00
for (auto* proxy_view : proxy_views_) {
gfx::Rect bounds = proxy_view->GetBounds();
if (bounds.Contains(event.PositionInWidget().x(),
event.PositionInWidget().y())) {
blink::WebMouseEvent proxy_event(event);
proxy_event.SetPositionInWidget(
proxy_event.PositionInWidget().x() - bounds.x(),
proxy_event.PositionInWidget().y() - bounds.y());
ui::MouseEvent ui_event = UiMouseEventFromWebMouseEvent(proxy_event);
proxy_view->OnEvent(&ui_event);
return;
}
}
if (!IsPopupWidget()) {
2018-04-18 01:55:30 +00:00
if (popup_host_view_ &&
popup_host_view_->popup_position_.Contains(
event.PositionInWidget().x(), event.PositionInWidget().y())) {
blink::WebMouseEvent popup_event(event);
popup_event.SetPositionInWidget(
popup_event.PositionInWidget().x() -
2017-06-29 23:50:55 +00:00
popup_host_view_->popup_position_.x(),
popup_event.PositionInWidget().y() -
2017-06-29 23:50:55 +00:00
popup_host_view_->popup_position_.y());
2018-05-15 01:59:22 +00:00
popup_host_view_->ProcessMouseEvent(popup_event, ui::LatencyInfo());
return;
}
}
if (!render_widget_host_)
return;
render_widget_host_->ForwardMouseEvent(event);
}
2018-05-15 01:59:22 +00:00
void OffScreenRenderWidgetHostView::SendMouseWheelEvent(
const blink::WebMouseWheelEvent& event) {
2018-05-04 06:45:12 +00:00
for (auto* proxy_view : proxy_views_) {
gfx::Rect bounds = proxy_view->GetBounds();
if (bounds.Contains(event.PositionInWidget().x(),
event.PositionInWidget().y())) {
blink::WebMouseWheelEvent proxy_event(event);
proxy_event.SetPositionInWidget(
proxy_event.PositionInWidget().x() - bounds.x(),
proxy_event.PositionInWidget().y() - bounds.y());
ui::MouseWheelEvent ui_event =
2018-04-18 01:55:30 +00:00
UiMouseWheelEventFromWebMouseEvent(proxy_event);
proxy_view->OnEvent(&ui_event);
return;
}
}
blink::WebMouseWheelEvent mouse_wheel_event(event);
bool should_route_event =
render_widget_host_->delegate() &&
render_widget_host_->delegate()->GetInputEventRouter();
mouse_wheel_phase_handler_.SendWheelEndForTouchpadScrollingIfNeeded(
should_route_event);
mouse_wheel_phase_handler_.AddPhaseIfNeededAndScheduleEndEvent(
mouse_wheel_event, false);
if (!IsPopupWidget()) {
if (popup_host_view_) {
if (popup_host_view_->popup_position_.Contains(
mouse_wheel_event.PositionInWidget().x(),
mouse_wheel_event.PositionInWidget().y())) {
blink::WebMouseWheelEvent popup_mouse_wheel_event(mouse_wheel_event);
popup_mouse_wheel_event.SetPositionInWidget(
mouse_wheel_event.PositionInWidget().x() -
2017-06-29 23:50:55 +00:00
popup_host_view_->popup_position_.x(),
mouse_wheel_event.PositionInWidget().y() -
2017-06-29 23:50:55 +00:00
popup_host_view_->popup_position_.y());
popup_mouse_wheel_event.SetPositionInScreen(
popup_mouse_wheel_event.PositionInWidget().x(),
popup_mouse_wheel_event.PositionInWidget().y());
popup_host_view_->SendMouseWheelEvent(popup_mouse_wheel_event);
return;
} else {
// Scrolling outside of the popup widget so destroy it.
// Execute asynchronously to avoid deleting the widget from inside some
// other callback.
base::PostTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&OffScreenRenderWidgetHostView::CancelWidget,
popup_host_view_->weak_ptr_factory_.GetWeakPtr()));
}
} else if (!guest_host_views_.empty()) {
for (auto* guest_host_view : guest_host_views_) {
if (!guest_host_view->render_widget_host_ ||
!guest_host_view->render_widget_host_->GetView()) {
continue;
}
const gfx::Rect& guest_bounds =
guest_host_view->render_widget_host_->GetView()->GetViewBounds();
if (guest_bounds.Contains(mouse_wheel_event.PositionInWidget().x(),
mouse_wheel_event.PositionInWidget().y())) {
blink::WebMouseWheelEvent guest_mouse_wheel_event(mouse_wheel_event);
guest_mouse_wheel_event.SetPositionInWidget(
mouse_wheel_event.PositionInWidget().x() - guest_bounds.x(),
mouse_wheel_event.PositionInWidget().y() - guest_bounds.y());
guest_mouse_wheel_event.SetPositionInScreen(
guest_mouse_wheel_event.PositionInWidget().x(),
guest_mouse_wheel_event.PositionInWidget().y());
guest_host_view->SendMouseWheelEvent(guest_mouse_wheel_event);
return;
}
}
}
}
if (!render_widget_host_)
return;
render_widget_host_->ForwardWheelEvent(event);
2016-07-27 17:44:41 +00:00
}
void OffScreenRenderWidgetHostView::SetPainting(bool painting) {
painting_ = painting;
if (popup_host_view_) {
popup_host_view_->SetPainting(painting);
}
for (auto* guest_host_view : guest_host_views_)
guest_host_view->SetPainting(painting);
if (video_consumer_) {
video_consumer_->SetActive(IsPainting());
} else if (host_display_client_) {
host_display_client_->SetActive(IsPainting());
2016-07-31 20:05:36 +00:00
}
}
bool OffScreenRenderWidgetHostView::IsPainting() const {
return painting_;
}
void OffScreenRenderWidgetHostView::SetFrameRate(int frame_rate) {
if (parent_host_view_) {
if (parent_host_view_->GetFrameRate() == GetFrameRate())
return;
frame_rate_ = parent_host_view_->GetFrameRate();
} else {
if (frame_rate <= 0)
frame_rate = 1;
2018-01-25 13:44:19 +00:00
if (frame_rate > 240)
frame_rate = 240;
2017-03-05 15:18:57 +00:00
frame_rate_ = frame_rate;
}
2017-03-05 15:18:57 +00:00
SetupFrameRate(true);
if (video_consumer_) {
video_consumer_->SetFrameRate(GetFrameRate());
}
2018-05-04 06:45:12 +00:00
for (auto* guest_host_view : guest_host_views_)
guest_host_view->SetFrameRate(frame_rate);
}
int OffScreenRenderWidgetHostView::GetFrameRate() const {
return frame_rate_;
}
2016-09-07 08:33:09 +00:00
ui::Compositor* OffScreenRenderWidgetHostView::GetCompositor() const {
return compositor_.get();
}
ui::Layer* OffScreenRenderWidgetHostView::GetRootLayer() const {
return root_layer_.get();
}
const viz::LocalSurfaceIdAllocation&
OffScreenRenderWidgetHostView::GetLocalSurfaceIdAllocation() const {
return delegated_frame_host_allocation_;
}
2016-09-07 08:33:09 +00:00
content::DelegatedFrameHost*
OffScreenRenderWidgetHostView::GetDelegatedFrameHost() const {
return delegated_frame_host_.get();
}
2016-08-03 04:46:34 +00:00
void OffScreenRenderWidgetHostView::SetupFrameRate(bool force) {
if (!force && frame_rate_threshold_us_ != 0)
2016-08-03 04:46:34 +00:00
return;
frame_rate_threshold_us_ = 1000000 / frame_rate_;
2016-08-03 04:46:34 +00:00
if (compositor_) {
compositor_->SetDisplayVSyncParameters(
base::TimeTicks::Now(),
base::TimeDelta::FromMicroseconds(frame_rate_threshold_us_));
2016-08-03 04:46:34 +00:00
}
}
void OffScreenRenderWidgetHostView::Invalidate() {
InvalidateBounds(gfx::Rect(GetRequestedRendererSize()));
}
void OffScreenRenderWidgetHostView::InvalidateBounds(const gfx::Rect& bounds) {
CompositeFrame(bounds);
}
void OffScreenRenderWidgetHostView::ResizeRootLayer(bool force) {
2016-08-03 04:46:34 +00:00
SetupFrameRate(false);
display::Display display =
display::Screen::GetScreen()->GetDisplayNearestView(GetNativeView());
const float scaleFactor = display.device_scale_factor();
const bool scaleFactorDidChange =
(scaleFactor != current_device_scale_factor_);
current_device_scale_factor_ = scaleFactor;
2016-08-03 04:46:34 +00:00
gfx::Size size;
if (!IsPopupWidget())
size = GetViewBounds().size();
else
size = popup_position_.size();
2016-08-03 04:46:34 +00:00
if (!force && !scaleFactorDidChange &&
size == GetRootLayer()->bounds().size())
2016-08-03 04:46:34 +00:00
return;
2016-09-07 08:33:09 +00:00
GetRootLayer()->SetBounds(gfx::Rect(size));
2018-05-15 01:59:22 +00:00
const gfx::Size& size_in_pixels =
gfx::ConvertSizeToPixel(current_device_scale_factor_, size);
if (compositor_) {
compositor_allocator_.GenerateId();
compositor_allocation_ =
compositor_allocator_.GetCurrentLocalSurfaceIdAllocation();
compositor_->SetScaleAndSize(current_device_scale_factor_, size_in_pixels,
compositor_allocation_);
}
delegated_frame_host_allocator_.GenerateId();
delegated_frame_host_allocation_ =
delegated_frame_host_allocator_.GetCurrentLocalSurfaceIdAllocation();
GetDelegatedFrameHost()->EmbedSurface(
delegated_frame_host_allocation_.local_surface_id(), size,
cc::DeadlinePolicy::UseDefaultDeadline());
2018-05-15 01:59:22 +00:00
// Note that |render_widget_host_| will retrieve resize parameters from the
// DelegatedFrameHost, so it must have SynchronizeVisualProperties called
// after.
if (render_widget_host_) {
render_widget_host_->SynchronizeVisualProperties();
}
2016-08-03 04:46:34 +00:00
}
viz::FrameSinkId OffScreenRenderWidgetHostView::AllocateFrameSinkId() {
return viz::FrameSinkId(
base::checked_cast<uint32_t>(render_widget_host_->GetProcess()->GetID()),
base::checked_cast<uint32_t>(render_widget_host_->GetRoutingID()));
}
2017-07-08 19:25:15 +00:00
void OffScreenRenderWidgetHostView::UpdateBackgroundColorFromRenderer(
SkColor color) {
if (color == background_color_)
2017-07-08 19:25:15 +00:00
return;
background_color_ = color;
bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE;
GetRootLayer()->SetFillsBoundsOpaquely(opaque);
GetRootLayer()->SetColor(color);
}
} // namespace electron