]> khamidou — GitHub mirrors - electron.git/commitdiff
Clean up SetAllowTransparency
authorCheng Zhao <zcbenz@gmail.com>
Tue, 23 Jun 2015 08:19:12 +0000 (16:19 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 23 Jun 2015 08:19:12 +0000 (16:19 +0800)
atom/browser/api/atom_api_web_contents.cc

index 3db913382b7a69ca431f8678da067fdb44c4ab54..d4dd40b814701c9df393fae531ad81d77c40943a 100644 (file)
@@ -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);
   }
 }