Commit 1fb12a84 authored by Fernando Serboncini's avatar Fernando Serboncini Committed by Commit Bot

Disable viz-dependent features on WebView

This adds a flag to disable:
- window.OffscreenCanvas
- Context2DCreation.desynchronize.
- HTMLCanvasElement.transferControlToOffscreen

This is a reland to add WebView layout test expectations.

TBR=alexmos,chrishtr,wfh,boliu

Bug: 940953
Change-Id: I1973c94ced693f0e91785c5197c0d9173e467af8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1743098Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Fernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685334}
parent 87934534
...@@ -42,6 +42,7 @@ void PopulateFixedWebPreferences(WebPreferences* web_prefs) { ...@@ -42,6 +42,7 @@ void PopulateFixedWebPreferences(WebPreferences* web_prefs) {
web_prefs->should_clear_document_background = false; web_prefs->should_clear_document_background = false;
web_prefs->viewport_meta_enabled = true; web_prefs->viewport_meta_enabled = true;
web_prefs->picture_in_picture_enabled = false; web_prefs->picture_in_picture_enabled = false;
web_prefs->disable_features_depending_on_viz = true;
} }
const void* const kAwSettingsUserDataKey = &kAwSettingsUserDataKey; const void* const kAwSettingsUserDataKey = &kAwSettingsUserDataKey;
......
...@@ -123,6 +123,12 @@ interface ServiceWorkerRegistration : EventTarget ...@@ -123,6 +123,12 @@ interface ServiceWorkerRegistration : EventTarget
# support_webgl2_compute_context not supported on android, crbug.com/865569 # support_webgl2_compute_context not supported on android, crbug.com/865569
interface WebGL2ComputeRenderingContext interface WebGL2ComputeRenderingContext
# Viz-dependent interfaces (OffscreenCanvas) are not supported on Webview yet.
interfaces: interface OffscreenCanvasRenderingContext2D
interface OffscreenCanvas : EventTarget
interface HTMLCanvasElement : HTMLElement
method transferControlToOffscreen
[GLOBAL OBJECT] [GLOBAL OBJECT]
method openDatabase method openDatabase
attribute eventSender # test only attribute eventSender # test only
......
...@@ -239,6 +239,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) ...@@ -239,6 +239,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
IPC_STRUCT_TRAITS_MEMBER(immersive_mode_enabled) IPC_STRUCT_TRAITS_MEMBER(immersive_mode_enabled)
IPC_STRUCT_TRAITS_MEMBER(css_hex_alpha_color_enabled) IPC_STRUCT_TRAITS_MEMBER(css_hex_alpha_color_enabled)
IPC_STRUCT_TRAITS_MEMBER(scroll_top_left_interop_enabled) IPC_STRUCT_TRAITS_MEMBER(scroll_top_left_interop_enabled)
IPC_STRUCT_TRAITS_MEMBER(disable_features_depending_on_viz)
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
IPC_STRUCT_TRAITS_MEMBER(force_dark_mode_enabled) IPC_STRUCT_TRAITS_MEMBER(force_dark_mode_enabled)
IPC_STRUCT_TRAITS_MEMBER(default_minimum_page_scale_factor) IPC_STRUCT_TRAITS_MEMBER(default_minimum_page_scale_factor)
......
...@@ -209,6 +209,7 @@ WebPreferences::WebPreferences() ...@@ -209,6 +209,7 @@ WebPreferences::WebPreferences()
embedded_media_experience_enabled(false), embedded_media_experience_enabled(false),
css_hex_alpha_color_enabled(true), css_hex_alpha_color_enabled(true),
scroll_top_left_interop_enabled(true), scroll_top_left_interop_enabled(true),
disable_features_depending_on_viz(false),
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
default_minimum_page_scale_factor(0.25f), default_minimum_page_scale_factor(0.25f),
......
...@@ -280,6 +280,10 @@ struct CONTENT_EXPORT WebPreferences { ...@@ -280,6 +280,10 @@ struct CONTENT_EXPORT WebPreferences {
// WebView sets this to false to retain old documentElement behaviour // WebView sets this to false to retain old documentElement behaviour
// (http://crbug.com/761016). // (http://crbug.com/761016).
bool scroll_top_left_interop_enabled; bool scroll_top_left_interop_enabled;
// Disable features such as offscreen canvas that depend on the viz
// architecture of surface embedding. Android WebView does not support this
// architecture yet.
bool disable_features_depending_on_viz;
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
// Enable forcibly modifying content rendering to result in a light on dark // Enable forcibly modifying content rendering to result in a light on dark
......
...@@ -879,6 +879,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs, ...@@ -879,6 +879,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
WebRuntimeFeatures::EnableCSSHexAlphaColor(prefs.css_hex_alpha_color_enabled); WebRuntimeFeatures::EnableCSSHexAlphaColor(prefs.css_hex_alpha_color_enabled);
WebRuntimeFeatures::EnableScrollTopLeftInterop( WebRuntimeFeatures::EnableScrollTopLeftInterop(
prefs.scroll_top_left_interop_enabled); prefs.scroll_top_left_interop_enabled);
WebRuntimeFeatures::EnableSurfaceEmbeddingFeatures(
!prefs.disable_features_depending_on_viz);
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
settings->SetForceDarkModeEnabled(prefs.force_dark_mode_enabled); settings->SetForceDarkModeEnabled(prefs.force_dark_mode_enabled);
......
...@@ -245,6 +245,8 @@ class WebRuntimeFeatures { ...@@ -245,6 +245,8 @@ class WebRuntimeFeatures {
BLINK_PLATFORM_EXPORT static void EnableMouseSubframeNoImplicitCapture(bool); BLINK_PLATFORM_EXPORT static void EnableMouseSubframeNoImplicitCapture(bool);
BLINK_PLATFORM_EXPORT static void EnableBackForwardCache(bool); BLINK_PLATFORM_EXPORT static void EnableBackForwardCache(bool);
BLINK_PLATFORM_EXPORT static void EnableSurfaceEmbeddingFeatures(bool);
private: private:
WebRuntimeFeatures(); WebRuntimeFeatures();
}; };
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
Constructor([EnforceRange] unsigned long width, [EnforceRange] unsigned long height), Constructor([EnforceRange] unsigned long width, [EnforceRange] unsigned long height),
Exposed=(Window,Worker), Exposed=(Window,Worker),
Transferable, Transferable,
MeasureAs=OffscreenCanvas MeasureAs=OffscreenCanvas,
RuntimeEnabled=SurfaceEmbeddingFeatures
] interface OffscreenCanvas : EventTarget { ] interface OffscreenCanvas : EventTarget {
attribute [EnforceRange] unsigned long width; attribute [EnforceRange] unsigned long width;
attribute [EnforceRange] unsigned long height; attribute [EnforceRange] unsigned long height;
......
...@@ -9,6 +9,6 @@ dictionary CanvasRenderingContext2DSettings { ...@@ -9,6 +9,6 @@ dictionary CanvasRenderingContext2DSettings {
boolean alpha = true; boolean alpha = true;
[RuntimeEnabled=CanvasColorManagement] CanvasColorSpace colorSpace = "srgb"; [RuntimeEnabled=CanvasColorManagement] CanvasColorSpace colorSpace = "srgb";
[RuntimeEnabled=CanvasColorManagement] CanvasPixelFormat pixelFormat = "uint8"; [RuntimeEnabled=CanvasColorManagement] CanvasPixelFormat pixelFormat = "uint8";
boolean desynchronized = false; [RuntimeEnabled=SurfaceEmbeddingFeatures] boolean desynchronized = false;
}; };
...@@ -40,7 +40,7 @@ dictionary CanvasContextCreationAttributesModule { ...@@ -40,7 +40,7 @@ dictionary CanvasContextCreationAttributesModule {
// the bindings because origin trial bindings don't work in extensions. // the bindings because origin trial bindings don't work in extensions.
// The trial's runtime flag is instead checked inside // The trial's runtime flag is instead checked inside
// HTMLCanvasElement.getContext(). // HTMLCanvasElement.getContext().
boolean desynchronized = false; [RuntimeEnabled=SurfaceEmbeddingFeatures] boolean desynchronized = false;
// Canvas 2D attributes // Canvas 2D attributes
boolean alpha = true; // Also used for WebGL. boolean alpha = true; // Also used for WebGL.
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
// https://html.spec.whatwg.org/C/#the-canvas-element // https://html.spec.whatwg.org/C/#the-canvas-element
// This file is currently forked between html_canvas_element_module.idl and
// html_canvas_element_module_support_webgl2_compute.idl. Update both files.
typedef (CanvasRenderingContext2D or typedef (CanvasRenderingContext2D or
WebGLRenderingContext or WebGLRenderingContext or
WebGL2RenderingContext or WebGL2RenderingContext or
...@@ -20,5 +23,7 @@ typedef (CanvasRenderingContext2D or ...@@ -20,5 +23,7 @@ typedef (CanvasRenderingContext2D or
// (and is not undefined or null). The binding must ignore this. // (and is not undefined or null). The binding must ignore this.
// Related spec issue: https://github.com/whatwg/html/issues/595 // Related spec issue: https://github.com/whatwg/html/issues/595
[RaisesException] RenderingContext? getContext(DOMString contextId, [PermissiveDictionaryConversion] optional CanvasContextCreationAttributesModule attributes); [RaisesException] RenderingContext? getContext(DOMString contextId, [PermissiveDictionaryConversion] optional CanvasContextCreationAttributesModule attributes);
[RaisesException, MeasureAs=OffscreenCanvas] OffscreenCanvas transferControlToOffscreen();
[RuntimeEnabled=SurfaceEmbeddingFeatures,
RaisesException, MeasureAs=OffscreenCanvas] OffscreenCanvas transferControlToOffscreen();
}; };
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
// https://html.spec.whatwg.org/C/#the-canvas-element // https://html.spec.whatwg.org/C/#the-canvas-element
// This file is currently forked between html_canvas_element_module.idl and
// html_canvas_element_module_support_webgl2_compute.idl. Update both files.
typedef (CanvasRenderingContext2D or typedef (CanvasRenderingContext2D or
WebGLRenderingContext or WebGLRenderingContext or
WebGL2RenderingContext or WebGL2RenderingContext or
...@@ -21,5 +24,5 @@ typedef (CanvasRenderingContext2D or ...@@ -21,5 +24,5 @@ typedef (CanvasRenderingContext2D or
// (and is not undefined or null). The binding must ignore this. // (and is not undefined or null). The binding must ignore this.
// Related spec issue: https://github.com/whatwg/html/issues/595 // Related spec issue: https://github.com/whatwg/html/issues/595
[RaisesException] RenderingContext? getContext(DOMString contextId, [PermissiveDictionaryConversion] optional CanvasContextCreationAttributesModule attributes); [RaisesException] RenderingContext? getContext(DOMString contextId, [PermissiveDictionaryConversion] optional CanvasContextCreationAttributesModule attributes);
[RaisesException, MeasureAs=OffscreenCanvas] OffscreenCanvas transferControlToOffscreen(); [RaisesException, MeasureAs=OffscreenCanvas, RuntimeEnabled=SurfaceEmbeddingFeatures] OffscreenCanvas transferControlToOffscreen();
}; };
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
// https://html.spec.whatwg.org/C/#the-offscreen-2d-rendering-context // https://html.spec.whatwg.org/C/#the-offscreen-2d-rendering-context
[ [
Exposed=(Window,Worker) Exposed=(Window,Worker),
RuntimeEnabled=SurfaceEmbeddingFeatures
] interface OffscreenCanvasRenderingContext2D { ] interface OffscreenCanvasRenderingContext2D {
// back-reference to the canvas // back-reference to the canvas
[ImplementedAs=offscreenCanvasForBinding] readonly attribute OffscreenCanvas canvas; [ImplementedAs=offscreenCanvasForBinding] readonly attribute OffscreenCanvas canvas;
......
...@@ -42,5 +42,5 @@ dictionary WebGLContextAttributes { ...@@ -42,5 +42,5 @@ dictionary WebGLContextAttributes {
WebGLPowerPreference powerPreference = "default"; WebGLPowerPreference powerPreference = "default";
boolean failIfMajorPerformanceCaveat = false; boolean failIfMajorPerformanceCaveat = false;
[RuntimeEnabled=WebXR] boolean xrCompatible = false; [RuntimeEnabled=WebXR] boolean xrCompatible = false;
boolean desynchronized = false; [RuntimeEnabled=SurfaceEmbeddingFeatures] boolean desynchronized = false;
}; };
...@@ -695,4 +695,8 @@ void WebRuntimeFeatures::EnableBackForwardCache(bool enable) { ...@@ -695,4 +695,8 @@ void WebRuntimeFeatures::EnableBackForwardCache(bool enable) {
RuntimeEnabledFeatures::SetBackForwardCacheEnabled(enable); RuntimeEnabledFeatures::SetBackForwardCacheEnabled(enable);
} }
void WebRuntimeFeatures::EnableSurfaceEmbeddingFeatures(bool enable) {
RuntimeEnabledFeatures::SetSurfaceEmbeddingFeaturesEnabled(enable);
}
} // namespace blink } // namespace blink
...@@ -1542,6 +1542,10 @@ ...@@ -1542,6 +1542,10 @@
name: "StreamsNative", name: "StreamsNative",
status: "test", status: "test",
}, },
{
name: "SurfaceEmbeddingFeatures",
status: "stable",
},
{ {
name: "TextFragmentIdentifiers", name: "TextFragmentIdentifiers",
origin_trial_feature_name: "TextFragmentIdentifiers", origin_trial_feature_name: "TextFragmentIdentifiers",
......
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