Commit d245896b authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Move SetDeviceColorSpaceForTesting into base.

This method can be easily moved into base.

BUG=1097816

Change-Id: Ic10bea81566403eed038a4c93ed54998dc5a1c68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2542758
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829008}
parent 2d0071f4
......@@ -1302,6 +1302,18 @@ void WebFrameWidgetBase::UseSynchronousResizeModeForTesting(bool enable) {
main_data().synchronous_resize_mode_for_testing = enable;
}
void WebFrameWidgetBase::SetDeviceColorSpaceForTesting(
const gfx::ColorSpace& color_space) {
DCHECK(ForMainFrame());
// We are changing the device color space from the renderer, so allocate a
// new viz::LocalSurfaceId to avoid surface invariants violations in tests.
widget_base_->LayerTreeHost()->RequestNewLocalSurfaceId();
blink::ScreenInfo info = widget_base_->GetScreenInfo();
info.display_color_spaces = gfx::DisplayColorSpaces(color_space);
widget_base_->UpdateScreenInfo(info);
}
// TODO(665924): Remove direct dispatches of mouse events from
// PointerLockController, instead passing them through EventHandler.
void WebFrameWidgetBase::PointerLockMouseEvent(
......
......@@ -581,6 +581,9 @@ class CORE_EXPORT WebFrameWidgetBase
// still need the resize to happen in a synchronous fashion.
void UseSynchronousResizeModeForTesting(bool enable);
// Sets the device color space for testing.
void SetDeviceColorSpaceForTesting(const gfx::ColorSpace& color_space);
// Converts from DIPs to Blink coordinate space (ie. Viewport/Physical
// pixels).
gfx::Size DIPsToCeiledBlinkSpace(const gfx::Size& size);
......
......@@ -298,17 +298,6 @@ WebInputEventResult WebViewFrameWidget::HandleGestureEvent(
return event_result;
}
void WebViewFrameWidget::SetDeviceColorSpaceForTesting(
const gfx::ColorSpace& color_space) {
// We are changing the device color space from the renderer, so allocate a
// new viz::LocalSurfaceId to avoid surface invariants violations in tests.
widget_base_->LayerTreeHost()->RequestNewLocalSurfaceId();
blink::ScreenInfo info = widget_base_->GetScreenInfo();
info.display_color_spaces = gfx::DisplayColorSpaces(color_space);
widget_base_->UpdateScreenInfo(info);
}
void WebViewFrameWidget::SetWindowRectSynchronouslyForTesting(
const gfx::Rect& new_window_rect) {
SetWindowRectSynchronously(new_window_rect);
......
......@@ -78,7 +78,6 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
// WidgetBaseClient overrides:
void FocusChanged(bool enabled) override;
void SetDeviceColorSpaceForTesting(const gfx::ColorSpace& color_space);
void SetWindowRect(const gfx::Rect& window_rect);
void SetWindowRectSynchronouslyForTesting(const gfx::Rect& new_window_rect);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment