chromium-style fixes (#12826)
This commit is contained in:
parent
7be30bb249
commit
b280ea5579
11 changed files with 30 additions and 21 deletions
|
@ -323,7 +323,7 @@ void BrowserWindow::BlurWebView() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserWindow::IsWebViewFocused() {
|
bool BrowserWindow::IsWebViewFocused() {
|
||||||
auto host_view = web_contents()->GetRenderViewHost()->GetWidget()->GetView();
|
auto* host_view = web_contents()->GetRenderViewHost()->GetWidget()->GetView();
|
||||||
return host_view && host_view->HasFocus();
|
return host_view && host_view->HasFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ typedef base::Callback<void(const gfx::Rect&, const SkBitmap&)> OnPaintCallback;
|
||||||
class OffScreenOutputDevice : public viz::SoftwareOutputDevice {
|
class OffScreenOutputDevice : public viz::SoftwareOutputDevice {
|
||||||
public:
|
public:
|
||||||
OffScreenOutputDevice(bool transparent, const OnPaintCallback& callback);
|
OffScreenOutputDevice(bool transparent, const OnPaintCallback& callback);
|
||||||
~OffScreenOutputDevice();
|
~OffScreenOutputDevice() override;
|
||||||
|
|
||||||
// viz::SoftwareOutputDevice:
|
// viz::SoftwareOutputDevice:
|
||||||
void Resize(const gfx::Size& pixel_size, float scale_factor) override;
|
void Resize(const gfx::Size& pixel_size, float scale_factor) override;
|
||||||
|
|
|
@ -641,11 +641,11 @@ void OffScreenRenderWidgetHostView::Destroy() {
|
||||||
// Guest RWHVs will be destroyed when the associated RWHVGuest is
|
// Guest RWHVs will be destroyed when the associated RWHVGuest is
|
||||||
// destroyed. This parent RWHV may be destroyed first, so disassociate
|
// destroyed. This parent RWHV may be destroyed first, so disassociate
|
||||||
// the guest RWHVs here without destroying them.
|
// the guest RWHVs here without destroying them.
|
||||||
for (auto guest_host_view : guest_host_views_)
|
for (auto* guest_host_view : guest_host_views_)
|
||||||
guest_host_view->parent_host_view_ = nullptr;
|
guest_host_view->parent_host_view_ = nullptr;
|
||||||
guest_host_views_.clear();
|
guest_host_views_.clear();
|
||||||
}
|
}
|
||||||
for (auto proxy_view : proxy_views_)
|
for (auto* proxy_view : proxy_views_)
|
||||||
proxy_view->RemoveObserver();
|
proxy_view->RemoveObserver();
|
||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
|
@ -978,7 +978,7 @@ void OffScreenRenderWidgetHostView::OnPaint(const gfx::Rect& damage_rect,
|
||||||
bitmap, pos.x(), pos.y(), pos.width(), pos.height()));
|
bitmap, pos.x(), pos.y(), pos.width(), pos.height()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto proxy_view : proxy_views_) {
|
for (auto* proxy_view : proxy_views_) {
|
||||||
gfx::Rect pos = proxy_view->GetBounds();
|
gfx::Rect pos = proxy_view->GetBounds();
|
||||||
damage.Union(pos);
|
damage.Union(pos);
|
||||||
damages.push_back(pos);
|
damages.push_back(pos);
|
||||||
|
@ -1059,7 +1059,7 @@ void OffScreenRenderWidgetHostView::ProcessKeyboardEvent(
|
||||||
void OffScreenRenderWidgetHostView::ProcessMouseEvent(
|
void OffScreenRenderWidgetHostView::ProcessMouseEvent(
|
||||||
const blink::WebMouseEvent& event,
|
const blink::WebMouseEvent& event,
|
||||||
const ui::LatencyInfo& latency) {
|
const ui::LatencyInfo& latency) {
|
||||||
for (auto proxy_view : proxy_views_) {
|
for (auto* proxy_view : proxy_views_) {
|
||||||
gfx::Rect bounds = proxy_view->GetBounds();
|
gfx::Rect bounds = proxy_view->GetBounds();
|
||||||
if (bounds.Contains(event.PositionInWidget().x,
|
if (bounds.Contains(event.PositionInWidget().x,
|
||||||
event.PositionInWidget().y)) {
|
event.PositionInWidget().y)) {
|
||||||
|
@ -1098,7 +1098,7 @@ void OffScreenRenderWidgetHostView::ProcessMouseEvent(
|
||||||
void OffScreenRenderWidgetHostView::ProcessMouseWheelEvent(
|
void OffScreenRenderWidgetHostView::ProcessMouseWheelEvent(
|
||||||
const blink::WebMouseWheelEvent& event,
|
const blink::WebMouseWheelEvent& event,
|
||||||
const ui::LatencyInfo& latency) {
|
const ui::LatencyInfo& latency) {
|
||||||
for (auto proxy_view : proxy_views_) {
|
for (auto* proxy_view : proxy_views_) {
|
||||||
gfx::Rect bounds = proxy_view->GetBounds();
|
gfx::Rect bounds = proxy_view->GetBounds();
|
||||||
if (bounds.Contains(event.PositionInWidget().x,
|
if (bounds.Contains(event.PositionInWidget().x,
|
||||||
event.PositionInWidget().y)) {
|
event.PositionInWidget().y)) {
|
||||||
|
@ -1170,7 +1170,7 @@ void OffScreenRenderWidgetHostView::SetFrameRate(int frame_rate) {
|
||||||
|
|
||||||
SetupFrameRate(true);
|
SetupFrameRate(true);
|
||||||
|
|
||||||
for (auto guest_host_view : guest_host_views_)
|
for (auto* guest_host_view : guest_host_views_)
|
||||||
guest_host_view->SetFrameRate(frame_rate);
|
guest_host_view->SetFrameRate(frame_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ class OffScreenRenderWidgetHostView
|
||||||
void RemoveGuestHostView(OffScreenRenderWidgetHostView* guest_host);
|
void RemoveGuestHostView(OffScreenRenderWidgetHostView* guest_host);
|
||||||
void AddViewProxy(OffscreenViewProxy* proxy);
|
void AddViewProxy(OffscreenViewProxy* proxy);
|
||||||
void RemoveViewProxy(OffscreenViewProxy* proxy);
|
void RemoveViewProxy(OffscreenViewProxy* proxy);
|
||||||
void ProxyViewDestroyed(OffscreenViewProxy* proxy);
|
void ProxyViewDestroyed(OffscreenViewProxy* proxy) override;
|
||||||
|
|
||||||
void RegisterGuestViewFrameSwappedCallback(
|
void RegisterGuestViewFrameSwappedCallback(
|
||||||
content::RenderWidgetHostViewGuest* guest_host_view);
|
content::RenderWidgetHostViewGuest* guest_host_view);
|
||||||
|
@ -227,7 +227,7 @@ class OffScreenRenderWidgetHostView
|
||||||
|
|
||||||
void OnPaint(const gfx::Rect& damage_rect, const SkBitmap& bitmap);
|
void OnPaint(const gfx::Rect& damage_rect, const SkBitmap& bitmap);
|
||||||
void OnPopupPaint(const gfx::Rect& damage_rect, const SkBitmap& bitmap);
|
void OnPopupPaint(const gfx::Rect& damage_rect, const SkBitmap& bitmap);
|
||||||
void OnProxyViewPaint(const gfx::Rect& damage_rect);
|
void OnProxyViewPaint(const gfx::Rect& damage_rect) override;
|
||||||
|
|
||||||
bool IsPopupWidget() const { return popup_type_ != blink::kWebPopupTypeNone; }
|
bool IsPopupWidget() const { return popup_type_ != blink::kWebPopupTypeNone; }
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ OffScreenWebContentsView::CreateViewForWidget(
|
||||||
render_widget_host->GetView());
|
render_widget_host->GetView());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
auto* relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||||
return new OffScreenRenderWidgetHostView(
|
return new OffScreenRenderWidgetHostView(
|
||||||
transparent_, painting_, GetFrameRate(), callback_, render_widget_host,
|
transparent_, painting_, GetFrameRate(), callback_, render_widget_host,
|
||||||
nullptr, relay->window.get());
|
nullptr, relay->window.get());
|
||||||
|
@ -113,7 +113,7 @@ OffScreenWebContentsView::CreateViewForWidget(
|
||||||
content::RenderWidgetHostViewBase*
|
content::RenderWidgetHostViewBase*
|
||||||
OffScreenWebContentsView::CreateViewForPopupWidget(
|
OffScreenWebContentsView::CreateViewForPopupWidget(
|
||||||
content::RenderWidgetHost* render_widget_host) {
|
content::RenderWidgetHost* render_widget_host) {
|
||||||
auto relay = NativeWindowRelay::FromWebContents(web_contents_);
|
auto* relay = NativeWindowRelay::FromWebContents(web_contents_);
|
||||||
|
|
||||||
content::WebContentsImpl* web_contents_impl =
|
content::WebContentsImpl* web_contents_impl =
|
||||||
static_cast<content::WebContentsImpl*>(web_contents_);
|
static_cast<content::WebContentsImpl*>(web_contents_);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
|
||||||
public content::RenderViewHostDelegateView {
|
public content::RenderViewHostDelegateView {
|
||||||
public:
|
public:
|
||||||
OffScreenWebContentsView(bool transparent, const OnPaintCallback& callback);
|
OffScreenWebContentsView(bool transparent, const OnPaintCallback& callback);
|
||||||
~OffScreenWebContentsView();
|
~OffScreenWebContentsView() override;
|
||||||
|
|
||||||
void SetWebContents(content::WebContents*);
|
void SetWebContents(content::WebContents*);
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ struct UtteranceContinuousParameters {
|
||||||
// Information about one voice.
|
// Information about one voice.
|
||||||
struct VoiceData {
|
struct VoiceData {
|
||||||
VoiceData();
|
VoiceData();
|
||||||
|
VoiceData(const VoiceData&);
|
||||||
~VoiceData();
|
~VoiceData();
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
|
@ -45,7 +45,9 @@ UtteranceContinuousParameters::UtteranceContinuousParameters()
|
||||||
VoiceData::VoiceData()
|
VoiceData::VoiceData()
|
||||||
: gender(TTS_GENDER_NONE), remote(false), native(false) {}
|
: gender(TTS_GENDER_NONE), remote(false), native(false) {}
|
||||||
|
|
||||||
VoiceData::~VoiceData() {}
|
VoiceData::VoiceData(const VoiceData&) = default;
|
||||||
|
|
||||||
|
VoiceData::~VoiceData() = default;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Utterance
|
// Utterance
|
||||||
|
|
|
@ -28,7 +28,9 @@ PrintMsg_Print_Params::PrintMsg_Print_Params()
|
||||||
url(),
|
url(),
|
||||||
should_print_backgrounds(false) {}
|
should_print_backgrounds(false) {}
|
||||||
|
|
||||||
PrintMsg_Print_Params::~PrintMsg_Print_Params() {}
|
PrintMsg_Print_Params::PrintMsg_Print_Params(const PrintMsg_Print_Params&) =
|
||||||
|
default;
|
||||||
|
PrintMsg_Print_Params::~PrintMsg_Print_Params() = default;
|
||||||
|
|
||||||
void PrintMsg_Print_Params::Reset() {
|
void PrintMsg_Print_Params::Reset() {
|
||||||
page_size = gfx::Size();
|
page_size = gfx::Size();
|
||||||
|
@ -53,8 +55,10 @@ void PrintMsg_Print_Params::Reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintMsg_PrintPages_Params::PrintMsg_PrintPages_Params() : pages() {}
|
PrintMsg_PrintPages_Params::PrintMsg_PrintPages_Params() : pages() {}
|
||||||
|
PrintMsg_PrintPages_Params::PrintMsg_PrintPages_Params(
|
||||||
|
const PrintMsg_PrintPages_Params&) = default;
|
||||||
|
|
||||||
PrintMsg_PrintPages_Params::~PrintMsg_PrintPages_Params() {}
|
PrintMsg_PrintPages_Params::~PrintMsg_PrintPages_Params() = default;
|
||||||
|
|
||||||
void PrintMsg_PrintPages_Params::Reset() {
|
void PrintMsg_PrintPages_Params::Reset() {
|
||||||
params.Reset();
|
params.Reset();
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
struct PrintMsg_Print_Params {
|
struct PrintMsg_Print_Params {
|
||||||
PrintMsg_Print_Params();
|
PrintMsg_Print_Params();
|
||||||
|
PrintMsg_Print_Params(const PrintMsg_Print_Params&);
|
||||||
~PrintMsg_Print_Params();
|
~PrintMsg_Print_Params();
|
||||||
|
|
||||||
// Resets the members of the struct to 0.
|
// Resets the members of the struct to 0.
|
||||||
|
@ -58,6 +59,7 @@ struct PrintMsg_Print_Params {
|
||||||
|
|
||||||
struct PrintMsg_PrintPages_Params {
|
struct PrintMsg_PrintPages_Params {
|
||||||
PrintMsg_PrintPages_Params();
|
PrintMsg_PrintPages_Params();
|
||||||
|
PrintMsg_PrintPages_Params(const PrintMsg_PrintPages_Params&);
|
||||||
~PrintMsg_PrintPages_Params();
|
~PrintMsg_PrintPages_Params();
|
||||||
|
|
||||||
// Resets the members of the struct to 0.
|
// Resets the members of the struct to 0.
|
||||||
|
|
|
@ -401,8 +401,6 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
|
||||||
void RestoreSize();
|
void RestoreSize();
|
||||||
void CopySelection(const WebPreferences& preferences);
|
void CopySelection(const WebPreferences& preferences);
|
||||||
|
|
||||||
base::WeakPtrFactory<PrepareFrameAndViewForPrint> weak_ptr_factory_;
|
|
||||||
|
|
||||||
FrameReference frame_;
|
FrameReference frame_;
|
||||||
blink::WebNode node_to_print_;
|
blink::WebNode node_to_print_;
|
||||||
bool owns_web_view_;
|
bool owns_web_view_;
|
||||||
|
@ -415,6 +413,8 @@ class PrepareFrameAndViewForPrint : public blink::WebViewClient,
|
||||||
bool should_print_selection_only_;
|
bool should_print_selection_only_;
|
||||||
bool is_printing_started_;
|
bool is_printing_started_;
|
||||||
|
|
||||||
|
base::WeakPtrFactory<PrepareFrameAndViewForPrint> weak_ptr_factory_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint);
|
DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -423,14 +423,14 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
|
||||||
blink::WebLocalFrame* frame,
|
blink::WebLocalFrame* frame,
|
||||||
const blink::WebNode& node,
|
const blink::WebNode& node,
|
||||||
bool ignore_css_margins)
|
bool ignore_css_margins)
|
||||||
: weak_ptr_factory_(this),
|
: frame_(frame),
|
||||||
frame_(frame),
|
|
||||||
node_to_print_(node),
|
node_to_print_(node),
|
||||||
owns_web_view_(false),
|
owns_web_view_(false),
|
||||||
expected_pages_count_(0),
|
expected_pages_count_(0),
|
||||||
should_print_backgrounds_(params.should_print_backgrounds),
|
should_print_backgrounds_(params.should_print_backgrounds),
|
||||||
should_print_selection_only_(params.selection_only),
|
should_print_selection_only_(params.selection_only),
|
||||||
is_printing_started_(false) {
|
is_printing_started_(false),
|
||||||
|
weak_ptr_factory_(this) {
|
||||||
PrintMsg_Print_Params print_params = params;
|
PrintMsg_Print_Params print_params = params;
|
||||||
if (!should_print_selection_only_ ||
|
if (!should_print_selection_only_ ||
|
||||||
!PrintingNodeOrPdfFrame(frame, node_to_print_)) {
|
!PrintingNodeOrPdfFrame(frame, node_to_print_)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue