Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_base.cc

Issue 1731373002: Allow to have a transparent UA dependent background. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Decouple background color and transparency in RenderWidgetHostView Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_base.h" 5 #include "content/browser/renderer_host/render_widget_host_view_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/accessibility/browser_accessibility_manager.h" 9 #include "content/browser/accessibility/browser_accessibility_manager.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 10 #include "content/browser/gpu/gpu_data_manager_impl.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 namespace { 364 namespace {
365 365
366 // How many microseconds apart input events should be flushed. 366 // How many microseconds apart input events should be flushed.
367 const int kFlushInputRateInUs = 16666; 367 const int kFlushInputRateInUs = 16666;
368 368
369 } 369 }
370 370
371 RenderWidgetHostViewBase::RenderWidgetHostViewBase() 371 RenderWidgetHostViewBase::RenderWidgetHostViewBase()
372 : popup_type_(blink::WebPopupTypeNone), 372 : popup_type_(blink::WebPopupTypeNone),
373 background_color_(SK_ColorWHITE), 373 background_color_(SK_ColorWHITE),
374 background_opaque_(false),
374 mouse_locked_(false), 375 mouse_locked_(false),
375 showing_context_menu_(false), 376 showing_context_menu_(false),
376 selection_text_offset_(0), 377 selection_text_offset_(0),
377 selection_range_(gfx::Range::InvalidRange()), 378 selection_range_(gfx::Range::InvalidRange()),
378 current_device_scale_factor_(0), 379 current_device_scale_factor_(0),
379 current_display_rotation_(gfx::Display::ROTATE_0), 380 current_display_rotation_(gfx::Display::ROTATE_0),
380 pinch_zoom_enabled_(content::IsPinchToZoomEnabled()), 381 pinch_zoom_enabled_(content::IsPinchToZoomEnabled()),
381 renderer_frame_number_(0), 382 renderer_frame_number_(0),
382 weak_factory_(this) {} 383 weak_factory_(this) {}
383 384
(...skipping 24 matching lines...) Expand all
408 } 409 }
409 410
410 void RenderWidgetHostViewBase::SetBackgroundColor(SkColor color) { 411 void RenderWidgetHostViewBase::SetBackgroundColor(SkColor color) {
411 background_color_ = color; 412 background_color_ = color;
412 } 413 }
413 414
414 void RenderWidgetHostViewBase::SetBackgroundColorToDefault() { 415 void RenderWidgetHostViewBase::SetBackgroundColorToDefault() {
415 SetBackgroundColor(SK_ColorWHITE); 416 SetBackgroundColor(SK_ColorWHITE);
416 } 417 }
417 418
419 void RenderWidgetHostViewBase::SetBackgroundOpaque(bool opaque) {
420 background_opaque_ = opaque;
421 }
422
418 bool RenderWidgetHostViewBase::GetBackgroundOpaque() { 423 bool RenderWidgetHostViewBase::GetBackgroundOpaque() {
419 return SkColorGetA(background_color_) == SK_AlphaOPAQUE; 424 return background_opaque_;
420 } 425 }
421 426
422 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const { 427 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const {
423 gfx::Display display = 428 gfx::Display display =
424 gfx::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeView()); 429 gfx::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeView());
425 return gfx::ScaleToCeiledSize(GetRequestedRendererSize(), 430 return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
426 display.device_scale_factor()); 431 display.device_scale_factor());
427 } 432 }
428 433
429 bool RenderWidgetHostViewBase::DoTopControlsShrinkBlinkSize() const { 434 bool RenderWidgetHostViewBase::DoTopControlsShrinkBlinkSize() const {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 void RenderWidgetHostViewBase::RemoveObserver( 733 void RenderWidgetHostViewBase::RemoveObserver(
729 RenderWidgetHostViewBaseObserver* observer) { 734 RenderWidgetHostViewBaseObserver* observer) {
730 observers_.RemoveObserver(observer); 735 observers_.RemoveObserver(observer);
731 } 736 }
732 737
733 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { 738 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const {
734 return cc::SurfaceId(); 739 return cc::SurfaceId();
735 } 740 }
736 741
737 } // namespace content 742 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698