From 2d65c3bcd0a6d5e987ece2555531fb1b2eb60507 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 23 Jun 2015 16:19:12 +0800 Subject: [PATCH] Clean up SetAllowTransparency --- atom/browser/api/atom_api_web_contents.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 3db913382b7a..d4dd40b81470 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -745,18 +745,15 @@ void WebContents::SetAllowTransparency(bool allow) { if (guest_opaque_ != allow) return; + auto render_view_host = web_contents()->GetRenderViewHost(); guest_opaque_ = !allow; - if (!web_contents()->GetRenderViewHost()->GetView()) + if (!render_view_host->GetView()) return; if (guest_opaque_) { - web_contents() - ->GetRenderViewHost() - ->GetView() - ->SetBackgroundColorToDefault(); + render_view_host->GetView()->SetBackgroundColorToDefault(); } else { - web_contents()->GetRenderViewHost()->GetView()->SetBackgroundColor( - SK_ColorTRANSPARENT); + render_view_host->GetView()->SetBackgroundColor(SK_ColorTRANSPARENT); } }