fix: BrowserView setBackgroundColor() (#31746)
This commit is contained in:
		
					parent
					
						
							
								25cdbb7d3a
							
						
					
				
			
			
				commit
				
					
						b40f3d4cfc
					
				
			
		
					 2 changed files with 7 additions and 2 deletions
				
			
		|  | @ -147,7 +147,11 @@ gfx::Rect BrowserView::GetBounds() { | |||
| } | ||||
| 
 | ||||
| void BrowserView::SetBackgroundColor(const std::string& color_name) { | ||||
|   view_->SetBackgroundColor(ParseHexColor(color_name)); | ||||
|   if (!web_contents()) | ||||
|     return; | ||||
| 
 | ||||
|   auto* wc = web_contents()->web_contents(); | ||||
|   wc->SetPageBaseBackgroundColor(ParseHexColor(color_name)); | ||||
| } | ||||
| 
 | ||||
| v8::Local<v8::Value> BrowserView::GetWebContents(v8::Isolate* isolate) { | ||||
|  |  | |||
|  | @ -1457,8 +1457,9 @@ void WebContents::HandleNewRenderFrame( | |||
|   // Set the background color of RenderWidgetHostView.
 | ||||
|   auto* web_preferences = WebContentsPreferences::From(web_contents()); | ||||
|   if (web_preferences) { | ||||
|     bool guest = IsGuest() || type_ == Type::kBrowserView; | ||||
|     absl::optional<SkColor> color = | ||||
|         IsGuest() ? SK_ColorTRANSPARENT : web_preferences->GetBackgroundColor(); | ||||
|         guest ? SK_ColorTRANSPARENT : web_preferences->GetBackgroundColor(); | ||||
|     web_contents()->SetPageBaseBackgroundColor(color); | ||||
|     rwhv->SetBackgroundColor(color.value_or(SK_ColorWHITE)); | ||||
|   } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Shelley Vohr
				Shelley Vohr