From 189d4fd8fad9e3c776873be51938cd31a42b6177 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 20 May 2021 09:47:09 +0200 Subject: BASELINE: Update Chromium to 90.0.4430.221 Change-Id: Iff4d9d18d2fcf1a576f3b1f453010f744a232920 Reviewed-by: Allan Sandfeld Jensen --- chromium/third_party/blink/renderer/.style.yapf | 2 - chromium/third_party/blink/renderer/BUILD.gn | 3 +- chromium/third_party/blink/renderer/DEPS | 15 +- .../third_party/blink/renderer/bindings/BUILD.gn | 12 +- .../blink/renderer/bindings/DIR_METADATA | 5 + .../renderer/bindings/IDLExtendedAttributes.md | 17 - .../renderer/bindings/IDLExtendedAttributes.txt | 1 - .../third_party/blink/renderer/bindings/OWNERS | 3 - .../blink/renderer/bindings/bindings.gni | 7 +- .../blink/renderer/bindings/core/v8/DIR_METADATA | 5 + .../blink/renderer/bindings/core/v8/OWNERS | 3 - .../renderer/bindings/core/v8/binding_security.cc | 6 +- .../renderer/bindings/core/v8/boxed_v8_module.h | 5 +- .../bindings/core/v8/boxed_v8_module_test.cc | 15 +- .../blink/renderer/bindings/core/v8/custom/DEPS | 5 + .../core/v8/custom/v8_dev_tools_host_custom.cc | 21 +- .../blink/renderer/bindings/core/v8/generated.gni | 4 +- .../bindings/core/v8/generated_code_helper.cc | 9 - .../bindings/core/v8/generated_code_helper.h | 6 +- .../blink/renderer/bindings/core/v8/idl_types.h | 57 +- .../bindings/core/v8/isolated_world_csp.cc | 8 +- .../bindings/core/v8/js_based_event_listener.cc | 4 +- .../v8/js_event_handler_for_content_attribute.cc | 7 +- .../bindings/core/v8/local_window_proxy.cc | 32 +- .../renderer/bindings/core/v8/local_window_proxy.h | 6 +- .../renderer/bindings/core/v8/module_record.cc | 116 +- .../renderer/bindings/core/v8/module_record.h | 22 +- .../bindings/core/v8/module_record_test.cc | 93 +- .../renderer/bindings/core/v8/module_request.cc | 19 + .../renderer/bindings/core/v8/module_request.h | 30 +- .../bindings/core/v8/native_value_traits_impl.h | 218 +- .../renderer/bindings/core/v8/rejected_promises.cc | 5 +- .../bindings/core/v8/remote_window_proxy.cc | 9 +- .../bindings/core/v8/remote_window_proxy.h | 9 +- .../renderer/bindings/core/v8/scheduled_action.cc | 70 +- .../renderer/bindings/core/v8/script_controller.cc | 115 +- .../renderer/bindings/core/v8/script_controller.h | 43 +- .../bindings/core/v8/script_evaluation_result.cc | 6 - .../bindings/core/v8/script_evaluation_result.h | 2 - .../renderer/bindings/core/v8/script_function.cc | 62 + .../renderer/bindings/core/v8/script_function.h | 76 +- .../renderer/bindings/core/v8/script_promise.cc | 7 + .../renderer/bindings/core/v8/script_promise.h | 10 +- .../core/v8/script_promise_property_test.cc | 6 +- .../bindings/core/v8/script_promise_resolver.h | 2 +- .../bindings/core/v8/script_promise_test.cc | 181 + .../bindings/core/v8/script_promise_tester.cc | 1 - .../bindings/core/v8/script_promise_tester.h | 2 +- .../renderer/bindings/core/v8/script_regexp.cc | 27 +- .../renderer/bindings/core/v8/script_regexp.h | 23 +- .../renderer/bindings/core/v8/script_streamer.cc | 127 +- .../renderer/bindings/core/v8/script_streamer.h | 13 +- .../bindings/core/v8/script_streamer_test.cc | 19 +- .../core/v8/serialization/serialization_tag.h | 19 +- .../v8/serialization/serialized_color_params.cc | 258 +- .../v8/serialization/serialized_color_params.h | 64 +- .../v8/serialization/serialized_script_value.cc | 8 +- .../v8/serialization/serialized_script_value.h | 24 +- .../serialization/v8_script_value_deserializer.cc | 97 +- .../serialization/v8_script_value_deserializer.h | 2 +- .../v8/serialization/v8_script_value_serializer.cc | 39 +- .../v8_script_value_serializer_test.cc | 106 +- .../renderer/bindings/core/v8/source_location.cc | 43 +- .../renderer/bindings/core/v8/source_location.h | 12 +- .../renderer/bindings/core/v8/to_v8_for_core.h | 4 +- .../blink/renderer/bindings/core/v8/to_v8_traits.h | 649 +++ .../renderer/bindings/core/v8/to_v8_traits_test.cc | 520 +++ .../bindings/core/v8/use_counter_callback.cc | 16 +- .../v8/v0_custom_element_constructor_builder.cc | 415 -- .../v8/v0_custom_element_constructor_builder.h | 98 - .../bindings/core/v8/v8_binding_for_core.cc | 5 +- .../bindings/core/v8/v8_binding_for_testing.cc | 3 +- .../bindings/core/v8/v8_binding_for_testing.h | 8 +- .../renderer/bindings/core/v8/v8_code_cache.cc | 19 +- .../bindings/core/v8/v8_dom_configuration.cc | 19 +- .../bindings/core/v8/v8_embedder_graph_builder.cc | 148 +- .../renderer/bindings/core/v8/v8_gc_controller.cc | 35 +- .../bindings/core/v8/v8_gc_for_context_dispose.cc | 2 +- .../renderer/bindings/core/v8/v8_initializer.cc | 27 +- .../blink/renderer/bindings/core/v8/v8_metrics.cc | 8 +- .../renderer/bindings/core/v8/v8_object_parser.cc | 2 +- .../renderer/bindings/core/v8/v8_script_runner.cc | 207 +- .../renderer/bindings/core/v8/v8_script_runner.h | 31 +- .../bindings/core/v8/v8_script_runner_test.cc | 2 +- .../v8/v8_v0_custom_element_lifecycle_callbacks.cc | 248 -- .../v8/v8_v0_custom_element_lifecycle_callbacks.h | 89 - .../core/v8/v8_wasm_response_extensions.cc | 90 +- .../renderer/bindings/core/v8/window_proxy.cc | 9 +- .../blink/renderer/bindings/core/v8/window_proxy.h | 21 +- .../bindings/core/v8/window_proxy_manager.cc | 49 +- .../bindings/core/v8/window_proxy_manager.h | 21 +- .../renderer/bindings/core/v8/window_proxy_test.cc | 43 + .../core/v8/worker_or_worklet_script_controller.cc | 48 - .../core/v8/worker_or_worklet_script_controller.h | 17 +- .../blink/renderer/bindings/generated_in_core.gni | 66 +- .../renderer/bindings/generated_in_modules.gni | 250 +- .../blink/renderer/bindings/idl_in_core.gni | 28 +- .../blink/renderer/bindings/idl_in_modules.gni | 119 +- .../blink/renderer/bindings/modules/v8/BUILD.gn | 52 +- .../renderer/bindings/modules/v8/generated.gni | 20 +- .../v8_script_value_deserializer_for_modules.cc | 51 +- .../v8_script_value_deserializer_for_modules.h | 4 +- .../v8_script_value_serializer_for_modules.cc | 49 +- .../v8_script_value_serializer_for_modules.h | 12 +- .../v8_script_value_serializer_for_modules_test.cc | 20 +- .../bindings/modules/v8/v8_binding_for_modules.cc | 6 +- .../blink/renderer/bindings/scripts/BUILD.gn | 5 +- .../renderer/bindings/scripts/bind_gen/.style.yapf | 4 - .../bindings/scripts/bind_gen/blink_v8_bridge.py | 214 +- .../bindings/scripts/bind_gen/callback_function.py | 34 +- .../scripts/bind_gen/callback_interface.py | 9 +- .../bindings/scripts/bind_gen/code_node.py | 10 +- .../bindings/scripts/bind_gen/codegen_expr.py | 15 +- .../bindings/scripts/bind_gen/codegen_format.py | 3 +- .../bindings/scripts/bind_gen/codegen_utils.py | 3 +- .../bindings/scripts/bind_gen/dictionary.py | 2 +- .../bindings/scripts/bind_gen/interface.py | 189 +- .../bindings/scripts/bind_gen/mako_renderer.py | 2 +- .../bindings/scripts/bind_gen/path_manager.py | 10 +- .../bindings/scripts/bind_gen/style_format.py | 9 +- .../bindings/scripts/bind_gen/task_queue.py | 3 +- .../renderer/bindings/scripts/bind_gen/union.py | 595 ++- .../scripts/generate_origin_trial_features.py | 4 +- .../renderer/bindings/scripts/idl_definitions.py | 8 +- .../blink/renderer/bindings/scripts/idl_reader.py | 4 +- .../blink/renderer/bindings/scripts/idl_types.py | 2 +- .../blink/renderer/bindings/scripts/scripts.gni | 17 +- .../blink/renderer/bindings/scripts/utilities.py | 35 +- .../renderer/bindings/scripts/v8_attributes.py | 6 +- .../renderer/bindings/scripts/v8_interface.py | 9 +- .../blink/renderer/bindings/scripts/v8_methods.py | 9 +- .../renderer/bindings/scripts/v8_utilities.py | 2 +- .../renderer/bindings/scripts/web_idl/.style.yapf | 4 - .../renderer/bindings/scripts/web_idl/__init__.py | 1 + .../bindings/scripts/web_idl/callback_interface.py | 12 +- .../renderer/bindings/scripts/web_idl/database.py | 2 +- .../renderer/bindings/scripts/web_idl/exposure.py | 5 +- .../bindings/scripts/web_idl/function_like.py | 28 +- .../bindings/scripts/web_idl/idl_compiler.py | 17 +- .../renderer/bindings/scripts/web_idl/idl_type.py | 16 + .../renderer/bindings/scripts/web_idl/interface.py | 45 +- .../bindings/scripts/web_idl/ir_builder.py | 29 +- .../renderer/bindings/scripts/web_idl/make_copy.py | 8 + .../renderer/bindings/scripts/web_idl/namespace.py | 12 +- .../renderer/bindings/scripts/web_idl/union.py | 25 +- .../renderer/bindings/templates/attributes.cc.tmpl | 4 - .../bindings/templates/interface_base.cc.tmpl | 17 +- .../renderer/bindings/templates/methods.cc.tmpl | 4 - .../blink/renderer/build/scripts/PRESUBMIT.py | 19 +- .../scripts/blinkbuild/name_style_converter.py | 1 + .../build/scripts/core/css/css_properties.py | 33 +- .../scripts/core/css/make_css_property_names.py | 4 +- .../scripts/core/css/make_style_shorthands.py | 23 +- .../css/properties/make_css_property_instances.py | 4 +- .../properties/templates/css_properties.cc.tmpl | 36 +- .../css/properties/templates/css_properties.h.tmpl | 17 +- .../templates/css_property_instances.cc.tmpl | 6 +- .../templates/style_builder_functions.tmpl | 12 +- .../core/css/templates/css_property_names.cc.tmpl | 6 +- .../core/css/templates/css_property_names.h.tmpl | 83 +- .../scripts/core/style/make_computed_style_base.py | 2 + .../blink/renderer/build/scripts/gperf.py | 2 +- .../blink/renderer/build/scripts/in_file.py | 2 +- .../blink/renderer/build/scripts/in_generator.py | 5 + .../scripts/make_document_policy_features_tests.py | 27 + .../renderer/build/scripts/make_policy_helper.py | 7 + .../build/scripts/make_runtime_features.py | 2 +- .../blink/renderer/build/scripts/name_utilities.py | 4 + .../blink/renderer/build/scripts/scripts.gni | 5 +- .../templates/document_policy_features.cc.tmpl | 37 +- .../build/scripts/templates/fields/field.tmpl | 38 +- .../renderer/build/scripts/templates/macros.tmpl | 10 + .../build/scripts/templates/origin_trials.cc.tmpl | 7 +- .../build/scripts/templates/policy_helper.cc.tmpl | 29 +- .../templates/runtime_enabled_features.cc.tmpl | 11 +- .../build/scripts/templates/settings_macros.h.tmpl | 20 +- .../renderer/build/scripts/writer_test_util.py | 111 + .../third_party/blink/renderer/controller/BUILD.gn | 7 +- .../blink/renderer/controller/DIR_METADATA | 5 + .../third_party/blink/renderer/controller/OWNERS | 3 - .../blink/renderer/controller/blink_initializer.cc | 4 +- .../renderer/controller/dev_tools_frontend_impl.cc | 10 +- .../renderer/controller/dev_tools_frontend_impl.h | 14 +- .../controller/highest_pmf_reporter_test.cc | 9 +- .../renderer/controller/memory_usage_monitor.cc | 2 +- .../renderer_resource_coordinator_impl.cc | 126 +- .../renderer_resource_coordinator_impl.h | 6 + .../renderer_resource_coordinator_impl_test.cc | 272 ++ .../v8_detailed_memory_reporter_impl.cc | 38 +- .../v8_detailed_memory_reporter_impl_test.cc | 5 + .../v8_worker_memory_reporter.cc | 82 +- .../v8_worker_memory_reporter.h | 19 +- .../v8_worker_memory_reporter_test.cc | 25 +- chromium/third_party/blink/renderer/core/BUILD.gn | 113 +- chromium/third_party/blink/renderer/core/DEPS | 12 +- .../third_party/blink/renderer/core/DIR_METADATA | 5 + chromium/third_party/blink/renderer/core/OWNERS | 18 +- .../blink/renderer/core/accessibility/DIR_METADATA | 5 + .../blink/renderer/core/accessibility/OWNERS | 3 - .../renderer/core/accessibility/ax_object_cache.h | 10 +- .../core/accessibility/ax_object_cache_base.h | 3 +- .../blink/renderer/core/animation/BUILD.gn | 4 + .../blink/renderer/core/animation/DIR_METADATA | 5 + .../blink/renderer/core/animation/OWNERS | 3 - .../blink/renderer/core/animation/animatable.cc | 13 + .../blink/renderer/core/animation/animation.cc | 391 +- .../blink/renderer/core/animation/animation.h | 89 +- .../blink/renderer/core/animation/animation.idl | 4 +- .../renderer/core/animation/animation_effect.cc | 8 +- .../renderer/core/animation/animation_effect.h | 12 +- .../core/animation/animation_effect_test.cc | 5 +- .../core/animation/animation_input_helpers.cc | 4 +- .../renderer/core/animation/animation_test.cc | 723 +++- .../renderer/core/animation/animation_time_delta.h | 6 + .../renderer/core/animation/animation_timeline.cc | 6 + .../renderer/core/animation/animation_timeline.h | 3 +- .../blink/renderer/core/animation/build.gni | 2 + .../core/animation/compositor_animations.cc | 76 +- .../core/animation/compositor_animations.h | 1 + .../core/animation/compositor_animations_test.cc | 24 +- .../animation/css/compositor_keyframe_double.h | 1 + .../css/compositor_keyframe_value_factory.cc | 6 +- .../css/compositor_keyframe_value_factory.h | 3 +- .../renderer/core/animation/css/css_animation.cc | 2 +- .../renderer/core/animation/css/css_animation.h | 2 +- .../renderer/core/animation/css/css_animations.cc | 60 +- .../core/animation/css/css_animations_test.cc | 30 +- .../core/animation/css/css_scroll_timeline.cc | 26 +- .../core/animation/css/css_scroll_timeline.h | 4 +- .../core/animation/css/css_scroll_timeline_test.cc | 136 + .../css_aspect_ratio_interpolation_type.cc | 164 + .../css_aspect_ratio_interpolation_type.h | 53 + .../css_basic_shape_interpolation_type.cc | 2 - .../core/animation/css_clip_interpolation_type.cc | 4 +- .../core/animation/css_color_interpolation_type.cc | 23 +- .../core/animation/css_color_interpolation_type.h | 6 +- .../animation/css_color_interpolation_type_test.cc | 32 + .../animation/css_default_interpolation_type.h | 3 +- ...s_font_variation_settings_interpolation_type.cc | 7 +- .../core/animation/css_image_interpolation_type.cc | 6 +- .../animation/css_image_list_interpolation_type.cc | 4 +- .../core/animation/css_interpolation_types_map.cc | 31 +- .../animation/css_interpolation_types_map_test.cc | 49 + .../animation/css_length_interpolation_type.cc | 14 +- .../css_length_list_interpolation_type.cc | 2 +- .../core/animation/css_paint_interpolation_type.cc | 13 +- .../core/animation/css_path_interpolation_type.cc | 2 +- .../core/animation/css_scale_interpolation_type.cc | 2 +- .../animation/css_size_list_interpolation_type.cc | 4 +- .../animation/css_visibility_interpolation_type.cc | 4 +- .../renderer/core/animation/document_animations.cc | 11 + .../renderer/core/animation/document_animations.h | 21 + .../core/animation/document_animations_test.cc | 2 +- .../renderer/core/animation/document_timeline.cc | 16 +- .../renderer/core/animation/document_timeline.h | 16 +- .../core/animation/document_timeline_test.cc | 76 +- .../renderer/core/animation/effect_stack_test.cc | 8 +- .../renderer/core/animation/element_animations.cc | 14 + .../renderer/core/animation/element_animations.h | 1 + .../blink/renderer/core/animation/inert_effect.cc | 2 +- .../blink/renderer/core/animation/inert_effect.h | 4 +- .../core/animation/interpolable_aspect_ratio.cc | 65 + .../core/animation/interpolable_aspect_ratio.h | 62 + .../renderer/core/animation/interpolable_length.cc | 5 +- .../renderer/core/animation/interpolable_value.h | 1 + .../renderer/core/animation/keyframe_effect.cc | 46 +- .../renderer/core/animation/keyframe_effect.h | 2 + .../core/animation/keyframe_effect_model.cc | 16 +- .../core/animation/keyframe_effect_model.h | 2 +- .../core/animation/keyframe_effect_model_test.cc | 9 +- .../core/animation/keyframe_effect_test.cc | 46 +- .../core/animation/length_property_functions.cc | 21 +- .../core/animation/list_interpolation_functions.h | 2 +- .../core/animation/path_interpolation_functions.cc | 2 +- .../renderer/core/animation/pending_animations.cc | 38 +- .../renderer/core/animation/pending_animations.h | 2 +- .../renderer/core/animation/scroll_timeline.cc | 52 +- .../renderer/core/animation/scroll_timeline.h | 10 +- .../core/animation/scroll_timeline_offset.cc | 7 +- .../core/animation/scroll_timeline_test.cc | 79 +- .../core/animation/scroll_timeline_util_test.cc | 9 +- .../renderer/core/animation/string_keyframe.cc | 2 +- .../core/animation/svg_path_interpolation_type.cc | 2 +- .../blink/renderer/core/animation/timing.cc | 2 +- .../renderer/core/animation/timing_calculations.h | 6 +- .../renderer/core/animation/timing_input_test.cc | 1 + .../renderer/core/animation/transition_keyframe.h | 2 + .../core/animation/worklet_animation_controller.cc | 8 +- .../core/animation/worklet_animation_controller.h | 6 +- .../renderer/core/animation_frame/DIR_METADATA | 5 + .../blink/renderer/core/animation_frame/OWNERS | 3 - .../blink/renderer/core/aom/DIR_METADATA | 5 + .../third_party/blink/renderer/core/aom/OWNERS | 3 - .../blink/renderer/core/aom/accessible_node.cc | 12 + .../blink/renderer/core/aom/accessible_node.h | 6 +- .../blink/renderer/core/clipboard/DIR_METADATA | 5 + .../blink/renderer/core/clipboard/OWNERS | 3 - .../renderer/core/clipboard/clipboard_utilities.cc | 6 +- .../blink/renderer/core/clipboard/data_object.cc | 33 +- .../blink/renderer/core/clipboard/data_object.h | 4 +- .../renderer/core/clipboard/data_object_item.cc | 25 +- .../renderer/core/clipboard/data_object_item.h | 14 +- .../blink/renderer/core/clipboard/data_transfer.cc | 114 +- .../blink/renderer/core/clipboard/data_transfer.h | 36 +- .../renderer/core/clipboard/system_clipboard.cc | 23 +- .../renderer/core/clipboard/system_clipboard.h | 3 + .../core/content_capture/content_capture_task.cc | 33 +- .../core/content_capture/content_capture_task.h | 3 +- .../content_capture_task_histogram_reporter.cc | 24 +- .../content_capture_task_histogram_reporter.h | 12 +- .../blink/renderer/core/core_idl_files.gni | 34 +- .../blink/renderer/core/core_initializer.cc | 2 - .../blink/renderer/core/css/DIR_METADATA | 5 + .../third_party/blink/renderer/core/css/OWNERS | 3 - .../abstract_property_set_css_style_declaration.cc | 28 +- .../blink/renderer/core/css/active_style_sheets.cc | 41 + .../blink/renderer/core/css/active_style_sheets.h | 4 + .../renderer/core/css/active_style_sheets_test.cc | 3 - .../css/background_color_paint_image_generator.cc | 30 + .../css/background_color_paint_image_generator.h | 47 + .../third_party/blink/renderer/core/css/build.gni | 26 +- .../blink/renderer/core/css/container_query.cc | 41 + .../blink/renderer/core/css/container_query.h | 37 + .../renderer/core/css/container_query_evaluator.cc | 79 + .../renderer/core/css/container_query_evaluator.h | 65 + .../core/css/container_query_evaluator_test.cc | 248 ++ .../renderer/core/css/container_query_test.cc | 198 + .../blink/renderer/core/css/counter_style.cc | 686 ++++ .../blink/renderer/core/css/counter_style.h | 169 + .../blink/renderer/core/css/counter_style_map.cc | 296 ++ .../blink/renderer/core/css/counter_style_map.h | 66 + .../renderer/core/css/counter_style_map_test.cc | 204 + .../blink/renderer/core/css/counter_style_test.cc | 627 +++ .../core/css/css_computed_style_declaration.cc | 47 +- .../blink/renderer/core/css/css_container_rule.cc | 24 + .../blink/renderer/core/css/css_container_rule.h | 37 + .../blink/renderer/core/css/css_container_rule.idl | 10 + .../renderer/core/css/css_counter_style_rule.cc | 188 +- .../renderer/core/css/css_counter_style_rule.h | 28 +- .../renderer/core/css/css_counter_style_rule.idl | 22 +- .../blink/renderer/core/css/css_counter_value.cc | 2 +- .../blink/renderer/core/css/css_counter_value.h | 6 +- .../renderer/core/css/css_default_style_sheets.cc | 90 +- .../renderer/core/css/css_default_style_sheets.h | 13 + .../renderer/core/css/css_font_face_src_value.cc | 2 +- .../blink/renderer/core/css/css_font_selector.cc | 69 +- .../blink/renderer/core/css/css_font_selector.h | 19 +- .../blink/renderer/core/css/css_global_rule_set.cc | 10 +- .../blink/renderer/core/css/css_gradient_value.cc | 7 +- .../blink/renderer/core/css/css_grouping_rule.h | 2 +- .../blink/renderer/core/css/css_image_set_value.cc | 50 +- .../blink/renderer/core/css/css_image_set_value.h | 19 +- .../blink/renderer/core/css/css_image_value.h | 1 + .../renderer/core/css/css_initial_color_value.h | 4 +- .../renderer/core/css/css_math_expression_node.cc | 132 +- .../renderer/core/css/css_math_expression_node.h | 3 +- .../renderer/core/css/css_math_function_value.cc | 5 +- .../renderer/core/css/css_numeric_literal_value.cc | 44 +- .../blink/renderer/core/css/css_page_rule_test.cc | 2 + .../blink/renderer/core/css/css_path_value.cc | 2 +- .../blink/renderer/core/css/css_path_value.h | 2 +- .../blink/renderer/core/css/css_primitive_value.cc | 28 +- .../blink/renderer/core/css/css_primitive_value.h | 3 +- .../core/css/css_primitive_value_mappings.h | 415 +- .../renderer/core/css/css_primitive_value_test.cc | 51 + .../blink/renderer/core/css/css_properties.json5 | 1029 +++-- .../renderer/core/css/css_property_equality.cc | 40 +- .../renderer/core/css/css_property_id_templates.h | 4 +- .../blink/renderer/core/css/css_property_name.h | 2 +- .../blink/renderer/core/css/css_property_value.cc | 2 +- .../renderer/core/css/css_property_value_set.cc | 51 +- .../renderer/core/css/css_property_value_set.h | 1 + .../blink/renderer/core/css/css_revert_value.h | 4 +- .../third_party/blink/renderer/core/css/css_rule.h | 1 + .../blink/renderer/core/css/css_selector.cc | 112 +- .../blink/renderer/core/css/css_selector.h | 75 +- .../blink/renderer/core/css/css_selector_list.cc | 46 - .../blink/renderer/core/css/css_selector_list.h | 14 - .../blink/renderer/core/css/css_selector_test.cc | 24 +- .../blink/renderer/core/css/css_selector_watch.cc | 1 + .../blink/renderer/core/css/css_selector_watch.h | 2 +- .../renderer/core/css/css_style_declaration.cc | 20 +- .../blink/renderer/core/css/css_style_sheet.cc | 11 +- .../blink/renderer/core/css/css_test_helpers.cc | 10 +- .../blink/renderer/core/css/css_test_helpers.h | 2 + .../blink/renderer/core/css/css_unset_value.h | 4 +- .../blink/renderer/core/css/css_value.h | 15 + .../renderer/core/css/css_value_clamping_utils.cc | 22 + .../renderer/core/css/css_value_clamping_utils.h | 25 + .../core/css/css_value_clamping_utils_test.cc | 38 + .../renderer/core/css/css_value_id_mappings.h | 12 +- .../renderer/core/css/css_value_keywords.json5 | 49 + .../blink/renderer/core/css/css_value_pair.h | 4 +- .../blink/renderer/core/css/css_value_pool.cc | 2 +- .../blink/renderer/core/css/css_value_pool.h | 4 +- .../css/cssom/cross_thread_style_value_test.cc | 12 +- .../renderer/core/css/cssom/css_style_value.cc | 2 +- .../renderer/core/css/cssom/css_unparsed_value.cc | 15 +- .../core/css/cssom/paint_worklet_deferred_image.cc | 10 +- .../core/css/cssom/paint_worklet_deferred_image.h | 1 + .../renderer/core/css/cssom/paint_worklet_input.h | 11 +- .../css/cssom/paint_worklet_style_property_map.cc | 4 +- ...repopulated_computed_style_property_map_test.cc | 1 + .../renderer/core/css/cssom/style_property_map.cc | 14 +- .../renderer/core/css/cssom/style_value_factory.cc | 6 +- .../core/css/document_style_sheet_collection.cc | 21 - .../core/css/document_style_sheet_collection.h | 2 - .../blink/renderer/core/css/dom_window_css.cc | 4 +- .../renderer/core/css/element_rule_collector.cc | 104 +- .../renderer/core/css/element_rule_collector.h | 39 +- .../core/css/element_rule_collector_test.cc | 4 +- .../blink/renderer/core/css/font_face.cc | 21 +- .../blink/renderer/core/css/font_face.h | 3 +- .../blink/renderer/core/css/font_face_cache.h | 4 +- .../renderer/core/css/font_face_cache_test.cc | 49 +- .../renderer/core/css/font_face_set_document.cc | 1 + .../renderer/core/css/font_face_set_document.h | 5 +- .../core/css/font_update_invalidation_test.cc | 7 +- .../core/css/invalidation/style_invalidator.cc | 10 - .../renderer/core/css/layout_tree_rebuild_root.cc | 22 +- .../renderer/core/css/layout_tree_rebuild_root.h | 3 +- .../renderer/core/css/media_feature_names.json5 | 1 + .../renderer/core/css/media_query_evaluator.cc | 86 +- .../renderer/core/css/media_query_evaluator.h | 3 +- .../core/css/media_query_evaluator_test.cc | 138 +- .../blink/renderer/core/css/media_query_exp.cc | 25 +- .../blink/renderer/core/css/media_query_exp.h | 4 + .../renderer/core/css/media_query_set_test.cc | 3 + .../blink/renderer/core/css/media_values.cc | 41 +- .../blink/renderer/core/css/media_values.h | 14 +- .../blink/renderer/core/css/media_values_cached.cc | 18 +- .../blink/renderer/core/css/media_values_cached.h | 11 +- .../renderer/core/css/media_values_dynamic.cc | 8 +- .../blink/renderer/core/css/media_values_dynamic.h | 5 +- .../core/css/media_values_initial_viewport.cc | 26 - .../core/css/media_values_initial_viewport.h | 22 - .../core/css/media_values_initial_viewport_test.cc | 38 - .../core/css/native_paint_image_generator.cc | 31 - .../core/css/native_paint_image_generator.h | 18 +- .../renderer/core/css/offscreen_font_selector.cc | 10 +- .../renderer/core/css/offscreen_font_selector.h | 4 +- .../at_rule_counter_style_descriptor_parser.cc | 238 +- .../core/css/parser/at_rule_descriptor_parser.cc | 26 +- .../renderer/core/css/parser/at_rule_names.json5 | 3 - .../blink/renderer/core/css/parser/css.proto | 89 +- .../renderer/core/css/parser/css_at_rule_id.cc | 12 +- .../renderer/core/css/parser/css_at_rule_id.h | 1 + .../blink/renderer/core/css/parser/css_parser.cc | 2 +- .../renderer/core/css/parser/css_parser_context.cc | 68 +- .../renderer/core/css/parser/css_parser_context.h | 14 +- .../core/css/parser/css_parser_fast_paths.cc | 14 - .../core/css/parser/css_parser_fast_paths.h | 4 - .../css/parser/css_parser_fast_paths_fuzzer.cc | 2 +- .../renderer/core/css/parser/css_parser_impl.cc | 54 +- .../renderer/core/css/parser/css_parser_impl.h | 2 + .../core/css/parser/css_parser_impl_test.cc | 36 + .../core/css/parser/css_parser_selector.cc | 4 +- .../renderer/core/css/parser/css_parser_selector.h | 6 - .../core/css/parser/css_property_parser.cc | 16 +- .../core/css/parser/css_property_parser_test.cc | 4 +- .../core/css/parser/css_proto_converter.cc | 62 +- .../renderer/core/css/parser/css_proto_converter.h | 4 +- .../core/css/parser/css_selector_parser.cc | 82 +- .../renderer/core/css/parser/css_selector_parser.h | 6 - .../core/css/parser/css_selector_parser_test.cc | 88 +- .../core/css/parser/sizes_attribute_parser_test.cc | 5 +- .../css/parser/sizes_math_function_parser_test.cc | 12 +- .../core/css/predefined_counter_styles.css | 435 ++ .../core/css/properties/computed_style_utils.cc | 106 +- .../renderer/core/css/properties/css_bitset.h | 6 +- .../core/css/properties/css_bitset_test.cc | 4 +- .../css/properties/css_direction_aware_resolver.cc | 298 +- .../css/properties/css_direction_aware_resolver.h | 158 +- .../core/css/properties/css_parsing_utils.cc | 87 +- .../core/css/properties/css_parsing_utils.h | 13 +- .../renderer/core/css/properties/css_property.cc | 6 +- .../renderer/core/css/properties/css_property.h | 28 +- .../core/css/properties/css_property_methods.json5 | 2 +- .../core/css/properties/css_property_ref.cc | 2 +- .../core/css/properties/css_property_ref.h | 4 +- .../core/css/properties/css_property_test.cc | 170 +- .../core/css/properties/css_unresolved_property.cc | 4 +- .../css/properties/longhands/custom_property.cc | 18 +- .../css/properties/longhands/custom_property.h | 4 - .../properties/longhands/custom_property_test.cc | 32 - .../css/properties/longhands/longhands_custom.cc | 1197 +++--- .../css/properties/shorthands/shorthands_custom.cc | 87 +- .../renderer/core/css/remote_font_face_source.cc | 28 +- .../core/css/resolver/cascade_expansion.cc | 4 +- .../core/css/resolver/cascade_interpolations.h | 4 +- .../css/resolver/cascade_interpolations_test.cc | 4 +- .../renderer/core/css/resolver/cascade_map.cc | 6 +- .../blink/renderer/core/css/resolver/cascade_map.h | 2 +- .../core/css/resolver/element_resolve_context.cc | 17 +- .../core/css/resolver/element_resolve_context.h | 4 - .../core/css/resolver/element_style_resources.cc | 160 +- .../core/css/resolver/element_style_resources.h | 16 +- .../core/css/resolver/filter_operation_resolver.cc | 8 +- .../core/css/resolver/filter_operation_resolver.h | 5 +- .../renderer/core/css/resolver/font_builder.cc | 28 +- .../renderer/core/css/resolver/font_builder.h | 13 +- .../renderer/core/css/resolver/match_result.cc | 1 + .../renderer/core/css/resolver/match_result.h | 5 + .../core/css/resolver/matched_properties_cache.cc | 75 +- .../core/css/resolver/matched_properties_cache.h | 17 +- .../css/resolver/matched_properties_cache_test.cc | 492 +-- .../core/css/resolver/scoped_style_resolver.cc | 207 +- .../core/css/resolver/scoped_style_resolver.h | 49 +- .../css/resolver/selector_filter_parent_scope.cc | 5 +- .../renderer/core/css/resolver/style_adjuster.cc | 55 +- .../renderer/core/css/resolver/style_adjuster.h | 3 +- .../core/css/resolver/style_adjuster_test.cc | 26 + .../renderer/core/css/resolver/style_builder.cc | 1 - .../core/css/resolver/style_builder_converter.cc | 42 +- .../core/css/resolver/style_builder_converter.h | 13 +- .../renderer/core/css/resolver/style_cascade.cc | 141 +- .../renderer/core/css/resolver/style_cascade.h | 14 - .../core/css/resolver/style_cascade_test.cc | 153 +- .../renderer/core/css/resolver/style_resolver.cc | 317 +- .../renderer/core/css/resolver/style_resolver.h | 19 +- .../core/css/resolver/style_resolver_state.cc | 20 +- .../core/css/resolver/style_resolver_state.h | 63 - .../core/css/resolver/style_resolver_state_test.cc | 66 - .../core/css/resolver/style_resolver_test.cc | 247 +- .../core/css/resolver/viewport_style_resolver.cc | 93 +- .../core/css/resolver/viewport_style_resolver.h | 12 +- .../blink/renderer/core/css/rule_feature_set.cc | 20 +- .../renderer/core/css/rule_feature_set_test.cc | 22 +- .../blink/renderer/core/css/rule_set.cc | 187 +- .../third_party/blink/renderer/core/css/rule_set.h | 99 +- .../blink/renderer/core/css/rule_set_test.cc | 104 +- .../blink/renderer/core/css/selector_checker.cc | 261 +- .../blink/renderer/core/css/selector_checker.h | 11 +- .../blink/renderer/core/css/selector_filter.cc | 26 +- .../blink/renderer/core/css/selector_query.cc | 78 +- .../blink/renderer/core/css/selector_query.h | 6 - .../blink/renderer/core/css/selector_query_test.cc | 23 +- .../blink/renderer/core/css/style_change_reason.cc | 2 + .../blink/renderer/core/css/style_change_reason.h | 2 + .../blink/renderer/core/css/style_color.cc | 11 +- .../blink/renderer/core/css/style_color.h | 10 +- .../blink/renderer/core/css/style_element.cc | 2 +- .../blink/renderer/core/css/style_engine.cc | 313 +- .../blink/renderer/core/css/style_engine.h | 68 +- .../blink/renderer/core/css/style_engine_test.cc | 652 ++- .../core/css/style_environment_variables.cc | 12 + .../core/css/style_environment_variables.h | 10 + .../core/css/style_environment_variables_test.cc | 3 +- .../renderer/core/css/style_invalidation_root.cc | 8 +- .../renderer/core/css/style_invalidation_root.h | 3 +- .../renderer/core/css/style_property_serializer.cc | 41 +- .../renderer/core/css/style_property_serializer.h | 2 +- .../blink/renderer/core/css/style_recalc.cc | 64 +- .../blink/renderer/core/css/style_recalc.h | 63 +- .../blink/renderer/core/css/style_recalc_root.cc | 47 +- .../blink/renderer/core/css/style_recalc_root.h | 3 +- .../blink/renderer/core/css/style_rule.cc | 70 +- .../blink/renderer/core/css/style_rule.h | 98 +- .../renderer/core/css/style_rule_counter_style.cc | 144 + .../renderer/core/css/style_rule_counter_style.h | 86 + .../blink/renderer/core/css/style_rule_import.cc | 11 +- .../renderer/core/css/style_sheet_collection.cc | 8 +- .../renderer/core/css/style_sheet_collection.h | 6 +- .../renderer/core/css/style_sheet_contents.cc | 4 +- .../blink/renderer/core/css/style_sheet_contents.h | 10 + .../renderer/core/css/style_traversal_root.cc | 10 +- .../blink/renderer/core/css/style_traversal_root.h | 25 +- .../renderer/core/css/style_traversal_root_test.cc | 32 +- .../third_party/blink/renderer/core/css/svg.css | 4 - .../core/css/tree_scope_style_sheet_collection.cc | 3 +- .../blink/renderer/core/css/view-source.css | 29 +- .../core/display_lock/display_lock_context.cc | 115 +- .../core/display_lock/display_lock_context.h | 27 + .../core/display_lock/display_lock_context_test.cc | 95 +- .../display_lock/display_lock_document_state.cc | 23 +- .../display_lock/display_lock_document_state.h | 8 + .../core/display_lock/display_lock_utilities.cc | 20 +- .../display_lock/display_lock_utilities_test.cc | 84 + .../blink/renderer/core/document_transition/DEPS | 3 + .../renderer/core/document_transition/README.md | 35 + .../renderer/core/document_transition/build.gni | 10 + .../document_transition/document_transition.cc | 170 + .../core/document_transition/document_transition.h | 76 + .../document_transition/document_transition.idl | 23 + .../document_transition_init.idl | 23 + .../document_transition_supplement.cc | 56 + .../document_transition_supplement.h | 41 + .../document_transition_supplement.idl | 10 + .../document_transition_test.cc | 259 ++ .../blink/renderer/core/dom/DIR_METADATA | 5 + .../third_party/blink/renderer/core/dom/OWNERS | 3 - .../blink/renderer/core/dom/abstract_range.cc | 12 + .../blink/renderer/core/dom/abstract_range.h | 31 + .../blink/renderer/core/dom/abstract_range.idl | 15 + .../blink/renderer/core/dom/aria_attributes.idl | 1 + .../third_party/blink/renderer/core/dom/attr.idl | 2 +- .../core/dom/beforeunload_event_listener.cc | 1 - .../core/dom/beforeunload_event_listener.h | 2 +- .../third_party/blink/renderer/core/dom/build.gni | 40 +- .../blink/renderer/core/dom/character_data.cc | 3 +- .../blink/renderer/core/dom/child_node.idl | 8 +- .../blink/renderer/core/dom/container_node.cc | 29 +- .../blink/renderer/core/dom/container_node.h | 19 +- .../blink/renderer/core/dom/create_element_flags.h | 27 +- .../blink/renderer/core/dom/distributed_nodes.cc | 74 - .../blink/renderer/core/dom/distributed_nodes.h | 76 - .../blink/renderer/core/dom/document.cc | 667 ++- .../third_party/blink/renderer/core/dom/document.h | 145 +- .../blink/renderer/core/dom/document.idl | 44 +- .../blink/renderer/core/dom/document_data.h | 3 +- .../blink/renderer/core/dom/document_fragment.h | 9 - .../blink/renderer/core/dom/document_init.cc | 60 +- .../blink/renderer/core/dom/document_init.h | 11 +- .../renderer/core/dom/document_or_shadow_root.h | 14 - .../blink/renderer/core/dom/document_test.cc | 76 +- .../blink/renderer/core/dom/dom_exception.h | 1 + .../blink/renderer/core/dom/dom_implementation.cc | 12 +- .../blink/renderer/core/dom/dom_token_list.cc | 4 - .../blink/renderer/core/dom/dom_token_list.h | 4 +- .../blink/renderer/core/dom/dom_token_list.idl | 8 +- .../blink/renderer/core/dom/element-hot.cc | 25 +- .../third_party/blink/renderer/core/dom/element.cc | 730 ++-- .../third_party/blink/renderer/core/dom/element.h | 111 +- .../blink/renderer/core/dom/element.idl | 29 +- .../blink/renderer/core/dom/element_data.h | 1 + .../blink/renderer/core/dom/element_rare_data.cc | 7 +- .../blink/renderer/core/dom/element_rare_data.h | 24 +- .../blink/renderer/core/dom/element_test.cc | 52 +- .../blink/renderer/core/dom/events/event.cc | 21 - .../blink/renderer/core/dom/events/event.h | 3 +- .../blink/renderer/core/dom/events/event.idl | 3 +- .../renderer/core/dom/events/event_dispatcher.cc | 84 +- .../renderer/core/dom/events/event_dispatcher.h | 2 - .../blink/renderer/core/dom/events/event_path.cc | 22 +- .../blink/renderer/core/dom/events/event_queue.h | 2 +- .../blink/renderer/core/dom/events/event_target.cc | 27 +- .../core/dom/events/simulated_click_options.h | 10 +- .../core/dom/events/tree_scope_event_context.cc | 2 +- .../core/dom/first_letter_pseudo_element.cc | 20 +- .../core/dom/first_letter_pseudo_element.h | 3 +- .../core/dom/first_letter_pseudo_element_test.cc | 19 +- .../blink/renderer/core/dom/flat_tree_node_data.h | 1 + .../blink/renderer/core/dom/flat_tree_traversal.cc | 111 +- .../blink/renderer/core/dom/flat_tree_traversal.h | 57 +- .../renderer/core/dom/flat_tree_traversal_test.cc | 145 +- .../blink/renderer/core/dom/focus_params.h | 1 + .../blink/renderer/core/dom/interest_cohort.idl | 10 + .../blink/renderer/core/dom/layout_tree_builder.cc | 2 - .../core/dom/layout_tree_builder_traversal.cc | 32 +- .../core/dom/layout_tree_builder_traversal.h | 24 +- .../blink/renderer/core/dom/named_node_map.idl | 8 +- .../third_party/blink/renderer/core/dom/node.cc | 344 +- .../third_party/blink/renderer/core/dom/node.h | 170 +- .../third_party/blink/renderer/core/dom/node.idl | 16 +- .../blink/renderer/core/dom/node_computed_style.h | 4 +- .../blink/renderer/core/dom/node_list.h | 11 + .../blink/renderer/core/dom/node_rare_data.h | 11 + .../blink/renderer/core/dom/node_test.cc | 74 +- .../blink/renderer/core/dom/node_traversal.cc | 4 +- .../blink/renderer/core/dom/node_traversal.h | 9 +- .../blink/renderer/core/dom/parent_node.idl | 6 +- .../core/dom/presentation_attribute_style.cc | 2 + .../renderer/core/dom/processing_instruction.cc | 8 +- .../blink/renderer/core/dom/pseudo_element.cc | 12 +- .../blink/renderer/core/dom/pseudo_element.h | 3 +- .../third_party/blink/renderer/core/dom/range.cc | 2 +- .../third_party/blink/renderer/core/dom/range.h | 13 +- .../third_party/blink/renderer/core/dom/range.idl | 19 +- .../core/dom/scripted_animation_controller.cc | 11 +- .../core/dom/scripted_animation_controller.h | 6 +- .../core/dom/scripted_idle_task_controller_test.cc | 4 + .../renderer/core/dom/set_inner_html_options.idl | 7 - .../blink/renderer/core/dom/shadow_dom_v0_test.cc | 192 - .../blink/renderer/core/dom/shadow_root.cc | 94 +- .../blink/renderer/core/dom/shadow_root.h | 68 +- .../blink/renderer/core/dom/shadow_root.idl | 7 +- .../blink/renderer/core/dom/shadow_root_v0.cc | 251 -- .../blink/renderer/core/dom/shadow_root_v0.h | 136 - .../blink/renderer/core/dom/slot_assignment.cc | 183 +- .../blink/renderer/core/dom/slot_assignment.h | 5 + .../renderer/core/dom/slot_assignment_test.cc | 5 +- .../blink/renderer/core/dom/static_range.cc | 22 + .../blink/renderer/core/dom/static_range.h | 17 +- .../blink/renderer/core/dom/static_range.idl | 13 +- .../blink/renderer/core/dom/static_range_init.idl | 12 + .../core/dom/synchronous_mutation_observer.h | 1 + .../third_party/blink/renderer/core/dom/text.cc | 17 +- .../blink/renderer/core/dom/text_link_colors.cc | 10 +- .../blink/renderer/core/dom/text_link_colors.h | 12 +- .../blink/renderer/core/dom/text_test.cc | 17 + .../blink/renderer/core/dom/tree_ordered_map.cc | 3 + .../blink/renderer/core/dom/tree_ordered_map.h | 12 +- .../renderer/core/dom/tree_ordered_map_test.cc | 143 + .../blink/renderer/core/dom/tree_scope.cc | 11 +- .../blink/renderer/core/dom/tree_scope.h | 3 +- .../blink/renderer/core/dom/tree_scope_adopter.cc | 6 +- .../renderer/core/dom/tree_scope_adopter_test.cc | 102 - .../blink/renderer/core/dom/tree_scope_test.cc | 103 +- .../blink/renderer/core/dom/v0_insertion_point.cc | 302 -- .../blink/renderer/core/dom/v0_insertion_point.h | 139 - .../blink/renderer/core/dom/whitespace_attacher.h | 1 + .../renderer/core/dom/whitespace_attacher_test.cc | 1 + .../blink/renderer/core/editing/DIR_METADATA | 5 + .../third_party/blink/renderer/core/editing/OWNERS | 6 - .../blink/renderer/core/editing/build.gni | 8 +- .../core/editing/caret_display_item_client.cc | 17 + .../core/editing/caret_display_item_client.h | 2 + .../commands/apply_block_element_command.cc | 15 + .../commands/apply_block_element_command_test.cc | 53 +- .../core/editing/commands/apply_style_command.cc | 57 +- .../editing/commands/apply_style_command_test.cc | 31 + .../editing/commands/composite_edit_command.cc | 25 +- .../commands/composite_edit_command_test.cc | 53 + .../editing/commands/delete_selection_command.cc | 28 +- .../commands/delete_selection_command_test.cc | 24 + .../editing/commands/editing_commands_utilities.cc | 2 +- .../core/editing/commands/editor_command.cc | 10 +- .../editing/commands/indent_outdent_command.cc | 107 +- .../core/editing/commands/insert_commands.cc | 43 +- .../core/editing/commands/insert_list_command.h | 1 + .../editing/commands/insert_node_before_command.cc | 8 +- .../core/editing/commands/insert_text_command.cc | 16 + .../editing/commands/insert_text_command_test.cc | 5 +- .../core/editing/commands/move_commands_test.cc | 12 +- .../editing/commands/remove_css_property_command.h | 3 +- .../editing/commands/replace_selection_command.cc | 13 +- .../commands/replace_selection_command_test.cc | 21 + .../editing/commands/selection_for_undo_step.cc | 2 + .../editing/commands/selection_for_undo_step.h | 6 +- .../core/editing/commands/typing_command.cc | 168 +- .../core/editing/commands/typing_command.h | 1 + .../renderer/core/editing/commands/undo_step.cc | 8 - .../renderer/core/editing/commands/undo_step.h | 6 +- .../blink/renderer/core/editing/editing_behavior.h | 4 +- .../renderer/core/editing/editing_strategy.cc | 8 +- .../renderer/core/editing/editing_strategy_test.cc | 6 +- .../blink/renderer/core/editing/editing_style.cc | 131 +- .../blink/renderer/core/editing/editing_style.h | 7 + .../renderer/core/editing/editing_style_test.cc | 26 + .../renderer/core/editing/editing_utilities.cc | 96 +- .../renderer/core/editing/editing_utilities.h | 20 +- .../core/editing/editing_utilities_test.cc | 106 +- .../blink/renderer/core/editing/editor.cc | 2 +- .../blink/renderer/core/editing/editor.h | 1 + .../renderer/core/editing/editor_key_bindings.cc | 23 +- .../renderer/core/editing/element_inner_text.cc | 14 + .../core/editing/element_inner_text_test.cc | 8 + .../blink/renderer/core/editing/ephemeral_range.cc | 12 +- .../renderer/core/editing/ephemeral_range_test.cc | 54 +- .../core/editing/finder/async_find_buffer.cc | 81 + .../core/editing/finder/async_find_buffer.h | 52 + .../renderer/core/editing/finder/find_buffer.cc | 145 +- .../renderer/core/editing/finder/find_buffer.h | 15 +- .../core/editing/finder/find_buffer_runner.h | 30 + .../core/editing/finder/find_buffer_test.cc | 129 + .../core/editing/finder/sync_find_buffer.cc | 24 + .../core/editing/finder/sync_find_buffer.h | 31 + .../renderer/core/editing/finder/text_finder.cc | 50 +- .../renderer/core/editing/finder/text_finder.h | 7 +- .../core/editing/finder/text_finder_test.cc | 83 +- .../blink/renderer/core/editing/frame_caret.cc | 22 +- .../blink/renderer/core/editing/frame_caret.h | 3 +- .../renderer/core/editing/frame_caret_test.cc | 3 +- .../blink/renderer/core/editing/frame_selection.cc | 52 +- .../blink/renderer/core/editing/frame_selection.h | 7 + .../renderer/core/editing/frame_selection_test.cc | 2 +- .../core/editing/ime/cached_text_input_info.cc | 38 +- .../renderer/core/editing/ime/edit_context.cc | 31 +- .../blink/renderer/core/editing/ime/edit_context.h | 14 +- .../core/editing/ime/input_method_controller.cc | 28 +- .../core/editing/ime/input_method_controller.h | 9 +- .../editing/ime/input_method_controller_test.cc | 71 + .../renderer/core/editing/inline_box_position.cc | 35 +- .../renderer/core/editing/inline_box_position.h | 2 - .../core/editing/inline_box_position_test.cc | 28 +- .../simplified_backwards_text_iterator_test.cc | 10 +- .../core/editing/iterators/text_iterator.cc | 6 +- .../core/editing/iterators/text_iterator.h | 5 +- .../core/editing/iterators/text_iterator_test.cc | 49 +- .../iterators/text_iterator_text_node_handler.cc | 22 +- .../iterators/text_iterator_text_node_handler.h | 4 + .../editing/iterators/text_iterator_text_state.h | 1 + .../renderer/core/editing/layout_selection.cc | 98 +- .../blink/renderer/core/editing/layout_selection.h | 24 + .../renderer/core/editing/layout_selection_test.cc | 172 + .../renderer/core/editing/local_caret_rect.cc | 56 +- .../renderer/core/editing/local_caret_rect_test.cc | 91 +- .../editing/markers/text_match_marker_list_impl.h | 1 + .../core/editing/ng_flat_tree_shorthands.cc | 10 - .../core/editing/ng_flat_tree_shorthands.h | 5 - .../blink/renderer/core/editing/position.cc | 65 +- .../blink/renderer/core/editing/position.h | 7 +- .../blink/renderer/core/editing/position_test.cc | 73 +- .../renderer/core/editing/range_in_flat_tree.cc | 56 + .../renderer/core/editing/range_in_flat_tree.h | 45 + .../renderer/core/editing/relocatable_position.cc | 14 +- .../renderer/core/editing/relocatable_position.h | 13 +- .../blink/renderer/core/editing/selection.idl | 2 +- .../renderer/core/editing/selection_adjuster.cc | 29 +- .../core/editing/selection_adjuster_test.cc | 19 + .../renderer/core/editing/selection_controller.cc | 42 +- .../renderer/core/editing/selection_controller.h | 2 +- .../core/editing/selection_controller_test.cc | 110 +- .../renderer/core/editing/selection_editor.cc | 1 - .../renderer/core/editing/selection_modifier.cc | 372 +- .../renderer/core/editing/selection_modifier.h | 71 +- .../core/editing/selection_modifier_line.cc | 230 +- .../core/editing/selection_modifier_test.cc | 164 + .../renderer/core/editing/selection_template.cc | 11 +- .../renderer/core/editing/selection_template.h | 4 - .../core/editing/selection_template_test.cc | 31 + .../blink/renderer/core/editing/selection_type.h | 35 - .../core/editing/serializers/markup_accumulator.cc | 1 - .../core/editing/serializers/markup_formatter.cc | 34 +- .../core/editing/serializers/serialization.cc | 24 +- .../core/editing/serializers/serialization.h | 2 +- .../core/editing/serializers/serialization_test.cc | 74 +- .../serializers/styled_markup_serializer.cc | 13 - .../serializers/styled_markup_serializer_test.cc | 89 +- .../spellcheck/idle_spell_check_controller.h | 2 +- .../core/editing/spellcheck/spell_checker.cc | 22 +- .../core/editing/spellcheck/spell_checker.h | 2 + .../editing/state_machines/state_machine_util.cc | 7 - .../state_machines/state_machine_util_test.cc | 6 - .../blink/renderer/core/editing/substring_util.h | 6 +- .../blink/renderer/core/editing/substring_util.mm | 11 +- .../renderer/core/editing/substring_util_test.mm | 10 +- .../core/editing/testing/editing_test_base.cc | 2 +- .../core/editing/testing/editing_test_base.h | 1 + .../core/editing/testing/selection_sample.cc | 2 +- .../core/editing/testing/selection_sample_test.cc | 17 +- .../renderer/core/editing/text_offset_mapping.cc | 16 +- .../core/editing/text_offset_mapping_test.cc | 43 +- .../renderer/core/editing/visible_position.cc | 58 +- .../renderer/core/editing/visible_position_test.cc | 178 +- .../renderer/core/editing/visible_selection.cc | 75 +- .../renderer/core/editing/visible_selection.h | 21 +- .../core/editing/visible_selection_test.cc | 113 +- .../blink/renderer/core/editing/visible_units.cc | 308 +- .../blink/renderer/core/editing/visible_units.h | 54 +- .../renderer/core/editing/visible_units_line.cc | 42 +- .../core/editing/visible_units_line_test.cc | 295 +- .../core/editing/visible_units_paragraph.cc | 98 +- .../core/editing/visible_units_paragraph_test.cc | 109 +- .../core/editing/visible_units_sentence.cc | 37 +- .../core/editing/visible_units_sentence_test.cc | 128 +- .../renderer/core/editing/visible_units_test.cc | 263 +- .../renderer/core/editing/visible_units_word.cc | 27 +- .../core/editing/visible_units_word_test.cc | 99 +- .../blink/renderer/core/events/build.gni | 2 + .../renderer/core/events/current_input_event.h | 2 +- .../renderer/core/events/event_target_names.json5 | 1 + .../renderer/core/events/event_type_names.json5 | 11 +- .../blink/renderer/core/events/event_util.cc | 2 +- .../blink/renderer/core/events/hash_change_event.h | 1 + .../blink/renderer/core/events/message_event.cc | 10 +- .../blink/renderer/core/events/message_event.h | 13 +- .../blink/renderer/core/events/mouse_event.cc | 62 +- .../blink/renderer/core/events/mouse_event.h | 38 +- .../blink/renderer/core/events/mouse_event_test.cc | 98 + .../blink/renderer/core/events/pointer_event.cc | 58 +- .../blink/renderer/core/events/pointer_event.h | 48 +- .../blink/renderer/core/events/pointer_event.idl | 4 +- .../renderer/core/events/pointer_event_init.idl | 4 +- .../renderer/core/events/pointer_event_util.h | 4 +- .../renderer/core/events/promise_rejection_event.h | 3 +- .../renderer/core/events/simulated_event_util.cc | 207 + .../renderer/core/events/simulated_event_util.h | 28 + .../blink/renderer/core/events/wheel_event.cc | 13 +- .../blink/renderer/core/execution_context/DEPS | 7 + .../renderer/core/execution_context/DIR_METADATA | 5 + .../blink/renderer/core/execution_context/OWNERS | 3 - .../blink/renderer/core/execution_context/agent.cc | 19 +- .../blink/renderer/core/execution_context/agent.h | 30 +- .../execution_context/agent_metrics_collector.cc | 179 - .../execution_context/agent_metrics_collector.h | 88 - .../agent_metrics_collector_test.cc | 181 - .../renderer/core/execution_context/build.gni | 3 +- .../core/execution_context/execution_context.cc | 160 +- .../core/execution_context/execution_context.h | 81 +- .../execution_context_lifecycle_state_observer.h | 2 +- .../core/execution_context/navigator_base.h | 78 + .../execution_context/remote_security_context.cc | 22 +- .../execution_context/remote_security_context.h | 13 +- .../core/execution_context/security_context.cc | 10 +- .../core/execution_context/security_context.h | 5 +- .../execution_context/security_context_init.cc | 63 +- .../core/execution_context/security_context_init.h | 14 + .../core/execution_context/window_agent_factory.cc | 16 +- .../core/execution_context/window_agent_factory.h | 15 +- .../blink/renderer/core/exported/BUILD.gn | 16 + .../core/exported/test_web_frame_content_dumper.cc | 67 + .../renderer/core/exported/web_content_holder.cc | 4 +- .../core/exported/web_dev_tools_agent_impl.cc | 19 +- .../core/exported/web_dev_tools_agent_impl.h | 1 + .../core/exported/web_document_loader_impl.cc | 17 +- .../core/exported/web_document_loader_impl.h | 7 +- .../web_document_subresource_filter_test.cc | 9 +- .../core/exported/web_dom_message_event.cc | 2 +- .../blink/renderer/core/exported/web_element.cc | 23 +- .../renderer/core/exported/web_element_test.cc | 10 - .../exported/web_form_element_observer_impl.cc | 6 +- .../core/exported/web_form_element_observer_impl.h | 4 +- .../core/exported/web_frame_content_dumper.cc | 140 +- .../web_frame_serializer_sanitization_test.cc | 11 +- .../blink/renderer/core/exported/web_heap.cc | 8 - .../exported/web_input_method_controller_impl.cc | 16 +- .../exported/web_input_method_controller_impl.h | 6 +- .../core/exported/web_isolated_world_info.cc | 6 + .../core/exported/web_navigation_params.cc | 13 +- .../blink/renderer/core/exported/web_node.cc | 9 +- .../renderer/core/exported/web_page_popup_impl.cc | 154 +- .../renderer/core/exported/web_page_popup_impl.h | 20 +- .../renderer/core/exported/web_performance.cc | 16 + .../core/exported/web_plugin_container_impl.cc | 21 +- .../core/exported/web_plugin_container_impl.h | 8 +- .../core/exported/web_plugin_container_test.cc | 152 +- .../renderer/core/exported/web_security_policy.cc | 9 +- .../renderer/core/exported/web_settings_impl.cc | 19 +- .../renderer/core/exported/web_settings_impl.h | 6 +- .../core/exported/web_shared_worker_impl.cc | 38 +- .../core/exported/web_shared_worker_impl.h | 9 +- .../blink/renderer/core/exported/web_view_impl.cc | 444 +- .../blink/renderer/core/exported/web_view_impl.h | 117 +- .../renderer/core/exported/web_view_observer.cc | 43 + .../blink/renderer/core/exported/web_view_test.cc | 386 +- .../blink/renderer/core/feature_policy/README.md | 18 +- .../blink/renderer/core/feature_policy/build.gni | 2 + .../core/feature_policy/document_policy.dict | 3 +- .../feature_policy/document_policy_features.json5 | 66 +- .../feature_policy/document_policy_sim_test.cc | 457 +++ .../core/feature_policy/dom_feature_policy.cc | 30 +- .../core/feature_policy/dom_feature_policy.h | 2 + .../core/feature_policy/feature_policy.dict | 1 + .../feature_policy_devtools_support.cc | 78 + .../feature_policy_devtools_support.h | 40 + .../feature_policy_devtools_support_test.cc | 297 ++ .../feature_policy/feature_policy_features.json5 | 70 +- .../core/feature_policy/feature_policy_parser.cc | 21 +- .../core/feature_policy/feature_policy_test.cc | 75 +- .../renderer/core/feature_policy/iframe_policy.h | 2 + .../renderer/core/feature_policy/policy_helper.h | 9 + .../third_party/blink/renderer/core/fetch/DEPS | 1 + .../blink/renderer/core/fetch/DIR_METADATA | 5 + .../third_party/blink/renderer/core/fetch/OWNERS | 3 - .../renderer/core/fetch/blob_bytes_consumer.cc | 2 +- .../renderer/core/fetch/body_stream_buffer.cc | 47 +- .../blink/renderer/core/fetch/body_stream_buffer.h | 19 +- .../renderer/core/fetch/body_stream_buffer_test.cc | 158 +- .../renderer/core/fetch/bytes_uploader_test.cc | 2 +- .../blink/renderer/core/fetch/fetch_data_loader.cc | 2 +- .../renderer/core/fetch/fetch_data_loader_test.cc | 4 +- .../blink/renderer/core/fetch/fetch_header_list.h | 2 +- .../blink/renderer/core/fetch/fetch_manager.cc | 318 +- .../renderer/core/fetch/fetch_request_data.cc | 47 +- .../blink/renderer/core/fetch/fetch_request_data.h | 4 - .../renderer/core/fetch/fetch_response_data.cc | 50 +- .../renderer/core/fetch/fetch_response_data.h | 15 +- .../core/fetch/fetch_response_data_test.cc | 17 +- .../core/fetch/form_data_bytes_consumer.cc | 7 +- .../core/fetch/place_holder_bytes_consumer_test.cc | 2 +- .../core/fetch/readable_stream_bytes_consumer.cc | 29 +- .../core/fetch/readable_stream_bytes_consumer.h | 1 + .../fetch/readable_stream_bytes_consumer_test.cc | 103 + .../blink/renderer/core/fetch/request.cc | 37 +- .../blink/renderer/core/fetch/response.cc | 37 +- .../blink/renderer/core/fetch/response_test.cc | 6 +- .../core/fetch/testing/worker_internals_fetch.cc | 4 +- .../renderer/core/fetch/trust_token_to_mojom.cc | 7 + .../blink/renderer/core/fileapi/DIR_METADATA | 5 + .../third_party/blink/renderer/core/fileapi/OWNERS | 3 - .../blink/renderer/core/fileapi/blob.cc | 5 +- .../blink/renderer/core/fileapi/file_reader.cc | 14 +- .../renderer/core/fileapi/file_reader_loader.cc | 2 +- .../core/fileapi/public_url_manager_test.cc | 3 + .../third_party/blink/renderer/core/frame/DEPS | 13 +- .../blink/renderer/core/frame/DIR_METADATA | 5 + .../third_party/blink/renderer/core/frame/OWNERS | 3 - .../blink/renderer/core/frame/ad_tracker.cc | 49 +- .../blink/renderer/core/frame/ad_tracker.h | 16 +- .../blink/renderer/core/frame/ad_tracker_test.cc | 234 +- .../renderer/core/frame/browser_controls_test.cc | 50 +- .../blink/renderer/core/frame/build.gni | 19 +- .../core/frame/coop_access_violation_report_body.h | 3 +- .../third_party/blink/renderer/core/frame/csp/DEPS | 5 + .../core/frame/csp/content_security_policy.cc | 903 ++-- .../core/frame/csp/content_security_policy.h | 198 +- .../frame/csp/content_security_policy_fuzzer.cc | 26 +- .../core/frame/csp/content_security_policy_test.cc | 796 ++-- .../renderer/core/frame/csp/conversion_util.cc | 191 + .../renderer/core/frame/csp/conversion_util.h | 37 + .../core/frame/csp/conversion_util_fuzzer.cc | 77 + .../core/frame/csp/conversion_util_test.cc | 165 + .../blink/renderer/core/frame/csp/csp_directive.h | 41 - .../renderer/core/frame/csp/csp_directive_list.cc | 1982 ++++----- .../renderer/core/frame/csp/csp_directive_list.h | 467 +-- .../core/frame/csp/csp_directive_list_test.cc | 792 +--- .../blink/renderer/core/frame/csp/csp_source.cc | 364 +- .../blink/renderer/core/frame/csp/csp_source.h | 110 +- .../renderer/core/frame/csp/csp_source_test.cc | 1261 ++---- .../frame/csp/execution_context_csp_delegate.cc | 5 +- .../core/frame/csp/media_list_directive.cc | 125 - .../renderer/core/frame/csp/media_list_directive.h | 46 - .../core/frame/csp/media_list_directive_test.cc | 153 - .../csp/require_trusted_types_for_directive.cc | 28 +- .../csp/require_trusted_types_for_directive.h | 22 +- .../require_trusted_types_for_directive_test.cc | 29 +- .../core/frame/csp/source_list_directive.cc | 933 ++--- .../core/frame/csp/source_list_directive.h | 171 +- .../core/frame/csp/source_list_directive_test.cc | 1478 ++----- .../core/frame/csp/string_list_directive.cc | 84 - .../core/frame/csp/string_list_directive.h | 41 - .../core/frame/csp/string_list_directive_test.cc | 70 - .../core/frame/csp/trusted_types_directive.cc | 96 + .../core/frame/csp/trusted_types_directive.h | 28 + .../core/frame/csp/trusted_types_directive_test.cc | 99 + .../blink/renderer/core/frame/deprecation.cc | 143 +- .../blink/renderer/core/frame/deprecation.h | 2 +- .../core/frame/document_loading_rendering_test.cc | 7 +- .../blink/renderer/core/frame/dom_window.cc | 58 +- .../blink/renderer/core/frame/dom_window.h | 6 +- .../frame/feature_policy_violation_report_body.h | 2 +- .../blink/renderer/core/frame/find_in_page.cc | 7 +- .../blink/renderer/core/frame/find_in_page.h | 2 +- .../third_party/blink/renderer/core/frame/frame.cc | 157 +- .../third_party/blink/renderer/core/frame/frame.h | 99 +- .../blink/renderer/core/frame/frame_console.cc | 10 +- .../renderer/core/frame/frame_content_as_text.cc | 76 + .../renderer/core/frame/frame_content_as_text.h | 25 + .../core/frame/frame_content_as_text_test.cc | 53 + .../blink/renderer/core/frame/frame_overlay.cc | 8 + .../blink/renderer/core/frame/frame_overlay.h | 1 + .../blink/renderer/core/frame/frame_owner.h | 6 +- .../blink/renderer/core/frame/frame_serializer.cc | 6 +- .../blink/renderer/core/frame/frame_serializer.h | 3 +- .../core/frame/frame_serializer_delegate_impl.cc | 6 +- .../blink/renderer/core/frame/frame_test.cc | 3 +- .../renderer/core/frame/frame_test_helpers.cc | 533 +-- .../blink/renderer/core/frame/frame_test_helpers.h | 271 +- .../blink/renderer/core/frame/frame_view.cc | 22 +- .../blink/renderer/core/frame/frame_view.h | 12 +- .../renderer/core/frame/fullscreen_controller.cc | 59 +- .../renderer/core/frame/fullscreen_controller.h | 6 +- .../blink/renderer/core/frame/history.cc | 5 +- .../renderer/core/frame/impression_params.idl | 11 + .../blink/renderer/core/frame/intervention.cc | 2 +- .../blink/renderer/core/frame/intervention.h | 2 +- .../blink/renderer/core/frame/local_dom_window.cc | 213 +- .../blink/renderer/core/frame/local_dom_window.h | 44 +- .../renderer/core/frame/local_dom_window_test.cc | 128 +- .../blink/renderer/core/frame/local_frame.cc | 433 +- .../blink/renderer/core/frame/local_frame.h | 124 +- .../frame/local_frame_back_forward_cache_test.cc | 3 +- .../blink/renderer/core/frame/local_frame_client.h | 40 +- .../renderer/core/frame/local_frame_client_impl.cc | 244 +- .../renderer/core/frame/local_frame_client_impl.h | 29 +- .../core/frame/local_frame_ukm_aggregator.cc | 187 +- .../core/frame/local_frame_ukm_aggregator.h | 42 +- .../core/frame/local_frame_ukm_aggregator_test.cc | 198 +- .../blink/renderer/core/frame/local_frame_view.cc | 664 +-- .../blink/renderer/core/frame/local_frame_view.h | 44 +- .../renderer/core/frame/local_frame_view_test.cc | 40 +- .../renderer/core/frame/mhtml_archive_test.cc | 4 +- .../renderer/core/frame/navigation_rate_limiter.h | 2 +- .../blink/renderer/core/frame/navigator.cc | 32 +- .../blink/renderer/core/frame/navigator.h | 27 +- .../frame/navigator_automation_information.idl | 6 +- .../blink/renderer/core/frame/navigator_id.cc | 14 +- .../frame/navigator_window_controls_overlay.idl | 12 + .../core/frame/overlay_interstitial_ad_detector.cc | 14 +- .../core/frame/overlay_interstitial_ad_detector.h | 2 - .../renderer/core/frame/pausable_script_executor.h | 2 +- .../blink/renderer/core/frame/policy_container.cc | 38 +- .../blink/renderer/core/frame/policy_container.h | 19 +- .../renderer/core/frame/policy_container_test.cc | 19 +- .../blink/renderer/core/frame/remote_frame.cc | 361 +- .../blink/renderer/core/frame/remote_frame.h | 77 +- .../renderer/core/frame/remote_frame_client.h | 59 +- .../core/frame/remote_frame_client_impl.cc | 69 +- .../renderer/core/frame/remote_frame_client_impl.h | 39 +- .../renderer/core/frame/remote_frame_owner.cc | 3 +- .../blink/renderer/core/frame/remote_frame_owner.h | 9 +- .../blink/renderer/core/frame/remote_frame_view.cc | 81 +- .../blink/renderer/core/frame/remote_frame_view.h | 4 + .../blink/renderer/core/frame/reporting_context.cc | 4 +- .../renderer/core/frame/reporting_context_test.cc | 13 +- .../renderer/core/frame/resize_viewport_anchor.cc | 7 - .../renderer/core/frame/root_frame_viewport.cc | 28 +- .../core/frame/root_frame_viewport_test.cc | 3 +- .../blink/renderer/core/frame/sandbox_flags.cc | 96 - .../blink/renderer/core/frame/sandbox_flags.h | 61 - .../blink/renderer/core/frame/savable_resources.cc | 5 +- .../blink/renderer/core/frame/screen.cc | 68 +- .../third_party/blink/renderer/core/frame/screen.h | 17 +- .../blink/renderer/core/frame/screen.idl | 8 +- .../renderer/core/frame/screen_metrics_emulator.cc | 39 +- .../renderer/core/frame/screen_metrics_emulator.h | 16 +- .../blink/renderer/core/frame/settings.cc | 64 +- .../blink/renderer/core/frame/settings.h | 18 +- .../blink/renderer/core/frame/settings.json5 | 129 +- .../blink/renderer/core/frame/settings_delegate.h | 47 +- .../renderer/core/frame/sticky_ad_detector.cc | 5 + .../renderer/core/frame/use_counter_helper.cc | 2 +- .../renderer/core/frame/use_counter_helper_test.cc | 14 +- .../blink/renderer/core/frame/visual_viewport.cc | 127 +- .../blink/renderer/core/frame/visual_viewport.h | 2 +- .../renderer/core/frame/visual_viewport_test.cc | 81 +- .../blink/renderer/core/frame/web_frame.cc | 24 +- .../core/frame/web_frame_serializer_impl.cc | 2 +- .../blink/renderer/core/frame/web_frame_test.cc | 1940 +++++---- .../renderer/core/frame/web_frame_widget_base.cc | 2954 ------------- .../renderer/core/frame/web_frame_widget_base.h | 824 ---- .../renderer/core/frame/web_frame_widget_impl.cc | 4323 +++++++++++++++++--- .../renderer/core/frame/web_frame_widget_impl.h | 1050 ++++- .../renderer/core/frame/web_frame_widget_test.cc | 164 +- .../core/frame/web_local_frame_client_test.cc | 17 +- .../renderer/core/frame/web_local_frame_impl.cc | 533 ++- .../renderer/core/frame/web_local_frame_impl.h | 126 +- .../renderer/core/frame/web_remote_frame_impl.cc | 121 +- .../renderer/core/frame/web_remote_frame_impl.h | 44 +- .../renderer/core/frame/web_view_frame_widget.cc | 764 ---- .../renderer/core/frame/web_view_frame_widget.h | 227 - .../blink/renderer/core/frame/window.idl | 19 +- .../renderer/core/frame/window_controls_overlay.cc | 65 + .../renderer/core/frame/window_controls_overlay.h | 44 + .../core/frame/window_controls_overlay.idl | 13 + .../core/frame/window_or_worker_global_scope.cc | 25 - .../core/frame/window_or_worker_global_scope.h | 24 +- .../core/frame/window_or_worker_global_scope.idl | 16 - .../core/frame/window_post_message_options.idl | 1 + .../blink/renderer/core/fullscreen/DIR_METADATA | 3 + .../blink/renderer/core/fullscreen/OWNERS | 2 - .../blink/renderer/core/fullscreen/fullscreen.cc | 116 +- .../blink/renderer/core/fullscreen/fullscreen.h | 6 +- .../blink/renderer/core/geometry/dom_matrix.cc | 14 +- .../renderer/core/geometry/dom_matrix_read_only.cc | 12 +- .../blink/renderer/core/geometry/dom_quad.cc | 2 +- .../blink/renderer/core/geometry/dom_rect.h | 1 - .../blink/renderer/core/html/DIR_METADATA | 5 + .../third_party/blink/renderer/core/html/OWNERS | 2 - .../blink/renderer/core/html/aria_properties.json5 | 6 + .../blink/renderer/core/html/battery_savings.h | 24 + .../third_party/blink/renderer/core/html/build.gni | 57 +- .../blink/renderer/core/html/canvas/DIR_METADATA | 5 + .../blink/renderer/core/html/canvas/OWNERS | 3 - .../core/html/canvas/canvas_async_blob_creator.cc | 30 +- .../core/html/canvas/canvas_image_source.h | 1 + .../core/html/canvas/canvas_rendering_context.cc | 64 +- .../core/html/canvas/canvas_rendering_context.h | 19 +- .../html/canvas/canvas_rendering_context_host.cc | 30 +- .../core/html/canvas/html_canvas_element.cc | 124 +- .../core/html/canvas/html_canvas_element.h | 11 +- .../blink/renderer/core/html/canvas/image_data.cc | 835 +--- .../blink/renderer/core/html/canvas/image_data.h | 205 +- .../blink/renderer/core/html/canvas/image_data.idl | 8 +- .../core/html/canvas/image_data_color_settings.idl | 22 - .../core/html/canvas/image_data_settings.idl | 22 + .../renderer/core/html/canvas/image_data_test.cc | 495 --- .../core/html/canvas/image_element_base.cc | 36 +- .../renderer/core/html/canvas/image_element_base.h | 5 - .../core/html/conversion_measurement_parsing.cc | 148 + .../core/html/conversion_measurement_parsing.h | 35 + .../renderer/core/html/custom/custom_element.cc | 33 +- .../html/custom/custom_element_definition_test.cc | 14 +- .../html/custom/custom_element_reaction_queue.cc | 5 +- .../custom/custom_element_reaction_queue_test.cc | 80 +- .../custom/custom_element_reaction_stack_test.cc | 143 +- .../custom/custom_element_reaction_test_helpers.h | 8 +- .../core/html/custom/custom_element_registry.cc | 27 +- .../core/html/custom/custom_element_registry.h | 9 - .../core/html/custom/custom_element_registry.idl | 2 +- .../core/html/custom/custom_element_test.cc | 24 +- .../renderer/core/html/custom/custom_state_set.cc | 123 + .../renderer/core/html/custom/custom_state_set.h | 47 + .../renderer/core/html/custom/custom_state_set.idl | 13 + .../renderer/core/html/custom/element_internals.cc | 22 +- .../renderer/core/html/custom/element_internals.h | 6 +- .../core/html/custom/element_internals.idl | 5 +- .../renderer/core/html/custom/v0_custom_element.cc | 150 - .../renderer/core/html/custom/v0_custom_element.h | 73 - ..._custom_element_async_import_microtask_queue.cc | 53 - ...0_custom_element_async_import_microtask_queue.h | 51 - .../v0_custom_element_callback_invocation.cc | 153 - .../custom/v0_custom_element_callback_invocation.h | 69 - .../custom/v0_custom_element_callback_queue.cc | 76 - .../html/custom/v0_custom_element_callback_queue.h | 80 - .../html/custom/v0_custom_element_definition.cc | 44 - .../html/custom/v0_custom_element_definition.h | 59 - .../html/custom/v0_custom_element_descriptor.h | 93 - .../custom/v0_custom_element_descriptor_hash.h | 82 - .../html/custom/v0_custom_element_exception.cc | 116 - .../core/html/custom/v0_custom_element_exception.h | 67 - .../custom/v0_custom_element_lifecycle_callbacks.h | 76 - .../v0_custom_element_microtask_dispatcher.cc | 83 - .../v0_custom_element_microtask_dispatcher.h | 46 - .../v0_custom_element_microtask_import_step.cc | 88 - .../v0_custom_element_microtask_import_step.h | 76 - .../v0_custom_element_microtask_queue_base.cc | 33 - .../v0_custom_element_microtask_queue_base.h | 41 - .../v0_custom_element_microtask_resolution_step.cc | 66 - .../v0_custom_element_microtask_resolution_step.h | 67 - .../v0_custom_element_microtask_run_queue.cc | 61 - .../custom/v0_custom_element_microtask_run_queue.h | 40 - .../html/custom/v0_custom_element_microtask_step.h | 60 - .../core/html/custom/v0_custom_element_observer.cc | 67 - .../core/html/custom/v0_custom_element_observer.h | 62 - .../custom/v0_custom_element_processing_stack.cc | 99 - .../custom/v0_custom_element_processing_stack.h | 109 - .../custom/v0_custom_element_processing_step.h | 55 - .../v0_custom_element_registration_context.cc | 186 - .../v0_custom_element_registration_context.h | 85 - .../core/html/custom/v0_custom_element_registry.cc | 149 - .../core/html/custom/v0_custom_element_registry.h | 88 - .../html/custom/v0_custom_element_scheduler.cc | 169 - .../core/html/custom/v0_custom_element_scheduler.h | 79 - .../v0_custom_element_sync_microtask_queue.cc | 25 - .../v0_custom_element_sync_microtask_queue.h | 25 - .../v0_custom_element_upgrade_candidate_map.cc | 94 - .../v0_custom_element_upgrade_candidate_map.h | 74 - .../blink/renderer/core/html/forms/DIR_METADATA | 5 + .../blink/renderer/core/html/forms/OWNERS | 3 - .../core/html/forms/base_checkable_input_type.cc | 14 +- .../core/html/forms/base_checkable_input_type.h | 5 +- .../core/html/forms/base_text_input_type.cc | 17 +- .../core/html/forms/base_text_input_type.h | 5 +- .../core/html/forms/date_time_edit_element.cc | 11 +- .../core/html/forms/date_time_edit_element.h | 3 +- .../renderer/core/html/forms/email_input_type.cc | 6 +- .../renderer/core/html/forms/email_input_type.h | 2 +- .../core/html/forms/email_input_type_test.cc | 6 +- .../core/html/forms/external_popup_menu.cc | 3 +- .../renderer/core/html/forms/external_popup_menu.h | 2 +- .../renderer/core/html/forms/hidden_input_type.cc | 3 +- .../renderer/core/html/forms/hidden_input_type.h | 3 +- .../core/html/forms/html_button_element.cc | 8 +- .../renderer/core/html/forms/html_button_element.h | 3 +- .../core/html/forms/html_field_set_element.cc | 4 - .../core/html/forms/html_field_set_element.h | 1 - .../renderer/core/html/forms/html_form_element.idl | 8 +- .../renderer/core/html/forms/html_input_element.cc | 35 +- .../renderer/core/html/forms/html_input_element.h | 6 +- .../core/html/forms/html_input_element.idl | 28 +- .../renderer/core/html/forms/html_label_element.cc | 8 +- .../renderer/core/html/forms/html_label_element.h | 3 +- .../core/html/forms/html_opt_group_element.cc | 13 +- .../core/html/forms/html_opt_group_element.h | 6 +- .../core/html/forms/html_option_element.cc | 4 +- .../renderer/core/html/forms/html_option_element.h | 6 +- .../core/html/forms/html_select_element.cc | 14 +- .../renderer/core/html/forms/html_select_element.h | 3 +- .../core/html/forms/html_select_menu_element.cc | 348 ++ .../core/html/forms/html_select_menu_element.h | 107 + .../core/html/forms/html_select_menu_element.idl | 12 + .../core/html/forms/html_text_area_element.cc | 12 +- .../core/html/forms/html_text_area_element.h | 3 +- .../renderer/core/html/forms/image_input_type.cc | 4 +- .../renderer/core/html/forms/input_type_view.cc | 8 +- .../renderer/core/html/forms/input_type_view.h | 5 +- .../core/html/forms/internal_popup_menu.cc | 25 +- .../forms/keyboard_clickable_input_type_view.cc | 9 +- .../forms/keyboard_clickable_input_type_view.h | 3 +- .../core/html/forms/menu_list_inner_element.cc | 4 +- .../core/html/forms/menu_list_inner_element.h | 3 +- .../core/html/forms/password_input_type_test.cc | 4 +- .../core/html/forms/radio_button_group_scope.cc | 8 - .../renderer/core/html/forms/radio_input_type.cc | 2 +- .../renderer/core/html/forms/range_input_type.cc | 32 +- .../renderer/core/html/forms/range_input_type.h | 4 +- .../core/html/forms/resources/color_picker.css | 8 + .../core/html/forms/resources/color_picker.js | 23 +- .../core/html/forms/resources/listPicker.js | 8 +- .../html/forms/resources/validation_bubble.css | 1 + .../renderer/core/html/forms/search_input_type.cc | 5 + .../renderer/core/html/forms/search_input_type.h | 6 +- .../blink/renderer/core/html/forms/select_type.cc | 2 +- .../core/html/forms/slider_thumb_element.cc | 6 +- .../core/html/forms/slider_thumb_element.h | 3 +- .../core/html/forms/spin_button_element.cc | 1 + .../renderer/core/html/forms/spin_button_element.h | 2 +- .../core/html/forms/text_control_element.cc | 13 +- .../core/html/forms/text_control_element.h | 2 +- .../core/html/forms/text_control_inner_elements.cc | 7 +- .../core/html/forms/text_control_inner_elements.h | 6 +- .../core/html/forms/text_field_input_type.cc | 8 +- .../core/html/forms/text_field_input_type.h | 2 +- .../renderer/core/html/html_anchor_element.cc | 120 +- .../blink/renderer/core/html/html_anchor_element.h | 6 - .../blink/renderer/core/html/html_area_element.h | 3 +- .../renderer/core/html/html_attribute_names.json5 | 2 + .../renderer/core/html/html_content_element.cc | 127 - .../renderer/core/html/html_content_element.h | 99 - .../renderer/core/html/html_content_element.idl | 34 - .../core/html/html_content_element_test.cc | 48 - .../renderer/core/html/html_details_element.cc | 19 + .../renderer/core/html/html_dialog_element.cc | 24 +- .../blink/renderer/core/html/html_dialog_element.h | 2 - .../blink/renderer/core/html/html_document.cc | 3 +- .../blink/renderer/core/html/html_element.cc | 368 +- .../blink/renderer/core/html/html_element.h | 21 +- .../blink/renderer/core/html/html_element.idl | 8 +- .../blink/renderer/core/html/html_element_test.cc | 16 + .../blink/renderer/core/html/html_embed_element.cc | 3 + .../renderer/core/html/html_frame_owner_element.cc | 30 +- .../renderer/core/html/html_frame_owner_element.h | 7 +- .../renderer/core/html/html_frame_set_element.cc | 11 +- .../renderer/core/html/html_iframe_element.cc | 122 +- .../blink/renderer/core/html/html_iframe_element.h | 11 - .../core/html/html_iframe_element_sandbox.cc | 12 - .../renderer/core/html/html_iframe_element_test.cc | 101 - .../blink/renderer/core/html/html_image_element.cc | 64 +- .../blink/renderer/core/html/html_image_element.h | 14 +- .../blink/renderer/core/html/html_li_element.cc | 36 +- .../blink/renderer/core/html/html_link_element.cc | 83 +- .../blink/renderer/core/html/html_link_element.h | 13 +- .../blink/renderer/core/html/html_link_element.idl | 3 +- .../blink/renderer/core/html/html_meta_element.cc | 20 +- .../renderer/core/html/html_meta_element_test.cc | 16 +- .../blink/renderer/core/html/html_meter_element.h | 3 +- .../renderer/core/html/html_no_embed_element.cc | 3 +- .../renderer/core/html/html_object_element.cc | 2 - .../blink/renderer/core/html/html_object_element.h | 2 +- .../blink/renderer/core/html/html_olist_element.cc | 18 +- .../renderer/core/html/html_or_foreign_element.idl | 2 +- .../renderer/core/html/html_picture_element.cc | 9 + .../renderer/core/html/html_picture_element.h | 1 + .../renderer/core/html/html_plugin_element.cc | 13 +- .../blink/renderer/core/html/html_plugin_element.h | 3 +- .../blink/renderer/core/html/html_popup_element.cc | 148 + .../blink/renderer/core/html/html_popup_element.h | 48 + .../renderer/core/html/html_popup_element.idl | 11 + .../renderer/core/html/html_progress_element.h | 3 +- .../renderer/core/html/html_script_element.cc | 7 +- .../renderer/core/html/html_shadow_element.cc | 51 - .../blink/renderer/core/html/html_shadow_element.h | 49 - .../renderer/core/html/html_shadow_element.idl | 37 - .../blink/renderer/core/html/html_slot_element.cc | 54 +- .../blink/renderer/core/html/html_slot_element.h | 9 +- .../renderer/core/html/html_source_element.cc | 11 + .../blink/renderer/core/html/html_source_element.h | 1 + .../renderer/core/html/html_source_element.idl | 2 + .../blink/renderer/core/html/html_style_element.cc | 11 +- .../renderer/core/html/html_summary_element.cc | 9 +- .../renderer/core/html/html_table_col_element.cc | 2 +- .../blink/renderer/core/html/html_table_element.h | 3 +- .../blink/renderer/core/html/html_tag_names.json5 | 19 +- .../blink/renderer/core/html/html_ulist_element.cc | 10 +- .../core/html/html_view_source_document.cc | 58 + .../core/html/html_view_source_document_test.cc | 76 +- .../core/html/imports/html_import_child.cc | 29 +- .../renderer/core/html/imports/html_import_child.h | 2 - .../core/html/imports/html_import_loader.cc | 12 +- .../core/html/imports/html_import_loader.h | 4 - .../core/html/imports/html_import_tree_root.cc | 1 + .../core/html/imports/html_import_tree_root.h | 2 +- .../renderer/core/html/lazy_load_frame_observer.cc | 7 +- .../renderer/core/html/lazy_load_frame_observer.h | 2 +- .../renderer/core/html/lazy_load_image_observer.cc | 6 +- .../renderer/core/html/lazy_load_image_observer.h | 2 +- .../blink/renderer/core/html/link_style.cc | 41 +- .../blink/renderer/core/html/link_style.h | 2 +- .../blink/renderer/core/html/link_web_bundle.cc | 184 +- .../blink/renderer/core/html/link_web_bundle.h | 12 +- .../renderer/core/html/link_web_bundle_test.cc | 17 +- .../blink/renderer/core/html/list_item_ordinal.cc | 57 +- .../blink/renderer/core/html/list_item_ordinal.h | 4 + .../blink/renderer/core/html/media/DEPS | 10 + .../blink/renderer/core/html/media/DIR_METADATA | 5 + .../blink/renderer/core/html/media/OWNERS | 3 - .../html/media/audio_output_device_controller.cc | 35 + .../html/media/audio_output_device_controller.h | 34 + .../renderer/core/html/media/autoplay_policy.cc | 4 +- .../renderer/core/html/media/html_media_element.cc | 212 +- .../renderer/core/html/media/html_media_element.h | 103 +- .../core/html/media/html_media_element_test.cc | 257 +- .../renderer/core/html/media/html_video_element.cc | 197 +- .../renderer/core/html/media/html_video_element.h | 93 +- .../core/html/media/html_video_element_test.cc | 28 + .../core/html/media/media_remoting_interstitial.cc | 1 + .../core/html/media/media_remoting_interstitial.h | 2 +- .../html/media/picture_in_picture_interstitial.cc | 1 + .../html/media/picture_in_picture_interstitial.h | 2 +- .../core/html/media/video_auto_fullscreen_test.cc | 14 +- .../html/media/video_frame_callback_requester.h | 1 + .../core/html/media/video_wake_lock_test.cc | 3 + .../blink/renderer/core/html/parser/DIR_METADATA | 5 + .../blink/renderer/core/html/parser/OWNERS | 3 - .../core/html/parser/background_html_parser.cc | 5 +- .../core/html/parser/css_preload_scanner.cc | 42 +- .../core/html/parser/css_preload_scanner.h | 10 +- .../core/html/parser/html_construction_site.cc | 2 - .../core/html/parser/html_document_parser.cc | 203 +- .../core/html/parser/html_document_parser.h | 23 +- .../core/html/parser/html_document_parser_test.cc | 18 +- .../core/html/parser/html_parser_metrics_test.cc | 4 +- .../core/html/parser/html_preload_scanner.cc | 158 +- .../core/html/parser/html_preload_scanner.h | 17 +- .../html/parser/html_preload_scanner_fuzzer.cc | 3 +- .../core/html/parser/html_preload_scanner_test.cc | 30 +- .../html/parser/html_resource_preloader_test.cc | 4 +- .../renderer/core/html/parser/html_tree_builder.cc | 75 +- .../renderer/core/html/parser/html_tree_builder.h | 6 +- .../html/parser/html_tree_builder_simulator.cc | 5 +- .../renderer/core/html/parser/preload_request.cc | 33 +- .../renderer/core/html/parser/preload_request.h | 33 + .../core/html/parser/text_document_parser.cc | 2 +- .../blink/renderer/core/html/plugin_document.cc | 5 +- .../blink/renderer/core/html/portal/DIR_METADATA | 3 + .../blink/renderer/core/html/portal/OWNERS | 2 - .../core/html/portal/html_portal_element.cc | 16 +- .../core/html/portal/html_portal_element.h | 8 +- .../core/html/portal/html_portal_element.idl | 4 +- .../blink/renderer/core/html/portal/portal_host.cc | 14 +- .../blink/renderer/core/html/portal/portal_host.h | 9 +- .../renderer/core/html/portal/portal_host.idl | 4 +- .../blink/renderer/core/html/rel_list.cc | 4 +- .../blink/renderer/core/html/resources/android.css | 2 +- .../core/html/resources/controls_refresh.css | 41 +- .../renderer/core/html/resources/forced_colors.css | 103 +- .../blink/renderer/core/html/resources/html.css | 109 +- .../core/html/resources/images/time_icon.svg | 2 +- .../core/html/resources/input_multiple_fields.css | 3 +- .../blink/renderer/core/html/resources/mac.css | 2 +- .../core/html/shadow/progress_shadow_element.cc | 7 +- .../core/html/shadow/progress_shadow_element.h | 3 +- .../html/shadow/progress_shadow_element_test.cc | 3 +- .../core/html/shadow/shadow_element_names.json5 | 6 +- .../core/html/shadow/shadow_element_utils.cc | 10 + .../core/html/shadow/shadow_element_utils.h | 1 + .../core/html/subresource_redirect_test.cc | 211 +- .../blink/renderer/core/html/track/DIR_METADATA | 3 + .../blink/renderer/core/html/track/OWNERS | 2 - .../blink/renderer/core/html/track/cue_timeline.cc | 4 +- .../blink/renderer/core/html/track/cue_timeline.h | 10 +- .../renderer/core/html/track/html_track_element.cc | 1 + .../renderer/core/html/track/html_track_element.h | 5 +- .../blink/renderer/core/html/track/track_base.h | 4 - .../renderer/core/html/track/vtt/vtt_parser.cc | 5 +- .../renderer/core/html/track/vtt/vtt_region.cc | 1 + .../renderer/core/html/track/vtt/vtt_region.h | 2 +- .../blink/renderer/core/imagebitmap/DIR_METADATA | 5 + .../blink/renderer/core/imagebitmap/OWNERS | 3 - .../blink/renderer/core/imagebitmap/build.gni | 2 - .../renderer/core/imagebitmap/image_bitmap.cc | 223 +- .../blink/renderer/core/imagebitmap/image_bitmap.h | 29 +- .../core/imagebitmap/image_bitmap_factories.cc | 377 -- .../core/imagebitmap/image_bitmap_factories.h | 162 - .../core/imagebitmap/image_bitmap_options.idl | 2 - .../renderer/core/imagebitmap/image_bitmap_test.cc | 4 +- .../core/input/boundary_event_dispatcher.cc | 1 - .../blink/renderer/core/input/event_handler.cc | 11 +- .../blink/renderer/core/input/event_handler.h | 10 +- .../renderer/core/input/event_handler_test.cc | 54 +- .../renderer/core/input/event_handling_util.h | 4 +- .../blink/renderer/core/input/gesture_manager.cc | 7 - .../blink/renderer/core/input/ime_on_focus_test.cc | 38 +- .../renderer/core/input/keyboard_event_manager.cc | 6 +- .../renderer/core/input/keyboard_event_manager.h | 1 + .../renderer/core/input/mouse_event_manager.cc | 27 +- .../renderer/core/input/mouse_event_manager.h | 5 +- .../renderer/core/input/pointer_event_manager.cc | 20 +- .../core/input/pointer_event_manager_test.cc | 60 + .../blink/renderer/core/input/scroll_manager.cc | 248 +- .../blink/renderer/core/input/scroll_manager.h | 28 +- .../blink/renderer/core/input/scroll_snap_test.cc | 1 + .../blink/renderer/core/input/touch_action_test.cc | 78 +- .../blink/renderer/core/inspector/BUILD.gn | 2 + .../third_party/blink/renderer/core/inspector/DEPS | 6 + .../blink/renderer/core/inspector/DIR_METADATA | 3 + .../blink/renderer/core/inspector/OWNERS | 3 +- .../blink/renderer/core/inspector/build.gni | 5 + .../renderer/core/inspector/dev_tools_emulator.cc | 98 +- .../renderer/core/inspector/dev_tools_emulator.h | 20 +- .../renderer/core/inspector/dev_tools_host.cc | 10 +- .../blink/renderer/core/inspector/dev_tools_host.h | 4 +- .../renderer/core/inspector/devtools_session.cc | 8 +- .../renderer/core/inspector/dom_traversal_utils.cc | 13 +- .../blink/renderer/core/inspector/inspect_tools.cc | 132 +- .../blink/renderer/core/inspector/inspect_tools.h | 44 +- .../core/inspector/inspector_animation_agent.cc | 71 +- .../core/inspector/inspector_audits_agent.cc | 143 +- .../core/inspector/inspector_audits_agent.h | 11 +- .../renderer/core/inspector/inspector_contrast.cc | 406 ++ .../renderer/core/inspector/inspector_contrast.h | 65 + .../core/inspector/inspector_contrast_test.cc | 212 + .../renderer/core/inspector/inspector_css_agent.cc | 235 +- .../renderer/core/inspector/inspector_css_agent.h | 3 +- .../renderer/core/inspector/inspector_dom_agent.cc | 56 +- .../renderer/core/inspector/inspector_dom_agent.h | 4 - .../core/inspector/inspector_dom_debugger_agent.cc | 78 +- .../core/inspector/inspector_dom_debugger_agent.h | 6 + .../core/inspector/inspector_dom_snapshot_agent.cc | 13 +- .../core/inspector/inspector_emulation_agent.cc | 41 +- .../core/inspector/inspector_emulation_agent.h | 2 +- .../inspector/inspector_emulation_agent_test.cc | 35 +- .../renderer/core/inspector/inspector_highlight.cc | 349 +- .../renderer/core/inspector/inspector_highlight.h | 58 +- .../renderer/core/inspector/inspector_io_agent.h | 3 +- .../core/inspector/inspector_media_agent.cc | 8 +- .../core/inspector/inspector_media_agent.h | 2 +- .../core/inspector/inspector_media_context_impl.cc | 124 +- .../core/inspector/inspector_media_context_impl.h | 38 +- .../inspector_media_context_impl_unittest.cc | 143 + .../core/inspector/inspector_network_agent.cc | 105 +- .../core/inspector/inspector_network_agent.h | 12 +- .../core/inspector/inspector_overlay_agent.cc | 308 +- .../core/inspector/inspector_overlay_agent.h | 24 +- .../core/inspector/inspector_page_agent.cc | 96 +- .../renderer/core/inspector/inspector_page_agent.h | 8 + .../inspector_performance_timeline_agent.cc | 218 + .../inspector_performance_timeline_agent.h | 55 + .../core/inspector/inspector_protocol_config.json | 3 + .../inspector/inspector_resource_content_loader.cc | 18 +- .../core/inspector/inspector_session_state.cc | 2 +- .../core/inspector/inspector_session_state_test.cc | 5 + .../core/inspector/inspector_style_sheet.cc | 5 +- .../core/inspector/inspector_trace_events.cc | 88 +- .../core/inspector/inspector_trace_events.h | 23 +- .../core/inspector/legacy_dom_snapshot_agent.cc | 2 +- .../core/inspector/network_resources_data.cc | 4 +- .../core/inspector/node_content_visibility_state.h | 16 + .../renderer/core/inspector/thread_debugger.cc | 46 + .../renderer/core/inspector/thread_debugger.h | 1 + .../core/inspector/worker_inspector_controller.cc | 11 +- .../core/inspector/worker_inspector_controller.h | 2 +- .../intersection_observer/intersection_geometry.cc | 82 +- .../intersection_observer/intersection_geometry.h | 9 +- .../intersection_observation.cc | 18 +- .../intersection_observation.h | 4 +- .../intersection_observer/intersection_observer.cc | 39 +- .../intersection_observer/intersection_observer.h | 9 +- .../intersection_observer_test.cc | 117 +- .../blink/renderer/core/layout/DIR_METADATA | 5 + .../third_party/blink/renderer/core/layout/OWNERS | 3 - .../renderer/core/layout/api/line_layout_item.h | 24 +- .../renderer/core/layout/box_layout_extra_input.h | 4 + .../blink/renderer/core/layout/build.gni | 13 +- .../blink/renderer/core/layout/custom_scrollbar.cc | 2 +- .../renderer/core/layout/flexible_box_algorithm.cc | 29 +- .../blink/renderer/core/layout/floating_objects.h | 4 +- .../blink/renderer/core/layout/geometry/axis.h | 78 + .../renderer/core/layout/geometry/axis_test.cc | 129 + .../renderer/core/layout/geometry/logical_size.h | 3 - .../renderer/core/layout/geometry/physical_rect.cc | 14 + .../renderer/core/layout/geometry/physical_rect.h | 4 + .../blink/renderer/core/layout/grid_test.cc | 2 +- .../core/layout/grid_track_sizing_algorithm.cc | 4 + .../blink/renderer/core/layout/hit_test_result.cc | 136 +- .../blink/renderer/core/layout/hit_test_result.h | 26 +- .../blink/renderer/core/layout/hit_testing_test.cc | 116 +- .../layout-shift-tracker-old-paint-offset.md | 76 + .../blink/renderer/core/layout/layout_block.cc | 111 +- .../blink/renderer/core/layout/layout_block.h | 1 + .../renderer/core/layout/layout_block_flow.cc | 99 +- .../blink/renderer/core/layout/layout_block_flow.h | 8 +- .../renderer/core/layout/layout_block_flow_line.cc | 33 +- .../blink/renderer/core/layout/layout_box.cc | 372 +- .../blink/renderer/core/layout/layout_box.h | 60 +- .../core/layout/layout_box_model_object.cc | 148 +- .../renderer/core/layout/layout_box_model_object.h | 2 +- .../core/layout/layout_box_model_object_test.cc | 9 +- .../blink/renderer/core/layout/layout_box_test.cc | 71 +- .../blink/renderer/core/layout/layout_br.cc | 7 +- .../blink/renderer/core/layout/layout_counter.cc | 62 +- .../blink/renderer/core/layout/layout_counter.h | 6 +- .../renderer/core/layout/layout_details_marker.cc | 19 +- .../renderer/core/layout/layout_details_marker.h | 5 +- .../core/layout/layout_embedded_content.cc | 12 +- .../renderer/core/layout/layout_embedded_content.h | 2 +- .../blink/renderer/core/layout/layout_fieldset.cc | 22 +- .../core/layout/layout_file_upload_control.cc | 15 - .../core/layout/layout_file_upload_control.h | 4 - .../renderer/core/layout/layout_flexible_box.cc | 62 +- .../renderer/core/layout/layout_flexible_box.h | 19 +- .../blink/renderer/core/layout/layout_frame.cc | 2 +- .../blink/renderer/core/layout/layout_frame.h | 5 +- .../blink/renderer/core/layout/layout_frame_set.cc | 4 +- .../blink/renderer/core/layout/layout_frame_set.h | 12 +- .../blink/renderer/core/layout/layout_grid.h | 7 +- .../renderer/core/layout/layout_html_canvas.cc | 18 + .../renderer/core/layout/layout_html_canvas.h | 2 + .../blink/renderer/core/layout/layout_image.cc | 23 +- .../renderer/core/layout/layout_image_resource.cc | 9 + .../renderer/core/layout/layout_image_resource.h | 1 + .../layout/layout_image_resource_style_image.cc | 10 + .../layout/layout_image_resource_style_image.h | 1 + .../blink/renderer/core/layout/layout_inline.cc | 130 +- .../blink/renderer/core/layout/layout_inline.h | 18 - .../blink/renderer/core/layout/layout_list_item.cc | 58 +- .../blink/renderer/core/layout/layout_list_item.h | 4 + .../renderer/core/layout/layout_list_marker.cc | 68 +- .../renderer/core/layout/layout_list_marker.h | 2 + .../core/layout/layout_list_marker_test.cc | 45 + .../core/layout/layout_multi_column_flow_thread.cc | 12 +- .../core/layout/layout_multi_column_set.cc | 5 +- .../blink/renderer/core/layout/layout_object.cc | 434 +- .../blink/renderer/core/layout/layout_object.h | 207 +- .../core/layout/layout_object_child_list.cc | 29 +- .../renderer/core/layout/layout_object_factory.cc | 13 +- .../renderer/core/layout/layout_object_factory.h | 6 +- .../renderer/core/layout/layout_object_test.cc | 143 +- .../core/layout/layout_outside_list_marker.cc | 2 +- .../blink/renderer/core/layout/layout_replaced.cc | 80 +- .../blink/renderer/core/layout/layout_replaced.h | 1 + .../renderer/core/layout/layout_shift_tracker.cc | 255 +- .../renderer/core/layout/layout_shift_tracker.h | 22 +- .../core/layout/layout_shift_tracker_test.cc | 226 +- .../blink/renderer/core/layout/layout_table.cc | 2 +- .../blink/renderer/core/layout/layout_table.h | 4 +- .../renderer/core/layout/layout_table_cell.cc | 2 +- .../blink/renderer/core/layout/layout_table_col.cc | 6 +- .../blink/renderer/core/layout/layout_table_col.h | 7 +- .../renderer/core/layout/layout_table_col_test.cc | 10 +- .../blink/renderer/core/layout/layout_table_row.h | 2 +- .../renderer/core/layout/layout_table_row_test.cc | 58 +- .../renderer/core/layout/layout_table_section.cc | 11 +- .../renderer/core/layout/layout_table_section.h | 2 +- .../core/layout/layout_table_section_test.cc | 15 +- .../renderer/core/layout/layout_table_test.cc | 151 +- .../blink/renderer/core/layout/layout_text.cc | 217 +- .../blink/renderer/core/layout/layout_text.h | 27 +- .../renderer/core/layout/layout_text_control.cc | 5 +- .../core/layout/layout_text_fragment_test.cc | 4 +- .../blink/renderer/core/layout/layout_theme.cc | 24 +- .../blink/renderer/core/layout/layout_theme.h | 2 +- .../renderer/core/layout/layout_theme_android.cc | 16 + .../renderer/core/layout/layout_theme_android.h | 4 + .../blink/renderer/core/layout/layout_theme_mac.h | 3 +- .../blink/renderer/core/layout/layout_theme_mac.mm | 28 +- .../renderer/core/layout/layout_tree_as_text.cc | 24 +- .../blink/renderer/core/layout/layout_video.cc | 69 +- .../renderer/core/layout/layout_video_test.cc | 55 +- .../blink/renderer/core/layout/layout_view.cc | 41 +- .../blink/renderer/core/layout/layout_view.h | 31 +- .../blink/renderer/core/layout/layout_view_test.cc | 428 ++ .../core/layout/line/abstract_inline_text_box.cc | 18 +- .../core/layout/line/abstract_inline_text_box.h | 2 + .../layout/line/breaking_context_inline_headers.h | 20 +- .../blink/renderer/core/layout/line/inline_box.cc | 2 +- .../renderer/core/layout/line/inline_iterator.h | 4 +- .../renderer/core/layout/line/line_box_list.cc | 22 +- .../blink/renderer/core/layout/list_marker.cc | 145 +- .../blink/renderer/core/layout/list_marker.h | 11 +- .../blink/renderer/core/layout/list_marker_test.cc | 312 ++ .../blink/renderer/core/layout/list_marker_text.cc | 40 +- .../renderer/core/layout/map_coordinates_flags.h | 3 + .../renderer/core/layout/map_coordinates_test.cc | 14 +- .../blink/renderer/core/layout/ng/DIR_METADATA | 5 + .../blink/renderer/core/layout/ng/OWNERS | 2 - .../renderer/core/layout/ng/custom/DIR_METADATA | 5 + .../blink/renderer/core/layout/ng/custom/OWNERS | 3 - .../layout/ng/custom/custom_layout_work_task.cc | 2 - .../ng/custom/layout_worklet_global_scope_proxy.cc | 5 +- .../core/layout/ng/custom/layout_worklet_test.cc | 6 +- .../layout/ng/custom/ng_custom_layout_algorithm.cc | 35 +- .../layout/ng/exclusions/ng_exclusion_space.cc | 28 +- .../ng/exclusions/ng_exclusion_space_test.cc | 8 +- .../layout/ng/flex/ng_flex_layout_algorithm.cc | 430 +- .../core/layout/ng/flex/ng_flex_layout_algorithm.h | 16 +- .../layout/ng/grid/ng_grid_layout_algorithm.cc | 2423 +++++++---- .../core/layout/ng/grid/ng_grid_layout_algorithm.h | 394 +- .../ng/grid/ng_grid_layout_algorithm_test.cc | 535 ++- .../core/layout/ng/grid/ng_grid_placement.cc | 461 ++- .../core/layout/ng/grid/ng_grid_placement.h | 132 +- .../layout/ng/grid/ng_grid_track_collection.cc | 376 +- .../core/layout/ng/grid/ng_grid_track_collection.h | 133 +- .../ng/grid/ng_grid_track_collection_test.cc | 91 +- .../blink/renderer/core/layout/ng/inline/README.md | 2 + .../ng/inline/ng_abstract_inline_text_box.cc | 81 +- .../layout/ng/inline/ng_abstract_inline_text_box.h | 11 +- .../core/layout/ng/inline/ng_caret_position.cc | 37 +- .../core/layout/ng/inline/ng_caret_position.h | 3 + .../layout/ng/inline/ng_caret_position_test.cc | 88 + .../core/layout/ng/inline/ng_caret_rect.cc | 33 +- .../renderer/core/layout/ng/inline/ng_caret_rect.h | 11 +- .../core/layout/ng/inline/ng_fragment_item.cc | 169 +- .../core/layout/ng/inline/ng_fragment_item.h | 19 +- .../core/layout/ng/inline/ng_fragment_item_test.cc | 38 +- .../core/layout/ng/inline/ng_fragment_items.cc | 4 +- .../layout/ng/inline/ng_fragment_items_builder.cc | 11 +- .../ng/inline/ng_fragment_items_builder_test.cc | 6 +- .../core/layout/ng/inline/ng_inline_box_state.cc | 29 +- .../core/layout/ng/inline/ng_inline_break_token.cc | 17 +- .../core/layout/ng/inline/ng_inline_break_token.h | 17 +- .../core/layout/ng/inline/ng_inline_cursor.cc | 892 ++-- .../core/layout/ng/inline/ng_inline_cursor.h | 167 +- .../core/layout/ng/inline/ng_inline_cursor_test.cc | 45 +- .../ng/inline/ng_inline_fragment_traversal.cc | 195 - .../ng/inline/ng_inline_fragment_traversal.h | 44 - .../ng/inline/ng_inline_fragment_traversal_test.cc | 75 - .../core/layout/ng/inline/ng_inline_item_result.h | 2 +- .../layout/ng/inline/ng_inline_items_builder.cc | 4 +- .../layout/ng/inline/ng_inline_layout_algorithm.cc | 124 +- .../layout/ng/inline/ng_inline_layout_algorithm.h | 2 +- .../ng/inline/ng_inline_layout_algorithm_test.cc | 19 +- .../core/layout/ng/inline/ng_inline_node.cc | 106 +- .../core/layout/ng/inline/ng_inline_node.h | 12 +- .../core/layout/ng/inline/ng_inline_node_test.cc | 84 +- .../ng/inline/ng_line_box_fragment_builder.cc | 27 +- .../ng/inline/ng_line_box_fragment_builder.h | 11 +- .../core/layout/ng/inline/ng_line_breaker.cc | 13 +- .../core/layout/ng/inline/ng_line_breaker_test.cc | 36 +- .../core/layout/ng/inline/ng_line_truncator.cc | 34 +- .../core/layout/ng/inline/ng_logical_line_item.cc | 44 +- .../core/layout/ng/inline/ng_logical_line_item.h | 66 +- .../core/layout/ng/inline/ng_offset_mapping.cc | 7 +- .../layout/ng/inline/ng_offset_mapping_test.cc | 7 - .../ng/inline/ng_physical_line_box_fragment.cc | 10 +- .../ng/inline/ng_physical_line_box_fragment.h | 2 +- .../inline/ng_physical_line_box_fragment_test.cc | 20 +- .../layout/ng/inline/ng_physical_text_fragment.cc | 244 -- .../layout/ng/inline/ng_physical_text_fragment.h | 142 - .../ng/inline/ng_physical_text_fragment_test.cc | 320 -- .../core/layout/ng/inline/ng_ruby_utils.cc | 6 +- .../layout/ng/inline/ng_text_fragment_builder.cc | 71 - .../layout/ng/inline/ng_text_fragment_builder.h | 63 - .../core/layout/ng/layout_ng_block_flow_mixin.cc | 116 +- .../core/layout/ng/layout_ng_block_flow_mixin.h | 17 - .../renderer/core/layout/ng/layout_ng_mixin.cc | 27 +- .../layout/ng/list/layout_ng_inside_list_marker.cc | 4 +- .../core/layout/ng/list/layout_ng_list_item.cc | 42 +- .../core/layout/ng/list/layout_ng_list_item.h | 2 + .../ng/list/layout_ng_outside_list_marker.cc | 6 +- .../layout/ng/list/ng_unpositioned_list_marker.cc | 6 +- .../ng/mathml/ng_math_fraction_layout_algorithm.cc | 5 +- .../core/layout/ng/mathml/ng_math_layout_utils.cc | 7 +- .../ng/mathml/ng_math_operator_layout_algorithm.cc | 7 +- .../ng/mathml/ng_math_padded_layout_algorithm.cc | 10 +- .../ng/mathml/ng_math_radical_layout_algorithm.cc | 7 +- .../ng/mathml/ng_math_row_layout_algorithm.cc | 5 +- .../ng/mathml/ng_math_scripts_layout_algorithm.cc | 15 +- .../ng/mathml/ng_math_space_layout_algorithm.cc | 6 +- .../mathml/ng_math_under_over_layout_algorithm.cc | 8 +- .../renderer/core/layout/ng/ng_absolute_utils.cc | 27 +- .../layout/ng/ng_base_layout_algorithm_test.cc | 4 +- .../core/layout/ng/ng_base_layout_algorithm_test.h | 2 +- .../core/layout/ng/ng_block_break_token.cc | 4 +- .../renderer/core/layout/ng/ng_block_break_token.h | 29 +- .../core/layout/ng/ng_block_child_iterator.cc | 44 +- .../core/layout/ng/ng_block_layout_algorithm.cc | 152 +- .../layout/ng/ng_block_layout_algorithm_test.cc | 58 +- .../blink/renderer/core/layout/ng/ng_block_node.cc | 234 +- .../blink/renderer/core/layout/ng/ng_block_node.h | 15 +- .../renderer/core/layout/ng/ng_box_fragment.h | 10 +- .../core/layout/ng/ng_box_fragment_builder.cc | 176 +- .../core/layout/ng/ng_box_fragment_builder.h | 17 +- .../renderer/core/layout/ng/ng_break_token.cc | 2 - .../blink/renderer/core/layout/ng/ng_break_token.h | 13 +- .../core/layout/ng/ng_column_layout_algorithm.cc | 191 +- .../core/layout/ng/ng_column_layout_algorithm.h | 1 + .../layout/ng/ng_column_layout_algorithm_test.cc | 69 +- .../renderer/core/layout/ng/ng_constraint_space.cc | 10 +- .../renderer/core/layout/ng/ng_constraint_space.h | 121 +- .../core/layout/ng/ng_constraint_space_builder.h | 16 +- .../layout/ng/ng_container_fragment_builder.cc | 141 +- .../core/layout/ng/ng_container_fragment_builder.h | 43 +- .../core/layout/ng/ng_fieldset_layout_algorithm.cc | 32 +- .../layout/ng/ng_fieldset_layout_algorithm_test.cc | 91 +- .../renderer/core/layout/ng/ng_floats_utils.cc | 10 +- .../renderer/core/layout/ng/ng_fragment_builder.h | 11 +- .../core/layout/ng/ng_fragment_child_iterator.cc | 27 +- .../layout/ng/ng_fragment_child_iterator_test.cc | 6 +- .../core/layout/ng/ng_fragmentation_test.cc | 103 + .../core/layout/ng/ng_fragmentation_utils.cc | 86 +- .../core/layout/ng/ng_fragmentation_utils.h | 28 +- .../core/layout/ng/ng_layout_input_node.cc | 5 +- .../renderer/core/layout/ng/ng_layout_input_node.h | 42 +- .../layout/ng/ng_layout_overflow_calculator.cc | 63 +- .../renderer/core/layout/ng/ng_layout_result.cc | 3 + .../renderer/core/layout/ng/ng_layout_result.h | 12 +- .../layout/ng/ng_layout_result_caching_test.cc | 242 +- .../renderer/core/layout/ng/ng_layout_utils.cc | 160 +- .../renderer/core/layout/ng/ng_length_utils.cc | 665 +-- .../renderer/core/layout/ng/ng_length_utils.h | 194 +- .../core/layout/ng/ng_length_utils_test.cc | 76 +- .../core/layout/ng/ng_out_of_flow_layout_part.cc | 451 +- .../core/layout/ng/ng_out_of_flow_layout_part.h | 62 +- .../layout/ng/ng_out_of_flow_layout_part_test.cc | 308 +- .../layout/ng/ng_out_of_flow_positioned_node.h | 7 +- .../renderer/core/layout/ng/ng_outline_utils.cc | 28 - .../renderer/core/layout/ng/ng_outline_utils.h | 7 - .../core/layout/ng/ng_page_layout_algorithm.cc | 4 +- .../core/layout/ng/ng_physical_box_fragment.cc | 323 +- .../core/layout/ng/ng_physical_box_fragment.h | 74 +- .../layout/ng/ng_physical_container_fragment.cc | 105 +- .../layout/ng/ng_physical_container_fragment.h | 28 + .../core/layout/ng/ng_physical_fragment.cc | 141 +- .../renderer/core/layout/ng/ng_physical_fragment.h | 23 +- .../core/layout/ng/ng_physical_fragment_test.cc | 185 + .../renderer/core/layout/ng/ng_relative_utils.h | 21 +- .../core/layout/ng/ng_replaced_layout_algorithm.cc | 45 + .../core/layout/ng/ng_replaced_layout_algorithm.h | 33 + .../layout/ng/ng_simplified_layout_algorithm.cc | 66 +- .../layout/ng/ng_simplified_layout_algorithm.h | 2 +- .../ng/ng_simplified_oof_layout_algorithm.cc | 97 +- .../layout/ng/ng_simplified_oof_layout_algorithm.h | 13 +- .../renderer/core/layout/ng/ng_space_utils.cc | 1 - .../core/layout/ng/table/layout_ng_table.cc | 99 +- .../core/layout/ng/table/layout_ng_table.h | 51 +- .../core/layout/ng/table/layout_ng_table_caption.h | 1 + .../core/layout/ng/table/layout_ng_table_cell.cc | 34 +- .../core/layout/ng/table/layout_ng_table_cell.h | 6 + .../core/layout/ng/table/layout_ng_table_column.cc | 18 +- .../core/layout/ng/table/layout_ng_table_column.h | 4 + .../core/layout/ng/table/layout_ng_table_row.cc | 21 + .../core/layout/ng/table/layout_ng_table_row.h | 12 + .../layout/ng/table/layout_ng_table_section.cc | 21 +- .../core/layout/ng/table/layout_ng_table_section.h | 12 + .../core/layout/ng/table/ng_table_borders.cc | 11 +- .../ng/table/ng_table_constraint_space_data.h | 93 +- .../core/layout/ng/table/ng_table_fragment_data.h | 8 + .../layout/ng/table/ng_table_layout_algorithm.cc | 470 +-- .../layout/ng/table/ng_table_layout_algorithm.h | 19 +- .../ng/table/ng_table_layout_algorithm_helpers.cc | 166 +- .../ng/table/ng_table_layout_algorithm_helpers.h | 9 +- .../ng_table_layout_algorithm_helpers_test.cc | 62 +- .../ng/table/ng_table_layout_algorithm_types.cc | 139 +- .../ng/table/ng_table_layout_algorithm_types.h | 40 +- .../ng/table/ng_table_layout_algorithm_utils.cc | 129 +- .../ng/table/ng_table_layout_algorithm_utils.h | 1 + .../renderer/core/layout/ng/table/ng_table_node.cc | 34 + .../renderer/core/layout/ng/table/ng_table_node.h | 13 + .../ng/table/ng_table_section_layout_algorithm.cc | 6 +- .../blink/renderer/core/layout/overflow_model.h | 1 - .../blink/renderer/core/layout/scroll_anchor.cc | 25 +- .../blink/renderer/core/layout/scroll_anchor.h | 11 +- .../renderer/core/layout/scroll_anchor_test.cc | 19 +- .../blink/renderer/core/layout/scrollbars_test.cc | 81 +- .../blink/renderer/core/layout/shapes/shape.cc | 54 +- .../core/layout/shapes/shape_outside_info.cc | 14 +- .../blink/renderer/core/layout/svg/DIR_METADATA | 5 + .../blink/renderer/core/layout/svg/OWNERS | 2 - .../renderer/core/layout/svg/layout_svg_block.cc | 18 +- .../core/layout/svg/layout_svg_container.cc | 1 - .../renderer/core/layout/svg/layout_svg_ellipse.cc | 19 +- .../core/layout/svg/layout_svg_filter_primitive.cc | 14 +- .../core/layout/svg/layout_svg_foreign_object.cc | 9 +- .../core/layout/svg/layout_svg_foreign_object.h | 2 +- .../layout/svg/layout_svg_foreign_object_test.cc | 21 + .../renderer/core/layout/svg/layout_svg_image.cc | 12 +- .../renderer/core/layout/svg/layout_svg_inline.cc | 13 +- .../core/layout/svg/layout_svg_inline_text.cc | 11 +- .../core/layout/svg/layout_svg_model_object.cc | 15 +- .../renderer/core/layout/svg/layout_svg_path.cc | 38 +- .../renderer/core/layout/svg/layout_svg_rect.cc | 18 +- .../core/layout/svg/layout_svg_resource_clipper.cc | 38 +- .../core/layout/svg/layout_svg_resource_clipper.h | 24 +- .../layout/svg/layout_svg_resource_container.cc | 111 +- .../layout/svg/layout_svg_resource_container.h | 52 +- .../core/layout/svg/layout_svg_resource_filter.cc | 22 +- .../core/layout/svg/layout_svg_resource_filter.h | 14 +- .../layout/svg/layout_svg_resource_gradient.cc | 2 +- .../core/layout/svg/layout_svg_resource_marker.cc | 3 +- .../core/layout/svg/layout_svg_resource_marker.h | 8 +- .../core/layout/svg/layout_svg_resource_masker.cc | 9 +- .../core/layout/svg/layout_svg_resource_masker.h | 8 +- .../core/layout/svg/layout_svg_resource_pattern.cc | 89 +- .../core/layout/svg/layout_svg_resource_pattern.h | 13 +- .../svg/layout_svg_resource_radial_gradient.h | 8 +- .../renderer/core/layout/svg/layout_svg_root.cc | 12 +- .../renderer/core/layout/svg/layout_svg_root.h | 6 +- .../renderer/core/layout/svg/layout_svg_shape.cc | 80 +- .../renderer/core/layout/svg/layout_svg_shape.h | 2 +- .../renderer/core/layout/svg/layout_svg_text.cc | 12 +- .../core/layout/svg/layout_svg_text_path.cc | 5 +- .../core/layout/svg/layout_svg_text_path.h | 4 +- .../svg/layout_svg_transformable_container.cc | 3 +- .../core/layout/svg/line/svg_inline_text_box.cc | 4 +- .../core/layout/svg/svg_content_container.cc | 31 +- .../core/layout/svg/svg_hit_test_perftest.cc | 132 + .../renderer/core/layout/svg/svg_layout_support.cc | 57 +- .../renderer/core/layout/svg/svg_layout_support.h | 1 - .../core/layout/svg/svg_layout_tree_as_text.cc | 225 +- .../renderer/core/layout/svg/svg_resources.cc | 707 +--- .../blink/renderer/core/layout/svg/svg_resources.h | 180 +- .../core/layout/svg/svg_resources_cache.cc | 140 - .../renderer/core/layout/svg/svg_resources_cache.h | 88 - .../core/layout/svg/svg_resources_cycle_solver.cc | 48 - .../core/layout/svg/svg_resources_cycle_solver.h | 79 - .../core/layout/svg/svg_text_chunk_builder.cc | 16 +- .../core/layout/svg/svg_text_layout_engine.cc | 34 +- .../layout/svg/svg_text_layout_engine_baseline.cc | 96 +- .../layout/svg/svg_text_layout_engine_baseline.h | 1 - .../layout/svg/transformed_hit_test_location.h | 3 +- .../core/layout/table_layout_algorithm_auto.cc | 8 +- .../blink/renderer/core/layout/text_autosizer.cc | 4 +- .../renderer/core/layout/web_font_rendering_win.cc | 6 +- .../third_party/blink/renderer/core/loader/DEPS | 3 + .../blink/renderer/core/loader/DIR_METADATA | 5 + .../third_party/blink/renderer/core/loader/OWNERS | 3 - .../renderer/core/loader/address_space_feature.cc | 219 +- .../renderer/core/loader/address_space_feature.h | 30 +- .../core/loader/address_space_feature_test.cc | 156 +- .../alternate_signed_exchange_resource_info.cc | 20 +- .../renderer/core/loader/appcache/DIR_METADATA | 5 + .../blink/renderer/core/loader/appcache/OWNERS | 3 - .../core/loader/appcache/application_cache_host.cc | 8 +- .../core/loader/appcache/application_cache_host.h | 24 +- .../appcache/application_cache_host_for_frame.cc | 9 +- .../appcache/application_cache_host_for_worker.cc | 7 +- .../appcache/application_cache_host_for_worker.h | 3 +- .../back_forward_cache_loader_helper_for_frame.cc | 41 + .../back_forward_cache_loader_helper_for_frame.h | 36 + .../renderer/core/loader/base_fetch_context.cc | 319 +- .../renderer/core/loader/base_fetch_context.h | 50 +- .../core/loader/base_fetch_context_test.cc | 20 +- .../blink/renderer/core/loader/build.gni | 20 +- .../renderer/core/loader/document_load_timing.cc | 37 +- .../renderer/core/loader/document_load_timing.h | 17 +- .../blink/renderer/core/loader/document_loader.cc | 620 ++- .../blink/renderer/core/loader/document_loader.h | 70 +- .../renderer/core/loader/document_loader_test.cc | 481 +-- .../blink/renderer/core/loader/empty_clients.cc | 10 +- .../blink/renderer/core/loader/empty_clients.h | 70 +- .../renderer/core/loader/font_preload_manager.cc | 3 +- .../renderer/core/loader/font_preload_manager.h | 2 +- .../blink/renderer/core/loader/form_submission.cc | 33 +- .../blink/renderer/core/loader/form_submission.h | 44 +- .../frame_client_hints_preferences_context.cc | 54 + .../frame_client_hints_preferences_context.h | 31 + .../renderer/core/loader/frame_fetch_context.cc | 324 +- .../renderer/core/loader/frame_fetch_context.h | 13 +- .../core/loader/frame_fetch_context_test.cc | 134 +- .../renderer/core/loader/frame_load_request.h | 40 +- .../blink/renderer/core/loader/frame_loader.cc | 264 +- .../blink/renderer/core/loader/frame_loader.h | 29 +- .../renderer/core/loader/frame_loader_test.cc | 16 +- .../renderer/core/loader/frame_loader_types.h | 5 - .../blink/renderer/core/loader/http_equiv.cc | 10 +- .../renderer/core/loader/idleness_detector.cc | 1 + .../blink/renderer/core/loader/idleness_detector.h | 2 +- .../blink/renderer/core/loader/image_loader.cc | 71 +- .../renderer/core/loader/interactive_detector.cc | 81 +- .../renderer/core/loader/interactive_detector.h | 24 +- .../core/loader/interactive_detector_test.cc | 28 - .../renderer/core/loader/lazy_image_helper.cc | 2 +- .../blink/renderer/core/loader/lazy_image_helper.h | 2 +- .../blink/renderer/core/loader/link_loader.cc | 41 +- .../blink/renderer/core/loader/link_loader.h | 13 +- .../renderer/core/loader/link_loader_client.h | 4 - .../blink/renderer/core/loader/link_loader_test.cc | 12 +- .../core/loader/loader_factory_for_frame.cc | 53 +- .../core/loader/loader_factory_for_frame.h | 11 +- .../core/loader/loader_factory_for_worker.cc | 22 +- .../core/loader/loader_factory_for_worker.h | 4 +- .../renderer/core/loader/mixed_content_checker.cc | 121 +- .../renderer/core/loader/mixed_content_checker.h | 14 +- .../core/loader/mixed_content_checker_test.cc | 43 +- .../modulescript/document_module_script_fetcher.cc | 58 +- .../modulescript/document_module_script_fetcher.h | 4 +- ...stalled_service_worker_module_script_fetcher.cc | 61 +- ...nstalled_service_worker_module_script_fetcher.h | 4 +- .../modulescript/module_script_creation_params.cc | 24 + .../modulescript/module_script_creation_params.h | 111 +- .../modulescript/module_script_fetch_request.h | 11 +- .../loader/modulescript/module_script_fetcher.cc | 55 +- .../loader/modulescript/module_script_fetcher.h | 16 +- .../loader/modulescript/module_script_loader.cc | 69 +- .../loader/modulescript/module_script_loader.h | 8 +- .../modulescript/module_script_loader_test.cc | 91 +- .../core/loader/modulescript/module_tree_linker.cc | 125 +- .../core/loader/modulescript/module_tree_linker.h | 10 +- .../loader/modulescript/module_tree_linker_test.cc | 78 +- .../modulescript/worker_module_script_fetcher.cc | 56 +- .../modulescript/worker_module_script_fetcher.h | 7 +- .../modulescript/worklet_module_script_fetcher.cc | 27 +- .../modulescript/worklet_module_script_fetcher.h | 4 +- .../core/loader/no_state_prefetch_client.cc | 59 + .../core/loader/no_state_prefetch_client.h | 67 + .../blink/renderer/core/loader/ping_loader_test.cc | 3 +- .../loader/prefetched_signed_exchange_manager.cc | 9 +- .../blink/renderer/core/loader/preload_helper.cc | 8 +- .../blink/renderer/core/loader/prerender_handle.cc | 125 + .../blink/renderer/core/loader/prerender_handle.h | 94 + .../blink/renderer/core/loader/prerender_test.cc | 250 +- .../renderer/core/loader/prerenderer_client.cc | 58 - .../renderer/core/loader/prerenderer_client.h | 67 - .../core/loader/previews_resource_loading_hints.cc | 194 - .../core/loader/previews_resource_loading_hints.h | 90 - .../loader/previews_resource_loading_hints_test.cc | 398 -- .../frame_client_hints_preferences_context.cc | 54 - .../frame_client_hints_preferences_context.h | 31 - .../core/loader/private/prerender_client.h | 54 - .../core/loader/private/prerender_handle.cc | 139 - .../core/loader/private/prerender_handle.h | 108 - .../loader/resource/css_style_sheet_resource.cc | 2 +- .../loader/resource/css_style_sheet_resource.h | 7 +- .../renderer/core/loader/resource/font_resource.cc | 11 +- .../renderer/core/loader/resource/font_resource.h | 8 +- .../core/loader/resource/font_resource_test.cc | 13 +- .../core/loader/resource/image_resource.cc | 2 +- .../renderer/core/loader/resource/image_resource.h | 8 +- .../core/loader/resource/image_resource_content.cc | 18 +- .../core/loader/resource/image_resource_content.h | 29 +- .../core/loader/resource/image_resource_test.cc | 6 +- .../core/loader/resource/script_resource.cc | 89 +- .../core/loader/resource/script_resource.h | 43 +- .../core/loader/resource/script_resource_test.cc | 92 + .../loader/resource/xsl_style_sheet_resource.cc | 7 +- .../loader/resource/xsl_style_sheet_resource.h | 7 +- .../loader/resource_load_observer_for_frame.cc | 16 +- .../core/loader/resource_load_observer_for_frame.h | 4 +- .../loader/resource_load_observer_for_worker.cc | 11 +- .../loader/resource_load_observer_for_worker.h | 5 +- .../core/loader/subresource_redirect_util.cc | 106 + .../core/loader/subresource_redirect_util.h | 46 + .../renderer/core/loader/text_track_loader.cc | 1 + .../blink/renderer/core/loader/text_track_loader.h | 2 +- .../renderer/core/loader/threadable_loader.cc | 11 +- .../blink/renderer/core/loader/threadable_loader.h | 4 +- .../core/loader/threadable_loader_client.h | 3 +- .../renderer/core/loader/threadable_loader_test.cc | 5 +- .../core/loader/web_associated_url_loader_impl.cc | 7 +- .../renderer/core/loader/worker_fetch_context.cc | 13 +- .../renderer/core/loader/worker_fetch_context.h | 6 +- .../blink/renderer/core/messaging/DIR_METADATA | 5 + .../blink/renderer/core/messaging/OWNERS | 3 - .../blink_cloneable_message_mojom_traits.cc | 6 +- .../blink_cloneable_message_mojom_traits.h | 8 +- .../core/messaging/blink_transferable_message.cc | 41 +- .../core/messaging/blink_transferable_message.h | 2 + .../blink_transferable_message_mojom_traits.cc | 2 + .../blink_transferable_message_mojom_traits.h | 5 + .../message_port_descriptor_mojom_traits_test.cc | 2 +- .../mobile_metrics/mobile_friendliness_checker.cc | 72 +- .../mobile_metrics/mobile_friendliness_checker.h | 19 +- .../mobile_friendliness_checker_test.cc | 264 +- .../mobile_metrics/mobile_metrics_test_helpers.h | 30 + .../third_party/blink/renderer/core/mojo/BUILD.gn | 38 - .../blink/renderer/core/mojo/DIR_METADATA | 3 + .../third_party/blink/renderer/core/mojo/OWNERS | 1 - .../third_party/blink/renderer/core/mojo/mojo.cc | 2 +- .../blink/renderer/core/mojo/mojo_handle.cc | 6 +- .../blink/renderer/core/mojo/mojo_watcher.cc | 13 +- .../blink/renderer/core/mojo/mojo_watcher.h | 6 + .../core/mojo/test/mojo_interface_interceptor.cc | 4 +- .../core/mojo/test/mojo_interface_interceptor.h | 2 +- .../blink/renderer/core/mojo/tests/js_to_cpp.mojom | 61 - .../renderer/core/offscreencanvas/DIR_METADATA | 5 + .../blink/renderer/core/offscreencanvas/OWNERS | 3 - .../core/offscreencanvas/offscreen_canvas.cc | 61 +- .../core/origin_trials/origin_trial_context.cc | 5 +- .../origin_trials/origin_trial_context_test.cc | 3 + .../renderer/core/page/autoscroll_controller.cc | 104 +- .../renderer/core/page/autoscroll_controller.h | 9 +- .../core/page/autoscroll_controller_test.cc | 98 + .../blink/renderer/core/page/chrome_client.cc | 7 +- .../blink/renderer/core/page/chrome_client.h | 34 +- .../blink/renderer/core/page/chrome_client_impl.cc | 86 +- .../blink/renderer/core/page/chrome_client_impl.h | 24 +- .../renderer/core/page/chrome_client_impl_test.cc | 13 +- .../renderer/core/page/context_menu_controller.cc | 364 +- .../renderer/core/page/context_menu_controller.h | 52 +- .../core/page/context_menu_controller_test.cc | 1000 ++++- .../renderer/core/page/context_menu_provider.h | 4 +- .../blink/renderer/core/page/create_window.cc | 30 +- .../blink/renderer/core/page/drag_controller.cc | 184 +- .../blink/renderer/core/page/drag_controller.h | 16 +- .../renderer/core/page/drag_controller_test.cc | 8 +- .../blink/renderer/core/page/drag_data.cc | 2 +- .../blink/renderer/core/page/drag_data.h | 6 +- .../blink/renderer/core/page/drag_image.cc | 2 +- .../blink/renderer/core/page/drag_image_test.cc | 1 + .../blink/renderer/core/page/focus_controller.cc | 7 +- .../blink/renderer/core/page/link_highlight.h | 7 +- .../third_party/blink/renderer/core/page/page.cc | 153 +- .../third_party/blink/renderer/core/page/page.h | 30 +- .../blink/renderer/core/page/page_animator.cc | 28 +- .../blink/renderer/core/page/page_animator.h | 4 +- .../blink/renderer/core/page/page_popup_client.cc | 2 +- .../renderer/core/page/page_widget_delegate.cc | 46 +- .../renderer/core/page/page_widget_delegate.h | 8 +- .../blink/renderer/core/page/plugin_data_test.cc | 1 - .../blink/renderer/core/page/print_context_test.cc | 18 +- .../core/page/scrolling/element_fragment_anchor.cc | 19 +- .../core/page/scrolling/element_fragment_anchor.h | 1 + .../main_thread_scrolling_reasons_test.cc | 4 +- .../core/page/scrolling/root_scroller_controller.h | 1 + .../core/page/scrolling/root_scroller_test.cc | 90 +- .../core/page/scrolling/scroll_into_view_test.cc | 78 +- .../core/page/scrolling/scroll_metrics_test.cc | 8 +- .../core/page/scrolling/scrolling_coordinator.cc | 23 +- .../renderer/core/page/scrolling/scrolling_test.cc | 11 +- .../core/page/scrolling/text_fragment_anchor.cc | 23 +- .../core/page/scrolling/text_fragment_anchor.h | 2 +- .../page/scrolling/text_fragment_anchor_metrics.cc | 4 + .../page/scrolling/text_fragment_anchor_metrics.h | 1 + .../scrolling/text_fragment_anchor_metrics_test.cc | 265 +- .../page/scrolling/text_fragment_anchor_test.cc | 87 + .../core/page/scrolling/text_fragment_finder.cc | 514 ++- .../core/page/scrolling/text_fragment_finder.h | 105 +- .../page/scrolling/text_fragment_finder_test.cc | 76 + .../scrolling/text_fragment_selector_generator.cc | 342 +- .../scrolling/text_fragment_selector_generator.h | 49 +- .../text_fragment_selector_generator_test.cc | 619 ++- .../core/page/slot_scoped_traversal_test.cc | 1 - .../core/page/spatial_navigation_controller.cc | 4 +- .../renderer/core/page/spatial_navigation_test.cc | 9 + .../renderer/core/page/touch_adjustment_test.cc | 4 +- .../core/page/validation_message_client_impl.cc | 9 +- .../core/page/validation_message_client_impl.h | 4 +- .../page/validation_message_overlay_delegate.cc | 10 +- .../validation_message_overlay_delegate_test.cc | 2 +- .../blink/renderer/core/page/viewport_test.cc | 435 +- .../third_party/blink/renderer/core/paint/DEPS | 4 +- .../blink/renderer/core/paint/DIR_METADATA | 5 + .../third_party/blink/renderer/core/paint/OWNERS | 3 - .../core/paint/background_image_geometry.cc | 20 +- .../core/paint/block_flow_paint_invalidator.cc | 7 - .../blink/renderer/core/paint/block_painter.cc | 9 +- .../blink/renderer/core/paint/block_painter.h | 3 +- .../renderer/core/paint/block_painter_test.cc | 6 +- .../core/paint/box_model_object_painter.cc | 11 +- .../renderer/core/paint/box_paint_invalidator.cc | 3 +- .../blink/renderer/core/paint/box_painter_base.cc | 220 +- .../blink/renderer/core/paint/box_painter_base.h | 2 + .../blink/renderer/core/paint/build.gni | 12 +- .../blink/renderer/core/paint/clip_path_clipper.cc | 39 +- .../renderer/core/paint/compositing/DIR_METADATA | 5 + .../blink/renderer/core/paint/compositing/OWNERS | 2 - .../paint/compositing/composited_layer_mapping.cc | 215 +- .../paint/compositing/composited_layer_mapping.h | 7 +- .../compositing/composited_layer_mapping_test.cc | 737 ++-- .../compositing/compositing_inputs_updater.cc | 67 +- .../paint/compositing/compositing_inputs_updater.h | 1 - .../compositing/compositing_inputs_updater_test.cc | 5 +- .../compositing/compositing_layer_assigner.cc | 4 +- .../paint/compositing/compositing_reason_finder.cc | 98 +- .../paint/compositing/compositing_reason_finder.h | 8 + .../compositing/compositing_reason_finder_test.cc | 114 +- .../compositing_requirements_updater.cc | 21 +- .../compositing_requirements_updater_test.cc | 87 + .../core/paint/compositing/compositing_test.cc | 362 +- .../compositing/graphics_layer_tree_builder.cc | 4 + .../paint/compositing/paint_layer_compositor.cc | 31 +- .../blink/renderer/core/paint/css_mask_painter.cc | 35 +- .../blink/renderer/core/paint/cull_rect_updater.cc | 287 ++ .../blink/renderer/core/paint/cull_rect_updater.h | 75 + .../renderer/core/paint/custom_scrollbar_theme.cc | 2 +- .../renderer/core/paint/details_marker_painter.cc | 8 +- .../renderer/core/paint/details_marker_painter.h | 3 +- .../renderer/core/paint/document_marker_painter.h | 1 + .../renderer/core/paint/element_timing_utils.cc | 5 +- .../renderer/core/paint/filter_effect_builder.cc | 26 +- .../renderer/core/paint/filter_effect_builder.h | 16 +- .../core/paint/first_meaningful_paint_detector.cc | 103 +- .../core/paint/first_meaningful_paint_detector.h | 14 +- .../paint/first_meaningful_paint_detector_test.cc | 184 +- .../blink/renderer/core/paint/fragment_data.cc | 13 + .../blink/renderer/core/paint/fragment_data.h | 19 + .../blink/renderer/core/paint/frame_painter.cc | 5 +- .../core/paint/highlight_painting_utils.cc | 22 +- .../core/paint/highlight_painting_utils_test.cc | 2 +- .../renderer/core/paint/html_canvas_painter.cc | 16 +- .../renderer/core/paint/image_element_timing.cc | 68 +- .../renderer/core/paint/image_element_timing.h | 19 +- .../core/paint/image_element_timing_test.cc | 12 +- .../core/paint/image_paint_timing_detector.cc | 71 +- .../core/paint/image_paint_timing_detector.h | 43 +- .../core/paint/image_paint_timing_detector_test.cc | 119 +- .../blink/renderer/core/paint/image_painter.cc | 56 +- .../renderer/core/paint/inline_box_painter_base.cc | 63 + .../renderer/core/paint/inline_box_painter_base.h | 12 + .../renderer/core/paint/inline_flow_box_painter.cc | 120 +- .../blink/renderer/core/paint/inline_painter.cc | 2 - .../renderer/core/paint/inline_text_box_painter.cc | 61 +- .../core/paint/inline_text_box_painter_test.cc | 61 + .../largest_contentful_paint_calculator_test.cc | 44 +- .../renderer/core/paint/link_highlight_impl.cc | 8 +- .../renderer/core/paint/link_highlight_impl.h | 2 +- .../renderer/core/paint/list_marker_painter.cc | 77 +- .../renderer/core/paint/list_marker_painter.h | 4 +- .../core/paint/ng/ng_box_fragment_painter.cc | 539 +-- .../core/paint/ng/ng_box_fragment_painter.h | 95 +- .../core/paint/ng/ng_box_fragment_painter_test.cc | 13 +- .../renderer/core/paint/ng/ng_fieldset_painter.cc | 1 - .../renderer/core/paint/ng/ng_fragment_painter.cc | 17 +- .../renderer/core/paint/ng/ng_fragment_painter.h | 8 +- .../renderer/core/paint/ng/ng_highlight_painter.cc | 355 ++ .../renderer/core/paint/ng/ng_highlight_painter.h | 125 + .../paint/ng/ng_inline_box_fragment_painter.cc | 133 +- .../core/paint/ng/ng_inline_box_fragment_painter.h | 92 +- .../renderer/core/paint/ng/ng_mathml_painter.cc | 1 + .../renderer/core/paint/ng/ng_paint_fragment.cc | 992 ----- .../renderer/core/paint/ng/ng_paint_fragment.h | 371 -- .../core/paint/ng/ng_paint_fragment_test.cc | 685 ---- .../core/paint/ng/ng_paint_fragment_traversal.cc | 278 -- .../core/paint/ng/ng_paint_fragment_traversal.h | 202 - .../paint/ng/ng_paint_fragment_traversal_test.cc | 225 - .../paint/ng/ng_table_cell_paint_invalidator.cc | 71 + .../paint/ng/ng_table_cell_paint_invalidator.h | 33 + .../renderer/core/paint/ng/ng_table_painters.cc | 53 +- .../renderer/core/paint/ng/ng_table_painters.h | 13 +- .../core/paint/ng/ng_text_fragment_painter.cc | 557 +-- .../core/paint/ng/ng_text_fragment_painter.h | 43 +- .../core/paint/ng/ng_text_fragment_painter_test.cc | 1 - .../renderer/core/paint/ng/ng_text_painter.cc | 11 +- .../blink/renderer/core/paint/ng/ng_text_painter.h | 3 +- .../renderer/core/paint/nine_piece_image_grid.cc | 122 +- .../renderer/core/paint/nine_piece_image_grid.h | 12 +- .../core/paint/nine_piece_image_grid_test.cc | 230 +- .../core/paint/nine_piece_image_painter.cc | 149 +- .../core/paint/object_paint_invalidator.cc | 1 - .../blink/renderer/core/paint/object_painter.cc | 2 +- .../renderer/core/paint/object_painter_base.cc | 13 +- .../paint/paint_and_raster_invalidation_test.cc | 21 +- .../core/paint/paint_controller_paint_test.cc | 1 - .../blink/renderer/core/paint/paint_info.h | 18 +- .../blink/renderer/core/paint/paint_invalidator.cc | 146 +- .../blink/renderer/core/paint/paint_layer.cc | 376 +- .../blink/renderer/core/paint/paint_layer.h | 78 +- .../renderer/core/paint/paint_layer_painter.cc | 276 +- .../renderer/core/paint/paint_layer_painter.h | 22 +- .../core/paint/paint_layer_painter_test.cc | 162 +- .../core/paint/paint_layer_resource_info.cc | 16 +- .../core/paint/paint_layer_resource_info.h | 4 +- .../core/paint/paint_layer_scrollable_area.cc | 34 +- .../core/paint/paint_layer_scrollable_area.h | 4 +- .../core/paint/paint_layer_scrollable_area_test.cc | 16 +- .../blink/renderer/core/paint/paint_layer_test.cc | 868 +++- .../blink/renderer/core/paint/paint_phase.h | 5 +- .../core/paint/paint_property_tree_builder.cc | 532 +-- .../core/paint/paint_property_tree_builder.h | 37 +- .../core/paint/paint_property_tree_builder_test.cc | 69 +- .../core/paint/paint_property_tree_update_tests.cc | 115 +- .../blink/renderer/core/paint/paint_timing.cc | 163 +- .../blink/renderer/core/paint/paint_timing.h | 122 +- .../renderer/core/paint/paint_timing_detector.cc | 50 +- .../renderer/core/paint/paint_timing_detector.h | 36 +- .../renderer/core/paint/paint_timing_test_helper.h | 8 +- .../renderer/core/paint/pre_paint_tree_walk.cc | 230 +- .../renderer/core/paint/pre_paint_tree_walk.h | 42 +- .../core/paint/pre_paint_tree_walk_test.cc | 54 +- .../blink/renderer/core/paint/replaced_painter.cc | 9 +- .../renderer/core/paint/scoped_paint_state.cc | 9 +- .../blink/renderer/core/paint/scoped_paint_state.h | 5 +- .../renderer/core/paint/scoped_svg_paint_state.cc | 20 +- .../core/paint/selection_bounds_recorder.cc | 155 + .../core/paint/selection_bounds_recorder.h | 50 + .../blink/renderer/core/paint/svg_image_painter.cc | 21 +- .../core/paint/svg_inline_text_box_painter.cc | 104 +- .../blink/renderer/core/paint/svg_mask_painter.cc | 9 +- .../renderer/core/paint/svg_object_painter.cc | 57 +- .../blink/renderer/core/paint/svg_object_painter.h | 6 +- .../core/paint/svg_root_inline_box_painter.cc | 5 +- .../blink/renderer/core/paint/svg_shape_painter.cc | 53 +- .../renderer/core/paint/table_painter_test.cc | 14 +- .../renderer/core/paint/text_decoration_info.h | 2 + .../core/paint/text_paint_timing_detector.cc | 55 +- .../core/paint/text_paint_timing_detector.h | 44 +- .../core/paint/text_paint_timing_detector_test.cc | 218 +- .../blink/renderer/core/paint/text_painter_base.cc | 52 +- .../blink/renderer/core/paint/text_painter_base.h | 13 +- .../blink/renderer/core/paint/text_painter_test.cc | 24 +- .../blink/renderer/core/paint/theme_painter.cc | 1 - .../renderer/core/paint/theme_painter_default.cc | 89 +- .../renderer/core/paint/theme_painter_default.h | 6 + .../blink/renderer/core/paint/video_painter.cc | 2 +- .../renderer/core/paint/video_painter_test.cc | 7 +- .../blink/renderer/core/paint/view_painter.cc | 15 +- .../blink/renderer/core/probe/core_probes.cc | 13 - .../blink/renderer/core/probe/core_probes.h | 1 + .../blink/renderer/core/probe/core_probes.json5 | 12 +- .../blink/renderer/core/probe/core_probes.pidl | 11 +- .../renderer/core/resize_observer/DIR_METADATA | 5 + .../blink/renderer/core/resize_observer/OWNERS | 3 - .../core/resize_observer/resize_observer.idl | 2 +- .../core/resize_observer/resize_observer_entry.cc | 80 +- .../core/resize_observer/resize_observer_entry.idl | 6 +- .../core/resize_observer/resize_observer_size.idl | 3 +- .../core/resize_observer/resize_observer_test.cc | 8 +- .../frame_throttling_test.cc | 524 ++- .../scheduler_integration_tests/throttling_test.cc | 70 +- .../blink/renderer/core/script/DIR_METADATA | 5 + .../third_party/blink/renderer/core/script/OWNERS | 3 - .../renderer/core/script/classic_pending_script.cc | 115 +- .../renderer/core/script/classic_pending_script.h | 4 - .../blink/renderer/core/script/classic_script.cc | 48 +- .../blink/renderer/core/script/classic_script.h | 24 +- .../core/script/document_modulator_impl.cc | 14 +- .../renderer/core/script/document_modulator_impl.h | 3 +- .../core/script/dynamic_module_resolver.cc | 47 +- .../renderer/core/script/dynamic_module_resolver.h | 3 +- .../core/script/dynamic_module_resolver_test.cc | 116 +- .../script/fetch_client_settings_object_impl.cc | 7 - .../script/fetch_client_settings_object_impl.h | 2 - .../blink/renderer/core/script/import_map.cc | 21 +- .../blink/renderer/core/script/js_module_script.cc | 67 +- .../blink/renderer/core/script/js_module_script.h | 15 +- .../blink/renderer/core/script/modulator.h | 35 +- .../renderer/core/script/modulator_impl_base.cc | 63 +- .../renderer/core/script/modulator_impl_base.h | 26 +- .../blink/renderer/core/script/module_map.cc | 8 +- .../blink/renderer/core/script/module_map.h | 6 +- .../blink/renderer/core/script/module_map_test.cc | 64 +- .../renderer/core/script/module_record_resolver.h | 2 +- .../core/script/module_record_resolver_impl.cc | 15 +- .../core/script/module_record_resolver_impl.h | 2 +- .../script/module_record_resolver_impl_test.cc | 24 +- .../blink/renderer/core/script/module_script.cc | 22 +- .../renderer/core/script/module_script_test.cc | 10 +- .../blink/renderer/core/script/script_loader.cc | 370 +- .../blink/renderer/core/script/script_loader.h | 22 +- .../value_wrapper_synthetic_module_script.cc | 46 +- .../script/value_wrapper_synthetic_module_script.h | 12 +- .../renderer/core/script/worker_modulator_impl.cc | 9 +- .../renderer/core/script/worker_modulator_impl.h | 3 +- .../renderer/core/script/worklet_modulator_impl.cc | 7 +- .../renderer/core/script/worklet_modulator_impl.h | 3 +- .../core/script/xml_parser_script_runner.cc | 3 +- .../core/scroll/programmatic_scroll_animator.cc | 12 +- .../core/scroll/programmatic_scroll_animator.h | 4 +- .../blink/renderer/core/scroll/scroll_animator.cc | 9 +- .../blink/renderer/core/scroll/scroll_animator.h | 5 +- .../renderer/core/scroll/scroll_animator_base.h | 4 +- .../scroll_animator_compositor_coordinator.h | 7 +- .../renderer/core/scroll/scroll_animator_mac.mm | 64 +- .../renderer/core/scroll/scroll_animator_test.cc | 3 +- .../blink/renderer/core/scroll/scroll_test.cc | 4 +- .../blink/renderer/core/scroll/scrollable_area.cc | 46 +- .../blink/renderer/core/scroll/scrollable_area.h | 14 +- .../blink/renderer/core/scroll/scrollbar.cc | 5 +- .../blink/renderer/core/scroll/scrollbar.h | 2 +- .../renderer/core/scroll/scrollbar_test_suite.h | 6 +- .../blink/renderer/core/scroll/scrollbar_theme.cc | 2 +- .../renderer/core/scroll/scrollbar_theme_aura.cc | 10 +- .../renderer/core/scroll/scrollbar_theme_mac.mm | 1 - .../blink/renderer/core/streams/DIR_METADATA | 5 + .../third_party/blink/renderer/core/streams/OWNERS | 3 - .../core/streams/count_queuing_strategy.cc | 1 + .../core/streams/miscellaneous_operations.cc | 75 + .../core/streams/miscellaneous_operations.h | 23 + .../renderer/core/streams/queue_with_sizes.cc | 1 - .../blink/renderer/core/streams/queue_with_sizes.h | 2 +- .../streams/readable_byte_stream_controller.cc | 1396 ++++++- .../core/streams/readable_byte_stream_controller.h | 229 +- .../streams/readable_byte_stream_controller.idl | 9 +- .../blink/renderer/core/streams/readable_stream.cc | 307 +- .../blink/renderer/core/streams/readable_stream.h | 80 +- .../renderer/core/streams/readable_stream.idl | 2 + .../core/streams/readable_stream_byob_reader.cc | 175 +- .../core/streams/readable_stream_byob_reader.h | 52 +- .../core/streams/readable_stream_byob_reader.idl | 3 +- .../core/streams/readable_stream_byob_request.cc | 67 +- .../core/streams/readable_stream_byob_request.h | 15 +- .../core/streams/readable_stream_byob_request.idl | 3 +- .../core/streams/readable_stream_controller.h | 5 +- .../streams/readable_stream_default_controller.cc | 8 +- .../streams/readable_stream_default_controller.h | 11 + .../streams/readable_stream_default_controller.idl | 3 + ...e_stream_default_controller_with_script_scope.h | 6 +- .../core/streams/readable_stream_default_reader.cc | 9 +- .../core/streams/readable_stream_default_reader.h | 21 +- .../streams/readable_stream_default_reader.idl | 3 +- .../core/streams/readable_stream_generic_reader.cc | 2 +- .../core/streams/readable_stream_generic_reader.h | 5 +- .../renderer/core/streams/readable_stream_test.cc | 136 +- .../readable_stream_transferring_optimizer.h | 2 +- .../renderer/core/streams/stream_algorithms.h | 2 +- .../core/streams/stream_promise_resolver.cc | 1 - .../core/streams/stream_promise_resolver.h | 3 +- .../renderer/core/streams/transferable_streams.cc | 240 +- .../renderer/core/streams/transferable_streams.h | 31 +- .../core/streams/transferable_streams_test.cc | 494 ++- .../renderer/core/streams/transform_stream.cc | 36 +- .../blink/renderer/core/streams/transform_stream.h | 5 +- .../streams/transform_stream_default_controller.cc | 17 +- .../streams/transform_stream_default_controller.h | 6 +- .../core/streams/transform_stream_transformer.h | 2 +- .../renderer/core/streams/underlying_source.idl | 13 + .../renderer/core/streams/underlying_source_base.h | 2 +- .../streams/underlying_source_cancel_callback.idl | 7 + .../streams/underlying_source_pull_callback.idl | 7 + .../streams/underlying_source_start_callback.idl | 7 + .../blink/renderer/core/streams/writable_stream.cc | 35 +- .../blink/renderer/core/streams/writable_stream.h | 20 +- .../streams/writable_stream_default_controller.cc | 1 - .../streams/writable_stream_default_controller.h | 2 +- .../core/streams/writable_stream_default_writer.cc | 1 - .../core/streams/writable_stream_default_writer.h | 2 +- .../renderer/core/streams/writable_stream_test.cc | 6 +- .../writable_stream_transferring_optimizer.h | 2 +- .../blink/renderer/core/style/DIR_METADATA | 5 + .../third_party/blink/renderer/core/style/OWNERS | 3 - .../blink/renderer/core/style/build.gni | 13 +- .../blink/renderer/core/style/computed_style.cc | 169 +- .../blink/renderer/core/style/computed_style.h | 264 +- .../renderer/core/style/computed_style_constants.h | 98 +- .../core/style/computed_style_diff_functions.json5 | 44 +- .../core/style/computed_style_extra_fields.json5 | 87 +- .../renderer/core/style/computed_style_test.cc | 63 +- .../blink/renderer/core/style/content_data.cc | 8 +- .../blink/renderer/core/style/content_data.h | 46 +- .../blink/renderer/core/style/counter_content.h | 62 - .../blink/renderer/core/style/data_equivalency.h | 6 +- .../blink/renderer/core/style/fill_layer.cc | 12 +- .../blink/renderer/core/style/grid_area.h | 13 +- .../blink/renderer/core/style/grid_track_list.cc | 4 + .../blink/renderer/core/style/grid_track_list.h | 4 + .../renderer/core/style/list_style_type_data.cc | 110 + .../renderer/core/style/list_style_type_data.h | 80 + .../blink/renderer/core/style/shadow_list.cc | 19 - .../blink/renderer/core/style/shadow_list.h | 5 - .../blink/renderer/core/style/style_aspect_ratio.h | 2 + .../renderer/core/style/style_fetched_image.cc | 35 +- .../renderer/core/style/style_fetched_image.h | 3 + .../renderer/core/style/style_fetched_image_set.cc | 14 + .../renderer/core/style/style_fetched_image_set.h | 3 + .../blink/renderer/core/style/style_image.h | 7 + .../renderer/core/style/style_pending_image.cc | 12 +- .../renderer/core/style/style_pending_image.h | 18 +- .../renderer/core/style/svg_computed_style.cc | 313 -- .../blink/renderer/core/style/svg_computed_style.h | 485 --- .../renderer/core/style/svg_computed_style_defs.cc | 190 - .../renderer/core/style/svg_computed_style_defs.h | 365 -- .../renderer/core/style/svg_computed_style_test.cc | 61 - .../blink/renderer/core/style/svg_dash_array.cc | 40 + .../blink/renderer/core/style/svg_dash_array.h | 44 + .../blink/renderer/core/style/svg_paint.cc | 52 + .../blink/renderer/core/style/svg_paint.h | 81 + .../blink/renderer/core/style/unzoomed_length.h | 61 + .../blink/renderer/core/svg/DIR_METADATA | 5 + .../third_party/blink/renderer/core/svg/OWNERS | 2 - .../core/svg/animation/smil_time_container.cc | 1 + .../core/svg/animation/smil_time_container.h | 2 +- .../core/svg/animation/smil_time_container_test.cc | 4 +- .../core/svg/animation/svg_smil_element.cc | 9 +- .../renderer/core/svg/animation/svg_smil_element.h | 2 +- .../third_party/blink/renderer/core/svg/build.gni | 4 +- .../core/svg/graphics/filters/svg_fe_image.h | 2 +- .../svg/graphics/filters/svg_filter_builder.cc | 9 +- .../core/svg/graphics/filters/svg_filter_builder.h | 2 +- .../blink/renderer/core/svg/graphics/svg_image.cc | 400 +- .../blink/renderer/core/svg/graphics/svg_image.h | 105 +- .../core/svg/graphics/svg_image_chrome_client.cc | 29 +- .../core/svg/graphics/svg_image_chrome_client.h | 14 +- .../core/svg/graphics/svg_image_for_container.cc | 29 +- .../core/svg/graphics/svg_image_for_container.h | 2 +- .../renderer/core/svg/graphics/svg_image_test.cc | 42 +- .../blink/renderer/core/svg/svg_a_element.cc | 11 +- .../blink/renderer/core/svg/svg_a_element.h | 2 +- .../blink/renderer/core/svg/svg_animate_element.cc | 36 +- .../blink/renderer/core/svg/svg_animate_element.h | 2 +- .../core/svg/svg_animate_motion_element.cc | 19 +- .../core/svg/svg_animate_transform_element.cc | 2 +- .../core/svg/svg_animate_transform_element.h | 2 +- .../blink/renderer/core/svg/svg_animated_path.cc | 6 +- .../blink/renderer/core/svg/svg_circle_element.cc | 16 +- .../blink/renderer/core/svg/svg_circle_element.h | 2 +- .../renderer/core/svg/svg_clip_path_element.cc | 7 +- .../renderer/core/svg/svg_clip_path_element.h | 2 +- .../svg/svg_component_transfer_function_element.cc | 5 +- .../svg/svg_component_transfer_function_element.h | 2 +- .../renderer/core/svg/svg_document_extensions.h | 4 - .../blink/renderer/core/svg/svg_element.cc | 56 +- .../blink/renderer/core/svg/svg_element.h | 23 +- .../renderer/core/svg/svg_element_rare_data.cc | 6 +- .../blink/renderer/core/svg/svg_ellipse_element.cc | 16 +- .../blink/renderer/core/svg/svg_ellipse_element.h | 2 +- .../core/svg/svg_external_document_cache.cc | 137 - .../core/svg/svg_external_document_cache.h | 85 - .../core/svg/svg_external_document_cache_test.cc | 49 - .../renderer/core/svg/svg_fe_blend_element.cc | 6 +- .../blink/renderer/core/svg/svg_fe_blend_element.h | 2 +- .../core/svg/svg_fe_color_matrix_element.cc | 5 +- .../core/svg/svg_fe_color_matrix_element.h | 2 +- .../core/svg/svg_fe_component_transfer_element.cc | 6 +- .../core/svg/svg_fe_component_transfer_element.h | 2 +- .../renderer/core/svg/svg_fe_composite_element.cc | 5 +- .../renderer/core/svg/svg_fe_composite_element.h | 2 +- .../core/svg/svg_fe_convolve_matrix_element.cc | 5 +- .../core/svg/svg_fe_convolve_matrix_element.h | 2 +- .../core/svg/svg_fe_diffuse_lighting_element.cc | 7 +- .../core/svg/svg_fe_diffuse_lighting_element.h | 2 +- .../core/svg/svg_fe_displacement_map_element.cc | 5 +- .../core/svg/svg_fe_displacement_map_element.h | 2 +- .../core/svg/svg_fe_drop_shadow_element.cc | 12 +- .../renderer/core/svg/svg_fe_drop_shadow_element.h | 2 +- .../renderer/core/svg/svg_fe_flood_element.cc | 7 +- .../core/svg/svg_fe_gaussian_blur_element.cc | 5 +- .../core/svg/svg_fe_gaussian_blur_element.h | 2 +- .../renderer/core/svg/svg_fe_image_element.cc | 6 +- .../blink/renderer/core/svg/svg_fe_image_element.h | 2 +- .../renderer/core/svg/svg_fe_light_element.cc | 6 +- .../blink/renderer/core/svg/svg_fe_light_element.h | 2 +- .../renderer/core/svg/svg_fe_merge_node_element.cc | 6 +- .../renderer/core/svg/svg_fe_merge_node_element.h | 2 +- .../renderer/core/svg/svg_fe_morphology_element.cc | 5 +- .../renderer/core/svg/svg_fe_morphology_element.h | 2 +- .../renderer/core/svg/svg_fe_offset_element.cc | 6 +- .../renderer/core/svg/svg_fe_offset_element.h | 2 +- .../core/svg/svg_fe_specular_lighting_element.cc | 7 +- .../core/svg/svg_fe_specular_lighting_element.h | 2 +- .../blink/renderer/core/svg/svg_fe_tile_element.cc | 7 +- .../blink/renderer/core/svg/svg_fe_tile_element.h | 2 +- .../renderer/core/svg/svg_fe_turbulence_element.cc | 5 +- .../renderer/core/svg/svg_fe_turbulence_element.h | 2 +- .../blink/renderer/core/svg/svg_filter_element.cc | 12 +- .../blink/renderer/core/svg/svg_filter_element.h | 2 +- .../svg_filter_primitive_standard_attributes.cc | 7 +- .../svg/svg_filter_primitive_standard_attributes.h | 2 +- .../core/svg/svg_foreign_object_element.cc | 5 +- .../renderer/core/svg/svg_foreign_object_element.h | 2 +- .../renderer/core/svg/svg_geometry_element.cc | 10 +- .../blink/renderer/core/svg/svg_geometry_element.h | 2 +- .../renderer/core/svg/svg_gradient_element.cc | 6 +- .../blink/renderer/core/svg/svg_gradient_element.h | 2 +- .../renderer/core/svg/svg_graphics_element.cc | 6 +- .../blink/renderer/core/svg/svg_graphics_element.h | 2 +- .../blink/renderer/core/svg/svg_image_element.cc | 6 +- .../blink/renderer/core/svg/svg_image_element.h | 2 +- .../blink/renderer/core/svg/svg_length.cc | 9 - .../blink/renderer/core/svg/svg_length.h | 3 - .../blink/renderer/core/svg/svg_length_context.cc | 20 +- .../blink/renderer/core/svg/svg_line_element.cc | 6 +- .../blink/renderer/core/svg/svg_line_element.h | 2 +- .../core/svg/svg_linear_gradient_element.cc | 5 +- .../core/svg/svg_linear_gradient_element.h | 2 +- .../blink/renderer/core/svg/svg_marker_element.cc | 6 +- .../blink/renderer/core/svg/svg_marker_element.h | 2 +- .../blink/renderer/core/svg/svg_mask_element.cc | 6 +- .../blink/renderer/core/svg/svg_mask_element.h | 2 +- .../blink/renderer/core/svg/svg_mpath_element.cc | 7 +- .../blink/renderer/core/svg/svg_mpath_element.h | 2 +- .../blink/renderer/core/svg/svg_parser_utilities.h | 2 +- .../blink/renderer/core/svg/svg_path.cc | 8 +- .../third_party/blink/renderer/core/svg/svg_path.h | 6 +- .../blink/renderer/core/svg/svg_path_element.cc | 11 +- .../blink/renderer/core/svg/svg_path_element.h | 2 +- .../blink/renderer/core/svg/svg_pattern_element.cc | 39 +- .../blink/renderer/core/svg/svg_pattern_element.h | 5 +- .../blink/renderer/core/svg/svg_point.cc | 37 - .../blink/renderer/core/svg/svg_point.h | 8 - .../blink/renderer/core/svg/svg_point_tear_off.cc | 3 +- .../blink/renderer/core/svg/svg_poly_element.cc | 7 +- .../blink/renderer/core/svg/svg_poly_element.h | 3 +- .../core/svg/svg_radial_gradient_element.cc | 5 +- .../core/svg/svg_radial_gradient_element.h | 2 +- .../blink/renderer/core/svg/svg_rect_element.cc | 18 +- .../blink/renderer/core/svg/svg_rect_element.h | 2 +- .../blink/renderer/core/svg/svg_resource.cc | 162 +- .../blink/renderer/core/svg/svg_resource.h | 53 +- .../blink/renderer/core/svg/svg_resource_client.h | 23 +- .../core/svg/svg_resource_document_content.cc | 158 + .../core/svg/svg_resource_document_content.h | 67 + .../core/svg/svg_resource_document_content_test.cc | 45 + .../blink/renderer/core/svg/svg_script_element.cc | 9 +- .../blink/renderer/core/svg/svg_script_element.h | 2 +- .../blink/renderer/core/svg/svg_stop_element.cc | 14 +- .../blink/renderer/core/svg/svg_stop_element.h | 2 +- .../blink/renderer/core/svg/svg_svg_element.cc | 10 +- .../blink/renderer/core/svg/svg_svg_element.h | 5 +- .../blink/renderer/core/svg/svg_symbol_element.cc | 5 +- .../blink/renderer/core/svg/svg_symbol_element.h | 2 +- .../renderer/core/svg/svg_text_content_element.cc | 5 +- .../renderer/core/svg/svg_text_content_element.h | 2 +- .../renderer/core/svg/svg_text_path_element.cc | 6 +- .../renderer/core/svg/svg_text_path_element.h | 5 +- .../core/svg/svg_text_positioning_element.cc | 5 +- .../core/svg/svg_text_positioning_element.h | 2 +- .../blink/renderer/core/svg/svg_use_element.cc | 39 +- .../blink/renderer/core/svg/svg_use_element.h | 12 +- .../svg/unsafe_svg_attribute_sanitization_test.cc | 1 - .../third_party/blink/renderer/core/testing/DEPS | 2 + .../renderer/core/testing/core_unit_test_helper.cc | 7 +- .../renderer/core/testing/core_unit_test_helper.h | 4 - .../testing/data/add-frame-in-unload-main.html | 2 + .../testing/data/add-frame-in-unload-subframe.html | 6 + .../composited_selection_bounds_basic_rtl.html | 24 + ...omposited_selection_bounds_vertical_lr_rtl.html | 25 + ...omposited_selection_bounds_vertical_rl_rtl.html | 25 + .../core/testing/data/display_none_frame.html | 5 + .../data/prerender/multiple_prerenders.html | 37 +- .../testing/data/prerender/single_prerender.html | 25 +- .../blink/renderer/core/testing/dictionary_test.cc | 22 +- .../blink/renderer/core/testing/dictionary_test.h | 7 +- .../blink/renderer/core/testing/dummy_modulator.cc | 40 +- .../blink/renderer/core/testing/dummy_modulator.h | 13 +- .../renderer/core/testing/dummy_page_holder.cc | 24 +- .../renderer/core/testing/dummy_page_holder.h | 1 + .../renderer/core/testing/fake_local_frame_host.cc | 36 +- .../renderer/core/testing/fake_local_frame_host.h | 33 +- .../core/testing/fake_remote_frame_host.cc | 16 +- .../renderer/core/testing/fake_remote_frame_host.h | 17 +- .../blink/renderer/core/testing/fake_web_plugin.h | 8 +- .../renderer/core/testing/internal_settings.cc | 33 +- .../blink/renderer/core/testing/internals.cc | 555 ++- .../blink/renderer/core/testing/internals.h | 19 +- .../blink/renderer/core/testing/internals.idl | 15 +- .../testing/intersection_observer_test_helper.h | 61 + .../renderer/core/testing/mock_clipboard_host.cc | 5 + .../renderer/core/testing/mock_clipboard_host.h | 2 + .../renderer/core/testing/mock_function_scope.cc | 66 + .../renderer/core/testing/mock_function_scope.h | 46 + .../core/testing/mock_policy_container_host.cc | 7 + .../core/testing/mock_policy_container_host.h | 14 + .../renderer/core/testing/module_test_base.cc | 31 +- .../blink/renderer/core/testing/module_test_base.h | 18 +- .../core/testing/null_execution_context.cc | 3 +- .../renderer/core/testing/null_execution_context.h | 2 +- .../blink/renderer/core/testing/page_test_base.cc | 4 +- .../core/testing/scoped_fake_ukm_recorder.cc | 53 + .../core/testing/scoped_fake_ukm_recorder.h | 42 + .../core/testing/scoped_mock_overlay_scrollbars.h | 2 +- .../blink/renderer/core/testing/sim/sim_canvas.cc | 24 +- .../blink/renderer/core/testing/sim/sim_canvas.h | 17 +- .../renderer/core/testing/sim/sim_compositor.cc | 15 +- .../renderer/core/testing/sim/sim_compositor.h | 31 +- .../blink/renderer/core/testing/sim/sim_test.cc | 73 +- .../blink/renderer/core/testing/sim/sim_test.h | 40 +- .../core/testing/sim/sim_web_frame_widget.cc | 18 + .../core/testing/sim/sim_web_frame_widget.h | 30 + .../blink/renderer/core/testing/wait_for_event.cc | 4 +- .../blink/renderer/core/timing/DIR_METADATA | 5 + .../third_party/blink/renderer/core/timing/OWNERS | 3 - .../blink/renderer/core/timing/build.gni | 2 - .../blink/renderer/core/timing/event_timing.cc | 8 - .../core/timing/largest_contentful_paint.h | 9 + .../blink/renderer/core/timing/layout_shift.h | 10 +- .../core/timing/layout_shift_attribution.cc | 4 + .../core/timing/layout_shift_attribution.h | 4 + .../renderer/core/timing/measure_memory/OWNERS | 1 + .../core/timing/measure_memory/measure_memory.idl | 11 - .../measure_memory/measure_memory_breakdown.idl | 12 - .../measure_memory/measure_memory_controller.cc | 288 +- .../measure_memory/measure_memory_controller.h | 39 +- .../measure_memory/measure_memory_delegate.cc | 286 -- .../measure_memory/measure_memory_delegate.h | 42 - .../timing/measure_memory/memory_attribution.idl | 12 + .../memory_attribution_container.idl | 11 + .../measure_memory/memory_breakdown_entry.idl | 12 + .../timing/measure_memory/memory_measurement.idl | 11 + .../blink/renderer/core/timing/performance.cc | 48 +- .../blink/renderer/core/timing/performance.h | 15 +- .../blink/renderer/core/timing/performance.idl | 2 +- .../renderer/core/timing/performance_entry.cc | 10 + .../blink/renderer/core/timing/performance_entry.h | 3 + .../core/timing/performance_event_timing.cc | 13 +- .../core/timing/performance_event_timing.h | 2 + .../core/timing/performance_long_task_timing.cc | 10 +- .../core/timing/performance_long_task_timing.h | 15 +- .../blink/renderer/core/timing/performance_mark.h | 3 +- .../renderer/core/timing/performance_measure.h | 2 +- .../core/timing/performance_navigation_timing.cc | 5 +- .../core/timing/performance_navigation_timing.h | 3 +- .../blink/renderer/core/timing/performance_test.cc | 2 + .../renderer/core/timing/performance_timing.cc | 37 +- .../renderer/core/timing/performance_timing.h | 16 +- .../core/timing/performance_user_timing.cc | 4 +- .../blink/renderer/core/timing/profiler_group.cc | 70 +- .../blink/renderer/core/timing/profiler_group.h | 2 +- .../renderer/core/timing/profiler_group_test.cc | 104 +- .../core/timing/task_attribution_timing.cc | 6 +- .../renderer/core/timing/task_attribution_timing.h | 6 +- .../renderer/core/timing/window_performance.cc | 74 +- .../renderer/core/timing/window_performance.h | 23 +- .../core/timing/window_performance_test.cc | 3 +- .../blink/renderer/core/trustedtypes/DIR_METADATA | 3 + .../blink/renderer/core/trustedtypes/OWNERS | 2 - .../renderer/core/trustedtypes/trusted_html.h | 1 + .../renderer/core/trustedtypes/trusted_html.idl | 1 + .../renderer/core/trustedtypes/trusted_script.h | 1 + .../renderer/core/trustedtypes/trusted_script.idl | 1 + .../core/trustedtypes/trusted_script_url.h | 1 + .../core/trustedtypes/trusted_script_url.idl | 1 + .../core/trustedtypes/trusted_type_policy.cc | 4 +- .../core/trustedtypes/trusted_type_policy.h | 1 + .../trustedtypes/trusted_type_policy_factory.cc | 61 +- .../trustedtypes/trusted_type_policy_factory.h | 1 + .../trustedtypes/trusted_type_policy_factory.idl | 2 +- .../core/trustedtypes/trusted_types_util.cc | 36 +- .../core/trustedtypes/trusted_types_util_test.cc | 6 +- .../array_buffer/array_buffer_contents.cc | 28 +- .../core/typed_arrays/array_buffer_view_helpers.h | 4 - .../renderer/core/typed_arrays/dom_array_buffer.cc | 18 + .../renderer/core/typed_arrays/dom_array_buffer.h | 1 + .../core/typed_arrays/dom_array_buffer_base.h | 5 + .../core/typed_arrays/dom_array_buffer_view.h | 11 +- .../renderer/core/typed_arrays/dom_array_piece.cc | 2 +- .../renderer/core/typed_arrays/dom_data_view.cc | 19 + .../renderer/core/typed_arrays/dom_data_view.h | 1 + .../core/typed_arrays/dom_shared_array_buffer.cc | 13 + .../core/typed_arrays/dom_shared_array_buffer.h | 1 + .../renderer/core/typed_arrays/dom_typed_array.cc | 28 + .../renderer/core/typed_arrays/dom_typed_array.h | 1 + .../blink/renderer/core/url/DIR_METADATA | 5 + .../third_party/blink/renderer/core/url/OWNERS | 3 - .../blink/renderer/core/web_test/BUILD.gn | 44 + .../third_party/blink/renderer/core/web_test/DEPS | 4 + .../blink/renderer/core/web_test/OWNERS | 4 + .../web_test/web_test_web_frame_widget_impl.cc | 274 ++ .../core/web_test/web_test_web_frame_widget_impl.h | 112 + .../blink/renderer/core/workers/DIR_METADATA | 5 + .../third_party/blink/renderer/core/workers/OWNERS | 3 - .../blink/renderer/core/workers/README.md | 1 + .../blink/renderer/core/workers/build.gni | 2 + ...s_thread_global_scope_creation_params_copier.cc | 122 + ...ss_thread_global_scope_creation_params_copier.h | 31 + .../renderer/core/workers/dedicated_worker.cc | 44 +- .../blink/renderer/core/workers/dedicated_worker.h | 10 +- .../core/workers/dedicated_worker_global_scope.cc | 39 +- .../core/workers/dedicated_worker_global_scope.h | 30 +- .../workers/dedicated_worker_messaging_proxy.cc | 19 +- .../workers/dedicated_worker_messaging_proxy.h | 10 +- .../core/workers/dedicated_worker_object_proxy.cc | 4 +- .../renderer/core/workers/dedicated_worker_test.cc | 20 +- .../core/workers/dedicated_worker_thread.cc | 17 +- .../core/workers/dedicated_worker_thread.h | 9 +- .../core/workers/global_scope_creation_params.cc | 22 +- .../core/workers/global_scope_creation_params.h | 20 +- .../core/workers/installed_scripts_manager.cc | 2 +- .../core/workers/main_thread_worklet_test.cc | 20 +- .../parent_execution_context_task_runners.h | 1 + .../blink/renderer/core/workers/shared_worker.cc | 2 +- .../core/workers/shared_worker_client_holder.cc | 28 +- .../core/workers/shared_worker_global_scope.cc | 25 +- .../core/workers/shared_worker_global_scope.h | 17 +- .../renderer/core/workers/shared_worker_thread.cc | 10 +- .../renderer/core/workers/shared_worker_thread.h | 5 +- .../core/workers/threaded_messaging_proxy_base.cc | 2 +- .../core/workers/threaded_object_proxy_base.cc | 3 +- .../workers/threaded_worklet_messaging_proxy.cc | 9 +- .../renderer/core/workers/threaded_worklet_test.cc | 28 +- .../core/workers/worker_classic_script_loader.cc | 10 +- .../core/workers/worker_classic_script_loader.h | 2 +- .../renderer/core/workers/worker_global_scope.cc | 58 +- .../renderer/core/workers/worker_global_scope.h | 24 +- .../renderer/core/workers/worker_navigator.cc | 20 +- .../blink/renderer/core/workers/worker_navigator.h | 44 +- .../core/workers/worker_or_worklet_global_scope.cc | 52 +- .../core/workers/worker_or_worklet_global_scope.h | 23 +- .../blink/renderer/core/workers/worker_thread.cc | 24 +- .../blink/renderer/core/workers/worker_thread.h | 2 - .../renderer/core/workers/worker_thread_test.cc | 7 +- .../core/workers/worker_thread_test_helper.h | 24 +- .../renderer/core/workers/worklet_global_scope.cc | 26 +- .../renderer/core/workers/worklet_global_scope.h | 5 +- .../core/workers/worklet_module_responses_map.cc | 11 +- .../core/workers/worklet_module_responses_map.h | 5 +- .../workers/worklet_module_responses_map_test.cc | 59 +- .../blink/renderer/core/xml/DIR_METADATA | 3 + .../third_party/blink/renderer/core/xml/OWNERS | 1 - .../blink/renderer/core/xml/dom_parser.cc | 6 +- .../blink/renderer/core/xml/dom_parser.h | 3 +- .../core/xml/parse_from_string_options.idl | 2 +- .../blink/renderer/core/xml/xpath_grammar.y | 2 +- .../renderer/core/xml/xpath_grammar_generated.cc | 1137 ++--- .../renderer/core/xml/xpath_grammar_generated.h | 706 ++-- .../blink/renderer/core/xml/xslt_processor.cc | 6 +- .../blink/renderer/core/xml/xslt_processor.idl | 4 +- .../renderer/core/xmlhttprequest/DIR_METADATA | 5 + .../blink/renderer/core/xmlhttprequest/OWNERS | 3 - .../core/xmlhttprequest/xml_http_request.cc | 79 +- .../third_party/blink/renderer/modules/BUILD.gn | 85 +- chromium/third_party/blink/renderer/modules/DEPS | 4 + .../blink/renderer/modules/DIR_METADATA | 4 + chromium/third_party/blink/renderer/modules/OWNERS | 3 - .../blink/renderer/modules/accessibility/BUILD.gn | 6 - .../blink/renderer/modules/accessibility/DEPS | 2 + .../renderer/modules/accessibility/DIR_METADATA | 4 + .../blink/renderer/modules/accessibility/OWNERS | 3 - .../accessibility_object_model_test.cc | 89 +- .../renderer/modules/accessibility/ax_enums.h | 4 + .../modules/accessibility/ax_image_map_link.cc | 39 +- .../modules/accessibility/ax_image_map_link.h | 10 +- .../modules/accessibility/ax_inline_text_box.cc | 99 +- .../modules/accessibility/ax_inline_text_box.h | 19 +- .../accessibility/ax_inline_text_box_test.cc | 90 +- .../modules/accessibility/ax_layout_object.cc | 1375 ++----- .../modules/accessibility/ax_layout_object.h | 50 - .../modules/accessibility/ax_layout_object_test.cc | 50 + .../renderer/modules/accessibility/ax_list.cc | 61 - .../blink/renderer/modules/accessibility/ax_list.h | 57 - .../modules/accessibility/ax_media_element.cc | 12 + .../renderer/modules/accessibility/ax_menu_list.cc | 79 +- .../renderer/modules/accessibility/ax_menu_list.h | 3 +- .../modules/accessibility/ax_menu_list_option.cc | 134 +- .../modules/accessibility/ax_menu_list_option.h | 13 +- .../modules/accessibility/ax_menu_list_popup.cc | 49 +- .../modules/accessibility/ax_menu_list_popup.h | 8 +- .../modules/accessibility/ax_mock_object.cc | 10 + .../modules/accessibility/ax_mock_object.h | 12 +- .../modules/accessibility/ax_node_object.cc | 1595 +++++--- .../modules/accessibility/ax_node_object.h | 93 +- .../renderer/modules/accessibility/ax_object.cc | 1498 +++++-- .../renderer/modules/accessibility/ax_object.h | 203 +- .../modules/accessibility/ax_object_cache_impl.cc | 1407 +++++-- .../modules/accessibility/ax_object_cache_impl.h | 126 +- .../modules/accessibility/ax_object_cache_test.cc | 10 +- .../modules/accessibility/ax_object_test.cc | 16 + .../renderer/modules/accessibility/ax_position.cc | 3 + .../modules/accessibility/ax_position_test.cc | 61 +- .../modules/accessibility/ax_radio_input.cc | 132 - .../modules/accessibility/ax_radio_input.h | 51 - .../modules/accessibility/ax_relation_cache.cc | 163 +- .../modules/accessibility/ax_relation_cache.h | 21 +- .../modules/accessibility/ax_selection_test.cc | 4 - .../renderer/modules/accessibility/ax_slider.cc | 53 - .../renderer/modules/accessibility/ax_slider.h | 19 - .../accessibility/ax_sparse_attribute_setter.cc | 329 +- .../accessibility/ax_sparse_attribute_setter.h | 51 +- .../renderer/modules/accessibility/ax_svg_root.cc | 77 - .../renderer/modules/accessibility/ax_svg_root.h | 58 - .../modules/accessibility/ax_validation_message.cc | 8 +- .../modules/accessibility/ax_validation_message.h | 5 +- .../modules/accessibility/ax_virtual_object.cc | 31 +- .../modules/accessibility/ax_virtual_object.h | 3 +- .../accessibility/inspector_accessibility_agent.cc | 220 +- .../accessibility/inspector_accessibility_agent.h | 9 + .../accessibility/inspector_type_builder_helper.cc | 2 + .../testing/accessibility_selection_test.cc | 6 +- .../data/selection/paragraph-presentational-ax.txt | 3 +- .../testing/data/selection/table-ax.txt | 172 +- .../renderer/modules/animationworklet/DIR_METADATA | 4 + .../blink/renderer/modules/animationworklet/OWNERS | 3 - .../animation_worklet_global_scope_test.cc | 11 +- .../animation_worklet_messaging_proxy.h | 3 +- .../animation_worklet_proxy_client.cc | 20 +- .../animation_worklet_proxy_client_test.cc | 9 +- .../modules/animationworklet/worklet_animation.cc | 12 +- .../modules/animationworklet/worklet_animation.h | 1 + .../animationworklet/worklet_animation_test.cc | 18 +- .../blink/renderer/modules/app_banner/DIR_METADATA | 4 + .../blink/renderer/modules/app_banner/OWNERS | 6 +- .../modules/app_banner/app_banner_controller.cc | 2 +- .../modules/audio_output_devices/DIR_METADATA | 3 + .../renderer/modules/audio_output_devices/OWNERS | 2 - .../html_media_element_audio_output_device.cc | 48 +- .../html_media_element_audio_output_device.h | 15 +- .../renderer/modules/background_fetch/DIR_METADATA | 4 + .../blink/renderer/modules/background_fetch/OWNERS | 3 - .../background_fetch/background_fetch_bridge.cc | 12 +- .../background_fetch_icon_loader_test.cc | 4 +- .../background_fetch/background_fetch_manager.cc | 5 +- .../renderer/modules/background_sync/DIR_METADATA | 3 + .../blink/renderer/modules/background_sync/OWNERS | 3 +- .../blink/renderer/modules/badging/DIR_METADATA | 4 + .../blink/renderer/modules/badging/OWNERS | 3 - .../blink/renderer/modules/battery/BUILD.gn | 2 - .../renderer/modules/battery/battery_dispatcher.cc | 14 +- .../renderer/modules/battery/battery_dispatcher.h | 6 +- .../renderer/modules/battery/battery_manager.cc | 50 +- .../renderer/modules/battery/battery_manager.h | 12 +- .../renderer/modules/battery/navigator_battery.cc | 63 - .../renderer/modules/battery/navigator_battery.h | 38 - .../renderer/modules/battery/navigator_battery.idl | 2 +- .../blink/renderer/modules/beacon/DIR_METADATA | 4 + .../blink/renderer/modules/beacon/OWNERS | 3 - .../renderer/modules/beacon/navigator_beacon.cc | 11 +- .../blink/renderer/modules/bluetooth/DIR_METADATA | 4 + .../blink/renderer/modules/bluetooth/OWNERS | 3 - .../blink/renderer/modules/bluetooth/bluetooth.cc | 6 +- .../renderer/modules/bluetooth/bluetooth_device.cc | 6 - .../renderer/modules/broadcastchannel/DIR_METADATA | 4 + .../blink/renderer/modules/broadcastchannel/OWNERS | 3 - .../modules/broadcastchannel/broadcast_channel.cc | 2 +- .../blink/renderer/modules/buckets/BUILD.gn | 14 + .../blink/renderer/modules/buckets/DEPS | 5 + .../blink/renderer/modules/buckets/OWNERS | 1 + .../blink/renderer/modules/buckets/idls.gni | 15 + .../modules/buckets/navigator_storage_buckets.idl | 14 + .../renderer/modules/buckets/storage_bucket.cc | 206 + .../renderer/modules/buckets/storage_bucket.h | 75 + .../renderer/modules/buckets/storage_bucket.idl | 22 + .../modules/buckets/storage_bucket_manager.cc | 169 + .../modules/buckets/storage_bucket_manager.h | 65 + .../modules/buckets/storage_bucket_manager.idl | 18 + .../modules/buckets/storage_bucket_options.idl | 18 + .../buckets/worker_navigator_storage_buckets.idl | 14 + .../renderer/modules/cache_storage/DIR_METADATA | 4 + .../blink/renderer/modules/cache_storage/OWNERS | 3 - .../blink/renderer/modules/cache_storage/cache.cc | 9 +- .../blink/renderer/modules/cache_storage/cache.h | 1 + .../modules/cache_storage/cache_storage.cc | 11 +- .../cache_storage_blob_client_list.cc | 8 +- .../cache_storage/cache_storage_blob_client_list.h | 5 +- .../renderer/modules/cache_storage/cache_test.cc | 32 +- .../renderer/modules/cache_storage/cache_utils.cc | 3 +- .../blink/renderer/modules/canvas/BUILD.gn | 13 + .../blink/renderer/modules/canvas/DIR_METADATA | 4 + .../blink/renderer/modules/canvas/OWNERS | 3 - .../canvas/canvas2d/base_rendering_context_2d.cc | 786 ++-- .../canvas/canvas2d/base_rendering_context_2d.h | 103 +- .../canvas/canvas2d/canvas_formatted_text.cc | 187 + .../canvas/canvas2d/canvas_formatted_text.h | 129 + .../canvas/canvas2d/canvas_formatted_text.idl | 24 + .../canvas/canvas2d/canvas_formatted_text_run.cc | 34 + .../canvas/canvas2d/canvas_formatted_text_run.h | 50 + .../canvas/canvas2d/canvas_formatted_text_run.idl | 12 + .../canvas/canvas2d/canvas_image_source_util.cc | 82 + .../canvas/canvas2d/canvas_image_source_util.h | 24 + .../modules/canvas/canvas2d/canvas_path.cc | 5 +- .../canvas/canvas2d/canvas_rendering_context_2d.cc | 101 +- .../canvas/canvas2d/canvas_rendering_context_2d.h | 46 +- .../canvas2d/canvas_rendering_context_2d.idl | 29 +- .../canvas2d/canvas_rendering_context_2d_state.cc | 24 +- .../canvas2d/canvas_rendering_context_2d_state.h | 10 + .../canvas2d/canvas_rendering_context_2d_test.cc | 77 +- .../modules/canvas/canvas2d/canvas_style.cc | 6 +- .../htmlcanvas/html_canvas_element_module_test.cc | 2 +- .../blink/renderer/modules/canvas/idls.gni | 4 + .../canvas/imagebitmap/image_bitmap_factories.cc | 384 ++ .../canvas/imagebitmap/image_bitmap_factories.h | 213 + .../image_bitmap_rendering_context_base.cc | 3 +- .../canvas/imagebitmap/image_bitmap_source_union.h | 17 + .../imagebitmap/window_create_image_bitmap.idl | 24 + .../imagebitmap/worker_create_image_bitmap.idl | 13 + .../offscreencanvas/offscreen_canvas_test.cc | 2 +- .../offscreen_canvas_rendering_context_2d.cc | 48 +- .../offscreen_canvas_rendering_context_2d.h | 8 +- .../offscreen_canvas_rendering_context_2d.idl | 21 +- .../blink/renderer/modules/clipboard/DIR_METADATA | 4 + .../blink/renderer/modules/clipboard/OWNERS | 3 - .../modules/clipboard/clipboard_promise.cc | 11 +- .../renderer/modules/clipboard/clipboard_promise.h | 4 +- .../renderer/modules/clipboard/clipboard_reader.cc | 8 +- .../renderer/modules/clipboard/clipboard_reader.h | 13 +- .../renderer/modules/clipboard/clipboard_writer.cc | 49 +- .../renderer/modules/clipboard/clipboard_writer.h | 77 +- .../renderer/modules/compression/DIR_METADATA | 4 + .../blink/renderer/modules/compression/OWNERS | 3 - .../modules/compression/deflate_transformer.cc | 2 +- .../modules/compression/deflate_transformer.h | 4 +- .../modules/compression/inflate_transformer.cc | 2 +- .../modules/compression/inflate_transformer.h | 4 +- .../renderer/modules/contacts_picker/DIR_METADATA | 4 + .../blink/renderer/modules/contacts_picker/OWNERS | 3 - .../renderer/modules/content_index/DIR_METADATA | 4 + .../blink/renderer/modules/content_index/OWNERS | 3 - .../blink/renderer/modules/cookie_store/BUILD.gn | 2 - .../renderer/modules/cookie_store/DIR_METADATA | 4 + .../blink/renderer/modules/cookie_store/OWNERS | 3 - .../modules/cookie_store/cookie_change_event.idl | 3 +- .../cookie_store/cookie_change_event_init.idl | 2 +- .../renderer/modules/cookie_store/cookie_store.cc | 1 + .../renderer/modules/cookie_store/cookie_store.idl | 1 - .../cookie_store/cookie_store_delete_options.idl | 2 +- .../cookie_store/cookie_store_get_options.idl | 2 +- .../modules/cookie_store/cookie_store_manager.cc | 35 +- .../modules/cookie_store/cookie_store_manager.h | 14 +- .../modules/cookie_store/cookie_store_manager.idl | 2 +- .../extendable_cookie_change_event.idl | 5 +- .../service_worker_global_scope_cookie_store.idl | 3 +- .../service_worker_registration_cookies.cc | 85 - .../service_worker_registration_cookies.h | 24 - .../service_worker_registration_cookies.idl | 3 +- .../modules/cookie_store/window_cookie_store.idl | 3 +- .../renderer/modules/credentialmanager/BUILD.gn | 2 - .../modules/credentialmanager/DIR_METADATA | 4 + .../renderer/modules/credentialmanager/OWNERS | 3 - .../credential_manager_type_converters.cc | 67 +- .../credential_manager_type_converters.h | 6 +- .../credentialmanager/credential_metrics.cc | 60 - .../modules/credentialmanager/credential_metrics.h | 47 - .../credential_request_options.idl | 3 + .../credentialmanager/credentials_container.cc | 305 +- .../credentials_container_test.cc | 12 +- .../credentialmanager/public_key_credential.cc | 8 +- .../blink/renderer/modules/crypto/DIR_METADATA | 3 + .../blink/renderer/modules/crypto/OWNERS | 1 - .../blink/renderer/modules/crypto/crypto.cc | 12 +- .../blink/renderer/modules/crypto/subtle_crypto.cc | 2 +- .../blink/renderer/modules/csspaint/BUILD.gn | 9 +- .../blink/renderer/modules/csspaint/DIR_METADATA | 4 + .../blink/renderer/modules/csspaint/OWNERS | 3 - .../blink/renderer/modules/csspaint/README.md | 85 +- .../background_color_paint_image_generator_impl.cc | 55 + .../background_color_paint_image_generator_impl.h | 46 + .../csspaint/background_color_paint_worklet.cc | 288 ++ .../csspaint/background_color_paint_worklet.h | 56 + .../background_color_paint_worklet_test.cc | 272 ++ .../csspaint/native_paint_image_generator_impl.cc | 37 - .../csspaint/native_paint_image_generator_impl.h | 36 - .../modules/csspaint/native_paint_worklet.cc | 57 +- .../modules/csspaint/native_paint_worklet.h | 44 +- .../csspaint/native_paint_worklet_proxy_client.h | 39 + .../modules/csspaint/paint_rendering_context_2d.cc | 4 + .../modules/csspaint/paint_rendering_context_2d.h | 1 + .../csspaint/paint_rendering_context_2d.idl | 13 +- .../renderer/modules/csspaint/paint_worklet.cc | 13 +- .../csspaint/paint_worklet_global_scope_proxy.cc | 5 +- .../modules/csspaint/paint_worklet_id_generator.cc | 25 + .../modules/csspaint/paint_worklet_id_generator.h | 19 + .../csspaint/paint_worklet_messaging_proxy.h | 3 +- .../modules/csspaint/paint_worklet_proxy_client.cc | 8 +- .../delegated_ink/delegated_ink_trail_presenter.cc | 16 +- .../delegated_ink_trail_presenter_unittest.cc | 48 +- .../blink/renderer/modules/device/BUILD.gn | 14 + .../blink/renderer/modules/device/OWNERS | 2 + .../renderer/modules/device/device_service.cc | 219 + .../blink/renderer/modules/device/device_service.h | 96 + .../renderer/modules/device/device_service.idl | 21 + .../blink/renderer/modules/device/idls.gni | 7 + .../renderer/modules/device/navigator_device.idl | 12 + .../modules/device_orientation/DIR_METADATA | 4 + .../renderer/modules/device_orientation/OWNERS | 3 - .../device_motion_event_pump_unittest.cc | 5 +- .../device_orientation_absolute_controller.cc | 2 - .../device_orientation_controller.cc | 4 +- .../device_orientation_event_pump_unittest.cc | 20 +- .../device_orientation/device_sensor_event_pump.cc | 1 + .../device_orientation/device_sensor_event_pump.h | 2 +- .../blink/renderer/modules/direct_sockets/BUILD.gn | 30 + .../renderer/modules/direct_sockets/DIR_METADATA | 3 + .../blink/renderer/modules/direct_sockets/OWNERS | 2 - .../modules/direct_sockets/navigator_socket.cc | 10 +- .../direct_sockets/tcp_readable_stream_wrapper.cc | 252 ++ .../direct_sockets/tcp_readable_stream_wrapper.h | 114 + .../tcp_readable_stream_wrapper_unittest.cc | 209 + .../renderer/modules/direct_sockets/tcp_socket.cc | 126 +- .../renderer/modules/direct_sockets/tcp_socket.h | 19 + .../renderer/modules/direct_sockets/tcp_socket.idl | 10 +- .../modules/direct_sockets/tcp_socket_unittest.cc | 171 + .../direct_sockets/tcp_writable_stream_wrapper.cc | 372 ++ .../direct_sockets/tcp_writable_stream_wrapper.h | 151 + .../tcp_writable_stream_wrapper_unittest.cc | 256 ++ .../renderer/modules/direct_sockets/udp_socket.cc | 2 +- .../modules/document_metadata/DIR_METADATA | 4 + .../renderer/modules/document_metadata/OWNERS | 5 - .../blink/renderer/modules/encoding/DIR_METADATA | 3 + .../blink/renderer/modules/encoding/OWNERS | 2 - .../renderer/modules/encoding/text_decoder.cc | 28 +- .../modules/encoding/text_decoder_stream.cc | 2 +- .../modules/encoding/text_decoder_stream.h | 2 +- .../renderer/modules/encoding/text_encoder.cc | 6 +- .../modules/encoding/text_encoder_stream.h | 2 +- .../renderer/modules/encryptedmedia/DIR_METADATA | 3 + .../blink/renderer/modules/encryptedmedia/OWNERS | 2 - .../html_media_element_encrypted_media.cc | 3 +- .../modules/encryptedmedia/media_key_session.cc | 1 + .../modules/encryptedmedia/media_key_session.h | 2 +- .../encryptedmedia/media_key_system_access.cc | 3 +- .../media_key_system_access_initializer_base.cc | 3 +- .../renderer/modules/encryptedmedia/media_keys.cc | 1 + .../renderer/modules/encryptedmedia/media_keys.h | 2 +- .../navigator_request_media_key_system_access.cc | 2 +- .../modules/event_target_modules_names.json5 | 4 + .../renderer/modules/eventsource/DIR_METADATA | 4 + .../blink/renderer/modules/eventsource/OWNERS | 3 - .../renderer/modules/eventsource/event_source.cc | 1 + .../renderer/modules/eventsource/event_source.h | 2 +- .../blink/renderer/modules/exported/BUILD.gn | 1 + .../renderer/modules/exported/web_ax_object.cc | 277 +- .../modules/exported/web_embedded_worker_impl.cc | 17 +- .../modules/exported/web_testing_support.cc | 12 +- .../blink/renderer/modules/eyedropper/BUILD.gn | 14 + .../blink/renderer/modules/eyedropper/OWNERS | 1 + .../modules/eyedropper/color_select_event.cc | 42 + .../modules/eyedropper/color_select_event.h | 41 + .../modules/eyedropper/color_select_event.idl | 12 + .../modules/eyedropper/color_select_event_init.idl | 9 + .../renderer/modules/eyedropper/eye_dropper.cc | 48 + .../renderer/modules/eyedropper/eye_dropper.h | 59 + .../renderer/modules/eyedropper/eye_dropper.idl | 19 + .../blink/renderer/modules/eyedropper/idls.gni | 10 + .../renderer/modules/file_system_access/BUILD.gn | 42 +- .../modules/file_system_access/DIR_METADATA | 4 + .../renderer/modules/file_system_access/OWNERS | 3 - .../data_transfer_item_file_system_access.cc | 83 + .../data_transfer_item_file_system_access.h | 24 + .../data_transfer_item_file_system_access.idl | 12 + .../data_transfer_item_native_file_system.cc | 83 - .../data_transfer_item_native_file_system.h | 24 - .../data_transfer_item_native_file_system.idl | 10 - .../directory_picker_options.idl | 4 +- .../file_system_access/file_picker_accept_type.idl | 2 +- .../file_system_access/file_picker_options.idl | 13 +- .../file_system_access/file_system_access_error.cc | 69 + .../file_system_access/file_system_access_error.h | 28 + .../file_system_create_writable_options.idl | 9 + .../file_system_create_writer_options.idl | 8 - .../file_system_directory_handle.cc | 270 ++ .../file_system_directory_handle.h | 77 + .../file_system_directory_handle.idl | 11 +- .../file_system_directory_iterator.cc | 110 + .../file_system_directory_iterator.h | 65 + .../file_system_directory_iterator.idl | 14 + .../file_system_access/file_system_file_handle.cc | 151 + .../file_system_access/file_system_file_handle.h | 59 + .../file_system_access/file_system_file_handle.idl | 9 +- .../file_system_get_directory_options.idl | 2 +- .../file_system_get_file_options.idl | 2 +- .../file_system_access/file_system_handle.cc | 119 + .../file_system_access/file_system_handle.h | 70 + .../file_system_access/file_system_handle.idl | 10 +- .../file_system_handle_permission_descriptor.idl | 4 +- .../file_system_remove_options.idl | 2 +- .../file_system_underlying_sink.cc | 483 +++ .../file_system_underlying_sink.h | 65 + .../file_system_writable_file_stream.cc | 117 + .../file_system_writable_file_stream.h | 45 + .../file_system_writable_file_stream.idl | 6 +- .../global_file_system_access.cc | 452 ++ .../file_system_access/global_file_system_access.h | 41 + .../global_file_system_access_test.cc | 233 ++ .../global_native_file_system.cc | 314 -- .../file_system_access/global_native_file_system.h | 41 - .../global_native_file_system_test.cc | 234 -- .../renderer/modules/file_system_access/idls.gni | 10 +- .../native_file_system_directory_handle.cc | 274 -- .../native_file_system_directory_handle.h | 77 - .../native_file_system_directory_iterator.cc | 111 - .../native_file_system_directory_iterator.h | 65 - .../native_file_system_directory_iterator.idl | 14 - .../file_system_access/native_file_system_error.cc | 69 - .../file_system_access/native_file_system_error.h | 28 - .../native_file_system_file_handle.cc | 152 - .../native_file_system_file_handle.h | 59 - .../native_file_system_handle.cc | 121 - .../file_system_access/native_file_system_handle.h | 72 - .../native_file_system_underlying_sink.cc | 271 -- .../native_file_system_underlying_sink.h | 69 - .../native_file_system_writable_file_stream.cc | 130 - .../native_file_system_writable_file_stream.h | 46 - .../open_file_picker_options.idl | 2 +- .../save_file_picker_options.idl | 3 +- .../storage_manager_file_system_access.cc | 122 + .../storage_manager_file_system_access.h | 29 + .../storage_manager_file_system_access.idl | 13 + .../storage_manager_native_file_system.cc | 122 - .../storage_manager_native_file_system.h | 29 - .../storage_manager_native_file_system.idl | 13 - .../window_file_system_access.idl | 20 + .../window_native_file_system.idl | 21 - .../modules/file_system_access/write_params.idl | 4 +- .../blink/renderer/modules/filesystem/DIR_METADATA | 4 + .../blink/renderer/modules/filesystem/OWNERS | 3 - .../filesystem/data_transfer_item_file_system.cc | 10 +- .../renderer/modules/filesystem/dom_file_system.cc | 4 +- .../filesystem/dom_file_system_base_test.cc | 7 +- .../filesystem/html_input_element_file_system.cc | 8 +- .../modules/filesystem/local_file_system.cc | 14 +- .../blink/renderer/modules/font_access/BUILD.gn | 2 - .../renderer/modules/font_access/DIR_METADATA | 4 + .../blink/renderer/modules/font_access/OWNERS | 3 - .../renderer/modules/font_access/font_iterator.cc | 140 - .../renderer/modules/font_access/font_iterator.h | 56 - .../renderer/modules/font_access/font_iterator.idl | 15 - .../modules/font_access/font_iterator_entry.idl | 11 - .../renderer/modules/font_access/font_manager.cc | 172 +- .../renderer/modules/font_access/font_manager.h | 31 +- .../renderer/modules/font_access/font_manager.idl | 3 +- .../renderer/modules/font_access/font_metadata.cc | 3 +- .../renderer/modules/font_access/font_metadata.h | 6 +- .../renderer/modules/font_access/font_metadata.idl | 1 + .../blink/renderer/modules/font_access/idls.gni | 6 +- .../modules/font_access/navigator_fonts.cc | 8 +- .../renderer/modules/font_access/query_options.idl | 4 +- .../blink/renderer/modules/gamepad/DEPS | 1 + .../blink/renderer/modules/gamepad/DIR_METADATA | 4 + .../blink/renderer/modules/gamepad/OWNERS | 3 - .../blink/renderer/modules/gamepad/gamepad.cc | 10 +- .../renderer/modules/gamepad/gamepad_dispatcher.cc | 18 +- .../renderer/modules/gamepad/gamepad_dispatcher.h | 2 +- .../renderer/modules/gamepad/navigator_gamepad.cc | 2 +- .../renderer/modules/geolocation/DIR_METADATA | 4 + .../blink/renderer/modules/geolocation/OWNERS | 3 - .../renderer/modules/geolocation/geo_notifier.cc | 1 + .../renderer/modules/geolocation/geo_notifier.h | 2 +- .../renderer/modules/geolocation/geolocation.cc | 47 +- .../renderer/modules/geolocation/geolocation.h | 40 +- .../blink/renderer/modules/handwriting/BUILD.gn | 20 + .../blink/renderer/modules/handwriting/OWNERS | 4 + .../modules/handwriting/handwriting_drawing.cc | 115 + .../modules/handwriting/handwriting_drawing.h | 55 + .../modules/handwriting/handwriting_drawing.idl | 18 + .../handwriting/handwriting_drawing_segment.idl | 12 + .../handwriting/handwriting_feature_query.idl | 11 + .../handwriting_feature_query_result.idl | 11 + .../modules/handwriting/handwriting_hints.idl | 12 + .../handwriting/handwriting_model_constraint.idl | 9 + .../modules/handwriting/handwriting_point.idl | 12 + .../modules/handwriting/handwriting_prediction.idl | 10 + .../handwriting/handwriting_recognition_service.cc | 165 + .../handwriting/handwriting_recognition_service.h | 67 + .../modules/handwriting/handwriting_recognizer.cc | 78 + .../modules/handwriting/handwriting_recognizer.h | 62 + .../modules/handwriting/handwriting_recognizer.idl | 16 + .../modules/handwriting/handwriting_segment.idl | 12 + .../modules/handwriting/handwriting_stroke.cc | 40 + .../modules/handwriting/handwriting_stroke.h | 43 + .../modules/handwriting/handwriting_stroke.idl | 22 + .../handwriting/handwriting_type_converters.cc | 204 + .../handwriting/handwriting_type_converters.h | 113 + .../handwriting_type_converters_unittest.cc | 246 ++ .../blink/renderer/modules/handwriting/idls.gni | 23 + .../navigator_handwriting_recognition_service.idl | 19 + .../blink/renderer/modules/hid/DIR_METADATA | 4 + .../third_party/blink/renderer/modules/hid/OWNERS | 3 - .../third_party/blink/renderer/modules/hid/hid.cc | 4 +- .../renderer/modules/hid/hid_collection_info.idl | 3 + .../blink/renderer/modules/hid/hid_device.cc | 25 +- .../blink/renderer/modules/hid/hid_device.h | 5 + .../blink/renderer/modules/hid/hid_device.idl | 1 + .../blink/renderer/modules/hid/hid_report_item.idl | 26 + .../blink/renderer/modules/idle/DIR_METADATA | 1 + .../third_party/blink/renderer/modules/idle/OWNERS | 2 - .../blink/renderer/modules/idle/idle_detector.cc | 3 +- .../image_downloader/image_downloader_impl.cc | 9 +- .../multi_resolution_image_resource_fetcher.cc | 14 +- .../multi_resolution_image_resource_fetcher.h | 13 +- .../renderer/modules/imagecapture/DIR_METADATA | 4 + .../blink/renderer/modules/imagecapture/OWNERS | 3 - .../renderer/modules/imagecapture/image_capture.cc | 195 +- .../renderer/modules/imagecapture/image_capture.h | 5 +- .../imagecapture/image_capture_frame_grabber.cc | 42 +- .../blink/renderer/modules/indexeddb/BUILD.gn | 6 - .../blink/renderer/modules/indexeddb/DIR_METADATA | 4 + .../blink/renderer/modules/indexeddb/OWNERS | 3 - .../blink/renderer/modules/indexeddb/idb_any.cc | 10 +- .../blink/renderer/modules/indexeddb/idb_any.h | 9 +- .../blink/renderer/modules/indexeddb/idb_cursor.cc | 2 + .../modules/indexeddb/idb_cursor_with_value.cc | 2 + .../renderer/modules/indexeddb/idb_database.cc | 66 +- .../renderer/modules/indexeddb/idb_database.h | 20 +- .../modules/indexeddb/idb_database_callbacks.cc | 13 +- .../modules/indexeddb/idb_database_callbacks.h | 7 +- .../modules/indexeddb/idb_database_error.h | 2 + .../renderer/modules/indexeddb/idb_factory.cc | 47 +- .../blink/renderer/modules/indexeddb/idb_factory.h | 6 +- .../renderer/modules/indexeddb/idb_factory_test.cc | 7 +- .../blink/renderer/modules/indexeddb/idb_index.cc | 2 + .../blink/renderer/modules/indexeddb/idb_key.h | 8 +- .../renderer/modules/indexeddb/idb_key_range.h | 3 + .../renderer/modules/indexeddb/idb_metadata.cc | 2 + .../modules/indexeddb/idb_name_and_version.h | 4 + .../renderer/modules/indexeddb/idb_object_store.cc | 6 +- .../renderer/modules/indexeddb/idb_object_store.h | 1 + .../renderer/modules/indexeddb/idb_observation.cc | 90 - .../renderer/modules/indexeddb/idb_observation.h | 55 - .../renderer/modules/indexeddb/idb_observation.idl | 22 - .../renderer/modules/indexeddb/idb_observer.cc | 109 - .../renderer/modules/indexeddb/idb_observer.h | 48 - .../renderer/modules/indexeddb/idb_observer.idl | 16 - .../modules/indexeddb/idb_observer_changes.cc | 59 - .../modules/indexeddb/idb_observer_changes.h | 47 - .../modules/indexeddb/idb_observer_changes.idl | 16 - .../modules/indexeddb/idb_observer_init.idl | 12 - .../modules/indexeddb/idb_open_db_request.cc | 5 +- .../renderer/modules/indexeddb/idb_request.cc | 13 - .../blink/renderer/modules/indexeddb/idb_request.h | 14 +- .../modules/indexeddb/idb_request_loader.cc | 2 + .../renderer/modules/indexeddb/idb_request_test.cc | 11 +- .../renderer/modules/indexeddb/idb_test_helper.h | 2 + .../renderer/modules/indexeddb/idb_transaction.cc | 2 +- .../renderer/modules/indexeddb/idb_transaction.h | 1 + .../modules/indexeddb/idb_transaction_test.cc | 9 +- .../blink/renderer/modules/indexeddb/idb_value.cc | 6 +- .../blink/renderer/modules/indexeddb/idb_value.h | 23 +- .../modules/indexeddb/idb_value_wrapping.cc | 4 +- .../modules/indexeddb/idb_value_wrapping.h | 9 +- .../blink/renderer/modules/indexeddb/idls.gni | 4 - .../indexeddb/indexed_db_blink_mojom_traits.cc | 23 +- .../indexeddb/indexed_db_blink_mojom_traits.h | 1 + .../indexed_db_blink_mojom_traits_test.cc | 1 + .../indexed_db_database_callbacks_impl.cc | 41 - .../indexeddb/indexed_db_database_callbacks_impl.h | 9 +- .../modules/indexeddb/indexed_db_names.json5 | 6 - .../indexeddb/inspector_indexed_db_agent.cc | 78 +- .../modules/indexeddb/inspector_indexed_db_agent.h | 2 + .../modules/indexeddb/mock_web_idb_callbacks.h | 13 +- .../modules/indexeddb/mock_web_idb_database.h | 11 - .../modules/indexeddb/web_idb_callbacks_impl.cc | 14 - .../modules/indexeddb/web_idb_callbacks_impl.h | 1 - .../modules/indexeddb/web_idb_cursor_impl.cc | 1 + .../modules/indexeddb/web_idb_cursor_impl.h | 8 +- .../indexeddb/web_idb_cursor_impl_unittest.cc | 8 +- .../renderer/modules/indexeddb/web_idb_database.h | 10 +- .../modules/indexeddb/web_idb_database_callbacks.h | 11 - .../indexeddb/web_idb_database_callbacks_impl.cc | 11 - .../indexeddb/web_idb_database_callbacks_impl.h | 3 - .../modules/indexeddb/web_idb_database_impl.cc | 20 +- .../modules/indexeddb/web_idb_database_impl.h | 10 +- .../modules/indexeddb/web_idb_transaction.h | 1 - .../indexeddb/web_idb_transaction_impl_unittest.cc | 1 + .../blink/renderer/modules/installedapp/BUILD.gn | 5 +- .../blink/renderer/modules/installedapp/DEPS | 3 + .../renderer/modules/installedapp/DIR_METADATA | 3 + .../blink/renderer/modules/installedapp/OWNERS | 2 - .../installedapp/installed_app_controller.cc | 9 +- .../installedapp/installed_app_controller_test.cc | 4 +- .../blink/renderer/modules/launch/DIR_METADATA | 4 + .../blink/renderer/modules/launch/OWNERS | 5 +- .../modules/launch/dom_window_launch_queue.cc | 5 +- .../modules/launch/dom_window_launch_queue.h | 4 +- .../modules/launch/file_handling_expiry_impl.cc | 2 +- .../blink/renderer/modules/launch/launch_params.cc | 7 +- .../blink/renderer/modules/launch/launch_params.h | 11 +- .../blink/renderer/modules/launch/launch_queue.cc | 1 - .../blink/renderer/modules/launch/launch_queue.h | 2 +- .../modules/launch/web_launch_service_impl.cc | 8 +- .../modules/launch/web_launch_service_impl.h | 4 +- .../blink/renderer/modules/locks/BUILD.gn | 2 - .../blink/renderer/modules/locks/DIR_METADATA | 4 + .../blink/renderer/modules/locks/OWNERS | 3 - .../blink/renderer/modules/locks/lock_manager.cc | 24 +- .../blink/renderer/modules/locks/lock_manager.h | 10 +- .../renderer/modules/locks/navigator_locks.cc | 75 - .../blink/renderer/modules/locks/navigator_locks.h | 27 - .../renderer/modules/locks/navigator_locks.idl | 4 +- .../modules/locks/worker_navigator_locks.idl | 4 +- .../blink/renderer/modules/manifest/OWNERS | 3 + .../renderer/modules/manifest/manifest_manager.cc | 9 + .../renderer/modules/manifest/manifest_manager.h | 1 + .../renderer/modules/manifest/manifest_parser.cc | 94 +- .../renderer/modules/manifest/manifest_parser.h | 11 +- .../modules/manifest/manifest_parser_unittest.cc | 179 +- .../modules/manifest/manifest_type_converters.cc | 13 +- .../blink/renderer/modules/media/DIR_METADATA | 3 + .../blink/renderer/modules/media/OWNERS | 4 +- .../media/audio/audio_renderer_mixer_manager.h | 2 +- .../media/audio/audio_renderer_sink_cache.cc | 2 +- .../media/audio/web_audio_device_factory.cc | 2 +- .../modules/media/webmediaplayer_util_unittest.cc | 14 +- .../renderer/modules/media_capabilities/BUILD.gn | 4 - .../blink/renderer/modules/media_capabilities/DEPS | 1 - .../modules/media_capabilities/DIR_METADATA | 4 + .../renderer/modules/media_capabilities/OWNERS | 3 - .../media_capabilities/media_capabilities.cc | 47 +- .../media_capabilities/media_capabilities.h | 13 +- .../media_capabilities_fuzzer.cc | 6 +- .../media_capabilities/media_capabilities_test.cc | 30 +- .../navigator_media_capabilities.cc | 47 - .../navigator_media_capabilities.h | 38 - .../navigator_media_capabilities.idl | 2 +- .../worker_navigator_media_capabilities.cc | 50 - .../worker_navigator_media_capabilities.h | 39 - .../worker_navigator_media_capabilities.idl | 2 +- .../renderer/modules/media_controls/DIR_METADATA | 4 + .../blink/renderer/modules/media_controls/OWNERS | 4 - .../elements/media_control_cast_button_element.cc | 3 + ...isplay_cutout_fullscreen_button_element_test.cc | 6 +- .../elements/media_control_input_element_test.cc | 2 +- .../modules/media_controls/media_controls_impl.cc | 4 + .../modules/media_controls/media_controls_impl.h | 8 +- .../media_controls/media_controls_impl_test.cc | 18 +- ...edia_controls_orientation_lock_delegate_test.cc | 133 +- ...media_controls_rotate_to_fullscreen_delegate.cc | 13 +- ..._controls_rotate_to_fullscreen_delegate_test.cc | 63 +- .../media_controls/resources/ic_no_source_dark.svg | 5 + .../resources/ic_no_source_white.svg | 5 - .../media_controls/resources/ic_pause_dark.svg | 4 + .../resources/ic_play_arrow_dark.svg | 4 + .../media_controls/resources/mediaControls.css | 43 +- .../resources/mediaControls_Android.css | 1 + .../modules/mediacapturefromelement/DIR_METADATA | 4 + .../modules/mediacapturefromelement/OWNERS | 3 - .../canvas_capture_handler.cc | 55 +- .../canvas_capture_handler_unittest.cc | 18 +- .../html_audio_element_capturer_source_unittest.cc | 14 +- .../html_media_element_capture.cc | 4 +- .../html_video_element_capturer_source.cc | 2 +- .../html_video_element_capturer_source_unittest.cc | 27 +- .../timed_canvas_draw_listener.cc | 1 + .../timed_canvas_draw_listener.h | 2 +- .../renderer/modules/mediarecorder/DIR_METADATA | 4 + .../blink/renderer/modules/mediarecorder/OWNERS | 3 - .../mediarecorder/audio_track_opus_encoder.cc | 10 +- .../mediarecorder/audio_track_opus_encoder.h | 8 +- .../modules/mediarecorder/audio_track_recorder.cc | 13 +- .../modules/mediarecorder/audio_track_recorder.h | 8 +- .../mediarecorder/audio_track_recorder_unittest.cc | 74 +- .../renderer/modules/mediarecorder/h264_encoder.cc | 18 +- .../modules/mediarecorder/media_recorder.cc | 30 +- .../modules/mediarecorder/media_recorder.h | 1 + .../modules/mediarecorder/media_recorder.idl | 1 + .../mediarecorder/media_recorder_handler.cc | 73 +- .../modules/mediarecorder/media_recorder_handler.h | 11 +- .../media_recorder_handler_unittest.cc | 54 +- .../mediarecorder/media_recorder_options.idl | 3 + .../renderer/modules/mediarecorder/vea_encoder.cc | 13 +- .../modules/mediarecorder/video_track_recorder.cc | 149 +- .../modules/mediarecorder/video_track_recorder.h | 41 +- .../mediarecorder/video_track_recorder_unittest.cc | 239 +- .../renderer/modules/mediarecorder/vpx_encoder.cc | 15 +- .../blink/renderer/modules/mediasession/BUILD.gn | 2 - .../renderer/modules/mediasession/DIR_METADATA | 4 + .../blink/renderer/modules/mediasession/OWNERS | 4 - .../modules/mediasession/media_metadata.cc | 1 + .../renderer/modules/mediasession/media_metadata.h | 2 +- .../renderer/modules/mediasession/media_session.cc | 42 +- .../renderer/modules/mediasession/media_session.h | 12 +- .../modules/mediasession/media_session_test.cc | 3 +- .../mediasession/navigator_media_session.cc | 44 - .../modules/mediasession/navigator_media_session.h | 38 - .../mediasession/navigator_media_session.idl | 4 +- .../blink/renderer/modules/mediasource/BUILD.gn | 7 + .../blink/renderer/modules/mediasource/DEPS | 10 + .../renderer/modules/mediasource/DIR_METADATA | 3 + .../blink/renderer/modules/mediasource/OWNERS | 2 - .../cross_thread_media_source_attachment.cc | 2 +- .../cross_thread_media_source_attachment.h | 4 +- .../blink/renderer/modules/mediasource/idls.gni | 2 + .../renderer/modules/mediasource/media_source.cc | 305 +- .../renderer/modules/mediasource/media_source.h | 31 +- .../renderer/modules/mediasource/media_source.idl | 15 +- .../media_source_attachment_supplement.h | 4 +- .../same_thread_media_source_attachment.cc | 2 +- .../same_thread_media_source_attachment.h | 4 +- .../renderer/modules/mediasource/source_buffer.cc | 436 +- .../renderer/modules/mediasource/source_buffer.h | 39 + .../renderer/modules/mediasource/source_buffer.idl | 22 + .../modules/mediasource/source_buffer_config.idl | 18 + .../modules/mediasource/track_default_list.cc | 2 - .../modules/mediasource/track_default_list.h | 4 +- .../modules/mediasource/url_media_source.h | 4 +- .../blink/renderer/modules/mediastream/BUILD.gn | 14 + .../blink/renderer/modules/mediastream/DEPS | 3 + .../renderer/modules/mediastream/DIR_METADATA | 4 + .../blink/renderer/modules/mediastream/OWNERS | 3 - .../mediastream/apply_constraints_processor.cc | 6 +- .../modules/mediastream/identifiability_metrics.cc | 3 +- .../modules/mediastream/identifiability_metrics.h | 4 +- .../blink/renderer/modules/mediastream/idls.gni | 3 + .../mediastream/local_media_stream_audio_source.cc | 2 +- .../mediastream/local_media_stream_audio_source.h | 2 +- .../low_latency_video_renderer_algorithm.cc | 4 +- ...ow_latency_video_renderer_algorithm_unittest.cc | 2 +- .../modules/mediastream/media_constraints_impl.cc | 7 +- .../renderer/modules/mediastream/media_devices.cc | 42 +- .../modules/mediastream/media_devices_test.cc | 63 +- .../renderer/modules/mediastream/media_stream.cc | 1 + .../renderer/modules/mediastream/media_stream.h | 2 +- .../mediastream/media_stream_audio_processor.cc | 18 +- .../mediastream/media_stream_audio_processor.h | 15 +- .../media_stream_audio_processor_test.cc | 138 + .../media_stream_audio_track_underlying_sink.cc | 78 + .../media_stream_audio_track_underlying_sink.h | 44 + ...edia_stream_audio_track_underlying_sink_test.cc | 188 + .../media_stream_audio_track_underlying_source.cc | 170 + .../media_stream_audio_track_underlying_source.h | 83 + ...ia_stream_audio_track_underlying_source_test.cc | 245 ++ .../mediastream/media_stream_constraints_util.cc | 2 +- .../mediastream/media_stream_constraints_util.h | 3 +- .../media_stream_constraints_util_audio.cc | 8 +- .../media_stream_constraints_util_audio_test.cc | 8 +- .../media_stream_constraints_util_video_device.cc | 18 +- .../media_stream_constraints_util_video_device.h | 7 +- ...ia_stream_constraints_util_video_device_test.cc | 21 +- .../mediastream/media_stream_local_frame_wrapper.h | 2 +- .../modules/mediastream/media_stream_track.cc | 36 +- .../modules/mediastream/media_stream_track.h | 33 +- .../mediastream/media_stream_track_generator.cc | 210 +- .../mediastream/media_stream_track_generator.h | 27 +- .../mediastream/media_stream_track_generator.idl | 10 +- .../media_stream_track_generator_init.idl | 11 + .../media_stream_track_generator_test.cc | 144 +- .../mediastream/media_stream_track_processor.cc | 199 +- .../mediastream/media_stream_track_processor.h | 38 +- .../mediastream/media_stream_track_processor.idl | 10 +- .../media_stream_track_processor_init.idl | 10 + .../media_stream_track_processor_test.cc | 305 +- .../mediastream/media_stream_track_signal.idl | 15 + .../modules/mediastream/media_stream_track_test.cc | 75 + .../media_stream_video_capturer_source.cc | 5 + .../media_stream_video_capturer_source.h | 3 + .../media_stream_video_capturer_source_test.cc | 9 +- .../media_stream_video_renderer_sink.cc | 8 +- .../mediastream/media_stream_video_source.cc | 47 +- .../mediastream/media_stream_video_track.cc | 61 +- .../modules/mediastream/media_stream_video_track.h | 6 + .../media_stream_video_track_signal_observer.h | 21 + .../mediastream/media_stream_video_track_test.cc | 8 +- .../media_stream_video_track_underlying_sink.cc | 25 +- .../media_stream_video_track_underlying_sink.h | 4 +- ...edia_stream_video_track_underlying_sink_test.cc | 40 +- .../media_stream_video_track_underlying_source.cc | 114 +- .../media_stream_video_track_underlying_source.h | 42 +- ...ia_stream_video_track_underlying_source_test.cc | 139 +- .../mediastream/media_track_constraint_set.idl | 4 +- .../modules/mediastream/media_track_settings.idl | 4 +- .../media_track_supported_constraints.idl | 4 +- .../mediastream/mock_media_stream_audio_sink.cc | 10 + .../mediastream/mock_media_stream_audio_sink.h | 26 + .../mediastream/mock_media_stream_video_sink.cc | 1 + .../mediastream/mock_media_stream_video_sink.h | 6 +- .../mediastream/mock_media_stream_video_source.cc | 22 +- .../mediastream/mock_media_stream_video_source.h | 6 + .../mediastream/processed_local_audio_source.cc | 4 +- .../processed_local_audio_source_test.cc | 9 +- .../pushable_media_stream_audio_source.cc | 103 + .../pushable_media_stream_audio_source.h | 72 + .../pushable_media_stream_audio_source_test.cc | 211 + .../pushable_media_stream_video_source.cc | 60 + .../pushable_media_stream_video_source.h | 17 + .../pushable_media_stream_video_source_test.cc | 59 +- .../modules/mediastream/stream_test_utils.cc | 35 + .../modules/mediastream/stream_test_utils.h | 49 + .../modules/mediastream/track_audio_renderer.cc | 2 +- .../modules/mediastream/user_media_client_test.cc | 30 +- .../modules/mediastream/user_media_processor.cc | 15 +- .../modules/mediastream/user_media_request.h | 2 +- .../video_renderer_algorithm_wrapper.cc | 2 +- .../modules/mediastream/video_track_adapter.cc | 129 +- .../modules/mediastream/video_track_adapter.h | 7 +- .../mediastream/video_track_adapter_unittest.cc | 63 +- .../video_track_signal_underlying_sink.cc | 106 + .../video_track_signal_underlying_sink.h | 44 + .../video_track_signal_underlying_sink_test.cc | 244 ++ .../video_track_signal_underlying_source.cc | 162 + .../video_track_signal_underlying_source.h | 80 + .../video_track_signal_underlying_source_test.cc | 191 + .../webaudio_media_stream_audio_sink.cc | 10 +- .../modules/mediastream/webmediaplayer_ms.cc | 429 +- .../mediastream/webmediaplayer_ms_compositor.cc | 120 +- .../modules/mediastream/webmediaplayer_ms_test.cc | 95 +- .../renderer/modules/modalclosewatcher/BUILD.gn | 12 + .../renderer/modules/modalclosewatcher/OWNERS | 2 + .../renderer/modules/modalclosewatcher/idls.gni | 5 + .../modalclosewatcher/modal_close_watcher.cc | 125 + .../modalclosewatcher/modal_close_watcher.h | 84 + .../modalclosewatcher/modal_close_watcher.idl | 16 + .../blink/renderer/modules/modules_idl_files.gni | 6 + .../blink/renderer/modules/modules_initializer.cc | 13 +- .../blink/renderer/modules/native_io/BUILD.gn | 8 +- .../blink/renderer/modules/native_io/DEPS | 1 + .../blink/renderer/modules/native_io/DIR_METADATA | 4 + .../blink/renderer/modules/native_io/OWNERS | 3 - .../blink/renderer/modules/native_io/README.md | 5 + .../renderer/modules/native_io/global_native_io.cc | 37 +- .../renderer/modules/native_io/global_native_io.h | 9 +- .../blink/renderer/modules/native_io/idls.gni | 2 +- .../native_io/native_io_capacity_tracker.cc | 27 + .../modules/native_io/native_io_capacity_tracker.h | 48 + .../renderer/modules/native_io/native_io_error.cc | 95 + .../renderer/modules/native_io/native_io_error.h | 45 + .../renderer/modules/native_io/native_io_file.cc | 384 +- .../renderer/modules/native_io/native_io_file.h | 67 +- .../renderer/modules/native_io/native_io_file.idl | 8 +- .../modules/native_io/native_io_file_manager.cc | 755 ++++ .../modules/native_io/native_io_file_manager.h | 136 + .../modules/native_io/native_io_file_manager.idl | 44 + .../modules/native_io/native_io_file_sync.cc | 270 +- .../modules/native_io/native_io_file_sync.h | 22 + .../modules/native_io/native_io_file_sync.idl | 8 +- .../modules/native_io/native_io_manager.cc | 331 -- .../renderer/modules/native_io/native_io_manager.h | 68 - .../modules/native_io/native_io_manager.idl | 33 - .../modules/native_io/window_native_io.idl | 4 +- .../native_io/worker_global_scope_native_io.idl | 4 +- .../modules/navigatorcontentutils/DIR_METADATA | 3 + .../renderer/modules/navigatorcontentutils/OWNERS | 2 - .../navigator_content_utils.cc | 39 +- .../navigator_content_utils.h | 6 +- .../blink/renderer/modules/netinfo/BUILD.gn | 4 - .../blink/renderer/modules/netinfo/DIR_METADATA | 3 + .../blink/renderer/modules/netinfo/OWNERS | 2 - .../netinfo/navigator_network_information.cc | 53 - .../netinfo/navigator_network_information.h | 40 - .../netinfo/navigator_network_information.idl | 2 +- .../modules/netinfo/network_information.cc | 21 +- .../renderer/modules/netinfo/network_information.h | 11 +- .../worker_navigator_network_information.cc | 64 - .../netinfo/worker_navigator_network_information.h | 44 - .../worker_navigator_network_information.idl | 4 +- .../blink/renderer/modules/nfc/BUILD.gn | 4 - .../blink/renderer/modules/nfc/DIR_METADATA | 4 + .../third_party/blink/renderer/modules/nfc/OWNERS | 4 +- .../blink/renderer/modules/nfc/idls.gni | 1 - .../blink/renderer/modules/nfc/ndef_message.cc | 5 +- .../blink/renderer/modules/nfc/ndef_reader.cc | 337 +- .../blink/renderer/modules/nfc/ndef_reader.h | 65 +- .../blink/renderer/modules/nfc/ndef_reader.idl | 11 +- .../blink/renderer/modules/nfc/ndef_record.cc | 5 +- .../blink/renderer/modules/nfc/ndef_writer.cc | 197 - .../blink/renderer/modules/nfc/ndef_writer.h | 74 - .../blink/renderer/modules/nfc/ndef_writer.idl | 20 - .../blink/renderer/modules/nfc/nfc_proxy.cc | 42 +- .../blink/renderer/modules/nfc/nfc_proxy.h | 9 +- .../blink/renderer/modules/nfc/nfc_proxy_test.cc | 17 +- .../renderer/modules/nfc/nfc_type_converters.cc | 1 - .../blink/renderer/modules/nfc/nfc_utils.cc | 49 - .../blink/renderer/modules/nfc/nfc_utils.h | 21 - .../renderer/modules/notifications/DIR_METADATA | 4 + .../blink/renderer/modules/notifications/OWNERS | 3 - .../renderer/modules/notifications/notification.cc | 1 + .../renderer/modules/notifications/notification.h | 2 +- .../blink/renderer/modules/payments/DEPS | 3 + .../blink/renderer/modules/payments/DIR_METADATA | 4 + .../blink/renderer/modules/payments/OWNERS | 4 +- .../blink/renderer/modules/payments/abort_test.cc | 9 +- .../can_make_payment_respond_with_observer.cc | 1 + .../modules/payments/can_make_payment_test.cc | 19 +- .../renderer/modules/payments/complete_test.cc | 11 +- .../renderer/modules/payments/goods/DIR_METADATA | 3 + .../blink/renderer/modules/payments/goods/OWNERS | 2 - .../modules/payments/goods/digital_goods_service.h | 2 +- .../payments/goods/dom_window_digital_goods.h | 2 +- .../modules/payments/on_payment_response_test.cc | 49 +- .../modules/payments/payment_handler_utils.cc | 1 + .../renderer/modules/payments/payment_request.cc | 67 +- .../renderer/modules/payments/payment_request.h | 4 +- .../modules/payments/payment_request_event.cc | 14 +- .../modules/payments/payment_request_test.cc | 63 +- .../payments/payment_request_update_event_test.cc | 9 +- .../modules/payments/payment_test_helper.cc | 59 +- .../modules/payments/payment_test_helper.h | 27 - .../modules/payments/payments_validators.cc | 30 +- .../modules/payments/payments_validators_test.cc | 10 +- .../payments/secure_payment_confirmation_helper.cc | 1 + .../blink/renderer/modules/peerconnection/BUILD.gn | 10 + .../renderer/modules/peerconnection/DIR_METADATA | 3 + .../blink/renderer/modules/peerconnection/OWNERS | 2 - .../peerconnection/adapters/dtls_transport_proxy.h | 2 + .../peerconnection/adapters/ice_transport_proxy.cc | 14 +- .../peerconnection/adapters/sctp_transport_proxy.h | 2 + .../fake_rtc_rtp_transceiver_impl.cc | 15 + .../peerconnection/fake_rtc_rtp_transceiver_impl.h | 6 + .../peerconnection/identifiability_metrics.cc | 7 +- .../peerconnection/identifiability_metrics.h | 6 +- .../media_stream_remote_video_source.cc | 118 +- .../media_stream_remote_video_source.h | 3 + .../media_stream_remote_video_source_test.cc | 165 +- .../media_stream_video_webrtc_sink.cc | 14 +- .../mock_peer_connection_dependency_factory.cc | 59 +- .../mock_peer_connection_dependency_factory.h | 7 +- .../peerconnection/mock_peer_connection_impl.cc | 16 +- .../peerconnection/mock_peer_connection_impl.h | 3 - .../mock_rtc_peer_connection_handler_platform.cc | 19 +- .../mock_rtc_peer_connection_handler_platform.h | 69 +- .../peer_connection_dependency_factory.cc | 72 +- .../peer_connection_dependency_factory.h | 21 +- .../peerconnection/peer_connection_tracker.cc | 12 +- .../peerconnection/peer_connection_tracker.h | 5 +- .../peerconnection/peer_connection_tracker_test.cc | 58 +- .../modules/peerconnection/rtc_data_channel.cc | 12 +- .../modules/peerconnection/rtc_data_channel.h | 2 +- .../peerconnection/rtc_data_channel_test.cc | 35 +- .../rtc_encoded_audio_underlying_sink_test.cc | 1 + .../rtc_encoded_audio_underlying_source.cc | 1 + .../rtc_encoded_video_underlying_sink_test.cc | 1 + .../rtc_encoded_video_underlying_source.cc | 1 + .../modules/peerconnection/rtc_ice_transport.cc | 42 - .../modules/peerconnection/rtc_ice_transport.h | 1 - .../modules/peerconnection/rtc_ice_transport.idl | 2 - .../modules/peerconnection/rtc_peer_connection.cc | 354 +- .../modules/peerconnection/rtc_peer_connection.h | 32 +- .../modules/peerconnection/rtc_peer_connection.idl | 4 +- .../peerconnection/rtc_peer_connection_handler.cc | 126 +- .../peerconnection/rtc_peer_connection_handler.h | 76 +- .../rtc_peer_connection_handler_test.cc | 36 +- .../rtc_peer_connection_ice_error_event.cc | 4 +- .../rtc_peer_connection_ice_error_event_init.idl | 4 +- .../peerconnection/rtc_peer_connection_test.cc | 265 +- .../rtc_rtp_header_extension_capability.idl | 3 +- .../modules/peerconnection/rtc_rtp_receiver.cc | 8 +- .../modules/peerconnection/rtc_rtp_receiver_impl.h | 2 +- .../modules/peerconnection/rtc_rtp_sender_impl.h | 2 +- .../modules/peerconnection/rtc_rtp_transceiver.cc | 85 + .../modules/peerconnection/rtc_rtp_transceiver.h | 10 + .../modules/peerconnection/rtc_rtp_transceiver.idl | 5 + .../peerconnection/rtc_rtp_transceiver_impl.cc | 60 +- .../peerconnection/rtc_rtp_transceiver_impl.h | 13 +- .../rtc_rtp_transceiver_impl_test.cc | 2 +- .../modules/peerconnection/thermal_resource.cc | 15 +- .../modules/peerconnection/thermal_resource.h | 9 +- .../peerconnection/thermal_resource_test.cc | 36 +- .../modules/peerconnection/thermal_uma_listener.cc | 20 +- .../modules/peerconnection/thermal_uma_listener.h | 8 +- .../peerconnection/thermal_uma_listener_test.cc | 18 +- .../peerconnection/transceiver_state_surfacer.cc | 20 +- .../peerconnection/transceiver_state_surfacer.h | 7 +- .../transceiver_state_surfacer_test.cc | 4 +- .../peerconnection/webrtc_audio_renderer_test.cc | 21 +- .../webrtc_set_description_observer.cc | 5 +- .../blink/renderer/modules/permissions/BUILD.gn | 4 - .../renderer/modules/permissions/DIR_METADATA | 3 + .../blink/renderer/modules/permissions/OWNERS | 2 - .../modules/permissions/navigator_permissions.cc | 44 - .../modules/permissions/navigator_permissions.h | 36 - .../modules/permissions/navigator_permissions.idl | 2 +- .../modules/permissions/permission_descriptor.idl | 1 + .../modules/permissions/permission_utils.cc | 16 +- .../renderer/modules/permissions/permissions.cc | 40 +- .../renderer/modules/permissions/permissions.h | 13 +- .../permissions/worker_navigator_permissions.cc | 49 - .../permissions/worker_navigator_permissions.h | 36 - .../permissions/worker_navigator_permissions.idl | 2 +- .../blink/renderer/modules/picture_in_picture/DEPS | 1 + .../modules/picture_in_picture/DIR_METADATA | 4 + .../renderer/modules/picture_in_picture/OWNERS | 3 - .../html_element_picture_in_picture.cc | 2 +- .../picture_in_picture_controller_impl.cc | 7 + .../picture_in_picture_controller_test.cc | 20 +- .../renderer/modules/plugins/dom_mime_type.cc | 3 +- .../modules/plugins/dom_mime_type_array.cc | 27 + .../renderer/modules/plugins/dom_mime_type_array.h | 5 + .../renderer/modules/plugins/dom_plugin_array.cc | 16 + .../renderer/modules/plugins/dom_plugin_array.h | 2 + .../renderer/modules/presentation/DIR_METADATA | 4 + .../blink/renderer/modules/presentation/OWNERS | 6 - .../renderer/modules/presentation/presentation.cc | 2 +- .../presentation/presentation_connection.cc | 4 +- .../presentation_connection_available_event.h | 9 - .../presentation_connection_callbacks_test.cc | 51 +- .../modules/presentation/presentation_receiver.cc | 1 + .../renderer/modules/push_messaging/DIR_METADATA | 4 + .../blink/renderer/modules/push_messaging/OWNERS | 3 - .../renderer/modules/push_messaging/push_event.cc | 2 +- .../modules/push_messaging/push_message_data.cc | 7 +- .../modules/push_messaging/push_provider.cc | 14 +- .../push_messaging/push_subscription_options.cc | 7 +- .../blink/renderer/modules/quota/BUILD.gn | 2 - .../blink/renderer/modules/quota/DIR_METADATA | 4 + .../blink/renderer/modules/quota/OWNERS | 3 - .../modules/quota/navigator_storage_quota.cc | 67 +- .../modules/quota/navigator_storage_quota.h | 16 +- .../renderer/modules/quota/storage_manager.cc | 6 +- .../blink/renderer/modules/quota/storage_manager.h | 3 +- .../quota/worker_navigator_storage_quota.cc | 85 - .../modules/quota/worker_navigator_storage_quota.h | 65 - .../quota/worker_navigator_storage_quota.idl | 2 +- .../modules/remote_objects/remote_object.cc | 143 +- .../modules/remote_objects/remote_object.h | 2 + .../remote_objects/remote_object_gateway_impl.cc | 29 +- .../remote_objects/remote_object_gateway_impl.h | 11 +- .../blink/renderer/modules/remoteplayback/BUILD.gn | 2 + .../renderer/modules/remoteplayback/DIR_METADATA | 4 + .../blink/renderer/modules/remoteplayback/OWNERS | 3 - .../modules/remoteplayback/remote_playback.cc | 10 +- .../remoteplayback/remote_playback_metrics.cc | 18 + .../remoteplayback/remote_playback_metrics.h | 27 + .../blink/renderer/modules/sanitizer_api/BUILD.gn | 77 + .../blink/renderer/modules/sanitizer_api/DEPS | 3 + .../renderer/modules/sanitizer_api/DIR_METADATA | 3 + .../blink/renderer/modules/sanitizer_api/OWNERS | 2 - .../renderer/modules/sanitizer_api/build_corpus.py | 68 + .../modules/sanitizer_api/corpus/config1.txt | 17 + .../modules/sanitizer_api/corpus/config2.txt | 9 + .../modules/sanitizer_api/corpus/default.txt | 0 .../modules/sanitizer_api/corpus/medium1.html | 1000 +++++ .../modules/sanitizer_api/corpus/medium2.html | 1000 +++++ .../modules/sanitizer_api/corpus/medium3.html | 1000 +++++ .../modules/sanitizer_api/corpus/simple1.html | 1 + .../modules/sanitizer_api/corpus/simple2.html | 3 + .../modules/sanitizer_api/corpus/simple3.html | 1 + .../renderer/modules/sanitizer_api/sanitizer.cc | 244 +- .../renderer/modules/sanitizer_api/sanitizer.h | 174 +- .../renderer/modules/sanitizer_api/sanitizer.idl | 6 +- .../modules/sanitizer_api/sanitizer_api.dict | 435 ++ .../modules/sanitizer_api/sanitizer_api_fuzzer.cc | 121 + .../modules/sanitizer_api/sanitizer_config.idl | 1 + .../modules/sanitizer_api/sanitizer_config.proto | 20 + .../renderer/modules/scheduler/dom_scheduler.cc | 14 +- .../renderer/modules/scheduler/dom_scheduler.h | 6 +- .../blink/renderer/modules/scheduler/dom_task.cc | 9 +- .../blink/renderer/modules/scheduler/dom_task.h | 9 +- .../blink/renderer/modules/scheduler/scheduler.idl | 2 +- .../scheduler/scheduler_post_task_callback.idl | 7 + .../modules/screen_enumeration/DIR_METADATA | 4 + .../renderer/modules/screen_enumeration/OWNERS | 3 - .../modules/screen_orientation/DIR_METADATA | 3 + .../renderer/modules/screen_orientation/OWNERS | 2 - .../screen_orientation_controller.cc | 12 +- .../screen_orientation_controller.h | 2 +- .../screen_orientation_controller_test.cc | 36 +- .../blink/renderer/modules/sensor/BUILD.gn | 2 + .../blink/renderer/modules/sensor/DIR_METADATA | 4 + .../blink/renderer/modules/sensor/OWNERS | 3 - .../renderer/modules/sensor/gravity_sensor.cc | 41 + .../blink/renderer/modules/sensor/gravity_sensor.h | 30 + .../renderer/modules/sensor/gravity_sensor.idl | 13 + .../blink/renderer/modules/sensor/idls.gni | 1 + .../renderer/modules/sensor/orientation_sensor.cc | 4 +- .../blink/renderer/modules/sensor/sensor.cc | 2 +- .../renderer/modules/sensor/sensor_proxy_impl.cc | 3 +- .../renderer/modules/sensor/sensor_proxy_impl.h | 2 +- .../modules/sensor/sensor_reading_remapper.cc | 1 + .../blink/renderer/modules/serial/BUILD.gn | 6 - .../blink/renderer/modules/serial/DIR_METADATA | 3 + .../blink/renderer/modules/serial/OWNERS | 2 - .../blink/renderer/modules/serial/idls.gni | 2 - .../renderer/modules/serial/navigator_serial.cc | 40 - .../renderer/modules/serial/navigator_serial.h | 36 - .../renderer/modules/serial/navigator_serial.idl | 2 +- .../blink/renderer/modules/serial/serial.cc | 33 +- .../blink/renderer/modules/serial/serial.h | 10 +- .../modules/serial/serial_connection_event.cc | 37 - .../modules/serial/serial_connection_event.h | 38 - .../modules/serial/serial_connection_event.idl | 11 - .../serial/serial_connection_event_init.idl | 7 - .../blink/renderer/modules/serial/serial_port.cc | 44 +- .../blink/renderer/modules/serial/serial_port.h | 11 +- .../blink/renderer/modules/serial/serial_port.idl | 5 +- .../modules/serial/serial_port_underlying_sink.cc | 2 +- .../modules/serial/worker_navigator_serial.cc | 49 - .../modules/serial/worker_navigator_serial.h | 38 - .../modules/serial/worker_navigator_serial.idl | 9 +- .../renderer/modules/service_worker/DIR_METADATA | 4 + .../blink/renderer/modules/service_worker/OWNERS | 3 - .../cross_origin_resource_policy_checker.cc | 7 +- .../service_worker/extendable_message_event.cc | 4 + .../service_worker/extendable_message_event.h | 6 + .../renderer/modules/service_worker/fetch_event.cc | 14 +- .../service_worker/fetch_respond_with_observer.cc | 69 +- .../service_worker/fetch_respond_with_observer.h | 9 +- .../service_worker/service_worker_event_queue.cc | 2 +- .../service_worker/service_worker_global_scope.cc | 71 +- .../service_worker/service_worker_global_scope.h | 37 +- .../service_worker_installed_scripts_manager.cc | 3 +- ...ervice_worker_installed_scripts_manager_test.cc | 6 +- .../service_worker_module_tree_client.cc | 14 + .../service_worker/service_worker_thread.cc | 9 +- .../modules/service_worker/service_worker_thread.h | 5 +- .../modules/service_worker/wait_until_observer.cc | 3 +- .../modules/service_worker/wait_until_observer.h | 2 +- .../web_embedded_worker_impl_test.cc | 13 +- .../blink/renderer/modules/shapedetection/DEPS | 3 +- .../renderer/modules/shapedetection/DIR_METADATA | 4 + .../blink/renderer/modules/shapedetection/OWNERS | 3 - .../modules/shapedetection/barcode_detector.h | 3 +- .../modules/shapedetection/face_detector.h | 3 +- .../modules/shapedetection/shape_detector.cc | 43 +- .../modules/shapedetection/shape_detector.h | 2 +- .../modules/shapedetection/text_detector.h | 3 +- .../blink/renderer/modules/speech/DIR_METADATA | 3 + .../blink/renderer/modules/speech/OWNERS | 3 - .../modules/speech/speech_recognition_event.idl | 4 +- .../blink/renderer/modules/srcobject/DIR_METADATA | 3 + .../blink/renderer/modules/srcobject/OWNERS | 2 - .../blink/renderer/modules/storage/DIR_METADATA | 4 + .../blink/renderer/modules/storage/OWNERS | 3 - .../blink/renderer/modules/storage/README.md | 9 +- .../modules/storage/storage_controller_test.cc | 10 +- .../blink/renderer/modules/url_pattern/BUILD.gn | 17 + .../blink/renderer/modules/url_pattern/DEPS | 9 + .../renderer/modules/url_pattern/DIR_METADATA | 4 + .../blink/renderer/modules/url_pattern/OWNERS | 6 + .../blink/renderer/modules/url_pattern/idls.gni | 13 + .../renderer/modules/url_pattern/url_pattern.cc | 778 ++++ .../renderer/modules/url_pattern/url_pattern.h | 92 + .../renderer/modules/url_pattern/url_pattern.idl | 16 + .../url_pattern/url_pattern_component_result.idl | 9 + .../modules/url_pattern/url_pattern_init.idl | 16 + .../modules/url_pattern/url_pattern_result.idl | 16 + .../blink/renderer/modules/vibration/DIR_METADATA | 4 + .../blink/renderer/modules/vibration/OWNERS | 3 - .../modules/vibration/vibration_controller.cc | 1 + .../modules/vibration/vibration_controller.h | 4 +- .../video_frame_callback_requester_impl.cc | 13 +- .../video_frame_callback_requester_impl.h | 4 + .../video_frame_callback_requester_impl_test.cc | 52 +- .../modules/video_rvfc/video_frame_metadata.idl | 4 +- .../video_frame_request_callback_collection.h | 2 +- ...video_frame_request_callback_collection_test.cc | 3 + .../blink/renderer/modules/wake_lock/BUILD.gn | 4 - .../blink/renderer/modules/wake_lock/DIR_METADATA | 4 + .../blink/renderer/modules/wake_lock/OWNERS | 3 - .../blink/renderer/modules/wake_lock/README.md | 2 +- .../modules/wake_lock/navigator_wake_lock.cc | 48 - .../modules/wake_lock/navigator_wake_lock.h | 37 - .../modules/wake_lock/navigator_wake_lock.idl | 2 +- .../blink/renderer/modules/wake_lock/wake_lock.cc | 48 +- .../blink/renderer/modules/wake_lock/wake_lock.h | 12 +- .../modules/wake_lock/wake_lock_manager.cc | 10 +- .../renderer/modules/wake_lock/wake_lock_manager.h | 6 - .../modules/wake_lock/wake_lock_sentinel.cc | 2 +- .../modules/wake_lock/wake_lock_sentinel_test.cc | 3 +- .../renderer/modules/wake_lock/wake_lock_test.cc | 11 +- .../modules/wake_lock/wake_lock_test_utils.cc | 14 +- .../wake_lock/worker_navigator_wake_lock.cc | 57 - .../modules/wake_lock/worker_navigator_wake_lock.h | 39 - .../wake_lock/worker_navigator_wake_lock.idl | 5 +- .../blink/renderer/modules/webaudio/BUILD.gn | 1 + .../blink/renderer/modules/webaudio/DIR_METADATA | 3 + .../blink/renderer/modules/webaudio/OWNERS | 2 - .../renderer/modules/webaudio/analyser_node.cc | 8 +- .../renderer/modules/webaudio/audio_buffer.cc | 14 +- .../modules/webaudio/audio_buffer_source_node.cc | 21 +- .../renderer/modules/webaudio/audio_context.cc | 8 + .../blink/renderer/modules/webaudio/audio_node.cc | 5 + .../blink/renderer/modules/webaudio/audio_param.cc | 57 +- .../modules/webaudio/audio_param_timeline.cc | 22 +- .../renderer/modules/webaudio/audio_worklet.cc | 1 + .../webaudio/audio_worklet_global_scope_test.cc | 13 +- .../modules/webaudio/audio_worklet_object_proxy.cc | 7 +- .../modules/webaudio/audio_worklet_thread_test.cc | 12 +- .../modules/webaudio/biquad_filter_node.cc | 18 +- .../renderer/modules/webaudio/convolver_node.cc | 2 +- .../renderer/modules/webaudio/iir_filter_node.cc | 18 +- .../webaudio/media_element_audio_source_node.cc | 19 +- .../webaudio/media_element_audio_source_node.h | 13 +- .../webaudio/media_element_audio_source_node.idl | 1 + .../webaudio/media_stream_audio_source_node.cc | 5 +- .../modules/webaudio/offline_audio_context.cc | 15 - .../modules/webaudio/oscillator_options.idl | 4 +- .../webaudio/realtime_audio_worklet_thread.cc | 4 + .../modules/webaudio/script_processor_node.cc | 19 +- .../renderer/modules/webaudio/wave_shaper_node.cc | 4 +- .../blink/renderer/modules/webcodecs/BUILD.gn | 19 + .../blink/renderer/modules/webcodecs/DEPS | 9 + .../blink/renderer/modules/webcodecs/DIR_METADATA | 11 + .../renderer/modules/webcodecs/audio_decoder.cc | 147 +- .../renderer/modules/webcodecs/audio_decoder.h | 20 +- .../renderer/modules/webcodecs/audio_decoder.idl | 12 +- .../modules/webcodecs/audio_decoder_broker.cc | 16 +- .../modules/webcodecs/audio_decoder_broker.h | 2 + .../modules/webcodecs/audio_decoder_broker_test.cc | 8 +- .../modules/webcodecs/audio_decoder_config.idl | 23 + .../modules/webcodecs/audio_decoder_fuzzer.cc | 62 +- .../modules/webcodecs/audio_decoder_support.idl | 10 + .../renderer/modules/webcodecs/audio_encoder.cc | 269 ++ .../renderer/modules/webcodecs/audio_encoder.h | 98 + .../renderer/modules/webcodecs/audio_encoder.idl | 50 + .../modules/webcodecs/audio_encoder_config.idl | 18 + .../modules/webcodecs/audio_encoder_init.idl | 10 + .../renderer/modules/webcodecs/audio_frame.cc | 85 +- .../blink/renderer/modules/webcodecs/audio_frame.h | 5 + .../modules/webcodecs/audio_frame_init.idl | 4 +- .../webcodecs/audio_frame_serialization_data.cc | 40 + .../webcodecs/audio_frame_serialization_data.h | 49 + .../renderer/modules/webcodecs/audio_frame_test.cc | 158 + .../modules/webcodecs/avc_encoder_config.idl | 14 + .../renderer/modules/webcodecs/codec_logger.cc | 67 + .../renderer/modules/webcodecs/codec_logger.h | 80 + .../modules/webcodecs/color_space_matrix_id.idl | 18 + .../modules/webcodecs/color_space_primary_id.idl | 19 + .../modules/webcodecs/color_space_range_id.idl | 16 + .../modules/webcodecs/color_space_transfer_id.idl | 23 + .../renderer/modules/webcodecs/decoder_template.cc | 131 +- .../renderer/modules/webcodecs/decoder_template.h | 30 +- .../modules/webcodecs/encoded_audio_chunk_init.idl | 6 +- .../encoded_audio_chunk_output_callback.idl | 9 + .../modules/webcodecs/encoded_audio_config.idl | 20 - .../modules/webcodecs/encoded_video_chunk.cc | 5 +- .../modules/webcodecs/encoded_video_chunk_init.idl | 8 +- .../renderer/modules/webcodecs/encoder_base.cc | 331 ++ .../renderer/modules/webcodecs/encoder_base.h | 136 + .../renderer/modules/webcodecs/fuzzer_inputs.proto | 62 +- .../fuzzer_seed_corpus/generate_image_corpus.py | 81 + .../video_encoder/encode_h264.textproto | 76 + .../video_encoder/encode_vp8.textproto | 76 + .../renderer/modules/webcodecs/fuzzer_utils.cc | 16 +- .../renderer/modules/webcodecs/fuzzer_utils.h | 7 +- .../modules/webcodecs/hardware_preference.cc | 25 + .../modules/webcodecs/hardware_preference.h | 18 + .../modules/webcodecs/hardware_preference.idl | 11 + .../blink/renderer/modules/webcodecs/idls.gni | 27 +- .../modules/webcodecs/image_decode_options.idl | 15 + .../renderer/modules/webcodecs/image_decoder.idl | 15 +- .../modules/webcodecs/image_decoder_base.textproto | 27 + .../modules/webcodecs/image_decoder_external.cc | 18 +- .../modules/webcodecs/image_decoder_external.h | 3 +- .../webcodecs/image_decoder_external_test.cc | 43 +- .../modules/webcodecs/image_decoder_fuzzer.cc | 176 + .../blink/renderer/modules/webcodecs/plane.cc | 7 +- .../modules/webcodecs/video_color_space.idl | 16 + .../renderer/modules/webcodecs/video_decoder.cc | 432 +- .../renderer/modules/webcodecs/video_decoder.h | 32 +- .../renderer/modules/webcodecs/video_decoder.idl | 10 +- .../modules/webcodecs/video_decoder_broker.cc | 84 +- .../modules/webcodecs/video_decoder_broker.h | 5 + .../modules/webcodecs/video_decoder_broker_test.cc | 123 +- .../modules/webcodecs/video_decoder_config.idl | 5 + .../modules/webcodecs/video_decoder_fuzzer.cc | 60 +- .../modules/webcodecs/video_decoder_support.idl | 10 + .../renderer/modules/webcodecs/video_encoder.cc | 628 ++- .../renderer/modules/webcodecs/video_encoder.h | 176 +- .../renderer/modules/webcodecs/video_encoder.idl | 22 +- .../modules/webcodecs/video_encoder_config.idl | 13 +- .../modules/webcodecs/video_encoder_fuzzer.cc | 77 +- .../renderer/modules/webcodecs/video_frame.cc | 853 ++-- .../blink/renderer/modules/webcodecs/video_frame.h | 65 +- .../renderer/modules/webcodecs/video_frame.idl | 20 +- .../modules/webcodecs/video_frame_handle.cc | 80 +- .../modules/webcodecs/video_frame_handle.h | 57 +- .../modules/webcodecs/video_frame_init.idl | 6 +- .../modules/webcodecs/video_frame_logger.cc | 103 + .../modules/webcodecs/video_frame_logger.h | 83 + .../modules/webcodecs/video_frame_plane_init.idl | 19 + .../renderer/modules/webcodecs/video_frame_test.cc | 189 +- .../modules/webcodecs/video_pixel_format.idl | 14 +- .../modules/webcodecs/video_track_reader.cc | 23 +- .../modules/webcodecs/video_track_reader.h | 11 +- .../modules/webcodecs/video_track_reader.idl | 2 + .../webcodecs/video_track_reader_writer_test.cc | 8 +- .../modules/webcodecs/video_track_writer.cc | 2 +- .../webcodecs/web_codecs_error_callback.idl | 8 - .../modules/webcodecs/webcodecs_error_callback.idl | 8 + .../renderer/modules/webdatabase/DIR_METADATA | 4 + .../blink/renderer/modules/webdatabase/OWNERS | 3 - .../blink/renderer/modules/webdatabase/database.cc | 5 +- .../modules/webdatabase/database_context.h | 2 +- .../blink/renderer/modules/webgl/BUILD.gn | 8 +- .../third_party/blink/renderer/modules/webgl/DEPS | 6 + .../blink/renderer/modules/webgl/DIR_METADATA | 3 + .../blink/renderer/modules/webgl/OWNERS | 2 - .../blink/renderer/modules/webgl/idls.gni | 3 + .../modules/webgl/webgl2_rendering_context.cc | 3 + .../modules/webgl/webgl2_rendering_context.h | 2 + .../modules/webgl/webgl2_rendering_context_base.cc | 317 +- .../modules/webgl/webgl2_rendering_context_base.h | 64 + .../webgl/webgl2_rendering_context_base.idl | 6 +- ...bgl_draw_instanced_base_vertex_base_instance.cc | 6 + .../renderer/modules/webgl/webgl_extension_name.h | 1 + .../renderer/modules/webgl/webgl_multi_draw.cc | 8 + .../modules/webgl/webgl_multi_draw_common.cc | 9 +- ...lti_draw_instanced_base_vertex_base_instance.cc | 4 + .../modules/webgl/webgl_rendering_context.cc | 3 + .../modules/webgl/webgl_rendering_context.h | 2 + .../modules/webgl/webgl_rendering_context_base.cc | 968 +++-- .../modules/webgl/webgl_rendering_context_base.h | 112 +- .../modules/webgl/webgl_rendering_context_base.idl | 6 + .../blink/renderer/modules/webgl/webgl_texture.h | 21 +- .../renderer/modules/webgl/webgl_video_texture.cc | 74 +- .../renderer/modules/webgl/webgl_video_texture.h | 10 + .../modules/webgl/webgl_webcodecs_texture_info.idl | 22 + .../modules/webgl/webgl_webcodecs_video_frame.cc | 495 +++ .../modules/webgl/webgl_webcodecs_video_frame.h | 69 + .../modules/webgl/webgl_webcodecs_video_frame.idl | 22 + .../webgl/webgl_webcodecs_video_frame_handle.idl | 43 + .../blink/renderer/modules/webgpu/BUILD.gn | 4 - .../third_party/blink/renderer/modules/webgpu/DEPS | 1 + .../blink/renderer/modules/webgpu/DIR_METADATA | 3 + .../blink/renderer/modules/webgpu/OWNERS | 3 +- .../renderer/modules/webgpu/dawn_conversions.cc | 109 +- .../renderer/modules/webgpu/dawn_conversions.h | 18 +- .../blink/renderer/modules/webgpu/dawn_object.cc | 64 +- .../blink/renderer/modules/webgpu/dawn_object.h | 141 +- .../blink/renderer/modules/webgpu/gpu.cc | 39 +- .../blink/renderer/modules/webgpu/gpu.h | 11 +- .../blink/renderer/modules/webgpu/gpu_adapter.cc | 105 +- .../blink/renderer/modules/webgpu/gpu_adapter.h | 22 +- .../blink/renderer/modules/webgpu/gpu_adapter.idl | 9 +- .../renderer/modules/webgpu/gpu_bind_group.cc | 11 +- .../blink/renderer/modules/webgpu/gpu_bind_group.h | 1 - .../renderer/modules/webgpu/gpu_bind_group.idl | 1 + .../modules/webgpu/gpu_bind_group_layout.cc | 84 +- .../modules/webgpu/gpu_bind_group_layout.h | 1 - .../modules/webgpu/gpu_bind_group_layout.idl | 1 + .../modules/webgpu/gpu_bind_group_layout_entry.idl | 14 +- .../modules/webgpu/gpu_blend_descriptor.idl | 35 - .../renderer/modules/webgpu/gpu_blend_state.idl | 35 + .../blink/renderer/modules/webgpu/gpu_buffer.cc | 11 +- .../blink/renderer/modules/webgpu/gpu_buffer.h | 1 - .../blink/renderer/modules/webgpu/gpu_buffer.idl | 1 + .../modules/webgpu/gpu_buffer_binding_layout.idl | 17 + .../modules/webgpu/gpu_buffer_copy_view.idl | 9 - .../renderer/modules/webgpu/gpu_canvas_context.cc | 21 +- .../renderer/modules/webgpu/gpu_canvas_context.h | 4 +- .../renderer/modules/webgpu/gpu_canvas_context.idl | 1 + .../modules/webgpu/gpu_color_state_descriptor.idl | 13 - .../modules/webgpu/gpu_color_target_state.idl | 13 + .../renderer/modules/webgpu/gpu_command_buffer.cc | 7 - .../renderer/modules/webgpu/gpu_command_buffer.h | 1 - .../renderer/modules/webgpu/gpu_command_buffer.idl | 1 + .../renderer/modules/webgpu/gpu_command_encoder.cc | 84 +- .../renderer/modules/webgpu/gpu_command_encoder.h | 26 +- .../modules/webgpu/gpu_command_encoder.idl | 19 +- .../modules/webgpu/gpu_compute_pass_encoder.cc | 9 +- .../modules/webgpu/gpu_compute_pass_encoder.h | 2 +- .../modules/webgpu/gpu_compute_pass_encoder.idl | 1 + .../modules/webgpu/gpu_compute_pipeline.cc | 49 +- .../renderer/modules/webgpu/gpu_compute_pipeline.h | 7 +- .../modules/webgpu/gpu_compute_pipeline.idl | 3 +- .../webgpu/gpu_compute_pipeline_descriptor.idl | 2 +- .../modules/webgpu/gpu_depth_stencil_state.idl | 18 + .../webgpu/gpu_depth_stencil_state_descriptor.idl | 18 - .../blink/renderer/modules/webgpu/gpu_device.cc | 189 +- .../blink/renderer/modules/webgpu/gpu_device.h | 39 +- .../blink/renderer/modules/webgpu/gpu_device.idl | 17 +- .../modules/webgpu/gpu_device_descriptor.idl | 5 +- .../renderer/modules/webgpu/gpu_extent_3d_dict.idl | 4 +- .../blink/renderer/modules/webgpu/gpu_fence.cc | 7 - .../blink/renderer/modules/webgpu/gpu_fence.h | 1 - .../modules/webgpu/gpu_image_bitmap_copy_view.idl | 12 - .../modules/webgpu/gpu_image_copy_buffer.idl | 9 + .../modules/webgpu/gpu_image_copy_image_bitmap.idl | 12 + .../modules/webgpu/gpu_image_copy_texture.idl | 12 + .../modules/webgpu/gpu_image_data_layout.idl | 11 + .../renderer/modules/webgpu/gpu_object_base.idl | 9 + .../renderer/modules/webgpu/gpu_pipeline_base.idl | 9 + .../renderer/modules/webgpu/gpu_pipeline_layout.cc | 11 +- .../renderer/modules/webgpu/gpu_pipeline_layout.h | 1 - .../modules/webgpu/gpu_pipeline_layout.idl | 1 + .../webgpu/gpu_programmable_pass_encoder.idl | 3 +- .../modules/webgpu/gpu_programmable_stage.idl | 10 + .../webgpu/gpu_programmable_stage_descriptor.idl | 10 - .../blink/renderer/modules/webgpu/gpu_query_set.cc | 11 +- .../blink/renderer/modules/webgpu/gpu_query_set.h | 1 - .../renderer/modules/webgpu/gpu_query_set.idl | 1 + .../blink/renderer/modules/webgpu/gpu_queue.cc | 125 +- .../blink/renderer/modules/webgpu/gpu_queue.h | 32 +- .../blink/renderer/modules/webgpu/gpu_queue.idl | 17 +- .../renderer/modules/webgpu/gpu_render_bundle.cc | 7 - .../renderer/modules/webgpu/gpu_render_bundle.h | 1 - .../renderer/modules/webgpu/gpu_render_bundle.idl | 1 + .../modules/webgpu/gpu_render_bundle_encoder.cc | 39 +- .../modules/webgpu/gpu_render_bundle_encoder.h | 9 +- .../modules/webgpu/gpu_render_bundle_encoder.idl | 1 + .../modules/webgpu/gpu_render_encoder_base.idl | 12 +- .../modules/webgpu/gpu_render_pass_descriptor.idl | 1 + .../modules/webgpu/gpu_render_pass_encoder.cc | 39 +- .../modules/webgpu/gpu_render_pass_encoder.h | 11 +- .../modules/webgpu/gpu_render_pass_encoder.idl | 3 + .../renderer/modules/webgpu/gpu_render_pipeline.cc | 215 +- .../renderer/modules/webgpu/gpu_render_pipeline.h | 34 +- .../modules/webgpu/gpu_render_pipeline.idl | 3 +- .../webgpu/gpu_render_pipeline_descriptor.idl | 8 +- .../blink/renderer/modules/webgpu/gpu_sampler.cc | 12 +- .../blink/renderer/modules/webgpu/gpu_sampler.h | 1 - .../blink/renderer/modules/webgpu/gpu_sampler.idl | 1 + .../modules/webgpu/gpu_sampler_binding_layout.idl | 15 + .../modules/webgpu/gpu_sampler_descriptor.idl | 1 + .../renderer/modules/webgpu/gpu_shader_module.cc | 15 +- .../renderer/modules/webgpu/gpu_shader_module.h | 1 - .../renderer/modules/webgpu/gpu_shader_module.idl | 1 + .../modules/webgpu/gpu_stencil_face_state.idl | 24 + .../webgpu/gpu_stencil_state_face_descriptor.idl | 24 - .../webgpu/gpu_storage_texture_binding_layout.idl | 16 + .../renderer/modules/webgpu/gpu_swap_chain.cc | 9 +- .../blink/renderer/modules/webgpu/gpu_swap_chain.h | 4 +- .../renderer/modules/webgpu/gpu_swap_chain.idl | 1 + .../blink/renderer/modules/webgpu/gpu_texture.cc | 174 +- .../blink/renderer/modules/webgpu/gpu_texture.h | 18 +- .../blink/renderer/modules/webgpu/gpu_texture.idl | 1 + .../modules/webgpu/gpu_texture_binding_layout.idl | 19 + .../modules/webgpu/gpu_texture_copy_view.idl | 12 - .../modules/webgpu/gpu_texture_data_layout.idl | 11 - .../modules/webgpu/gpu_texture_descriptor.idl | 2 - .../renderer/modules/webgpu/gpu_texture_usage.h | 8 +- .../renderer/modules/webgpu/gpu_texture_usage.idl | 5 +- .../renderer/modules/webgpu/gpu_texture_view.cc | 7 - .../renderer/modules/webgpu/gpu_texture_view.h | 1 - .../renderer/modules/webgpu/gpu_texture_view.idl | 1 + .../blink/renderer/modules/webgpu/idls.gni | 24 +- .../blink/renderer/modules/webgpu/navigator_gpu.cc | 50 - .../blink/renderer/modules/webgpu/navigator_gpu.h | 41 - .../renderer/modules/webgpu/navigator_gpu.idl | 4 +- .../modules/webgpu/worker_navigator_gpu.cc | 49 - .../renderer/modules/webgpu/worker_navigator_gpu.h | 41 - .../modules/webgpu/worker_navigator_gpu.idl | 4 +- .../blink/renderer/modules/webid/DIR_METADATA | 3 + .../blink/renderer/modules/webid/OWNERS | 2 - .../renderer/modules/webid/navigator_web_id.cc | 24 +- .../renderer/modules/webid/navigator_web_id.h | 14 +- .../renderer/modules/webid/navigator_web_id.idl | 4 +- .../blink/renderer/modules/webid/web_id.cc | 137 +- .../blink/renderer/modules/webid/web_id.h | 14 +- .../blink/renderer/modules/webid/web_id.idl | 6 +- .../modules/webid/web_id_request_options.idl | 5 +- .../blink/renderer/modules/webmidi/DIR_METADATA | 4 + .../blink/renderer/modules/webmidi/OWNERS | 3 - .../renderer/modules/webmidi/midi_dispatcher.cc | 7 +- .../renderer/modules/webmidi/midi_message_event.cc | 2 +- .../blink/renderer/modules/webmidi/midi_output.cc | 4 +- .../renderer/modules/webmidi/navigator_web_midi.cc | 6 +- .../blink/renderer/modules/webrtc/DIR_METADATA | 4 + .../blink/renderer/modules/webrtc/OWNERS | 3 - .../modules/webrtc/webrtc_audio_device_impl.cc | 5 +- .../modules/webrtc/webrtc_audio_renderer.cc | 2 +- .../renderer/modules/webshare/navigator_share.cc | 19 +- .../modules/webshare/navigator_share_test.cc | 6 +- .../blink/renderer/modules/websockets/BUILD.gn | 2 + .../blink/renderer/modules/websockets/DIR_METADATA | 4 + .../blink/renderer/modules/websockets/OWNERS | 3 - .../renderer/modules/websockets/dom_websocket.cc | 59 +- .../modules/websockets/dom_websocket_test.cc | 2 +- .../modules/websockets/websocket_channel_impl.cc | 89 +- .../modules/websockets/websocket_channel_impl.h | 3 +- .../websockets/websocket_channel_impl_test.cc | 2 +- .../modules/websockets/websocket_stream.cc | 10 +- .../renderer/modules/websockets/websocket_stream.h | 2 +- .../renderer/modules/webtransport/DIR_METADATA | 4 + .../blink/renderer/modules/webtransport/OWNERS | 3 - .../webtransport/bidirectional_stream_test.cc | 4 +- .../modules/webtransport/incoming_stream.cc | 1 - .../modules/webtransport/incoming_stream.h | 6 +- .../modules/webtransport/incoming_stream_test.cc | 4 +- .../modules/webtransport/outgoing_stream.cc | 2 +- .../modules/webtransport/outgoing_stream.h | 4 +- .../modules/webtransport/outgoing_stream_test.cc | 4 +- .../modules/webtransport/quic_transport.cc | 71 +- .../renderer/modules/webtransport/quic_transport.h | 8 +- .../webtransport/quic_transport_options.idl | 5 + .../modules/webtransport/quic_transport_test.cc | 105 +- .../renderer/modules/webtransport/send_stream.cc | 1 - .../renderer/modules/webtransport/send_stream.h | 2 +- .../renderer/modules/webtransport/test_utils.cc | 2 +- .../renderer/modules/webtransport/web_transport.h | 10 +- .../modules/webtransport/web_transport.idl | 5 + .../blink/renderer/modules/webusb/BUILD.gn | 4 - .../blink/renderer/modules/webusb/DIR_METADATA | 4 + .../blink/renderer/modules/webusb/OWNERS | 3 - .../blink/renderer/modules/webusb/navigator_usb.cc | 44 - .../blink/renderer/modules/webusb/navigator_usb.h | 39 - .../renderer/modules/webusb/navigator_usb.idl | 2 +- .../blink/renderer/modules/webusb/usb.cc | 24 +- .../blink/renderer/modules/webusb/usb.h | 10 +- .../blink/renderer/modules/webusb/usb_device.cc | 8 +- .../modules/webusb/usb_in_transfer_result.h | 6 +- .../webusb/usb_isochronous_in_transfer_packet.h | 2 +- .../webusb/usb_isochronous_in_transfer_result.h | 2 +- .../modules/webusb/worker_navigator_usb.cc | 64 - .../renderer/modules/webusb/worker_navigator_usb.h | 40 - .../modules/webusb/worker_navigator_usb.idl | 9 +- .../animation_and_paint_worklet_thread_test.cc | 6 +- .../modules/worklet/worklet_thread_test_common.cc | 6 +- .../third_party/blink/renderer/modules/xr/BUILD.gn | 22 +- .../blink/renderer/modules/xr/DIR_METADATA | 4 + .../third_party/blink/renderer/modules/xr/OWNERS | 3 - .../blink/renderer/modules/xr/document_xr.idl | 12 + .../blink/renderer/modules/xr/element_xr.h | 21 - .../blink/renderer/modules/xr/element_xr.idl | 12 - .../renderer/modules/xr/global_event_handlers_xr.h | 25 + .../blink/renderer/modules/xr/html_element_xr.idl | 12 + .../third_party/blink/renderer/modules/xr/idls.gni | 15 +- .../renderer/modules/xr/mathml_element_xr.idl | 12 + .../blink/renderer/modules/xr/svg_element_xr.idl | 12 + .../blink/renderer/modules/xr/window_xr.idl | 12 + .../blink/renderer/modules/xr/xr_anchor.cc | 2 +- .../modules/xr/xr_cpu_depth_information.cc | 145 + .../renderer/modules/xr/xr_cpu_depth_information.h | 54 + .../modules/xr/xr_cpu_depth_information.idl | 20 + .../blink/renderer/modules/xr/xr_cube_map.cc | 4 +- .../blink/renderer/modules/xr/xr_cube_map.h | 2 +- .../renderer/modules/xr/xr_depth_information.cc | 95 +- .../renderer/modules/xr/xr_depth_information.h | 37 +- .../renderer/modules/xr/xr_depth_information.idl | 10 +- .../blink/renderer/modules/xr/xr_depth_manager.cc | 136 + .../blink/renderer/modules/xr/xr_depth_manager.h | 67 + .../renderer/modules/xr/xr_depth_state_init.idl | 18 + .../blink/renderer/modules/xr/xr_frame.cc | 174 +- .../blink/renderer/modules/xr/xr_frame.h | 40 +- .../blink/renderer/modules/xr/xr_frame.idl | 18 +- .../blink/renderer/modules/xr/xr_frame_provider.cc | 2 - .../blink/renderer/modules/xr/xr_hand.cc | 61 + .../blink/renderer/modules/xr/xr_hand.h | 71 + .../blink/renderer/modules/xr/xr_hand.idl | 44 + .../renderer/modules/xr/xr_hit_test_result.cc | 7 +- .../modules/xr/xr_image_tracking_result.cc | 2 +- .../blink/renderer/modules/xr/xr_input_source.cc | 10 + .../blink/renderer/modules/xr/xr_input_source.h | 7 + .../blink/renderer/modules/xr/xr_input_source.idl | 1 + .../blink/renderer/modules/xr/xr_joint_pose.cc | 13 + .../blink/renderer/modules/xr/xr_joint_pose.h | 30 + .../blink/renderer/modules/xr/xr_joint_pose.idl | 11 + .../blink/renderer/modules/xr/xr_joint_space.cc | 53 + .../blink/renderer/modules/xr/xr_joint_space.h | 54 + .../blink/renderer/modules/xr/xr_joint_space.idl | 10 + .../blink/renderer/modules/xr/xr_light_probe.cc | 4 +- .../modules/xr/xr_native_origin_information.cc | 16 + .../modules/xr/xr_native_origin_information.h | 3 + .../blink/renderer/modules/xr/xr_plane.cc | 5 +- .../modules/xr/xr_plane_detection_state.cc | 12 - .../renderer/modules/xr/xr_plane_detection_state.h | 28 - .../modules/xr/xr_plane_detection_state.idl | 15 - .../blink/renderer/modules/xr/xr_plane_manager.cc | 93 + .../blink/renderer/modules/xr/xr_plane_manager.h | 41 + .../blink/renderer/modules/xr/xr_render_state.cc | 1 - .../blink/renderer/modules/xr/xr_session.cc | 144 +- .../blink/renderer/modules/xr/xr_session.h | 52 +- .../blink/renderer/modules/xr/xr_session.idl | 8 +- .../blink/renderer/modules/xr/xr_session_init.idl | 1 + .../blink/renderer/modules/xr/xr_system.cc | 204 +- .../blink/renderer/modules/xr/xr_system.h | 23 + .../blink/renderer/modules/xr/xr_utils.cc | 116 + .../blink/renderer/modules/xr/xr_utils.h | 7 + .../blink/renderer/modules/xr/xr_webgl_binding.cc | 58 +- .../blink/renderer/modules/xr/xr_webgl_binding.h | 4 + .../blink/renderer/modules/xr/xr_webgl_binding.idl | 6 +- .../modules/xr/xr_webgl_depth_information.cc | 14 + .../modules/xr/xr_webgl_depth_information.h | 24 + .../modules/xr/xr_webgl_depth_information.idl | 13 + .../renderer/modules/xr/xr_world_information.cc | 96 - .../renderer/modules/xr/xr_world_information.h | 47 - .../renderer/modules/xr/xr_world_information.idl | 15 - .../renderer/modules/xr/xr_world_tracking_state.cc | 20 - .../renderer/modules/xr/xr_world_tracking_state.h | 34 - .../modules/xr/xr_world_tracking_state.idl | 15 - .../third_party/blink/renderer/platform/BUILD.gn | 66 +- chromium/third_party/blink/renderer/platform/DEPS | 2 + .../blink/renderer/platform/DIR_METADATA | 3 + .../third_party/blink/renderer/platform/OWNERS | 2 - .../blink/renderer/platform/animation/DIR_METADATA | 4 + .../blink/renderer/platform/animation/OWNERS | 3 - .../animation/animation_translation_util_test.cc | 32 +- .../platform/animation/compositor_animation.cc | 2 +- .../platform/animation/compositor_animation.h | 4 +- .../animation/compositor_animation_curve.h | 5 +- .../animation/compositor_animation_delegate.h | 4 +- .../animation/compositor_color_animation_curve.cc | 14 +- .../animation/compositor_color_animation_curve.h | 10 +- .../compositor_color_animation_curve_test.cc | 26 +- .../animation/compositor_color_keyframe.cc | 12 +- .../platform/animation/compositor_color_keyframe.h | 10 +- .../animation/compositor_filter_animation_curve.cc | 6 +- .../animation/compositor_filter_animation_curve.h | 2 +- .../animation/compositor_filter_keyframe.cc | 2 +- .../animation/compositor_filter_keyframe.h | 4 +- .../animation/compositor_float_animation_curve.cc | 14 +- .../animation/compositor_float_animation_curve.h | 10 +- .../compositor_float_animation_curve_test.cc | 26 +- .../animation/compositor_float_keyframe.cc | 12 +- .../platform/animation/compositor_float_keyframe.h | 10 +- .../platform/animation/compositor_keyframe.h | 4 +- .../animation/compositor_keyframe_model.cc | 79 +- .../platform/animation/compositor_keyframe_model.h | 22 +- .../compositor_scroll_offset_animation_curve.cc | 4 +- .../compositor_scroll_offset_animation_curve.h | 2 +- .../compositor_transform_animation_curve.cc | 10 +- .../compositor_transform_animation_curve.h | 4 +- .../animation/compositor_transform_keyframe.cc | 10 +- .../animation/compositor_transform_keyframe.h | 8 +- .../animation/compositor_transform_operations.cc | 10 +- .../animation/compositor_transform_operations.h | 8 +- .../renderer/platform/animation/timing_function.cc | 18 +- .../renderer/platform/animation/timing_function.h | 30 +- .../blink/renderer/platform/audio/DIR_METADATA | 3 + .../blink/renderer/platform/audio/OWNERS | 2 - .../blink/renderer/platform/audio/audio_bus.cc | 28 +- .../blink/renderer/platform/audio/audio_bus.h | 11 +- .../blink/renderer/platform/audio/audio_channel.h | 5 - .../renderer/platform/audio/audio_utilities.cc | 7 +- .../blink/renderer/platform/audio/biquad.cc | 65 +- .../renderer/platform/audio/distance_effect.cc | 3 +- .../blink/renderer/platform/audio/down_sampler.cc | 7 +- .../platform/audio/dynamics_compressor_kernel.cc | 22 +- .../platform/audio/dynamics_compressor_kernel.h | 8 +- .../renderer/platform/audio/equal_power_panner.cc | 12 +- .../blink/renderer/platform/audio/fft_frame.cc | 11 +- .../blink/renderer/platform/audio/hrtf_kernel.cc | 12 - .../blink/renderer/platform/audio/hrtf_kernel.h | 3 - .../blink/renderer/platform/audio/hrtf_panner.cc | 3 +- .../blink/renderer/platform/audio/iir_filter.cc | 5 +- .../blink/renderer/platform/audio/panner.h | 4 +- .../renderer/platform/audio/push_pull_fifo.cc | 9 +- .../blink/renderer/platform/audio/reverb.cc | 3 +- .../renderer/platform/audio/sinc_resampler.cc | 7 +- .../blink/renderer/platform/audio/stereo_panner.cc | 17 +- .../blink/renderer/platform/audio/up_sampler.cc | 7 +- .../renderer/platform/back_forward_cache_utils.cc | 38 + .../renderer/platform/back_forward_cache_utils.h | 24 + .../blink/renderer/platform/bindings/DIR_METADATA | 4 + .../blink/renderer/platform/bindings/OWNERS | 3 - .../bindings/active_script_wrappable_base.h | 41 +- .../bindings/active_script_wrappable_manager.h | 2 - .../renderer/platform/bindings/dictionary_base.h | 2 - .../platform/bindings/dom_wrapper_world.cc | 9 +- .../renderer/platform/bindings/dom_wrapper_world.h | 10 +- .../renderer/platform/bindings/exception_context.h | 135 + .../platform/bindings/exception_messages.cc | 5 + .../platform/bindings/exception_messages.h | 2 + .../renderer/platform/bindings/exception_state.cc | 133 +- .../renderer/platform/bindings/exception_state.h | 147 +- .../platform/bindings/idl_member_installer.cc | 2 +- .../platform/bindings/parkable_string_manager.cc | 14 +- .../platform/bindings/parkable_string_manager.h | 3 - .../platform/bindings/parkable_string_test.cc | 52 +- .../platform/bindings/runtime_call_stats.h | 1 - .../renderer/platform/bindings/scoped_persistent.h | 6 - .../renderer/platform/bindings/script_state.cc | 7 +- .../renderer/platform/bindings/script_state.h | 6 +- .../renderer/platform/bindings/script_wrappable.cc | 15 + .../renderer/platform/bindings/script_wrappable.h | 6 + .../blink/renderer/platform/bindings/to_v8.h | 10 +- .../platform/bindings/trace_wrapper_v8_reference.h | 51 +- .../blink/renderer/platform/bindings/union_base.cc | 33 + .../blink/renderer/platform/bindings/union_base.h | 9 + .../platform/bindings/v0_custom_element_binding.cc | 47 - .../platform/bindings/v0_custom_element_binding.h | 56 - .../renderer/platform/bindings/v8_dom_wrapper.cc | 35 + .../renderer/platform/bindings/v8_dom_wrapper.h | 46 +- .../platform/bindings/v8_per_context_data.cc | 58 +- .../platform/bindings/v8_per_context_data.h | 42 +- .../platform/bindings/v8_per_isolate_data.cc | 16 +- .../platform/bindings/v8_per_isolate_data.h | 5 + .../renderer/platform/bindings/wrapper_type_info.h | 2 +- .../blink/renderer/platform/blob/DIR_METADATA | 4 + .../blink/renderer/platform/blob/OWNERS | 3 - .../renderer/platform/blob/blob_bytes_provider.cc | 4 +- .../platform/blob/blob_bytes_provider_test.cc | 11 +- .../platform/context_lifecycle_notifier.cc | 44 + .../renderer/platform/context_lifecycle_notifier.h | 25 +- .../platform/context_lifecycle_observer.cc | 25 +- .../renderer/platform/context_lifecycle_observer.h | 11 +- .../blink/renderer/platform/disk_data_allocator.cc | 2 - .../blink/renderer/platform/disk_data_allocator.h | 9 +- .../blink/renderer/platform/disk_data_metadata.h | 2 +- .../platform/exported/file_path_conversion.cc | 5 +- .../platform/exported/impression_conversions.cc | 27 + .../platform/exported/mediastream/DIR_METADATA | 4 + .../renderer/platform/exported/mediastream/OWNERS | 3 - .../blink/renderer/platform/exported/platform.cc | 4 + .../platform/exported/sync_load_response.cc | 18 - .../renderer/platform/exported/url_conversion.cc | 4 +- .../web_video_capture_impl_manager_test.cc | 3 +- .../web_back_forward_cache_loader_helper.cc | 31 + .../blink/renderer/platform/exported/web_font.cc | 1 - .../exported/web_memory_pressure_listener.cc | 2 +- .../platform/exported/web_mixed_content.cc | 99 - .../platform/exported/web_runtime_features.cc | 56 +- .../platform/exported/web_security_origin.cc | 5 - .../blink/renderer/platform/exported/web_string.cc | 13 +- .../renderer/platform/exported/web_string_test.cc | 4 +- .../renderer/platform/exported/web_url_request.cc | 22 + .../renderer/platform/exported/web_url_response.cc | 33 + .../platform/exported/web_url_response_test.cc | 13 + .../blink/renderer/platform/file_metadata.cc | 51 +- .../blink/renderer/platform/file_metadata.h | 24 +- .../blink/renderer/platform/fonts/OWNERS | 2 + .../platform/fonts/canvas_rotation_in_vertical.h | 18 +- .../blink/renderer/platform/fonts/font.cc | 83 +- .../blink/renderer/platform/fonts/font_cache.cc | 2 +- .../blink/renderer/platform/fonts/font_cache.h | 6 +- .../renderer/platform/fonts/font_description.cc | 66 +- .../renderer/platform/fonts/font_description.h | 19 +- .../renderer/platform/fonts/font_fallback_list.cc | 81 +- .../renderer/platform/fonts/font_fallback_list.h | 32 +- .../renderer/platform/fonts/font_fallback_map.cc | 2 +- .../renderer/platform/fonts/font_fallback_map.h | 2 + .../platform/fonts/font_matching_metrics.cc | 13 + .../platform/fonts/font_metrics_override.h | 2 +- .../renderer/platform/fonts/mac/font_cache_mac.mm | 8 +- .../platform/fonts/mac/font_matcher_mac.mm | 75 +- .../platform/fonts/mac/font_matcher_mac_test.mm | 16 - .../fonts/mac/font_platform_data_mac_test.mm | 19 +- .../platform/fonts/opentype/font_format_check.cc | 48 +- .../platform/fonts/opentype/font_format_check.h | 20 +- .../fonts/opentype/font_format_check_test.cc | 45 + .../fonts/opentype/open_type_caps_support.cc | 5 +- .../renderer/platform/fonts/script_run_iterator.cc | 43 +- .../renderer/platform/fonts/script_run_iterator.h | 2 +- .../platform/fonts/shaping/font_features.cc | 227 + .../platform/fonts/shaping/font_features.h | 47 + .../platform/fonts/shaping/font_features_test.cc | 122 + .../platform/fonts/shaping/harfbuzz_shaper.cc | 280 +- .../platform/fonts/shaping/run_segmenter_test.cc | 54 + .../platform/fonts/shaping/shape_result.cc | 159 +- .../renderer/platform/fonts/shaping/shape_result.h | 6 +- .../fonts/shaping/shape_result_bloberizer.cc | 6 +- .../fonts/shaping/shape_result_bloberizer.h | 5 +- .../platform/fonts/shaping/shape_result_buffer.cc | 16 +- .../fonts/shaping/shape_result_inline_headers.h | 63 +- .../platform/fonts/shaping/shape_result_spacing.cc | 10 +- .../platform/fonts/shaping/shape_result_spacing.h | 3 +- .../platform/fonts/shaping/shape_result_test.cc | 41 + .../platform/fonts/shaping/shape_result_view.cc | 30 +- .../platform/fonts/shaping/shape_result_view.h | 3 +- .../fonts/shaping/shape_result_view_test.cc | 41 + .../platform/fonts/shaping/shaping_line_breaker.cc | 39 +- .../fonts/shaping/shaping_line_breaker_test.cc | 50 + .../renderer/platform/fonts/simple_font_data.cc | 14 +- .../renderer/platform/fonts/simple_font_data.h | 16 +- .../renderer/platform/fonts/web_font_decoder.cc | 2 +- .../platform/fonts/web_font_typeface_factory.cc | 57 +- .../platform/fonts/web_font_typeface_factory.h | 7 +- .../platform/fonts/win/font_cache_skia_win.cc | 6 +- .../fonts/win/font_unique_name_lookup_win.cc | 19 +- .../platform/geometry/calculation_value.cc | 5 +- .../blink/renderer/platform/geometry/layout_unit.h | 24 + .../renderer/platform/geometry/length_functions.cc | 2 +- .../platform/geometry/length_functions_test.cc | 17 + .../blink/renderer/platform/graphics/DEPS | 14 + .../blink/renderer/platform/graphics/DIR_METADATA | 4 + .../blink/renderer/platform/graphics/OWNERS | 6 - .../graphics/accelerated_static_bitmap_image.cc | 12 +- .../graphics/accelerated_static_bitmap_image.h | 1 + .../animation_worklet_mutator_dispatcher_impl.cc | 47 +- .../animation_worklet_mutator_dispatcher_impl.h | 25 +- ...imation_worklet_mutator_dispatcher_impl_test.cc | 2 +- .../platform/graphics/begin_frame_provider.cc | 12 +- .../platform/graphics/begin_frame_provider.h | 3 + .../renderer/platform/graphics/bitmap_image.cc | 16 +- .../renderer/platform/graphics/bitmap_image.h | 7 + .../platform/graphics/bitmap_image_metrics.cc | 59 +- .../platform/graphics/bitmap_image_metrics.h | 6 +- .../platform/graphics/bitmap_image_test.cc | 43 +- .../platform/graphics/canvas_2d_layer_bridge.cc | 8 + .../graphics/canvas_2d_layer_bridge_test.cc | 85 +- .../platform/graphics/canvas_color_params.cc | 190 +- .../platform/graphics/canvas_color_params.h | 62 +- .../platform/graphics/canvas_color_params_test.cc | 1 + .../renderer/platform/graphics/canvas_resource.cc | 131 +- .../renderer/platform/graphics/canvas_resource.h | 73 +- .../graphics/canvas_resource_dispatcher.cc | 62 +- .../platform/graphics/canvas_resource_dispatcher.h | 15 +- .../graphics/canvas_resource_dispatcher_test.cc | 51 +- .../platform/graphics/canvas_resource_params.cc | 149 + .../platform/graphics/canvas_resource_params.h | 76 + .../platform/graphics/canvas_resource_provider.cc | 213 +- .../platform/graphics/canvas_resource_provider.h | 28 +- .../graphics/canvas_resource_provider_test.cc | 157 +- .../platform/graphics/canvas_resource_test.cc | 3 +- .../graphics/color_correction_test_utils.cc | 2 +- .../compositing/content_layer_client_impl.h | 6 +- .../compositing/paint_artifact_compositor.cc | 96 +- .../compositing/paint_artifact_compositor.h | 31 +- .../compositing/paint_artifact_compositor_test.cc | 71 +- .../compositing/paint_chunks_to_cc_layer.cc | 76 +- .../compositing/paint_chunks_to_cc_layer.h | 2 + .../compositing/paint_chunks_to_cc_layer_test.cc | 3 +- .../graphics/compositing/property_tree_manager.cc | 8 +- .../platform/graphics/compositing_reasons.h | 15 +- .../graphics/compositor_filter_operations.cc | 6 +- .../graphics/compositor_filter_operations.h | 3 +- .../platform/graphics/contiguous_container.h | 2 +- .../platform/graphics/crossfade_generated_image.cc | 20 +- .../platform/graphics/crossfade_generated_image.h | 2 + .../platform/graphics/decoding_image_generator.cc | 2 +- .../platform/graphics/deferred_image_decoder.cc | 79 +- .../platform/graphics/deferred_image_decoder.h | 10 +- .../deferred_image_decoder_test_wo_platform.cc | 3 + .../renderer/platform/graphics/filters/fe_blend.cc | 6 +- .../platform/graphics/filters/fe_box_reflect.h | 3 +- .../platform/graphics/filters/fe_color_matrix.cc | 5 +- .../graphics/filters/fe_component_transfer.cc | 5 +- .../platform/graphics/filters/fe_composite.cc | 13 +- .../graphics/filters/fe_convolve_matrix.cc | 18 +- .../graphics/filters/fe_displacement_map.cc | 25 +- .../platform/graphics/filters/fe_drop_shadow.cc | 7 +- .../renderer/platform/graphics/filters/fe_flood.cc | 6 +- .../platform/graphics/filters/fe_gaussian_blur.cc | 8 +- .../platform/graphics/filters/fe_lighting.cc | 10 +- .../renderer/platform/graphics/filters/fe_merge.cc | 6 +- .../platform/graphics/filters/fe_morphology.cc | 6 +- .../platform/graphics/filters/fe_offset.cc | 5 +- .../renderer/platform/graphics/filters/fe_tile.cc | 1 - .../platform/graphics/filters/fe_turbulence.cc | 7 +- .../platform/graphics/filters/filter_effect.cc | 15 +- .../platform/graphics/filters/filter_effect.h | 2 +- .../graphics/filters/paint_filter_builder.cc | 11 +- .../graphics/filters/paint_filter_effect.cc | 1 - .../platform/graphics/filters/source_alpha.cc | 1 - .../renderer/platform/graphics/gpu/DIR_METADATA | 3 + .../blink/renderer/platform/graphics/gpu/OWNERS | 3 +- .../graphics/gpu/dawn_control_client_holder.cc | 16 +- .../graphics/gpu/dawn_control_client_holder.h | 4 +- .../platform/graphics/gpu/drawing_buffer.cc | 74 +- .../platform/graphics/gpu/drawing_buffer.h | 10 +- .../graphics/gpu/drawing_buffer_test_helpers.h | 3 + .../platform/graphics/gpu/image_layer_bridge.cc | 6 +- .../graphics/gpu/shared_gpu_context_test.cc | 4 +- .../graphics/gpu/webgl_image_conversion.cc | 13 +- .../platform/graphics/gpu/webgl_image_conversion.h | 4 +- .../graphics/gpu/webgpu_image_bitmap_handler.cc | 51 - .../graphics/gpu/webgpu_image_bitmap_handler.h | 26 - .../gpu/webgpu_image_bitmap_handler_test.cc | 81 +- .../graphics/gpu/webgpu_mailbox_texture.cc | 93 + .../platform/graphics/gpu/webgpu_mailbox_texture.h | 63 + .../graphics/gpu/webgpu_swap_buffer_provider.cc | 27 +- .../graphics/gpu/webgpu_swap_buffer_provider.h | 4 +- .../gpu/webgpu_swap_buffer_provider_test.cc | 45 +- .../platform/graphics/gpu/xr_frame_transport.cc | 1 + .../platform/graphics/gradient_generated_image.cc | 4 +- .../platform/graphics/gradient_generated_image.h | 1 + .../renderer/platform/graphics/graphics_context.cc | 203 +- .../renderer/platform/graphics/graphics_context.h | 104 +- .../platform/graphics/graphics_context_test.cc | 10 +- .../renderer/platform/graphics/graphics_layer.cc | 59 +- .../renderer/platform/graphics/graphics_layer.h | 25 +- .../platform/graphics/graphics_layer_client.h | 4 + .../platform/graphics/graphics_layer_test.cc | 4 +- .../renderer/platform/graphics/graphics_types.h | 8 - .../graphics/identifiability_paint_op_digest.cc | 2 +- .../identifiability_paint_op_digest_unittest.cc | 9 +- .../blink/renderer/platform/graphics/image.cc | 22 +- .../blink/renderer/platform/graphics/image.h | 1 + .../platform/graphics/image_data_buffer.cc | 24 +- .../platform/graphics/image_frame_generator.cc | 74 +- .../platform/graphics/intercepting_canvas.h | 56 +- .../renderer/platform/graphics/logging_canvas.cc | 64 +- .../renderer/platform/graphics/logging_canvas.h | 20 +- .../renderer/platform/graphics/mailbox_ref.cc | 4 +- .../blink/renderer/platform/graphics/mailbox_ref.h | 5 +- .../platform/graphics/mailbox_texture_backing.cc | 6 + .../platform/graphics/mailbox_texture_backing.h | 2 + .../graphics/memory_managed_paint_canvas.cc | 7 +- .../graphics/memory_managed_paint_canvas.h | 2 + .../graphics/offscreen_canvas_placeholder.cc | 1 + .../graphics/offscreen_canvas_placeholder.h | 4 +- .../renderer/platform/graphics/paint/cull_rect.cc | 300 +- .../renderer/platform/graphics/paint/cull_rect.h | 31 +- .../platform/graphics/paint/cull_rect_test.cc | 402 +- .../platform/graphics/paint/display_item_client.cc | 11 +- .../platform/graphics/paint/display_item_client.h | 6 +- .../graphics/paint/display_item_client_test.cc | 12 +- .../platform/graphics/paint/drawing_recorder.cc | 4 +- .../platform/graphics/paint/geometry_mapper.h | 2 + .../platform/graphics/paint/layer_selection_data.h | 29 + .../platform/graphics/paint/paint_artifact.h | 7 +- .../platform/graphics/paint/paint_chunk.cc | 1 + .../renderer/platform/graphics/paint/paint_chunk.h | 14 + .../platform/graphics/paint/paint_chunker.cc | 65 +- .../platform/graphics/paint/paint_chunker.h | 13 + .../platform/graphics/paint/paint_controller.cc | 11 +- .../platform/graphics/paint/paint_controller.h | 10 + .../graphics/paint/paint_property_node_test.cc | 17 + .../graphics/paint/paint_record_builder.cc | 34 +- .../platform/graphics/paint/paint_record_builder.h | 32 +- .../graphics/paint/paint_record_builder_test.cc | 2 +- .../graphics/paint/painted_selection_bound.h | 29 + .../paint/transform_paint_property_node.cc | 1 - .../graphics/paint/transform_paint_property_node.h | 25 +- .../platform/graphics/paint_generated_image.cc | 4 +- .../platform/graphics/paint_generated_image.h | 1 + .../graphics/paint_worklet_paint_dispatcher.cc | 6 +- .../graphics/paint_worklet_paint_dispatcher.h | 2 +- .../renderer/platform/graphics/parkable_image.cc | 269 ++ .../renderer/platform/graphics/parkable_image.h | 120 + .../platform/graphics/parkable_image_manager.cc | 223 + .../platform/graphics/parkable_image_manager.h | 122 + .../platform/graphics/parkable_image_test.cc | 668 +++ .../blink/renderer/platform/graphics/path.cc | 63 +- .../blink/renderer/platform/graphics/path.h | 14 +- .../blink/renderer/platform/graphics/path_test.cc | 7 +- .../platform/graphics/placeholder_image.cc | 20 +- .../renderer/platform/graphics/placeholder_image.h | 1 + .../platform/graphics/placeholder_image_test.cc | 23 +- .../platform/graphics/resource_id_traits.h | 55 + .../blink/renderer/platform/graphics/rw_buffer.cc | 278 ++ .../blink/renderer/platform/graphics/rw_buffer.h | 121 + .../renderer/platform/graphics/rw_buffer_test.cc | 182 + .../platform/graphics/skia/image_pixel_locker.h | 1 + .../renderer/platform/graphics/skia/skia_utils.cc | 26 +- .../platform/graphics/static_bitmap_image.cc | 56 +- .../platform/graphics/static_bitmap_image.h | 13 +- .../platform/graphics/static_bitmap_image_test.cc | 35 - .../graphics/unaccelerated_static_bitmap_image.cc | 5 +- .../graphics/unaccelerated_static_bitmap_image.h | 1 + .../platform/graphics/video_frame_image_util.cc | 231 ++ .../platform/graphics/video_frame_image_util.h | 86 + .../graphics/video_frame_image_util_test.cc | 313 ++ .../platform/graphics/video_frame_submitter.cc | 20 +- .../platform/graphics/video_frame_submitter.h | 3 + .../graphics/video_frame_submitter_test.cc | 2 +- .../blink/renderer/platform/heap/BUILD.gn | 114 +- .../third_party/blink/renderer/platform/heap/DEPS | 1 + .../blink/renderer/platform/heap/DIR_METADATA | 4 + .../blink/renderer/platform/heap/OWNERS | 3 - .../blink/renderer/platform/heap/blink_gc.h | 8 +- .../platform/heap/blink_gc_memory_dump_provider.h | 8 +- .../platform/heap/collection_support/heap_deque.h | 58 + .../collection_support/heap_hash_counted_set.h | 61 + .../heap/collection_support/heap_hash_map.h | 67 + .../heap/collection_support/heap_hash_set.h | 45 + .../collection_support/heap_hash_table_backing.h | 320 +- .../heap/collection_support/heap_linked_hash_set.h | 42 + .../heap/collection_support/heap_linked_stack.h | 20 +- .../heap/collection_support/heap_list_hash_set.h | 125 + .../platform/heap/collection_support/heap_vector.h | 148 + .../heap/collection_support/heap_vector_backing.h | 207 +- .../blink/renderer/platform/heap/custom_spaces.h | 14 + .../renderer/platform/heap/disallow_new_wrapper.h | 60 +- .../renderer/platform/heap/garbage_collected.h | 8 +- .../blink/renderer/platform/heap/gc_task_runner.h | 81 +- .../blink/renderer/platform/heap/handle.h | 1 + .../blink/renderer/platform/heap/heap.h | 8 +- .../blink/renderer/platform/heap/heap_allocator.h | 17 +- .../renderer/platform/heap/heap_allocator_impl.h | 16 + .../renderer/platform/heap/heap_stats_collector.h | 8 +- .../renderer/platform/heap/heap_test_utilities.cc | 117 - .../renderer/platform/heap/heap_test_utilities.h | 210 +- .../blink/renderer/platform/heap/heap_traits.h | 38 +- .../collection_support/heap_hash_table_backing.h | 283 ++ .../impl/collection_support/heap_vector_backing.h | 213 + .../platform/heap/impl/disallow_new_wrapper.h | 53 - .../platform/heap/impl/garbage_collected.h | 3 +- .../blink/renderer/platform/heap/impl/gc_info.cc | 9 +- .../renderer/platform/heap/impl/gc_task_runner.h | 90 - .../blink/renderer/platform/heap/impl/heap.cc | 3 - .../blink/renderer/platform/heap/impl/heap.h | 42 - .../renderer/platform/heap/impl/heap_allocator.cc | 139 - .../renderer/platform/heap/impl/heap_allocator.h | 909 ---- .../platform/heap/impl/heap_allocator_impl.cc | 139 + .../platform/heap/impl/heap_allocator_impl.h | 178 + .../blink/renderer/platform/heap/impl/heap_page.cc | 116 +- .../blink/renderer/platform/heap/impl/heap_page.h | 20 +- .../platform/heap/impl/heap_stats_collector.cc | 12 +- .../platform/heap/impl/heap_stats_collector.h | 1 + .../platform/heap/impl/heap_test_utilities.cc | 117 + .../platform/heap/impl/heap_test_utilities.h | 225 + .../renderer/platform/heap/impl/heap_traits.h | 40 - .../renderer/platform/heap/impl/marking_visitor.cc | 18 +- .../renderer/platform/heap/impl/marking_visitor.h | 95 +- .../blink/renderer/platform/heap/impl/member.h | 59 +- .../renderer/platform/heap/impl/page_memory.cc | 11 +- .../renderer/platform/heap/impl/page_memory.h | 6 +- .../blink/renderer/platform/heap/impl/page_pool.cc | 9 +- .../blink/renderer/platform/heap/impl/persistent.h | 151 +- .../renderer/platform/heap/impl/persistent_node.h | 2 +- .../renderer/platform/heap/impl/process_heap.cc | 19 - .../renderer/platform/heap/impl/thread_state.cc | 181 +- .../renderer/platform/heap/impl/thread_state.h | 65 +- .../platform/heap/impl/thread_state_scopes.h | 46 - .../platform/heap/impl/thread_state_statistics.cc | 7 + .../platform/heap/impl/thread_state_statistics.h | 1 + .../renderer/platform/heap/impl/trace_traits.h | 253 -- .../platform/heap/impl/unified_heap_controller.cc | 3 +- .../heap/impl/unified_heap_marking_visitor.cc | 1 + .../heap/impl/unified_heap_marking_visitor.h | 6 +- .../blink/renderer/platform/heap/member.h | 131 +- .../blink/renderer/platform/heap/persistent.h | 174 +- .../blink/renderer/platform/heap/process_heap.h | 8 +- .../blink/renderer/platform/heap/self_keep_alive.h | 1 + .../blink/renderer/platform/heap/thread_state.h | 8 +- .../renderer/platform/heap/thread_state_scopes.h | 31 +- .../blink/renderer/platform/heap/trace_traits.h | 129 + .../platform/heap/unified_heap_controller.h | 8 +- .../platform/heap/unified_heap_marking_visitor.h | 8 +- .../renderer/platform/heap/v8_wrapper/blink_gc.h | 26 +- .../v8_wrapper/blink_gc_memory_dump_provider.cc | 137 + .../v8_wrapper/blink_gc_memory_dump_provider.h | 36 +- .../collection_support/heap_hash_table_backing.h | 275 ++ .../collection_support/heap_vector_backing.h | 214 + .../platform/heap/v8_wrapper/custom_spaces.cc | 21 + .../platform/heap/v8_wrapper/custom_spaces.h | 45 + .../heap/v8_wrapper/disallow_new_wrapper.h | 10 - .../platform/heap/v8_wrapper/garbage_collected.h | 27 +- .../platform/heap/v8_wrapper/gc_task_runner.h | 10 - .../blink/renderer/platform/heap/v8_wrapper/heap.h | 29 +- .../platform/heap/v8_wrapper/heap_allocator.h | 10 - .../platform/heap/v8_wrapper/heap_allocator_impl.h | 245 ++ .../platform/heap/v8_wrapper/heap_test_utilities.h | 54 + .../renderer/platform/heap/v8_wrapper/member.h | 26 + .../renderer/platform/heap/v8_wrapper/persistent.h | 59 + .../platform/heap/v8_wrapper/process_heap.h | 28 +- .../platform/heap/v8_wrapper/thread_state.cc | 143 + .../platform/heap/v8_wrapper/thread_state.h | 149 + .../platform/heap/v8_wrapper/thread_state_scopes.h | 23 +- .../platform/heap/v8_wrapper/trace_traits.h | 55 + .../heap/v8_wrapper/unified_heap_marking_visitor.h | 42 +- .../renderer/platform/heap/v8_wrapper/visitor.h | 1 + .../blink/renderer/platform/heap/visitor.h | 8 +- .../renderer/platform/image-decoders/DIR_METADATA | 3 + .../blink/renderer/platform/image-decoders/OWNERS | 2 - .../image-decoders/avif/avif_image_decoder.cc | 237 +- .../image-decoders/avif/avif_image_decoder.h | 41 +- .../image-decoders/avif/avif_image_decoder_test.cc | 161 +- .../image-decoders/bmp/bmp_image_decoder.cc | 2 +- .../fast_shared_buffer_reader_test.cc | 24 +- .../image-decoders/gif/gif_image_decoder_test.cc | 5 - .../platform/image-decoders/image_decoder.cc | 18 +- .../platform/image-decoders/image_decoder.h | 27 +- .../platform/image-decoders/image_decoder_test.cc | 57 +- .../image-decoders/image_decoder_test_helpers.cc | 50 - .../image-decoders/image_decoder_test_helpers.h | 6 - .../image-decoders/jpeg/jpeg_image_decoder.cc | 6 +- .../image-decoders/jpeg/jpeg_image_decoder_test.cc | 15 +- .../platform/image-decoders/segment_reader.cc | 34 +- .../platform/image-decoders/segment_reader.h | 8 +- .../image-decoders/webp/webp_image_decoder.cc | 45 +- .../image-decoders/webp/webp_image_decoder.h | 2 +- .../image-decoders/webp/webp_image_decoder_test.cc | 6 - .../renderer/platform/instrumentation/BUILD.gn | 7 +- .../renderer/platform/instrumentation/DIR_METADATA | 4 + .../blink/renderer/platform/instrumentation/OWNERS | 3 - .../renderer/platform/instrumentation/histogram.cc | 26 - .../renderer/platform/instrumentation/histogram.h | 16 - .../instrumentation/memory_pressure_listener.cc | 8 +- .../instrumentation/memory_pressure_listener.h | 7 +- .../partition_alloc_memory_dump_provider.cc | 32 + .../partition_alloc_memory_dump_provider_test.cc | 52 + .../document_resource_coordinator.cc | 17 +- .../document_resource_coordinator.h | 10 +- .../renderer_resource_coordinator.cc | 4 + .../renderer_resource_coordinator.h | 11 + .../blink/renderer/platform/json/DIR_METADATA | 3 + .../blink/renderer/platform/json/OWNERS | 2 - .../blink/renderer/platform/link_hash.cc | 5 +- .../blink/renderer/platform/loader/BUILD.gn | 31 +- .../blink/renderer/platform/loader/DEPS | 4 + .../blink/renderer/platform/loader/DIR_METADATA | 4 + .../blink/renderer/platform/loader/OWNERS | 3 - .../renderer/platform/loader/allowed_by_nosniff.cc | 15 + .../platform/loader/allowed_by_nosniff_test.cc | 16 + .../loader/child_url_loader_factory_bundle.cc | 69 +- .../blink/renderer/platform/loader/cors/cors.cc | 247 +- .../blink/renderer/platform/loader/cors/cors.h | 64 +- .../renderer/platform/loader/cors/cors_test.cc | 82 - .../blink/renderer/platform/loader/fetch/DEPS | 1 + .../fetch/back_forward_cache_loader_helper.h | 43 + .../loader/fetch/buffering_bytes_consumer.cc | 7 +- .../loader/fetch/buffering_bytes_consumer.h | 6 +- .../loader/fetch/buffering_bytes_consumer_test.cc | 4 +- .../loader/fetch/cached_metadata_handler_test.cc | 135 + .../loader/fetch/client_hints_preferences.cc | 18 +- .../loader/fetch/client_hints_preferences.h | 1 + .../loader/fetch/client_hints_preferences_test.cc | 28 +- .../loader/fetch/cross_origin_attribute_value.h | 2 + .../loader/fetch/data_pipe_bytes_consumer_test.cc | 96 +- .../fetch/fetch_api_request_body_mojom_traits.cc | 154 +- .../fetch/fetch_api_request_body_mojom_traits.h | 2 +- .../fetch_api_request_body_mojom_traits_test.cc | 14 +- .../loader/fetch/fetch_client_settings_object.h | 12 - .../renderer/platform/loader/fetch/fetch_context.h | 22 +- .../platform/loader/fetch/fetch_parameters.cc | 5 + .../platform/loader/fetch/fetch_parameters.h | 20 + .../renderer/platform/loader/fetch/memory_cache.cc | 3 +- .../renderer/platform/loader/fetch/memory_cache.h | 3 +- .../loader/fetch/memory_cache_correctness_test.cc | 3 +- .../platform/loader/fetch/memory_cache_test.cc | 6 +- .../renderer/platform/loader/fetch/raw_resource.cc | 33 +- .../renderer/platform/loader/fetch/raw_resource.h | 13 +- .../platform/loader/fetch/raw_resource_test.cc | 3 +- .../loader/fetch/render_blocking_behavior.h | 19 + .../renderer/platform/loader/fetch/resource.cc | 88 +- .../renderer/platform/loader/fetch/resource.h | 51 +- .../platform/loader/fetch/resource_error.cc | 8 +- .../platform/loader/fetch/resource_fetcher.cc | 293 +- .../platform/loader/fetch/resource_fetcher.h | 39 +- .../platform/loader/fetch/resource_fetcher_test.cc | 285 +- .../platform/loader/fetch/resource_load_observer.h | 12 +- .../platform/loader/fetch/resource_load_timing.cc | 1 + .../platform/loader/fetch/resource_loader.cc | 182 +- .../platform/loader/fetch/resource_loader.h | 28 +- .../fetch/resource_loader_defer_loading_test.cc | 6 +- .../loader/fetch/resource_loader_options.h | 4 +- .../platform/loader/fetch/resource_loader_test.cc | 359 +- .../platform/loader/fetch/resource_loading_log.h | 2 +- .../platform/loader/fetch/resource_request.cc | 52 +- .../platform/loader/fetch/resource_request.h | 59 +- .../platform/loader/fetch/resource_response.h | 36 + .../loader/fetch/resource_response_test.cc | 12 + .../platform/loader/fetch/resource_test.cc | 170 +- .../platform/loader/fetch/response_body_loader.cc | 45 +- .../platform/loader/fetch/response_body_loader.h | 18 +- .../loader/fetch/response_body_loader_client.h | 4 - .../loader/fetch/response_body_loader_test.cc | 132 +- .../platform/loader/fetch/script_fetch_options.cc | 1 + .../platform/loader/fetch/script_fetch_options.h | 5 + .../fetch/stale_revalidation_resource_client.cc | 9 +- .../fetch/stale_revalidation_resource_client.h | 1 - .../platform/loader/fetch/subresource_web_bundle.h | 12 +- .../renderer/platform/loader/fetch/url_loader/DEPS | 31 +- .../fetch/url_loader/mojo_url_loader_client.cc | 594 +++ .../fetch/url_loader/mojo_url_loader_client.h | 128 + .../url_loader/mojo_url_loader_client_unittest.cc | 898 ++++ .../loader/fetch/url_loader/request_conversion.cc | 102 +- .../loader/fetch/url_loader/request_conversion.h | 8 +- .../loader/fetch/url_loader/sync_load_context.cc | 335 ++ .../loader/fetch/url_loader/sync_load_context.h | 155 + .../fetch/url_loader/sync_load_context_unittest.cc | 219 + .../loader/fetch/url_loader/sync_load_response.cc | 18 + .../loader/fetch/url_loader/sync_load_response.h | 60 + .../url_loader/web_bundle_subresource_loader.cc | 459 --- .../url_loader/web_bundle_subresource_loader.h | 39 - .../web_bundle_subresource_loader_test.cc | 336 -- .../url_loader/web_resource_request_sender.cc | 630 +++ .../web_resource_request_sender_unittest.cc | 561 +++ .../loader/fetch/url_loader/web_url_loader.cc | 1172 ++++++ .../fetch/url_loader/web_url_loader_factory.cc | 46 + .../fetch/url_loader/web_url_loader_unittest.cc | 715 ++++ .../fetch/url_loader/worker_main_script_loader.cc | 23 +- .../fetch/url_loader/worker_main_script_loader.h | 11 +- .../worker_main_script_loader_unittest.cc | 30 +- .../loader/internet_disconnected_web_url_loader.cc | 6 +- .../renderer/platform/loader/mixed_content.cc | 102 + .../blink/renderer/platform/loader/mixed_content.h | 52 + .../platform/loader/testing/mock_fetch_context.h | 33 + .../platform/loader/testing/mock_resource.cc | 53 - .../platform/loader/testing/mock_resource.h | 31 - .../platform/loader/testing/test_loader_factory.h | 8 +- .../testing/web_url_loader_factory_with_mock.cc | 5 +- .../testing/web_url_loader_factory_with_mock.h | 5 +- .../platform/loader/web_url_request_extra_data.cc | 1 - .../platform/loader/web_url_request_util.cc | 54 +- .../renderer/platform/mediastream/DIR_METADATA | 4 + .../blink/renderer/platform/mediastream/OWNERS | 3 - .../media_stream_audio_processor_options.cc | 4 + .../media_stream_audio_processor_options.h | 3 + .../media_stream_audio_processor_options_test.cc | 6 + .../mediastream/media_stream_audio_source.cc | 7 +- .../mediastream/media_stream_audio_track.cc | 5 +- .../mediastream/webaudio_media_stream_source.cc | 10 +- .../blink/renderer/platform/mhtml/mhtml_archive.cc | 8 +- .../blink/renderer/platform/mhtml/mhtml_archive.h | 7 +- .../third_party/blink/renderer/platform/mojo/DEPS | 1 + .../platform/mojo/big_string_mojom_traits_test.cc | 10 +- .../renderer/platform/mojo/drag_mojom_traits.cc | 32 +- .../renderer/platform/mojo/drag_mojom_traits.h | 12 +- .../platform/mojo/heap_mojo_associated_receiver.h | 1 + .../mojo/heap_mojo_associated_receiver_set.h | 7 + .../mojo/heap_mojo_associated_receiver_set_test.cc | 40 +- .../mojo/heap_mojo_associated_receiver_test.cc | 46 +- .../platform/mojo/heap_mojo_associated_remote.h | 1 + .../mojo/heap_mojo_associated_remote_set.h | 119 + .../mojo/heap_mojo_associated_remote_set_test.cc | 214 + .../mojo/heap_mojo_associated_remote_test.cc | 43 +- .../renderer/platform/mojo/heap_mojo_receiver.h | 1 + .../platform/mojo/heap_mojo_receiver_set.h | 11 + .../platform/mojo/heap_mojo_receiver_set_test.cc | 39 +- .../platform/mojo/heap_mojo_receiver_test.cc | 50 +- .../renderer/platform/mojo/heap_mojo_remote.h | 1 + .../renderer/platform/mojo/heap_mojo_remote_set.h | 123 + .../platform/mojo/heap_mojo_remote_set_test.cc | 205 + .../platform/mojo/heap_mojo_remote_test.cc | 46 +- .../platform/mojo/heap_mojo_unique_receiver_set.h | 1 + .../mojo/heap_mojo_unique_receiver_set_test.cc | 40 +- .../renderer/platform/mojo/mojo_binding_context.h | 35 + .../platform/mojo/security_origin_mojom_traits.h | 3 +- .../platform/mojo/string16_mojom_traits_test.cc | 14 +- .../blink/renderer/platform/network/BUILD.gn | 2 +- .../network/content_security_policy_parsers.cc | 51 +- .../network/content_security_policy_parsers.h | 6 + .../content_security_policy_parsers_test.cc | 30 + .../content_security_policy_response_headers.cc | 12 +- .../content_security_policy_response_headers.h | 20 +- .../renderer/platform/network/http_names.json5 | 1 - .../renderer/platform/network/http_parsers.cc | 43 +- .../blink/renderer/platform/network/network_log.h | 20 - .../platform/network/network_state_notifier.cc | 30 +- .../network/network_state_notifier_test.cc | 47 + .../renderer/platform/network/network_utils.cc | 5 - .../renderer/platform/network/network_utils.h | 2 - .../blink/renderer/platform/p2p/DIR_METADATA | 3 + .../third_party/blink/renderer/platform/p2p/OWNERS | 2 - .../renderer/platform/p2p/socket_dispatcher.cc | 4 +- .../renderer/platform/p2p/socket_dispatcher.h | 5 +- .../blink/renderer/platform/peerconnection/DEPS | 5 +- .../renderer/platform/peerconnection/DIR_METADATA | 3 + .../blink/renderer/platform/peerconnection/OWNERS | 2 - .../rtc_event_log_output_sink_proxy.cc | 1 + .../platform/peerconnection/rtc_rtp_source_test.cc | 42 + .../peerconnection/rtc_rtp_transceiver_platform.h | 24 + .../rtc_session_description_platform.h | 4 +- .../peerconnection/rtc_video_decoder_adapter.cc | 37 +- .../peerconnection/rtc_video_decoder_adapter.h | 4 +- .../rtc_video_decoder_adapter_test.cc | 3 + .../peerconnection/rtc_video_decoder_factory.cc | 57 +- .../peerconnection/rtc_video_decoder_factory.h | 5 +- .../rtc_video_decoder_stream_adapter.cc | 805 ++++ .../rtc_video_decoder_stream_adapter.h | 199 + .../rtc_video_decoder_stream_adapter_test.cc | 409 ++ .../platform/peerconnection/rtc_video_encoder.cc | 58 +- .../platform/peerconnection/rtc_video_encoder.h | 5 +- .../peerconnection/rtc_video_encoder_test.cc | 27 +- .../platform/peerconnection/video_codec_factory.cc | 6 +- .../platform/peerconnection/video_codec_factory.h | 4 +- .../platform/peerconnection/webrtc_audio_sink.cc | 8 +- .../peerconnection/webrtc_video_track_source.cc | 24 +- .../peerconnection/webrtc_video_track_source.h | 9 +- .../webrtc_video_track_source_test.cc | 156 +- .../renderer/platform/privacy_budget/DIR_METADATA | 4 + .../blink/renderer/platform/privacy_budget/OWNERS | 3 - .../platform/runtime_enabled_features.json5 | 466 ++- .../blink/renderer/platform/scheduler/BUILD.gn | 2 + .../blink/renderer/platform/scheduler/DEPS | 1 + .../blink/renderer/platform/scheduler/DIR_METADATA | 4 + .../blink/renderer/platform/scheduler/OWNERS | 3 - .../platform/scheduler/TaskSchedulingInBlink.md | 3 +- .../platform/scheduler/common/dummy_schedulers.cc | 83 +- .../renderer/platform/scheduler/common/features.h | 15 + .../scheduler/common/idle_helper_unittest.cc | 1 + .../platform/scheduler/common/scheduler_helper.cc | 15 +- .../platform/scheduler/common/scheduler_helper.h | 14 +- .../scheduler/common/scheduler_helper_unittest.cc | 1 + .../platform/scheduler/common/scheduling_policy.cc | 1 - .../common/single_thread_idle_task_runner.cc | 2 - .../renderer/platform/scheduler/common/thread.cc | 19 +- .../scheduler/common/throttling/budget_pool.h | 7 +- .../common/throttling/budget_pool_unittest.cc | 4 +- .../common/throttling/cpu_time_budget_pool.cc | 41 +- .../common/throttling/cpu_time_budget_pool.h | 4 +- .../common/throttling/task_queue_throttler.cc | 40 +- .../common/throttling/task_queue_throttler.h | 11 +- .../throttling/task_queue_throttler_unittest.cc | 367 +- .../common/throttling/wake_up_budget_pool.cc | 30 +- .../common/throttling/wake_up_budget_pool.h | 4 +- .../platform/scheduler/common/tracing_helper.cc | 7 - .../platform/scheduler/common/tracing_helper.h | 12 +- .../scheduler/common/web_thread_scheduler.cc | 6 +- .../main_thread/agent_group_scheduler_impl.cc | 55 +- .../main_thread/agent_group_scheduler_impl.h | 23 +- .../auto_advancing_virtual_time_domain_unittest.cc | 1 + .../main_thread/compositor_priority_experiments.cc | 2 +- .../scheduler/main_thread/frame_scheduler_impl.cc | 108 +- .../scheduler/main_thread/frame_scheduler_impl.h | 14 +- .../main_thread/frame_scheduler_impl_unittest.cc | 190 +- .../main_thread/frame_task_queue_controller.cc | 21 +- .../main_thread/frame_task_queue_controller.h | 3 +- .../scheduler/main_thread/idle_time_estimator.cc | 29 +- .../scheduler/main_thread/idle_time_estimator.h | 7 +- .../main_thread/idle_time_estimator_unittest.cc | 92 +- .../platform/scheduler/main_thread/main_thread.cc | 8 +- .../platform/scheduler/main_thread/main_thread.h | 2 - .../main_thread/main_thread_scheduler_helper.cc | 18 +- .../main_thread/main_thread_scheduler_helper.h | 4 - .../main_thread/main_thread_scheduler_impl.cc | 412 +- .../main_thread/main_thread_scheduler_impl.h | 58 +- .../main_thread_scheduler_impl_unittest.cc | 78 +- .../main_thread/main_thread_task_queue.cc | 72 +- .../scheduler/main_thread/main_thread_task_queue.h | 88 +- .../scheduler/main_thread/main_thread_unittest.cc | 4 +- .../scheduler/main_thread/page_scheduler_impl.cc | 58 +- .../scheduler/main_thread/page_scheduler_impl.h | 8 +- .../main_thread/page_scheduler_impl_unittest.cc | 113 +- .../scheduler/main_thread/render_widget_signals.cc | 14 +- .../scheduler/main_thread/render_widget_signals.h | 3 +- .../scheduler/main_thread/task_type_names.cc | 2 + .../platform/scheduler/main_thread/user_model.cc | 31 +- .../platform/scheduler/main_thread/user_model.h | 3 +- .../scheduler/public/agent_group_scheduler.h | 3 + .../scheduler/public/frame_or_worker_scheduler.h | 4 +- .../platform/scheduler/public/page_scheduler.h | 4 + .../platform/scheduler/public/scheduling_policy.h | 6 +- .../renderer/platform/scheduler/public/thread.h | 1 - .../worker/compositor_thread_scheduler.cc | 2 - .../scheduler/worker/compositor_thread_scheduler.h | 4 - .../worker/non_main_thread_scheduler_impl.cc | 8 +- .../worker/non_main_thread_scheduler_impl.h | 19 +- .../platform/scheduler/worker/worker_scheduler.cc | 4 +- .../worker/worker_scheduler_proxy_unittest.cc | 21 +- .../scheduler/worker/worker_scheduler_unittest.cc | 1 + .../platform/scheduler/worker/worker_thread.cc | 54 +- .../platform/scheduler/worker/worker_thread.h | 23 +- .../scheduler/worker/worker_thread_scheduler.cc | 20 +- .../scheduler/worker/worker_thread_scheduler.h | 6 +- .../worker/worker_thread_scheduler_unittest.cc | 2 + .../blink/renderer/platform/supplementable.h | 2 +- .../blink/renderer/platform/testing/DEPS | 2 + .../renderer/platform/testing/data/colrv0_test.ttf | Bin 0 -> 976 bytes .../renderer/platform/testing/data/colrv1_test.ttf | Bin 0 -> 1128 bytes .../platform/testing/empty_web_media_player.cc | 7 +- .../platform/testing/empty_web_media_player.h | 19 +- .../platform/testing/fake_graphics_layer_client.h | 3 + .../testing/mock_context_lifecycle_notifier.h | 22 +- .../platform/testing/paint_property_test_helpers.h | 66 + .../platform/testing/paint_test_configurations.h | 19 +- .../platform/testing/test_paint_artifact.cc | 10 +- .../platform/testing/test_paint_artifact.h | 2 + .../platform/testing/testing_platform_support.cc | 3 +- .../renderer/platform/testing/unit_test_helpers.cc | 3 +- .../renderer/platform/testing/video_frame_utils.cc | 54 +- .../renderer/platform/testing/video_frame_utils.h | 7 + .../text/hyphenation/hyphenation_minikin.cc | 85 +- .../text/hyphenation/hyphenation_minikin.h | 5 + .../renderer/platform/text/hyphenation_test.cc | 45 +- .../platform/text/locale_to_script_mapping.cc | 6 +- .../renderer/platform/text/platform_locale.cc | 20 +- .../renderer/platform/text/text_break_iterator.cc | 7 +- .../third_party/blink/renderer/platform/timer.cc | 7 +- .../third_party/blink/renderer/platform/timer.h | 81 +- .../blink/renderer/platform/timer_test.cc | 8 +- .../transforms/interpolated_transform_operation.h | 3 + .../transforms/matrix_3d_transform_operation.h | 3 + .../transforms/matrix_transform_operation.h | 3 + .../transforms/scale_transform_operation.h | 3 + .../platform/transforms/transform_operation.h | 1 + .../platform/transforms/transform_operations.h | 8 + .../transforms/transform_operations_test.cc | 29 + .../platform/transforms/transformation_matrix.cc | 7 + .../platform/transforms/transformation_matrix.h | 6 +- .../transformation_matrix_test_helpers.h | 4 +- .../transforms/translate_transform_operation.h | 1 + .../blink/renderer/platform/video_capture/DEPS | 2 + .../renderer/platform/video_capture/DIR_METADATA | 3 + .../blink/renderer/platform/video_capture/OWNERS | 2 - .../video_capture/local_video_capturer_source.cc | 6 +- .../platform/video_capture/video_capture_impl.cc | 610 +-- .../platform/video_capture/video_capture_impl.h | 77 +- .../video_capture/video_capture_impl_test.cc | 314 +- .../blink/renderer/platform/weborigin/DIR_METADATA | 4 + .../blink/renderer/platform/weborigin/OWNERS | 3 - .../blink/renderer/platform/weborigin/kurl.cc | 116 +- .../blink/renderer/platform/weborigin/kurl.h | 5 + .../blink/renderer/platform/weborigin/kurl_test.cc | 171 +- .../platform/weborigin/origin_access_entry.cc | 2 +- .../renderer/platform/weborigin/scheme_registry.cc | 77 +- .../renderer/platform/weborigin/scheme_registry.h | 19 +- .../renderer/platform/weborigin/security_origin.cc | 128 +- .../renderer/platform/weborigin/security_origin.h | 25 +- .../platform/weborigin/security_origin_fuzzer.cc | 22 - .../platform/weborigin/security_origin_test.cc | 309 +- .../renderer/platform/weborigin/security_policy.cc | 62 +- .../renderer/platform/weborigin/security_policy.h | 8 - .../platform/weborigin/security_policy_test.cc | 71 +- .../blink/renderer/platform/webrtc/DEPS | 10 + .../blink/renderer/platform/webrtc/DIR_METADATA | 3 + .../blink/renderer/platform/webrtc/OWNERS | 2 - .../webrtc/peer_connection_remote_audio_source.cc | 7 +- .../platform/webrtc/webrtc_video_frame_adapter.cc | 503 ++- .../platform/webrtc/webrtc_video_frame_adapter.h | 76 +- .../webrtc/webrtc_video_frame_adapter_test.cc | 260 +- .../renderer/platform/webrtc/webrtc_video_utils.cc | 13 + .../renderer/platform/webrtc/webrtc_video_utils.h | 5 + .../blink/renderer/platform/widget/DEPS | 13 +- .../widget/compositing/android_webview/BUILD.gn | 8 +- .../widget/compositing/android_webview/DEPS | 1 + .../synchronous_layer_tree_frame_sink.cc | 38 +- .../synchronous_layer_tree_frame_sink.h | 7 +- .../widget/compositing/layer_tree_settings.cc | 15 +- .../platform/widget/compositing/layer_tree_view.cc | 28 +- .../platform/widget/compositing/layer_tree_view.h | 9 +- .../widget/compositing/layer_tree_view_delegate.h | 20 +- .../compositing/queue_report_time_swap_promise.cc | 2 + .../render_frame_metadata_observer_impl.cc | 2 +- .../compositing/widget_compositor_unittest.cc | 4 +- .../blink/renderer/platform/widget/frame_widget.h | 49 +- .../renderer/platform/widget/input/DIR_METADATA | 4 + .../blink/renderer/platform/widget/input/OWNERS | 5 - .../platform/widget/input/event_with_callback.cc | 24 +- .../platform/widget/input/event_with_callback.h | 6 + .../input/frame_widget_input_handler_impl.cc | 254 +- .../widget/input/frame_widget_input_handler_impl.h | 16 +- .../platform/widget/input/input_handler_proxy.cc | 193 +- .../widget/input/input_handler_proxy_unittest.cc | 186 +- .../platform/widget/input/input_metrics.cc | 48 + .../renderer/platform/widget/input/input_metrics.h | 21 + .../widget/input/main_thread_event_queue.cc | 12 +- .../platform/widget/input/scroll_predictor.cc | 9 +- .../platform/widget/input/scroll_predictor.h | 4 +- .../widget/input/scroll_predictor_unittest.cc | 92 +- .../widget/input/synchronous_compositor_proxy.cc | 13 +- .../widget/input/synchronous_compositor_proxy.h | 2 + .../widget/input/widget_base_input_handler.cc | 42 +- .../widget/input/widget_base_input_handler.h | 8 +- .../widget/input/widget_input_handler_impl.cc | 14 +- .../widget/input/widget_input_handler_impl.h | 10 +- .../widget/input/widget_input_handler_manager.cc | 57 +- .../widget/input/widget_input_handler_manager.h | 13 +- .../blink/renderer/platform/widget/widget_base.cc | 175 +- .../blink/renderer/platform/widget/widget_base.h | 70 +- .../renderer/platform/widget/widget_base_client.h | 32 +- .../blink/renderer/platform/wtf/BUILD.gn | 2 + .../third_party/blink/renderer/platform/wtf/DEPS | 2 + .../blink/renderer/platform/wtf/DIR_METADATA | 4 + .../third_party/blink/renderer/platform/wtf/OWNERS | 3 - .../renderer/platform/wtf/allocator/allocator.h | 88 +- .../platform/wtf/allocator/partition_allocator.h | 10 +- .../renderer/platform/wtf/allocator/partitions.cc | 113 +- .../renderer/platform/wtf/allocator/partitions.h | 6 +- .../platform/wtf/allocator/partitions_test.cc | 4 +- .../blink/renderer/platform/wtf/assertions.h | 77 - .../renderer/platform/wtf/container_annotations.h | 7 +- .../renderer/platform/wtf/cross_thread_copier.h | 17 +- .../blink/renderer/platform/wtf/deque.h | 30 +- .../blink/renderer/platform/wtf/deque_test.cc | 36 + .../blink/renderer/platform/wtf/functional.h | 64 +- .../blink/renderer/platform/wtf/hash_iterators.h | 108 +- .../blink/renderer/platform/wtf/hash_map_test.cc | 72 + .../blink/renderer/platform/wtf/hash_table.h | 55 +- .../blink/renderer/platform/wtf/leak_annotations.h | 59 - .../blink/renderer/platform/wtf/list_hash_set.h | 430 +- .../blink/renderer/platform/wtf/std_lib_extras.h | 9 +- .../blink/renderer/platform/wtf/text/DIR_METADATA | 4 + .../blink/renderer/platform/wtf/text/OWNERS | 3 - .../renderer/platform/wtf/text/ascii_fast_path.h | 45 +- .../renderer/platform/wtf/text/atomic_string.cc | 5 + .../renderer/platform/wtf/text/atomic_string.h | 10 + .../renderer/platform/wtf/text/character_names.h | 8 + .../renderer/platform/wtf/text/string_builder.cc | 11 +- .../platform/wtf/text/string_builder_test.cc | 10 + .../renderer/platform/wtf/text/string_impl.cc | 59 +- .../blink/renderer/platform/wtf/text/string_impl.h | 57 +- .../blink/renderer/platform/wtf/text/string_mac.mm | 3 +- .../blink/renderer/platform/wtf/text/string_view.h | 11 +- .../renderer/platform/wtf/text/text_codec_icu.cc | 2 +- .../blink/renderer/platform/wtf/text/wtf_string.cc | 12 +- .../blink/renderer/platform/wtf/text/wtf_string.h | 16 + .../renderer/platform/wtf/text/wtf_string_test.cc | 3 +- .../blink/renderer/platform/wtf/threading.cc | 2 + .../blink/renderer/platform/wtf/threading.h | 7 + .../blink/renderer/platform/wtf/type_traits.h | 41 +- .../blink/renderer/platform/wtf/vector.h | 10 +- 5154 files changed, 164679 insertions(+), 102631 deletions(-) delete mode 100644 chromium/third_party/blink/renderer/.style.yapf create mode 100644 chromium/third_party/blink/renderer/bindings/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/bindings/core/v8/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/bindings/core/v8/custom/DEPS create mode 100644 chromium/third_party/blink/renderer/bindings/core/v8/module_request.cc create mode 100644 chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits.h create mode 100644 chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc delete mode 100644 chromium/third_party/blink/renderer/bindings/core/v8/v0_custom_element_constructor_builder.cc delete mode 100644 chromium/third_party/blink/renderer/bindings/core/v8/v0_custom_element_constructor_builder.h delete mode 100644 chromium/third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.cc delete mode 100644 chromium/third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.h delete mode 100644 chromium/third_party/blink/renderer/bindings/scripts/bind_gen/.style.yapf delete mode 100644 chromium/third_party/blink/renderer/bindings/scripts/web_idl/.style.yapf create mode 100644 chromium/third_party/blink/renderer/build/scripts/make_document_policy_features_tests.py create mode 100644 chromium/third_party/blink/renderer/build/scripts/writer_test_util.py create mode 100644 chromium/third_party/blink/renderer/controller/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl_test.cc create mode 100644 chromium/third_party/blink/renderer/core/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/accessibility/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/animation/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.cc create mode 100644 chromium/third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.h create mode 100644 chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type_test.cc create mode 100644 chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map_test.cc create mode 100644 chromium/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.cc create mode 100644 chromium/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h create mode 100644 chromium/third_party/blink/renderer/core/animation_frame/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/aom/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/clipboard/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/css/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/css/background_color_paint_image_generator.cc create mode 100644 chromium/third_party/blink/renderer/core/css/background_color_paint_image_generator.h create mode 100644 chromium/third_party/blink/renderer/core/css/container_query.cc create mode 100644 chromium/third_party/blink/renderer/core/css/container_query.h create mode 100644 chromium/third_party/blink/renderer/core/css/container_query_evaluator.cc create mode 100644 chromium/third_party/blink/renderer/core/css/container_query_evaluator.h create mode 100644 chromium/third_party/blink/renderer/core/css/container_query_evaluator_test.cc create mode 100644 chromium/third_party/blink/renderer/core/css/container_query_test.cc create mode 100644 chromium/third_party/blink/renderer/core/css/counter_style.cc create mode 100644 chromium/third_party/blink/renderer/core/css/counter_style.h create mode 100644 chromium/third_party/blink/renderer/core/css/counter_style_map.cc create mode 100644 chromium/third_party/blink/renderer/core/css/counter_style_map.h create mode 100644 chromium/third_party/blink/renderer/core/css/counter_style_map_test.cc create mode 100644 chromium/third_party/blink/renderer/core/css/counter_style_test.cc create mode 100644 chromium/third_party/blink/renderer/core/css/css_container_rule.cc create mode 100644 chromium/third_party/blink/renderer/core/css/css_container_rule.h create mode 100644 chromium/third_party/blink/renderer/core/css/css_container_rule.idl create mode 100644 chromium/third_party/blink/renderer/core/css/css_value_clamping_utils.cc create mode 100644 chromium/third_party/blink/renderer/core/css/css_value_clamping_utils.h create mode 100644 chromium/third_party/blink/renderer/core/css/css_value_clamping_utils_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.cc delete mode 100644 chromium/third_party/blink/renderer/core/css/media_values_initial_viewport.h delete mode 100644 chromium/third_party/blink/renderer/core/css/media_values_initial_viewport_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/css/native_paint_image_generator.cc create mode 100644 chromium/third_party/blink/renderer/core/css/predefined_counter_styles.css delete mode 100644 chromium/third_party/blink/renderer/core/css/resolver/style_resolver_state_test.cc create mode 100644 chromium/third_party/blink/renderer/core/css/style_rule_counter_style.cc create mode 100644 chromium/third_party/blink/renderer/core/css/style_rule_counter_style.h create mode 100644 chromium/third_party/blink/renderer/core/document_transition/DEPS create mode 100644 chromium/third_party/blink/renderer/core/document_transition/README.md create mode 100644 chromium/third_party/blink/renderer/core/document_transition/build.gni create mode 100644 chromium/third_party/blink/renderer/core/document_transition/document_transition.cc create mode 100644 chromium/third_party/blink/renderer/core/document_transition/document_transition.h create mode 100644 chromium/third_party/blink/renderer/core/document_transition/document_transition.idl create mode 100644 chromium/third_party/blink/renderer/core/document_transition/document_transition_init.idl create mode 100644 chromium/third_party/blink/renderer/core/document_transition/document_transition_supplement.cc create mode 100644 chromium/third_party/blink/renderer/core/document_transition/document_transition_supplement.h create mode 100644 chromium/third_party/blink/renderer/core/document_transition/document_transition_supplement.idl create mode 100644 chromium/third_party/blink/renderer/core/document_transition/document_transition_test.cc create mode 100644 chromium/third_party/blink/renderer/core/dom/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/dom/abstract_range.cc create mode 100644 chromium/third_party/blink/renderer/core/dom/abstract_range.h create mode 100644 chromium/third_party/blink/renderer/core/dom/abstract_range.idl delete mode 100644 chromium/third_party/blink/renderer/core/dom/distributed_nodes.cc delete mode 100644 chromium/third_party/blink/renderer/core/dom/distributed_nodes.h create mode 100644 chromium/third_party/blink/renderer/core/dom/interest_cohort.idl delete mode 100644 chromium/third_party/blink/renderer/core/dom/set_inner_html_options.idl delete mode 100644 chromium/third_party/blink/renderer/core/dom/shadow_dom_v0_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/dom/shadow_root_v0.cc delete mode 100644 chromium/third_party/blink/renderer/core/dom/shadow_root_v0.h create mode 100644 chromium/third_party/blink/renderer/core/dom/static_range_init.idl create mode 100644 chromium/third_party/blink/renderer/core/dom/tree_ordered_map_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/dom/v0_insertion_point.cc delete mode 100644 chromium/third_party/blink/renderer/core/dom/v0_insertion_point.h create mode 100644 chromium/third_party/blink/renderer/core/editing/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/editing/finder/async_find_buffer.cc create mode 100644 chromium/third_party/blink/renderer/core/editing/finder/async_find_buffer.h create mode 100644 chromium/third_party/blink/renderer/core/editing/finder/find_buffer_runner.h create mode 100644 chromium/third_party/blink/renderer/core/editing/finder/sync_find_buffer.cc create mode 100644 chromium/third_party/blink/renderer/core/editing/finder/sync_find_buffer.h create mode 100644 chromium/third_party/blink/renderer/core/editing/range_in_flat_tree.cc create mode 100644 chromium/third_party/blink/renderer/core/editing/range_in_flat_tree.h delete mode 100644 chromium/third_party/blink/renderer/core/editing/selection_type.h create mode 100644 chromium/third_party/blink/renderer/core/events/mouse_event_test.cc create mode 100644 chromium/third_party/blink/renderer/core/events/simulated_event_util.cc create mode 100644 chromium/third_party/blink/renderer/core/events/simulated_event_util.h create mode 100644 chromium/third_party/blink/renderer/core/execution_context/DEPS create mode 100644 chromium/third_party/blink/renderer/core/execution_context/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/core/execution_context/agent_metrics_collector.cc delete mode 100644 chromium/third_party/blink/renderer/core/execution_context/agent_metrics_collector.h delete mode 100644 chromium/third_party/blink/renderer/core/execution_context/agent_metrics_collector_test.cc create mode 100644 chromium/third_party/blink/renderer/core/execution_context/navigator_base.h create mode 100644 chromium/third_party/blink/renderer/core/exported/test_web_frame_content_dumper.cc create mode 100644 chromium/third_party/blink/renderer/core/exported/web_view_observer.cc create mode 100644 chromium/third_party/blink/renderer/core/feature_policy/document_policy_sim_test.cc create mode 100644 chromium/third_party/blink/renderer/core/feature_policy/feature_policy_devtools_support.cc create mode 100644 chromium/third_party/blink/renderer/core/feature_policy/feature_policy_devtools_support.h create mode 100644 chromium/third_party/blink/renderer/core/feature_policy/feature_policy_devtools_support_test.cc create mode 100644 chromium/third_party/blink/renderer/core/fetch/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/fileapi/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/frame/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/frame/csp/conversion_util.cc create mode 100644 chromium/third_party/blink/renderer/core/frame/csp/conversion_util.h create mode 100644 chromium/third_party/blink/renderer/core/frame/csp/conversion_util_fuzzer.cc create mode 100644 chromium/third_party/blink/renderer/core/frame/csp/conversion_util_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/frame/csp/csp_directive.h delete mode 100644 chromium/third_party/blink/renderer/core/frame/csp/media_list_directive.cc delete mode 100644 chromium/third_party/blink/renderer/core/frame/csp/media_list_directive.h delete mode 100644 chromium/third_party/blink/renderer/core/frame/csp/media_list_directive_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/frame/csp/string_list_directive.cc delete mode 100644 chromium/third_party/blink/renderer/core/frame/csp/string_list_directive.h delete mode 100644 chromium/third_party/blink/renderer/core/frame/csp/string_list_directive_test.cc create mode 100644 chromium/third_party/blink/renderer/core/frame/csp/trusted_types_directive.cc create mode 100644 chromium/third_party/blink/renderer/core/frame/csp/trusted_types_directive.h create mode 100644 chromium/third_party/blink/renderer/core/frame/csp/trusted_types_directive_test.cc create mode 100644 chromium/third_party/blink/renderer/core/frame/frame_content_as_text.cc create mode 100644 chromium/third_party/blink/renderer/core/frame/frame_content_as_text.h create mode 100644 chromium/third_party/blink/renderer/core/frame/frame_content_as_text_test.cc create mode 100644 chromium/third_party/blink/renderer/core/frame/impression_params.idl create mode 100644 chromium/third_party/blink/renderer/core/frame/navigator_window_controls_overlay.idl delete mode 100644 chromium/third_party/blink/renderer/core/frame/sandbox_flags.cc delete mode 100644 chromium/third_party/blink/renderer/core/frame/sandbox_flags.h delete mode 100644 chromium/third_party/blink/renderer/core/frame/web_frame_widget_base.cc delete mode 100644 chromium/third_party/blink/renderer/core/frame/web_frame_widget_base.h delete mode 100644 chromium/third_party/blink/renderer/core/frame/web_view_frame_widget.cc delete mode 100644 chromium/third_party/blink/renderer/core/frame/web_view_frame_widget.h create mode 100644 chromium/third_party/blink/renderer/core/frame/window_controls_overlay.cc create mode 100644 chromium/third_party/blink/renderer/core/frame/window_controls_overlay.h create mode 100644 chromium/third_party/blink/renderer/core/frame/window_controls_overlay.idl create mode 100644 chromium/third_party/blink/renderer/core/fullscreen/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/html/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/html/battery_savings.h create mode 100644 chromium/third_party/blink/renderer/core/html/canvas/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/core/html/canvas/image_data_color_settings.idl create mode 100644 chromium/third_party/blink/renderer/core/html/canvas/image_data_settings.idl create mode 100644 chromium/third_party/blink/renderer/core/html/conversion_measurement_parsing.cc create mode 100644 chromium/third_party/blink/renderer/core/html/conversion_measurement_parsing.h create mode 100644 chromium/third_party/blink/renderer/core/html/custom/custom_state_set.cc create mode 100644 chromium/third_party/blink/renderer/core/html/custom/custom_state_set.h create mode 100644 chromium/third_party/blink/renderer/core/html/custom/custom_state_set.idl delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_async_import_microtask_queue.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_async_import_microtask_queue.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_callback_invocation.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_callback_invocation.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_callback_queue.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_callback_queue.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_definition.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_definition.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_descriptor.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_descriptor_hash.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_exception.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_exception.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_lifecycle_callbacks.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_dispatcher.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_dispatcher.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_import_step.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_import_step.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_queue_base.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_queue_base.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_resolution_step.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_resolution_step.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_run_queue.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_run_queue.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_microtask_step.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_observer.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_observer.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_processing_step.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_registration_context.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_registration_context.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_registry.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_registry.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_scheduler.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_scheduler.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_sync_microtask_queue.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_sync_microtask_queue.h delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_upgrade_candidate_map.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/custom/v0_custom_element_upgrade_candidate_map.h create mode 100644 chromium/third_party/blink/renderer/core/html/forms/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/html/forms/html_select_menu_element.cc create mode 100644 chromium/third_party/blink/renderer/core/html/forms/html_select_menu_element.h create mode 100644 chromium/third_party/blink/renderer/core/html/forms/html_select_menu_element.idl delete mode 100644 chromium/third_party/blink/renderer/core/html/html_content_element.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/html_content_element.h delete mode 100644 chromium/third_party/blink/renderer/core/html/html_content_element.idl delete mode 100644 chromium/third_party/blink/renderer/core/html/html_content_element_test.cc create mode 100644 chromium/third_party/blink/renderer/core/html/html_popup_element.cc create mode 100644 chromium/third_party/blink/renderer/core/html/html_popup_element.h create mode 100644 chromium/third_party/blink/renderer/core/html/html_popup_element.idl delete mode 100644 chromium/third_party/blink/renderer/core/html/html_shadow_element.cc delete mode 100644 chromium/third_party/blink/renderer/core/html/html_shadow_element.h delete mode 100644 chromium/third_party/blink/renderer/core/html/html_shadow_element.idl create mode 100644 chromium/third_party/blink/renderer/core/html/media/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/html/media/audio_output_device_controller.cc create mode 100644 chromium/third_party/blink/renderer/core/html/media/audio_output_device_controller.h create mode 100644 chromium/third_party/blink/renderer/core/html/parser/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/html/portal/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/html/track/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/imagebitmap/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc delete mode 100644 chromium/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.h create mode 100644 chromium/third_party/blink/renderer/core/inspector/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/inspector/inspector_contrast.cc create mode 100644 chromium/third_party/blink/renderer/core/inspector/inspector_contrast.h create mode 100644 chromium/third_party/blink/renderer/core/inspector/inspector_contrast_test.cc create mode 100644 chromium/third_party/blink/renderer/core/inspector/inspector_media_context_impl_unittest.cc create mode 100644 chromium/third_party/blink/renderer/core/inspector/inspector_performance_timeline_agent.cc create mode 100644 chromium/third_party/blink/renderer/core/inspector/inspector_performance_timeline_agent.h create mode 100644 chromium/third_party/blink/renderer/core/inspector/node_content_visibility_state.h create mode 100644 chromium/third_party/blink/renderer/core/layout/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/layout/geometry/axis.h create mode 100644 chromium/third_party/blink/renderer/core/layout/geometry/axis_test.cc create mode 100644 chromium/third_party/blink/renderer/core/layout/layout-shift-tracker-old-paint-offset.md create mode 100644 chromium/third_party/blink/renderer/core/layout/layout_list_marker_test.cc create mode 100644 chromium/third_party/blink/renderer/core/layout/list_marker_test.cc create mode 100644 chromium/third_party/blink/renderer/core/layout/ng/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/layout/ng/custom/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/core/layout/ng/inline/ng_inline_fragment_traversal.cc delete mode 100644 chromium/third_party/blink/renderer/core/layout/ng/inline/ng_inline_fragment_traversal.h delete mode 100644 chromium/third_party/blink/renderer/core/layout/ng/inline/ng_inline_fragment_traversal_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment.cc delete mode 100644 chromium/third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment.h delete mode 100644 chromium/third_party/blink/renderer/core/layout/ng/inline/ng_physical_text_fragment_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/layout/ng/inline/ng_text_fragment_builder.cc delete mode 100644 chromium/third_party/blink/renderer/core/layout/ng/inline/ng_text_fragment_builder.h create mode 100644 chromium/third_party/blink/renderer/core/layout/ng/ng_physical_fragment_test.cc create mode 100644 chromium/third_party/blink/renderer/core/layout/ng/ng_replaced_layout_algorithm.cc create mode 100644 chromium/third_party/blink/renderer/core/layout/ng/ng_replaced_layout_algorithm.h create mode 100644 chromium/third_party/blink/renderer/core/layout/svg/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/layout/svg/svg_hit_test_perftest.cc delete mode 100644 chromium/third_party/blink/renderer/core/layout/svg/svg_resources_cache.cc delete mode 100644 chromium/third_party/blink/renderer/core/layout/svg/svg_resources_cache.h delete mode 100644 chromium/third_party/blink/renderer/core/layout/svg/svg_resources_cycle_solver.cc delete mode 100644 chromium/third_party/blink/renderer/core/layout/svg/svg_resources_cycle_solver.h create mode 100644 chromium/third_party/blink/renderer/core/loader/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/loader/appcache/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_for_frame.cc create mode 100644 chromium/third_party/blink/renderer/core/loader/back_forward_cache_loader_helper_for_frame.h create mode 100644 chromium/third_party/blink/renderer/core/loader/frame_client_hints_preferences_context.cc create mode 100644 chromium/third_party/blink/renderer/core/loader/frame_client_hints_preferences_context.h create mode 100644 chromium/third_party/blink/renderer/core/loader/modulescript/module_script_creation_params.cc create mode 100644 chromium/third_party/blink/renderer/core/loader/no_state_prefetch_client.cc create mode 100644 chromium/third_party/blink/renderer/core/loader/no_state_prefetch_client.h create mode 100644 chromium/third_party/blink/renderer/core/loader/prerender_handle.cc create mode 100644 chromium/third_party/blink/renderer/core/loader/prerender_handle.h delete mode 100644 chromium/third_party/blink/renderer/core/loader/prerenderer_client.cc delete mode 100644 chromium/third_party/blink/renderer/core/loader/prerenderer_client.h delete mode 100644 chromium/third_party/blink/renderer/core/loader/previews_resource_loading_hints.cc delete mode 100644 chromium/third_party/blink/renderer/core/loader/previews_resource_loading_hints.h delete mode 100644 chromium/third_party/blink/renderer/core/loader/previews_resource_loading_hints_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/loader/private/frame_client_hints_preferences_context.cc delete mode 100644 chromium/third_party/blink/renderer/core/loader/private/frame_client_hints_preferences_context.h delete mode 100644 chromium/third_party/blink/renderer/core/loader/private/prerender_client.h delete mode 100644 chromium/third_party/blink/renderer/core/loader/private/prerender_handle.cc delete mode 100644 chromium/third_party/blink/renderer/core/loader/private/prerender_handle.h create mode 100644 chromium/third_party/blink/renderer/core/loader/resource/script_resource_test.cc create mode 100644 chromium/third_party/blink/renderer/core/loader/subresource_redirect_util.cc create mode 100644 chromium/third_party/blink/renderer/core/loader/subresource_redirect_util.h create mode 100644 chromium/third_party/blink/renderer/core/messaging/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/mobile_metrics/mobile_metrics_test_helpers.h delete mode 100644 chromium/third_party/blink/renderer/core/mojo/BUILD.gn create mode 100644 chromium/third_party/blink/renderer/core/mojo/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/core/mojo/tests/js_to_cpp.mojom create mode 100644 chromium/third_party/blink/renderer/core/offscreencanvas/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/page/scrolling/text_fragment_finder_test.cc create mode 100644 chromium/third_party/blink/renderer/core/paint/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/paint/compositing/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/paint/cull_rect_updater.cc create mode 100644 chromium/third_party/blink/renderer/core/paint/cull_rect_updater.h create mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.cc create mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_highlight_painter.h delete mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.cc delete mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_paint_fragment.h delete mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_paint_fragment_test.cc delete mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_paint_fragment_traversal.cc delete mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_paint_fragment_traversal.h delete mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_paint_fragment_traversal_test.cc create mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_table_cell_paint_invalidator.cc create mode 100644 chromium/third_party/blink/renderer/core/paint/ng/ng_table_cell_paint_invalidator.h create mode 100644 chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc create mode 100644 chromium/third_party/blink/renderer/core/paint/selection_bounds_recorder.h create mode 100644 chromium/third_party/blink/renderer/core/resize_observer/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/script/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/streams/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/streams/underlying_source.idl create mode 100644 chromium/third_party/blink/renderer/core/streams/underlying_source_cancel_callback.idl create mode 100644 chromium/third_party/blink/renderer/core/streams/underlying_source_pull_callback.idl create mode 100644 chromium/third_party/blink/renderer/core/streams/underlying_source_start_callback.idl create mode 100644 chromium/third_party/blink/renderer/core/style/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/core/style/counter_content.h create mode 100644 chromium/third_party/blink/renderer/core/style/list_style_type_data.cc create mode 100644 chromium/third_party/blink/renderer/core/style/list_style_type_data.h delete mode 100644 chromium/third_party/blink/renderer/core/style/svg_computed_style.cc delete mode 100644 chromium/third_party/blink/renderer/core/style/svg_computed_style.h delete mode 100644 chromium/third_party/blink/renderer/core/style/svg_computed_style_defs.cc delete mode 100644 chromium/third_party/blink/renderer/core/style/svg_computed_style_defs.h delete mode 100644 chromium/third_party/blink/renderer/core/style/svg_computed_style_test.cc create mode 100644 chromium/third_party/blink/renderer/core/style/svg_dash_array.cc create mode 100644 chromium/third_party/blink/renderer/core/style/svg_dash_array.h create mode 100644 chromium/third_party/blink/renderer/core/style/svg_paint.cc create mode 100644 chromium/third_party/blink/renderer/core/style/svg_paint.h create mode 100644 chromium/third_party/blink/renderer/core/style/unzoomed_length.h create mode 100644 chromium/third_party/blink/renderer/core/svg/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/core/svg/svg_external_document_cache.cc delete mode 100644 chromium/third_party/blink/renderer/core/svg/svg_external_document_cache.h delete mode 100644 chromium/third_party/blink/renderer/core/svg/svg_external_document_cache_test.cc create mode 100644 chromium/third_party/blink/renderer/core/svg/svg_resource_document_content.cc create mode 100644 chromium/third_party/blink/renderer/core/svg/svg_resource_document_content.h create mode 100644 chromium/third_party/blink/renderer/core/svg/svg_resource_document_content_test.cc create mode 100644 chromium/third_party/blink/renderer/core/testing/data/add-frame-in-unload-main.html create mode 100644 chromium/third_party/blink/renderer/core/testing/data/add-frame-in-unload-subframe.html create mode 100644 chromium/third_party/blink/renderer/core/testing/data/composited_selection_bounds_basic_rtl.html create mode 100644 chromium/third_party/blink/renderer/core/testing/data/composited_selection_bounds_vertical_lr_rtl.html create mode 100644 chromium/third_party/blink/renderer/core/testing/data/composited_selection_bounds_vertical_rl_rtl.html create mode 100644 chromium/third_party/blink/renderer/core/testing/data/display_none_frame.html create mode 100644 chromium/third_party/blink/renderer/core/testing/intersection_observer_test_helper.h create mode 100644 chromium/third_party/blink/renderer/core/testing/mock_function_scope.cc create mode 100644 chromium/third_party/blink/renderer/core/testing/mock_function_scope.h create mode 100644 chromium/third_party/blink/renderer/core/testing/scoped_fake_ukm_recorder.cc create mode 100644 chromium/third_party/blink/renderer/core/testing/scoped_fake_ukm_recorder.h create mode 100644 chromium/third_party/blink/renderer/core/testing/sim/sim_web_frame_widget.cc create mode 100644 chromium/third_party/blink/renderer/core/testing/sim/sim_web_frame_widget.h create mode 100644 chromium/third_party/blink/renderer/core/timing/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/timing/measure_memory/OWNERS delete mode 100644 chromium/third_party/blink/renderer/core/timing/measure_memory/measure_memory.idl delete mode 100644 chromium/third_party/blink/renderer/core/timing/measure_memory/measure_memory_breakdown.idl delete mode 100644 chromium/third_party/blink/renderer/core/timing/measure_memory/measure_memory_delegate.cc delete mode 100644 chromium/third_party/blink/renderer/core/timing/measure_memory/measure_memory_delegate.h create mode 100644 chromium/third_party/blink/renderer/core/timing/measure_memory/memory_attribution.idl create mode 100644 chromium/third_party/blink/renderer/core/timing/measure_memory/memory_attribution_container.idl create mode 100644 chromium/third_party/blink/renderer/core/timing/measure_memory/memory_breakdown_entry.idl create mode 100644 chromium/third_party/blink/renderer/core/timing/measure_memory/memory_measurement.idl create mode 100644 chromium/third_party/blink/renderer/core/trustedtypes/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/url/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/web_test/BUILD.gn create mode 100644 chromium/third_party/blink/renderer/core/web_test/DEPS create mode 100644 chromium/third_party/blink/renderer/core/web_test/OWNERS create mode 100644 chromium/third_party/blink/renderer/core/web_test/web_test_web_frame_widget_impl.cc create mode 100644 chromium/third_party/blink/renderer/core/web_test/web_test_web_frame_widget_impl.h create mode 100644 chromium/third_party/blink/renderer/core/workers/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/workers/cross_thread_global_scope_creation_params_copier.cc create mode 100644 chromium/third_party/blink/renderer/core/workers/cross_thread_global_scope_creation_params_copier.h create mode 100644 chromium/third_party/blink/renderer/core/xml/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/core/xmlhttprequest/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/accessibility/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/accessibility/ax_list.cc delete mode 100644 chromium/third_party/blink/renderer/modules/accessibility/ax_list.h delete mode 100644 chromium/third_party/blink/renderer/modules/accessibility/ax_radio_input.cc delete mode 100644 chromium/third_party/blink/renderer/modules/accessibility/ax_radio_input.h delete mode 100644 chromium/third_party/blink/renderer/modules/accessibility/ax_svg_root.cc delete mode 100644 chromium/third_party/blink/renderer/modules/accessibility/ax_svg_root.h create mode 100644 chromium/third_party/blink/renderer/modules/animationworklet/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/app_banner/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/audio_output_devices/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/background_fetch/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/background_sync/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/badging/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/battery/navigator_battery.cc delete mode 100644 chromium/third_party/blink/renderer/modules/battery/navigator_battery.h create mode 100644 chromium/third_party/blink/renderer/modules/beacon/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/bluetooth/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/broadcastchannel/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/buckets/BUILD.gn create mode 100644 chromium/third_party/blink/renderer/modules/buckets/DEPS create mode 100644 chromium/third_party/blink/renderer/modules/buckets/OWNERS create mode 100644 chromium/third_party/blink/renderer/modules/buckets/idls.gni create mode 100644 chromium/third_party/blink/renderer/modules/buckets/navigator_storage_buckets.idl create mode 100644 chromium/third_party/blink/renderer/modules/buckets/storage_bucket.cc create mode 100644 chromium/third_party/blink/renderer/modules/buckets/storage_bucket.h create mode 100644 chromium/third_party/blink/renderer/modules/buckets/storage_bucket.idl create mode 100644 chromium/third_party/blink/renderer/modules/buckets/storage_bucket_manager.cc create mode 100644 chromium/third_party/blink/renderer/modules/buckets/storage_bucket_manager.h create mode 100644 chromium/third_party/blink/renderer/modules/buckets/storage_bucket_manager.idl create mode 100644 chromium/third_party/blink/renderer/modules/buckets/storage_bucket_options.idl create mode 100644 chromium/third_party/blink/renderer/modules/buckets/worker_navigator_storage_buckets.idl create mode 100644 chromium/third_party/blink/renderer/modules/cache_storage/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/canvas/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_formatted_text.cc create mode 100644 chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_formatted_text.h create mode 100644 chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_formatted_text.idl create mode 100644 chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_formatted_text_run.cc create mode 100644 chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_formatted_text_run.h create mode 100644 chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_formatted_text_run.idl create mode 100644 chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_image_source_util.cc create mode 100644 chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_image_source_util.h create mode 100644 chromium/third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_factories.cc create mode 100644 chromium/third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_factories.h create mode 100644 chromium/third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_source_union.h create mode 100644 chromium/third_party/blink/renderer/modules/canvas/imagebitmap/window_create_image_bitmap.idl create mode 100644 chromium/third_party/blink/renderer/modules/canvas/imagebitmap/worker_create_image_bitmap.idl create mode 100644 chromium/third_party/blink/renderer/modules/clipboard/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/compression/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/contacts_picker/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/content_index/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/cookie_store/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/cookie_store/service_worker_registration_cookies.cc delete mode 100644 chromium/third_party/blink/renderer/modules/cookie_store/service_worker_registration_cookies.h create mode 100644 chromium/third_party/blink/renderer/modules/credentialmanager/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/credentialmanager/credential_metrics.cc delete mode 100644 chromium/third_party/blink/renderer/modules/credentialmanager/credential_metrics.h create mode 100644 chromium/third_party/blink/renderer/modules/crypto/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/csspaint/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/csspaint/background_color_paint_image_generator_impl.cc create mode 100644 chromium/third_party/blink/renderer/modules/csspaint/background_color_paint_image_generator_impl.h create mode 100644 chromium/third_party/blink/renderer/modules/csspaint/background_color_paint_worklet.cc create mode 100644 chromium/third_party/blink/renderer/modules/csspaint/background_color_paint_worklet.h create mode 100644 chromium/third_party/blink/renderer/modules/csspaint/background_color_paint_worklet_test.cc delete mode 100644 chromium/third_party/blink/renderer/modules/csspaint/native_paint_image_generator_impl.cc delete mode 100644 chromium/third_party/blink/renderer/modules/csspaint/native_paint_image_generator_impl.h create mode 100644 chromium/third_party/blink/renderer/modules/csspaint/native_paint_worklet_proxy_client.h create mode 100644 chromium/third_party/blink/renderer/modules/csspaint/paint_worklet_id_generator.cc create mode 100644 chromium/third_party/blink/renderer/modules/csspaint/paint_worklet_id_generator.h create mode 100644 chromium/third_party/blink/renderer/modules/device/BUILD.gn create mode 100644 chromium/third_party/blink/renderer/modules/device/OWNERS create mode 100644 chromium/third_party/blink/renderer/modules/device/device_service.cc create mode 100644 chromium/third_party/blink/renderer/modules/device/device_service.h create mode 100644 chromium/third_party/blink/renderer/modules/device/device_service.idl create mode 100644 chromium/third_party/blink/renderer/modules/device/idls.gni create mode 100644 chromium/third_party/blink/renderer/modules/device/navigator_device.idl create mode 100644 chromium/third_party/blink/renderer/modules/device_orientation/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/direct_sockets/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/direct_sockets/tcp_readable_stream_wrapper.cc create mode 100644 chromium/third_party/blink/renderer/modules/direct_sockets/tcp_readable_stream_wrapper.h create mode 100644 chromium/third_party/blink/renderer/modules/direct_sockets/tcp_readable_stream_wrapper_unittest.cc create mode 100644 chromium/third_party/blink/renderer/modules/direct_sockets/tcp_socket_unittest.cc create mode 100644 chromium/third_party/blink/renderer/modules/direct_sockets/tcp_writable_stream_wrapper.cc create mode 100644 chromium/third_party/blink/renderer/modules/direct_sockets/tcp_writable_stream_wrapper.h create mode 100644 chromium/third_party/blink/renderer/modules/direct_sockets/tcp_writable_stream_wrapper_unittest.cc create mode 100644 chromium/third_party/blink/renderer/modules/document_metadata/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/encoding/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/encryptedmedia/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/eventsource/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/BUILD.gn create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/OWNERS create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/color_select_event.cc create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/color_select_event.h create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/color_select_event.idl create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/color_select_event_init.idl create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/eye_dropper.cc create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/eye_dropper.h create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/eye_dropper.idl create mode 100644 chromium/third_party/blink/renderer/modules/eyedropper/idls.gni create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/data_transfer_item_file_system_access.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/data_transfer_item_file_system_access.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/data_transfer_item_file_system_access.idl delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/data_transfer_item_native_file_system.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/data_transfer_item_native_file_system.h delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/data_transfer_item_native_file_system.idl create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_access_error.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_access_error.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_create_writable_options.idl delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_create_writer_options.idl create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_directory_handle.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_directory_handle.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_directory_iterator.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_directory_iterator.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_directory_iterator.idl create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_file_handle.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_file_handle.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_handle.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_handle.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_underlying_sink.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_underlying_sink.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_writable_file_stream.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/file_system_writable_file_stream.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/global_file_system_access.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/global_file_system_access.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/global_file_system_access_test.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/global_native_file_system.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/global_native_file_system.h delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/global_native_file_system_test.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_directory_handle.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_directory_handle.h delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_directory_iterator.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_directory_iterator.h delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_directory_iterator.idl delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_error.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_error.h delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_file_handle.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_file_handle.h delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_handle.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_handle.h delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_underlying_sink.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_underlying_sink.h delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_writable_file_stream.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/native_file_system_writable_file_stream.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/storage_manager_file_system_access.cc create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/storage_manager_file_system_access.h create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/storage_manager_file_system_access.idl delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/storage_manager_native_file_system.cc delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/storage_manager_native_file_system.h delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/storage_manager_native_file_system.idl create mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/window_file_system_access.idl delete mode 100644 chromium/third_party/blink/renderer/modules/file_system_access/window_native_file_system.idl create mode 100644 chromium/third_party/blink/renderer/modules/filesystem/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/font_access/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/font_access/font_iterator.cc delete mode 100644 chromium/third_party/blink/renderer/modules/font_access/font_iterator.h delete mode 100644 chromium/third_party/blink/renderer/modules/font_access/font_iterator.idl delete mode 100644 chromium/third_party/blink/renderer/modules/font_access/font_iterator_entry.idl create mode 100644 chromium/third_party/blink/renderer/modules/gamepad/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/geolocation/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/BUILD.gn create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/OWNERS create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_drawing.cc create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_drawing.h create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_drawing.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_drawing_segment.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_feature_query.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_feature_query_result.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_hints.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_model_constraint.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_point.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_prediction.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_recognition_service.cc create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_recognition_service.h create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_recognizer.cc create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_recognizer.h create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_recognizer.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_segment.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_stroke.cc create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_stroke.h create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_stroke.idl create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_type_converters.cc create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_type_converters.h create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/handwriting_type_converters_unittest.cc create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/idls.gni create mode 100644 chromium/third_party/blink/renderer/modules/handwriting/navigator_handwriting_recognition_service.idl create mode 100644 chromium/third_party/blink/renderer/modules/hid/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/idle/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/imagecapture/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observation.cc delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observation.h delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observation.idl delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observer.cc delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observer.h delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observer.idl delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.cc delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.h delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.idl delete mode 100644 chromium/third_party/blink/renderer/modules/indexeddb/idb_observer_init.idl create mode 100644 chromium/third_party/blink/renderer/modules/installedapp/DEPS create mode 100644 chromium/third_party/blink/renderer/modules/installedapp/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/launch/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/locks/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/locks/navigator_locks.cc delete mode 100644 chromium/third_party/blink/renderer/modules/locks/navigator_locks.h create mode 100644 chromium/third_party/blink/renderer/modules/media/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/media_capabilities/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/media_capabilities/navigator_media_capabilities.cc delete mode 100644 chromium/third_party/blink/renderer/modules/media_capabilities/navigator_media_capabilities.h delete mode 100644 chromium/third_party/blink/renderer/modules/media_capabilities/worker_navigator_media_capabilities.cc delete mode 100644 chromium/third_party/blink/renderer/modules/media_capabilities/worker_navigator_media_capabilities.h create mode 100644 chromium/third_party/blink/renderer/modules/media_controls/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/media_controls/resources/ic_no_source_dark.svg delete mode 100644 chromium/third_party/blink/renderer/modules/media_controls/resources/ic_no_source_white.svg create mode 100644 chromium/third_party/blink/renderer/modules/media_controls/resources/ic_pause_dark.svg create mode 100644 chromium/third_party/blink/renderer/modules/media_controls/resources/ic_play_arrow_dark.svg create mode 100644 chromium/third_party/blink/renderer/modules/mediacapturefromelement/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/mediarecorder/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/mediasession/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/mediasession/navigator_media_session.cc delete mode 100644 chromium/third_party/blink/renderer/modules/mediasession/navigator_media_session.h create mode 100644 chromium/third_party/blink/renderer/modules/mediasource/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/mediasource/source_buffer_config.idl create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_audio_track_underlying_sink.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_audio_track_underlying_sink.h create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_audio_track_underlying_sink_test.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_audio_track_underlying_source.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_audio_track_underlying_source.h create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_audio_track_underlying_source_test.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_track_generator_init.idl create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_track_processor_init.idl create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_track_signal.idl create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_track_test.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/media_stream_video_track_signal_observer.h create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/mock_media_stream_audio_sink.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/mock_media_stream_audio_sink.h create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/pushable_media_stream_audio_source.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/pushable_media_stream_audio_source.h create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/pushable_media_stream_audio_source_test.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/stream_test_utils.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/stream_test_utils.h create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/video_track_signal_underlying_sink.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/video_track_signal_underlying_sink.h create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/video_track_signal_underlying_sink_test.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/video_track_signal_underlying_source.cc create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/video_track_signal_underlying_source.h create mode 100644 chromium/third_party/blink/renderer/modules/mediastream/video_track_signal_underlying_source_test.cc create mode 100644 chromium/third_party/blink/renderer/modules/modalclosewatcher/BUILD.gn create mode 100644 chromium/third_party/blink/renderer/modules/modalclosewatcher/OWNERS create mode 100644 chromium/third_party/blink/renderer/modules/modalclosewatcher/idls.gni create mode 100644 chromium/third_party/blink/renderer/modules/modalclosewatcher/modal_close_watcher.cc create mode 100644 chromium/third_party/blink/renderer/modules/modalclosewatcher/modal_close_watcher.h create mode 100644 chromium/third_party/blink/renderer/modules/modalclosewatcher/modal_close_watcher.idl create mode 100644 chromium/third_party/blink/renderer/modules/native_io/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_capacity_tracker.cc create mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_capacity_tracker.h create mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_error.cc create mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_error.h create mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_file_manager.cc create mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_file_manager.h create mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_file_manager.idl delete mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_manager.cc delete mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_manager.h delete mode 100644 chromium/third_party/blink/renderer/modules/native_io/native_io_manager.idl create mode 100644 chromium/third_party/blink/renderer/modules/navigatorcontentutils/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/netinfo/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/netinfo/navigator_network_information.cc delete mode 100644 chromium/third_party/blink/renderer/modules/netinfo/navigator_network_information.h delete mode 100644 chromium/third_party/blink/renderer/modules/netinfo/worker_navigator_network_information.cc delete mode 100644 chromium/third_party/blink/renderer/modules/netinfo/worker_navigator_network_information.h create mode 100644 chromium/third_party/blink/renderer/modules/nfc/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/nfc/ndef_writer.cc delete mode 100644 chromium/third_party/blink/renderer/modules/nfc/ndef_writer.h delete mode 100644 chromium/third_party/blink/renderer/modules/nfc/ndef_writer.idl delete mode 100644 chromium/third_party/blink/renderer/modules/nfc/nfc_utils.cc delete mode 100644 chromium/third_party/blink/renderer/modules/nfc/nfc_utils.h create mode 100644 chromium/third_party/blink/renderer/modules/notifications/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/payments/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/payments/goods/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/peerconnection/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/permissions/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/permissions/navigator_permissions.cc delete mode 100644 chromium/third_party/blink/renderer/modules/permissions/navigator_permissions.h delete mode 100644 chromium/third_party/blink/renderer/modules/permissions/worker_navigator_permissions.cc delete mode 100644 chromium/third_party/blink/renderer/modules/permissions/worker_navigator_permissions.h create mode 100644 chromium/third_party/blink/renderer/modules/picture_in_picture/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/presentation/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/push_messaging/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/quota/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/quota/worker_navigator_storage_quota.cc delete mode 100644 chromium/third_party/blink/renderer/modules/quota/worker_navigator_storage_quota.h create mode 100644 chromium/third_party/blink/renderer/modules/remoteplayback/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/remoteplayback/remote_playback_metrics.cc create mode 100644 chromium/third_party/blink/renderer/modules/remoteplayback/remote_playback_metrics.h create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/DEPS create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/DIR_METADATA create mode 100755 chromium/third_party/blink/renderer/modules/sanitizer_api/build_corpus.py create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/corpus/config1.txt create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/corpus/config2.txt create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/corpus/default.txt create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/corpus/medium1.html create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/corpus/medium2.html create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/corpus/medium3.html create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/corpus/simple1.html create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/corpus/simple2.html create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/corpus/simple3.html create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/sanitizer_api.dict create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/sanitizer_api_fuzzer.cc create mode 100644 chromium/third_party/blink/renderer/modules/sanitizer_api/sanitizer_config.proto create mode 100644 chromium/third_party/blink/renderer/modules/scheduler/scheduler_post_task_callback.idl create mode 100644 chromium/third_party/blink/renderer/modules/screen_enumeration/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/screen_orientation/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/sensor/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/sensor/gravity_sensor.cc create mode 100644 chromium/third_party/blink/renderer/modules/sensor/gravity_sensor.h create mode 100644 chromium/third_party/blink/renderer/modules/sensor/gravity_sensor.idl create mode 100644 chromium/third_party/blink/renderer/modules/serial/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/serial/navigator_serial.cc delete mode 100644 chromium/third_party/blink/renderer/modules/serial/navigator_serial.h delete mode 100644 chromium/third_party/blink/renderer/modules/serial/serial_connection_event.cc delete mode 100644 chromium/third_party/blink/renderer/modules/serial/serial_connection_event.h delete mode 100644 chromium/third_party/blink/renderer/modules/serial/serial_connection_event.idl delete mode 100644 chromium/third_party/blink/renderer/modules/serial/serial_connection_event_init.idl delete mode 100644 chromium/third_party/blink/renderer/modules/serial/worker_navigator_serial.cc delete mode 100644 chromium/third_party/blink/renderer/modules/serial/worker_navigator_serial.h create mode 100644 chromium/third_party/blink/renderer/modules/service_worker/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/shapedetection/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/speech/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/srcobject/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/storage/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/BUILD.gn create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/DEPS create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/OWNERS create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/idls.gni create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/url_pattern.cc create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/url_pattern.h create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/url_pattern.idl create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/url_pattern_component_result.idl create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/url_pattern_init.idl create mode 100644 chromium/third_party/blink/renderer/modules/url_pattern/url_pattern_result.idl create mode 100644 chromium/third_party/blink/renderer/modules/vibration/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/wake_lock/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.cc delete mode 100644 chromium/third_party/blink/renderer/modules/wake_lock/navigator_wake_lock.h delete mode 100644 chromium/third_party/blink/renderer/modules/wake_lock/worker_navigator_wake_lock.cc delete mode 100644 chromium/third_party/blink/renderer/modules/wake_lock/worker_navigator_wake_lock.h create mode 100644 chromium/third_party/blink/renderer/modules/webaudio/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_decoder_config.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_decoder_support.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_encoder.cc create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_encoder.h create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_encoder.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_encoder_config.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_encoder_init.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_frame_serialization_data.cc create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_frame_serialization_data.h create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/audio_frame_test.cc create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/avc_encoder_config.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/codec_logger.cc create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/codec_logger.h create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/color_space_matrix_id.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/color_space_primary_id.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/color_space_range_id.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/color_space_transfer_id.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/encoded_audio_chunk_output_callback.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/encoded_audio_config.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/encoder_base.cc create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/encoder_base.h create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/fuzzer_seed_corpus/generate_image_corpus.py create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/fuzzer_seed_corpus/video_encoder/encode_h264.textproto create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/fuzzer_seed_corpus/video_encoder/encode_vp8.textproto create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/hardware_preference.cc create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/hardware_preference.h create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/hardware_preference.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/image_decode_options.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/image_decoder_base.textproto create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/image_decoder_fuzzer.cc create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/video_color_space.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/video_decoder_support.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/video_frame_logger.cc create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/video_frame_logger.h create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/video_frame_plane_init.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/web_codecs_error_callback.idl create mode 100644 chromium/third_party/blink/renderer/modules/webcodecs/webcodecs_error_callback.idl create mode 100644 chromium/third_party/blink/renderer/modules/webdatabase/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/webgl/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/webgl/webgl_webcodecs_texture_info.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame.cc create mode 100644 chromium/third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame.h create mode 100644 chromium/third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame_handle.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_blend_descriptor.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_blend_state.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_buffer_binding_layout.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_buffer_copy_view.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_color_state_descriptor.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_color_target_state.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_depth_stencil_state.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_depth_stencil_state_descriptor.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_image_bitmap_copy_view.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_image_copy_buffer.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_image_copy_image_bitmap.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_image_copy_texture.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_image_data_layout.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_object_base.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_pipeline_base.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_programmable_stage.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_programmable_stage_descriptor.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_sampler_binding_layout.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_stencil_face_state.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_stencil_state_face_descriptor.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_storage_texture_binding_layout.idl create mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_texture_binding_layout.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_texture_copy_view.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/gpu_texture_data_layout.idl delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/navigator_gpu.cc delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/navigator_gpu.h delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/worker_navigator_gpu.cc delete mode 100644 chromium/third_party/blink/renderer/modules/webgpu/worker_navigator_gpu.h create mode 100644 chromium/third_party/blink/renderer/modules/webid/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/webmidi/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/webrtc/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/websockets/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/webtransport/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/webusb/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/modules/webusb/navigator_usb.cc delete mode 100644 chromium/third_party/blink/renderer/modules/webusb/navigator_usb.h delete mode 100644 chromium/third_party/blink/renderer/modules/webusb/worker_navigator_usb.cc delete mode 100644 chromium/third_party/blink/renderer/modules/webusb/worker_navigator_usb.h create mode 100644 chromium/third_party/blink/renderer/modules/xr/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/modules/xr/document_xr.idl delete mode 100644 chromium/third_party/blink/renderer/modules/xr/element_xr.h delete mode 100644 chromium/third_party/blink/renderer/modules/xr/element_xr.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/global_event_handlers_xr.h create mode 100644 chromium/third_party/blink/renderer/modules/xr/html_element_xr.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/mathml_element_xr.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/svg_element_xr.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/window_xr.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_cpu_depth_information.cc create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_cpu_depth_information.h create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_cpu_depth_information.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_depth_manager.cc create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_depth_manager.h create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_depth_state_init.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_hand.cc create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_hand.h create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_hand.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_joint_pose.cc create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_joint_pose.h create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_joint_pose.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_joint_space.cc create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_joint_space.h create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_joint_space.idl delete mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_plane_detection_state.cc delete mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_plane_detection_state.h delete mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_plane_detection_state.idl create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_plane_manager.cc create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_plane_manager.h create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_webgl_depth_information.cc create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_webgl_depth_information.h create mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_webgl_depth_information.idl delete mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_world_information.cc delete mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_world_information.h delete mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_world_information.idl delete mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_world_tracking_state.cc delete mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_world_tracking_state.h delete mode 100644 chromium/third_party/blink/renderer/modules/xr/xr_world_tracking_state.idl create mode 100644 chromium/third_party/blink/renderer/platform/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/animation/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/audio/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/back_forward_cache_utils.cc create mode 100644 chromium/third_party/blink/renderer/platform/back_forward_cache_utils.h create mode 100644 chromium/third_party/blink/renderer/platform/bindings/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/bindings/exception_context.h create mode 100644 chromium/third_party/blink/renderer/platform/bindings/union_base.cc delete mode 100644 chromium/third_party/blink/renderer/platform/bindings/v0_custom_element_binding.cc delete mode 100644 chromium/third_party/blink/renderer/platform/bindings/v0_custom_element_binding.h create mode 100644 chromium/third_party/blink/renderer/platform/blob/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/context_lifecycle_notifier.cc create mode 100644 chromium/third_party/blink/renderer/platform/exported/impression_conversions.cc create mode 100644 chromium/third_party/blink/renderer/platform/exported/mediastream/DIR_METADATA delete mode 100644 chromium/third_party/blink/renderer/platform/exported/sync_load_response.cc create mode 100644 chromium/third_party/blink/renderer/platform/exported/web_back_forward_cache_loader_helper.cc delete mode 100644 chromium/third_party/blink/renderer/platform/exported/web_mixed_content.cc create mode 100644 chromium/third_party/blink/renderer/platform/fonts/OWNERS create mode 100644 chromium/third_party/blink/renderer/platform/fonts/opentype/font_format_check_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/fonts/shaping/font_features.cc create mode 100644 chromium/third_party/blink/renderer/platform/fonts/shaping/font_features.h create mode 100644 chromium/third_party/blink/renderer/platform/fonts/shaping/font_features_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/geometry/length_functions_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/graphics/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/graphics/canvas_resource_params.cc create mode 100644 chromium/third_party/blink/renderer/platform/graphics/canvas_resource_params.h create mode 100644 chromium/third_party/blink/renderer/platform/graphics/gpu/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/graphics/gpu/webgpu_mailbox_texture.cc create mode 100644 chromium/third_party/blink/renderer/platform/graphics/gpu/webgpu_mailbox_texture.h create mode 100644 chromium/third_party/blink/renderer/platform/graphics/paint/layer_selection_data.h create mode 100644 chromium/third_party/blink/renderer/platform/graphics/paint/painted_selection_bound.h create mode 100644 chromium/third_party/blink/renderer/platform/graphics/parkable_image.cc create mode 100644 chromium/third_party/blink/renderer/platform/graphics/parkable_image.h create mode 100644 chromium/third_party/blink/renderer/platform/graphics/parkable_image_manager.cc create mode 100644 chromium/third_party/blink/renderer/platform/graphics/parkable_image_manager.h create mode 100644 chromium/third_party/blink/renderer/platform/graphics/parkable_image_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/graphics/resource_id_traits.h create mode 100644 chromium/third_party/blink/renderer/platform/graphics/rw_buffer.cc create mode 100644 chromium/third_party/blink/renderer/platform/graphics/rw_buffer.h create mode 100644 chromium/third_party/blink/renderer/platform/graphics/rw_buffer_test.cc delete mode 100644 chromium/third_party/blink/renderer/platform/graphics/static_bitmap_image_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/graphics/video_frame_image_util.cc create mode 100644 chromium/third_party/blink/renderer/platform/graphics/video_frame_image_util.h create mode 100644 chromium/third_party/blink/renderer/platform/graphics/video_frame_image_util_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/heap/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/heap/collection_support/heap_deque.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/collection_support/heap_hash_counted_set.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/collection_support/heap_hash_set.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/collection_support/heap_linked_hash_set.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/collection_support/heap_list_hash_set.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/collection_support/heap_vector.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/custom_spaces.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/heap_allocator_impl.h delete mode 100644 chromium/third_party/blink/renderer/platform/heap/heap_test_utilities.cc create mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/collection_support/heap_hash_table_backing.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/collection_support/heap_vector_backing.h delete mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/disallow_new_wrapper.h delete mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/gc_task_runner.h delete mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/heap_allocator.cc delete mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/heap_allocator.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/heap_allocator_impl.cc create mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/heap_allocator_impl.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/heap_test_utilities.cc create mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/heap_test_utilities.h delete mode 100644 chromium/third_party/blink/renderer/platform/heap/impl/heap_traits.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/trace_traits.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/blink_gc_memory_dump_provider.cc create mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/collection_support/heap_hash_table_backing.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/collection_support/heap_vector_backing.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/custom_spaces.cc create mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/custom_spaces.h delete mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/disallow_new_wrapper.h delete mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/gc_task_runner.h delete mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/heap_allocator.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/heap_allocator_impl.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/heap_test_utilities.h create mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/thread_state.cc create mode 100644 chromium/third_party/blink/renderer/platform/heap/v8_wrapper/trace_traits.h create mode 100644 chromium/third_party/blink/renderer/platform/image-decoders/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/instrumentation/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/instrumentation/partition_alloc_memory_dump_provider_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/json/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/loader/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/back_forward_cache_loader_helper.h create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/cached_metadata_handler_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/render_blocking_behavior.h create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client.h create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/mojo_url_loader_client_unittest.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_context.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_context.h create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_context_unittest.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_response.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/sync_load_response.h delete mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/web_bundle_subresource_loader.cc delete mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/web_bundle_subresource_loader.h delete mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/web_bundle_subresource_loader_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/web_resource_request_sender.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/web_resource_request_sender_unittest.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_factory.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_unittest.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/mixed_content.cc create mode 100644 chromium/third_party/blink/renderer/platform/loader/mixed_content.h create mode 100644 chromium/third_party/blink/renderer/platform/mediastream/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/mojo/heap_mojo_associated_remote_set.h create mode 100644 chromium/third_party/blink/renderer/platform/mojo/heap_mojo_associated_remote_set_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/mojo/heap_mojo_remote_set.h create mode 100644 chromium/third_party/blink/renderer/platform/mojo/heap_mojo_remote_set_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/mojo/mojo_binding_context.h create mode 100644 chromium/third_party/blink/renderer/platform/network/content_security_policy_parsers_test.cc delete mode 100644 chromium/third_party/blink/renderer/platform/network/network_log.h create mode 100644 chromium/third_party/blink/renderer/platform/p2p/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/peerconnection/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/peerconnection/rtc_rtp_source_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_stream_adapter.cc create mode 100644 chromium/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_stream_adapter.h create mode 100644 chromium/third_party/blink/renderer/platform/peerconnection/rtc_video_decoder_stream_adapter_test.cc create mode 100644 chromium/third_party/blink/renderer/platform/privacy_budget/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/scheduler/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/testing/data/colrv0_test.ttf create mode 100644 chromium/third_party/blink/renderer/platform/testing/data/colrv1_test.ttf create mode 100644 chromium/third_party/blink/renderer/platform/video_capture/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/weborigin/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/webrtc/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/widget/input/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/widget/input/input_metrics.cc create mode 100644 chromium/third_party/blink/renderer/platform/widget/input/input_metrics.h create mode 100644 chromium/third_party/blink/renderer/platform/wtf/DIR_METADATA create mode 100644 chromium/third_party/blink/renderer/platform/wtf/text/DIR_METADATA (limited to 'chromium/third_party/blink/renderer') diff --git a/chromium/third_party/blink/renderer/.style.yapf b/chromium/third_party/blink/renderer/.style.yapf deleted file mode 100644 index 557fa7bf84c..00000000000 --- a/chromium/third_party/blink/renderer/.style.yapf +++ /dev/null @@ -1,2 +0,0 @@ -[style] -based_on_style = pep8 diff --git a/chromium/third_party/blink/renderer/BUILD.gn b/chromium/third_party/blink/renderer/BUILD.gn index e70d561c630..02ee0bfd103 100644 --- a/chromium/third_party/blink/renderer/BUILD.gn +++ b/chromium/third_party/blink/renderer/BUILD.gn @@ -50,7 +50,8 @@ config("inside_blink") { "-Wno-implicit-int-conversion", ] - if (!is_ash || default_toolchain != "//build/toolchain/cros:target") { + if (!is_chromeos_ash || + default_toolchain != "//build/toolchain/cros:target") { cflags += [ "-Wno-enum-float-conversion" ] } } diff --git a/chromium/third_party/blink/renderer/DEPS b/chromium/third_party/blink/renderer/DEPS index bcc9717108c..8ea205527f7 100644 --- a/chromium/third_party/blink/renderer/DEPS +++ b/chromium/third_party/blink/renderer/DEPS @@ -1,14 +1,15 @@ include_rules = [ - "+base/allocator/partition_allocator/partition_alloc.h", "+base/allocator/partition_allocator/oom.h", + "+base/allocator/partition_allocator/partition_alloc.h", "+base/auto_reset.h", "+base/bind.h", - "+base/callback_helpers.h", "+base/bit_cast.h", + "+base/bits.h", "+base/check.h", "+base/check_op.h", "+base/compiler_specific.h", "+base/containers/adapters.h", + "+base/containers/contains.h", "+base/containers/span.h", "+base/debug", "+base/feature_list.h", @@ -18,7 +19,6 @@ include_rules = [ "+base/i18n/rtl.h", "+base/location.h", "+base/logging.h", - "+base/notreached.h", "+base/macros.h", "+base/memory/checked_ptr.h", "+base/memory/ptr_util.h", @@ -28,12 +28,14 @@ include_rules = [ "+base/metrics/histogram_functions.h", "+base/metrics/histogram_macros.h", "+base/metrics/single_sample_metrics.h", + "+base/notreached.h", "+base/numerics/checked_math.h", "+base/numerics/clamped_math.h", "+base/numerics/ranges.h", "+base/numerics/safe_conversions.h", "+base/optional.h", "+base/rand_util.h", + "+base/ranges", "+base/sequence_checker.h", "+base/sequenced_task_runner.h", "+base/single_thread_task_runner.h", @@ -57,10 +59,11 @@ include_rules = [ "+base/timer/elapsed_timer.h", "+base/timer/timer.h", "+base/trace_event", - "+base/util/type_safety/pass_key.h", - "+base/util/type_safety/strong_alias.h", + "+base/types/pass_key.h", + "+base/types/strong_alias.h", "+build", "+components/crash/core/common/crash_key.h", + "+components/power_scheduler", "+net/cookies", "+net/http/structured_headers.h", "+services/network/public/mojom", @@ -76,7 +79,7 @@ include_rules = [ "+ui/base/cursor/mojom/cursor.mojom-blink.h", "+ui/base/cursor/mojom/cursor_type.mojom-blink.h", - "+ui/base/dragdrop/mojom/drag_drop_types.mojom-blink.h", + "+ui/base/dragdrop/mojom", "+ui/events/keycodes/dom", "+v8", ] diff --git a/chromium/third_party/blink/renderer/bindings/BUILD.gn b/chromium/third_party/blink/renderer/bindings/BUILD.gn index dd6c7397b20..61c9e7f59da 100644 --- a/chromium/third_party/blink/renderer/bindings/BUILD.gn +++ b/chromium/third_party/blink/renderer/bindings/BUILD.gn @@ -17,8 +17,7 @@ import("//third_party/blink/renderer/modules/modules_idl_files.gni") visibility = [ "//third_party/blink/renderer/*" ] -# TODO(crbug.com/1112471): Get this to run cleanly under Python 3. -python2_action("interfaces_info") { +action("interfaces_info") { script = "$bindings_scripts_dir/compute_interfaces_info_overall.py" inputs = [ @@ -66,9 +65,6 @@ if (use_blink_v8_binding_new_idl_interface) { template("collect_idl_files") { action_with_pydeps(target_name) { - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - run_under_python2 = true - script = "${bindings_scripts_dir}/collect_idl_files.py" inputs = invoker.inputs @@ -141,9 +137,6 @@ collect_idl_files("web_idl_in_modules_for_testing") { action_with_pydeps("web_idl_database") { visibility += [ "//tools/privacy_budget/blink_apis:*" ] - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - run_under_python2 = true - script = "${bindings_scripts_dir}/build_web_idl_database.py" input_data_files = get_target_outputs(":web_idl_in_core") + @@ -172,9 +165,6 @@ action_with_pydeps("web_idl_database") { template("generate_bindings") { action_with_pydeps(target_name) { - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - run_under_python2 = true - script = "${bindings_scripts_dir}/generate_bindings.py" if (defined(invoker.pool)) { diff --git a/chromium/third_party/blink/renderer/bindings/DIR_METADATA b/chromium/third_party/blink/renderer/bindings/DIR_METADATA new file mode 100644 index 00000000000..9eb47abdbd1 --- /dev/null +++ b/chromium/third_party/blink/renderer/bindings/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink>Bindings" +} + +team_email: "blink-reviews-bindings@chromium.org" diff --git a/chromium/third_party/blink/renderer/bindings/IDLExtendedAttributes.md b/chromium/third_party/blink/renderer/bindings/IDLExtendedAttributes.md index 7835be1c7a8..84544f468fc 100644 --- a/chromium/third_party/blink/renderer/bindings/IDLExtendedAttributes.md +++ b/chromium/third_party/blink/renderer/bindings/IDLExtendedAttributes.md @@ -957,23 +957,6 @@ v8::Local V8XXX::CallAsFunctionCallback(const v8::Arguments& args) { } ``` -### [CustomElementCallbacks] _(m, a)_ - -Summary: Wraps the method/accessor with a Custom Elements "callback delivery scope" which will dispatch Custom Element callbacks (createdCallback, attributeChangedCallback, etc.) before returning to script. - -*** note -This attribute is only for Custom Elements V0, -and is superceded by `[CEReactions]` for V1. -*** - -If the method/accessor creates elements or modifies DOM nodes in any way, it should be tagged with this extended attribute. Even if you're not a Node, this may apply to you! For example [DOMTokenList.toggle](https://code.google.com/p/chromium/codesearch#chromium/src/third_party/blink/renderer/core/dom/dom_token_list.idl&l=34) can be reflected in the attribute of its associated element, so it needs to be tagged with CustomElementCallbacks. If the method/accessor only calls something that may modify the DOM (for example, it runs user script as a callback) you don't need to tag your method with `[CustomElementCallbacks]`; that is the responsibility of the binding that actually modifies the DOM. In general over-applying this extended attribute is safe, with one caveat: - -* This extended attribute MUST NOT be used on members that operate on non-main threads, because the callback delivery scope accesses statics. -* Basically: Don't apply this extended attribute to anything that can be called from a worker. -* This criterion (accessible by workers) depends on implementation and cannot easily be checked from the IDL or C++ headers (it includes obvious cases like `[Exposed=Worker]`, where there is a constructor on the (JS) global object, but also cases where the C++ creates or accesses methods internally), so please be careful. - -Usage: `[CustomElementCallbacks]` takes no arguments. - ### [HighEntropy] _(m, a, c)_ Summary: Denotes an API that exposes data that folks on the internet find useful for fingerprinting. diff --git a/chromium/third_party/blink/renderer/bindings/IDLExtendedAttributes.txt b/chromium/third_party/blink/renderer/bindings/IDLExtendedAttributes.txt index 1d8daf39c58..2433667658f 100644 --- a/chromium/third_party/blink/renderer/bindings/IDLExtendedAttributes.txt +++ b/chromium/third_party/blink/renderer/bindings/IDLExtendedAttributes.txt @@ -49,7 +49,6 @@ ContextEnabled=* CrossOrigin=|Getter|Setter Custom=|Getter|Setter|LegacyCallAsFunction|PropertyGetter|PropertyEnumerator|PropertyQuery CustomConstructor -CustomElementCallbacks DefaultValue=Undefined DeprecateAs=* DoNotCheckConstants diff --git a/chromium/third_party/blink/renderer/bindings/OWNERS b/chromium/third_party/blink/renderer/bindings/OWNERS index 7458e2d7d38..c86b5f21f29 100644 --- a/chromium/third_party/blink/renderer/bindings/OWNERS +++ b/chromium/third_party/blink/renderer/bindings/OWNERS @@ -18,6 +18,3 @@ per-file generated_in_core.gni=* per-file generated_in_modules.gni=* per-file idl_in_core.gni=* per-file idl_in_modules.gni=* - -# TEAM: blink-reviews-bindings@chromium.org -# COMPONENT: Blink>Bindings diff --git a/chromium/third_party/blink/renderer/bindings/bindings.gni b/chromium/third_party/blink/renderer/bindings/bindings.gni index f942dd02d82..d05f6b67f90 100644 --- a/chromium/third_party/blink/renderer/bindings/bindings.gni +++ b/chromium/third_party/blink/renderer/bindings/bindings.gni @@ -54,6 +54,7 @@ bindings_core_v8_files = "core/v8/maplike.h", "core/v8/module_record.cc", "core/v8/module_record.h", + "core/v8/module_request.cc", "core/v8/module_request.h", "core/v8/native_value_traits.h", "core/v8/native_value_traits_impl.cc", @@ -117,10 +118,9 @@ bindings_core_v8_files = "core/v8/source_location.cc", "core/v8/source_location.h", "core/v8/to_v8_for_core.h", + "core/v8/to_v8_traits.h", "core/v8/use_counter_callback.cc", "core/v8/use_counter_callback.h", - "core/v8/v0_custom_element_constructor_builder.cc", - "core/v8/v0_custom_element_constructor_builder.h", "core/v8/v8_binding_for_core.cc", "core/v8/v8_binding_for_core.h", "core/v8/v8_code_cache.cc", @@ -159,8 +159,6 @@ bindings_core_v8_files = "core/v8/v8_string_resource.h", "core/v8/v8_throw_dom_exception.cc", "core/v8/v8_throw_dom_exception.h", - "core/v8/v8_v0_custom_element_lifecycle_callbacks.cc", - "core/v8/v8_v0_custom_element_lifecycle_callbacks.h", "core/v8/v8_wasm_response_extensions.cc", "core/v8/v8_wasm_response_extensions.h", "core/v8/window_proxy.cc", @@ -199,6 +197,7 @@ bindings_unittest_files = "core/v8/script_streamer_test.cc", "core/v8/script_wrappable_v8_gc_integration_test.cc", "core/v8/to_v8_test.cc", + "core/v8/to_v8_traits_test.cc", "core/v8/trace_wrapper_v8_reference_test.cc", "core/v8/v8_binding_for_testing.cc", "core/v8/v8_binding_for_testing.h", diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/DIR_METADATA b/chromium/third_party/blink/renderer/bindings/core/v8/DIR_METADATA new file mode 100644 index 00000000000..9eb47abdbd1 --- /dev/null +++ b/chromium/third_party/blink/renderer/bindings/core/v8/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink>Bindings" +} + +team_email: "blink-reviews-bindings@chromium.org" diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/OWNERS b/chromium/third_party/blink/renderer/bindings/core/v8/OWNERS index daa4941ea82..09bbb23429b 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/OWNERS +++ b/chromium/third_party/blink/renderer/bindings/core/v8/OWNERS @@ -1,6 +1,3 @@ per-file script_source_.*=leszeks@chromium.org per-file script_streamer.*=leszeks@chromium.org per-file v8_wasm_response_extensions.*=ahaas@chromium.org - -# TEAM: blink-reviews-bindings@chromium.org -# COMPONENT: Blink>Bindings diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/binding_security.cc b/chromium/third_party/blink/renderer/bindings/core/v8/binding_security.cc index c88962aa7f5..9339a01ec81 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/binding_security.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/binding_security.cc @@ -35,6 +35,7 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_location.h" #include "third_party/blink/renderer/bindings/core/v8/v8_window.h" #include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/execution_context/agent.h" #include "third_party/blink/renderer/core/frame/dom_window.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -151,9 +152,12 @@ bool CanAccessWindowInternal( if (detail == SecurityOrigin::AccessResultDomainDetail:: kDomainNotRelevantAgentClusterMismatch) { // Assert that because the agent clusters are different than the - // WindowAgentFactories must also be different. + // WindowAgentFactories must also be different unless they differ in + // being explicitly origin keyed. SECURITY_CHECK( !IsSameWindowAgentFactory(accessing_window, local_target_window) || + (accessing_window->GetAgent()->IsExplicitlyOriginKeyed() != + local_target_window->GetAgent()->IsExplicitlyOriginKeyed()) || (WebTestSupport::IsRunningWebTest() && local_target_window->GetFrame()->PagePopupOwner())); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/boxed_v8_module.h b/chromium/third_party/blink/renderer/bindings/core/v8/boxed_v8_module.h index d53d8230d90..52e3d6d46a2 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/boxed_v8_module.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/boxed_v8_module.h @@ -7,6 +7,7 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" +#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/member.h" #include "third_party/blink/renderer/platform/wtf/hash_functions.h" #include "v8/include/v8.h" @@ -50,9 +51,9 @@ struct BoxedV8ModuleHash { static bool Equal(const Member& a, const Member& b) { - if (a.IsHashTableDeletedValue() && b.IsHashTableDeletedValue()) + if (IsHashTableDeletedValue(a) && IsHashTableDeletedValue(b)) return true; - if (a.IsHashTableDeletedValue() || b.IsHashTableDeletedValue()) + if (IsHashTableDeletedValue(a) || IsHashTableDeletedValue(b)) return false; if (!a && !b) diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/boxed_v8_module_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/boxed_v8_module_test.cc index 99bfffada18..a08b2d354fe 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/boxed_v8_module_test.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/boxed_v8_module_test.cc @@ -8,6 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/bindings/core/v8/module_record.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" +#include "third_party/blink/renderer/core/testing/module_test_base.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/loader/fetch/script_fetch_options.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" @@ -23,18 +24,14 @@ TEST(BoxedV8ModuleTest, equalAndHash) { const KURL js_url_b("https://example.com/b.js"); Member module_empty = nullptr; - Member module_deleted(WTF::kHashTableDeletedValue); + Member module_deleted(kMemberDeletedValue); - v8::Local local_module_a = ModuleRecord::Compile( - scope.GetIsolate(), "export const a = 'a';", js_url_a, js_url_a, - ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + v8::Local local_module_a = ModuleTestBase::CompileModule( + scope.GetIsolate(), "export const a = 'a';", js_url_a); Member module_a = MakeGarbageCollected(scope.GetIsolate(), local_module_a); - v8::Local local_module_b = ModuleRecord::Compile( - scope.GetIsolate(), "export const b = 'b';", js_url_b, js_url_b, - ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + v8::Local local_module_b = ModuleTestBase::CompileModule( + scope.GetIsolate(), "export const b = 'b';", js_url_b); Member module_b = MakeGarbageCollected(scope.GetIsolate(), local_module_b); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/custom/DEPS b/chromium/third_party/blink/renderer/bindings/core/v8/custom/DEPS new file mode 100644 index 00000000000..4cb839d6518 --- /dev/null +++ b/chromium/third_party/blink/renderer/bindings/core/v8/custom/DEPS @@ -0,0 +1,5 @@ +specific_include_rules = { + "v8_dev_tools_host_custom.cc": [ + "+base/strings/utf_string_conversions.h", + ], +} \ No newline at end of file diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/custom/v8_dev_tools_host_custom.cc b/chromium/third_party/blink/renderer/bindings/core/v8/custom/v8_dev_tools_host_custom.cc index aa3e1ce4156..0f9c10419cd 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/custom/v8_dev_tools_host_custom.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/custom/v8_dev_tools_host_custom.cc @@ -30,9 +30,10 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_dev_tools_host.h" +#include "base/strings/utf_string_conversions.h" #include "build/build_config.h" +#include "third_party/blink/public/common/context_menu_data/menu_item_info.h" #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/public/web/web_menu_item_info.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_html_document.h" #include "third_party/blink/renderer/bindings/core/v8/v8_mouse_event.h" @@ -58,7 +59,7 @@ void V8DevToolsHost::PlatformMethodCustom( static bool PopulateContextMenuItems(v8::Isolate* isolate, const v8::Local& item_array, - WebVector& items) { + std::vector& items) { v8::Local context = isolate->GetCurrentContext(); for (uint32_t i = 0; i < item_array->Length(); ++i) { v8::Local item = @@ -84,13 +85,13 @@ static bool PopulateContextMenuItems(v8::Isolate* isolate, String type_string = ToCoreStringWithNullCheck(type.As()); items.reserve(items.size() + 1); items.emplace_back(); - WebMenuItemInfo& item_info = items[items.size() - 1]; + MenuItemInfo& item_info = items[items.size() - 1]; if (type_string == "separator") { - item_info.type = WebMenuItemInfo::kSeparator; + item_info.type = MenuItemInfo::kSeparator; item_info.enabled = true; item_info.action = DevToolsHost::kMaxContextMenuAction; } else if (type_string == "subMenu" && sub_items->IsArray()) { - item_info.type = WebMenuItemInfo::kSubMenu; + item_info.type = MenuItemInfo::kSubMenu; item_info.enabled = true; item_info.action = DevToolsHost::kMaxContextMenuAction; v8::Local sub_items_array = @@ -100,7 +101,7 @@ static bool PopulateContextMenuItems(v8::Isolate* isolate, return false; TOSTRING_DEFAULT(V8StringResource, label_string, label, false); - item_info.label = String(label_string); + item_info.label = base::UTF8ToUTF16(String(label_string).Utf8()); } else { int32_t int32_id; if (!id->Int32Value(context).To(&int32_id) || int32_id < 0 || @@ -109,10 +110,10 @@ static bool PopulateContextMenuItems(v8::Isolate* isolate, TOSTRING_DEFAULT(V8StringResource, label_string, label, false); if (type_string == "checkbox") - item_info.type = WebMenuItemInfo::kCheckableOption; + item_info.type = MenuItemInfo::kCheckableOption; else - item_info.type = WebMenuItemInfo::kOption; - item_info.label = String(label_string); + item_info.type = MenuItemInfo::kOption; + item_info.label = base::UTF8ToUTF16(String(label_string).Utf8()); item_info.enabled = true; item_info.action = int32_id; if (checked->IsBoolean()) @@ -144,7 +145,7 @@ void V8DevToolsHost::ShowContextMenuAtPointMethodCustom( v8::Local array = info[2]; if (!array->IsArray()) return; - WebVector items; + std::vector items; if (!PopulateContextMenuItems(isolate, v8::Local::Cast(array), items)) return; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/generated.gni b/chromium/third_party/blink/renderer/bindings/core/v8/generated.gni index 3cffd6d6de2..a53634140ba 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/generated.gni +++ b/chromium/third_party/blink/renderer/bindings/core/v8/generated.gni @@ -64,8 +64,6 @@ bindings_core_generated_union_type_files = [ "$bindings_core_v8_output_dir/html_option_element_or_html_opt_group_element.h", "$bindings_core_v8_output_dir/html_script_element_or_svg_script_element.cc", "$bindings_core_v8_output_dir/html_script_element_or_svg_script_element.h", - "$bindings_core_v8_output_dir/image_bitmap_source.cc", - "$bindings_core_v8_output_dir/image_bitmap_source.h", "$bindings_core_v8_output_dir/internal_enum_or_internal_enum_sequence.cc", "$bindings_core_v8_output_dir/internal_enum_or_internal_enum_sequence.h", "$bindings_core_v8_output_dir/media_list_or_string.cc", @@ -76,6 +74,8 @@ bindings_core_generated_union_type_files = [ "$bindings_core_v8_output_dir/node_or_string_or_trusted_script.h", "$bindings_core_v8_output_dir/radio_node_list_or_element.cc", "$bindings_core_v8_output_dir/radio_node_list_or_element.h", + "$bindings_core_v8_output_dir/readable_stream_default_controller_or_readable_byte_stream_controller.cc", + "$bindings_core_v8_output_dir/readable_stream_default_controller_or_readable_byte_stream_controller.h", "$bindings_core_v8_output_dir/readable_stream_default_reader_or_readable_stream_byob_reader.cc", "$bindings_core_v8_output_dir/readable_stream_default_reader_or_readable_stream_byob_reader.h", "$bindings_core_v8_output_dir/request_or_usv_string.cc", diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/generated_code_helper.cc b/chromium/third_party/blink/renderer/bindings/core/v8/generated_code_helper.cc index fb3b0e8f9d3..5ea6550e116 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/generated_code_helper.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/generated_code_helper.cc @@ -14,7 +14,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/html/custom/ce_reactions_scope.h" -#include "third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.h" #include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/xml/dom_parser.h" #include "third_party/blink/renderer/platform/bindings/v8_binding.h" @@ -112,7 +111,6 @@ void V8SetReflectedBooleanAttribute( v8::Isolate* isolate = info.GetIsolate(); Element* impl = V8Element::ToImpl(info.Holder()); - V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; ExceptionState exception_state(isolate, ExceptionState::kSetterContext, interface_name, idl_attribute_name); CEReactionsScope ce_reactions_scope; @@ -131,7 +129,6 @@ void V8SetReflectedDOMStringAttribute( const QualifiedName& content_attr) { Element* impl = V8Element::ToImpl(info.Holder()); - V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; CEReactionsScope ce_reactions_scope; // Prepare the value to be set. @@ -147,7 +144,6 @@ void V8SetReflectedNullableDOMStringAttribute( const QualifiedName& content_attr) { Element* impl = V8Element::ToImpl(info.Holder()); - V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; CEReactionsScope ce_reactions_scope; // Prepare the value to be set. @@ -413,8 +409,6 @@ void InstallCSSPropertyAttributes( v8::Local set_func = v8::FunctionTemplate::New( isolate, CSSPropertyAttributeSet, v8_property_name, signature, 1, v8::ConstructorBehavior::kThrow, v8::SideEffectType::kHasSideEffect); - get_func->RemovePrototype(); - set_func->RemovePrototype(); get_func->SetAcceptAnyReceiver(false); set_func->SetAcceptAnyReceiver(false); get_func->SetClassName( @@ -485,9 +479,6 @@ void PerformAttributeSetCEReactionsReflect( return; } - // [Reflect] - V0CustomElementProcessingStack::CallbackDeliveryScope v0_custom_element_scope; - // [CEReactions] CEReactionsScope ce_reactions_scope; Element* blink_receiver = V8Element::ToWrappableUnsafe(info.This()); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/generated_code_helper.h b/chromium/third_party/blink/renderer/bindings/core/v8/generated_code_helper.h index a0582c93610..609c7d5a9cf 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/generated_code_helper.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/generated_code_helper.h @@ -78,9 +78,9 @@ using InstallTemplateFunction = using InstallRuntimeEnabledFeaturesFunction = void (*)(v8::Isolate*, const DOMWrapperWorld&, - v8::Local instance, - v8::Local prototype, - v8::Local interface); + v8::Local instance_object, + v8::Local prototype_object, + v8::Local interface_object); using InstallRuntimeEnabledFeaturesOnTemplateFunction = InstallTemplateFunction; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/idl_types.h b/chromium/third_party/blink/renderer/bindings/core/v8/idl_types.h index 2b89fa0c356..daac58e5875 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/idl_types.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/idl_types.h @@ -95,13 +95,33 @@ using IDLLongLongEnforceRange = using IDLUnsignedLongLongEnforceRange = IDLIntegerTypeBase; +// Floating point number types + +namespace bindings { + +enum class IDLFloatingPointNumberConvMode { + kDefault, + kUnrestricted, +}; + +} // namespace bindings + +template +struct IDLFloatingPointNumberTypeBase final : public IDLBaseHelper {}; + // float -struct IDLFloat final : public IDLBaseHelper {}; -struct IDLUnrestrictedFloat final : public IDLBaseHelper {}; +using IDLFloat = IDLFloatingPointNumberTypeBase; +using IDLUnrestrictedFloat = IDLFloatingPointNumberTypeBase< + float, + bindings::IDLFloatingPointNumberConvMode::kUnrestricted>; // double -struct IDLDouble final : public IDLBaseHelper {}; -struct IDLUnrestrictedDouble final : public IDLBaseHelper {}; +using IDLDouble = IDLFloatingPointNumberTypeBase; +using IDLUnrestrictedDouble = IDLFloatingPointNumberTypeBase< + double, + bindings::IDLFloatingPointNumberConvMode::kUnrestricted>; // Strings // The "Base" classes are always templatized and require users to specify how JS @@ -179,29 +199,32 @@ enum class IDLStringConvMode { } // namespace bindings +// Base class for IDL string types (except for enumeration types) +struct IDLStringTypeBase : public IDLBaseHelper {}; + // ByteString template -struct IDLByteStringBaseV2 final : public IDLBaseHelper {}; +struct IDLByteStringBaseV2 final : public IDLStringTypeBase {}; using IDLByteStringV2 = IDLByteStringBaseV2; // DOMString template -struct IDLStringBaseV2 final : public IDLBaseHelper {}; +struct IDLStringBaseV2 final : public IDLStringTypeBase {}; using IDLStringV2 = IDLStringBaseV2; using IDLStringTreatNullAsEmptyStringV2 = IDLStringBaseV2; // USVString template -struct IDLUSVStringBaseV2 final : public IDLBaseHelper {}; +struct IDLUSVStringBaseV2 final : public IDLStringTypeBase {}; using IDLUSVStringV2 = IDLUSVStringBaseV2; // [StringContext=TrustedHTML] DOMString template struct IDLStringStringContextTrustedHTMLBaseV2 final - : public IDLBaseHelper {}; + : public IDLStringTypeBase {}; using IDLStringStringContextTrustedHTMLV2 = IDLStringStringContextTrustedHTMLBaseV2< bindings::IDLStringConvMode::kDefault>; @@ -212,7 +235,7 @@ using IDLStringStringContextTrustedHTMLTreatNullAsEmptyStringV2 = // [StringContext=TrustedScript] DOMString template struct IDLStringStringContextTrustedScriptBaseV2 final - : public IDLBaseHelper {}; + : public IDLStringTypeBase {}; using IDLStringStringContextTrustedScriptV2 = IDLStringStringContextTrustedScriptBaseV2< bindings::IDLStringConvMode::kDefault>; @@ -223,7 +246,7 @@ using IDLStringStringContextTrustedScriptTreatNullAsEmptyStringV2 = // [StringContext=TrustedScriptURL] USVString template struct IDLUSVStringStringContextTrustedScriptURLBaseV2 final - : public IDLBaseHelper {}; + : public IDLStringTypeBase {}; using IDLUSVStringStringContextTrustedScriptURLV2 = IDLUSVStringStringContextTrustedScriptURLBaseV2< bindings::IDLStringConvMode::kDefault>; @@ -298,6 +321,20 @@ struct IDLOnBeforeUnloadEventHandler final : public IDLBaseHelper {}; struct IDLOnErrorEventHandler final : public IDLBaseHelper {}; +// IDL optional types +// +// IDLOptional represents an optional argument and supports a conversion from +// ES undefined to "missing" special value. The "missing" value might be +// represented in Blink as base::nullopt, nullptr, 0, etc. depending on a Blink +// type. +// +// Note that IDLOptional is not meant to represent an optional dictionary +// member. +template +struct IDLOptional final : public IDLBase { + using ImplType = void; +}; + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_IDL_TYPES_H_ diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/isolated_world_csp.cc b/chromium/third_party/blink/renderer/bindings/core/v8/isolated_world_csp.cc index f7099162b6e..3b83f26aced 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/isolated_world_csp.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/isolated_world_csp.cc @@ -182,12 +182,12 @@ ContentSecurityPolicy* IsolatedWorldCSP::CreateIsolatedWorldCSP( IsolatedWorldCSPDelegate* delegate = MakeGarbageCollected( - window, std::move(self_origin), world_id, + window, self_origin, world_id, policy.IsEmpty() ? CSPType::kEmpty : CSPType::kNonEmpty); csp->BindToDelegate(*delegate); - csp->AddPolicyFromHeaderValue( - policy, network::mojom::ContentSecurityPolicyType::kEnforce, - network::mojom::ContentSecurityPolicySource::kHTTP); + csp->DidReceiveHeader(policy, *self_origin, + network::mojom::ContentSecurityPolicyType::kEnforce, + network::mojom::ContentSecurityPolicySource::kHTTP); return csp; } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.cc b/chromium/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.cc index 412bad667ca..5931ae96436 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/js_based_event_listener.cc @@ -132,10 +132,10 @@ void JSBasedEventListener::Invoke( current_event = window->CurrentEvent(); // Step 8-2: If |struct|’s invocation-target-in-shadow-tree is false (i.e., - // event's target is in a V1 shadow tree), then set |global|’s current + // event's target is in a shadow tree), then set |global|’s current // event to event. Node* target_node = event->target()->ToNode(); - if (!(target_node && target_node->IsInV1ShadowTree())) + if (!(target_node && target_node->IsInShadowTree())) window->SetCurrentEvent(event); } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc b/chromium/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc index 77d95d30e80..a22d5d790f8 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc @@ -203,10 +203,9 @@ v8::Local JSEventHandlerForContentAttribute::GetCompiledHandler( DCHECK_LE(scopes_size, base::size(scopes)); v8::ScriptOrigin origin( - V8String(isolate, source_url_), - v8::Integer::New(isolate, position_.line_.ZeroBasedInt()), - v8::Integer::New(isolate, position_.column_.ZeroBasedInt()), - v8::True(isolate)); // True as |SanitizeScriptErrors::kDoNotSanitize| + V8String(isolate, source_url_), position_.line_.ZeroBasedInt(), + position_.column_.ZeroBasedInt(), + true); // true as |SanitizeScriptErrors::kDoNotSanitize| v8::ScriptCompiler::Source source(V8String(isolate, script_body_), origin); v8::Local compiled_function; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/chromium/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc index 16d2cc458b3..be5cf4457cd 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc @@ -69,12 +69,6 @@ namespace blink { -namespace { - -constexpr char kGlobalProxyLabel[] = "WindowProxy::global_proxy_"; - -} // namespace - void LocalWindowProxy::Trace(Visitor* visitor) const { visitor->Trace(script_state_); WindowProxy::Trace(visitor); @@ -94,8 +88,6 @@ void LocalWindowProxy::DisposeContext(Lifecycle next_status, if (lifecycle_ == Lifecycle::kV8MemoryIsForciblyPurged) { DCHECK(next_status == Lifecycle::kGlobalObjectIsDetached || next_status == Lifecycle::kFrameIsDetachedAndV8MemoryIsPurged); - if (next_status == Lifecycle::kFrameIsDetachedAndV8MemoryIsPurged) - global_proxy_.SetPhantom(); lifecycle_ = next_status; return; } @@ -114,7 +106,7 @@ void LocalWindowProxy::DisposeContext(Lifecycle next_status, next_status == Lifecycle::kGlobalObjectIsDetached) { // Clean up state on the global proxy, which will be reused. if (!global_proxy_.IsEmpty()) { - CHECK(global_proxy_ == context->Global()); + CHECK(global_proxy_.Get() == context->Global()); CHECK_EQ(ToScriptWrappable(context->Global()), ToScriptWrappable( context->Global()->GetPrototype().As())); @@ -135,12 +127,6 @@ void LocalWindowProxy::DisposeContext(Lifecycle next_status, V8GCForContextDispose::Instance().NotifyContextDisposed( GetFrame()->IsMainFrame(), frame_reuse_status); - if (next_status == Lifecycle::kFrameIsDetached) { - // The context's frame is detached from the DOM, so there shouldn't be a - // strong reference to the context. - global_proxy_.SetPhantom(); - } - DCHECK_EQ(lifecycle_, Lifecycle::kContextIsInitialized); lifecycle_ = next_status; } @@ -159,7 +145,6 @@ void LocalWindowProxy::Initialize() { v8::Local context = script_state_->GetContext(); if (global_proxy_.IsEmpty()) { global_proxy_.Set(GetIsolate(), context->Global()); - global_proxy_.Get().AnnotateStrongRetainer(kGlobalProxyLabel); CHECK(!global_proxy_.IsEmpty()); } @@ -184,8 +169,8 @@ void LocalWindowProxy::Initialize() { scoped_refptr origin; if (world_->IsMainWorld()) { - // ActivityLogger for main world is updated within updateDocumentInternal(). - UpdateDocumentInternal(); + // This also updates the ActivityLogger for the main world. + UpdateDocumentForMainWorld(); origin = GetFrame()->DomWindow()->GetSecurityOrigin(); } else { UpdateActivityLogger(); @@ -319,7 +304,7 @@ void LocalWindowProxy::SetupWindowPrototypeChain() { // The global proxy object. Note this is not the global object. v8::Local global_proxy = context->Global(); - CHECK(global_proxy_ == global_proxy); + CHECK(global_proxy_.Get() == global_proxy); V8DOMWrapper::SetNativeInfo(GetIsolate(), global_proxy, wrapper_type_info, window); // Mark the handle to be traced by Oilpan, since the global proxy has a @@ -448,7 +433,6 @@ void LocalWindowProxy::SetSecurityToken(const SecurityOrigin* origin) { } void LocalWindowProxy::UpdateDocument() { - DCHECK(world_->IsMainWorld()); // For an uninitialized main window proxy, there's nothing we need // to update. The update is done when the window proxy gets initialized later. if (lifecycle_ == Lifecycle::kContextIsUninitialized) @@ -464,10 +448,14 @@ void LocalWindowProxy::UpdateDocument() { return; } - UpdateDocumentInternal(); + if (!world_->IsMainWorld()) + return; + + UpdateDocumentForMainWorld(); } -void LocalWindowProxy::UpdateDocumentInternal() { +void LocalWindowProxy::UpdateDocumentForMainWorld() { + DCHECK(world_->IsMainWorld()); UpdateActivityLogger(); UpdateDocumentProperty(); UpdateSecurityOrigin(GetFrame()->DomWindow()->GetSecurityOrigin()); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/local_window_proxy.h b/chromium/third_party/blink/renderer/bindings/core/v8/local_window_proxy.h index 5fa12678f86..27f175f3b61 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/local_window_proxy.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/local_window_proxy.h @@ -71,6 +71,7 @@ class LocalWindowProxy final : public WindowProxy { v8::Context::AbortScriptExecutionCallback callback); private: + // LocalWindowProxy overrides: bool IsLocal() const override { return true; } void Initialize() override; void DisposeContext(Lifecycle next_status, FrameReuseStatus) override; @@ -92,9 +93,10 @@ class LocalWindowProxy final : public WindowProxy { // Triggers updates of objects that are associated with a Document: // - the activity logger - // - the document DOM wrapper + // - the document DOM wrapper (performance optimization for accessing + // window.document in the main world) // - the security origin - void UpdateDocumentInternal(); + void UpdateDocumentForMainWorld(); // The JavaScript wrapper for the document object is cached on the global // object for fast access. UpdateDocumentProperty sets the wrapper diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/module_record.cc b/chromium/third_party/blink/renderer/bindings/core/v8/module_record.cc index ef6715fe6a9..6dd4e486d90 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/module_record.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/module_record.cc @@ -10,6 +10,7 @@ #include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h" +#include "third_party/blink/renderer/core/loader/modulescript/module_script_creation_params.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/script/modulator.h" #include "third_party/blink/renderer/core/script/module_record_resolver.h" @@ -17,6 +18,8 @@ #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/loader/fetch/script_fetch_options.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" +#include "third_party/blink/renderer/platform/wtf/text/text_position.h" +#include "third_party/blink/renderer/platform/wtf/wtf.h" namespace blink { @@ -46,15 +49,11 @@ void ModuleRecordProduceCacheData::Trace(Visitor* visitor) const { v8::Local ModuleRecord::Compile( v8::Isolate* isolate, - const String& source, - const KURL& source_url, - const KURL& base_url, + const ModuleScriptCreationParams& params, const ScriptFetchOptions& options, const TextPosition& text_position, ExceptionState& exception_state, mojom::blink::V8CacheOptions v8_cache_options, - SingleCachedMetadataHandler* cache_handler, - ScriptSourceLocationType source_location_type, ModuleRecordProduceCacheData** out_produce_cache_data) { v8::TryCatch try_catch(isolate); v8::Local module; @@ -71,13 +70,13 @@ v8::Local ModuleRecord::Compile( V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(v8_cache_options, cache_handler, - source.length(), source_location_type); + V8CodeCache::GetCompileOptions(v8_cache_options, params.CacheHandler(), + params.GetSourceText().length(), + params.SourceLocationType()); if (!V8ScriptRunner::CompileModule( - isolate, source, cache_handler, source_url, text_position, - compile_options, no_cache_reason, - ReferrerScriptInfo(base_url, options, + isolate, params, text_position, compile_options, no_cache_reason, + ReferrerScriptInfo(params.BaseURL(), options, ReferrerScriptInfo::BaseUrlSource::kOther)) .ToLocal(&module)) { DCHECK(try_catch.HasCaught()); @@ -89,7 +88,7 @@ v8::Local ModuleRecord::Compile( if (out_produce_cache_data) { *out_produce_cache_data = MakeGarbageCollected( - isolate, cache_handler, produce_cache_options, module); + isolate, params.CacheHandler(), produce_cache_options, module); } return module; @@ -134,18 +133,43 @@ Vector ModuleRecord::ModuleRequests( if (record.IsEmpty()) return Vector(); + v8::Local v8_module_requests = record->GetModuleRequests(); + int length = v8_module_requests->Length(); Vector requests; - int length = record->GetModuleRequestsLength(); requests.ReserveInitialCapacity(length); + bool needs_text_position = + !WTF::IsMainThread() || + probe::ToCoreProbeSink(ExecutionContext::From(script_state)) + ->HasDevToolsSessions(); for (int i = 0; i < length; ++i) { - v8::Local v8_name = record->GetModuleRequest(i); - v8::Location v8_loc = record->GetModuleRequestLocation(i); - TextPosition position( - OrdinalNumber::FromZeroBasedInt(v8_loc.GetLineNumber()), - OrdinalNumber::FromZeroBasedInt(v8_loc.GetColumnNumber())); - requests.emplace_back(ToCoreString(v8_name), position); + v8::Local v8_module_request = + v8_module_requests->Get(script_state->GetContext(), i) + .As(); + v8::Local v8_specifier = v8_module_request->GetSpecifier(); + TextPosition position = TextPosition::MinimumPosition(); + if (needs_text_position) { + // The source position is only used by DevTools for module requests and + // only visible if devtools is open when the request is initiated. + // Calculating the source position is not free and V8 has to initialize + // the line end information for the complete module, thus we try to + // avoid this additional work here if DevTools is closed. + int source_offset = v8_module_request->GetSourceOffset(); + v8::Location v8_loc = record->SourceOffsetToLocation(source_offset); + position = TextPosition( + OrdinalNumber::FromZeroBasedInt(v8_loc.GetLineNumber()), + OrdinalNumber::FromZeroBasedInt(v8_loc.GetColumnNumber())); + } + Vector import_assertions = + ModuleRecord::ToBlinkImportAssertions( + script_state->GetContext(), record, + v8_module_request->GetImportAssertions(), + /*v8_import_assertions_has_positions=*/true); + + requests.emplace_back(ToCoreString(v8_specifier), position, + import_assertions); } + return requests; } @@ -157,19 +181,71 @@ v8::Local ModuleRecord::V8Namespace(v8::Local record) { v8::MaybeLocal ModuleRecord::ResolveModuleCallback( v8::Local context, v8::Local specifier, + v8::Local import_assertions, v8::Local referrer) { v8::Isolate* isolate = context->GetIsolate(); Modulator* modulator = Modulator::From(ScriptState::From(context)); DCHECK(modulator); + ModuleRequest module_request( + ToCoreStringWithNullCheck(specifier), TextPosition(), + ModuleRecord::ToBlinkImportAssertions( + context, referrer, import_assertions, + /*v8_import_assertions_has_positions=*/true)); + ExceptionState exception_state(isolate, ExceptionState::kExecutionContext, "ModuleRecord", "resolveModuleCallback"); v8::Local resolved = - modulator->GetModuleRecordResolver()->Resolve( - ToCoreStringWithNullCheck(specifier), referrer, exception_state); + modulator->GetModuleRecordResolver()->Resolve(module_request, referrer, + exception_state); DCHECK(!resolved.IsEmpty()); DCHECK(!exception_state.HadException()); + return resolved; } +Vector ModuleRecord::ToBlinkImportAssertions( + v8::Local context, + v8::Local record, + v8::Local v8_import_assertions, + bool v8_import_assertions_has_positions) { + // If v8_import_assertions_has_positions == true then v8_import_assertions has + // source position information and is given in the form [key1, value1, + // source_offset1, key2, value2, source_offset2, ...]. Otherwise if + // v8_import_assertions_has_positions == false, then v8_import_assertions is + // in the form [key1, value1, key2, value2, ...]. + const int kV8AssertionEntrySize = v8_import_assertions_has_positions ? 3 : 2; + + Vector import_assertions; + int number_of_import_assertions = + v8_import_assertions->Length() / kV8AssertionEntrySize; + import_assertions.ReserveInitialCapacity(number_of_import_assertions); + for (int i = 0; i < number_of_import_assertions; ++i) { + v8::Local v8_assertion_key = + v8_import_assertions->Get(context, i * kV8AssertionEntrySize) + .As(); + v8::Local v8_assertion_value = + v8_import_assertions->Get(context, (i * kV8AssertionEntrySize) + 1) + .As(); + TextPosition assertion_position; + if (v8_import_assertions_has_positions) { + int32_t v8_assertion_source_offset = + v8_import_assertions->Get(context, (i * kV8AssertionEntrySize) + 2) + .As() + ->Value(); + v8::Location v8_assertion_loc = + record->SourceOffsetToLocation(v8_assertion_source_offset); + assertion_position = TextPosition( + OrdinalNumber::FromZeroBasedInt(v8_assertion_loc.GetLineNumber()), + OrdinalNumber::FromZeroBasedInt(v8_assertion_loc.GetColumnNumber())); + } + + import_assertions.emplace_back(ToCoreString(v8_assertion_key), + ToCoreString(v8_assertion_value), + assertion_position); + } + + return import_assertions; +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/module_record.h b/chromium/third_party/blink/renderer/bindings/core/v8/module_record.h index 289213fe508..c4c02d9b10b 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/module_record.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/module_record.h @@ -22,6 +22,7 @@ namespace blink { class ExceptionState; class KURL; +class ModuleScriptCreationParams; class ScriptFetchOptions; class ScriptState; class ScriptValue; @@ -63,16 +64,11 @@ class CORE_EXPORT ModuleRecord final { public: static v8::Local Compile( v8::Isolate*, - const String& source, - const KURL& source_url, - const KURL& base_url, + const ModuleScriptCreationParams& params, const ScriptFetchOptions&, const TextPosition&, ExceptionState&, mojom::blink::V8CacheOptions = mojom::blink::V8CacheOptions::kDefault, - SingleCachedMetadataHandler* = nullptr, - ScriptSourceLocationType source_location_type = - ScriptSourceLocationType::kInternal, ModuleRecordProduceCacheData** out_produce_cache_data = nullptr); // Returns exception, if any. @@ -87,10 +83,24 @@ class CORE_EXPORT ModuleRecord final { static v8::Local V8Namespace(v8::Local record); + // ToBlinkImportAssertions deserializes v8::FixedArray encoded import + // assertions to blink::ImportAssertion. When + // |v8_import_assertions_has_positions| is set to true, it expects [key1, + // value1, position1, key2, value2, position2, ...] encoding used in + // v8::ModuleRequest::GetImportAssertions(). When it is set to false, it + // expects [key1, value1, key2, value2, ...] encoding used in the + // |HostImportModuleDynamically| callback. + static Vector ToBlinkImportAssertions( + v8::Local context, + v8::Local record, + v8::Local v8_import_assertions, + bool v8_import_assertions_has_positions); + private: static v8::MaybeLocal ResolveModuleCallback( v8::Local, v8::Local specifier, + v8::Local import_assertions, v8::Local referrer); }; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/module_record_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/module_record_test.cc index 3b5813b3c9a..39d0164390b 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/module_record_test.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/module_record_test.cc @@ -29,7 +29,7 @@ namespace { class TestModuleRecordResolver final : public ModuleRecordResolver { public: - TestModuleRecordResolver(v8::Isolate* isolate) : isolate_(isolate) {} + explicit TestModuleRecordResolver(v8::Isolate* isolate) : isolate_(isolate) {} ~TestModuleRecordResolver() override = default; size_t ResolveCount() const { return specifiers_.size(); } @@ -56,10 +56,10 @@ class TestModuleRecordResolver final : public ModuleRecordResolver { return nullptr; } - v8::Local Resolve(const String& specifier, + v8::Local Resolve(const ModuleRequest& module_request, v8::Local module, ExceptionState&) override { - specifiers_.push_back(specifier); + specifiers_.push_back(module_request.specifier); return module_records_.TakeFirst()->NewLocal(isolate_); } @@ -114,19 +114,16 @@ class ModuleRecordTest : public ::testing::Test, public ParametrizedModuleTest { TEST_P(ModuleRecordTest, compileSuccess) { V8TestingScope scope; const KURL js_url("https://example.com/foo.js"); - v8::Local module = ModuleRecord::Compile( - scope.GetIsolate(), "export const a = 42;", js_url, js_url, - ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + v8::Local module = ModuleTestBase::CompileModule( + scope.GetIsolate(), "export const a = 42;", js_url); ASSERT_FALSE(module.IsEmpty()); } TEST_P(ModuleRecordTest, compileFail) { V8TestingScope scope; const KURL js_url("https://example.com/foo.js"); - v8::Local module = ModuleRecord::Compile( - scope.GetIsolate(), "123 = 456", js_url, js_url, ScriptFetchOptions(), - TextPosition::MinimumPosition(), scope.GetExceptionState()); + v8::Local module = ModuleTestBase::CompileModule( + scope.GetIsolate(), "123 = 456", js_url, scope.GetExceptionState()); ASSERT_TRUE(module.IsEmpty()); EXPECT_TRUE(scope.GetExceptionState().HadException()); } @@ -134,16 +131,43 @@ TEST_P(ModuleRecordTest, compileFail) { TEST_P(ModuleRecordTest, moduleRequests) { V8TestingScope scope; const KURL js_url("https://example.com/foo.js"); - v8::Local module = ModuleRecord::Compile( + v8::Local module = ModuleTestBase::CompileModule( scope.GetIsolate(), "import 'a'; import 'b'; export const c = 'c';", - js_url, js_url, ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + js_url); ASSERT_FALSE(module.IsEmpty()); auto requests = ModuleRecord::ModuleRequests(scope.GetScriptState(), module); EXPECT_EQ(2u, requests.size()); EXPECT_EQ("a", requests[0].specifier); + EXPECT_EQ(0u, requests[0].import_assertions.size()); EXPECT_EQ("b", requests[1].specifier); + EXPECT_EQ(0u, requests[1].import_assertions.size()); +} + +TEST_P(ModuleRecordTest, moduleRequestsWithImportAssertions) { + V8TestingScope scope; + v8::V8::SetFlagsFromString("--harmony-import-assertions"); + const KURL js_url("https://example.com/foo.js"); + v8::Local module = ModuleTestBase::CompileModule( + scope.GetIsolate(), + "import 'a' assert { };" + "import 'b' assert { type: 'x'};" + "import 'c' assert { foo: 'y', type: 'z' };", + js_url); + ASSERT_FALSE(module.IsEmpty()); + + auto requests = ModuleRecord::ModuleRequests(scope.GetScriptState(), module); + EXPECT_EQ(3u, requests.size()); + EXPECT_EQ("a", requests[0].specifier); + EXPECT_EQ(0u, requests[0].import_assertions.size()); + EXPECT_EQ(String(), requests[0].GetModuleTypeString()); + + EXPECT_EQ("b", requests[1].specifier); + EXPECT_EQ(1u, requests[1].import_assertions.size()); + EXPECT_EQ("x", requests[1].GetModuleTypeString()); + + EXPECT_EQ("c", requests[2].specifier); + EXPECT_EQ("z", requests[2].GetModuleTypeString()); } TEST_P(ModuleRecordTest, instantiateNoDeps) { @@ -154,10 +178,8 @@ TEST_P(ModuleRecordTest, instantiateNoDeps) { auto* resolver = modulator->GetTestModuleRecordResolver(); const KURL js_url("https://example.com/foo.js"); - v8::Local module = ModuleRecord::Compile( - scope.GetIsolate(), "export const a = 42;", js_url, js_url, - ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + v8::Local module = ModuleTestBase::CompileModule( + scope.GetIsolate(), "export const a = 42;", js_url); ASSERT_FALSE(module.IsEmpty()); ScriptValue exception = ModuleRecord::Instantiate(scope.GetScriptState(), module, js_url); @@ -174,26 +196,21 @@ TEST_P(ModuleRecordTest, instantiateWithDeps) { auto* resolver = modulator->GetTestModuleRecordResolver(); const KURL js_url_a("https://example.com/a.js"); - v8::Local module_a = ModuleRecord::Compile( - scope.GetIsolate(), "export const a = 'a';", js_url_a, js_url_a, - ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + v8::Local module_a = ModuleTestBase::CompileModule( + scope.GetIsolate(), "export const a = 'a';", js_url_a); ASSERT_FALSE(module_a.IsEmpty()); resolver->PrepareMockResolveResult(module_a); const KURL js_url_b("https://example.com/b.js"); - v8::Local module_b = ModuleRecord::Compile( - scope.GetIsolate(), "export const b = 'b';", js_url_b, js_url_b, - ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + v8::Local module_b = ModuleTestBase::CompileModule( + scope.GetIsolate(), "export const b = 'b';", js_url_b); ASSERT_FALSE(module_b.IsEmpty()); resolver->PrepareMockResolveResult(module_b); const KURL js_url_c("https://example.com/c.js"); - v8::Local module = ModuleRecord::Compile( + v8::Local module = ModuleTestBase::CompileModule( scope.GetIsolate(), "import 'a'; import 'b'; export const c = 123;", - js_url_c, js_url_c, ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + js_url_c); ASSERT_FALSE(module.IsEmpty()); ScriptValue exception = ModuleRecord::Instantiate(scope.GetScriptState(), module, js_url_c); @@ -212,10 +229,8 @@ TEST_P(ModuleRecordTest, EvaluationErrorIsRemembered) { auto* resolver = modulator->GetTestModuleRecordResolver(); const KURL js_url_f("https://example.com/failure.js"); - v8::Local module_failure = ModuleRecord::Compile( - scope.GetIsolate(), "nonexistent_function()", js_url_f, js_url_f, - ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + v8::Local module_failure = ModuleTestBase::CompileModule( + scope.GetIsolate(), "nonexistent_function()", js_url_f); ASSERT_FALSE(module_failure.IsEmpty()); ASSERT_TRUE( ModuleRecord::Instantiate(state, module_failure, js_url_f).IsEmpty()); @@ -226,9 +241,8 @@ TEST_P(ModuleRecordTest, EvaluationErrorIsRemembered) { resolver->PrepareMockResolveResult(module_failure); const KURL js_url_c("https://example.com/c.js"); - v8::Local module = ModuleRecord::Compile( + v8::Local module = ModuleTestBase::CompileModule( scope.GetIsolate(), "import 'failure'; export const c = 123;", js_url_c, - js_url_c, ScriptFetchOptions(), TextPosition::MinimumPosition(), scope.GetExceptionState()); ASSERT_FALSE(module.IsEmpty()); ASSERT_TRUE(ModuleRecord::Instantiate(state, module, js_url_c).IsEmpty()); @@ -253,10 +267,8 @@ TEST_P(ModuleRecordTest, Evaluate) { MakeGarbageCollected(scope.GetScriptState()); const KURL js_url("https://example.com/foo.js"); - v8::Local module = ModuleRecord::Compile( - scope.GetIsolate(), "export const a = 42; window.foo = 'bar';", js_url, - js_url, ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); + v8::Local module = ModuleTestBase::CompileModule( + scope.GetIsolate(), "export const a = 42; window.foo = 'bar';", js_url); ASSERT_FALSE(module.IsEmpty()); ScriptValue exception = ModuleRecord::Instantiate(scope.GetScriptState(), module, js_url); @@ -289,9 +301,8 @@ TEST_P(ModuleRecordTest, EvaluateCaptureError) { MakeGarbageCollected(scope.GetScriptState()); const KURL js_url("https://example.com/foo.js"); - v8::Local module = ModuleRecord::Compile( - scope.GetIsolate(), "throw 'bar';", js_url, js_url, ScriptFetchOptions(), - TextPosition::MinimumPosition(), ASSERT_NO_EXCEPTION); + v8::Local module = + ModuleTestBase::CompileModule(scope.GetIsolate(), "throw 'bar';", js_url); ASSERT_FALSE(module.IsEmpty()); ScriptValue instantiation_exception = ModuleRecord::Instantiate(scope.GetScriptState(), module, js_url); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/module_request.cc b/chromium/third_party/blink/renderer/bindings/core/v8/module_request.cc new file mode 100644 index 00000000000..f915e6e6e02 --- /dev/null +++ b/chromium/third_party/blink/renderer/bindings/core/v8/module_request.cc @@ -0,0 +1,19 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/bindings/core/v8/module_request.h" + +namespace blink { + +String ModuleRequest::GetModuleTypeString() const { + for (const ImportAssertion& import_assertion : import_assertions) { + if (import_assertion.key == "type") { + DCHECK(!import_assertion.value.IsNull()); + return import_assertion.value; + } + } + return String(); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/module_request.h b/chromium/third_party/blink/renderer/bindings/core/v8/module_request.h index 29d6c2beed7..9710252bb7e 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/module_request.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/module_request.h @@ -5,16 +5,40 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_MODULE_REQUEST_H_ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_MODULE_REQUEST_H_ +#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { -struct ModuleRequest { +// An import assertion key/value pair per spec: +// https://tc39.es/proposal-import-assertions/ +struct ImportAssertion { + String key; + String value; + TextPosition position; + ImportAssertion(const String& key, + const String& value, + const TextPosition& position) + : key(key), value(value), position(position) {} +}; + +// An instance of a ModuleRequest record: +// https://tc39.es/proposal-import-assertions/#sec-modulerequest-record +// Represents a module script's request to import a module given a specifier and +// list of import assertions. +struct CORE_EXPORT ModuleRequest { String specifier; TextPosition position; - ModuleRequest(const String& specifier, const TextPosition& position) - : specifier(specifier), position(position) {} + Vector import_assertions; + ModuleRequest(const String& specifier, + const TextPosition& position, + const Vector& import_assertions) + : specifier(specifier), + position(position), + import_assertions(import_assertions) {} + + String GetModuleTypeString() const; }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h b/chromium/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h index ccc3625f634..5a39f8ae2fd 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h @@ -36,6 +36,7 @@ namespace bindings { class DictionaryBase; class EnumerationBase; +class UnionBase; CORE_EXPORT void NativeValueTraitsInterfaceNotOfType( const WrapperTypeInfo* wrapper_type_info, @@ -58,10 +59,21 @@ struct CORE_EXPORT NativeValueTraits return ScriptValue(isolate, value); } }; + // IDLNullable must not be used. template <> struct NativeValueTraits>; +template <> +struct CORE_EXPORT NativeValueTraits> + : public NativeValueTraitsBase { + static ScriptValue NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + return ScriptValue(isolate, value); + } +}; + // boolean template <> struct CORE_EXPORT NativeValueTraits @@ -73,6 +85,16 @@ struct CORE_EXPORT NativeValueTraits } }; +template <> +struct CORE_EXPORT NativeValueTraits> + : public NativeValueTraitsBase { + static bool NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + return ToBoolean(isolate, value, exception_state); + } +}; + // Integer types #define DEFINE_NATIVE_VALUE_TRAITS_INTEGER_TYPE(T, Func) \ template \ @@ -387,6 +409,19 @@ struct CORE_EXPORT NativeValueTraits> } }; +template <> +struct CORE_EXPORT NativeValueTraits> + : public NativeValueTraitsBase { + static decltype(auto) NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + if (value->IsUndefined()) + return bindings::NativeValueTraitsStringAdapter(); + return NativeValueTraits::NativeValue(isolate, value, + exception_state); + } +}; + template struct NativeValueTraits> : public NativeValueTraitsBase> { @@ -433,6 +468,19 @@ struct CORE_EXPORT NativeValueTraits> } }; +template <> +struct CORE_EXPORT NativeValueTraits> + : public NativeValueTraitsBase { + static decltype(auto) NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + if (value->IsUndefined()) + return bindings::NativeValueTraitsStringAdapter(); + return NativeValueTraits::NativeValue(isolate, value, + exception_state); + } +}; + template struct NativeValueTraits> : public NativeValueTraitsBase> { @@ -463,6 +511,19 @@ struct CORE_EXPORT NativeValueTraits> } }; +template <> +struct CORE_EXPORT NativeValueTraits> + : public NativeValueTraitsBase { + static decltype(auto) NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + if (value->IsUndefined()) + return bindings::NativeValueTraitsStringAdapter(); + return NativeValueTraits::NativeValue(isolate, value, + exception_state); + } +}; + template struct NativeValueTraits> : public NativeValueTraitsBase< @@ -586,6 +647,7 @@ struct CORE_EXPORT NativeValueTraits v8::Local value, ExceptionState& exception_state); }; + template <> struct CORE_EXPORT NativeValueTraits> : public NativeValueTraitsBase { @@ -613,6 +675,7 @@ struct NativeValueTraits< v8::Local value, ExceptionState& exception_state); }; + template struct NativeValueTraits< IDLNullable>, @@ -642,6 +705,7 @@ struct NativeValueTraits< v8::Local value, ExceptionState& exception_state); }; + template struct NativeValueTraits< IDLNullable>, @@ -673,6 +737,7 @@ struct NativeValueTraits< v8::Local value, ExceptionState& exception_state); }; + template struct NativeValueTraits< IDLNullable, @@ -756,6 +821,7 @@ struct CORE_EXPORT NativeValueTraits value); } }; + // IDLNullable must not be used. template <> struct NativeValueTraits>; @@ -888,6 +954,20 @@ struct NativeValueTraits> } }; +template +struct NativeValueTraits>> + : public NativeValueTraitsBase> { + static typename NativeValueTraits>::ImplType NativeValue( + v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + if (value->IsUndefined()) + return {}; + return NativeValueTraits>::NativeValue(isolate, value, + exception_state); + } +}; + // Record types template struct NativeValueTraits> @@ -1140,35 +1220,20 @@ struct NativeValueTraits< } }; +// We don't support nullable dictionary types for the time being since it's +// quite confusing. template struct NativeValueTraits< IDLNullable, - typename std::enable_if_t::value>> - : public NativeValueTraitsBase> { - static T* NativeValue(v8::Isolate* isolate, - v8::Local value, - ExceptionState& exception_state) { - if (value->IsObject()) - return NativeValueTraits::NativeValue(isolate, value, exception_state); - if (value->IsNullOrUndefined()) - return nullptr; - exception_state.ThrowTypeError("The given value is not an object."); - return nullptr; - } + typename std::enable_if_t< + std::is_base_of::value>>; - static T* ArgumentValue(v8::Isolate* isolate, - int argument_index, - v8::Local value, - ExceptionState& exception_state) { - if (value->IsObject()) - return NativeValueTraits::NativeValue(isolate, value, exception_state); - if (value->IsNullOrUndefined()) - return nullptr; - exception_state.ThrowTypeError( - ExceptionMessages::ArgumentNotOfType(argument_index, "Object")); - return nullptr; - } -}; +// Migration Adapters: Nullable dictionary types generated by the old bindings +// generator. +template +struct NativeValueTraits< + IDLNullable, + typename std::enable_if_t::value>>; // Enumeration types template @@ -1253,6 +1318,18 @@ struct NativeValueTraits< } }; +template +struct NativeValueTraits< + T, + typename std::enable_if_t::value>> + : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + return T::Create(isolate, value, exception_state); + } +}; + // Migration Adapters: union types generated by the old bindings generator. template struct NativeValueTraits> : public NativeValueTraitsBase { @@ -1318,6 +1395,44 @@ struct NativeValueTraits>> template struct NativeValueTraits>>; +template +struct NativeValueTraits>> + : public NativeValueTraitsBase { + static T NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + if (value->IsUndefined()) + return T(); + return NativeValueTraits>::NativeValue(isolate, value, + exception_state); + } + + static T ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } +}; + +template +struct NativeValueTraits>> + : public NativeValueTraitsBase { + static T NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + return NativeValueTraits>::NativeValue(isolate, value, + exception_state); + } + + static T ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local value, + ExceptionState& exception_state) { + return NativeValue(isolate, value, exception_state); + } +}; + // Nullable types template struct NativeValueTraits< @@ -1347,10 +1462,62 @@ struct NativeValueTraits< value, exception_state); } }; + // IDLNullable> must not be used. template struct NativeValueTraits>>; +// Optional types +template +struct NativeValueTraits, + typename std::enable_if_t::ImplType>::value>> + : public NativeValueTraitsBase::ImplType> { + using ImplType = typename NativeValueTraits::ImplType; + + static ImplType NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + // Just let ES undefined to be converted into 0. + return NativeValueTraits::NativeValue(isolate, value, exception_state); + } + + static ImplType ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local value, + ExceptionState& exception_state) { + // Just let ES undefined to be converted into 0. + return NativeValueTraits::ArgumentValue(isolate, argument_index, value, + exception_state); + } +}; + +template +struct NativeValueTraits, + typename std::enable_if_t::ImplType>::value>> + : public NativeValueTraitsBase::ImplType> { + using ImplType = typename NativeValueTraits::ImplType; + + static ImplType NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + if (value->IsUndefined()) + return nullptr; + return NativeValueTraits::NativeValue(isolate, value, exception_state); + } + + static ImplType ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local value, + ExceptionState& exception_state) { + if (value->IsUndefined()) + return nullptr; + return NativeValueTraits::ArgumentValue(isolate, argument_index, value, + exception_state); + } +}; + // Date template <> struct CORE_EXPORT NativeValueTraits @@ -1420,6 +1587,7 @@ struct CORE_EXPORT NativeValueTraits v8::Local value, ExceptionState& exception_state); }; + template <> struct CORE_EXPORT NativeValueTraits> : public NativeValueTraitsBase> { diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/rejected_promises.cc b/chromium/third_party/blink/renderer/bindings/core/v8/rejected_promises.cc index 88a639c6697..7728ca77e8f 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/rejected_promises.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/rejected_promises.cc @@ -5,6 +5,7 @@ #include "third_party/blink/renderer/bindings/core/v8/rejected_promises.h" #include +#include #include "base/memory/ptr_util.h" #include "third_party/blink/public/platform/platform.h" @@ -214,7 +215,7 @@ void RejectedPromises::HandlerAdded(v8::PromiseRejectMessage data) { context->GetTaskRunner(TaskType::kDOMManipulation) ->PostTask(FROM_HERE, WTF::Bind(&RejectedPromises::RevokeNow, scoped_refptr(this), - WTF::Passed(std::move(message)))); + std::move(message))); reported_as_errors_.EraseAt(i); return; } @@ -244,7 +245,7 @@ void RejectedPromises::ProcessQueue() { kv.key->GetTaskRunner(blink::TaskType::kDOMManipulation) ->PostTask(FROM_HERE, WTF::Bind(&RejectedPromises::ProcessQueueNow, scoped_refptr(this), - WTF::Passed(std::move(kv.value)))); + std::move(kv.value))); } } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/remote_window_proxy.cc b/chromium/third_party/blink/renderer/bindings/core/v8/remote_window_proxy.cc index ab2c20f80a0..a4fa41cf291 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/remote_window_proxy.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/remote_window_proxy.cc @@ -62,8 +62,6 @@ void RemoteWindowProxy::DisposeContext(Lifecycle next_status, if (lifecycle_ == Lifecycle::kV8MemoryIsForciblyPurged) { DCHECK(next_status == Lifecycle::kGlobalObjectIsDetached || next_status == Lifecycle::kFrameIsDetachedAndV8MemoryIsPurged); - if (next_status == Lifecycle::kFrameIsDetachedAndV8MemoryIsPurged) - global_proxy_.SetPhantom(); lifecycle_ = next_status; return; } @@ -74,6 +72,7 @@ void RemoteWindowProxy::DisposeContext(Lifecycle next_status, if ((next_status == Lifecycle::kV8MemoryIsForciblyPurged || next_status == Lifecycle::kGlobalObjectIsDetached) && !global_proxy_.IsEmpty()) { + v8::HandleScope handle_scope(GetIsolate()); global_proxy_.Get().SetWrapperClassId(0); V8DOMWrapper::ClearNativeInfo(GetIsolate(), global_proxy_.NewLocal(GetIsolate())); @@ -82,12 +81,6 @@ void RemoteWindowProxy::DisposeContext(Lifecycle next_status, #endif } - if (next_status == Lifecycle::kFrameIsDetached) { - // The context's frame is detached from the DOM, so there shouldn't be a - // strong reference to the context. - global_proxy_.SetPhantom(); - } - DCHECK_EQ(lifecycle_, Lifecycle::kContextIsInitialized); lifecycle_ = next_status; } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/remote_window_proxy.h b/chromium/third_party/blink/renderer/bindings/core/v8/remote_window_proxy.h index 0841c421bef..22596bda400 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/remote_window_proxy.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/remote_window_proxy.h @@ -40,14 +40,12 @@ namespace blink { // Subclass of WindowProxy that only handles RemoteFrame. -// TODO(dcheng): This class temporarily contains code duplicated from -// LocalWindowProxy. It will be removed once the global proxy is instantiated -// using v8::Context::NewRemoteContext(). class RemoteWindowProxy final : public WindowProxy { public: RemoteWindowProxy(v8::Isolate*, RemoteFrame&, scoped_refptr); private: + // WindowProxy overrides: void Initialize() override; void DisposeContext(Lifecycle next_status, FrameReuseStatus) override; @@ -62,6 +60,11 @@ class RemoteWindowProxy final : public WindowProxy { void SetupWindowPrototypeChain(); }; +template <> +struct DowncastTraits { + static bool AllowFrom(const WindowProxy& proxy) { return !proxy.IsLocal(); } +}; + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_REMOTE_WINDOW_PROXY_H_ diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc b/chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc index b54f028e092..40591a51f7d 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc @@ -31,19 +31,16 @@ #include "third_party/blink/renderer/bindings/core/v8/scheduled_action.h" #include "third_party/blink/renderer/bindings/core/v8/binding_security.h" -#include "third_party/blink/renderer/bindings/core/v8/script_controller.h" +#include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" -#include "third_party/blink/renderer/bindings/core/v8/source_location.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_function.h" -#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" -#include "third_party/blink/renderer/core/workers/worker_global_scope.h" -#include "third_party/blink/renderer/core/workers/worker_thread.h" +#include "third_party/blink/renderer/core/script/classic_script.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/wtf/casting.h" @@ -115,40 +112,45 @@ void ScheduledAction::Execute(ExecutionContext* context) { DVLOG(1) << "ScheduledAction::execute " << this << ": context is empty"; return; } - // ExecutionContext::CanExecuteScripts() relies on the current context to - // determine if it is allowed. Enter the scope here. - ScriptState::Scope scope(script_state_->Get()); - if (!context->CanExecuteScripts(kAboutToExecuteScript)) { - DVLOG(1) << "ScheduledAction::execute " << this - << ": window can not execute scripts"; - return; - } - // https://html.spec.whatwg.org/C/#timer-initialisation-steps - if (function_) { - DVLOG(1) << "ScheduledAction::execute " << this << ": have function"; - function_->InvokeAndReportException(context->ToScriptWrappable(), - arguments_); - return; + { + // ExecutionContext::CanExecuteScripts() relies on the current context to + // determine if it is allowed. Enter the scope here. + // TODO(crbug.com/1151165): Consider merging CanExecuteScripts() calls, + // because once crbug.com/1111134 is done, CanExecuteScripts() will be + // always called below inside + // - InvokeAndReportException() => V8Function::Invoke() => + // IsCallbackFunctionRunnable() and + // - V8ScriptRunner::CompileAndRunScript(). + ScriptState::Scope scope(script_state_->Get()); + if (!context->CanExecuteScripts(kAboutToExecuteScript)) { + DVLOG(1) << "ScheduledAction::execute " << this + << ": window can not execute scripts"; + return; + } + + // https://html.spec.whatwg.org/C/#timer-initialisation-steps + if (function_) { + DVLOG(1) << "ScheduledAction::execute " << this << ": have function"; + function_->InvokeAndReportException(context->ToScriptWrappable(), + arguments_); + return; + } + + // We exit the scope here, because we enter v8::Context during the main + // evaluation below. } // We use |SanitizeScriptErrors::kDoNotSanitize| because muted errors flag is // not set in https://html.spec.whatwg.org/C/#timer-initialisation-steps + // TODO(crbug.com/1133238): Plumb base URL etc. from the initializing script. DVLOG(1) << "ScheduledAction::execute " << this << ": executing from source"; - if (LocalDOMWindow* window = DynamicTo(context)) { - window->GetScriptController().ExecuteScriptAndReturnValue( - script_state_->GetContext(), - ScriptSourceCode(code_, - ScriptSourceLocationType::kEvalForScheduledAction), - KURL(), SanitizeScriptErrors::kDoNotSanitize); - } else { - WorkerGlobalScope* worker = To(context); - DCHECK(worker->GetThread()->IsCurrentThread()); - worker->ScriptController()->EvaluateAndReturnValue( - ScriptSourceCode(code_, - ScriptSourceLocationType::kEvalForScheduledAction), - SanitizeScriptErrors::kDoNotSanitize); - } + v8::HandleScope scope(script_state_->GetIsolate()); + ClassicScript* script = MakeGarbageCollected( + ScriptSourceCode(code_, + ScriptSourceLocationType::kEvalForScheduledAction), + KURL(), ScriptFetchOptions(), SanitizeScriptErrors::kDoNotSanitize); + script->RunScriptOnScriptStateAndReturnValue(script_state_->Get()); } void ScheduledAction::Trace(Visitor* visitor) const { diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_controller.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_controller.cc index b572c7f7b9a..97c22f59811 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_controller.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_controller.cc @@ -36,9 +36,6 @@ #include #include "base/callback_helpers.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" -#include "third_party/blink/public/web/web_settings.h" -#include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" @@ -51,7 +48,6 @@ #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_client.h" -#include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/html/html_plugin_element.h" #include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" @@ -83,31 +79,6 @@ void ScriptController::UpdateSecurityOrigin( window_proxy_manager_->UpdateSecurityOrigin(security_origin); } -// TODO(crbug/1129743): Use ScriptEvaluationResult instead of -// v8::Local as the return type. -v8::Local ScriptController::ExecuteScriptAndReturnValue( - v8::Local context, - const ScriptSourceCode& source, - const KURL& base_url, - SanitizeScriptErrors sanitize_script_errors, - const ScriptFetchOptions& fetch_options) { - mojom::blink::V8CacheOptions v8_cache_options = - mojom::blink::V8CacheOptions::kDefault; - if (const Settings* settings = window_->GetFrame()->GetSettings()) - v8_cache_options = settings->GetV8CacheOptions(); - - ScriptEvaluationResult result = V8ScriptRunner::CompileAndRunScript( - GetIsolate(), ScriptState::From(context), window_.Get(), source, - base_url, sanitize_script_errors, fetch_options, - std::move(v8_cache_options), - V8ScriptRunner::RethrowErrorsOption::DoNotRethrow()); - - if (result.GetResultType() == ScriptEvaluationResult::ResultType::kSuccess) - return result.GetSuccessValue(); - - return v8::Local(); -} - TextPosition ScriptController::EventHandlerPosition() const { ScriptableDocumentParser* parser = window_->document()->GetScriptableDocumentParser(); @@ -185,7 +156,7 @@ v8::ExtensionConfiguration ScriptController::ExtensionsFor( } void ScriptController::UpdateDocument() { - window_proxy_manager_->MainWorldProxyMaybeUninitialized()->UpdateDocument(); + window_proxy_manager_->UpdateDocument(); } void ScriptController::ExecuteJavaScriptURL( @@ -264,12 +235,12 @@ void ScriptController::ExecuteJavaScriptURL( UseCounter::Count(window_.Get(), WebFeature::kReplaceDocumentViaJavaScriptURL); - auto params = std::make_unique(); - params->url = window_->Url(); - if (auto* owner = window_->GetFrame()->Owner()) - params->frame_policy = owner->GetFramePolicy(); - params->origin_to_commit = window_->GetSecurityOrigin(); + auto* previous_document_loader = + window_->GetFrame()->Loader().GetDocumentLoader(); + DCHECK(previous_document_loader); + auto params = + previous_document_loader->CreateWebNavigationParamsToCloneDocument(); String result = ToCoreString(v8::Local::Cast(v8_result)); WebNavigationParams::FillStaticResponse(params.get(), "text/html", "UTF-8", StringUTF8Adaptor(result)); @@ -277,54 +248,31 @@ void ScriptController::ExecuteJavaScriptURL( CommitReason::kJavascriptUrl); } -v8::Local ScriptController::EvaluateScriptInMainWorld( - const ScriptSourceCode& source_code, - const KURL& base_url, - SanitizeScriptErrors sanitize_script_errors, - const ScriptFetchOptions& fetch_options, - ExecuteScriptPolicy policy) { - if (!CanExecuteScript(policy)) { - return v8::Local(); - } - - // |context| should be initialized already due to the - // MainWorldProxy() call. - v8::Local context = - window_proxy_manager_->MainWorldProxy()->ContextIfInitialized(); - v8::Context::Scope scope(context); - v8::EscapableHandleScope handle_scope(GetIsolate()); - - v8::Local object = ExecuteScriptAndReturnValue( - context, source_code, base_url, sanitize_script_errors, fetch_options); - - if (object.IsEmpty()) - return v8::Local(); - - return handle_scope.Escape(object); -} - v8::Local ScriptController::EvaluateMethodInMainWorld( v8::Local function, v8::Local receiver, int argc, - v8::Local argv[], - ExecuteScriptPolicy policy) { - if (!CanExecuteScript(policy)) { + v8::Local argv[]) { + if (!CanExecuteScript( + ExecuteScriptPolicy::kDoNotExecuteScriptWhenScriptsDisabled)) { + return v8::Local(); + } + + // |script_state->GetContext()| should be initialized already due to the + // WindowProxy() call inside ToScriptStateForMainWorld(). + ScriptState* script_state = ToScriptStateForMainWorld(window_->GetFrame()); + if (!script_state) { return v8::Local(); } + DCHECK_EQ(script_state->GetIsolate(), GetIsolate()); - // |context| should be initialized already due to the - // MainWorldProxy() call. - v8::Local context = - window_proxy_manager_->MainWorldProxy()->ContextIfInitialized(); - v8::Context::Scope scope(context); + v8::Context::Scope scope(script_state->GetContext()); v8::EscapableHandleScope handle_scope(GetIsolate()); v8::TryCatch try_catch(GetIsolate()); try_catch.SetVerbose(true); - ExecutionContext* executionContext = - ExecutionContext::From(ScriptState::From(context)); + ExecutionContext* executionContext = ExecutionContext::From(script_state); v8::MaybeLocal resultObj = V8ScriptRunner::CallFunction( function, executionContext, receiver, argc, @@ -337,7 +285,7 @@ v8::Local ScriptController::EvaluateMethodInMainWorld( } bool ScriptController::CanExecuteScript(ExecuteScriptPolicy policy) { - if (policy == kDoNotExecuteScriptWhenScriptsDisabled && + if (policy == ExecuteScriptPolicy::kDoNotExecuteScriptWhenScriptsDisabled && !window_->CanExecuteScripts(kAboutToExecuteScript)) return false; @@ -347,29 +295,6 @@ bool ScriptController::CanExecuteScript(ExecuteScriptPolicy policy) { return true; } -v8::Local ScriptController::ExecuteScriptInIsolatedWorld( - int32_t world_id, - const ScriptSourceCode& source, - const KURL& base_url, - SanitizeScriptErrors sanitize_script_errors) { - DCHECK_GT(world_id, 0); - - scoped_refptr world = - DOMWrapperWorld::EnsureIsolatedWorld(GetIsolate(), world_id); - LocalWindowProxy* isolated_world_window_proxy = WindowProxy(*world); - // TODO(dcheng): Context must always be initialized here, due to the call to - // windowProxy() on the previous line. Add a helper which makes that obvious? - v8::Local context = - isolated_world_window_proxy->ContextIfInitialized(); - v8::Context::Scope scope(context); - - v8::Local evaluation_result = ExecuteScriptAndReturnValue( - context, source, base_url, sanitize_script_errors); - if (!evaluation_result.IsEmpty()) - return evaluation_result; - return v8::Local::New(GetIsolate(), v8::Undefined(GetIsolate())); -} - scoped_refptr ScriptController::CreateNewInspectorIsolatedWorld(const String& world_name) { scoped_refptr world = DOMWrapperWorld::Create( diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_controller.h b/chromium/third_party/blink/renderer/bindings/core/v8/script_controller.h index 992b5ec1227..d81f02ca6e6 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_controller.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_controller.h @@ -34,14 +34,10 @@ #include #include "base/macros.h" -#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_location_type.h" #include "third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" -#include "third_party/blink/renderer/platform/loader/fetch/script_fetch_options.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "v8/include/v8.h" @@ -49,23 +45,18 @@ namespace blink { class DOMWrapperWorld; -class ExecutionContext; class KURL; class LocalDOMWindow; -class ScriptSourceCode; class SecurityOrigin; +enum class ExecuteScriptPolicy; + // This class exposes methods to run script in a frame (in the main world and // in isolated worlds). An instance can be obtained by using // LocalDOMWindow::GetScriptController(). class CORE_EXPORT ScriptController final : public GarbageCollected { public: - enum ExecuteScriptPolicy { - kExecuteScriptWhenScriptsDisabled, - kDoNotExecuteScriptWhenScriptsDisabled - }; - ScriptController(LocalDOMWindow& window, LocalWindowProxyManager& window_proxy_manager) : window_(&window), window_proxy_manager_(&window_proxy_manager) {} @@ -77,39 +68,11 @@ class CORE_EXPORT ScriptController final return window_proxy_manager_->WindowProxy(world); } - v8::Local ExecuteScriptAndReturnValue( - v8::Local, - const ScriptSourceCode&, - const KURL& base_url, - SanitizeScriptErrors, - const ScriptFetchOptions& = ScriptFetchOptions()); - v8::Local EvaluateMethodInMainWorld( v8::Local function, v8::Local receiver, int argc, - v8::Local argv[], - ScriptController::ExecuteScriptPolicy = ScriptController:: - ExecuteScriptPolicy::kDoNotExecuteScriptWhenScriptsDisabled); - - // Evaluate JavaScript in the main world. - v8::Local EvaluateScriptInMainWorld(const ScriptSourceCode&, - const KURL& base_url, - SanitizeScriptErrors, - const ScriptFetchOptions&, - ExecuteScriptPolicy); - - // Executes JavaScript in an isolated world. The script gets its own global - // scope, its own prototypes for intrinsic JavaScript objects (String, Array, - // and so-on), and its own wrappers for all DOM nodes and DOM constructors. - // - // If an isolated world with the specified ID already exists, it is reused. - // Otherwise, a new world is created. - v8::Local ExecuteScriptInIsolatedWorld( - int32_t world_id, - const ScriptSourceCode&, - const KURL& base_url, - SanitizeScriptErrors sanitize_script_errors); + v8::Local argv[]); // Executes a javascript url in the main world. |world_for_csp| denotes the // javascript world in which this navigation initiated and which should be diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_evaluation_result.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_evaluation_result.cc index b9241cbee94..51a42db62c8 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_evaluation_result.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_evaluation_result.cc @@ -81,12 +81,6 @@ ScriptEvaluationResult ScriptEvaluationResult::FromModuleAborted() { ResultType::kAborted, {}); } -ScriptEvaluationResult& ScriptEvaluationResult::Escape( - ScriptState::EscapableScope* scope) { - value_ = scope->Escape(value_); - return *this; -} - v8::Local ScriptEvaluationResult::GetSuccessValue() const { DCHECK_EQ(result_type_, ResultType::kSuccess); DCHECK(!value_.IsEmpty()); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h b/chromium/third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h index f31b03eba76..9bc596456e8 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h @@ -96,8 +96,6 @@ class CORE_EXPORT ScriptEvaluationResult final { v8::Local exception); static ScriptEvaluationResult FromModuleAborted(); - ScriptEvaluationResult& Escape(ScriptState::EscapableScope* scope); - ResultType GetResultType() const { return result_type_; } // Can be called only when GetResultType() == kSuccess. diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_function.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_function.cc index 5d84c120ac4..5eef41c8c24 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_function.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_function.cc @@ -9,6 +9,28 @@ namespace blink { +namespace { + +class CallableHolder final : public CustomWrappableAdapter { + public: + explicit CallableHolder(NewScriptFunction::Callable* callable) + : callable_(callable) {} + const char* NameInHeapSnapshot() const final { + return "ScriptFunction::Callable"; + } + NewScriptFunction::Callable* GetCallable() { return callable_; } + + void Trace(Visitor* visitor) const override { + visitor->Trace(callable_); + CustomWrappableAdapter::Trace(visitor); + } + + private: + const Member callable_; +}; + +} // namespace + void ScriptFunction::Trace(Visitor* visitor) const { visitor->Trace(script_state_); CustomWrappableAdapter::Trace(visitor); @@ -48,4 +70,44 @@ void ScriptFunction::CallCallback( script_function->CallRaw(args); } +ScriptValue NewScriptFunction::Callable::Call(ScriptState*, ScriptValue) { + NOTREACHED(); + return ScriptValue(); +} + +void NewScriptFunction::Callable::CallRaw( + ScriptState* script_state, + const v8::FunctionCallbackInfo& args) { + ScriptValue result = + Call(script_state, ScriptValue(script_state->GetIsolate(), args[0])); + V8SetReturnValue(args, result.V8Value()); +} + +v8::Local NewScriptFunction::BindToV8Function( + ScriptState* script_state, + Callable* callable) { + DCHECK(callable); + v8::Local wrapper = + MakeGarbageCollected(callable) + ->CreateAndInitializeWrapper(script_state); + + // The wrapper is held alive by the CallHandlerInfo internally in V8 as long + // as the function is alive. + return v8::Function::New(script_state->GetContext(), CallCallback, wrapper, + callable->Length(), v8::ConstructorBehavior::kThrow) + .ToLocalChecked(); +} + +void NewScriptFunction::CallCallback( + const v8::FunctionCallbackInfo& args) { + RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(args.GetIsolate(), + "Blink_CallCallback"); + v8::Local data = v8::Local::Cast(args.Data()); + auto* holder = static_cast(ToCustomWrappable(data)); + ScriptState* script_state = + ScriptState::From(args.GetIsolate()->GetCurrentContext()); + + holder->GetCallable()->CallRaw(script_state, args); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_function.h b/chromium/third_party/blink/renderer/bindings/core/v8/script_function.h index 2e80f0b9f84..595ee8f8499 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_function.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_function.h @@ -34,22 +34,14 @@ #include "third_party/blink/renderer/bindings/core/v8/custom_wrappable_adapter.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/bindings/script_state.h" +#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "v8/include/v8.h" namespace blink { -// A common way of using ScriptFunction is as follows: -// -// class DerivedFunction : public ScriptFunction { -// // This returns a V8 function which the DerivedFunction is bound to. -// // The DerivedFunction is destroyed when the V8 function is -// // garbage-collected. -// static v8::Local CreateFunction(ScriptState* script_state) { -// DerivedFunction* self = new DerivedFunction(script_state); -// return self->BindToV8Function(); -// } -// }; +// DEPRECATED: Use NewScriptFunction. class CORE_EXPORT ScriptFunction : public CustomWrappableAdapter { public: ~ScriptFunction() override = default; @@ -86,6 +78,68 @@ class CORE_EXPORT ScriptFunction : public CustomWrappableAdapter { #endif }; +// A `NewScriptFunction` represents a function that can be called from scripts. +// You can define a subclass of `Callable` and put arbitrary logic by +// overriding `Call` or `CallRaw` methods. +class CORE_EXPORT NewScriptFunction final + : public GarbageCollected { + public: + class CORE_EXPORT Callable : public GarbageCollected { + public: + virtual ~Callable() = default; + + // Subclasses should implement one of Call() or CallRaw(). Most will + // implement Call(). + virtual ScriptValue Call(ScriptState*, ScriptValue); + + // To support more than one argument, or for low-level access to the V8 API, + // implement CallRaw(). The default implementation delegates to Call(). + virtual void CallRaw(ScriptState*, + const v8::FunctionCallbackInfo&); + + // The length of the aosociated JavaScript function. Implement this only + // when the function is exposed to scripts. + virtual int Length() const { return 0; } + + virtual void Trace(Visitor* visitor) const {} + }; + + // Represents a function that returns a value given to the constructor. + class Constant final : public Callable { + public: + explicit Constant(ScriptValue value) : value_(value) {} + void Trace(Visitor* visitor) const override { + visitor->Trace(value_); + Callable::Trace(visitor); + } + ScriptValue Call(ScriptState*, ScriptValue) override { return value_; } + + private: + const ScriptValue value_; + }; + + NewScriptFunction(ScriptState* script_state, Callable* callable) + : script_state_(script_state), + function_(script_state->GetIsolate(), + BindToV8Function(script_state, callable)) {} + + void Trace(Visitor* visitor) const { + visitor->Trace(script_state_); + visitor->Trace(function_); + } + + v8::Local V8Function() { + return function_.NewLocal(script_state_->GetIsolate()); + } + + private: + static v8::Local BindToV8Function(ScriptState*, Callable*); + static void CallCallback(const v8::FunctionCallbackInfo&); + + Member script_state_; + TraceWrapperV8Reference function_; +}; + } // namespace blink #endif diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise.cc index 4bc39c11009..3c98f9018da 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise.cc @@ -266,6 +266,13 @@ ScriptPromise ScriptPromise::Then(v8::Local on_fulfilled, return ScriptPromise(script_state_, result_promise); } +ScriptPromise ScriptPromise::Then(NewScriptFunction* on_fulfilled, + NewScriptFunction* on_rejected) { + const v8::Local empty; + return Then(on_fulfilled ? on_fulfilled->V8Function() : empty, + on_rejected ? on_rejected->V8Function() : empty); +} + ScriptPromise ScriptPromise::CastUndefined(ScriptState* script_state) { return ScriptPromise::Cast(script_state, v8::Undefined(script_state->GetIsolate())); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise.h b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise.h index 37385c2267a..3b7d6d5cf05 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise.h @@ -43,6 +43,7 @@ namespace blink { class DOMException; class ExceptionState; +class NewScriptFunction; // ScriptPromise is the class for representing Promise values in C++ world. // ScriptPromise holds a Promise. @@ -69,6 +70,8 @@ class CORE_EXPORT ScriptPromise final { ScriptPromise Then(v8::Local on_fulfilled, v8::Local on_rejected = {}); + ScriptPromise Then(NewScriptFunction* on_fulfilled, + NewScriptFunction* on_rejected = nullptr); bool IsObject() const { return promise_.IsObject(); } @@ -78,9 +81,14 @@ class CORE_EXPORT ScriptPromise final { return promise_.IsUndefined() || promise_.IsNull(); } - ScriptValue GetScriptValue() const { return promise_; } + ScriptValue AsScriptValue() const { return promise_; } v8::Local V8Value() const { return promise_.V8Value(); } + v8::Local V8Promise() const { + // This is safe because `promise_` always stores a promise value as long + // as it's non-empty. + return V8Value().As(); + } v8::Isolate* GetIsolate() const { return script_state_->GetIsolate(); } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_property_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_property_test.cc index b4efa922faa..4d3ba4bb7d6 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_property_test.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_property_test.cc @@ -510,7 +510,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, MarkAsHandled) { GarbageCollectedScriptWrappable* reason = MakeGarbageCollected("reason"); GetProperty()->Reject(reason); - EXPECT_FALSE(promise.V8Value().As()->HasHandler()); + EXPECT_FALSE(promise.V8Promise()->HasHandler()); } GetProperty()->Reset(); @@ -524,7 +524,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, MarkAsHandled) { GarbageCollectedScriptWrappable* reason = MakeGarbageCollected("reason"); GetProperty()->Reject(reason); - EXPECT_TRUE(promise.V8Value().As()->HasHandler()); + EXPECT_TRUE(promise.V8Promise()->HasHandler()); } GetProperty()->Reset(); @@ -538,7 +538,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, MarkAsHandled) { GarbageCollectedScriptWrappable* reason = MakeGarbageCollected("reason"); GetProperty()->Reject(reason); - EXPECT_TRUE(promise.V8Value().As()->HasHandler()); + EXPECT_TRUE(promise.V8Promise()->HasHandler()); } } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h index 13d4fea03a3..69231d62d79 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h @@ -42,7 +42,7 @@ class CORE_EXPORT ScriptPromiseResolver public: explicit ScriptPromiseResolver(ScriptState*); - virtual ~ScriptPromiseResolver(); + ~ScriptPromiseResolver() override; void Dispose(); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_test.cc index 0e4aa4195a8..ef38dc01fc0 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_test.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_test.cc @@ -48,6 +48,12 @@ namespace { typedef ScriptPromise::InternalResolver Resolver; +template +NewScriptFunction* CreateFunction(ScriptState* script_state, Args&&... args) { + return MakeGarbageCollected( + script_state, MakeGarbageCollected(std::forward(args)...)); +} + class FunctionForScriptPromiseTest : public ScriptFunction { public: static v8::Local CreateFunction(ScriptState* script_state, @@ -88,6 +94,49 @@ class ThrowingFunction : public ScriptFunction { } }; +class ThrowingCallable : public NewScriptFunction::Callable { + public: + private: + ScriptValue Call(ScriptState* script_state, ScriptValue value) override { + v8::Isolate* isolate = script_state->GetIsolate(); + isolate->ThrowException(v8::Undefined(isolate)); + return ScriptValue(); + } +}; + +class NotReached : public NewScriptFunction::Callable { + ScriptValue Call(ScriptState* script_state, ScriptValue value) override { + ADD_FAILURE() << "This function should not be called."; + return ScriptValue(); + } +}; + +class ScriptValueHolder final : public GarbageCollected { + public: + const ScriptValue& Value() const { return value_; } + void SetValue(const ScriptValue& value) { value_ = value; } + void Trace(Visitor* visitor) const { visitor->Trace(value_); } + + private: + ScriptValue value_; +}; + +class CapturingCallable final : public NewScriptFunction::Callable { + public: + explicit CapturingCallable(ScriptValueHolder* holder) : holder_(holder) {} + ScriptValue Call(ScriptState*, ScriptValue value) override { + holder_->SetValue(value); + return value; + } + void Trace(Visitor* visitor) const override { + visitor->Trace(holder_); + Callable::Trace(visitor); + } + + private: + Member holder_; +}; + String ToString(v8::Local context, const ScriptValue& value) { return ToCoreString(value.V8Value()->ToString(context).ToLocalChecked()); } @@ -133,6 +182,28 @@ TEST(ScriptPromiseTest, ThenResolve) { EXPECT_TRUE(on_rejected.IsEmpty()); } +TEST(ScriptPromiseTest, ThenResolveScriptFunction) { + V8TestingScope scope; + Resolver resolver(scope.GetScriptState()); + ScriptPromise promise = resolver.Promise(); + auto* const on_fulfilled = MakeGarbageCollected(); + promise.Then( + CreateFunction(scope.GetScriptState(), on_fulfilled), + CreateFunction(scope.GetScriptState())); + + ASSERT_FALSE(promise.IsEmpty()); + EXPECT_TRUE(on_fulfilled->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + resolver.Resolve(V8String(scope.GetIsolate(), "hello")); + + EXPECT_TRUE(on_fulfilled->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + + EXPECT_EQ("hello", ToString(scope.GetContext(), on_fulfilled->Value())); +} + TEST(ScriptPromiseTest, ResolveThen) { V8TestingScope scope; Resolver resolver(scope.GetScriptState()); @@ -154,6 +225,24 @@ TEST(ScriptPromiseTest, ResolveThen) { EXPECT_TRUE(on_rejected.IsEmpty()); } +TEST(ScriptPromiseTest, ResolveThenScriptFunction) { + V8TestingScope scope; + Resolver resolver(scope.GetScriptState()); + ScriptPromise promise = resolver.Promise(); + auto* const on_fulfilled = MakeGarbageCollected(); + resolver.Resolve(V8String(scope.GetIsolate(), "hello")); + promise.Then( + CreateFunction(scope.GetScriptState(), on_fulfilled), + CreateFunction(scope.GetScriptState())); + + ASSERT_FALSE(promise.IsEmpty()); + EXPECT_TRUE(on_fulfilled->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + + EXPECT_EQ("hello", ToString(scope.GetContext(), on_fulfilled->Value())); +} + TEST(ScriptPromiseTest, ThenReject) { V8TestingScope scope; Resolver resolver(scope.GetScriptState()); @@ -180,6 +269,28 @@ TEST(ScriptPromiseTest, ThenReject) { EXPECT_EQ("hello", ToString(scope.GetContext(), on_rejected)); } +TEST(ScriptPromiseTest, ThenRejectScriptFunction) { + V8TestingScope scope; + Resolver resolver(scope.GetScriptState()); + ScriptPromise promise = resolver.Promise(); + auto* const on_rejected = MakeGarbageCollected(); + promise.Then( + CreateFunction(scope.GetScriptState()), + CreateFunction(scope.GetScriptState(), on_rejected)); + + ASSERT_FALSE(promise.IsEmpty()); + EXPECT_TRUE(on_rejected->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + resolver.Reject(V8String(scope.GetIsolate(), "hello")); + + EXPECT_TRUE(on_rejected->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + + EXPECT_EQ("hello", ToString(scope.GetContext(), on_rejected->Value())); +} + TEST(ScriptPromiseTest, ThrowingOnFulfilled) { V8TestingScope scope; Resolver resolver(scope.GetScriptState()); @@ -214,6 +325,32 @@ TEST(ScriptPromiseTest, ThrowingOnFulfilled) { EXPECT_FALSE(on_rejected2.IsEmpty()); } +TEST(ScriptPromiseTest, ThrowingOnFulfilledScriptFunction) { + V8TestingScope scope; + Resolver resolver(scope.GetScriptState()); + ScriptPromise promise = resolver.Promise(); + auto* const on_rejected = MakeGarbageCollected(); + + promise = + promise.Then(CreateFunction(scope.GetScriptState()), + CreateFunction(scope.GetScriptState())); + promise.Then( + CreateFunction(scope.GetScriptState()), + CreateFunction(scope.GetScriptState(), on_rejected)); + + ASSERT_FALSE(promise.IsEmpty()); + EXPECT_TRUE(on_rejected->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + resolver.Resolve(V8String(scope.GetIsolate(), "hello")); + + EXPECT_TRUE(on_rejected->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + + EXPECT_FALSE(on_rejected->Value().IsEmpty()); +} + TEST(ScriptPromiseTest, ThrowingOnRejected) { V8TestingScope scope; Resolver resolver(scope.GetScriptState()); @@ -248,6 +385,32 @@ TEST(ScriptPromiseTest, ThrowingOnRejected) { EXPECT_FALSE(on_rejected2.IsEmpty()); } +TEST(ScriptPromiseTest, ThrowingOnRejectedScriptFunction) { + V8TestingScope scope; + Resolver resolver(scope.GetScriptState()); + ScriptPromise promise = resolver.Promise(); + auto* const on_rejected = MakeGarbageCollected(); + + promise = + promise.Then(CreateFunction(scope.GetScriptState()), + CreateFunction(scope.GetScriptState())); + promise.Then( + CreateFunction(scope.GetScriptState()), + CreateFunction(scope.GetScriptState(), on_rejected)); + + ASSERT_FALSE(promise.IsEmpty()); + EXPECT_TRUE(on_rejected->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + resolver.Reject(V8String(scope.GetIsolate(), "hello")); + + EXPECT_TRUE(on_rejected->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + + EXPECT_FALSE(on_rejected->Value().IsEmpty()); +} + TEST(ScriptPromiseTest, RejectThen) { V8TestingScope scope; Resolver resolver(scope.GetScriptState()); @@ -269,6 +432,24 @@ TEST(ScriptPromiseTest, RejectThen) { EXPECT_EQ("hello", ToString(scope.GetContext(), on_rejected)); } +TEST(ScriptPromiseTest, RejectThenScriptFunction) { + V8TestingScope scope; + Resolver resolver(scope.GetScriptState()); + ScriptPromise promise = resolver.Promise(); + auto* const on_rejected = MakeGarbageCollected(); + resolver.Reject(V8String(scope.GetIsolate(), "hello")); + promise.Then( + CreateFunction(scope.GetScriptState()), + CreateFunction(scope.GetScriptState(), on_rejected)); + + ASSERT_FALSE(promise.IsEmpty()); + EXPECT_TRUE(on_rejected->Value().IsEmpty()); + + v8::MicrotasksScope::PerformCheckpoint(scope.GetIsolate()); + + EXPECT_EQ("hello", ToString(scope.GetContext(), on_rejected->Value())); +} + TEST(ScriptPromiseTest, CastPromise) { V8TestingScope scope; ScriptPromise promise = Resolver(scope.GetScriptState()).Promise(); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_tester.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_tester.cc index 41600d39f94..b7e053a18db 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_tester.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_tester.cc @@ -10,7 +10,6 @@ #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/heap/visitor.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "v8/include/v8.h" diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_tester.h b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_tester.h index ee5315a0ae8..8419792d413 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_tester.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_promise_tester.h @@ -7,13 +7,13 @@ #include "base/memory/weak_ptr.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h" +#include "third_party/blink/renderer/platform/heap/visitor.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" namespace blink { class ScriptState; class ScriptPromise; -class Visitor; // Utility for writing unit tests involving promises. // Typical usage: diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_regexp.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_regexp.cc index dc0523f9f09..23fe9bbb3f2 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_regexp.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_regexp.cc @@ -32,6 +32,7 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h" #include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h" +#include "third_party/blink/renderer/platform/bindings/string_resource.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" namespace blink { @@ -70,9 +71,10 @@ ScriptRegexp::ScriptRegexp(const String& pattern, ToCoreStringWithUndefinedOrNullCheck(try_catch.Message()->Get()); } -int ScriptRegexp::Match(const String& string, +int ScriptRegexp::Match(StringView string, int start_from, - int* match_length) const { + int* match_length, + WTF::Vector* group_list) const { if (match_length) *match_length = 0; @@ -94,7 +96,7 @@ int ScriptRegexp::Match(const String& string, v8::Local regex = regex_.NewLocal(isolate); v8::Local subject = - V8String(isolate, string.Substring(start_from)); + V8String(isolate, StringView(string, start_from)); v8::Local return_value; if (!regex->Exec(context, subject).ToLocal(&return_value)) return -1; @@ -122,7 +124,26 @@ int ScriptRegexp::Match(const String& string, *match_length = match.As()->Length(); } + if (group_list) { + DCHECK(group_list->IsEmpty()); + for (uint32_t i = 1; i < result->Length(); ++i) { + v8::Local group; + if (!result->Get(context, i).ToLocal(&group)) + return -1; + String group_string; + if (group->IsString()) { + group_string = + ToBlinkString(group.As(), kExternalize); + } + group_list->push_back(group_string); + } + } + return match_offset.As()->Value() + start_from; } +void ScriptRegexp::Trace(Visitor* visitor) const { + visitor->Trace(regex_); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_regexp.h b/chromium/third_party/blink/renderer/bindings/core/v8/script_regexp.h index 58df59bfb3f..315aef9ac2a 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_regexp.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_regexp.h @@ -29,7 +29,8 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/bindings/scoped_persistent.h" +#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" +#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "v8/include/v8.h" @@ -37,9 +38,7 @@ namespace blink { enum MultilineMode { kMultilineDisabled, kMultilineEnabled }; -class CORE_EXPORT ScriptRegexp { - USING_FAST_MALLOC(ScriptRegexp); - +class CORE_EXPORT ScriptRegexp final : public GarbageCollected { public: enum CharacterMode { BMP, // NOLINT @@ -53,16 +52,26 @@ class CORE_EXPORT ScriptRegexp { MultilineMode = kMultilineDisabled, CharacterMode = BMP); - int Match(const String&, + // Attempt to match the given input string against the regexp. Returns the + // index of the match within the input string on success and -1 otherwise. + // If |match_length| is provided, then its populated with the length of the + // match on success. If |group_list| is provided its populated with the + // matched groups within the regexp. These are the values normally starting + // at index 1 within the array returned from Regexp.exec(). |group_list| + // must be empty if it is provided. + int Match(StringView, int start_from = 0, - int* match_length = nullptr) const; + int* match_length = nullptr, + WTF::Vector* group_list = nullptr) const; bool IsValid() const { return !regex_.IsEmpty(); } // exceptionMessage is available only if !isValid(). String ExceptionMessage() const { return exception_message_; } + void Trace(Visitor* visitor) const; + private: - ScopedPersistent regex_; + TraceWrapperV8Reference regex_; String exception_message_; DISALLOW_COPY_AND_ASSIGN(ScriptRegexp); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer.cc index 0fb1c19eacb..02e2081d4d1 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer.cc @@ -5,6 +5,7 @@ #include "third_party/blink/renderer/bindings/core/v8/script_streamer.h" #include +#include #include "base/macros.h" #include "base/memory/ptr_util.h" @@ -19,10 +20,12 @@ #include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" #include "third_party/blink/renderer/core/loader/resource/script_resource.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" +#include "third_party/blink/renderer/platform/instrumentation/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/loader/fetch/cached_metadata.h" #include "third_party/blink/renderer/platform/loader/fetch/resource.h" #include "third_party/blink/renderer/platform/loader/fetch/response_body_loader.h" +#include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" @@ -100,9 +103,9 @@ class SourceStream : public v8::ScriptCompiler::ExternalSourceStream { memcpy(copy_for_resource.get(), buffer, num_bytes); PostCrossThreadTask( *loading_task_runner_, FROM_HERE, - CrossThreadBindOnce( - NotifyClientDidReceiveData, response_body_loader_client_, - WTF::Passed(std::move(copy_for_resource)), num_bytes)); + CrossThreadBindOnce(NotifyClientDidReceiveData, + response_body_loader_client_, + std::move(copy_for_resource), num_bytes)); result = data_pipe_->EndReadData(num_bytes); CHECK_EQ(result, MOJO_RESULT_OK); @@ -266,6 +269,100 @@ class SourceStream : public v8::ScriptCompiler::ExternalSourceStream { size_t ScriptStreamer::small_script_threshold_ = 30 * 1024; +std::tuple +ScriptStreamer::TakeFrom(ScriptResource* script_resource) { + ScriptStreamer::NotStreamingReason not_streamed_reason = + script_resource->NoStreamerReason(); + ScriptStreamer* streamer = script_resource->TakeStreamer(); + if (streamer) { + if (streamer->IsStreamingSuppressed()) { + not_streamed_reason = streamer->StreamingSuppressedReason(); + streamer = nullptr; + } else { + DCHECK_EQ(not_streamed_reason, + ScriptStreamer::NotStreamingReason::kInvalid); + } + } + return std::make_tuple(streamer, not_streamed_reason); +} + +namespace { + +enum class StreamedBoolean { + // Must match BooleanStreamed in enums.xml. + kNotStreamed = 0, + kStreamed = 1, + kMaxValue = kStreamed +}; + +void RecordStartedStreamingHistogram(ScriptSchedulingType type, + bool did_use_streamer) { + StreamedBoolean streamed = did_use_streamer ? StreamedBoolean::kStreamed + : StreamedBoolean::kNotStreamed; + switch (type) { + case ScriptSchedulingType::kParserBlocking: { + UMA_HISTOGRAM_ENUMERATION( + "WebCore.Scripts.ParsingBlocking.StartedStreaming", streamed); + break; + } + case ScriptSchedulingType::kDefer: { + UMA_HISTOGRAM_ENUMERATION("WebCore.Scripts.Deferred.StartedStreaming", + streamed); + break; + } + case ScriptSchedulingType::kAsync: { + UMA_HISTOGRAM_ENUMERATION("WebCore.Scripts.Async.StartedStreaming", + streamed); + break; + } + default: { + UMA_HISTOGRAM_ENUMERATION("WebCore.Scripts.Other.StartedStreaming", + streamed); + break; + } + } +} + +void RecordNotStreamingReasonHistogram( + ScriptSchedulingType type, + ScriptStreamer::NotStreamingReason reason) { + switch (type) { + case ScriptSchedulingType::kParserBlocking: { + UMA_HISTOGRAM_ENUMERATION( + "WebCore.Scripts.ParsingBlocking.NotStreamingReason", reason); + break; + } + case ScriptSchedulingType::kDefer: { + UMA_HISTOGRAM_ENUMERATION("WebCore.Scripts.Deferred.NotStreamingReason", + reason); + break; + } + case ScriptSchedulingType::kAsync: { + UMA_HISTOGRAM_ENUMERATION("WebCore.Scripts.Async.NotStreamingReason", + reason); + break; + } + default: { + UMA_HISTOGRAM_ENUMERATION("WebCore.Scripts.Other.NotStreamingReason", + reason); + break; + } + } +} + +} // namespace + +void ScriptStreamer::RecordStreamingHistogram( + ScriptSchedulingType type, + bool can_use_streamer, + ScriptStreamer::NotStreamingReason reason) { + RecordStartedStreamingHistogram(type, can_use_streamer); + if (!can_use_streamer) { + DCHECK_NE(ScriptStreamer::NotStreamingReason::kInvalid, reason); + RecordNotStreamingReasonHistogram(type, reason); + } +} + bool ScriptStreamer::ConvertEncoding( const char* encoding_name, v8::ScriptCompiler::StreamedSource::Encoding* encoding) { @@ -429,6 +526,16 @@ bool ScriptStreamer::TryStartStreamingTask() { if (!CanStartStreaming()) return false; + // Skip non-JS modules based on the mime-type. + // TODO(crbug/1132413),TODO(crbug/1061857): Disable streaming for non-JS + // based the specific import statements. + if (script_resource_->GetScriptType() == mojom::blink::ScriptType::kModule && + !MIMETypeRegistry::IsSupportedJavaScriptMIMEType( + script_resource_->GetResponse().HttpContentType())) { + SuppressStreaming(NotStreamingReason::kNonJavascriptModule); + return false; + } + // Even if the first data chunk is small, the script can still be big enough - // wait until the next data chunk comes before deciding whether to start the // streaming. @@ -486,10 +593,14 @@ bool ScriptStreamer::TryStartStreamingTask() { std::move(stream_ptr), encoding_); std::unique_ptr - script_streaming_task( - base::WrapUnique(v8::ScriptCompiler::StartStreamingScript( + script_streaming_task = + base::WrapUnique(v8::ScriptCompiler::StartStreaming( V8PerIsolateData::MainThreadIsolate(), source_.get(), - compile_options_))); + script_resource_->GetScriptType() == + mojom::blink::ScriptType::kClassic + ? v8::ScriptType::kClassic + : v8::ScriptType::kModule)); + if (!script_streaming_task) { // V8 cannot stream the script. stream_ = nullptr; @@ -518,7 +629,7 @@ bool ScriptStreamer::TryStartStreamingTask() { worker_pool::PostTask( FROM_HERE, {base::TaskPriority::USER_BLOCKING, base::MayBlock()}, CrossThreadBindOnce(RunScriptStreamingTask, - WTF::Passed(std::move(script_streaming_task)), + std::move(script_streaming_task), WrapCrossThreadPersistent(this), WTF::CrossThreadUnretained(stream_))); @@ -529,12 +640,10 @@ ScriptStreamer::ScriptStreamer( ScriptResource* script_resource, mojo::ScopedDataPipeConsumerHandle data_pipe, ResponseBodyLoaderClient* response_body_loader_client, - v8::ScriptCompiler::CompileOptions compile_options, scoped_refptr loading_task_runner) : script_resource_(script_resource), response_body_loader_client_(response_body_loader_client), data_pipe_(std::move(data_pipe)), - compile_options_(compile_options), script_url_string_(script_resource->Url().Copy().GetString()), script_resource_identifier_(script_resource->InspectorId()), // Unfortunately there's no dummy encoding value in the enum; let's use diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer.h b/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer.h index bf042780c45..714c66ae3aa 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer.h @@ -6,11 +6,13 @@ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_SCRIPT_STREAMER_H_ #include +#include #include "base/macros.h" #include "base/single_thread_task_runner.h" #include "mojo/public/cpp/system/data_pipe.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/script/script_scheduling_type.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "v8/include/v8.h" @@ -58,6 +60,7 @@ class CORE_EXPORT ScriptStreamer final kModuleScript, kNoDataPipe, kLoadingCancelled, + kNonJavascriptModule, kDisabledByFeatureList, // Pseudo values that should never be seen in reported metrics @@ -69,11 +72,16 @@ class CORE_EXPORT ScriptStreamer final ScriptResource* resource, mojo::ScopedDataPipeConsumerHandle data_pipe, ResponseBodyLoaderClient* response_body_loader_client, - v8::ScriptCompiler::CompileOptions compile_options, scoped_refptr loading_task_runner); ~ScriptStreamer(); void Trace(Visitor*) const; + static std::tuple TakeFrom( + ScriptResource*); + static void RecordStreamingHistogram(ScriptSchedulingType type, + bool can_use_streamer, + ScriptStreamer::NotStreamingReason); + // Returns false if we cannot stream the given encoding. static bool ConvertEncoding(const char* encoding_name, v8::ScriptCompiler::StreamedSource::Encoding*); @@ -201,9 +209,6 @@ class CORE_EXPORT ScriptStreamer final // The reason that streaming is disabled NotStreamingReason suppressed_reason_ = NotStreamingReason::kInvalid; - // What kind of cached data V8 produces during streaming. - v8::ScriptCompiler::CompileOptions compile_options_; - // Keep the script URL string for event tracing. const String script_url_string_; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc index c7cf683f19b..9cf829f3b16 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc @@ -12,6 +12,7 @@ #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" +#include "third_party/blink/public/platform/web_back_forward_cache_loader_helper.h" #include "third_party/blink/public/platform/web_url_loader.h" #include "third_party/blink/public/platform/web_url_loader_mock_factory.h" #include "third_party/blink/public/platform/web_url_request_extra_data.h" @@ -72,7 +73,8 @@ class NoopLoaderFactory final : public ResourceFetcher::LoaderFactory { const ResourceRequest& request, const ResourceLoaderOptions& options, scoped_refptr, - scoped_refptr) override { + scoped_refptr, + WebBackForwardCacheLoaderHelper) override { return std::make_unique(); } std::unique_ptr CreateCodeCacheLoader() override { @@ -130,7 +132,11 @@ class ScriptStreamingTest : public testing::Test { auto* fetcher = MakeGarbageCollected(ResourceFetcherInit( properties->MakeDetachable(), context, freezable_task_runner_, unfreezable_task_runner_, MakeGarbageCollected(), - MakeGarbageCollected())); + MakeGarbageCollected(), + nullptr /* back_forward_cache_loader_helper */)); + + EXPECT_EQ(mojo::CreateDataPipe(nullptr, producer_handle_, consumer_handle_), + MOJO_RESULT_OK); ResourceRequest request(url_); request.SetRequestContext(mojom::blink::RequestContextType::SCRIPT); @@ -149,7 +155,7 @@ class ScriptStreamingTest : public testing::Test { resource_->Loader()->DidReceiveResponse(WrappedResourceResponse(response)); resource_->Loader()->DidStartLoadingResponseBody( - std::move(data_pipe_.consumer_handle)); + std::move(consumer_handle_)); } ScriptSourceCode GetScriptSourceCode() const { @@ -172,7 +178,7 @@ class ScriptStreamingTest : public testing::Test { protected: void AppendData(const char* data) { uint32_t data_len = strlen(data); - MojoResult result = data_pipe_.producer_handle->WriteData( + MojoResult result = producer_handle_->WriteData( data, &data_len, MOJO_WRITE_DATA_FLAG_ALL_OR_NONE); EXPECT_EQ(result, MOJO_RESULT_OK); @@ -195,7 +201,7 @@ class ScriptStreamingTest : public testing::Test { void Finish() { resource_->Loader()->DidFinishLoading(base::TimeTicks(), 0, 0, 0, false); - data_pipe_.producer_handle.reset(); + producer_handle_.reset(); resource_->SetStatus(ResourceStatus::kCached); } @@ -210,7 +216,8 @@ class ScriptStreamingTest : public testing::Test { Persistent resource_client_; Persistent resource_; - mojo::DataPipe data_pipe_; + mojo::ScopedDataPipeProducerHandle producer_handle_; + mojo::ScopedDataPipeConsumerHandle consumer_handle_; std::unique_ptr dummy_page_holder_; }; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h index d1736184493..1eb157a30b0 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h @@ -43,16 +43,15 @@ enum SerializationTag { // transferred MojoHandle. kBlobTag = 'b', // uuid:WebCoreString, type:WebCoreString, size:uint64_t -> // Blob (ref) - kBlobIndexTag = 'i', // index:int32_t -> Blob (ref) - kFileTag = 'f', // file:RawFile -> File (ref) - kFileIndexTag = 'e', // index:int32_t -> File (ref) - kDOMFileSystemTag = 'd', // type:int32_t, name:WebCoreString, - // uuid:WebCoreString -> FileSystem (ref) - kNativeFileSystemFileHandleTag = 'n', // name:WebCoreString, index:uint32_t - // -> NativeFileSystemFileHandle (ref) - kNativeFileSystemDirectoryHandleTag = - 'N', // name:WebCoreString, index:uint32_t -> - // NativeFileSystemDirectoryHandle (ref) + kBlobIndexTag = 'i', // index:int32_t -> Blob (ref) + kFileTag = 'f', // file:RawFile -> File (ref) + kFileIndexTag = 'e', // index:int32_t -> File (ref) + kDOMFileSystemTag = 'd', // type:int32_t, name:WebCoreString, + // uuid:WebCoreString -> FileSystem (ref) + kFileSystemFileHandleTag = 'n', // name:WebCoreString, index:uint32_t + // -> FileSystemFileHandle (ref) + kFileSystemDirectoryHandleTag = 'N', // name:WebCoreString, index:uint32_t -> + // FileSystemDirectoryHandle (ref) kFileListTag = 'l', // length:uint32_t, files:RawFile[length] -> FileList (ref) kFileListIndexTag = diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_color_params.cc b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_color_params.cc index 2eacec18fa6..1732c2b027b 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_color_params.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_color_params.cc @@ -8,47 +8,45 @@ namespace blink { -SerializedColorParams::SerializedColorParams() - : color_space_(SerializedColorSpace::kSRGB), - pixel_format_(SerializedPixelFormat::kRGBA8), - opacity_mode_(SerializedOpacityMode::kNonOpaque), - storage_format_(SerializedImageDataStorageFormat::kUint8Clamped) {} - -SerializedColorParams::SerializedColorParams(CanvasColorParams color_params) { - switch (color_params.ColorSpace()) { +namespace { + +SerializedColorSpace SerializeColorSpace(CanvasColorSpace color_space) { + switch (color_space) { case CanvasColorSpace::kSRGB: - color_space_ = SerializedColorSpace::kSRGB; - break; + return SerializedColorSpace::kSRGB; case CanvasColorSpace::kRec2020: - color_space_ = SerializedColorSpace::kRec2020; - break; + return SerializedColorSpace::kRec2020; case CanvasColorSpace::kP3: - color_space_ = SerializedColorSpace::kP3; - break; + return SerializedColorSpace::kP3; } + NOTREACHED(); + return SerializedColorSpace::kSRGB; +} - switch (color_params.PixelFormat()) { - case CanvasPixelFormat::kRGBA8: - pixel_format_ = SerializedPixelFormat::kRGBA8; - break; - case CanvasPixelFormat::kBGRA8: - pixel_format_ = SerializedPixelFormat::kBGRA8; - break; - case CanvasPixelFormat::kF16: - pixel_format_ = SerializedPixelFormat::kF16; - break; +CanvasColorSpace DeserializeColorSpace( + SerializedColorSpace serialized_color_space) { + switch (serialized_color_space) { + case SerializedColorSpace::kLegacyObsolete: + case SerializedColorSpace::kSRGB: + return CanvasColorSpace::kSRGB; + case SerializedColorSpace::kRec2020: + return CanvasColorSpace::kRec2020; + case SerializedColorSpace::kP3: + return CanvasColorSpace::kP3; } - - opacity_mode_ = SerializedOpacityMode::kNonOpaque; - if (color_params.GetOpacityMode() == blink::kOpaque) - opacity_mode_ = SerializedOpacityMode::kOpaque; - storage_format_ = SerializedImageDataStorageFormat::kUint8Clamped; + NOTREACHED(); + return CanvasColorSpace::kSRGB; } -SerializedColorParams::SerializedColorParams( - CanvasColorParams color_params, +} // namespace + +//////////////////////////////////////////////////////////////////////////////// +// SerializedImageDataSettings + +SerializedImageDataSettings::SerializedImageDataSettings( + CanvasColorSpace color_space, ImageDataStorageFormat storage_format) - : SerializedColorParams(color_params) { + : color_space_(SerializeColorSpace(color_space)) { switch (storage_format) { case kUint8ClampedArrayStorageFormat: storage_format_ = SerializedImageDataStorageFormat::kUint8Clamped; @@ -62,64 +60,16 @@ SerializedColorParams::SerializedColorParams( } } -SerializedColorParams::SerializedColorParams( +SerializedImageDataSettings::SerializedImageDataSettings( SerializedColorSpace color_space, - SerializedPixelFormat pixel_format, - SerializedOpacityMode opacity_mode, - SerializedImageDataStorageFormat storage_format) { - SetSerializedColorSpace(color_space); - SetSerializedPixelFormat(pixel_format); - SetSerializedOpacityMode(opacity_mode); - SetSerializedImageDataStorageFormat(storage_format); -} + SerializedImageDataStorageFormat storage_format) + : color_space_(color_space), storage_format_(storage_format) {} -CanvasColorParams SerializedColorParams::GetCanvasColorParams() const { - CanvasColorSpace color_space = CanvasColorSpace::kSRGB; - switch (color_space_) { - case SerializedColorSpace::kLegacyObsolete: - case SerializedColorSpace::kSRGB: - color_space = CanvasColorSpace::kSRGB; - break; - case SerializedColorSpace::kRec2020: - color_space = CanvasColorSpace::kRec2020; - break; - case SerializedColorSpace::kP3: - color_space = CanvasColorSpace::kP3; - break; - } - - CanvasPixelFormat pixel_format = CanvasPixelFormat::kRGBA8; - switch (pixel_format_) { - case SerializedPixelFormat::kNative8_LegacyObsolete: -#if defined(OS_ANDROID) - pixel_format = CanvasPixelFormat::kRGBA8; -#else - pixel_format = CanvasPixelFormat::kBGRA8; -#endif - break; - case SerializedPixelFormat::kRGBA8: - pixel_format = CanvasPixelFormat::kRGBA8; - break; - case SerializedPixelFormat::kBGRA8: - pixel_format = CanvasPixelFormat::kBGRA8; - break; - case SerializedPixelFormat::kF16: - pixel_format = CanvasPixelFormat::kF16; - break; - } - - blink::OpacityMode opacity_mode = blink::kNonOpaque; - if (opacity_mode_ == SerializedOpacityMode::kOpaque) - opacity_mode = blink::kOpaque; - - return CanvasColorParams(color_space, pixel_format, opacity_mode); -} - -CanvasColorSpace SerializedColorParams::GetColorSpace() const { - return GetCanvasColorParams().ColorSpace(); +CanvasColorSpace SerializedImageDataSettings::GetColorSpace() const { + return DeserializeColorSpace(color_space_); } -ImageDataStorageFormat SerializedColorParams::GetStorageFormat() const { +ImageDataStorageFormat SerializedImageDataSettings::GetStorageFormat() const { switch (storage_format_) { case SerializedImageDataStorageFormat::kUint8Clamped: return kUint8ClampedArrayStorageFormat; @@ -132,41 +82,125 @@ ImageDataStorageFormat SerializedColorParams::GetStorageFormat() const { return kUint8ClampedArrayStorageFormat; } -void SerializedColorParams::SetSerializedColorSpace( - SerializedColorSpace color_space) { - color_space_ = color_space; +ImageDataSettings* SerializedImageDataSettings::GetImageDataSettings() const { + ImageDataSettings* settings = ImageDataSettings::Create(); + switch (DeserializeColorSpace(color_space_)) { + case CanvasColorSpace::kSRGB: + settings->setColorSpace(kSRGBCanvasColorSpaceName); + break; + case CanvasColorSpace::kRec2020: + settings->setColorSpace(kRec2020CanvasColorSpaceName); + break; + case CanvasColorSpace::kP3: + settings->setColorSpace(kP3CanvasColorSpaceName); + break; + } + switch (storage_format_) { + case SerializedImageDataStorageFormat::kUint8Clamped: + settings->setStorageFormat(kUint8ClampedArrayStorageFormatName); + break; + case SerializedImageDataStorageFormat::kUint16: + settings->setStorageFormat(kUint16ArrayStorageFormatName); + break; + case SerializedImageDataStorageFormat::kFloat32: + settings->setStorageFormat(kFloat32ArrayStorageFormatName); + break; + } + return settings; } -void SerializedColorParams::SetSerializedPixelFormat( - SerializedPixelFormat pixel_format) { - pixel_format_ = pixel_format; -} +//////////////////////////////////////////////////////////////////////////////// +// SerializedImageBitmapSettings -void SerializedColorParams::SetSerializedOpacityMode( - SerializedOpacityMode opacity_mode) { - opacity_mode_ = opacity_mode; -} +SerializedImageBitmapSettings::SerializedImageBitmapSettings() = default; -void SerializedColorParams::SetSerializedImageDataStorageFormat( - SerializedImageDataStorageFormat storage_format) { - storage_format_ = storage_format; -} +SerializedImageBitmapSettings::SerializedImageBitmapSettings(SkImageInfo info) { + color_space_ = + SerializeColorSpace(CanvasColorSpaceFromSkColorSpace(info.colorSpace())); -SerializedColorSpace SerializedColorParams::GetSerializedColorSpace() const { - return color_space_; -} + switch (info.colorType()) { + default: + case kRGBA_8888_SkColorType: + pixel_format_ = SerializedPixelFormat::kRGBA8; + break; + case kBGRA_8888_SkColorType: + pixel_format_ = SerializedPixelFormat::kBGRA8; + break; + case kRGB_888x_SkColorType: + pixel_format_ = SerializedPixelFormat::kRGBX8; + break; + case kRGBA_F16_SkColorType: + pixel_format_ = SerializedPixelFormat::kF16; + break; + } -SerializedPixelFormat SerializedColorParams::GetSerializedPixelFormat() const { - return pixel_format_; + switch (info.alphaType()) { + case kUnknown_SkAlphaType: + case kPremul_SkAlphaType: + opacity_mode_ = SerializedOpacityMode::kNonOpaque; + is_premultiplied_ = true; + break; + case kUnpremul_SkAlphaType: + opacity_mode_ = SerializedOpacityMode::kNonOpaque; + is_premultiplied_ = false; + break; + case kOpaque_SkAlphaType: + opacity_mode_ = SerializedOpacityMode::kOpaque; + is_premultiplied_ = true; + break; + } } -SerializedOpacityMode SerializedColorParams::GetSerializedOpacityMode() const { - return opacity_mode_; -} +SerializedImageBitmapSettings::SerializedImageBitmapSettings( + SerializedColorSpace color_space, + SerializedPixelFormat pixel_format, + SerializedOpacityMode opacity_mode, + uint32_t is_premultiplied) + : color_space_(color_space), + pixel_format_(pixel_format), + opacity_mode_(opacity_mode), + is_premultiplied_(is_premultiplied) {} + +SkImageInfo SerializedImageBitmapSettings::GetSkImageInfo( + uint32_t width, + uint32_t height) const { + sk_sp sk_color_space = + CanvasColorSpaceToSkColorSpace(DeserializeColorSpace(color_space_)); + + SkColorType sk_color_type = kRGBA_8888_SkColorType; + switch (pixel_format_) { + case SerializedPixelFormat::kNative8_LegacyObsolete: + sk_color_type = kN32_SkColorType; + break; + case SerializedPixelFormat::kRGBA8: + sk_color_type = kRGBA_8888_SkColorType; + break; + case SerializedPixelFormat::kBGRA8: + sk_color_type = kBGRA_8888_SkColorType; + break; + case SerializedPixelFormat::kRGBX8: + sk_color_type = kRGB_888x_SkColorType; + break; + case SerializedPixelFormat::kF16: + sk_color_type = kRGBA_F16_SkColorType; + break; + } + + SkAlphaType sk_alpha_type = kPremul_SkAlphaType; + if (opacity_mode_ == SerializedOpacityMode::kOpaque) { + sk_alpha_type = kOpaque_SkAlphaType; + } else if (is_premultiplied_) { + sk_alpha_type = kPremul_SkAlphaType; + } else { + sk_alpha_type = kUnpremul_SkAlphaType; + } + + blink::OpacityMode opacity_mode = blink::kNonOpaque; + if (opacity_mode_ == SerializedOpacityMode::kOpaque) + opacity_mode = blink::kOpaque; -SerializedImageDataStorageFormat -SerializedColorParams::GetSerializedImageDataStorageFormat() const { - return storage_format_; + return SkImageInfo::Make(width, height, sk_color_type, sk_alpha_type, + std::move(sk_color_space)); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_color_params.h b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_color_params.h index 512df80ae8e..0d87169a169 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_color_params.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_color_params.h @@ -53,7 +53,8 @@ enum class SerializedPixelFormat : uint32_t { kF16 = 1, kRGBA8 = 2, kBGRA8 = 3, - kLast = kBGRA8, + kRGBX8 = 4, + kLast = kRGBX8, }; // This enumeration specifies the values used to serialize @@ -71,35 +72,52 @@ enum class SerializedOpacityMode : uint32_t { kLast = kOpaque, }; -class SerializedColorParams { +class SerializedImageDataSettings { public: - SerializedColorParams(); - SerializedColorParams(CanvasColorParams); - SerializedColorParams(CanvasColorParams, ImageDataStorageFormat); - SerializedColorParams(SerializedColorSpace, - SerializedPixelFormat, - SerializedOpacityMode, - SerializedImageDataStorageFormat); - - CanvasColorParams GetCanvasColorParams() const; + SerializedImageDataSettings(CanvasColorSpace, ImageDataStorageFormat); + SerializedImageDataSettings(SerializedColorSpace, + SerializedImageDataStorageFormat); + CanvasColorSpace GetColorSpace() const; ImageDataStorageFormat GetStorageFormat() const; + ImageDataSettings* GetImageDataSettings() const; - void SetSerializedColorSpace(SerializedColorSpace); - void SetSerializedPixelFormat(SerializedPixelFormat); - void SetSerializedOpacityMode(SerializedOpacityMode); - void SetSerializedImageDataStorageFormat(SerializedImageDataStorageFormat); + SerializedColorSpace GetSerializedColorSpace() const { return color_space_; } + SerializedImageDataStorageFormat GetSerializedImageDataStorageFormat() const { + return storage_format_; + } - SerializedColorSpace GetSerializedColorSpace() const; - SerializedPixelFormat GetSerializedPixelFormat() const; - SerializedImageDataStorageFormat GetSerializedImageDataStorageFormat() const; - SerializedOpacityMode GetSerializedOpacityMode() const; + private: + SerializedColorSpace color_space_ = SerializedColorSpace::kSRGB; + SerializedImageDataStorageFormat storage_format_ = + SerializedImageDataStorageFormat::kUint8Clamped; +}; + +class SerializedImageBitmapSettings { + public: + SerializedImageBitmapSettings(); + explicit SerializedImageBitmapSettings(SkImageInfo); + SerializedImageBitmapSettings(SerializedColorSpace, + SerializedPixelFormat, + SerializedOpacityMode, + uint32_t is_premultiplied); + + SkImageInfo GetSkImageInfo(uint32_t width, uint32_t height) const; + + SerializedColorSpace GetSerializedColorSpace() const { return color_space_; } + SerializedPixelFormat GetSerializedPixelFormat() const { + return pixel_format_; + } + SerializedOpacityMode GetSerializedOpacityMode() const { + return opacity_mode_; + } + uint32_t IsPremultiplied() const { return is_premultiplied_; } private: - SerializedColorSpace color_space_; - SerializedPixelFormat pixel_format_; - SerializedOpacityMode opacity_mode_; - SerializedImageDataStorageFormat storage_format_; + SerializedColorSpace color_space_ = SerializedColorSpace::kSRGB; + SerializedPixelFormat pixel_format_ = SerializedPixelFormat::kRGBA8; + SerializedOpacityMode opacity_mode_ = SerializedOpacityMode::kNonOpaque; + bool is_premultiplied_ = true; }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.cc b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.cc index dea409f2322..766e3328a1b 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.cc @@ -409,6 +409,9 @@ void SerializedScriptValue::TransferReadableStream( readable_stream->Serialize(script_state, local_port, exception_state); if (exception_state.HadException()) return; + // The last element is added by the above `AddStreamChannel()` call. + streams_.back().readable_optimizer = + readable_stream->TakeTransferringOptimizer(); } void SerializedScriptValue::TransferWritableStreams( @@ -433,6 +436,9 @@ void SerializedScriptValue::TransferWritableStream( writable_stream->Serialize(script_state, local_port, exception_state); if (exception_state.HadException()) return; + // The last element is added by the above `AddStreamChannel()` call. + streams_.back().writable_optimizer = + writable_stream->TakeTransferringOptimizer(); } void SerializedScriptValue::TransferTransformStreams( @@ -790,7 +796,7 @@ static_assert(kSerializedScriptValueVersion == "Update WebSerializedScriptValueVersion.h."); bool SerializedScriptValue::IsOriginCheckRequired() const { - return native_file_system_tokens_.size() > 0; + return file_system_access_tokens_.size() > 0; } } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h index c057291fab8..7898c521db4 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h @@ -38,7 +38,7 @@ #include "mojo/public/cpp/bindings/pending_remote.h" #include "third_party/blink/public/common/messaging/message_port_channel.h" #include "third_party/blink/public/common/messaging/message_port_descriptor.h" -#include "third_party/blink/public/mojom/file_system_access/native_file_system_transfer_token.mojom-blink-forward.h" +#include "third_party/blink/public/mojom/file_system_access/file_system_access_transfer_token.mojom-blink-forward.h" #include "third_party/blink/renderer/bindings/core/v8/native_value_traits.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/transferables.h" #include "third_party/blink/renderer/core/core_export.h" @@ -46,6 +46,7 @@ #include "third_party/blink/renderer/core/streams/readable_stream_transferring_optimizer.h" #include "third_party/blink/renderer/core/streams/writable_stream_transferring_optimizer.h" #include "third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.h" +#include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator/partitions.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" @@ -102,8 +103,8 @@ class CORE_EXPORT SerializedScriptValue using TransferredWasmModulesArray = WTF::Vector; using MessagePortChannelArray = Vector; using StreamArray = Vector; - using NativeFileSystemTokensArray = - Vector>; + using FileSystemAccessTokensArray = + Vector>; // Increment this for each incompatible change to the wire format. // Version 2: Added StringUCharTag for UChar v8 strings. @@ -271,12 +272,19 @@ class CORE_EXPORT SerializedScriptValue size_t DataLengthInBytes() const { return data_buffer_size_; } TransferredWasmModulesArray& WasmModules() { return wasm_modules_; } + + const SecurityOrigin* origin() { return origin_.get(); } + + void set_origin(const SecurityOrigin* origin) { + origin_ = origin->IsolatedCopy(); + } + SharedArrayBufferContentsArray& SharedArrayBuffersContents() { return shared_array_buffers_contents_; } BlobDataHandleMap& BlobDataHandles() { return blob_data_handles_; } - NativeFileSystemTokensArray& NativeFileSystemTokens() { - return native_file_system_tokens_; + FileSystemAccessTokensArray& FileSystemAccessTokens() { + return file_system_access_tokens_; } MojoScopedHandleArray& MojoHandles() { return mojo_handles_; } ArrayBufferContentsArray& GetArrayBufferContentsArray() { @@ -393,10 +401,14 @@ class CORE_EXPORT SerializedScriptValue // These do not have one-use transferred contents, like the above. TransferredWasmModulesArray wasm_modules_; + // To count how often WebAssembly modules get transferred cross-origin, we + // allow to store the |SecurityOrigin| in the |V8SerializedScriptValue|. The + // |SecurityOrigin| has to be set explicitly with |set_origin()|. + scoped_refptr origin_; BlobDataHandleMap blob_data_handles_; MojoScopedHandleArray mojo_handles_; SharedArrayBufferContentsArray shared_array_buffers_contents_; - NativeFileSystemTokensArray native_file_system_tokens_; + FileSystemAccessTokensArray file_system_access_tokens_; HashMap> attachments_; bool has_registered_external_allocation_; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.cc b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.cc index 697b1fe0ce9..e4f056150e2 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.cc @@ -31,6 +31,7 @@ #include "third_party/blink/renderer/core/mojo/mojo_handle.h" #include "third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h" #include "third_party/blink/renderer/core/streams/readable_stream.h" +#include "third_party/blink/renderer/core/streams/readable_stream_transferring_optimizer.h" #include "third_party/blink/renderer/core/streams/transform_stream.h" #include "third_party/blink/renderer/core/streams/writable_stream.h" #include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h" @@ -95,6 +96,14 @@ size_t ReadVersionEnvelope(SerializedScriptValue* serialized_script_value, return i; } +MessagePort* CreateEntangledPort(ScriptState* script_state, + const MessagePortChannel& channel) { + MessagePort* const port = + MakeGarbageCollected(*ExecutionContext::From(script_state)); + port->Entangle(channel); + return port; +} + } // namespace V8ScriptValueDeserializer::V8ScriptValueDeserializer( @@ -183,12 +192,7 @@ void V8ScriptValueDeserializer::Transfer() { // TODO(ricea): Make ExtendableMessageEvent store an // UnpackedSerializedScriptValue like MessageEvent does, and then this // special case won't be necessary. - Vector channels; - for (auto& stream : serialized_script_value_->GetStreams()) { - channels.push_back(stream.channel); - } - transferred_stream_ports_ = MessagePort::EntanglePorts( - *ExecutionContext::From(script_state_), channels); + streams_ = std::move(serialized_script_value_->GetStreams()); } // There's nothing else to transfer if the deserializer was not given an @@ -354,14 +358,12 @@ ScriptWrappable* V8ScriptValueDeserializer::ReadDOMObject( if (!ReadUint32(&width) || !ReadUint32(&height) || !ReadUint32(&byte_length) || !ReadRawBytes(byte_length, &pixels)) return nullptr; - CanvasColorParams color_params = - SerializedColorParams(canvas_color_space, canvas_pixel_format, - canvas_opacity_mode, - SerializedImageDataStorageFormat::kUint8Clamped) - .GetCanvasColorParams(); - base::CheckedNumeric computed_byte_length = width; - computed_byte_length *= height; - computed_byte_length *= color_params.BytesPerPixel(); + SkImageInfo info = + SerializedImageBitmapSettings(canvas_color_space, canvas_pixel_format, + canvas_opacity_mode, is_premultiplied) + .GetSkImageInfo(width, height); + base::CheckedNumeric computed_byte_length = + info.computeMinByteSize(); if (!computed_byte_length.IsValid() || computed_byte_length.ValueOrDie() != byte_length) return nullptr; @@ -370,8 +372,8 @@ ScriptWrappable* V8ScriptValueDeserializer::ReadDOMObject( // been deprecated. return nullptr; } - return MakeGarbageCollected( - pixels, width, height, is_premultiplied, origin_clean, color_params); + SkPixmap pixmap(info, pixels, info.minRowBytes()); + return MakeGarbageCollected(pixmap, origin_clean); } case kImageBitmapTransferTag: { uint32_t index = 0; @@ -426,24 +428,23 @@ ScriptWrappable* V8ScriptValueDeserializer::ReadDOMObject( return nullptr; } - SerializedColorParams color_params( - canvas_color_space, SerializedPixelFormat::kNative8_LegacyObsolete, - SerializedOpacityMode::kNonOpaque, image_data_storage_format); - ImageDataStorageFormat storage_format = color_params.GetStorageFormat(); + SerializedImageDataSettings settings(canvas_color_space, + image_data_storage_format); base::CheckedNumeric computed_byte_length = width; computed_byte_length *= height; computed_byte_length *= - ImageData::StorageFormatBytesPerPixel(storage_format); + ImageData::StorageFormatBytesPerPixel(settings.GetStorageFormat()); if (!computed_byte_length.IsValid() || computed_byte_length.ValueOrDie() != byte_length) return nullptr; - ImageData* image_data = ImageData::Create( - IntSize(width, height), color_params.GetColorSpace(), storage_format); + ImageData* image_data = ImageData::ValidateAndCreate( + width, height, base::nullopt, settings.GetImageDataSettings(), + exception_state); if (!image_data) return nullptr; - DOMArrayBufferBase* pixel_buffer = image_data->BufferBase(); - DCHECK_EQ(pixel_buffer->ByteLength(), byte_length); - memcpy(pixel_buffer->Data(), pixels, byte_length); + SkPixmap image_data_pixmap = image_data->GetSkPixmap(); + DCHECK_EQ(image_data_pixmap.computeByteSize(), byte_length); + memcpy(image_data_pixmap.writable_addr(), pixels, byte_length); return image_data; } case kDOMPointTag: { @@ -558,52 +559,56 @@ ScriptWrappable* V8ScriptValueDeserializer::ReadDOMObject( if (!TransferableStreamsEnabled()) return nullptr; uint32_t index = 0; - if (!ReadUint32(&index) || !transferred_stream_ports_ || - index >= transferred_stream_ports_->size()) { + if (!ReadUint32(&index) || index >= streams_.size()) { return nullptr; } return ReadableStream::Deserialize( - script_state_, (*transferred_stream_ports_)[index].Get(), - exception_state); + script_state_, + CreateEntangledPort(GetScriptState(), streams_[index].channel), + std::move(streams_[index].readable_optimizer), exception_state); } case kWritableStreamTransferTag: { if (!TransferableStreamsEnabled()) return nullptr; uint32_t index = 0; - if (!ReadUint32(&index) || !transferred_stream_ports_ || - index >= transferred_stream_ports_->size()) { + if (!ReadUint32(&index) || index >= streams_.size()) { return nullptr; } return WritableStream::Deserialize( - script_state_, (*transferred_stream_ports_)[index].Get(), - exception_state); + script_state_, + CreateEntangledPort(GetScriptState(), streams_[index].channel), + std::move(streams_[index].writable_optimizer), exception_state); } case kTransformStreamTransferTag: { if (!TransferableStreamsEnabled()) return nullptr; uint32_t index = 0; - if (!ReadUint32(&index) || !transferred_stream_ports_ || + if (!ReadUint32(&index) || index == std::numeric_limits::max() || - index + 1 >= transferred_stream_ports_->size()) { + index + 1 >= streams_.size()) { return nullptr; } + MessagePort* const port_for_readable = + CreateEntangledPort(GetScriptState(), streams_[index].channel); + MessagePort* const port_for_writable = + CreateEntangledPort(GetScriptState(), streams_[index + 1].channel); // https://streams.spec.whatwg.org/#ts-transfer // 1. Let readableRecord be ! // StructuredDeserializeWithTransfer(dataHolder.[[readable]], the // current Realm). - ReadableStream* readable = ReadableStream::Deserialize( - script_state_, (*transferred_stream_ports_)[index].Get(), - exception_state); + ReadableStream* readable = + ReadableStream::Deserialize(script_state_, port_for_readable, + /*optimizer=*/nullptr, exception_state); if (!readable) return nullptr; // 2. Let writableRecord be ! // StructuredDeserializeWithTransfer(dataHolder.[[writable]], the // current Realm). - WritableStream* writable = WritableStream::Deserialize( - script_state_, (*transferred_stream_ports_)[index + 1].Get(), - exception_state); + WritableStream* writable = + WritableStream::Deserialize(script_state_, port_for_writable, + /*optimizer=*/nullptr, exception_state); if (!writable) return nullptr; @@ -746,6 +751,14 @@ v8::MaybeLocal V8ScriptValueDeserializer::GetWasmModuleFromId(v8::Isolate* isolate, uint32_t id) { if (id < serialized_script_value_->WasmModules().size()) { + ExecutionContext* execution_context = ExecutionContext::From(script_state_); + DCHECK(serialized_script_value_->origin()); + UseCounter::Count(execution_context, WebFeature::kWasmModuleSharing); + if (!serialized_script_value_->origin()->IsSameOriginWith( + execution_context->GetSecurityOrigin())) { + UseCounter::Count(execution_context, + WebFeature::kCrossOriginWasmModuleSharing); + } return v8::WasmModuleObject::FromCompiledModule( isolate, serialized_script_value_->WasmModules()[id]); } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.h b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.h index cf8af825cb8..b8e3309eda8 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.h @@ -119,7 +119,7 @@ class CORE_EXPORT V8ScriptValueDeserializer // Message ports which were transferred in. const MessagePortArray* transferred_message_ports_ = nullptr; - MessagePortArray* transferred_stream_ports_ = nullptr; + Vector streams_; // Blob info for blobs stored by index. const WebBlobInfoArray* blob_info_array_ = nullptr; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc index 25d53ad41b5..517d4f5f8ec 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.cc @@ -118,7 +118,7 @@ scoped_refptr V8ScriptValueSerializer::Serialize( if (shared_array_buffers_.size()) { auto* execution_context = ExecutionContext::From(script_state_); - if (!execution_context->SharedArrayBufferTransferAllowed()) { + if (!execution_context->CheckSharedArrayBufferTransferAllowedAndReport()) { exception_state.ThrowDOMException( DOMExceptionCode::kDataCloneError, "SharedArrayBuffer transfer requires self.crossOriginIsolated."); @@ -304,7 +304,8 @@ bool V8ScriptValueSerializer::WriteDOMObject(ScriptWrappable* wrappable, return false; } WriteTag(kImageBitmapTag); - SerializedColorParams color_params(image_bitmap->GetCanvasColorParams()); + SkImageInfo info = image_bitmap->GetBitmapSkImageInfo(); + SerializedImageBitmapSettings color_params(info); WriteUint32Enum(ImageSerializationTag::kCanvasColorSpaceTag); WriteUint32Enum(color_params.GetSerializedColorSpace()); WriteUint32Enum(ImageSerializationTag::kCanvasPixelFormatTag); @@ -314,11 +315,11 @@ bool V8ScriptValueSerializer::WriteDOMObject(ScriptWrappable* wrappable, WriteUint32Enum(ImageSerializationTag::kOriginCleanTag); WriteUint32(image_bitmap->OriginClean()); WriteUint32Enum(ImageSerializationTag::kIsPremultipliedTag); - WriteUint32(image_bitmap->IsPremultiplied()); + WriteUint32(color_params.IsPremultiplied()); WriteUint32Enum(ImageSerializationTag::kEndTag); WriteUint32(image_bitmap->width()); WriteUint32(image_bitmap->height()); - Vector pixels = image_bitmap->CopyBitmapData(); + Vector pixels = image_bitmap->CopyBitmapData(info, false); // Check if we succeeded to copy the BitmapData. if (image_bitmap->width() != 0 && image_bitmap->height() != 0 && pixels.size() == 0) { @@ -334,19 +335,24 @@ bool V8ScriptValueSerializer::WriteDOMObject(ScriptWrappable* wrappable, if (wrapper_type_info == V8ImageData::GetWrapperTypeInfo()) { ImageData* image_data = wrappable->ToImpl(); WriteTag(kImageDataTag); - SerializedColorParams color_params(image_data->GetCanvasColorParams(), - image_data->GetImageDataStorageFormat()); + SerializedImageDataSettings settings( + image_data->GetCanvasColorSpace(), + image_data->GetImageDataStorageFormat()); WriteUint32Enum(ImageSerializationTag::kCanvasColorSpaceTag); - WriteUint32Enum(color_params.GetSerializedColorSpace()); + WriteUint32Enum(settings.GetSerializedColorSpace()); WriteUint32Enum(ImageSerializationTag::kImageDataStorageFormatTag); - WriteUint32Enum(color_params.GetSerializedImageDataStorageFormat()); + WriteUint32Enum(settings.GetSerializedImageDataStorageFormat()); WriteUint32Enum(ImageSerializationTag::kEndTag); WriteUint32(image_data->width()); WriteUint32(image_data->height()); - DOMArrayBufferBase* pixel_buffer = image_data->BufferBase(); - size_t pixel_buffer_length = pixel_buffer->ByteLength(); - WriteUint64(base::strict_cast(pixel_buffer_length)); - WriteRawBytes(pixel_buffer->Data(), pixel_buffer_length); + if (image_data->IsBufferBaseDetached()) { + WriteUint64(0u); + } else { + SkPixmap image_data_pixmap = image_data->GetSkPixmap(); + size_t pixel_buffer_length = image_data_pixmap.computeByteSize(); + WriteUint64(base::strict_cast(pixel_buffer_length)); + WriteRawBytes(image_data_pixmap.addr(), pixel_buffer_length); + } return true; } if (wrapper_type_info == V8DOMPoint::GetWrapperTypeInfo()) { @@ -762,6 +768,13 @@ v8::Maybe V8ScriptValueSerializer::GetWasmModuleTransferId( // simple and should perform sufficiently well under these expectations. serialized_script_value_->WasmModules().push_back( module->GetCompiledModule()); + if (!serialized_script_value_->origin()) { + // Store the |SecurityOrigin| of the current |ExecutionContext| to count + // during deserialization if the WebAssembly module got transferred + // cross-origin. + serialized_script_value_->set_origin( + ExecutionContext::From(script_state_)->GetSecurityOrigin()); + } uint32_t size = static_cast(serialized_script_value_->WasmModules().size()); DCHECK_GE(size, 1u); @@ -777,7 +790,7 @@ v8::Maybe V8ScriptValueSerializer::GetWasmModuleTransferId( void* V8ScriptValueSerializer::ReallocateBufferMemory(void* old_buffer, size_t size, size_t* actual_size) { - *actual_size = WTF::Partitions::BufferActualSize(size); + *actual_size = WTF::Partitions::BufferPotentialCapacity(size); return WTF::Partitions::BufferTryRealloc(old_buffer, *actual_size, "SerializedScriptValue buffer"); } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc index d7195549a41..f8e1a441fa8 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer_test.cc @@ -759,8 +759,11 @@ TEST(V8ScriptValueSerializerTest, DecodeDOMMatrixReadOnly) { TEST(V8ScriptValueSerializerTest, RoundTripImageData) { // ImageData objects should serialize and deserialize correctly. V8TestingScope scope; - ImageData* image_data = ImageData::Create(2, 1, ASSERT_NO_EXCEPTION); - image_data->data().GetAsUint8ClampedArray()->Data()[0] = 200; + ImageData* image_data = ImageData::ValidateAndCreate( + 2, 1, base::nullopt, nullptr, ASSERT_NO_EXCEPTION); + SkPixmap pm = image_data->GetSkPixmap(); + pm.writable_addr32(0, 0)[0] = 200u; + pm.writable_addr32(1, 0)[0] = 100u; v8::Local wrapper = ToV8(image_data, scope.GetContext()->Global(), scope.GetIsolate()); v8::Local result = RoundTrip(wrapper, scope); @@ -768,21 +771,40 @@ TEST(V8ScriptValueSerializerTest, RoundTripImageData) { ImageData* new_image_data = V8ImageData::ToImpl(result.As()); EXPECT_NE(image_data, new_image_data); EXPECT_EQ(image_data->Size(), new_image_data->Size()); - EXPECT_EQ(image_data->data().GetAsUint8ClampedArray()->length(), - new_image_data->data().GetAsUint8ClampedArray()->length()); - EXPECT_EQ(200, new_image_data->data().GetAsUint8ClampedArray()->Data()[0]); + SkPixmap new_pm = new_image_data->GetSkPixmap(); + EXPECT_EQ(200u, new_pm.addr32(0, 0)[0]); + EXPECT_EQ(100u, new_pm.addr32(1, 0)[0]); +} + +TEST(V8ScriptValueSerializerTest, RoundTripDetachedImageData) { + // If an ImageData is detached, it can be serialized, but will fail when being + // deserialized. + V8TestingScope scope; + ImageData* image_data = ImageData::ValidateAndCreate( + 2, 1, base::nullopt, nullptr, ASSERT_NO_EXCEPTION); + SkPixmap pm = image_data->GetSkPixmap(); + pm.writable_addr32(0, 0)[0] = 200u; + image_data->data().GetAsUint8ClampedArray()->BufferBase()->Detach(); + + v8::Local wrapper = + ToV8(image_data, scope.GetContext()->Global(), scope.GetIsolate()); + v8::Local result = RoundTrip(wrapper, scope); + EXPECT_FALSE(V8ImageData::HasInstance(result, scope.GetIsolate())); } TEST(V8ScriptValueSerializerTest, RoundTripImageDataWithColorSpaceInfo) { // ImageData objects with color space information should serialize and // deserialize correctly. V8TestingScope scope; - ImageDataColorSettings* color_settings = ImageDataColorSettings::Create(); - color_settings->setColorSpace("p3"); - color_settings->setStorageFormat("float32"); - ImageData* image_data = - ImageData::CreateImageData(2, 1, color_settings, ASSERT_NO_EXCEPTION); - static_cast(image_data->BufferBase()->Data())[0] = 200; + ImageDataSettings* image_data_settings = ImageDataSettings::Create(); + image_data_settings->setColorSpace("display-p3"); + image_data_settings->setStorageFormat("float32"); + ImageData* image_data = ImageData::ValidateAndCreate( + 2, 1, base::nullopt, image_data_settings, ASSERT_NO_EXCEPTION); + SkPixmap pm = image_data->GetSkPixmap(); + EXPECT_EQ(kRGBA_F32_SkColorType, pm.info().colorType()); + static_cast(pm.writable_addr(0, 0))[0] = 200.f; + v8::Local wrapper = ToV8(image_data, scope.GetContext()->Global(), scope.GetIsolate()); v8::Local result = RoundTrip(wrapper, scope); @@ -790,14 +812,12 @@ TEST(V8ScriptValueSerializerTest, RoundTripImageDataWithColorSpaceInfo) { ImageData* new_image_data = V8ImageData::ToImpl(result.As()); EXPECT_NE(image_data, new_image_data); EXPECT_EQ(image_data->Size(), new_image_data->Size()); - ImageDataColorSettings* new_color_settings = - new_image_data->getColorSettings(); - EXPECT_EQ("p3", new_color_settings->colorSpace()); - EXPECT_EQ("float32", new_color_settings->storageFormat()); - EXPECT_EQ(image_data->BufferBase()->ByteLength(), - new_image_data->BufferBase()->ByteLength()); - EXPECT_EQ(200, static_cast( - new_image_data->BufferBase()->Data())[0]); + ImageDataSettings* new_image_data_settings = new_image_data->getSettings(); + EXPECT_EQ("display-p3", new_image_data_settings->colorSpace()); + EXPECT_EQ("float32", new_image_data_settings->storageFormat()); + SkPixmap new_pm = new_image_data->GetSkPixmap(); + EXPECT_EQ(kRGBA_F32_SkColorType, new_pm.info().colorType()); + EXPECT_EQ(200.f, reinterpret_cast(new_pm.addr(0, 0))[0]); } TEST(V8ScriptValueSerializerTest, DecodeImageDataV9) { @@ -814,8 +834,9 @@ TEST(V8ScriptValueSerializerTest, DecodeImageDataV9) { ASSERT_TRUE(V8ImageData::HasInstance(result, scope.GetIsolate())); ImageData* new_image_data = V8ImageData::ToImpl(result.As()); EXPECT_EQ(IntSize(2, 1), new_image_data->Size()); - EXPECT_EQ(8u, new_image_data->data().GetAsUint8ClampedArray()->length()); - EXPECT_EQ(200, new_image_data->data().GetAsUint8ClampedArray()->Data()[0]); + SkPixmap new_pm = new_image_data->GetSkPixmap(); + EXPECT_EQ(8u, new_pm.computeByteSize()); + EXPECT_EQ(200u, new_pm.addr32()[0]); } TEST(V8ScriptValueSerializerTest, DecodeImageDataV16) { @@ -829,8 +850,10 @@ TEST(V8ScriptValueSerializerTest, DecodeImageDataV16) { ASSERT_TRUE(V8ImageData::HasInstance(result, scope.GetIsolate())); ImageData* new_image_data = V8ImageData::ToImpl(result.As()); EXPECT_EQ(IntSize(2, 1), new_image_data->Size()); - EXPECT_EQ(8u, new_image_data->data().GetAsUint8ClampedArray()->length()); - EXPECT_EQ(200, new_image_data->data().GetAsUint8ClampedArray()->Data()[0]); + SkPixmap new_pm = new_image_data->GetSkPixmap(); + EXPECT_EQ(kRGBA_8888_SkColorType, new_pm.info().colorType()); + EXPECT_EQ(8u, new_pm.computeByteSize()); + EXPECT_EQ(200u, new_pm.addr32()[0]); } TEST(V8ScriptValueSerializerTest, DecodeImageDataV18) { @@ -846,13 +869,12 @@ TEST(V8ScriptValueSerializerTest, DecodeImageDataV18) { ASSERT_TRUE(V8ImageData::HasInstance(result, scope.GetIsolate())); ImageData* new_image_data = V8ImageData::ToImpl(result.As()); EXPECT_EQ(IntSize(2, 1), new_image_data->Size()); - ImageDataColorSettings* new_color_settings = - new_image_data->getColorSettings(); - EXPECT_EQ("p3", new_color_settings->colorSpace()); - EXPECT_EQ("float32", new_color_settings->storageFormat()); - EXPECT_EQ(32u, new_image_data->BufferBase()->ByteLength()); - EXPECT_EQ(200, static_cast( - new_image_data->BufferBase()->Data())[0]); + ImageDataSettings* new_image_data_settings = new_image_data->getSettings(); + EXPECT_EQ("display-p3", new_image_data_settings->colorSpace()); + EXPECT_EQ("float32", new_image_data_settings->storageFormat()); + SkPixmap new_pm = new_image_data->GetSkPixmap(); + EXPECT_EQ(kRGBA_F32_SkColorType, new_pm.info().colorType()); + EXPECT_EQ(200u, static_cast(new_pm.addr(0, 0))[0]); } TEST(V8ScriptValueSerializerTest, InvalidImageDataDecodeV18) { @@ -1037,12 +1059,12 @@ TEST(V8ScriptValueSerializerTest, RoundTripImageBitmap) { } TEST(V8ScriptValueSerializerTest, RoundTripImageBitmapWithColorSpaceInfo) { + sk_sp p3 = + SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kDisplayP3); V8TestingScope scope; // Make a 10x7 red ImageBitmap in P3 color space. SkImageInfo info = - SkImageInfo::Make(10, 7, kRGBA_F16_SkColorType, kPremul_SkAlphaType, - SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, - SkNamedGamut::kDisplayP3)); + SkImageInfo::Make(10, 7, kRGBA_F16_SkColorType, kPremul_SkAlphaType, p3); sk_sp surface = SkSurface::MakeRaster(info); surface->getCanvas()->clear(SK_ColorRED); auto* image_bitmap = MakeGarbageCollected( @@ -1059,9 +1081,9 @@ TEST(V8ScriptValueSerializerTest, RoundTripImageBitmapWithColorSpaceInfo) { ASSERT_EQ(IntSize(10, 7), new_image_bitmap->Size()); // Check the color settings. - CanvasColorParams color_params = new_image_bitmap->GetCanvasColorParams(); - EXPECT_EQ(CanvasColorSpace::kP3, color_params.ColorSpace()); - EXPECT_EQ(CanvasPixelFormat::kF16, color_params.PixelFormat()); + SkImageInfo bitmap_info = new_image_bitmap->GetBitmapSkImageInfo(); + EXPECT_EQ(kRGBA_F16_SkColorType, bitmap_info.colorType()); + EXPECT_TRUE(SkColorSpace::Equals(p3.get(), bitmap_info.colorSpace())); // Check that the pixel at (3, 3) is red. We expect red in P3 to be // {0x57, 0x3B, 0x68, 0x32, 0x6E, 0x30, 0x00, 0x3C} when each color @@ -1128,6 +1150,8 @@ TEST(V8ScriptValueSerializerTest, DecodeImageBitmapV18) { {0xff, 0x12, 0xff, 0x0d, 0x5c, 0x67, 0x01, 0x03, 0x02, 0x01, 0x04, 0x01, 0x05, 0x01, 0x00, 0x02, 0x01, 0x10, 0x94, 0x3a, 0x3f, 0x28, 0x5f, 0x24, 0x00, 0x3c, 0x94, 0x3a, 0x3f, 0x28, 0x5f, 0x24, 0x00, 0x3c}); + sk_sp p3 = + SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kDisplayP3); v8::Local result = V8ScriptValueDeserializer(script_state, input).Deserialize(); @@ -1137,16 +1161,14 @@ TEST(V8ScriptValueSerializerTest, DecodeImageBitmapV18) { ASSERT_EQ(IntSize(2, 1), new_image_bitmap->Size()); // Check the color settings. - CanvasColorParams color_params = new_image_bitmap->GetCanvasColorParams(); - EXPECT_EQ(CanvasColorSpace::kP3, color_params.ColorSpace()); - EXPECT_EQ(CanvasPixelFormat::kF16, color_params.PixelFormat()); + SkImageInfo bitmap_info = new_image_bitmap->GetBitmapSkImageInfo(); + EXPECT_EQ(kRGBA_F16_SkColorType, bitmap_info.colorType()); + EXPECT_TRUE(SkColorSpace::Equals(p3.get(), bitmap_info.colorSpace())); // Check that the pixel at (1, 0) is red. uint8_t pixel[8] = {}; SkImageInfo info = - SkImageInfo::Make(1, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType, - SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, - SkNamedGamut::kDisplayP3)); + SkImageInfo::Make(1, 1, kRGBA_F16_SkColorType, kPremul_SkAlphaType, p3); ASSERT_TRUE( new_image_bitmap->BitmapImage()->PaintImageForCurrentFrame().readPixels( info, &pixel, 8, 1, 0)); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/source_location.cc b/chromium/third_party/blink/renderer/bindings/core/v8/source_location.cc index a7dada1068f..28938bcb177 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/source_location.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/source_location.cc @@ -41,9 +41,10 @@ std::unique_ptr SourceLocation::Capture( unsigned column_number) { std::unique_ptr stack_trace = CaptureStackTrace(false); - if (stack_trace && !stack_trace->isEmpty()) + if (stack_trace && !stack_trace->isEmpty()) { return SourceLocation::CreateFromNonEmptyV8StackTrace( - std::move(stack_trace), 0); + std::move(stack_trace)); + } return std::make_unique(url, line_number, column_number, std::move(stack_trace)); } @@ -53,9 +54,10 @@ std::unique_ptr SourceLocation::Capture( ExecutionContext* execution_context) { std::unique_ptr stack_trace = CaptureStackTrace(false); - if (stack_trace && !stack_trace->isEmpty()) + if (stack_trace && !stack_trace->isEmpty()) { return SourceLocation::CreateFromNonEmptyV8StackTrace( - std::move(stack_trace), 0); + std::move(stack_trace)); + } if (LocalDOMWindow* window = DynamicTo(execution_context)) { Document* document = window->document(); @@ -86,8 +88,7 @@ std::unique_ptr SourceLocation::FromMessage( if (debugger) stack_trace = debugger->GetV8Inspector()->createStackTrace(stack); - int script_id = - static_cast(message->GetScriptOrigin().ScriptID()->Value()); + int script_id = message->GetScriptOrigin().ScriptId(); if (!stack.IsEmpty() && stack->GetFrameCount() > 0) { int top_script_id = stack->GetFrame(isolate, 0)->GetScriptId(); if (top_script_id == script_id) @@ -100,9 +101,10 @@ std::unique_ptr SourceLocation::FromMessage( message->GetStartColumn(isolate->GetCurrentContext()).To(&column_number)) ++column_number; - if ((!script_id || !line_number) && stack_trace && !stack_trace->isEmpty()) + if ((!script_id || !line_number) && stack_trace && !stack_trace->isEmpty()) { return SourceLocation::CreateFromNonEmptyV8StackTrace( - std::move(stack_trace), 0); + std::move(stack_trace)); + } String url = ToCoreStringWithUndefinedOrNullCheck( message->GetScriptOrigin().ResourceName()); @@ -114,12 +116,12 @@ std::unique_ptr SourceLocation::FromMessage( // static std::unique_ptr SourceLocation::CreateFromNonEmptyV8StackTrace( - std::unique_ptr stack_trace, - int script_id) { + std::unique_ptr stack_trace) { // Retrieve the data before passing the ownership to SourceLocation. String url = ToCoreString(stack_trace->topSourceURL()); unsigned line_number = stack_trace->topLineNumber(); unsigned column_number = stack_trace->topColumnNumber(); + int script_id = stack_trace->topScriptIdAsInteger(); return base::WrapUnique(new SourceLocation( url, line_number, column_number, std::move(stack_trace), script_id)); } @@ -140,9 +142,10 @@ std::unique_ptr SourceLocation::FromFunction( std::unique_ptr SourceLocation::CaptureWithFullStackTrace() { std::unique_ptr stack_trace = CaptureStackTrace(true); - if (stack_trace && !stack_trace->isEmpty()) + if (stack_trace && !stack_trace->isEmpty()) { return SourceLocation::CreateFromNonEmptyV8StackTrace( - std::move(stack_trace), 0); + std::move(stack_trace)); + } return std::make_unique(String(), 0, 0, nullptr, 0); } @@ -167,7 +170,7 @@ void SourceLocation::ToTracedValue(TracedValue* value, const char* name) const { value->BeginDictionary(); value->SetString("functionName", ToCoreString(stack_trace_->topFunctionName())); - value->SetString("scriptId", ToCoreString(stack_trace_->topScriptId())); + value->SetInteger("scriptId", stack_trace_->topScriptIdAsInteger()); value->SetString("url", ToCoreString(stack_trace_->topSourceURL())); value->SetInteger("lineNumber", stack_trace_->topLineNumber()); value->SetInteger("columnNumber", stack_trace_->topColumnNumber()); @@ -175,6 +178,20 @@ void SourceLocation::ToTracedValue(TracedValue* value, const char* name) const { value->EndArray(); } +void SourceLocation::WriteIntoTracedValue(perfetto::TracedValue context) const { + // TODO(altimin): Consider replacing nested dict-inside-array with just an + // array here. + auto array = std::move(context).WriteArray(); + auto dict = array.AppendDictionary(); + // TODO(altimin): Add TracedValue support to v8::StringView and remove + // ToCoreString calls. + dict.Add("functionName", ToCoreString(stack_trace_->topFunctionName())); + dict.Add("scriptId", stack_trace_->topScriptIdAsInteger()); + dict.Add("url", ToCoreString(stack_trace_->topSourceURL())); + dict.Add("lineNumber", stack_trace_->topLineNumber()); + dict.Add("columnNumber", stack_trace_->topColumnNumber()); +} + std::unique_ptr SourceLocation::Clone() const { return base::WrapUnique(new SourceLocation( url_.IsolatedCopy(), line_number_, column_number_, diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/source_location.h b/chromium/third_party/blink/renderer/bindings/core/v8/source_location.h index 3126e04984e..08f41febdf8 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/source_location.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/source_location.h @@ -11,6 +11,7 @@ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" +#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" namespace blink { @@ -58,10 +59,18 @@ class CORE_EXPORT SourceLocation { return std::move(stack_trace_); } + bool HasStackTrace() const { + return stack_trace_ && !stack_trace_->isEmpty(); + } + // Safe to pass between threads, drops async chain in stack trace. std::unique_ptr Clone() const; + void WriteIntoTracedValue(perfetto::TracedValue context) const; + // No-op when stack trace is unknown. + // TODO(altimin): Replace all usages of `ToTracedValue` with + // `WriteIntoTracedValue` and remove this method. void ToTracedValue(TracedValue*, const char* name) const; // Could be null string when stack trace is unknown. @@ -76,8 +85,7 @@ class CORE_EXPORT SourceLocation { private: static std::unique_ptr CreateFromNonEmptyV8StackTrace( - std::unique_ptr, - int script_id); + std::unique_ptr); String url_; unsigned line_number_; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h b/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h index 40ae6d6650b..60276298c88 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h @@ -31,14 +31,14 @@ template inline v8::Local ToV8(NotShared value, v8::Local creation_context, v8::Isolate* isolate) { - return ToV8(value.View(), creation_context, isolate); + return ToV8(value.Get(), creation_context, isolate); } template inline v8::Local ToV8(MaybeShared value, v8::Local creation_context, v8::Isolate* isolate) { - return ToV8(value.View(), creation_context, isolate); + return ToV8(value.Get(), creation_context, isolate); } // Dictionary diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits.h b/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits.h new file mode 100644 index 00000000000..2233edae858 --- /dev/null +++ b/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits.h @@ -0,0 +1,649 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_TO_V8_TRAITS_H_ +#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_TO_V8_TRAITS_H_ + +#include "third_party/blink/renderer/bindings/core/v8/idl_dictionary_base.h" +#include "third_party/blink/renderer/bindings/core/v8/idl_types.h" +#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" +#include "third_party/blink/renderer/platform/bindings/callback_function_base.h" +#include "third_party/blink/renderer/platform/bindings/callback_interface_base.h" +#include "third_party/blink/renderer/platform/bindings/dictionary_base.h" +#include "third_party/blink/renderer/platform/bindings/dom_data_store.h" +#include "third_party/blink/renderer/platform/bindings/enumeration_base.h" +#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" +#include "third_party/blink/renderer/platform/bindings/v8_binding.h" +#include "v8/include/v8.h" + +namespace blink { + +// ToV8Traits provides C++ -> V8 conversion. +// Currently, you can use ToV8() which is defined in to_v8.h for this +// conversion, but it cannot throw an exception when an error occurs. +// We will solve this problem and replace ToV8() in to_v8.h with +// ToV8Traits::ToV8(). +// TODO(canonmukai): Replace existing ToV8() with ToV8Traits<>. + +// Primary template for ToV8Traits. +template +struct ToV8Traits; + +// Any +template <> +struct ToV8Traits { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const ScriptValue& script_value) + WARN_UNUSED_RESULT { + DCHECK(!script_value.IsEmpty()); + return script_value.V8Value(); + } +}; + +// Boolean +template <> +struct ToV8Traits { + static v8::MaybeLocal ToV8(ScriptState* script_state, + bool value) WARN_UNUSED_RESULT { + return v8::Boolean::New(script_state->GetIsolate(), value); + } +}; + +// Integer +// int8_t +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + int8_t value) WARN_UNUSED_RESULT { + return v8::Integer::New(script_state->GetIsolate(), value); + } +}; + +// int16_t +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + int16_t value) WARN_UNUSED_RESULT { + return v8::Integer::New(script_state->GetIsolate(), value); + } +}; + +// int32_t +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + int32_t value) WARN_UNUSED_RESULT { + return v8::Integer::New(script_state->GetIsolate(), value); + } +}; + +// int64_t +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + int64_t value) WARN_UNUSED_RESULT { + int32_t value_in_32bit = static_cast(value); + if (value_in_32bit == value) + return v8::Integer::New(script_state->GetIsolate(), value_in_32bit); + // v8::Integer cannot represent 64-bit integers. + return v8::Number::New(script_state->GetIsolate(), value); + } +}; + +// uint8_t +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + uint8_t value) WARN_UNUSED_RESULT { + return v8::Integer::NewFromUnsigned(script_state->GetIsolate(), value); + } +}; + +// uint16_t +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + uint16_t value) WARN_UNUSED_RESULT { + return v8::Integer::NewFromUnsigned(script_state->GetIsolate(), value); + } +}; + +// uint32_t +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + uint32_t value) WARN_UNUSED_RESULT { + return v8::Integer::NewFromUnsigned(script_state->GetIsolate(), value); + } +}; + +// uint64_t +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + uint64_t value) WARN_UNUSED_RESULT { + uint32_t value_in_32bit = static_cast(value); + if (value_in_32bit == value) { + return v8::Integer::NewFromUnsigned(script_state->GetIsolate(), + value_in_32bit); + } + // v8::Integer cannot represent 64-bit integers. + return v8::Number::New(script_state->GetIsolate(), value); + } +}; + +// Floating Point Number +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + T value) WARN_UNUSED_RESULT { + return v8::Number::New(script_state->GetIsolate(), value); + } +}; + +// String +template +struct ToV8Traits< + T, + typename std::enable_if_t::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const String& value) + WARN_UNUSED_RESULT { + // if |value| is a null string, V8String() returns an empty string. + return V8String(script_state->GetIsolate(), value); + } +}; + +// Object +template <> +struct ToV8Traits { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const ScriptValue& script_value) + WARN_UNUSED_RESULT { + DCHECK(!script_value.IsEmpty()); + v8::Local v8_value = script_value.V8Value(); + DCHECK(v8_value->IsObject()); + return v8_value; + } +}; + +// Promise +template <> +struct ToV8Traits { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const ScriptPromise& script_promise) + WARN_UNUSED_RESULT { + DCHECK(!script_promise.IsEmpty()); + return script_promise.V8Value(); + } +}; + +// ScriptWrappable + +namespace bindings { + +// Helper function for ScriptWrappable +inline v8::MaybeLocal ToV8HelperScriptWrappable( + ScriptState* script_state, + ScriptWrappable* script_wrappable) { + CHECK(script_wrappable); + v8::Local wrapper = + DOMDataStore::GetWrapper(script_wrappable, script_state->GetIsolate()); + if (!wrapper.IsEmpty()) { + return wrapper; + } + + if (!script_wrappable->WrapV2(script_state).ToLocal(&wrapper)) { + return v8::MaybeLocal(); + } + return wrapper; +} + +// For optimization +inline v8::MaybeLocal ToV8HelperScriptWrappable( + v8::Isolate* isolate, + ScriptWrappable* script_wrappable, + v8::Local creation_context_object) { + CHECK(script_wrappable); + v8::Local wrapper = + DOMDataStore::GetWrapper(script_wrappable, isolate); + if (!wrapper.IsEmpty()) { + return wrapper; + } + + CHECK(!creation_context_object.IsEmpty()); + ScriptState* script_state = + ScriptState::From(creation_context_object->CreationContext()); + if (!script_wrappable->WrapV2(script_state).ToLocal(&wrapper)) { + return v8::MaybeLocal(); + } + return wrapper; +} + +} // namespace bindings + +template +struct ToV8Traits< + T, + typename std::enable_if_t::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + T* script_wrappable) + WARN_UNUSED_RESULT { + return bindings::ToV8HelperScriptWrappable(script_state, script_wrappable); + } + + // This overload is used for the case when a ToV8 caller does not have + // |script_state| but has a receiver object (a creation context object) + // which is needed to create a wrapper. If a wrapper object corresponding to + // the receiver object exists, ToV8 can return it without a call to + // CreationContext() which is slow. + static v8::MaybeLocal ToV8( + v8::Isolate* isolate, + T* script_wrappable, + v8::Local creation_context_object) WARN_UNUSED_RESULT { + return bindings::ToV8HelperScriptWrappable(isolate, script_wrappable, + creation_context_object); + } +}; + +// Dictionary +template +struct ToV8Traits::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const T* dictionary) + WARN_UNUSED_RESULT { + DCHECK(dictionary); + v8::Local v8_value = dictionary->CreateV8Object( + script_state->GetIsolate(), script_state->GetContext()->Global()); + DCHECK(!v8_value.IsEmpty()); + return v8_value; + } +}; + +// Old implementation of Dictionary +template +struct ToV8Traits< + T, + typename std::enable_if_t::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const T* dictionary) + WARN_UNUSED_RESULT { + DCHECK(dictionary); + return dictionary->ToV8Impl(script_state->GetContext()->Global(), + script_state->GetIsolate()); + } +}; + +// Callback function +template +struct ToV8Traits::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + T* callback) WARN_UNUSED_RESULT { + // creation_context (|script_state->GetContext()|) is intentionally ignored. + // Callback functions are not wrappers nor clonable. ToV8 on a callback + // function must be used only when it's in the same world. + DCHECK(callback); + DCHECK(&callback->GetWorld() == &script_state->World()); + return callback->CallbackObject().template As(); + } +}; + +// Callback interface +template +struct ToV8Traits::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + T* callback) WARN_UNUSED_RESULT { + // creation_context (|script_state->GetContext()|) is intentionally ignored. + // Callback Interfaces are not wrappers nor clonable. ToV8 on a callback + // interface must be used only when it's in the same world. + DCHECK(callback); + DCHECK(&callback->GetWorld() == &script_state->World()); + return callback->CallbackObject().template As(); + } +}; + +// Enumeration +template +struct ToV8Traits::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const T& enumeration) + WARN_UNUSED_RESULT { + return V8String(script_state->GetIsolate(), enumeration.AsCStr()); + } +}; + +// NotShared +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + NotShared value) WARN_UNUSED_RESULT { + return ToV8Traits::ToV8(script_state, value.Get()); + } +}; + +// MaybeShared +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + MaybeShared value) + WARN_UNUSED_RESULT { + return ToV8Traits::ToV8(script_state, value.Get()); + } +}; + +// Array + +namespace bindings { + +// Helper function for IDLSequence +template +inline v8::MaybeLocal ToV8HelperSequence(ScriptState* script_state, + const VectorType& vector) { + v8::Isolate* isolate = script_state->GetIsolate(); + v8::Local array; + { + v8::Context::Scope context_scope(script_state->GetContext()); + array = v8::Array::New(isolate, SafeCast(vector.size())); + } + v8::Local context = script_state->GetContext(); + uint32_t index = 0; + typename VectorType::const_iterator end = vector.end(); + for (typename VectorType::const_iterator iter = vector.begin(); iter != end; + ++iter) { + v8::Local v8_value; + if (!ToV8Traits::ToV8(script_state, *iter) + .ToLocal(&v8_value)) { + return v8::MaybeLocal(); + } + bool is_property_created; + if (!array->CreateDataProperty(context, index++, v8_value) + .To(&is_property_created) || + !is_property_created) { + return v8::Local(); + } + } + return array; +} + +// Helper function for IDLRecord +template +inline v8::MaybeLocal ToV8HelperRecord(ScriptState* script_state, + const VectorType& vector) { + v8::Isolate* isolate = script_state->GetIsolate(); + v8::Local object; + { + v8::Context::Scope context_scope(script_state->GetContext()); + object = v8::Object::New(isolate); + } + v8::Local context = script_state->GetContext(); + typename VectorType::const_iterator end = vector.end(); + for (typename VectorType::const_iterator iter = vector.begin(); iter != end; + ++iter) { + v8::Local v8_value; + if (!ToV8Traits::ToV8(script_state, iter->second) + .ToLocal(&v8_value)) { + return v8::MaybeLocal(); + } + bool is_property_created; + if (!object + ->CreateDataProperty(context, V8AtomicString(isolate, iter->first), + v8_value) + .To(&is_property_created) || + !is_property_created) { + return v8::Local(); + } + } + return object; +} + +} // namespace bindings + +// IDLSequence +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8( + ScriptState* script_state, + const typename IDLSequence::ImplType& value) { + return bindings::ToV8HelperSequence(script_state, value); + } + + static v8::MaybeLocal ToV8( + ScriptState* script_state, + const typename IDLSequence::ImplType* value) { + return bindings::ToV8HelperSequence(script_state, *value); + } +}; + +// IDLRecord +// K must be based of IDL String types. +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8( + ScriptState* script_state, + const typename IDLRecord::ImplType& value) { + return bindings::ToV8HelperRecord(script_state, value); + } + + static v8::MaybeLocal ToV8( + ScriptState* script_state, + const typename IDLRecord::ImplType* value) { + return bindings::ToV8HelperRecord(script_state, *value); + } +}; + +// Nullable + +// IDLNullable> must not be used. +template +struct ToV8Traits>>; + +// Nullable Boolean +template <> +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const base::Optional& value) + WARN_UNUSED_RESULT { + if (!value) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, *value); + } +}; + +// Nullable Integers +template +struct ToV8Traits>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const base::Optional& value) + WARN_UNUSED_RESULT { + if (!value) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits>::ToV8(script_state, *value); + } +}; + +// Nullable Floating Point Number +template +struct ToV8Traits>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const base::Optional& value) + WARN_UNUSED_RESULT { + if (!value) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits>::ToV8( + script_state, *value); + } +}; + +// Nullable Strings +template +struct ToV8Traits< + IDLNullable, + typename std::enable_if_t::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const String& value) + WARN_UNUSED_RESULT { + if (!value) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, value); + } +}; + +// Nullable ScriptWrappable +template +struct ToV8Traits< + IDLNullable, + typename std::enable_if_t::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + T* script_wrappable) + WARN_UNUSED_RESULT { + if (!script_wrappable) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, script_wrappable); + } + + static v8::MaybeLocal ToV8(v8::Isolate* isolate, + ScriptWrappable* script_wrappable, + v8::Local creation_context) + WARN_UNUSED_RESULT { + if (!script_wrappable) + return v8::Null(isolate); + return ToV8Traits::ToV8(isolate, script_wrappable, creation_context); + } +}; + +// Nullable Dictionary +template +struct ToV8Traits, + typename std::enable_if_t< + std::is_base_of::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const T* dictionary) + WARN_UNUSED_RESULT { + if (!dictionary) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, dictionary); + } +}; + +// Nullable Dictionary (Old implementation) +template +struct ToV8Traits< + IDLNullable, + typename std::enable_if_t::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const T* dictionary) + WARN_UNUSED_RESULT { + if (!dictionary) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, dictionary); + } +}; + +// Nullable Callback function +template +struct ToV8Traits, + typename std::enable_if_t< + std::is_base_of::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + T* callback) WARN_UNUSED_RESULT { + if (!callback) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, callback); + } +}; + +// Nullable Callback interface +template +struct ToV8Traits, + typename std::enable_if_t< + std::is_base_of::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + T* callback) WARN_UNUSED_RESULT { + if (!callback) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, callback); + } +}; + +// Nullable Enumeration +template +struct ToV8Traits, + typename std::enable_if_t< + std::is_base_of::value>> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const base::Optional& enumeration) + WARN_UNUSED_RESULT { + if (!enumeration) + return v8::Null(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, *enumeration); + } +}; + +// Nullable Date +// IDLDate must be used as IDLNullable. +template <> +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const base::Optional date) + WARN_UNUSED_RESULT { + if (!date) + return v8::Null(script_state->GetIsolate()); + return v8::Date::New(script_state->GetContext(), + date->ToJsTimeIgnoringNull()) + .ToLocalChecked(); + } +}; + +// Union types + +namespace bindings { + +// Helper function for Union +template +inline v8::MaybeLocal ToV8HelperUnion(ScriptState* script_state, + const T& value) { + return ToV8(value, script_state->GetContext()->Global(), + script_state->GetIsolate()); +} + +} // namespace bindings + +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const T& value) WARN_UNUSED_RESULT { + return bindings::ToV8HelperUnion(script_state, value); + } +}; + +// Optional +template +struct ToV8Traits> { + static v8::MaybeLocal ToV8(ScriptState* script_state, + const T* value) WARN_UNUSED_RESULT { + if (!value) + return v8::Undefined(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, value); + } + + static v8::MaybeLocal ToV8(ScriptState* script_state, + const ScriptValue& value) + WARN_UNUSED_RESULT { + if (value.IsEmpty()) + return v8::Undefined(script_state->GetIsolate()); + return ToV8Traits::ToV8(script_state, value); + } +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_TO_V8_TRAITS_H_ diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc new file mode 100644 index 00000000000..f30f06a51df --- /dev/null +++ b/chromium/third_party/blink/renderer/bindings/core/v8/to_v8_traits_test.cc @@ -0,0 +1,520 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h" + +#include "third_party/blink/renderer/bindings/core/v8/file_or_usv_string_or_form_data.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_address_space.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_create_html_callback.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_dom_point_init.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_event_listener.h" +#include "third_party/blink/renderer/core/dom/events/event_target.h" +#include "third_party/blink/renderer/core/streams/stream_promise_resolver.h" +#include "third_party/blink/renderer/core/testing/garbage_collected_script_wrappable.h" +#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h" +#include "third_party/blink/renderer/platform/bindings/dictionary_base.h" + +namespace blink { + +namespace { + +#define TEST_TOV8_TRAITS(scope, IDLType, expected, value) \ + TestToV8Traits(scope, expected, value, __FILE__, __LINE__) + +template +void TestToV8Traits(const V8TestingScope& scope, + const String& expected, + T value, + const char* path, + int line_number) { + v8::Local actual; + if (!ToV8Traits::ToV8(scope.GetScriptState(), value) + .ToLocal(&actual)) { + ADD_FAILURE_AT(path, line_number) << "ToV8 throws an exception."; + return; + } + String actual_string = + ToCoreString(actual->ToString(scope.GetContext()).ToLocalChecked()); + if (expected != actual_string) { + ADD_FAILURE_AT(path, line_number) + << "ToV8 returns an incorrect value.\n Actual: " + << actual_string.Utf8() << "\nExpected: " << expected; + return; + } +} + +TEST(ToV8TraitsTest, Any) { + const V8TestingScope scope; + ScriptValue value(scope.GetIsolate(), + v8::Number::New(scope.GetIsolate(), 1234.0)); + v8::Local actual1; + ASSERT_TRUE(ToV8Traits::ToV8(scope.GetScriptState(), value) + .ToLocal(&actual1)); + EXPECT_FALSE(actual1.IsEmpty()); + double actual_as_number1 = actual1.As()->Value(); + EXPECT_EQ(1234.0, actual_as_number1); +} + +TEST(ToV8TraitsTest, Boolean) { + const V8TestingScope scope; + TEST_TOV8_TRAITS(scope, IDLBoolean, "true", true); + TEST_TOV8_TRAITS(scope, IDLBoolean, "false", false); +} + +TEST(ToV8TraitsTest, Integer) { + const V8TestingScope scope; + // Test type matching + // Integer + TEST_TOV8_TRAITS(scope, IDLByte, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLByte, "1", static_cast(1)); + TEST_TOV8_TRAITS(scope, IDLByte, "-2", static_cast(-2)); + TEST_TOV8_TRAITS(scope, IDLShort, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLLong, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLLongLong, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLOctet, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLUnsignedShort, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLUnsignedLong, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLUnsignedLongLong, "0", static_cast(0)); + // [Clamp] Integer + TEST_TOV8_TRAITS(scope, IDLByteClamp, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLShortClamp, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLLongClamp, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLLongLongClamp, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLOctetClamp, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLUnsignedShortClamp, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLUnsignedLongClamp, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLUnsignedLongLongClamp, "0", + static_cast(0)); + // [EnforceRange] Integer + TEST_TOV8_TRAITS(scope, IDLByteEnforceRange, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLShortEnforceRange, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLLongEnforceRange, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLLongLongEnforceRange, "0", + static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLOctetEnforceRange, "0", static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLUnsignedShortEnforceRange, "0", + static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLUnsignedLongEnforceRange, "0", + static_cast(0)); + TEST_TOV8_TRAITS(scope, IDLUnsignedLongLongEnforceRange, "0", + static_cast(0)); + + // Test the maximum and the minimum integer in the range + TEST_TOV8_TRAITS(scope, IDLLong, "-2147483648", + std::numeric_limits::min()); + TEST_TOV8_TRAITS(scope, IDLLong, "2147483647", + std::numeric_limits::max()); + TEST_TOV8_TRAITS(scope, IDLUnsignedLong, "4294967295", + std::numeric_limits::max()); + + // v8::Number can represent exact numbers in [-(2^53-1), 2^53-1]. + TEST_TOV8_TRAITS(scope, IDLLongLong, "-9007199254740991", + static_cast(-9007199254740991)); // -(2^53-1) + TEST_TOV8_TRAITS(scope, IDLLongLong, "9007199254740991", + static_cast(9007199254740991)); // 2^53-1 + TEST_TOV8_TRAITS(scope, IDLUnsignedLongLong, "9007199254740991", + static_cast(9007199254740991)); // 2^53-1 +} + +TEST(ToV8TraitsTest, FloatAndDouble) { + const V8TestingScope scope; + TEST_TOV8_TRAITS(scope, IDLFloat, "0.5", static_cast(0.5)); + TEST_TOV8_TRAITS(scope, IDLUnrestrictedFloat, "-0.5", + static_cast(-0.5)); + TEST_TOV8_TRAITS(scope, IDLDouble, "0.5", static_cast(0.5)); + TEST_TOV8_TRAITS(scope, IDLUnrestrictedDouble, "-0.5", + static_cast(-0.5)); + TEST_TOV8_TRAITS(scope, IDLUnrestrictedDouble, "NaN", + std::numeric_limits::quiet_NaN()); + TEST_TOV8_TRAITS(scope, IDLUnrestrictedDouble, "Infinity", + std::numeric_limits::infinity()); + TEST_TOV8_TRAITS(scope, IDLUnrestrictedDouble, "-Infinity", + -std::numeric_limits::infinity()); +} + +TEST(ToV8TraitsTest, String) { + const V8TestingScope scope; + const String string("string"); + const char* const charptr_string = "charptrString"; + // ByteString + TEST_TOV8_TRAITS(scope, IDLByteStringV2, "string", string); + TEST_TOV8_TRAITS(scope, IDLByteStringV2, "charptrString", charptr_string); + // DOMString + TEST_TOV8_TRAITS(scope, IDLStringV2, "string", string); + TEST_TOV8_TRAITS(scope, IDLStringV2, "charptrString", charptr_string); + TEST_TOV8_TRAITS(scope, IDLStringTreatNullAsEmptyStringV2, "string", string); + TEST_TOV8_TRAITS(scope, IDLStringTreatNullAsEmptyStringV2, "charptrString", + charptr_string); + // USVString + TEST_TOV8_TRAITS(scope, IDLUSVStringV2, "string", string); + TEST_TOV8_TRAITS(scope, IDLUSVStringV2, "charptrString", charptr_string); + // [StringContext=TrustedHTML] DOMString + TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedHTMLV2, "string", + string); + TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedHTMLV2, "charptrString", + charptr_string); + TEST_TOV8_TRAITS(scope, + IDLStringStringContextTrustedHTMLTreatNullAsEmptyStringV2, + "string", string); + TEST_TOV8_TRAITS(scope, + IDLStringStringContextTrustedHTMLTreatNullAsEmptyStringV2, + "charptrString", charptr_string); + // [StringContext=TrustedScript] DOMString + TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedScriptV2, "string", + string); + TEST_TOV8_TRAITS(scope, IDLStringStringContextTrustedScriptV2, + "charptrString", charptr_string); + TEST_TOV8_TRAITS(scope, + IDLStringStringContextTrustedScriptTreatNullAsEmptyStringV2, + "string", string); + TEST_TOV8_TRAITS(scope, + IDLStringStringContextTrustedScriptTreatNullAsEmptyStringV2, + "charptrString", charptr_string); + // [StringContext=TrustedScriptURL] USVString + TEST_TOV8_TRAITS(scope, IDLUSVStringStringContextTrustedScriptURLV2, "string", + string); + TEST_TOV8_TRAITS(scope, IDLUSVStringStringContextTrustedScriptURLV2, + "charptrString", charptr_string); +} + +TEST(ToV8TraitsTest, EmptyString) { + const V8TestingScope scope; + const String empty_string(""); + TEST_TOV8_TRAITS(scope, IDLStringV2, "", empty_string); + const char* const empty = ""; + TEST_TOV8_TRAITS(scope, IDLStringV2, "", empty); +} + +TEST(ToV8TraitsTest, Object) { + const V8TestingScope scope; + Vector string_vector; + string_vector.push_back("hello"); + string_vector.push_back("world"); + ScriptValue value(scope.GetIsolate(), + ToV8Traits>::ToV8( + scope.GetScriptState(), string_vector)); + TEST_TOV8_TRAITS(scope, IDLObject, "hello,world", value); + v8::Local actual; + ASSERT_TRUE(ToV8Traits::ToV8(scope.GetScriptState(), value) + .ToLocal(&actual)); + EXPECT_TRUE(actual->IsObject()); +} + +TEST(ToV8TraitsTest, Promise) { + const V8TestingScope scope; + ScriptPromise::InternalResolver resolver(scope.GetScriptState()); + ScriptPromise promise = resolver.Promise(); + TEST_TOV8_TRAITS(scope, IDLPromise, "[object Promise]", promise); +} + +TEST(ToV8TraitsTest, NotShared) { + const V8TestingScope scope; + auto not_shared = NotShared(DOMUint8Array::Create(2)); + not_shared->Data()[0] = static_cast(0); + not_shared->Data()[1] = static_cast(255); + TEST_TOV8_TRAITS(scope, NotShared, "0,255", not_shared); +} + +TEST(ToV8TraitsTest, MaybeShared) { + const V8TestingScope scope; + auto maybe_shared = MaybeShared(DOMInt8Array::Create(3)); + maybe_shared->Data()[0] = static_cast(-128); + maybe_shared->Data()[1] = static_cast(0); + maybe_shared->Data()[2] = static_cast(127); + TEST_TOV8_TRAITS(scope, MaybeShared, "-128,0,127", + maybe_shared); +} + +TEST(ToV8TraitsTest, Vector) { + const V8TestingScope scope; + Vector string_vector; + string_vector.push_back("foo"); + string_vector.push_back("bar"); + TEST_TOV8_TRAITS(scope, IDLSequence, "foo,bar", string_vector); +} + +TEST(ToV8TraitsTest, HeapVector) { + const V8TestingScope scope; + HeapVector> heap_vector; + heap_vector.push_back( + MakeGarbageCollected("hoge")); + heap_vector.push_back( + MakeGarbageCollected("fuga")); + TEST_TOV8_TRAITS(scope, IDLSequence, + "hoge,fuga", heap_vector); + + HeapVector>* + garbage_collected_heap_vector = &heap_vector; + TEST_TOV8_TRAITS(scope, IDLSequence, + "hoge,fuga", garbage_collected_heap_vector); +} + +TEST(ToV8TraitsTest, BasicIDLTypeVectors) { + const V8TestingScope scope; + + Vector int32_vector; + int32_vector.push_back(42); + int32_vector.push_back(23); + TEST_TOV8_TRAITS(scope, IDLSequence, "42,23", int32_vector); + + Vector int64_vector; + int64_vector.push_back(31773); + int64_vector.push_back(404); + TEST_TOV8_TRAITS(scope, IDLSequence, "31773,404", int64_vector); + + Vector uint32_vector; + uint32_vector.push_back(1); + uint32_vector.push_back(2); + TEST_TOV8_TRAITS(scope, IDLSequence, "1,2", uint32_vector); + + Vector uint64_vector; + uint64_vector.push_back(1001); + uint64_vector.push_back(2002); + TEST_TOV8_TRAITS(scope, IDLSequence, "1001,2002", + uint64_vector); + + Vector float_vector; + float_vector.push_back(0.125); + float_vector.push_back(1.); + TEST_TOV8_TRAITS(scope, IDLSequence, "0.125,1", float_vector); + + Vector double_vector; + double_vector.push_back(2.3); + double_vector.push_back(4.2); + TEST_TOV8_TRAITS(scope, IDLSequence, "2.3,4.2", double_vector); + + Vector bool_vector; + bool_vector.push_back(true); + bool_vector.push_back(true); + bool_vector.push_back(false); + TEST_TOV8_TRAITS(scope, IDLSequence, "true,true,false", + bool_vector); +} + +TEST(ToV8TraitsTest, StringVectorVector) { + const V8TestingScope scope; + + Vector string_vector1; + string_vector1.push_back("foo"); + string_vector1.push_back("bar"); + Vector string_vector2; + string_vector2.push_back("quux"); + + Vector> compound_vector; + compound_vector.push_back(string_vector1); + compound_vector.push_back(string_vector2); + + EXPECT_EQ(2U, compound_vector.size()); + TEST_TOV8_TRAITS(scope, IDLSequence>, "foo,bar,quux", + compound_vector); + + v8::Local actual; + ASSERT_TRUE(ToV8Traits>>::ToV8( + scope.GetScriptState(), compound_vector) + .ToLocal(&actual)) + << "ToV8 throws an exception."; + v8::Local result = + actual->ToObject(scope.GetContext()).ToLocalChecked(); + v8::Local vector1 = + result->Get(scope.GetContext(), 0).ToLocalChecked(); + EXPECT_TRUE(vector1->IsArray()); + EXPECT_EQ(2U, vector1.As()->Length()); + v8::Local vector2 = + result->Get(scope.GetContext(), 1).ToLocalChecked(); + EXPECT_TRUE(vector2->IsArray()); + EXPECT_EQ(1U, vector2.As()->Length()); +} + +TEST(ToV8TraitsTest, PairVector) { + const V8TestingScope scope; + Vector> pair_vector; + pair_vector.push_back(std::make_pair("one", 1)); + pair_vector.push_back(std::make_pair("two", 2)); + using ByteRecord = IDLRecord; + TEST_TOV8_TRAITS(scope, ByteRecord, "[object Object]", pair_vector); + v8::Local actual; + ASSERT_TRUE(ToV8Traits::ToV8(scope.GetScriptState(), pair_vector) + .ToLocal(&actual)) + << "ToV8 throws an exception."; + v8::Local result = + actual->ToObject(scope.GetContext()).ToLocalChecked(); + v8::Local one = + result->Get(scope.GetContext(), V8String(scope.GetIsolate(), "one")) + .ToLocalChecked(); + EXPECT_EQ(1, one->NumberValue(scope.GetContext()).FromJust()); + v8::Local two = + result->Get(scope.GetContext(), V8String(scope.GetIsolate(), "two")) + .ToLocalChecked(); + EXPECT_EQ(2, two->NumberValue(scope.GetContext()).FromJust()); +} + +TEST(ToV8TraitsTest, PairHeapVector) { + const V8TestingScope scope; + HeapVector>> + pair_heap_vector; + pair_heap_vector.push_back(std::make_pair( + "one", MakeGarbageCollected("foo"))); + pair_heap_vector.push_back(std::make_pair( + "two", MakeGarbageCollected("bar"))); + using HeapRecord = IDLRecord; + TEST_TOV8_TRAITS(scope, HeapRecord, "[object Object]", pair_heap_vector); + v8::Local actual; + ASSERT_TRUE( + ToV8Traits::ToV8(scope.GetScriptState(), pair_heap_vector) + .ToLocal(&actual)) + << "ToV8 throws an exception."; + v8::Local result = + actual->ToObject(scope.GetContext()).ToLocalChecked(); + v8::Local one = + result->Get(scope.GetContext(), V8String(scope.GetIsolate(), "one")) + .ToLocalChecked(); + EXPECT_TRUE(one->IsObject()); + EXPECT_EQ(String("foo"), + ToCoreString(one->ToString(scope.GetContext()).ToLocalChecked())); + v8::Local two = + result->Get(scope.GetContext(), V8String(scope.GetIsolate(), "two")) + .ToLocalChecked(); + EXPECT_TRUE(two->IsObject()); + EXPECT_EQ(String("bar"), + ToCoreString(two->ToString(scope.GetContext()).ToLocalChecked())); + + HeapVector>>* + garbage_collected_pair_heap_vector = &pair_heap_vector; + TEST_TOV8_TRAITS(scope, HeapRecord, "[object Object]", + garbage_collected_pair_heap_vector); +} + +TEST(ToV8TraitsTest, NullStringInputForNoneNullableType) { + const V8TestingScope scope; + const String null_string; + TEST_TOV8_TRAITS(scope, IDLStringV2, "", null_string); + const char* const null = nullptr; + TEST_TOV8_TRAITS(scope, IDLStringV2, "", null); +} + +TEST(ToV8TraitsTest, Nullable) { + const V8TestingScope scope; + // Nullable Boolean + TEST_TOV8_TRAITS(scope, IDLNullable, "null", base::nullopt); + TEST_TOV8_TRAITS(scope, IDLNullable, "true", true); + // Nullable Integer + TEST_TOV8_TRAITS(scope, IDLNullable, "null", base::nullopt); + TEST_TOV8_TRAITS(scope, IDLNullable, "0", + base::Optional(0)); + // Nullable Float + TEST_TOV8_TRAITS(scope, IDLNullable, "null", base::nullopt); + TEST_TOV8_TRAITS(scope, IDLNullable, "0.5", + base::Optional(0.5)); + // Nullable Double + TEST_TOV8_TRAITS(scope, IDLNullable, "null", base::nullopt); + TEST_TOV8_TRAITS(scope, IDLNullable, "3.14", + base::Optional(3.14)); +} + +TEST(ToV8TraitsTest, NullableString) { + const V8TestingScope scope; + TEST_TOV8_TRAITS(scope, IDLNullable, "null", String()); + TEST_TOV8_TRAITS(scope, IDLNullable, "string", String("string")); + TEST_TOV8_TRAITS(scope, IDLNullable, "", String("")); + const char* const null = nullptr; + TEST_TOV8_TRAITS(scope, IDLNullable, "null", null); + const char* const charptr_string = "charptrString"; + TEST_TOV8_TRAITS(scope, IDLNullable, "charptrString", + charptr_string); + const char* const charptr_empty_string = ""; + TEST_TOV8_TRAITS(scope, IDLNullable, "", charptr_empty_string); +} + +TEST(ToV8TraitsTest, NullableScriptWrappable) { + const V8TestingScope scope; + TEST_TOV8_TRAITS(scope, IDLNullable, "null", nullptr); + EventTarget* event_target = EventTarget::Create(scope.GetScriptState()); + TEST_TOV8_TRAITS(scope, IDLNullable, "[object EventTarget]", + event_target); +} + +TEST(ToV8TraitsTest, NullableDictionary) { + const V8TestingScope scope; + // bindings::DictionaryBase + TEST_TOV8_TRAITS(scope, IDLNullable, "null", + nullptr); + // IDLDictionaryBase + DOMPointInit* dom_point_init = DOMPointInit::Create(); + TEST_TOV8_TRAITS(scope, IDLNullable, "null", nullptr); + TEST_TOV8_TRAITS(scope, IDLNullable, "[object Object]", + dom_point_init); +} + +TEST(ToV8TraitsTest, NullableCallbackFunction) { + const V8TestingScope scope; + TEST_TOV8_TRAITS(scope, IDLNullable, "null", nullptr); + V8CreateHTMLCallback* v8_create_html_callback = + V8CreateHTMLCallback::Create(scope.GetContext()->Global()); + TEST_TOV8_TRAITS(scope, IDLNullable, "[object Window]", + v8_create_html_callback); +} + +TEST(ToV8TraitsTest, NullableCallbackInterface) { + const V8TestingScope scope; + TEST_TOV8_TRAITS(scope, IDLNullable, "null", nullptr); + V8EventListener* v8_event_listener = + V8EventListener::Create(scope.GetContext()->Global()); + TEST_TOV8_TRAITS(scope, IDLNullable, "[object Window]", + v8_event_listener); +} + +TEST(ToV8TraitsTest, NullableEnumeration) { + const V8TestingScope scope; + TEST_TOV8_TRAITS(scope, IDLNullable, "null", base::nullopt); + const base::Optional v8_address_space = + V8AddressSpace::Create("public"); + TEST_TOV8_TRAITS(scope, IDLNullable, "public", + v8_address_space); +} + +TEST(ToV8TraitsTest, NullableDate) { + const V8TestingScope scope; + TEST_TOV8_TRAITS(scope, IDLNullable, "null", base::nullopt); + + base::Time expected_date; + EXPECT_TRUE( + base::Time::FromString("Fri, 01 Jan 2021 00:00:00 GMT", &expected_date)); + v8::Local result; + ASSERT_TRUE( + ToV8Traits>::ToV8( + scope.GetScriptState(), base::Optional(expected_date)) + .ToLocal(&result)); + String actual_string = + ToCoreString(result->ToString(scope.GetContext()).ToLocalChecked()); + base::Time actual_date; + EXPECT_TRUE( + base::Time::FromString(actual_string.Ascii().c_str(), &actual_date)); + EXPECT_EQ(expected_date, actual_date); +} + +TEST(ToV8TraitsTest, Union) { + const V8TestingScope scope; + const FileOrUSVStringOrFormData usv_string = + FileOrUSVStringOrFormData::FromUSVString("https://example.com/"); + TEST_TOV8_TRAITS(scope, IDLUnionNotINT, + "https://example.com/", usv_string); +} + +TEST(ToV8TraitsTest, Optional) { + const V8TestingScope scope; + TEST_TOV8_TRAITS(scope, IDLOptional, "undefined", nullptr); + DOMPointInit* dom_point_init = DOMPointInit::Create(); + TEST_TOV8_TRAITS(scope, IDLOptional, "[object Object]", + dom_point_init); + + TEST_TOV8_TRAITS(scope, IDLOptional, "undefined", ScriptValue()); + ScriptValue value(scope.GetIsolate(), + v8::Number::New(scope.GetIsolate(), 3.14)); + TEST_TOV8_TRAITS(scope, IDLOptional, "3.14", value); +} + +} // namespace + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/use_counter_callback.cc b/chromium/third_party/blink/renderer/bindings/core/v8/use_counter_callback.cc index 598bbba548e..375225e2929 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/use_counter_callback.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/use_counter_callback.cc @@ -236,14 +236,23 @@ void UseCounterCallback(v8::Isolate* isolate, case v8::Isolate::kRegExpReplaceCalledOnSlowRegExp: blink_feature = WebFeature::kV8RegExpReplaceCalledOnSlowRegExp; break; - case v8::Isolate::kSharedArrayBufferConstructed: - if (!CurrentExecutionContext(isolate)->CrossOriginIsolatedCapability()) { + case v8::Isolate::kSharedArrayBufferConstructed: { + ExecutionContext* current_execution_context = + CurrentExecutionContext(isolate); + if (!current_execution_context->CrossOriginIsolatedCapability()) { + // It is performance critical to only file the issue once per context. + if (!current_execution_context + ->has_filed_shared_array_buffer_creation_issue()) { + current_execution_context->FileSharedArrayBufferCreationIssue(); + } blink_feature = WebFeature::kV8SharedArrayBufferConstructedWithoutIsolation; + deprecated = true; } else { blink_feature = WebFeature::kV8SharedArrayBufferConstructed; } break; + } case v8::Isolate::kArrayPrototypeHasElements: blink_feature = WebFeature::kV8ArrayPrototypeHasElements; break; @@ -337,6 +346,9 @@ void UseCounterCallback(v8::Isolate* isolate, case v8::Isolate::kWasmMultiValue: blink_feature = WebFeature::kV8WasmMultiValue; break; + case v8::Isolate::kWasmExceptionHandling: + blink_feature = WebFeature::kV8WasmExceptionHandling; + break; default: // This can happen if V8 has added counters that this version of Blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v0_custom_element_constructor_builder.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v0_custom_element_constructor_builder.cc deleted file mode 100644 index 17ca699336f..00000000000 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v0_custom_element_constructor_builder.cc +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/renderer/bindings/core/v8/v0_custom_element_constructor_builder.h" - -#include "third_party/blink/renderer/bindings/core/v8/string_or_element_creation_options.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_document.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_element_registration_options.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_html_element.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_svg_element.h" -#include "third_party/blink/renderer/core/dom/document.h" -#include "third_party/blink/renderer/core/frame/web_feature.h" -#include "third_party/blink/renderer/core/html/custom/v0_custom_element_definition.h" -#include "third_party/blink/renderer/core/html/custom/v0_custom_element_descriptor.h" -#include "third_party/blink/renderer/core/html/custom/v0_custom_element_exception.h" -#include "third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.h" -#include "third_party/blink/renderer/core/html_names.h" -#include "third_party/blink/renderer/core/svg_names.h" -#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" -#include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/bindings/v0_custom_element_binding.h" -#include "third_party/blink/renderer/platform/bindings/v8_per_context_data.h" -#include "third_party/blink/renderer/platform/bindings/v8_private_property.h" -#include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/instrumentation/use_counter.h" -#include "third_party/blink/renderer/platform/wtf/assertions.h" - -namespace blink { - -const V8PrivateProperty::SymbolKey kPrivatePropertyDocument; -const V8PrivateProperty::SymbolKey kPrivatePropertyIsInterfacePrototypeObject; -const V8PrivateProperty::SymbolKey kPrivatePropertyNamespaceURI; -const V8PrivateProperty::SymbolKey kPrivatePropertyTagName; -const V8PrivateProperty::SymbolKey kPrivatePropertyType; - -static void ConstructCustomElement(const v8::FunctionCallbackInfo&); - -V0CustomElementConstructorBuilder::V0CustomElementConstructorBuilder( - ScriptState* script_state, - const ElementRegistrationOptions* options) - : script_state_(script_state), options_(options), callbacks_(nullptr) { - DCHECK(script_state_->GetContext() == - script_state_->GetIsolate()->GetCurrentContext()); -} - -bool V0CustomElementConstructorBuilder::IsFeatureAllowed() const { - return script_state_->World().IsMainWorld(); -} - -bool V0CustomElementConstructorBuilder::ValidateOptions( - const AtomicString& type, - QualifiedName& tag_name, - ExceptionState& exception_state) { - DCHECK(prototype_.IsEmpty()); - - v8::TryCatch try_catch(script_state_->GetIsolate()); - - if (!script_state_->PerContextData()) { - // FIXME: This should generate an InvalidContext exception at a later point. - V0CustomElementException::ThrowException( - V0CustomElementException::kContextDestroyedCheckingPrototype, type, - exception_state); - try_catch.ReThrow(); - return false; - } - - // TODO(crbug.com/1070871): ElementRegistrationOptions.prototype has a default - // value, but we check |hasPrototype()| here for backward compatibility. - if (options_->hasPrototype() && !options_->prototype().IsNull()) { - DCHECK(options_->prototype().IsObject()); - prototype_ = options_->prototype().V8Value().As(); - } else { - prototype_ = v8::Object::New(script_state_->GetIsolate()); - v8::Local base_prototype = - script_state_->PerContextData()->PrototypeForType( - V8HTMLElement::GetWrapperTypeInfo()); - if (!base_prototype.IsEmpty()) { - bool set_prototype; - if (!prototype_->SetPrototype(script_state_->GetContext(), base_prototype) - .To(&set_prototype) || - !set_prototype) { - return false; - } - } - } - - AtomicString namespace_uri = html_names::xhtmlNamespaceURI; - if (HasValidPrototypeChainFor(V8SVGElement::GetWrapperTypeInfo())) - namespace_uri = svg_names::kNamespaceURI; - - DCHECK(!try_catch.HasCaught()); - - AtomicString local_name; - - if (!options_->extends().IsNull()) { - local_name = AtomicString(options_->extends().DeprecatedLower()); - - if (!Document::IsValidName(local_name)) { - V0CustomElementException::ThrowException( - V0CustomElementException::kExtendsIsInvalidName, type, - exception_state); - try_catch.ReThrow(); - return false; - } - if (V0CustomElement::IsValidName(local_name)) { - V0CustomElementException::ThrowException( - V0CustomElementException::kExtendsIsCustomElementName, type, - exception_state); - try_catch.ReThrow(); - return false; - } - } else { - if (namespace_uri == svg_names::kNamespaceURI) { - V0CustomElementException::ThrowException( - V0CustomElementException::kExtendsIsInvalidName, type, - exception_state); - try_catch.ReThrow(); - return false; - } - local_name = type; - } - - DCHECK(!try_catch.HasCaught()); - tag_name = QualifiedName(g_null_atom, local_name, namespace_uri); - return true; -} - -V0CustomElementLifecycleCallbacks* -V0CustomElementConstructorBuilder::CreateCallbacks() { - DCHECK(!prototype_.IsEmpty()); - - v8::TryCatch exception_catcher(script_state_->GetIsolate()); - exception_catcher.SetVerbose(true); - - v8::MaybeLocal created = RetrieveCallback("createdCallback"); - v8::MaybeLocal attached = RetrieveCallback("attachedCallback"); - v8::MaybeLocal detached = RetrieveCallback("detachedCallback"); - v8::MaybeLocal attribute_changed = - RetrieveCallback("attributeChangedCallback"); - - callbacks_ = MakeGarbageCollected( - script_state_, prototype_, created, attached, detached, - attribute_changed); - return callbacks_; -} - -v8::MaybeLocal -V0CustomElementConstructorBuilder::RetrieveCallback(const char* name) { - v8::Local value; - if (!prototype_ - ->Get(script_state_->GetContext(), - V8AtomicString(script_state_->GetIsolate(), name)) - .ToLocal(&value) || - !value->IsFunction()) - return v8::MaybeLocal(); - return v8::MaybeLocal(value.As()); -} - -bool V0CustomElementConstructorBuilder::CreateConstructor( - Document* document, - V0CustomElementDefinition* definition, - ExceptionState& exception_state) { - DCHECK(!prototype_.IsEmpty()); - DCHECK(constructor_.IsEmpty()); - DCHECK(document); - - v8::Isolate* isolate = script_state_->GetIsolate(); - v8::Local context = script_state_->GetContext(); - - if (!PrototypeIsValid(definition->Descriptor().GetType(), exception_state)) - return false; - - const V0CustomElementDescriptor& descriptor = definition->Descriptor(); - - v8::Local v8_tag_name = V8String(isolate, descriptor.LocalName()); - v8::Local v8_type; - if (descriptor.IsTypeExtension()) - v8_type = V8String(isolate, descriptor.GetType()); - else - v8_type = v8::Null(isolate); - - v8::Local data = v8::Object::New(isolate); - V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyDocument) - .Set(data, ToV8(document, context->Global(), isolate)); - V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyNamespaceURI) - .Set(data, V8String(isolate, descriptor.NamespaceURI())); - V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyTagName) - .Set(data, v8_tag_name); - V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyType) - .Set(data, v8_type); - - v8::Local constructor_template = - v8::FunctionTemplate::New(isolate); - constructor_template->SetCallHandler(ConstructCustomElement, data); - if (!constructor_template->GetFunction(context).ToLocal(&constructor_)) { - V0CustomElementException::ThrowException( - V0CustomElementException::kContextDestroyedRegisteringDefinition, - definition->Descriptor().GetType(), exception_state); - return false; - } - - constructor_->SetName(v8_type->IsNull() ? v8_tag_name - : v8_type.As()); - - v8::Local prototype_key = V8AtomicString(isolate, "prototype"); - bool has_own_property; - if (!constructor_->HasOwnProperty(context, prototype_key) - .To(&has_own_property) || - !has_own_property) { - return false; - } - - // This sets the property *value*; calling Set is safe because - // "prototype" is a non-configurable data property so there can be - // no side effects. - bool set_prototype_key; - if (!constructor_->Set(context, prototype_key, prototype_) - .To(&set_prototype_key) || - !set_prototype_key) { - return false; - } - - // This *configures* the property. DefineOwnProperty of a function's - // "prototype" does not affect the value, but can reconfigure the - // property. - bool configured_prototype; - if (!constructor_ - ->DefineOwnProperty( - context, prototype_key, prototype_, - v8::PropertyAttribute(v8::ReadOnly | v8::DontEnum | - v8::DontDelete)) - .To(&configured_prototype) || - !configured_prototype) { - return false; - } - - v8::Local constructor_key = - V8AtomicString(isolate, "constructor"); - v8::Local constructor_prototype; - if (!prototype_->Get(context, constructor_key) - .ToLocal(&constructor_prototype)) { - return false; - } - - bool set_prototype; - if (!constructor_->SetPrototype(context, constructor_prototype) - .To(&set_prototype) || - !set_prototype) { - return false; - } - - V8PrivateProperty::GetSymbol(isolate, - kPrivatePropertyIsInterfacePrototypeObject) - .Set(prototype_, v8::True(isolate)); - - bool configured_constructor; - if (!prototype_ - ->DefineOwnProperty(context, constructor_key, constructor_, - v8::DontEnum) - .To(&configured_constructor) || - !configured_constructor) { - return false; - } - - return true; -} - -bool V0CustomElementConstructorBuilder::PrototypeIsValid( - const AtomicString& type, - ExceptionState& exception_state) const { - v8::Isolate* isolate = script_state_->GetIsolate(); - v8::Local context = script_state_->GetContext(); - - if (prototype_->InternalFieldCount() || - V8PrivateProperty::GetSymbol(isolate, - kPrivatePropertyIsInterfacePrototypeObject) - .HasValue(prototype_)) { - V0CustomElementException::ThrowException( - V0CustomElementException::kPrototypeInUse, type, exception_state); - return false; - } - - v8::PropertyAttribute property_attribute; - if (!prototype_ - ->GetPropertyAttributes(context, - V8AtomicString(isolate, "constructor")) - .To(&property_attribute) || - (property_attribute & v8::DontDelete)) { - V0CustomElementException::ThrowException( - V0CustomElementException::kConstructorPropertyNotConfigurable, type, - exception_state); - return false; - } - - return true; -} - -bool V0CustomElementConstructorBuilder::DidRegisterDefinition() const { - DCHECK(!constructor_.IsEmpty()); - - return callbacks_->SetBinding(std::make_unique( - script_state_->GetIsolate(), prototype_)); -} - -ScriptValue V0CustomElementConstructorBuilder::BindingsReturnValue() const { - return ScriptValue(script_state_->GetIsolate(), constructor_); -} - -bool V0CustomElementConstructorBuilder::HasValidPrototypeChainFor( - const WrapperTypeInfo* type) const { - v8::Local element_prototype = - script_state_->PerContextData()->PrototypeForType(type); - if (element_prototype.IsEmpty()) - return false; - - v8::Local chain = prototype_; - while (!chain.IsEmpty() && chain->IsObject()) { - if (chain == element_prototype) - return true; - chain = chain.As()->GetPrototype(); - } - - return false; -} - -static void ConstructCustomElement( - const v8::FunctionCallbackInfo& info) { - v8::Isolate* isolate = info.GetIsolate(); - - if (!info.IsConstructCall()) { - V8ThrowException::ThrowTypeError( - isolate, "DOM object constructor cannot be called as a function."); - return; - } - - if (info.Length() > 0) { - V8ThrowException::ThrowTypeError( - isolate, "This constructor should be called without arguments."); - return; - } - - v8::Local data = v8::Local::Cast(info.Data()); - v8::Local document_value; - if (!V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyDocument) - .GetOrUndefined(data) - .ToLocal(&document_value)) { - return; - } - Document* document = V8Document::ToImpl(document_value.As()); - v8::Local namespace_uri_value; - if (!V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyNamespaceURI) - .GetOrUndefined(data) - .ToLocal(&namespace_uri_value) || - namespace_uri_value->IsUndefined()) { - return; - } - TOSTRING_VOID(V8StringResource<>, namespace_uri, namespace_uri_value); - v8::Local tag_name_value; - if (!V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyTagName) - .GetOrUndefined(data) - .ToLocal(&tag_name_value) || - tag_name_value->IsUndefined()) { - return; - } - TOSTRING_VOID(V8StringResource<>, tag_name, tag_name_value); - v8::Local maybe_type; - if (!V8PrivateProperty::GetSymbol(isolate, kPrivatePropertyType) - .GetOrUndefined(data) - .ToLocal(&maybe_type) || - maybe_type->IsUndefined()) { - return; - } - TOSTRING_VOID(V8StringResource, type, maybe_type); - - ExceptionState exception_state(isolate, ExceptionState::kConstructionContext, - "CustomElement"); - V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; - Element* element = document->createElementNS( - namespace_uri, tag_name, StringOrElementCreationOptions::FromString(type), - exception_state); - if (element) { - UseCounter::Count(document, WebFeature::kV0CustomElementsConstruct); - } - V8SetReturnValueFast(info, element, document); -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v0_custom_element_constructor_builder.h b/chromium/third_party/blink/renderer/bindings/core/v8/v0_custom_element_constructor_builder.h deleted file mode 100644 index 7e02e872243..00000000000 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v0_custom_element_constructor_builder.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V0_CUSTOM_ELEMENT_CONSTRUCTOR_BUILDER_H_ -#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V0_CUSTOM_ELEMENT_CONSTRUCTOR_BUILDER_H_ - -#include "base/macros.h" -#include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/bindings/core/v8/script_value.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.h" -#include "third_party/blink/renderer/core/dom/qualified_name.h" -#include "third_party/blink/renderer/core/html/custom/v0_custom_element_lifecycle_callbacks.h" -#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" -#include "v8/include/v8.h" - -namespace blink { - -class V0CustomElementDefinition; -class Document; -class ElementRegistrationOptions; -class ExceptionState; -class QualifiedName; -struct WrapperTypeInfo; - -// Handles the scripting-specific parts of the Custom Elements element -// registration algorithm and constructor generation algorithm. It is -// used in the implementation of those algorithms in -// Document::registerElement. -class V0CustomElementConstructorBuilder { - STACK_ALLOCATED(); - - public: - V0CustomElementConstructorBuilder(ScriptState*, - const ElementRegistrationOptions*); - - // The builder accumulates state and may run script at specific - // points. These methods must be called in order. When one fails - // (returns false), the calls must stop. - - bool IsFeatureAllowed() const; - bool ValidateOptions(const AtomicString& type, - QualifiedName& tag_name, - ExceptionState&); - V0CustomElementLifecycleCallbacks* CreateCallbacks(); - bool CreateConstructor(Document*, - V0CustomElementDefinition*, - ExceptionState&); - bool DidRegisterDefinition() const; - - // This method collects a return value for the bindings. It is - // safe to call this method even if the builder failed; it will - // return an empty value. - ScriptValue BindingsReturnValue() const; - - private: - bool HasValidPrototypeChainFor(const WrapperTypeInfo*) const; - bool PrototypeIsValid(const AtomicString& type, ExceptionState&) const; - v8::MaybeLocal RetrieveCallback(const char* name); - - ScriptState* script_state_; - const ElementRegistrationOptions* options_; - v8::Local prototype_; - v8::Local constructor_; - V8V0CustomElementLifecycleCallbacks* callbacks_; - - DISALLOW_COPY_AND_ASSIGN(V0CustomElementConstructorBuilder); -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V0_CUSTOM_ELEMENT_CONSTRUCTOR_BUILDER_H_ diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc index 8327721aed9..8dd0021d59e 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc @@ -30,6 +30,7 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" +#include "base/debug/dump_without_crashing.h" #include "third_party/blink/renderer/bindings/core/v8/custom/v8_custom_xpath_ns_resolver.h" #include "third_party/blink/renderer/bindings/core/v8/idl_types.h" #include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" @@ -768,8 +769,10 @@ v8::Local ToV8ContextEvenIfDetached(LocalFrame* frame, // TODO(crbug.com/1046282): The following bailout is a temporary fix // introduced due to crbug.com/1037985 . Remove this temporary fix once // the root cause is fixed. - if (frame->IsProvisional()) + if (frame->IsProvisional()) { + base::debug::DumpWithoutCrashing(); return v8::Local(); + } return frame->WindowProxy(world)->ContextIfInitialized(); } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.cc index 6f3c53ccbb6..e63324ce04c 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.cc @@ -18,7 +18,8 @@ std::unique_ptr V8TestingScope::CreateDummyPageHolder( std::unique_ptr holder = std::make_unique(); if (url.IsValid()) { holder->GetFrame().Loader().CommitNavigation( - WebNavigationParams::CreateWithHTMLBuffer(SharedBuffer::Create(), url), + WebNavigationParams::CreateWithHTMLBufferForTesting( + SharedBuffer::Create(), url), nullptr /* extra_data */); blink::test::RunPendingTasks(); } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h b/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h index 77087972d7c..04984552064 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h @@ -77,10 +77,12 @@ class BindingTestSupportingGC : public testing::Test { v8::Isolate::GarbageCollectionType::kMinorGarbageCollection); } - void RunV8FullGC(v8::EmbedderHeapTracer::EmbedderStackState stack_state = - v8::EmbedderHeapTracer::EmbedderStackState::kEmpty) { + void RunV8FullGC( + v8::EmbedderHeapTracer::EmbedderStackState stack_state = + v8::EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers) { ThreadState::Current()->CollectAllGarbageForTesting( - stack_state == v8::EmbedderHeapTracer::EmbedderStackState::kEmpty + stack_state == + v8::EmbedderHeapTracer::EmbedderStackState::kNoHeapPointers ? BlinkGC::kNoHeapPointersOnStack : BlinkGC::kHeapPointersOnStack); } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc index 44c11826e21..0f9959905b6 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc @@ -321,17 +321,14 @@ scoped_refptr V8CodeCache::GenerateFullCodeCache( ReferrerScriptInfo referrer_info; v8::ScriptOrigin origin( V8String(isolate, file_name), - v8::Integer::New(isolate, 0), // line_offset - v8::Integer::New(isolate, 0), // column_offset - v8::Boolean::New( - isolate, - opaque_mode == OpaqueMode::kNotOpaque), // is_shared_cross_origin - v8::Local(), // script_id - V8String(isolate, String("")), // source_map_url - v8::Boolean::New(isolate, - opaque_mode == OpaqueMode::kOpaque), // is_opaque - v8::False(isolate), // is_wasm - v8::False(isolate), // is_module + 0, // line_offset + 0, // column_offset + opaque_mode == OpaqueMode::kNotOpaque, // is_shared_cross_origin + -1, // script_id + V8String(isolate, String("")), // source_map_url + opaque_mode == OpaqueMode::kOpaque, // is_opaque + false, // is_wasm + false, // is_module referrer_info.ToV8HostDefinedOptions(isolate)); v8::Local code(V8String(isolate, script_string)); v8::ScriptCompiler::Source source(code, origin); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_dom_configuration.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_dom_configuration.cc index 39f20c54149..54ed4ad1b4a 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_dom_configuration.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_dom_configuration.cc @@ -205,11 +205,10 @@ CreateAccessorFunctionOrTemplate( } else { function_template = v8::FunctionTemplate::New( isolate, callback, data, signature, length, - v8::ConstructorBehavior::kAllow, side_effect_type); + v8::ConstructorBehavior::kThrow, side_effect_type); } if (!function_template.IsEmpty()) { - function_template->RemovePrototype(); function_template->SetAcceptAnyReceiver( access_check_configuration == V8DOMConfiguration::kDoNotCheckAccess); @@ -485,12 +484,10 @@ void InstallMethodInternal(v8::Isolate* isolate, : v8::SideEffectType::kHasSideEffect; if (method.property_location_configuration & (V8DOMConfiguration::kOnInstance | V8DOMConfiguration::kOnPrototype)) { - // TODO(luoe): use ConstructorBehavior::kThrow for non-constructor methods. v8::Local function_template = v8::FunctionTemplate::New( isolate, callback, v8::Local(), signature, method.length, - v8::ConstructorBehavior::kAllow, side_effect_type, v8_c_function); - function_template->RemovePrototype(); + v8::ConstructorBehavior::kThrow, side_effect_type, v8_c_function); function_template->SetAcceptAnyReceiver( method.access_check_configuration == V8DOMConfiguration::kDoNotCheckAccess); @@ -510,13 +507,11 @@ void InstallMethodInternal(v8::Isolate* isolate, // Operations installed on the interface object must be static methods, so // no need to specify a signature, i.e. no need to do type check against a // holder. - // TODO(luoe): use ConstructorBehavior::kThrow for non-constructor methods. v8::Local function_template = v8::FunctionTemplate::New(isolate, callback, v8::Local(), v8::Local(), method.length, - v8::ConstructorBehavior::kAllow, + v8::ConstructorBehavior::kThrow, side_effect_type); - function_template->RemovePrototype(); // Similarly, there is no need to do an access check for static methods, as // there is no holder to check against. AddMethodToTemplate(isolate, interface_template, function_template, method); @@ -554,12 +549,10 @@ void InstallMethodInternal( DCHECK(location); if (location & (V8DOMConfiguration::kOnInstance | V8DOMConfiguration::kOnPrototype)) { - // TODO(luoe): use ConstructorBehavior::kThrow for non-constructor methods. v8::Local function_template = v8::FunctionTemplate::New( isolate, callback, v8::Local(), signature, config.length, - v8::ConstructorBehavior::kAllow, side_effect_type); - function_template->RemovePrototype(); + v8::ConstructorBehavior::kThrow, side_effect_type); function_template->SetAcceptAnyReceiver( config.access_check_configuration == V8DOMConfiguration::kDoNotCheckAccess); @@ -586,13 +579,11 @@ void InstallMethodInternal( // Operations installed on the interface object must be static // operations, so no need to specify a signature, i.e. no need to do // type check against a holder. - // TODO(luoe): use ConstructorBehavior::kThrow for non-constructor methods. v8::Local function_template = v8::FunctionTemplate::New(isolate, callback, v8::Local(), v8::Local(), config.length, - v8::ConstructorBehavior::kAllow, + v8::ConstructorBehavior::kThrow, side_effect_type); - function_template->RemovePrototype(); v8::Local function = function_template->GetFunction(isolate->GetCurrentContext()) .ToLocalChecked(); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.cc index 86780b6d16f..94a956b339b 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.cc @@ -5,6 +5,7 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.h" #include +#include #include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h" #include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h" #include "third_party/blink/renderer/bindings/core/v8/v8_node.h" @@ -16,6 +17,17 @@ #include "third_party/blink/renderer/platform/heap/unified_heap_controller.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "third_party/blink/renderer/platform/wtf/buildflags.h" + +#if BUILDFLAG(USE_V8_OILPAN) + +namespace blink { +void EmbedderGraphBuilder::BuildEmbedderGraphCallback(v8::Isolate* isolate, + v8::EmbedderGraph* graph, + void*) {} +} // namespace blink + +#else // !USE_V8_OILPAN namespace blink { @@ -65,10 +77,19 @@ class EmbedderNode : public Graph::Node { Graph::Node* WrapperNode() override { return wrapper_; } Detachedness GetDetachedness() override { return detachedness_; } + void AddEdgeName(std::unique_ptr edge_name) { + edge_names_.push_back(std::move(edge_name)); + } + private: const char* name_; Graph::Node* wrapper_; const Detachedness detachedness_; + // V8's API uses raw strings for edge names and expect the underlying memory + // to be retained until the end of graph building where strings are copied + // into its internal storage. The following vector retains those edge names + // until a node is freed which is at the end of graph building. + Vector> edge_names_; }; class EmbedderRootNode : public EmbedderNode { @@ -77,14 +98,6 @@ class EmbedderRootNode : public EmbedderNode { : EmbedderNode(name, nullptr, Detachedness::kUnknown) {} // Graph::Node override. bool IsRootNode() override { return true; } - - void AddEdgeName(std::unique_ptr edge_name) { - edge_names_.insert(std::move(edge_name)); - } - - private: - // Storage to hold edge names until they have been internalized by V8. - HashSet> edge_names_; }; class NodeBuilder final { @@ -183,13 +196,17 @@ class GC_PLUGIN_IGNORE( public: ParentScope(V8EmbedderGraphBuilder* visitor, Traceable traceable) - : visitor_(visitor) { + : visitor_(visitor), old_parent_(visitor->current_parent_) { visitor->current_parent_ = traceable; } - ~ParentScope() { visitor_->current_parent_ = nullptr; } + ~ParentScope() { visitor_->current_parent_ = old_parent_; } + + ParentScope(const ParentScope&) = delete; + ParentScope& operator=(const ParentScope&) = delete; private: V8EmbedderGraphBuilder* const visitor_; + Traceable old_parent_; }; class State final { @@ -217,12 +234,12 @@ class GC_PLUGIN_IGNORE( return node_; } - void AddEdge(State* destination, std::string edge_name) { + void AddEdgeName(State* destination, std::string edge_name) { auto result = named_edges_.insert(destination, std::move(edge_name)); DCHECK(result.is_new_entry); } - void AddRootEdge(State* destination, std::string edge_name) { + void AddRootEdgeName(State* destination, std::string edge_name) { // State may represent root groups in which case there may exist multiple // references to the same |destination|. named_edges_.insert(destination, std::move(edge_name)); @@ -307,10 +324,12 @@ class GC_PLUGIN_IGNORE( class EphemeronItem final { public: - EphemeronItem(Traceable key, + EphemeronItem(Traceable backing, + Traceable key, Traceable value, TraceCallback value_tracing_callback) - : key_(key), + : backing_(backing), + key_(key), value_(value), value_tracing_callback_(value_tracing_callback) {} @@ -322,13 +341,16 @@ class GC_PLUGIN_IGNORE( if (!builder->StateExists(key_)) return false; { - TraceValuesScope scope(builder, key_); + ParentScope scope(builder, key_); + builder->current_ephemeron_backing_ = backing_; value_tracing_callback_(builder, const_cast(value_)); + builder->current_ephemeron_backing_ = nullptr; } return true; } private: + Traceable backing_; Traceable key_; Traceable value_; TraceCallback value_tracing_callback_; @@ -365,6 +387,7 @@ class GC_PLUGIN_IGNORE( } void AddEdge(State*, State*); + void AddEphemeronEdgeName(Traceable backing, State* parent, State* current); void VisitPersistentHandleInternal(v8::Local, uint16_t); void VisitPendingActivities(); @@ -390,27 +413,12 @@ class GC_PLUGIN_IGNORE( } } - class TraceValuesScope final { - STACK_ALLOCATED(); - DISALLOW_COPY_AND_ASSIGN(TraceValuesScope); - - public: - explicit TraceValuesScope(V8EmbedderGraphBuilder* graph_builder, - Traceable key) - : graph_builder_(graph_builder) { - graph_builder_->current_parent_ = key; - } - ~TraceValuesScope() { graph_builder_->current_parent_ = nullptr; } - - private: - V8EmbedderGraphBuilder* const graph_builder_; - }; - v8::Isolate* const isolate_; Graph* const graph_; NodeBuilder* const node_builder_; Traceable current_parent_ = nullptr; + Traceable current_ephemeron_backing_ = nullptr; HashMap states_; // Worklist that is used to visit transitive closure. Deque> worklist_; @@ -519,11 +527,42 @@ void V8EmbedderGraphBuilder::VisitRoot(const void* object, State* const current = GetOrCreateState( traceable, HeapObjectHeader::FromPayload(traceable)->Name(), Detachedness::kUnknown); - parent->AddRootEdge(current, location.ToString()); + parent->AddRootEdgeName(current, location.ToString()); } Visit(object, wrapper_descriptor); } +void V8EmbedderGraphBuilder::AddEphemeronEdgeName(Traceable backing, + State* parent, + State* current) { + const GCInfo& backing_info = GCInfo::From( + HeapObjectHeader::FromPayload(current_ephemeron_backing_)->GcInfoIndex()); + HeapObjectName backing_name = backing_info.name(current_ephemeron_backing_); + std::stringstream ss; + ss << "part of key -> value pair in ephemeron table"; + if (!backing_name.name_is_hidden) { + const std::string backing_name_str(backing_name.value); + const auto kvp_pos = backing_name_str.find("WTF::KeyValuePair"); + // Ephemerons are defined through WTF::KeyValuePair. + CHECK_NE(std::string::npos, kvp_pos); + // Extracting the pair TYPE from for WTF::KeyValuePair. + ss << " (<"; + size_t current_pos = kvp_pos + sizeof("WTF::KeyValuePair"); + CHECK_EQ('<', backing_name_str[current_pos - 1]); + size_t nesting = 0; + while (backing_name_str[current_pos] != '>' || (nesting > 0)) { + if (backing_name_str[current_pos] == '<') + nesting++; + if (backing_name_str[current_pos] == '>') + nesting--; + ss << backing_name_str[current_pos]; + current_pos++; + } + ss << ">)"; + } + parent->AddEdgeName(current, ss.str()); +} + void V8EmbedderGraphBuilder::Visit(const void* object, TraceDescriptor wrapper_descriptor) { const void* traceable = wrapper_descriptor.base_object_payload; @@ -534,6 +573,10 @@ void V8EmbedderGraphBuilder::Visit(const void* object, State* const parent = GetStateNotNull(current_parent_); State* const current = GetOrCreateState(traceable, name.value, Detachedness::kUnknown); + if (current_ephemeron_backing_) { + // Just records an edge name in case the state gets later on materialized. + AddEphemeronEdgeName(current_ephemeron_backing_, parent, current); + } if (current->IsPending()) { if (parent->HasNode()) { // Backedge in currently processed graph. @@ -561,21 +604,17 @@ void V8EmbedderGraphBuilder::Visit(const void* object, void V8EmbedderGraphBuilder::AddEdge(State* parent, State* current) { EmbedderNode* parent_node = parent->GetOrCreateNode(node_builder_); EmbedderNode* current_node = current->GetOrCreateNode(node_builder_); - if (parent_node->IsRootNode()) { - const std::string edge_name = parent->EdgeName(current); - if (!edge_name.empty()) { - // V8's API is based on raw C strings. Allocate and temporarily keep the - // edge name alive from the corresponding node. - const size_t len = edge_name.length(); - char* raw_location_string = new char[len + 1]; - strncpy(raw_location_string, edge_name.c_str(), len); - raw_location_string[len] = 0; - std::unique_ptr holder(raw_location_string); - graph_->AddEdge(parent_node, current_node, holder.get()); - static_cast(parent_node) - ->AddEdgeName(std::move(holder)); - return; - } + if (!parent->EdgeName(current).empty()) { + std::string edge_name = parent->EdgeName(current); + // V8's API is based on raw C strings. Allocate and temporarily keep the + // edge name alive from the corresponding node. + const size_t len = edge_name.length(); + auto holder = std::make_unique(len + 1); + strncpy(holder.get(), edge_name.c_str(), len); + holder[len] = 0; + graph_->AddEdge(parent_node, current_node, holder.get()); + parent_node->AddEdgeName(std::move(holder)); + return; } graph_->AddEdge(parent_node, current_node); } @@ -590,9 +629,14 @@ void V8EmbedderGraphBuilder::VisitWeakContainer( // Only ephemerons have weak callbacks. if (ephemeron_iteration.callback) { // Heap snapshot is always run after a GC so we know there are no dead - // entries in the backing store, thus it safe to trace it strongly. + // entries in the backing store. Using the weak descriptor here ensures that + // the key is not held alive from the backing store but rather from the + // object. A named edge ensures that we make the fact that value was held + // alive via ephemeron visible. if (object) { - Visit(object, strong_desc); + ParentScope parent(this, ephemeron_iteration.base_object_payload); + ephemeron_iteration.callback(this, + ephemeron_iteration.base_object_payload); } } } @@ -600,8 +644,10 @@ void V8EmbedderGraphBuilder::VisitWeakContainer( void V8EmbedderGraphBuilder::VisitEphemeron( const void* key, TraceDescriptor value_trace_descriptor) { + // During regular visitation of ephemerons, current_parent_ refers to the + // backing store. ephemeron_worklist_.push_back(std::make_unique( - key, value_trace_descriptor.base_object_payload, + current_parent_, key, value_trace_descriptor.base_object_payload, value_trace_descriptor.callback)); } @@ -687,3 +733,5 @@ void EmbedderGraphBuilder::BuildEmbedderGraphCallback(v8::Isolate* isolate, } } // namespace blink + +#endif // !USE_V8_OILPAN diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc index d36cb64149c..576f82e2406 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_gc_controller.cc @@ -53,6 +53,7 @@ #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/wtf/allocator/partitions.h" +#include "third_party/blink/renderer/platform/wtf/buildflags.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { @@ -75,23 +76,29 @@ Node* V8GCController::OpaqueRootForGC(v8::Isolate*, Node* node) { return node; } +#if !BUILDFLAG(USE_V8_OILPAN) namespace { - bool IsNestedInV8GC(ThreadState* thread_state, v8::GCType type) { return thread_state && (type == v8::kGCTypeMarkSweepCompact || type == v8::kGCTypeIncrementalMarking); } - } // namespace +#endif // !USE_V8_OILPAN void V8GCController::GcPrologue(v8::Isolate* isolate, v8::GCType type, v8::GCCallbackFlags flags) { RUNTIME_CALL_TIMER_SCOPE(isolate, RuntimeCallStats::CounterId::kGcPrologue); +#if !BUILDFLAG(USE_V8_OILPAN) ThreadHeapStatsCollector::BlinkGCInV8Scope nested_scope( IsNestedInV8GC(ThreadState::Current(), type) ? ThreadState::Current()->Heap().stats_collector() : nullptr); +#endif // !USE_V8_OILPAN + + auto* per_isolate_data = V8PerIsolateData::From(isolate); + per_isolate_data->EnterGC(); + ScriptForbiddenScope::Enter(); // Attribute garbage collection to the all frames instead of a specific @@ -105,14 +112,12 @@ void V8GCController::GcPrologue(v8::Isolate* isolate, case v8::kGCTypeIncrementalMarking: // Recomputing ASWs is opportunistic during incremental marking as they // only need to be recomputing during the atomic pause for corectness. - V8PerIsolateData::From(isolate) - ->GetActiveScriptWrappableManager() + per_isolate_data->GetActiveScriptWrappableManager() ->RecomputeActiveScriptWrappables( ActiveScriptWrappableManager::RecomputeMode::kOpportunistic); break; case v8::kGCTypeMarkSweepCompact: - V8PerIsolateData::From(isolate) - ->GetActiveScriptWrappableManager() + per_isolate_data->GetActiveScriptWrappableManager() ->RecomputeActiveScriptWrappables( ActiveScriptWrappableManager::RecomputeMode::kRequired); break; @@ -125,10 +130,15 @@ void V8GCController::GcEpilogue(v8::Isolate* isolate, v8::GCType type, v8::GCCallbackFlags flags) { RUNTIME_CALL_TIMER_SCOPE(isolate, RuntimeCallStats::CounterId::kGcEpilogue); +#if !BUILDFLAG(USE_V8_OILPAN) ThreadHeapStatsCollector::BlinkGCInV8Scope nested_scope( IsNestedInV8GC(ThreadState::Current(), type) ? ThreadState::Current()->Heap().stats_collector() : nullptr); +#endif // !USE_V8_OILPAN + + V8PerIsolateData::From(isolate)->LeaveGC(); + ScriptForbiddenScope::Exit(); if (BlameContext* blame_context = @@ -136,17 +146,8 @@ void V8GCController::GcEpilogue(v8::Isolate* isolate, blame_context->Leave(); ThreadState* current_thread_state = ThreadState::Current(); - if (current_thread_state && !current_thread_state->IsGCForbidden()) { - if (flags & v8::kGCCallbackFlagForced) { - // Forces a precise GC at the end of the current event loop. This is - // required for testing code that cannot use GC internals but rather has - // to rely on window.gc(). Only schedule additional GCs if the last GC was - // using conservative stack scanning. - if (type == v8::kGCTypeScavenge || - current_thread_state->RequiresForcedGCForTesting()) { - current_thread_state->ScheduleForcedGCForTesting(); - } - } + if (current_thread_state) { + current_thread_state->NotifyGarbageCollection(type, flags); } TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_gc_for_context_dispose.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_gc_for_context_dispose.cc index 0b6066eeb15..a64019b606c 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_gc_for_context_dispose.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_gc_for_context_dispose.cc @@ -49,7 +49,7 @@ static size_t GetMemoryUsage() { v8::HeapStatistics v8_heap_statistics; blink::V8PerIsolateData::MainThreadIsolate()->GetHeapStatistics( &v8_heap_statistics); - usage = v8_heap_statistics.total_heap_size(); + usage += v8_heap_statistics.total_heap_size(); return usage; } #endif // defined(OS_ANDROID) diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc index 3252caf9364..e0f8d19545f 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc @@ -92,8 +92,7 @@ namespace blink { static void ReportFatalErrorInMainThread(const char* location, const char* message) { - DVLOG(1) << "V8 error: " << message << " (" << location << ")."; - LOG(FATAL); + LOG(FATAL) << "V8 error: " << message << " (" << location << ")."; } static void ReportOOMErrorInMainThread(const char* location, bool is_js_heap) { @@ -477,20 +476,21 @@ static bool WasmCodeGenerationCheckCallbackInMainThread( return false; } -static bool WasmSimdEnabledCallback(v8::Local context) { +static bool WasmExceptionsEnabledCallback(v8::Local context) { ExecutionContext* execution_context = ToExecutionContext(context); if (!execution_context) return false; - return RuntimeEnabledFeatures::WebAssemblySimdEnabled(execution_context); + return RuntimeEnabledFeatures::WebAssemblyExceptionsEnabled( + execution_context); } -static bool WasmThreadsEnabledCallback(v8::Local context) { +static bool WasmSimdEnabledCallback(v8::Local context) { ExecutionContext* execution_context = ToExecutionContext(context); if (!execution_context) return false; - return RuntimeEnabledFeatures::WebAssemblyThreadsEnabled(execution_context); + return RuntimeEnabledFeatures::WebAssemblySimdEnabled(execution_context); } v8::Local NewRangeException(v8::Isolate* isolate, @@ -554,7 +554,8 @@ static bool WasmInstanceOverride( static v8::MaybeLocal HostImportModuleDynamically( v8::Local context, v8::Local v8_referrer, - v8::Local v8_specifier) { + v8::Local v8_specifier, + v8::Local v8_import_assertions) { ScriptState* script_state = ScriptState::From(context); Modulator* modulator = Modulator::From(script_state); @@ -599,14 +600,20 @@ static v8::MaybeLocal HostImportModuleDynamically( referrer_resource_url = KURL(NullURL(), referrer_resource_url_str); } + ModuleRequest module_request( + specifier, TextPosition(), + ModuleRecord::ToBlinkImportAssertions( + script_state->GetContext(), v8::Local(), + v8_import_assertions, /*v8_import_assertions_has_positions=*/false)); + ReferrerScriptInfo referrer_info = ReferrerScriptInfo::FromV8HostDefinedOptions( context, v8_referrer->GetHostDefinedOptions()); auto* resolver = MakeGarbageCollected(script_state); ScriptPromise promise = resolver->Promise(); - modulator->ResolveDynamically(specifier, referrer_resource_url, referrer_info, - resolver); + modulator->ResolveDynamically(module_request, referrer_resource_url, + referrer_info, resolver); return v8::Local::Cast(promise.V8Value()); } @@ -644,8 +651,8 @@ static void InitializeV8Common(v8::Isolate* isolate) { isolate->SetUseCounterCallback(&UseCounterCallback); isolate->SetWasmModuleCallback(WasmModuleOverride); isolate->SetWasmInstanceCallback(WasmInstanceOverride); + isolate->SetWasmExceptionsEnabledCallback(WasmExceptionsEnabledCallback); isolate->SetWasmSimdEnabledCallback(WasmSimdEnabledCallback); - isolate->SetWasmThreadsEnabledCallback(WasmThreadsEnabledCallback); isolate->SetHostImportModuleDynamicallyCallback(HostImportModuleDynamically); isolate->SetHostInitializeImportMetaObjectCallback( HostGetImportMetaProperties); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_metrics.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_metrics.cc index 2fe305a01a9..acbade0fe67 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_metrics.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_metrics.cc @@ -26,7 +26,7 @@ void V8MetricsRecorder::AddMainThreadEvent( .SetModuleSize( ukm::GetExponentialBucketMinForBytes(event.module_size_in_bytes)) .SetFunctionCount(event.function_count) - .SetWallClockTime(event.wall_clock_time_in_us) + .SetWallClockDuration(event.wall_clock_duration_in_us) .Record(ukm->recorder); } @@ -46,7 +46,7 @@ void V8MetricsRecorder::AddMainThreadEvent( .SetCodeSize( ukm::GetExponentialBucketMinForBytes(event.code_size_in_bytes)) .SetLiftoffBailoutCount(event.liftoff_bailout_count) - .SetWallClockTime(event.wall_clock_time_in_us) + .SetWallClockDuration(event.wall_clock_duration_in_us) .Record(ukm->recorder); } @@ -59,7 +59,7 @@ void V8MetricsRecorder::AddMainThreadEvent( ukm::builders::V8_Wasm_ModuleInstantiated(ukm->source_id) .SetSuccess(event.success ? 1 : 0) .SetImportedFunctionCount(event.imported_function_count) - .SetWallClockTime(event.wall_clock_time_in_us) + .SetWallClockDuration(event.wall_clock_duration_in_us) .Record(ukm->recorder); } @@ -73,7 +73,7 @@ void V8MetricsRecorder::AddMainThreadEvent( .SetLazy(event.lazy ? 1 : 0) .SetCodeSize( ukm::GetExponentialBucketMinForBytes(event.code_size_in_bytes)) - .SetWallClockTime(event.wall_clock_time_in_us) + .SetWallClockDuration(event.wall_clock_duration_in_us) .Record(ukm->recorder); } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_object_parser.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_object_parser.cc index cb2fe11556e..9e23d8cbaae 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_object_parser.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_object_parser.cc @@ -38,7 +38,7 @@ bool V8ObjectParser::ParseCSSPropertyList( return false; for (const auto& property : properties) { - CSSPropertyID property_id = cssPropertyID(execution_context, property); + CSSPropertyID property_id = CssPropertyID(execution_context, property); if (property_id == CSSPropertyID::kVariable) { custom_properties->push_back(std::move(property)); } else if (property_id != CSSPropertyID::kInvalid) { diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc index f6dac9b6d13..29f65c22b3b 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc @@ -39,14 +39,18 @@ #include "third_party/blink/renderer/bindings/core/v8/v8_code_cache.h" #include "third_party/blink/renderer/bindings/core/v8/v8_initializer.h" #include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" +#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/core/execution_context/agent.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" +#include "third_party/blink/renderer/core/loader/modulescript/module_script_creation_params.h" #include "third_party/blink/renderer/core/probe/core_probes.h" +#include "third_party/blink/renderer/core/script/classic_script.h" #include "third_party/blink/renderer/core/script/modulator.h" #include "third_party/blink/renderer/core/script/module_script.h" +#include "third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h" #include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h" #include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h" @@ -220,16 +224,13 @@ v8::MaybeLocal V8ScriptRunner::CompileScript( // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at // 1, whereas v8 starts at 0. v8::ScriptOrigin origin( - V8String(isolate, file_name), - v8::Integer::New(isolate, script_start_position.line_.ZeroBasedInt()), - v8::Integer::New(isolate, script_start_position.column_.ZeroBasedInt()), - v8::Boolean::New(isolate, sanitize_script_errors == - SanitizeScriptErrors::kDoNotSanitize), - v8::Local(), V8String(isolate, source.SourceMapUrl()), - v8::Boolean::New( - isolate, sanitize_script_errors == SanitizeScriptErrors::kSanitize), - v8::False(isolate), // is_wasm - v8::False(isolate), // is_module + V8String(isolate, file_name), script_start_position.line_.ZeroBasedInt(), + script_start_position.column_.ZeroBasedInt(), + sanitize_script_errors == SanitizeScriptErrors::kDoNotSanitize, -1, + V8String(isolate, source.SourceMapUrl()), + sanitize_script_errors == SanitizeScriptErrors::kSanitize, + false, // is_wasm + false, // is_module referrer_info.ToV8HostDefinedOptions(isolate)); if (!*TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(kTraceEventCategoryGroup)) { @@ -250,74 +251,82 @@ v8::MaybeLocal V8ScriptRunner::CompileScript( v8::MaybeLocal V8ScriptRunner::CompileModule( v8::Isolate* isolate, - const String& source_text, - SingleCachedMetadataHandler* cache_handler, - const String& file_name, + const ModuleScriptCreationParams& params, const TextPosition& start_position, v8::ScriptCompiler::CompileOptions compile_options, v8::ScriptCompiler::NoCacheReason no_cache_reason, const ReferrerScriptInfo& referrer_info) { + const String file_name = params.SourceURL(); constexpr const char* kTraceEventCategoryGroup = "v8,devtools.timeline"; TRACE_EVENT_BEGIN1(kTraceEventCategoryGroup, "v8.compileModule", "fileName", file_name.Utf8()); // |resource_is_shared_cross_origin| is always true and |resource_is_opaque| // is always false because CORS is enforced to module scripts. - v8::ScriptOrigin origin( - V8String(isolate, file_name), - v8::Integer::New(isolate, start_position.line_.ZeroBasedInt()), - v8::Integer::New(isolate, start_position.column_.ZeroBasedInt()), - v8::Boolean::New(isolate, true), // resource_is_shared_cross_origin - v8::Local(), // script id - v8::String::Empty(isolate), // source_map_url - v8::Boolean::New(isolate, false), // resource_is_opaque - v8::False(isolate), // is_wasm - v8::True(isolate), // is_module - referrer_info.ToV8HostDefinedOptions(isolate)); - - v8::Local code = V8String(isolate, source_text); - - v8::MaybeLocal script; + v8::ScriptOrigin origin(V8String(isolate, file_name), + start_position.line_.ZeroBasedInt(), + start_position.column_.ZeroBasedInt(), + true, // resource_is_shared_cross_origin + -1, // script id + v8::String::Empty(isolate), // source_map_url + false, // resource_is_opaque + false, // is_wasm + true, // is_module + referrer_info.ToV8HostDefinedOptions(isolate)); + + v8::Local code = V8String(isolate, params.GetSourceText()); inspector_compile_script_event::V8CacheResult cache_result; + v8::MaybeLocal script; + ScriptStreamer* streamer = params.GetScriptStreamer(); + if (streamer) { + // Final compile call for a streamed compilation. + // Streaming compilation may involve use of code cache. + // TODO(leszeks): Add compile timer to streaming compilation. + DCHECK(streamer->IsFinished()); + DCHECK(!streamer->IsStreamingSuppressed()); + script = v8::ScriptCompiler::CompileModule( + isolate->GetCurrentContext(), streamer->Source(), code, origin); + } else { + switch (compile_options) { + case v8::ScriptCompiler::kNoCompileOptions: + case v8::ScriptCompiler::kEagerCompile: { + v8::ScriptCompiler::Source source(code, origin); + script = v8::ScriptCompiler::CompileModule( + isolate, &source, compile_options, no_cache_reason); + break; + } - switch (compile_options) { - case v8::ScriptCompiler::kNoCompileOptions: - case v8::ScriptCompiler::kEagerCompile: { - v8::ScriptCompiler::Source source(code, origin); - script = v8::ScriptCompiler::CompileModule( - isolate, &source, compile_options, no_cache_reason); - break; - } - - case v8::ScriptCompiler::kConsumeCodeCache: { - // Compile a script, and consume a V8 cache that was generated previously. - DCHECK(cache_handler); - v8::ScriptCompiler::CachedData* cached_data = - V8CodeCache::CreateCachedData(cache_handler); - v8::ScriptCompiler::Source source(code, origin, cached_data); - script = v8::ScriptCompiler::CompileModule( - isolate, &source, compile_options, no_cache_reason); - if (cached_data->rejected) { - cache_handler->ClearCachedMetadata( - CachedMetadataHandler::kClearPersistentStorage); - } else if (InDiscardExperiment()) { - // Experimentally free code cache from memory after first use. See - // http://crbug.com/1045052. - cache_handler->ClearCachedMetadata( - CachedMetadataHandler::kDiscardLocally); + case v8::ScriptCompiler::kConsumeCodeCache: { + // Compile a script, and consume a V8 cache that was generated + // previously. + SingleCachedMetadataHandler* cache_handler = params.CacheHandler(); + DCHECK(cache_handler); + v8::ScriptCompiler::CachedData* cached_data = + V8CodeCache::CreateCachedData(cache_handler); + v8::ScriptCompiler::Source source(code, origin, cached_data); + script = v8::ScriptCompiler::CompileModule( + isolate, &source, compile_options, no_cache_reason); + if (cached_data->rejected) { + cache_handler->ClearCachedMetadata( + CachedMetadataHandler::kClearPersistentStorage); + } else if (InDiscardExperiment()) { + // Experimentally free code cache from memory after first use. See + // http://crbug.com/1045052. + cache_handler->ClearCachedMetadata( + CachedMetadataHandler::kDiscardLocally); + } + cache_result.consume_result = base::make_optional( + inspector_compile_script_event::V8CacheResult::ConsumeResult( + compile_options, cached_data->length, cached_data->rejected)); + break; } - cache_result.consume_result = base::make_optional( - inspector_compile_script_event::V8CacheResult::ConsumeResult( - compile_options, cached_data->length, cached_data->rejected)); - break; } } TRACE_EVENT_END1(kTraceEventCategoryGroup, "v8.compileModule", "data", inspector_compile_script_event::Data( - file_name, start_position, cache_result, false, - ScriptStreamer::NotStreamingReason::kModuleScript)); - + file_name, start_position, cache_result, streamer, + params.NotStreamingReason())); return script; } @@ -370,19 +379,49 @@ v8::MaybeLocal V8ScriptRunner::RunCompiledScript( } ScriptEvaluationResult V8ScriptRunner::CompileAndRunScript( - v8::Isolate* isolate, ScriptState* script_state, - ExecutionContext* execution_context, - const ScriptSourceCode& source, - const KURL& base_url, - SanitizeScriptErrors sanitize_script_errors, - const ScriptFetchOptions& fetch_options, - mojom::blink::V8CacheOptions v8_cache_options, + ClassicScript* classic_script, + ExecuteScriptPolicy policy, RethrowErrorsOption rethrow_errors) { - DCHECK_EQ(isolate, script_state->GetIsolate()); + if (!script_state) + return ScriptEvaluationResult::FromClassicNotRun(); + + // |script_state->GetContext()| must be initialized here already, typically + // due to a WindowProxy() call inside ToScriptState*() that is used to get the + // ScriptState. + + ExecutionContext* execution_context = ExecutionContext::From(script_state); + DCHECK(execution_context->IsContextThread()); + + if (policy == ExecuteScriptPolicy::kDoNotExecuteScriptWhenScriptsDisabled && + !execution_context->CanExecuteScripts(kAboutToExecuteScript)) { + return ScriptEvaluationResult::FromClassicNotRun(); + } + + v8::Isolate* isolate = script_state->GetIsolate(); + const ScriptSourceCode& source = classic_script->GetScriptSourceCode(); + const SanitizeScriptErrors sanitize_script_errors = + classic_script->GetSanitizeScriptErrors(); LocalDOMWindow* window = DynamicTo(execution_context); + WorkerOrWorkletGlobalScope* worker_or_worklet_global_scope = + DynamicTo(execution_context); LocalFrame* frame = window ? window->GetFrame() : nullptr; + + if (window && window->document()->IsInitialEmptyDocument()) { + window->GetFrame()->Loader().DidAccessInitialDocument(); + } else if (worker_or_worklet_global_scope) { + DCHECK_EQ( + script_state, + worker_or_worklet_global_scope->ScriptController()->GetScriptState()); + DCHECK(worker_or_worklet_global_scope->ScriptController() + ->IsContextInitialized()); + DCHECK(worker_or_worklet_global_scope->ScriptController() + ->IsReadyToEvaluate()); + } + + v8::Context::Scope scope(script_state->GetContext()); + TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", inspector_evaluate_script_event::Data( frame, source.Url().GetString(), source.StartPosition())); @@ -403,6 +442,7 @@ ScriptEvaluationResult V8ScriptRunner::CompileAndRunScript( // Omit storing base URL if it is same as source URL. // Note: This improves chance of getting into a fast path in // ReferrerScriptInfo::ToV8HostDefinedOptions. + const KURL base_url = classic_script->BaseURL(); KURL stored_base_url = (base_url == source.Url()) ? KURL() : base_url; // TODO(hiroshige): Remove this code and related use counters once the @@ -423,8 +463,8 @@ ScriptEvaluationResult V8ScriptRunner::CompileAndRunScript( break; } } - const ReferrerScriptInfo referrer_info(stored_base_url, fetch_options, - base_url_source); + const ReferrerScriptInfo referrer_info( + stored_base_url, classic_script->FetchOptions(), base_url_source); v8::Local script; @@ -432,7 +472,8 @@ ScriptEvaluationResult V8ScriptRunner::CompileAndRunScript( V8CodeCache::ProduceCacheOptions produce_cache_options; v8::ScriptCompiler::NoCacheReason no_cache_reason; std::tie(compile_options, produce_cache_options, no_cache_reason) = - V8CodeCache::GetCompileOptions(v8_cache_options, source); + V8CodeCache::GetCompileOptions(execution_context->GetV8CacheOptions(), + source); v8::MaybeLocal maybe_result; if (V8ScriptRunner::CompileScript(script_state, source, @@ -449,6 +490,8 @@ ScriptEvaluationResult V8ScriptRunner::CompileAndRunScript( // TODO(crbug/1114601): Investigate whether to check CanContinue() in other // script evaluation code paths. if (!try_catch.CanContinue()) { + if (worker_or_worklet_global_scope) + worker_or_worklet_global_scope->ScriptController()->ForbidExecution(); return ScriptEvaluationResult::FromClassicAborted(); } @@ -671,6 +714,10 @@ ScriptEvaluationResult V8ScriptRunner::EvaluateModule( ExecutionContext* execution_context = ExecutionContext::From(script_state); v8::Isolate* isolate = script_state->GetIsolate(); + // TODO(crbug.com/1151165): Ideally v8::Context should be entered before + // CanExecuteScripts(). + v8::Context::Scope scope(script_state->GetContext()); + // Check if we can run script with settings. If this returns // "do not run" then return NormalCompletion(empty). if (!execution_context->CanExecuteScripts(kAboutToExecuteScript)) { @@ -683,7 +730,6 @@ ScriptEvaluationResult V8ScriptRunner::EvaluateModule( v8::MicrotasksScope microtasks_scope(isolate, ToMicrotaskQueue(execution_context), v8::MicrotasksScope::kRunMicrotasks); - ScriptState::EscapableScope scope(script_state); // Without TLA: Let evaluationStatus be null. ScriptEvaluationResult result = ScriptEvaluationResult::FromModuleNotRun(); @@ -727,11 +773,20 @@ ScriptEvaluationResult V8ScriptRunner::EvaluateModule( // Do not perform a microtask checkpoint here. A checkpoint is performed // only after module error handling to ensure proper timing with and // without top-level await. + + v8::MaybeLocal maybe_result = + record->Evaluate(script_state->GetContext()); + + if (!try_catch.CanContinue()) + return ScriptEvaluationResult::FromModuleAborted(); + v8::Local v8_result; - if (!record->Evaluate(script_state->GetContext()).ToLocal(&v8_result)) { + if (!maybe_result.ToLocal(&v8_result)) { + DCHECK(try_catch.HasCaught()); result = ScriptEvaluationResult::FromModuleException(try_catch.Exception()); } else { + DCHECK(!try_catch.HasCaught()); result = ScriptEvaluationResult::FromModuleSuccess(v8_result); } @@ -775,9 +830,9 @@ ScriptEvaluationResult V8ScriptRunner::EvaluateModule( } // Clean up after running script with settings. - // - Partially implement in MicrotaskScope destructor and the - // - ScriptState::EscapableScope destructor. - return result.Escape(&scope); + // Partially implemented in MicrotaskScope destructor and the + // v8::Context::Scope destructor. + return result; } void V8ScriptRunner::ReportException(v8::Isolate* isolate, diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.h b/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.h index 65b88676e1b..1bf869adf64 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner.h @@ -26,7 +26,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_SCRIPT_RUNNER_H_ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_SCRIPT_RUNNER_H_ -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" @@ -40,15 +39,19 @@ class TextPosition; namespace blink { -class ScriptEvaluationResult; +class ClassicScript; class ExecutionContext; -class KURL; class ModuleScript; +class ModuleScriptCreationParams; class ReferrerScriptInfo; -class ScriptFetchOptions; +class ScriptEvaluationResult; class ScriptSourceCode; class ScriptState; -class SingleCachedMetadataHandler; + +enum class ExecuteScriptPolicy { + kExecuteScriptWhenScriptsDisabled, + kDoNotExecuteScriptWhenScriptsDisabled +}; class CORE_EXPORT V8ScriptRunner final { STATIC_ONLY(V8ScriptRunner); @@ -114,23 +117,15 @@ class CORE_EXPORT V8ScriptRunner final { const ReferrerScriptInfo&); static v8::MaybeLocal CompileModule( v8::Isolate*, - const String& source, - SingleCachedMetadataHandler*, - const String& file_name, + const ModuleScriptCreationParams&, const WTF::TextPosition&, v8::ScriptCompiler::CompileOptions, v8::ScriptCompiler::NoCacheReason, const ReferrerScriptInfo&); - static ScriptEvaluationResult CompileAndRunScript( - v8::Isolate*, - ScriptState*, - ExecutionContext*, - const ScriptSourceCode&, - const KURL&, - SanitizeScriptErrors, - const ScriptFetchOptions&, - mojom::blink::V8CacheOptions, - RethrowErrorsOption); + static ScriptEvaluationResult CompileAndRunScript(ScriptState*, + ClassicScript*, + ExecuteScriptPolicy, + RethrowErrorsOption); static v8::MaybeLocal CompileAndRunInternalScript( v8::Isolate*, ScriptState*, diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc index d9d550eed55..53e97a49e2f 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_script_runner_test.cc @@ -106,7 +106,7 @@ class V8ScriptRunnerTest : public testing::Test { String code = Code(); ResourceResponse response(Url()); response.SetHttpStatusCode(200); - resource->SetResponse(response); + resource->ResponseReceived(response); StringUTF8Adaptor code_utf8(code); resource->AppendData(code_utf8.data(), code_utf8.size()); resource->FinishForTest(); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.cc deleted file mode 100644 index fb9ec7b35ca..00000000000 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.cc +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.h" - -#include -#include "third_party/blink/renderer/bindings/core/v8/script_controller.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_element.h" -#include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/platform/bindings/dom_data_store.h" -#include "third_party/blink/renderer/platform/bindings/v0_custom_element_binding.h" -#include "third_party/blink/renderer/platform/bindings/v8_per_context_data.h" -#include "third_party/blink/renderer/platform/bindings/v8_private_property.h" - -namespace blink { - -#define CALLBACK_LIST(V) \ - V(created, CreatedCallback) \ - V(attached, AttachedCallback) \ - V(detached, DetachedCallback) \ - V(attribute_changed, AttributeChangedCallback) - -static V0CustomElementLifecycleCallbacks::CallbackType FlagSet( - v8::MaybeLocal attached, - v8::MaybeLocal detached, - v8::MaybeLocal attribute_changed) { - // V8 Custom Elements always run created to swizzle prototypes. - int flags = V0CustomElementLifecycleCallbacks::kCreatedCallback; - - if (!attached.IsEmpty()) - flags |= V0CustomElementLifecycleCallbacks::kAttachedCallback; - - if (!detached.IsEmpty()) - flags |= V0CustomElementLifecycleCallbacks::kDetachedCallback; - - if (!attribute_changed.IsEmpty()) - flags |= V0CustomElementLifecycleCallbacks::kAttributeChangedCallback; - - return V0CustomElementLifecycleCallbacks::CallbackType(flags); -} - -V8V0CustomElementLifecycleCallbacks::V8V0CustomElementLifecycleCallbacks( - ScriptState* script_state, - v8::Local prototype, - v8::MaybeLocal created, - v8::MaybeLocal attached, - v8::MaybeLocal detached, - v8::MaybeLocal attribute_changed) - : V0CustomElementLifecycleCallbacks( - FlagSet(attached, detached, attribute_changed)), - script_state_(script_state), - prototype_(script_state->GetIsolate(), prototype){ - v8::Isolate* isolate = script_state->GetIsolate(); - v8::Local function; - -// A given object can only be used as a Custom Element prototype -// once; see customElementIsInterfacePrototypeObject -#define SET_PRIVATE_PROPERTY(Maybe, Name) \ - static const V8PrivateProperty::SymbolKey kPrivateProperty##Name; \ - V8PrivateProperty::Symbol symbol##Name = \ - V8PrivateProperty::GetSymbol(isolate, kPrivateProperty##Name); \ - DCHECK(!symbol##Name.HasValue(prototype)); \ - { \ - if (Maybe.ToLocal(&function)) \ - symbol##Name.Set(prototype, function); \ - } - - CALLBACK_LIST(SET_PRIVATE_PROPERTY) -#undef SET_PRIVATE_PROPERTY - -#define SET_FIELD(maybe, ignored) \ - if (maybe.ToLocal(&function)) \ - maybe##_.Set(isolate, function); - - CALLBACK_LIST(SET_FIELD) -#undef SET_FIELD -} - -V8PerContextData* V8V0CustomElementLifecycleCallbacks::CreationContextData() { - if (!script_state_->ContextIsValid()) - return nullptr; - - v8::Local context = script_state_->GetContext(); - if (context.IsEmpty()) - return nullptr; - - return V8PerContextData::From(context); -} - -V8V0CustomElementLifecycleCallbacks::~V8V0CustomElementLifecycleCallbacks() = - default; - -bool V8V0CustomElementLifecycleCallbacks::SetBinding( - std::unique_ptr binding) { - V8PerContextData* per_context_data = CreationContextData(); - if (!per_context_data) - return false; - - // The context is responsible for keeping the prototype - // alive. This in turn keeps callbacks alive through hidden - // references; see CALLBACK_LIST(SET_HIDDEN_VALUE). - per_context_data->AddCustomElementBinding(std::move(binding)); - return true; -} - -void V8V0CustomElementLifecycleCallbacks::Created(Element* element) { - // FIXME: callbacks while paused should be queued up for execution to - // continue then be delivered in order rather than delivered immediately. - // Bug 329665 tracks similar behavior for other synchronous events. - if (!script_state_->ContextIsValid()) - return; - - element->SetV0CustomElementState(Element::kV0Upgraded); - - ScriptState::Scope scope(script_state_); - v8::Isolate* isolate = script_state_->GetIsolate(); - v8::Local context = script_state_->GetContext(); - v8::Local receiver_value = - ToV8(element, context->Global(), isolate); - if (receiver_value.IsEmpty()) - return; - v8::Local receiver = receiver_value.As(); - - // Swizzle the prototype of the wrapper. - v8::Local prototype = prototype_.NewLocal(isolate); - bool set_prototype; - if (prototype.IsEmpty() || - !receiver->SetPrototype(context, prototype).To(&set_prototype) || - !set_prototype) { - return; - } - - v8::Local callback = created_.NewLocal(isolate); - if (callback.IsEmpty()) - return; - - v8::TryCatch exception_catcher(isolate); - exception_catcher.SetVerbose(true); - V8ScriptRunner::CallFunction(callback, ExecutionContext::From(script_state_), - receiver, 0, nullptr, isolate); -} - -void V8V0CustomElementLifecycleCallbacks::Attached(Element* element) { - Call(attached_, element); -} - -void V8V0CustomElementLifecycleCallbacks::Detached(Element* element) { - Call(detached_, element); -} - -void V8V0CustomElementLifecycleCallbacks::AttributeChanged( - Element* element, - const AtomicString& name, - const AtomicString& old_value, - const AtomicString& new_value) { - // FIXME: callbacks while paused should be queued up for execution to - // continue then be delivered in order rather than delivered immediately. - // Bug 329665 tracks similar behavior for other synchronous events. - if (!script_state_->ContextIsValid()) - return; - ScriptState::Scope scope(script_state_); - v8::Isolate* isolate = script_state_->GetIsolate(); - v8::Local context = script_state_->GetContext(); - v8::Local receiver = ToV8(element, context->Global(), isolate); - if (receiver.IsEmpty()) - return; - - v8::Local callback = attribute_changed_.NewLocal(isolate); - if (callback.IsEmpty()) - return; - - v8::Local argv[] = { - V8String(isolate, name), - old_value.IsNull() ? v8::Local(v8::Null(isolate)) - : v8::Local(V8String(isolate, old_value)), - new_value.IsNull() ? v8::Local(v8::Null(isolate)) - : v8::Local(V8String(isolate, new_value))}; - - v8::TryCatch exception_catcher(isolate); - exception_catcher.SetVerbose(true); - V8ScriptRunner::CallFunction(callback, ExecutionContext::From(script_state_), - receiver, base::size(argv), argv, isolate); -} - -void V8V0CustomElementLifecycleCallbacks::Call( - const TraceWrapperV8Reference& callback_reference, - Element* element) { - // FIXME: callbacks while paused should be queued up for execution to - // continue then be delivered in order rather than delivered immediately. - // Bug 329665 tracks similar behavior for other synchronous events. - if (!script_state_->ContextIsValid()) - return; - ScriptState::Scope scope(script_state_); - v8::Isolate* isolate = script_state_->GetIsolate(); - v8::Local context = script_state_->GetContext(); - v8::Local callback = callback_reference.NewLocal(isolate); - if (callback.IsEmpty()) - return; - - v8::Local receiver = ToV8(element, context->Global(), isolate); - if (receiver.IsEmpty()) - return; - - v8::TryCatch exception_catcher(isolate); - exception_catcher.SetVerbose(true); - V8ScriptRunner::CallFunction(callback, ExecutionContext::From(script_state_), - receiver, 0, nullptr, isolate); -} - -void V8V0CustomElementLifecycleCallbacks::Trace(Visitor* visitor) const { - visitor->Trace(script_state_); - visitor->Trace(prototype_); - visitor->Trace(created_); - visitor->Trace(attached_); - visitor->Trace(detached_); - visitor->Trace(attribute_changed_); - V0CustomElementLifecycleCallbacks::Trace(visitor); -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.h b/chromium/third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.h deleted file mode 100644 index 3376747456a..00000000000 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_v0_custom_element_lifecycle_callbacks.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_V0_CUSTOM_ELEMENT_LIFECYCLE_CALLBACKS_H_ -#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_V0_CUSTOM_ELEMENT_LIFECYCLE_CALLBACKS_H_ - -#include - -#include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/core/html/custom/v0_custom_element_lifecycle_callbacks.h" -#include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" -#include "v8/include/v8.h" - -namespace blink { - -class V0CustomElementBinding; -class V0CustomElementLifecycleCallbacks; -class Element; -class V8PerContextData; - -class V8V0CustomElementLifecycleCallbacks final - : public V0CustomElementLifecycleCallbacks { - public: - V8V0CustomElementLifecycleCallbacks( - ScriptState*, - v8::Local prototype, - v8::MaybeLocal created, - v8::MaybeLocal attached, - v8::MaybeLocal detached, - v8::MaybeLocal attribute_changed); - ~V8V0CustomElementLifecycleCallbacks() override; - - bool SetBinding(std::unique_ptr); - - void Trace(Visitor*) const override; - - private: - void Created(Element*) override; - void Attached(Element*) override; - void Detached(Element*) override; - void AttributeChanged(Element*, - const AtomicString& name, - const AtomicString& old_value, - const AtomicString& new_value) override; - - void Call(const TraceWrapperV8Reference& callback_reference, - Element*); - - V8PerContextData* CreationContextData(); - - Member script_state_; - TraceWrapperV8Reference prototype_; - TraceWrapperV8Reference created_; - TraceWrapperV8Reference attached_; - TraceWrapperV8Reference detached_; - TraceWrapperV8Reference attribute_changed_; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_V0_CUSTOM_ELEMENT_LIFECYCLE_CALLBACKS_H_ diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc b/chromium/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc index 5ba2f110ca8..eda5ba6c23d 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc @@ -23,8 +23,6 @@ #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/loader/fetch/cached_metadata.h" -#include "third_party/blink/renderer/platform/loader/fetch/raw_resource.h" -#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" @@ -207,39 +205,6 @@ class ExceptionToAbortStreamingScope { DISALLOW_COPY_AND_ASSIGN(ExceptionToAbortStreamingScope); }; -RawResource* GetRawResource(ScriptState* script_state, - const String& url_string, - Response* response) { - ExecutionContext* execution_context = ExecutionContext::From(script_state); - if (!execution_context) - return nullptr; - ResourceFetcher* fetcher = execution_context->Fetcher(); - if (!fetcher) - return nullptr; - KURL url(url_string); - if (!url.IsValid()) - return nullptr; - Resource* resource = fetcher->CachedResource(url); - if (!resource) - return nullptr; - - // Make sure the resource matches the |response|. To check that, we make sure - // the response times match, and the response sources match. - const ResourceResponse& resource_response = resource->GetResponse(); - const FetchResponseData* fetch_response_data = - response->GetResponse()->InternalResponse(); - if (resource_response.ResponseTime() != fetch_response_data->ResponseTime()) - return nullptr; - bool from_service_worker = fetch_response_data->ResponseSource() == - network::mojom::FetchResponseSource::kUnspecified; - if (resource_response.WasFetchedViaServiceWorker() != from_service_worker) - return nullptr; - - // Wasm modules should be fetched as raw resources. - DCHECK_EQ(ResourceType::kRaw, resource->GetType()); - return ToRawResource(resource); -} - class WasmStreamingClient : public v8::WasmStreaming::Client { public: WasmStreamingClient(const String& response_url, @@ -362,35 +327,32 @@ void StreamFromResponseCallback( String url = response->url(); const std::string& url_utf8 = url.Utf8(); streaming->SetUrl(url_utf8.c_str(), url_utf8.size()); - RawResource* resource = GetRawResource(script_state, url, response); - if (resource) { - SingleCachedMetadataHandler* cache_handler = resource->ScriptCacheHandler(); - if (cache_handler) { - auto client = std::make_shared( - url, resource->GetResponse().ResponseTime()); - streaming->SetClient(client); - scoped_refptr cached_module = - cache_handler->GetCachedMetadata(kWasmModuleTag); - if (cached_module) { - TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), - "v8.wasm.moduleCacheHit", TRACE_EVENT_SCOPE_THREAD, - "url", url.Utf8(), "consumedCacheSize", - cached_module->size()); - bool is_valid = streaming->SetCompiledModuleBytes( - reinterpret_cast(cached_module->Data()), - cached_module->size()); - if (is_valid) { - // Keep the buffer alive until V8 is ready to deserialize it. - // TODO(bbudge) V8 should notify us if deserialization fails, so we - // can release the data and reset the cache. - client->SetBuffer(cached_module); - } else { - TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), - "v8.wasm.moduleCacheInvalid", - TRACE_EVENT_SCOPE_THREAD); - cache_handler->ClearCachedMetadata( - CachedMetadataHandler::kClearPersistentStorage); - } + if (auto* cache_handler = + response->BodyBuffer()->GetCachedMetadataHandler()) { + auto client = std::make_shared( + url, response->GetResponse()->InternalResponse()->ResponseTime()); + streaming->SetClient(client); + scoped_refptr cached_module = + cache_handler->GetCachedMetadata(kWasmModuleTag); + if (cached_module) { + TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), + "v8.wasm.moduleCacheHit", TRACE_EVENT_SCOPE_THREAD, + "url", url.Utf8(), "consumedCacheSize", + cached_module->size()); + bool is_valid = streaming->SetCompiledModuleBytes( + reinterpret_cast(cached_module->Data()), + cached_module->size()); + if (is_valid) { + // Keep the buffer alive until V8 is ready to deserialize it. + // TODO(bbudge) V8 should notify us if deserialization fails, so we + // can release the data and reset the cache. + client->SetBuffer(cached_module); + } else { + TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), + "v8.wasm.moduleCacheInvalid", + TRACE_EVENT_SCOPE_THREAD); + cache_handler->ClearCachedMetadata( + CachedMetadataHandler::kClearPersistentStorage); } } } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy.cc b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy.cc index b57941ba35e..8e590ffed40 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy.cc @@ -50,6 +50,7 @@ WindowProxy::~WindowProxy() { void WindowProxy::Trace(Visitor* visitor) const { visitor->Trace(frame_); + visitor->Trace(global_proxy_); } WindowProxy::WindowProxy(v8::Isolate* isolate, @@ -94,9 +95,9 @@ v8::Local WindowProxy::ReleaseGlobalProxy() { lifecycle_ == Lifecycle::kGlobalObjectIsDetached); // Make sure the global object was detached from the proxy by calling - // clearForNavigation(). + // ClearForSwap(). DLOG_IF(FATAL, is_global_object_attached_) - << "Context not detached by calling clearForNavigation()"; + << "Context not detached by calling ClearForSwap()"; v8::Local global_proxy = global_proxy_.NewLocal(isolate_); global_proxy_.Clear(); @@ -108,6 +109,10 @@ void WindowProxy::SetGlobalProxy(v8::Local global_proxy) { CHECK(global_proxy_.IsEmpty()); global_proxy_.Set(isolate_, global_proxy); + // The global proxy was transferred from a previous WindowProxy, so the state + // should be detached, not uninitialized. This ensures that it will be + // properly reinitialized when needed, e.g. by `UpdateDocument()`. + lifecycle_ = Lifecycle::kGlobalObjectIsDetached; } // Create a new environment and setup the global object. diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy.h b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy.h index 4323a5c7f20..56f808fe995 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy.h @@ -34,7 +34,7 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" -#include "third_party/blink/renderer/platform/bindings/scoped_persistent.h" +#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "v8/include/v8.h" @@ -277,11 +277,20 @@ class WindowProxy : public GarbageCollected { protected: // TODO(dcheng): Consider making these private and using getters. const scoped_refptr world_; - // |global_proxy_| is the root reference from Blink to v8::Context (a strong - // reference to the global proxy makes the entire context alive). In order to - // discard the v8::Context, |global_proxy_| needs to be a weak reference or - // to be destroyed. - ScopedPersistent global_proxy_; + // Note: this used to be a ScopedPersistent, making `global_proxy_` a strong + // GC root from Blink to v8::Context. When the context was disposed (e.g. when + // detaching the frame or purging v8), it was important to call `SetPhantom()` + // to convert `global_proxy_` to a weak GC root. Otherwise, even if + // `WindowProxy` was no longer reachable via Blink GC, the strong reference + // could create a reference cycle preventing GC of both Blink and v8 objects: + // + // WindowProxy -> global_proxy_ -> v8::Context -> JS object + // -> chain of Blink C++ objects -> WindowProxy + // + // With unified tracing, `global_proxy_` can simply be a traced v8 reference. + // Once `WindowProxy` is no longer reachable from a GC root, `global_proxy_` + // will also become collectible with no need to explicitly break a cycle. + TraceWrapperV8Reference global_proxy_; Lifecycle lifecycle_; }; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.cc b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.cc index 66bc944696b..9fea377d4db 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.cc @@ -4,8 +4,12 @@ #include "third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h" +#include "third_party/blink/renderer/bindings/core/v8/local_window_proxy.h" +#include "third_party/blink/renderer/bindings/core/v8/remote_window_proxy.h" +#include "third_party/blink/renderer/core/frame/remote_frame.h" #include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { @@ -58,14 +62,28 @@ void WindowProxyManager::SetGlobalProxies( for (const auto& entry : global_proxies) WindowProxyMaybeUninitialized(*entry.first)->SetGlobalProxy(entry.second); - // Initialize the window proxies now, to re-establish the connection between - // the global object and the v8::Context. This is really only needed for a - // RemoteDOMWindow, since it has no scripting environment of its own. - // Without this, existing script references to a swapped in RemoteDOMWindow - // would be broken until that RemoteDOMWindow was vended again through an - // interface like window.frames. - for (const auto& entry : global_proxies) + // Any transferred global proxies must now be reinitialized to ensure any + // preexisting JS references to global proxies don't break. + + // For local frames, the global proxies cannot be reinitialized yet. Blink is + // in the midst of committing a navigation and swapping in the new frame. + // Instead, the global proxies will be reinitialized after this via a call to + // `UpdateDocument()` when the new `Document` is installed: this will happen + // before committing the navigation completes and yields back to the event + // loop. + if (frame_type_ == FrameType::kLocal) + return; + + for (const auto& entry : global_proxies) { WindowProxyMaybeUninitialized(*entry.first)->InitializeIfNeeded(); + } +} + +void WindowProxyManager::ResetIsolatedWorldsForTesting() { + for (auto& world_info : isolated_worlds_) { + world_info.value->ClearForClose(); + } + isolated_worlds_.clear(); } WindowProxyManager::WindowProxyManager(Frame& frame, FrameType frame_type) @@ -114,14 +132,21 @@ WindowProxy* WindowProxyManager::WindowProxyMaybeUninitialized( return window_proxy; } +void LocalWindowProxyManager::UpdateDocument() { + MainWorldProxyMaybeUninitialized()->UpdateDocument(); + + for (auto& entry : isolated_worlds_) { + To(entry.value.Get())->UpdateDocument(); + } +} + void LocalWindowProxyManager::UpdateSecurityOrigin( const SecurityOrigin* security_origin) { - static_cast(window_proxy_.Get()) + To(window_proxy_.Get()) ->UpdateSecurityOrigin(security_origin); for (auto& entry : isolated_worlds_) { - auto* isolated_window_proxy = - static_cast(entry.value.Get()); + auto* isolated_window_proxy = To(entry.value.Get()); scoped_refptr isolated_security_origin = isolated_window_proxy->World().IsolatedWorldSecurityOrigin( security_origin->AgentClusterId()); @@ -137,9 +162,7 @@ void LocalWindowProxyManager::SetAbortScriptExecution( ->SetAbortScriptExecution(callback); for (auto& entry : isolated_worlds_) { - auto* isolated_window_proxy = - static_cast(entry.value.Get()); - isolated_window_proxy->SetAbortScriptExecution(callback); + To(entry.value.Get())->SetAbortScriptExecution(callback); } } diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h index ea9dd330ec4..eb810cf9b51 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h @@ -27,29 +27,27 @@ class WindowProxyManager : public GarbageCollected { v8::Isolate* GetIsolate() const { return isolate_; } void ClearForClose(); - void CORE_EXPORT ClearForNavigation(); + CORE_EXPORT void ClearForNavigation(); void ClearForSwap(); void ClearForV8MemoryPurge(); - // Global proxies are passed in a vector to maintain their order: global proxy - // object for the main world is always first. This is needed to prevent bugs - // like https://crbug.com/700077 . + // Helpers used to transfer global proxies from the previous frame to the new + // frame when swapping frames. Global proxies are passed in a vector to ensure + // the main world is always processed first. This is needed to prevent bugs + // like https://crbug.com/700077. using GlobalProxyVector = Vector>>; void CORE_EXPORT ReleaseGlobalProxies(GlobalProxyVector&); void CORE_EXPORT SetGlobalProxies(const GlobalProxyVector&); - WindowProxy* MainWorldProxy() { - window_proxy_->InitializeIfNeeded(); - return window_proxy_; - } - WindowProxy* GetWindowProxy(DOMWrapperWorld& world) { WindowProxy* window_proxy = WindowProxyMaybeUninitialized(world); window_proxy->InitializeIfNeeded(); return window_proxy; } + CORE_EXPORT void ResetIsolatedWorldsForTesting(); + protected: using IsolatedWorldMap = HeapHashMap>; enum class FrameType { kLocal, kRemote }; @@ -76,9 +74,6 @@ class WindowProxyManagerImplHelper : public WindowProxyManager { using Base = WindowProxyManager; public: - ProxyType* MainWorldProxy() { - return static_cast(Base::MainWorldProxy()); - } ProxyType* WindowProxy(DOMWrapperWorld& world) { return static_cast(Base::GetWindowProxy(world)); } @@ -101,6 +96,8 @@ class LocalWindowProxyManager return static_cast(window_proxy_.Get()); } + void UpdateDocument(); + // Sets the given security origin to the main world's context. Also updates // the security origin of the context for each isolated world. void UpdateSecurityOrigin(const SecurityOrigin*); diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_test.cc b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_test.cc index 6faf1d5d800..ca16c31ce9d 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_test.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/window_proxy_test.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "third_party/blink/public/web/web_script_source.h" #include "third_party/blink/renderer/core/testing/sim/sim_request.h" #include "third_party/blink/renderer/core/testing/sim/sim_test.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" @@ -49,4 +50,46 @@ TEST_F(WindowProxyTest, ReinitializedAfterNavigation) { ASSERT_GT(ConsoleMessages().size(), 0U); EXPECT_EQ("PASSED", ConsoleMessages()[0]); } + +TEST_F(WindowProxyTest, IsolatedWorldReinitializedAfterNavigation) { + SimRequest main_resource("https://example.com/index.html", "text/html"); + LoadURL("https://example.com/index.html"); + main_resource.Complete(R"HTML( + + + )HTML"); + + ASSERT_TRUE(MainFrame().FirstChild()); + + v8::HandleScope scope(v8::Isolate::GetCurrent()); + + const int32_t kIsolatedWorldId = 42; + + // Save a reference to the top `window` in the isolated world. + v8::Local window_top = + MainFrame().ExecuteScriptInIsolatedWorldAndReturnValue( + kIsolatedWorldId, WebScriptSource("window")); + ASSERT_TRUE(window_top->IsObject()); + + // Save a reference to the child frame's window proxy in the isolated world. + v8::Local saved_child_window = + MainFrame().ExecuteScriptInIsolatedWorldAndReturnValue( + kIsolatedWorldId, WebScriptSource("saved = window[0]")); + ASSERT_TRUE(saved_child_window->IsObject()); + + frame_test_helpers::LoadFrame(MainFrame().FirstChild()->ToWebLocalFrame(), + "data:text/html,

Hello

"); + ASSERT_TRUE(MainFrame().FirstChild()); + + // Test if the window proxy of the navigated frame was reinitialized. The + // `top` attribute of the saved child frame's window proxy reference should + // refer to the same object as the top-level window proxy reference that was + // cached earlier. + v8::Local top_via_saved = + MainFrame().ExecuteScriptInIsolatedWorldAndReturnValue( + kIsolatedWorldId, WebScriptSource("saved.top")); + EXPECT_TRUE(top_via_saved->IsObject()); + EXPECT_TRUE(window_top->StrictEquals(top_via_saved)); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc b/chromium/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc index 4f3b691b633..59430d092be 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc +++ b/chromium/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc @@ -33,29 +33,13 @@ #include #include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/renderer/bindings/core/v8/referrer_script_info.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" -#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" -#include "third_party/blink/renderer/bindings/core/v8/script_value.h" -#include "third_party/blink/renderer/bindings/core/v8/source_location.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_code_cache.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_initializer.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" -#include "third_party/blink/renderer/core/events/error_event.h" #include "third_party/blink/renderer/core/execution_context/agent.h" -#include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" #include "third_party/blink/renderer/core/inspector/worker_thread_debugger.h" -#include "third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h" -#include "third_party/blink/renderer/core/workers/shared_worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h" -#include "third_party/blink/renderer/core/workers/worker_thread.h" #include "third_party/blink/renderer/platform/bindings/origin_trial_features.h" #include "third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h" -#include "third_party/blink/renderer/platform/bindings/v8_object_constructor.h" -#include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h" #include "third_party/blink/renderer/platform/bindings/wrapper_type_info.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/thread_state.h" @@ -312,38 +296,6 @@ void WorkerOrWorkletScriptController::DisableEvalInternal( V8String(isolate_, error_message)); } -// https://html.spec.whatwg.org/C/#run-a-classic-script -ScriptEvaluationResult WorkerOrWorkletScriptController::EvaluateAndReturnValue( - const ScriptSourceCode& source_code, - SanitizeScriptErrors sanitize_script_errors, - mojom::blink::V8CacheOptions v8_cache_options, - V8ScriptRunner::RethrowErrorsOption rethrow_errors) { - if (IsExecutionForbidden()) - return ScriptEvaluationResult::FromClassicNotRun(); - - DCHECK(IsContextInitialized()); - DCHECK(is_ready_to_evaluate_); - - // TODO(crbug/1114994): Plumb this from ClassicScript. - const KURL base_url = source_code.Url(); - - // Use default ReferrerScriptInfo here, as - // - A work{er,let} script doesn't have a nonce, and - // - a work{er,let} script is always "not parser inserted". - // TODO(crbug/1114989): Plumb ScriptFetchOptions from ClassicScript. - ScriptEvaluationResult result = V8ScriptRunner::CompileAndRunScript( - isolate_, script_state_, global_scope_, source_code, base_url, - sanitize_script_errors, ScriptFetchOptions(), v8_cache_options, - std::move(rethrow_errors)); - - if (result.GetResultType() == ScriptEvaluationResult::ResultType::kAborted) - ForbidExecution(); - else - CHECK(!IsExecutionForbidden()); - - return result; -} - void WorkerOrWorkletScriptController::ForbidExecution() { DCHECK(global_scope_->IsContextThread()); execution_forbidden_ = true; diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h b/chromium/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h index 24286a79c19..50054a0065a 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h @@ -32,20 +32,14 @@ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_WORKER_OR_WORKLET_SCRIPT_CONTROLLER_H_ #include "base/macros.h" -#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/rejected_promises.h" -#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" -#include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h" -#include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" -#include "third_party/blink/renderer/platform/wtf/text/text_position.h" #include "v8/include/v8.h" namespace blink { -class ScriptSourceCode; class WorkerOrWorkletGlobalScope; class CORE_EXPORT WorkerOrWorkletScriptController final @@ -57,15 +51,6 @@ class CORE_EXPORT WorkerOrWorkletScriptController final bool IsExecutionForbidden() const; - // https://html.spec.whatwg.org/C/#run-a-classic-script - // Callers should enter ScriptState::Scope before calling this. - ScriptEvaluationResult EvaluateAndReturnValue( - const ScriptSourceCode&, - SanitizeScriptErrors sanitize_script_errors, - mojom::blink::V8CacheOptions = mojom::blink::V8CacheOptions::kDefault, - V8ScriptRunner::RethrowErrorsOption = - V8ScriptRunner::RethrowErrorsOption::DoNotRethrow()); - // Prevents future JavaScript execution. void ForbidExecution(); @@ -84,7 +69,6 @@ class CORE_EXPORT WorkerOrWorkletScriptController final // Disables `eval()` on JavaScript. This must be called before Evaluate(). void DisableEval(const String&); - // Used by Inspector agents: ScriptState* GetScriptState() { return script_state_; } // Used by V8 bindings: @@ -102,6 +86,7 @@ class CORE_EXPORT WorkerOrWorkletScriptController final bool IsContextInitialized() const { return script_state_ && !!script_state_->PerContextData(); } + bool IsReadyToEvaluate() const { return is_ready_to_evaluate_; } private: void DisableEvalInternal(const String& error_message); diff --git a/chromium/third_party/blink/renderer/bindings/generated_in_core.gni b/chromium/third_party/blink/renderer/bindings/generated_in_core.gni index dbdf05c6664..f60e846297e 100644 --- a/chromium/third_party/blink/renderer/bindings/generated_in_core.gni +++ b/chromium/third_party/blink/renderer/bindings/generated_in_core.gni @@ -57,6 +57,12 @@ generated_callback_function_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_resize_observer_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_scroll_state_callback.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_scroll_state_callback.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_underlying_source_cancel_callback.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_underlying_source_cancel_callback.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_underlying_source_pull_callback.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_underlying_source_pull_callback.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_underlying_source_start_callback.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_underlying_source_start_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_void_function.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_void_function.h", ] @@ -107,12 +113,12 @@ generated_dictionary_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_custom_layout_constraints_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_timeline_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_timeline_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_transition_init.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_transition_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_matrix_2d_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_matrix_2d_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_matrix_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_matrix_init.h", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_parser_init.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_parser_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_point_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_point_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_quad_init.cc", @@ -165,12 +171,16 @@ generated_dictionary_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_hash_change_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_idle_request_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_idle_request_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_interest_cohort.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_interest_cohort.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_bitmap_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_bitmap_options.h", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_data_color_settings.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_data_color_settings.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_data_settings.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_data_settings.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_encode_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_encode_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_impression_params.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_impression_params.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_input_device_capabilities_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_input_device_capabilities_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_input_event_init.cc", @@ -187,12 +197,16 @@ generated_dictionary_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_keyframe_animation_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_keyframe_effect_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_keyframe_effect_options.h", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_measure_memory.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_measure_memory.h", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_measure_memory_breakdown.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_measure_memory_breakdown.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_media_query_list_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_media_query_list_event_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_memory_attribution.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_memory_attribution.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_memory_attribution_container.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_memory_attribution_container.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_memory_breakdown_entry.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_memory_breakdown_entry.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_memory_measurement.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_memory_measurement.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_message_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_message_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_mojo_create_data_pipe_options.cc", @@ -237,6 +251,8 @@ generated_dictionary_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_overscroll_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_page_transition_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_page_transition_event_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_parse_from_string_options.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_parse_from_string_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_performance_mark_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_performance_mark_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_performance_measure_options.cc", @@ -301,12 +317,12 @@ generated_dictionary_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_scroll_to_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_security_policy_violation_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_security_policy_violation_event_init.h", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_set_inner_html_options.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_set_inner_html_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_shadow_root_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_shadow_root_init.h", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_stream_pipe_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_static_range_init.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_static_range_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_stream_pipe_options.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_stream_pipe_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_submit_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_submit_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_text_format_update_event_init.cc", @@ -329,6 +345,8 @@ generated_dictionary_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_ua_data_values.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_ui_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_ui_event_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_underlying_source.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_underlying_source.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_validity_state_flags.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_validity_state_flags.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_wheel_event_init.cc", @@ -388,8 +406,6 @@ generated_enumeration_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_form_state_restore_mode.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_fullscreen_navigation_ui.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_fullscreen_navigation_ui.h", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_bitmap_pixel_format.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_bitmap_pixel_format.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_color_space.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_color_space.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_image_data_storage_format.cc", @@ -410,6 +426,10 @@ generated_enumeration_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_playback_direction.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_premultiply_alpha.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_premultiply_alpha.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_reader_mode.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_reader_mode.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_type.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_referrer_policy.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_referrer_policy.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_refresh_policy.cc", @@ -434,6 +454,8 @@ generated_enumeration_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_resize_quality.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_response_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_response_type.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_root_transition_type.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_root_transition_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_scroll_behavior.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_scroll_behavior.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_scroll_direction.cc", @@ -475,6 +497,8 @@ generated_interface_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_abort_controller.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_abort_signal.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_abort_signal.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_abstract_range.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_abstract_range.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_accessible_node.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_accessible_node.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_accessible_node_list.cc", @@ -533,6 +557,8 @@ generated_interface_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_animation.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_condition_rule.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_condition_rule.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_container_rule.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_container_rule.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_counter_style_rule.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_counter_style_rule.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_css_font_face_rule.cc", @@ -625,6 +651,8 @@ generated_interface_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_custom_element_registry.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_custom_event.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_custom_event.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_custom_state_set.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_custom_state_set.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_data_transfer.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_data_transfer.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_data_transfer_item.cc", @@ -645,6 +673,8 @@ generated_interface_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_policy_violation_report_body.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_timeline.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_timeline.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_transition.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_transition.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_document_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_dom_exception.cc", @@ -745,8 +775,6 @@ generated_interface_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_canvas_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_collection.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_collection.h", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_content_element.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_content_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_data_element.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_data_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_data_list_element.cc", @@ -833,6 +861,8 @@ generated_interface_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_param_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_picture_element.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_picture_element.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_popup_element.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_popup_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_portal_element.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_portal_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_pre_element.cc", @@ -845,8 +875,8 @@ generated_interface_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_script_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_select_element.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_select_element.h", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_shadow_element.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_shadow_element.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_select_menu_element.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_select_menu_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_slot_element.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_slot_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_html_source_element.cc", @@ -1369,6 +1399,8 @@ generated_interface_sources_in_core = [ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_wheel_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_window.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_window.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_window_controls_overlay.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_window_controls_overlay.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_worker.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_worker.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_worker_global_scope.cc", diff --git a/chromium/third_party/blink/renderer/bindings/generated_in_modules.gni b/chromium/third_party/blink/renderer/bindings/generated_in_modules.gni index 60700b63fc7..46763abf469 100644 --- a/chromium/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/chromium/third_party/blink/renderer/bindings/generated_in_modules.gni @@ -23,14 +23,16 @@ generated_callback_function_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_decode_error_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_decode_success_callback.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_decode_success_callback.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observer_callback.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observer_callback.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_chunk_output_callback.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_chunk_output_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_launch_consumer.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_launch_consumer.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_lock_granted_callback.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_lock_granted_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_session_action_handler.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_session_action_handler.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_modal_close_watcher.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_modal_close_watcher.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_navigator_user_media_error_callback.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_navigator_user_media_error_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_navigator_user_media_success_callback.cc", @@ -51,6 +53,8 @@ generated_callback_function_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_rtc_session_description_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_rtc_stats_callback.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_rtc_stats_callback.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_scheduler_post_task_callback.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_scheduler_post_task_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_state_callback.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_state_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_error_callback.cc", @@ -65,8 +69,8 @@ generated_callback_function_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_frame_output_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_frame_request_callback.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_frame_request_callback.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_codecs_error_callback.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_codecs_error_callback.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webcodecs_error_callback.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webcodecs_error_callback.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_frame_request_callback.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_frame_request_callback.h", ] @@ -115,8 +119,16 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_configuration.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_context_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_context_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_config.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_config.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_support.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder_support.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_encoder_config.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_encoder_config.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_encoder_init.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_encoder_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_frame_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_frame_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_node_options.cc", @@ -139,6 +151,10 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_authentication_extensions_large_blob_outputs.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_authenticator_selection_criteria.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_authenticator_selection_criteria.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_avc_bitstream_format.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_avc_bitstream_format.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_avc_encoder_config.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_avc_encoder_config.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_background_fetch_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_background_fetch_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_background_fetch_options.cc", @@ -177,6 +193,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_can_make_payment_response.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_context_creation_attributes_module.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_context_creation_attributes_module.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_formatted_text_run.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_formatted_text_run.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_rendering_context_2d_settings.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_rendering_context_2d_settings.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_channel_merger_options.cc", @@ -193,6 +211,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_close_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_collected_client_data.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_collected_client_data.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_select_event_init.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_select_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_constant_source_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_constant_source_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_constrain_boolean_parameters.cc", @@ -259,8 +279,6 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_dynamics_compressor_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_chunk_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_chunk_init.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_config.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_config.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_video_chunk_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_video_chunk_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_event_source_init.cc", @@ -283,8 +301,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_picker_accept_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_picker_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_picker_options.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_create_writer_options.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_create_writer_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_create_writable_options.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_create_writable_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_flags.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_flags.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_get_directory_options.cc", @@ -295,8 +313,6 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_handle_permission_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_remove_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_remove_options.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_font_iterator_entry.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_font_iterator_entry.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gain_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gain_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gamepad_axis_event_init.cc", @@ -317,18 +333,18 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_bind_group_layout_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_bind_group_layout_entry.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_bind_group_layout_entry.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_blend_descriptor.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_blend_descriptor.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_blend_state.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_blend_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_binding.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_binding.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_copy_view.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_copy_view.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_binding_layout.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_binding_layout.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_dict.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_dict.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_state_descriptor.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_state_descriptor.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_target_state.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_target_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_command_buffer_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_command_buffer_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_command_encoder_descriptor.cc", @@ -337,16 +353,22 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_compute_pass_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_compute_pipeline_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_compute_pipeline_descriptor.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_depth_stencil_state_descriptor.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_depth_stencil_state_descriptor.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_depth_stencil_state.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_depth_stencil_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_device_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_device_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_extent_3d_dict.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_extent_3d_dict.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_fence_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_fence_descriptor.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_bitmap_copy_view.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_bitmap_copy_view.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_copy_buffer.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_copy_buffer.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_copy_image_bitmap.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_copy_image_bitmap.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_copy_texture.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_copy_texture.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_data_layout.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_image_data_layout.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_limits.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_limits.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_object_descriptor_base.cc", @@ -359,8 +381,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_pipeline_descriptor_base.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_pipeline_layout_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_pipeline_layout_descriptor.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_programmable_stage_descriptor.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_programmable_stage_descriptor.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_programmable_stage.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_programmable_stage.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_query_set_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_query_set_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_rasterization_state_descriptor.cc", @@ -379,18 +401,20 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_render_pipeline_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_request_adapter_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_request_adapter_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_binding_layout.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_binding_layout.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module_descriptor.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_stencil_state_face_descriptor.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_stencil_state_face_descriptor.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_stencil_face_state.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_stencil_face_state.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_storage_texture_binding_layout.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_storage_texture_binding_layout.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_swap_chain_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_swap_chain_descriptor.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_copy_view.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_copy_view.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_data_layout.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_data_layout.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_binding_layout.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_binding_layout.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_view_descriptor.cc", @@ -403,6 +427,20 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_vertex_buffer_layout_descriptor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_vertex_state_descriptor.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_vertex_state_descriptor.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_drawing_segment.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_drawing_segment.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_feature_query.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_feature_query.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_feature_query_result.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_feature_query_result.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_hints.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_hints.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_model_constraint.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_model_constraint.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_point.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_point.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_segment.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_segment.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_hid_collection_info.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_hid_collection_info.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_hid_connection_event_init.cc", @@ -423,8 +461,6 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_index_parameters.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_object_store_parameters.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_object_store_parameters.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observer_init.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observer_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_transaction_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_transaction_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_version_change_event_init.cc", @@ -433,6 +469,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idle_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_iir_filter_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_iir_filter_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_image_decode_options.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_image_decode_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_image_decoder_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_image_decoder_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_image_frame.cc", @@ -507,6 +545,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_stream_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_stream_track_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_stream_track_event_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_stream_track_signal.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_stream_track_signal.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_track_capabilities.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_track_capabilities.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_track_constraint_set.cc", @@ -617,6 +657,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_picture_in_picture_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_picture_in_picture_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_picture_in_picture_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_plane_init.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_plane_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_point_2d.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_point_2d.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_position_options.cc", @@ -639,6 +681,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_public_key_credential_rp_entity.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_public_key_credential_user_entity.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_public_key_credential_user_entity.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_purchase_details.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_purchase_details.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_push_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_push_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_push_permission_descriptor.cc", @@ -647,6 +691,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_push_subscription_change_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_push_subscription_options_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_push_subscription_options_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_query_options.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_query_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_quic_transport_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_quic_transport_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_registration_options.cc", @@ -745,6 +791,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sensor_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_share_data.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_share_data.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_source_buffer_config.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_source_buffer_config.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_spatial_sensor_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_spatial_sensor_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_speech_recognition_error_event_init.cc", @@ -757,6 +805,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_stereo_panner_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_stereo_panner_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket_options.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_estimate.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_estimate.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_event_init.cc", @@ -773,6 +823,12 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_text_decoder_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_text_encoder_encode_into_result.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_text_encoder_encode_into_result.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url_pattern_component_result.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url_pattern_component_result.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url_pattern_init.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url_pattern_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url_pattern_result.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url_pattern_result.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_usb_connection_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_usb_connection_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_usb_control_transfer_parameters.cc", @@ -781,12 +837,16 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_usb_device_filter.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_usb_device_request_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_usb_device_request_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_color_space.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_color_space.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_configuration.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_configuration.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_decoder_config.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_decoder_config.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_decoder_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_decoder_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_decoder_support.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_decoder_support.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_config.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_config.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_encode_options.cc", @@ -799,18 +859,22 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_frame_metadata.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_track_writer_parameters.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_track_writer_parameters.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_virtual_keyboard_geometry_change_event_init.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_virtual_keyboard_geometry_change_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_watch_advertisements_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_watch_advertisements_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_wave_shaper_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_wave_shaper_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_id_request_options.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_id_request_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_transport_close_info.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_transport_close_info.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_context_attributes.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_context_attributes.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_context_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_context_event_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_webcodecs_texture_info.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_webcodecs_texture_info.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_webcodecs_video_frame_handle.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_webcodecs_video_frame_handle.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket_close_info.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket_close_info.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket_connection.cc", @@ -819,6 +883,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket_stream_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_write_params.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_write_params.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_state_init.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_state_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_dom_overlay_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_dom_overlay_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_hit_test_options_init.cc", @@ -827,6 +893,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_input_source_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_input_sources_change_event_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_input_sources_change_event_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_light_probe_init.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_light_probe_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_ray_direction_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_ray_direction_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_reference_space_event_init.cc", @@ -837,6 +905,8 @@ generated_dictionary_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_session_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_session_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_session_init.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_tracked_image_init.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_tracked_image_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_transient_input_hit_test_options_init.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_transient_input_hit_test_options_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_layer_init.cc", @@ -868,6 +938,8 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_binary_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_biquad_filter_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_biquad_filter_type.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_bitrate_mode.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_bitrate_mode.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_fill_rule.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_fill_rule.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_pixel_format.cc", @@ -888,6 +960,14 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_codec_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_gamut.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_gamut.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_space_matrix_id.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_space_matrix_id.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_space_primary_id.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_space_primary_id.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_space_range_id.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_space_range_id.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_space_transfer_id.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_space_transfer_id.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_connection_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_connection_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_contact_property.cc", @@ -930,14 +1010,16 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_blend_factor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_blend_operation.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_blend_operation.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_binding_type.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_binding_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_compare_function.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_compare_function.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_cull_mode.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_cull_mode.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_error_filter.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_error_filter.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_extension_name.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_extension_name.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_feature_name.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_feature_name.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_filter_mode.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_filter_mode.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_front_face.cc", @@ -958,6 +1040,8 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_query_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_stencil_operation.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_stencil_operation.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_storage_texture_access.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_storage_texture_access.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_store_op.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_store_op.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_aspect.cc", @@ -968,6 +1052,8 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_dimension.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_format.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_format.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_sample_type.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_sample_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_view_dimension.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_view_dimension.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_vertex_format.cc", @@ -980,8 +1066,6 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_cursor_direction.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_data_loss_amount.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_data_loss_amount.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observation_type.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observation_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_request_ready_state.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_request_ready_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_transaction_durability.cc", @@ -1014,6 +1098,8 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_session_action.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_session_playback_state.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_session_playback_state.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_stream_track_signal_type.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_stream_track_signal_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_stream_track_state.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_stream_track_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_metering_mode.cc", @@ -1062,6 +1148,8 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_presenter_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_public_key_credential_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_public_key_credential_type.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_purchase_state.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_purchase_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_purchase_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_purchase_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_push_encryption_key_name.cc", @@ -1128,6 +1216,8 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_service_worker_update_via_cache.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_error_code.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_error_code.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket_durability.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket_durability.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_task_priority.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_task_priority.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_track_default_type.cc", @@ -1148,22 +1238,28 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_user_idle_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_user_verification_requirement.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_user_verification_requirement.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_acceleration_preference.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_encoder_acceleration_preference.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_pixel_format.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_video_pixel_format.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_wake_lock_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_wake_lock_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_power_preference.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_power_preference.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_well_known_directory.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_well_known_directory.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_write_command_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_write_command_type.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_data_format.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_data_format.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_usage.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_usage.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_dom_overlay_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_dom_overlay_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_environment_blend_mode.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_environment_blend_mode.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_eye.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_eye.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_hand_joint.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_hand_joint.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_handedness.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_handedness.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_hit_test_trackable_type.cc", @@ -1172,6 +1268,8 @@ generated_enumeration_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_plane_orientation.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_reference_space_type.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_reference_space_type.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_reflection_format.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_reflection_format.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_session_mode.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_session_mode.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_target_ray_mode.cc", @@ -1205,6 +1303,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_decoder.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_destination_node.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_destination_node.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_encoder.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_encoder.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_frame.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_frame.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_audio_listener.cc", @@ -1293,6 +1393,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_can_make_payment_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_capture_media_stream_track.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_capture_media_stream_track.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_formatted_text.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_formatted_text_run.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_gradient.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_gradient.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_canvas_pattern.cc", @@ -1313,6 +1415,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_clipboard_item.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_close_event.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_close_event.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_select_event.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_color_select_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_compression_stream.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_compression_stream.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_constant_source_node.cc", @@ -1369,6 +1473,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_device_motion_event_rotation_rate.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_device_orientation_event.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_device_orientation_event.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_device_service.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_device_service.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_digital_goods_service.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_digital_goods_service.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_directory_entry.cc", @@ -1389,8 +1495,6 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_dom_file_system_sync.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_dynamics_compressor_node.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_dynamics_compressor_node.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_element.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_chunk.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_audio_chunk.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_encoded_video_chunk.cc", @@ -1433,6 +1537,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_extendable_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_extendable_message_event.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_extendable_message_event.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_eye_dropper.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_eye_dropper.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_face_detector.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_face_detector.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_federated_credential.cc", @@ -1445,6 +1551,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_entry_sync.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_directory_handle.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_directory_handle.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_directory_iterator.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_directory_iterator.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_file_handle.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_file_handle.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_system_handle.cc", @@ -1455,8 +1563,6 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_writer.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_writer_sync.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_file_writer_sync.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_font_iterator.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_font_iterator.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_font_manager.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_font_manager.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_font_metadata.cc", @@ -1537,6 +1643,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_render_pipeline.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_binding_type.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler_binding_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_stage.cc", @@ -1553,8 +1661,16 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_uncaptured_error_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_validation_error.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_validation_error.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gravity_sensor.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gravity_sensor.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gyroscope.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gyroscope.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_drawing.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_drawing.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_recognizer.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_recognizer.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_stroke.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_handwriting_stroke.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_hid.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_hid.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_hid_connection_event.cc", @@ -1589,12 +1705,6 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_key_range.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_object_store.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_object_store.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observation.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observation.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observer.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observer.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observer_changes.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_observer_changes.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_open_db_request.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_open_db_request.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_idb_request.cc", @@ -1637,6 +1747,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_lock_manager.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_magnetometer.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_magnetometer.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_mathml_element.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_mathml_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_capabilities.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_capabilities.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_media_device_info.cc", @@ -1705,14 +1817,12 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_mime_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_mime_type_array.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_mime_type_array.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_file_system_directory_iterator.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_file_system_directory_iterator.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file_manager.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file_manager.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file_sync.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_file_sync.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_manager.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_native_io_manager.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_navigation_preload_manager.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_navigation_preload_manager.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_navigator.cc", @@ -1725,8 +1835,6 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_reading_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_record.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_record.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_writer.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_ndef_writer.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_network_information.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_network_information.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_notification.cc", @@ -1975,12 +2083,18 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_stereo_panner_node.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket_manager.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_bucket_manager.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_event.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_manager.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_storage_manager.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_subtle_crypto.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_subtle_crypto.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_svg_element.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_svg_element.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_event.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_sync_manager.cc", @@ -2007,6 +2121,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_track_default_list.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url_pattern.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_url_pattern.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_usb.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_usb.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_usb_alternate_interface.cc", @@ -2055,6 +2171,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_wake_lock_sentinel.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_wave_shaper_node.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_wave_shaper_node.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_id.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_id.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_transport.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_transport.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl2_rendering_context.cc", @@ -2127,8 +2245,8 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_vertex_array_object_oes.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_video_texture.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_video_texture.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_id.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_web_id.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_webcodecs_video_frame.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_webgl_webcodecs_video_frame.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_websocket_stream.cc", @@ -2153,12 +2271,16 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_anchor_set.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_bounded_reference_space.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_bounded_reference_space.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_cpu_depth_information.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_cpu_depth_information.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_information.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_depth_information.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_dom_overlay_state.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_dom_overlay_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_frame.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_frame.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_hand.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_hand.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_hit_test_result.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_hit_test_result.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_hit_test_source.cc", @@ -2173,6 +2295,10 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_input_source_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_input_sources_change_event.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_input_sources_change_event.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_joint_pose.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_joint_pose.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_joint_space.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_joint_space.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_layer.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_layer.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_light_estimate.cc", @@ -2181,8 +2307,6 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_light_probe.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_plane.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_plane.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_plane_detection_state.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_plane_detection_state.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_plane_set.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_plane_set.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_pose.cc", @@ -2217,12 +2341,10 @@ generated_interface_sources_in_modules = [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_viewport.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_binding.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_binding.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_depth_information.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_depth_information.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_layer.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_layer.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_world_information.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_world_information.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_world_tracking_state.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_world_tracking_state.h", ] generated_namespace_sources_in_modules = [] @@ -2244,8 +2366,6 @@ if (!is_android) { # Serial if (!is_android) { generated_dictionary_sources_in_modules += [ - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial_connection_event_init.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial_connection_event_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial_input_signals.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial_input_signals.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial_options.cc", @@ -2268,8 +2388,6 @@ if (!is_android) { generated_interface_sources_in_modules += [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial_connection_event.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial_connection_event.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial_port.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_serial_port.h", ] diff --git a/chromium/third_party/blink/renderer/bindings/idl_in_core.gni b/chromium/third_party/blink/renderer/bindings/idl_in_core.gni index 9a546b39ac9..16d8c5ebee3 100644 --- a/chromium/third_party/blink/renderer/bindings/idl_in_core.gni +++ b/chromium/third_party/blink/renderer/bindings/idl_in_core.gni @@ -39,6 +39,7 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/clipboard/data_transfer_item_list.idl", "//third_party/blink/renderer/core/css/css.idl", "//third_party/blink/renderer/core/css/css_condition_rule.idl", + "//third_party/blink/renderer/core/css/css_container_rule.idl", "//third_party/blink/renderer/core/css/css_counter_style_rule.idl", "//third_party/blink/renderer/core/css/css_font_face_rule.idl", "//third_party/blink/renderer/core/css/css_grouping_rule.idl", @@ -105,8 +106,12 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/css/style_media.idl", "//third_party/blink/renderer/core/css/style_sheet.idl", "//third_party/blink/renderer/core/css/style_sheet_list.idl", + "//third_party/blink/renderer/core/document_transition/document_transition.idl", + "//third_party/blink/renderer/core/document_transition/document_transition_init.idl", + "//third_party/blink/renderer/core/document_transition/document_transition_supplement.idl", "//third_party/blink/renderer/core/dom/abort_controller.idl", "//third_party/blink/renderer/core/dom/abort_signal.idl", + "//third_party/blink/renderer/core/dom/abstract_range.idl", "//third_party/blink/renderer/core/dom/accessibility_role.idl", "//third_party/blink/renderer/core/dom/aria_attributes.idl", "//third_party/blink/renderer/core/dom/aria_relationship_attributes.idl", @@ -147,6 +152,7 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/dom/idle_deadline.idl", "//third_party/blink/renderer/core/dom/idle_request_callback.idl", "//third_party/blink/renderer/core/dom/idle_request_options.idl", + "//third_party/blink/renderer/core/dom/interest_cohort.idl", "//third_party/blink/renderer/core/dom/iterator.idl", "//third_party/blink/renderer/core/dom/mutation_observer.idl", "//third_party/blink/renderer/core/dom/mutation_observer_init.idl", @@ -162,10 +168,10 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/dom/pointer_lock_options.idl", "//third_party/blink/renderer/core/dom/processing_instruction.idl", "//third_party/blink/renderer/core/dom/range.idl", - "//third_party/blink/renderer/core/dom/set_inner_html_options.idl", "//third_party/blink/renderer/core/dom/shadow_root.idl", "//third_party/blink/renderer/core/dom/shadow_root_init.idl", "//third_party/blink/renderer/core/dom/static_range.idl", + "//third_party/blink/renderer/core/dom/static_range_init.idl", "//third_party/blink/renderer/core/dom/text.idl", "//third_party/blink/renderer/core/dom/tree_walker.idl", "//third_party/blink/renderer/core/dom/void_function.idl", @@ -258,6 +264,7 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/frame/feature_policy_violation_report_body.idl", "//third_party/blink/renderer/core/frame/fragment_directive.idl", "//third_party/blink/renderer/core/frame/history.idl", + "//third_party/blink/renderer/core/frame/impression_params.idl", "//third_party/blink/renderer/core/frame/intervention_report_body.idl", "//third_party/blink/renderer/core/frame/is_input_pending_options.idl", "//third_party/blink/renderer/core/frame/location.idl", @@ -274,6 +281,7 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/frame/navigator_ua_brand_version.idl", "//third_party/blink/renderer/core/frame/navigator_ua_data.idl", "//third_party/blink/renderer/core/frame/navigator_user_activation.idl", + "//third_party/blink/renderer/core/frame/navigator_window_controls_overlay.idl", "//third_party/blink/renderer/core/frame/report.idl", "//third_party/blink/renderer/core/frame/report_body.idl", "//third_party/blink/renderer/core/frame/reporting_observer.idl", @@ -288,6 +296,7 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/frame/user_activation.idl", "//third_party/blink/renderer/core/frame/visual_viewport.idl", "//third_party/blink/renderer/core/frame/window.idl", + "//third_party/blink/renderer/core/frame/window_controls_overlay.idl", "//third_party/blink/renderer/core/frame/window_event_handlers.idl", "//third_party/blink/renderer/core/frame/window_or_worker_global_scope.idl", "//third_party/blink/renderer/core/frame/window_post_message_options.idl", @@ -311,10 +320,11 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/html/canvas/baselines.idl", "//third_party/blink/renderer/core/html/canvas/html_canvas_element.idl", "//third_party/blink/renderer/core/html/canvas/image_data.idl", - "//third_party/blink/renderer/core/html/canvas/image_data_color_settings.idl", + "//third_party/blink/renderer/core/html/canvas/image_data_settings.idl", "//third_party/blink/renderer/core/html/canvas/image_encode_options.idl", "//third_party/blink/renderer/core/html/canvas/text_metrics.idl", "//third_party/blink/renderer/core/html/custom/custom_element_registry.idl", + "//third_party/blink/renderer/core/html/custom/custom_state_set.idl", "//third_party/blink/renderer/core/html/custom/element_internals.idl", "//third_party/blink/renderer/core/html/custom/validity_state_flags.idl", "//third_party/blink/renderer/core/html/event_handler.idl", @@ -335,6 +345,7 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/html/forms/html_options_collection.idl", "//third_party/blink/renderer/core/html/forms/html_output_element.idl", "//third_party/blink/renderer/core/html/forms/html_select_element.idl", + "//third_party/blink/renderer/core/html/forms/html_select_menu_element.idl", "//third_party/blink/renderer/core/html/forms/html_text_area_element.idl", "//third_party/blink/renderer/core/html/forms/radio_node_list.idl", "//third_party/blink/renderer/core/html/forms/submit_event.idl", @@ -347,7 +358,6 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/html/html_body_element.idl", "//third_party/blink/renderer/core/html/html_br_element.idl", "//third_party/blink/renderer/core/html/html_collection.idl", - "//third_party/blink/renderer/core/html/html_content_element.idl", "//third_party/blink/renderer/core/html/html_data_element.idl", "//third_party/blink/renderer/core/html/html_details_element.idl", "//third_party/blink/renderer/core/html/html_dialog_element.idl", @@ -381,11 +391,11 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/html/html_paragraph_element.idl", "//third_party/blink/renderer/core/html/html_param_element.idl", "//third_party/blink/renderer/core/html/html_picture_element.idl", + "//third_party/blink/renderer/core/html/html_popup_element.idl", "//third_party/blink/renderer/core/html/html_pre_element.idl", "//third_party/blink/renderer/core/html/html_progress_element.idl", "//third_party/blink/renderer/core/html/html_quote_element.idl", "//third_party/blink/renderer/core/html/html_script_element.idl", - "//third_party/blink/renderer/core/html/html_shadow_element.idl", "//third_party/blink/renderer/core/html/html_slot_element.idl", "//third_party/blink/renderer/core/html/html_source_element.idl", "//third_party/blink/renderer/core/html/html_span_element.idl", @@ -498,7 +508,11 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/streams/transform_stream.idl", "//third_party/blink/renderer/core/streams/transform_stream_default_controller.idl", "//third_party/blink/renderer/core/streams/underlying_sink_base.idl", + "//third_party/blink/renderer/core/streams/underlying_source.idl", "//third_party/blink/renderer/core/streams/underlying_source_base.idl", + "//third_party/blink/renderer/core/streams/underlying_source_cancel_callback.idl", + "//third_party/blink/renderer/core/streams/underlying_source_pull_callback.idl", + "//third_party/blink/renderer/core/streams/underlying_source_start_callback.idl", "//third_party/blink/renderer/core/streams/writable_stream.idl", "//third_party/blink/renderer/core/streams/writable_stream_default_controller.idl", "//third_party/blink/renderer/core/streams/writable_stream_default_writer.idl", @@ -611,8 +625,10 @@ static_idl_files_in_core = get_path_info( "//third_party/blink/renderer/core/timing/largest_contentful_paint.idl", "//third_party/blink/renderer/core/timing/layout_shift.idl", "//third_party/blink/renderer/core/timing/layout_shift_attribution.idl", - "//third_party/blink/renderer/core/timing/measure_memory/measure_memory.idl", - "//third_party/blink/renderer/core/timing/measure_memory/measure_memory_breakdown.idl", + "//third_party/blink/renderer/core/timing/measure_memory/memory_measurement.idl", + "//third_party/blink/renderer/core/timing/measure_memory/memory_breakdown_entry.idl", + "//third_party/blink/renderer/core/timing/measure_memory/memory_attribution.idl", + "//third_party/blink/renderer/core/timing/measure_memory/memory_attribution_container.idl", "//third_party/blink/renderer/core/timing/memory_info.idl", "//third_party/blink/renderer/core/timing/performance.idl", "//third_party/blink/renderer/core/timing/performance_element_timing.idl", diff --git a/chromium/third_party/blink/renderer/bindings/idl_in_modules.gni b/chromium/third_party/blink/renderer/bindings/idl_in_modules.gni index de4b5adab47..a5cd50fec1c 100644 --- a/chromium/third_party/blink/renderer/bindings/idl_in_modules.gni +++ b/chromium/third_party/blink/renderer/bindings/idl_in_modules.gni @@ -65,12 +65,19 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/bluetooth/request_device_options.idl", "//third_party/blink/renderer/modules/bluetooth/watch_advertisements_options.idl", "//third_party/blink/renderer/modules/broadcastchannel/broadcast_channel.idl", + "//third_party/blink/renderer/modules/buckets/navigator_storage_buckets.idl", + "//third_party/blink/renderer/modules/buckets/storage_bucket.idl", + "//third_party/blink/renderer/modules/buckets/storage_bucket_manager.idl", + "//third_party/blink/renderer/modules/buckets/storage_bucket_options.idl", + "//third_party/blink/renderer/modules/buckets/worker_navigator_storage_buckets.idl", "//third_party/blink/renderer/modules/cache_storage/cache.idl", "//third_party/blink/renderer/modules/cache_storage/cache_query_options.idl", "//third_party/blink/renderer/modules/cache_storage/cache_storage.idl", "//third_party/blink/renderer/modules/cache_storage/multi_cache_query_options.idl", "//third_party/blink/renderer/modules/cache_storage/window_cache_storage.idl", "//third_party/blink/renderer/modules/cache_storage/worker_cache_storage.idl", + "//third_party/blink/renderer/modules/canvas/canvas2d/canvas_formatted_text.idl", + "//third_party/blink/renderer/modules/canvas/canvas2d/canvas_formatted_text_run.idl", "//third_party/blink/renderer/modules/canvas/canvas2d/canvas_gradient.idl", "//third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.idl", "//third_party/blink/renderer/modules/canvas/canvas2d/canvas_pattern.idl", @@ -81,6 +88,8 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/canvas/htmlcanvas/canvas_context_creation_attributes_module.idl", "//third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module.idl", "//third_party/blink/renderer/modules/canvas/imagebitmap/image_bitmap_rendering_context.idl", + "//third_party/blink/renderer/modules/canvas/imagebitmap/window_create_image_bitmap.idl", + "//third_party/blink/renderer/modules/canvas/imagebitmap/worker_create_image_bitmap.idl", "//third_party/blink/renderer/modules/canvas/offscreencanvas/offscreen_canvas_module.idl", "//third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.idl", "//third_party/blink/renderer/modules/clipboard/clipboard.idl", @@ -167,6 +176,8 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/delegated_ink/ink.idl", "//third_party/blink/renderer/modules/delegated_ink/ink_trail_style.idl", "//third_party/blink/renderer/modules/delegated_ink/navigator_ink.idl", + "//third_party/blink/renderer/modules/device/device_service.idl", + "//third_party/blink/renderer/modules/device/navigator_device.idl", "//third_party/blink/renderer/modules/device_orientation/device_motion_event.idl", "//third_party/blink/renderer/modules/device_orientation/device_motion_event_acceleration.idl", "//third_party/blink/renderer/modules/device_orientation/device_motion_event_acceleration_init.idl", @@ -201,11 +212,14 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/encryptedmedia/navigator_request_media_key_system_access.idl", "//third_party/blink/renderer/modules/eventsource/event_source.idl", "//third_party/blink/renderer/modules/eventsource/event_source_init.idl", - "//third_party/blink/renderer/modules/file_system_access/data_transfer_item_native_file_system.idl", + "//third_party/blink/renderer/modules/eyedropper/color_select_event.idl", + "//third_party/blink/renderer/modules/eyedropper/color_select_event_init.idl", + "//third_party/blink/renderer/modules/eyedropper/eye_dropper.idl", + "//third_party/blink/renderer/modules/file_system_access/data_transfer_item_file_system_access.idl", "//third_party/blink/renderer/modules/file_system_access/directory_picker_options.idl", "//third_party/blink/renderer/modules/file_system_access/file_picker_accept_type.idl", "//third_party/blink/renderer/modules/file_system_access/file_picker_options.idl", - "//third_party/blink/renderer/modules/file_system_access/file_system_create_writer_options.idl", + "//third_party/blink/renderer/modules/file_system_access/file_system_create_writable_options.idl", "//third_party/blink/renderer/modules/file_system_access/file_system_directory_handle.idl", "//third_party/blink/renderer/modules/file_system_access/file_system_file_handle.idl", "//third_party/blink/renderer/modules/file_system_access/file_system_get_directory_options.idl", @@ -214,11 +228,11 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/file_system_access/file_system_handle_permission_descriptor.idl", "//third_party/blink/renderer/modules/file_system_access/file_system_remove_options.idl", "//third_party/blink/renderer/modules/file_system_access/file_system_writable_file_stream.idl", - "//third_party/blink/renderer/modules/file_system_access/native_file_system_directory_iterator.idl", + "//third_party/blink/renderer/modules/file_system_access/file_system_directory_iterator.idl", "//third_party/blink/renderer/modules/file_system_access/open_file_picker_options.idl", "//third_party/blink/renderer/modules/file_system_access/save_file_picker_options.idl", - "//third_party/blink/renderer/modules/file_system_access/storage_manager_native_file_system.idl", - "//third_party/blink/renderer/modules/file_system_access/window_native_file_system.idl", + "//third_party/blink/renderer/modules/file_system_access/storage_manager_file_system_access.idl", + "//third_party/blink/renderer/modules/file_system_access/window_file_system_access.idl", "//third_party/blink/renderer/modules/file_system_access/write_params.idl", "//third_party/blink/renderer/modules/filesystem/data_transfer_item_file_system.idl", "//third_party/blink/renderer/modules/filesystem/dedicated_worker_global_scope_file_system.idl", @@ -247,8 +261,6 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/filesystem/metadata_callback.idl", "//third_party/blink/renderer/modules/filesystem/shared_worker_global_scope_file_system.idl", "//third_party/blink/renderer/modules/filesystem/window_file_system.idl", - "//third_party/blink/renderer/modules/font_access/font_iterator.idl", - "//third_party/blink/renderer/modules/font_access/font_iterator_entry.idl", "//third_party/blink/renderer/modules/font_access/font_manager.idl", "//third_party/blink/renderer/modules/font_access/font_metadata.idl", "//third_party/blink/renderer/modules/font_access/font_table_map.idl", @@ -272,6 +284,18 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/geolocation/geolocation_position_error.idl", "//third_party/blink/renderer/modules/geolocation/navigator_geolocation.idl", "//third_party/blink/renderer/modules/geolocation/position_options.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_drawing.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_drawing_segment.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_feature_query.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_feature_query_result.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_hints.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_model_constraint.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_point.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_prediction.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_recognizer.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_segment.idl", + "//third_party/blink/renderer/modules/handwriting/handwriting_stroke.idl", + "//third_party/blink/renderer/modules/handwriting/navigator_handwriting_recognition_service.idl", "//third_party/blink/renderer/modules/hid/hid.idl", "//third_party/blink/renderer/modules/hid/hid_collection_info.idl", "//third_party/blink/renderer/modules/hid/hid_connection_event.idl", @@ -301,10 +325,6 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/indexeddb/idb_key_range.idl", "//third_party/blink/renderer/modules/indexeddb/idb_object_store.idl", "//third_party/blink/renderer/modules/indexeddb/idb_object_store_parameters.idl", - "//third_party/blink/renderer/modules/indexeddb/idb_observation.idl", - "//third_party/blink/renderer/modules/indexeddb/idb_observer.idl", - "//third_party/blink/renderer/modules/indexeddb/idb_observer_changes.idl", - "//third_party/blink/renderer/modules/indexeddb/idb_observer_init.idl", "//third_party/blink/renderer/modules/indexeddb/idb_open_db_request.idl", "//third_party/blink/renderer/modules/indexeddb/idb_request.idl", "//third_party/blink/renderer/modules/indexeddb/idb_transaction.idl", @@ -360,6 +380,7 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/mediasource/html_video_element_media_source.idl", "//third_party/blink/renderer/modules/mediasource/media_source.idl", "//third_party/blink/renderer/modules/mediasource/source_buffer.idl", + "//third_party/blink/renderer/modules/mediasource/source_buffer_config.idl", "//third_party/blink/renderer/modules/mediasource/source_buffer_list.idl", "//third_party/blink/renderer/modules/mediasource/track_default.idl", "//third_party/blink/renderer/modules/mediasource/track_default_list.idl", @@ -384,7 +405,10 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/mediastream/media_stream_track_event.idl", "//third_party/blink/renderer/modules/mediastream/media_stream_track_event_init.idl", "//third_party/blink/renderer/modules/mediastream/media_stream_track_generator.idl", + "//third_party/blink/renderer/modules/mediastream/media_stream_track_generator_init.idl", "//third_party/blink/renderer/modules/mediastream/media_stream_track_processor.idl", + "//third_party/blink/renderer/modules/mediastream/media_stream_track_processor_init.idl", + "//third_party/blink/renderer/modules/mediastream/media_stream_track_signal.idl", "//third_party/blink/renderer/modules/mediastream/media_track_capabilities.idl", "//third_party/blink/renderer/modules/mediastream/media_track_constraint_set.idl", "//third_party/blink/renderer/modules/mediastream/media_track_constraints.idl", @@ -393,9 +417,10 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/mediastream/navigator_media_stream.idl", "//third_party/blink/renderer/modules/mediastream/navigator_user_media.idl", "//third_party/blink/renderer/modules/mediastream/overconstrained_error.idl", + "//third_party/blink/renderer/modules/modalclosewatcher/modal_close_watcher.idl", "//third_party/blink/renderer/modules/native_io/native_io_file.idl", + "//third_party/blink/renderer/modules/native_io/native_io_file_manager.idl", "//third_party/blink/renderer/modules/native_io/native_io_file_sync.idl", - "//third_party/blink/renderer/modules/native_io/native_io_manager.idl", "//third_party/blink/renderer/modules/native_io/window_native_io.idl", "//third_party/blink/renderer/modules/native_io/worker_global_scope_native_io.idl", "//third_party/blink/renderer/modules/navigatorcontentutils/navigator_content_utils.idl", @@ -411,7 +436,6 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/nfc/ndef_record_init.idl", "//third_party/blink/renderer/modules/nfc/ndef_scan_options.idl", "//third_party/blink/renderer/modules/nfc/ndef_write_options.idl", - "//third_party/blink/renderer/modules/nfc/ndef_writer.idl", "//third_party/blink/renderer/modules/notifications/get_notification_options.idl", "//third_party/blink/renderer/modules/notifications/notification.idl", "//third_party/blink/renderer/modules/notifications/notification_action.idl", @@ -585,6 +609,7 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/sanitizer_api/sanitizer.idl", "//third_party/blink/renderer/modules/sanitizer_api/sanitizer_config.idl", "//third_party/blink/renderer/modules/scheduler/scheduler.idl", + "//third_party/blink/renderer/modules/scheduler/scheduler_post_task_callback.idl", "//third_party/blink/renderer/modules/scheduler/scheduler_post_task_options.idl", "//third_party/blink/renderer/modules/scheduler/task_controller.idl", "//third_party/blink/renderer/modules/scheduler/task_signal.idl", @@ -595,6 +620,7 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/sensor/absolute_orientation_sensor.idl", "//third_party/blink/renderer/modules/sensor/accelerometer.idl", "//third_party/blink/renderer/modules/sensor/ambient_light_sensor.idl", + "//third_party/blink/renderer/modules/sensor/gravity_sensor.idl", "//third_party/blink/renderer/modules/sensor/gyroscope.idl", "//third_party/blink/renderer/modules/sensor/linear_acceleration_sensor.idl", "//third_party/blink/renderer/modules/sensor/magnetometer.idl", @@ -656,6 +682,10 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/storage/storage_event.idl", "//third_party/blink/renderer/modules/storage/storage_event_init.idl", "//third_party/blink/renderer/modules/storage/window_storage.idl", + "//third_party/blink/renderer/modules/url_pattern/url_pattern.idl", + "//third_party/blink/renderer/modules/url_pattern/url_pattern_component_result.idl", + "//third_party/blink/renderer/modules/url_pattern/url_pattern_init.idl", + "//third_party/blink/renderer/modules/url_pattern/url_pattern_result.idl", "//third_party/blink/renderer/modules/vibration/navigator_vibration.idl", "//third_party/blink/renderer/modules/video_rvfc/html_video_element_request_video_frame_callback.idl", "//third_party/blink/renderer/modules/video_rvfc/video_frame_metadata.idl", @@ -732,25 +762,39 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/webaudio/wave_shaper_node.idl", "//third_party/blink/renderer/modules/webaudio/wave_shaper_options.idl", "//third_party/blink/renderer/modules/webcodecs/audio_decoder.idl", + "//third_party/blink/renderer/modules/webcodecs/audio_decoder_config.idl", "//third_party/blink/renderer/modules/webcodecs/audio_decoder_init.idl", + "//third_party/blink/renderer/modules/webcodecs/audio_decoder_support.idl", + "//third_party/blink/renderer/modules/webcodecs/audio_encoder.idl", + "//third_party/blink/renderer/modules/webcodecs/audio_encoder_config.idl", + "//third_party/blink/renderer/modules/webcodecs/audio_encoder_init.idl", "//third_party/blink/renderer/modules/webcodecs/audio_frame.idl", "//third_party/blink/renderer/modules/webcodecs/audio_frame_init.idl", "//third_party/blink/renderer/modules/webcodecs/audio_frame_output_callback.idl", + "//third_party/blink/renderer/modules/webcodecs/avc_encoder_config.idl", "//third_party/blink/renderer/modules/webcodecs/codec_state.idl", "//third_party/blink/renderer/modules/webcodecs/encoded_audio_chunk.idl", + "//third_party/blink/renderer/modules/webcodecs/color_space_matrix_id.idl", + "//third_party/blink/renderer/modules/webcodecs/color_space_primary_id.idl", + "//third_party/blink/renderer/modules/webcodecs/color_space_range_id.idl", + "//third_party/blink/renderer/modules/webcodecs/color_space_transfer_id.idl", "//third_party/blink/renderer/modules/webcodecs/encoded_audio_chunk_init.idl", - "//third_party/blink/renderer/modules/webcodecs/encoded_audio_config.idl", "//third_party/blink/renderer/modules/webcodecs/encoded_video_chunk.idl", "//third_party/blink/renderer/modules/webcodecs/encoded_video_chunk_init.idl", + "//third_party/blink/renderer/modules/webcodecs/encoded_audio_chunk_output_callback.idl", + "//third_party/blink/renderer/modules/webcodecs/hardware_preference.idl", "//third_party/blink/renderer/modules/webcodecs/image_decoder.idl", "//third_party/blink/renderer/modules/webcodecs/image_decoder_init.idl", + "//third_party/blink/renderer/modules/webcodecs/image_decode_options.idl", "//third_party/blink/renderer/modules/webcodecs/image_frame.idl", "//third_party/blink/renderer/modules/webcodecs/image_track.idl", "//third_party/blink/renderer/modules/webcodecs/plane.idl", "//third_party/blink/renderer/modules/webcodecs/plane_init.idl", + "//third_party/blink/renderer/modules/webcodecs/video_color_space.idl", "//third_party/blink/renderer/modules/webcodecs/video_decoder.idl", "//third_party/blink/renderer/modules/webcodecs/video_decoder_config.idl", "//third_party/blink/renderer/modules/webcodecs/video_decoder_init.idl", + "//third_party/blink/renderer/modules/webcodecs/video_decoder_support.idl", "//third_party/blink/renderer/modules/webcodecs/video_encoder.idl", "//third_party/blink/renderer/modules/webcodecs/video_encoder_config.idl", "//third_party/blink/renderer/modules/webcodecs/video_encoder_encode_options.idl", @@ -759,10 +803,11 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/webcodecs/video_frame.idl", "//third_party/blink/renderer/modules/webcodecs/video_frame_init.idl", "//third_party/blink/renderer/modules/webcodecs/video_frame_output_callback.idl", + "//third_party/blink/renderer/modules/webcodecs/video_frame_plane_init.idl", "//third_party/blink/renderer/modules/webcodecs/video_pixel_format.idl", "//third_party/blink/renderer/modules/webcodecs/video_track_reader.idl", "//third_party/blink/renderer/modules/webcodecs/video_track_writer_parameters.idl", - "//third_party/blink/renderer/modules/webcodecs/web_codecs_error_callback.idl", + "//third_party/blink/renderer/modules/webcodecs/webcodecs_error_callback.idl", "//third_party/blink/renderer/modules/webdatabase/database.idl", "//third_party/blink/renderer/modules/webdatabase/sql_error.idl", "//third_party/blink/renderer/modules/webdatabase/sql_result_set.idl", @@ -837,6 +882,9 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/webgl/webgl_vertex_array_object.idl", "//third_party/blink/renderer/modules/webgl/webgl_vertex_array_object_oes.idl", "//third_party/blink/renderer/modules/webgl/webgl_video_texture.idl", + "//third_party/blink/renderer/modules/webgl/webgl_webcodecs_texture_info.idl", + "//third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame.idl", + "//third_party/blink/renderer/modules/webgl/webgl_webcodecs_video_frame_handle.idl", "//third_party/blink/renderer/modules/webgpu/gpu.idl", "//third_party/blink/renderer/modules/webgpu/gpu_adapter.idl", "//third_party/blink/renderer/modules/webgpu/gpu_bind_group.idl", @@ -845,15 +893,15 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/webgpu/gpu_bind_group_layout.idl", "//third_party/blink/renderer/modules/webgpu/gpu_bind_group_layout_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_bind_group_layout_entry.idl", - "//third_party/blink/renderer/modules/webgpu/gpu_blend_descriptor.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_blend_state.idl", "//third_party/blink/renderer/modules/webgpu/gpu_buffer.idl", "//third_party/blink/renderer/modules/webgpu/gpu_buffer_binding.idl", - "//third_party/blink/renderer/modules/webgpu/gpu_buffer_copy_view.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_buffer_binding_layout.idl", "//third_party/blink/renderer/modules/webgpu/gpu_buffer_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.idl", "//third_party/blink/renderer/modules/webgpu/gpu_canvas_context.idl", "//third_party/blink/renderer/modules/webgpu/gpu_color_dict.idl", - "//third_party/blink/renderer/modules/webgpu/gpu_color_state_descriptor.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_color_target_state.idl", "//third_party/blink/renderer/modules/webgpu/gpu_color_write.idl", "//third_party/blink/renderer/modules/webgpu/gpu_command_buffer.idl", "//third_party/blink/renderer/modules/webgpu/gpu_command_buffer_descriptor.idl", @@ -863,25 +911,30 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/webgpu/gpu_compute_pass_encoder.idl", "//third_party/blink/renderer/modules/webgpu/gpu_compute_pipeline.idl", "//third_party/blink/renderer/modules/webgpu/gpu_compute_pipeline_descriptor.idl", - "//third_party/blink/renderer/modules/webgpu/gpu_depth_stencil_state_descriptor.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_depth_stencil_state.idl", "//third_party/blink/renderer/modules/webgpu/gpu_device.idl", "//third_party/blink/renderer/modules/webgpu/gpu_device_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_device_lost_info.idl", "//third_party/blink/renderer/modules/webgpu/gpu_extent_3d_dict.idl", "//third_party/blink/renderer/modules/webgpu/gpu_fence.idl", "//third_party/blink/renderer/modules/webgpu/gpu_fence_descriptor.idl", - "//third_party/blink/renderer/modules/webgpu/gpu_image_bitmap_copy_view.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_image_copy_buffer.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_image_copy_image_bitmap.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_image_copy_texture.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_image_data_layout.idl", "//third_party/blink/renderer/modules/webgpu/gpu_limits.idl", "//third_party/blink/renderer/modules/webgpu/gpu_map_mode.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_object_base.idl", "//third_party/blink/renderer/modules/webgpu/gpu_object_descriptor_base.idl", "//third_party/blink/renderer/modules/webgpu/gpu_origin_2d_dict.idl", "//third_party/blink/renderer/modules/webgpu/gpu_origin_3d_dict.idl", "//third_party/blink/renderer/modules/webgpu/gpu_out_of_memory_error.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_pipeline_base.idl", "//third_party/blink/renderer/modules/webgpu/gpu_pipeline_descriptor_base.idl", "//third_party/blink/renderer/modules/webgpu/gpu_pipeline_layout.idl", "//third_party/blink/renderer/modules/webgpu/gpu_pipeline_layout_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_programmable_pass_encoder.idl", - "//third_party/blink/renderer/modules/webgpu/gpu_programmable_stage_descriptor.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_programmable_stage.idl", "//third_party/blink/renderer/modules/webgpu/gpu_query_set.idl", "//third_party/blink/renderer/modules/webgpu/gpu_query_set_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_queue.idl", @@ -899,16 +952,17 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/webgpu/gpu_render_pipeline_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_request_adapter_options.idl", "//third_party/blink/renderer/modules/webgpu/gpu_sampler.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_sampler_binding_layout.idl", "//third_party/blink/renderer/modules/webgpu/gpu_sampler_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_shader_module.idl", "//third_party/blink/renderer/modules/webgpu/gpu_shader_module_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl", - "//third_party/blink/renderer/modules/webgpu/gpu_stencil_state_face_descriptor.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_stencil_face_state.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_storage_texture_binding_layout.idl", "//third_party/blink/renderer/modules/webgpu/gpu_swap_chain.idl", "//third_party/blink/renderer/modules/webgpu/gpu_swap_chain_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_texture.idl", - "//third_party/blink/renderer/modules/webgpu/gpu_texture_copy_view.idl", - "//third_party/blink/renderer/modules/webgpu/gpu_texture_data_layout.idl", + "//third_party/blink/renderer/modules/webgpu/gpu_texture_binding_layout.idl", "//third_party/blink/renderer/modules/webgpu/gpu_texture_descriptor.idl", "//third_party/blink/renderer/modules/webgpu/gpu_texture_usage.idl", "//third_party/blink/renderer/modules/webgpu/gpu_texture_view.idl", @@ -972,16 +1026,25 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/webusb/usb_isochronous_out_transfer_result.idl", "//third_party/blink/renderer/modules/webusb/usb_out_transfer_result.idl", "//third_party/blink/renderer/modules/webusb/worker_navigator_usb.idl", - "//third_party/blink/renderer/modules/xr/element_xr.idl", + "//third_party/blink/renderer/modules/xr/document_xr.idl", + "//third_party/blink/renderer/modules/xr/html_element_xr.idl", + "//third_party/blink/renderer/modules/xr/mathml_element_xr.idl", "//third_party/blink/renderer/modules/xr/navigator_xr.idl", + "//third_party/blink/renderer/modules/xr/svg_element_xr.idl", + "//third_party/blink/renderer/modules/xr/window_xr.idl", "//third_party/blink/renderer/modules/xr/xr_anchor.idl", "//third_party/blink/renderer/modules/xr/xr_anchor_set.idl", "//third_party/blink/renderer/modules/xr/xr_bounded_reference_space.idl", + "//third_party/blink/renderer/modules/xr/xr_cpu_depth_information.idl", "//third_party/blink/renderer/modules/xr/xr_depth_information.idl", + "//third_party/blink/renderer/modules/xr/xr_depth_state_init.idl", "//third_party/blink/renderer/modules/xr/xr_dom_overlay_init.idl", "//third_party/blink/renderer/modules/xr/xr_dom_overlay_state.idl", "//third_party/blink/renderer/modules/xr/xr_frame.idl", "//third_party/blink/renderer/modules/xr/xr_frame_request_callback.idl", + "//third_party/blink/renderer/modules/xr/xr_hand.idl", + "//third_party/blink/renderer/modules/xr/xr_joint_pose.idl", + "//third_party/blink/renderer/modules/xr/xr_joint_space.idl", "//third_party/blink/renderer/modules/xr/xr_hit_test_options_init.idl", "//third_party/blink/renderer/modules/xr/xr_hit_test_result.idl", "//third_party/blink/renderer/modules/xr/xr_hit_test_source.idl", @@ -997,7 +1060,6 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/xr/xr_light_probe.idl", "//third_party/blink/renderer/modules/xr/xr_light_probe_init.idl", "//third_party/blink/renderer/modules/xr/xr_plane.idl", - "//third_party/blink/renderer/modules/xr/xr_plane_detection_state.idl", "//third_party/blink/renderer/modules/xr/xr_plane_set.idl", "//third_party/blink/renderer/modules/xr/xr_pose.idl", "//third_party/blink/renderer/modules/xr/xr_ray.idl", @@ -1023,10 +1085,9 @@ static_idl_files_in_modules = get_path_info( "//third_party/blink/renderer/modules/xr/xr_viewport.idl", "//third_party/blink/renderer/modules/xr/xr_webgl_binding.idl", "//third_party/blink/renderer/modules/xr/xr_webgl_context.idl", + "//third_party/blink/renderer/modules/xr/xr_webgl_depth_information.idl", "//third_party/blink/renderer/modules/xr/xr_webgl_layer.idl", "//third_party/blink/renderer/modules/xr/xr_webgl_layer_init.idl", - "//third_party/blink/renderer/modules/xr/xr_world_information.idl", - "//third_party/blink/renderer/modules/xr/xr_world_tracking_state.idl", ], "abspath") @@ -1048,8 +1109,6 @@ if (!is_android) { [ "//third_party/blink/renderer/modules/serial/navigator_serial.idl", "//third_party/blink/renderer/modules/serial/serial.idl", - "//third_party/blink/renderer/modules/serial/serial_connection_event.idl", - "//third_party/blink/renderer/modules/serial/serial_connection_event_init.idl", "//third_party/blink/renderer/modules/serial/serial_input_signals.idl", "//third_party/blink/renderer/modules/serial/serial_options.idl", "//third_party/blink/renderer/modules/serial/serial_output_signals.idl", diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/BUILD.gn b/chromium/third_party/blink/renderer/bindings/modules/v8/BUILD.gn index 28cfe126f64..fd8e73febf2 100644 --- a/chromium/third_party/blink/renderer/bindings/modules/v8/BUILD.gn +++ b/chromium/third_party/blink/renderer/bindings/modules/v8/BUILD.gn @@ -97,29 +97,27 @@ group("bindings_modules_v8_generated") { ] } -idl_compiler("generate_bindings_modules_v8_interfaces") { - if (use_blink_v8_binding_new_idl_interface) { - modules_interface_idl_files = - filter_exclude(modules_idl_files, [ "*_callback.idl" ]) - } - if (use_blink_v8_binding_new_idl_callback_interface) { - modules_callback_interface_idl_files = - filter_include(modules_idl_files, [ "*_callback.idl" ]) - } - - sources = modules_definition_idl_files - if (use_blink_v8_binding_new_idl_callback_interface) { - sources -= modules_callback_interface_idl_files - } - if (use_blink_v8_binding_new_idl_dictionary) { - sources -= modules_dictionary_idl_files +if (!use_blink_v8_binding_new_idl_callback_interface || + !use_blink_v8_binding_new_idl_dictionary || + !use_blink_v8_binding_new_idl_interface) { + idl_compiler("generate_bindings_modules_v8_interfaces") { + sources = [] + if (!use_blink_v8_binding_new_idl_callback_interface) { + sources += filter_include(modules_idl_files, [ "*_callback.idl" ]) + } + if (!use_blink_v8_binding_new_idl_dictionary) { + sources += modules_dictionary_idl_files + } + if (!use_blink_v8_binding_new_idl_interface) { + sources += filter_exclude(modules_idl_files, [ "*_callback.idl" ]) + } + output_dir = bindings_modules_v8_output_dir + output_name_suffix = "" + target_component = "modules" } - if (use_blink_v8_binding_new_idl_interface) { - sources -= modules_interface_idl_files +} else { + group("generate_bindings_modules_v8_interfaces") { } - output_dir = bindings_modules_v8_output_dir - output_name_suffix = "" - target_component = "modules" } idl_impl("bindings_modules_impl_generated") { @@ -229,8 +227,13 @@ group("generate_mojo_bindings") { blink_modules_sources("bindings_modules_impl") { # ":generate_bindings_modules_v8_partial_interfaces_for_testing" is not # included here. - sources = get_target_outputs(":generate_bindings_modules_v8_interfaces") + - get_target_outputs(":bindings_modules_impl_generated") + sources = get_target_outputs(":bindings_modules_impl_generated") + + if (!use_blink_v8_binding_new_idl_callback_interface || + !use_blink_v8_binding_new_idl_dictionary || + !use_blink_v8_binding_new_idl_interface) { + sources += get_target_outputs(":generate_bindings_modules_v8_interfaces") + } if (!use_blink_v8_binding_new_idl_interface) { sources += get_target_outputs(":generate_bindings_modules_v8_partial_interfaces") + @@ -248,8 +251,7 @@ blink_modules_sources("bindings_modules_impl") { ] } -# TODO(crbug.com/1112471): Get this to run cleanly under Python 3. -python2_action("generate_v8_context_snapshot_external_references") { +action("generate_v8_context_snapshot_external_references") { script = "$bindings_scripts_dir/generate_v8_context_snapshot_external_references.py" idl_files = core_interface_idl_files_core_only + diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/generated.gni b/chromium/third_party/blink/renderer/bindings/modules/v8/generated.gni index 1641dbd99ad..153a73bccda 100644 --- a/chromium/third_party/blink/renderer/bindings/modules/v8/generated.gni +++ b/chromium/third_party/blink/renderer/bindings/modules/v8/generated.gni @@ -49,6 +49,10 @@ bindings_modules_generated_union_type_files = [ "$bindings_modules_v8_output_dir/double_or_dom_point.cc", "$bindings_modules_v8_output_dir/double_sequence_or_gpu_color_dict.cc", "$bindings_modules_v8_output_dir/double_sequence_or_gpu_color_dict.h", + "$bindings_modules_v8_output_dir/encoded_audio_chunk_or_encoded_video_chunk.cc", + "$bindings_modules_v8_output_dir/encoded_audio_chunk_or_encoded_video_chunk.h", + "$bindings_modules_v8_output_dir/encoded_av_chunk_sequence_or_encoded_av_chunk.cc", + "$bindings_modules_v8_output_dir/encoded_av_chunk_sequence_or_encoded_av_chunk.h", "$bindings_modules_v8_output_dir/float32_array_or_float64_array_or_dom_matrix.cc", "$bindings_modules_v8_output_dir/float32_array_or_float64_array_or_dom_matrix.h", "$bindings_modules_v8_output_dir/gpu_buffer_or_array_buffer.cc", @@ -69,6 +73,8 @@ bindings_modules_generated_union_type_files = [ "$bindings_modules_v8_output_dir/idb_object_store_or_idb_index.h", "$bindings_modules_v8_output_dir/idb_object_store_or_idb_index_or_idb_cursor.cc", "$bindings_modules_v8_output_dir/idb_object_store_or_idb_index_or_idb_cursor.h", + "$bindings_modules_v8_output_dir/image_bitmap_source.cc", + "$bindings_modules_v8_output_dir/image_bitmap_source.h", "$bindings_modules_v8_output_dir/int32_array_or_long_sequence.cc", "$bindings_modules_v8_output_dir/int32_array_or_long_sequence.h", "$bindings_modules_v8_output_dir/long_or_constrain_long_range.cc", @@ -91,8 +97,6 @@ bindings_modules_generated_union_type_files = [ "$bindings_modules_v8_output_dir/rendering_context.h", "$bindings_modules_v8_output_dir/request_or_usv_string_or_request_or_usv_string_sequence.cc", "$bindings_modules_v8_output_dir/request_or_usv_string_or_request_or_usv_string_sequence.h", - "$bindings_modules_v8_output_dir/rtc_ice_candidate_init_or_rtc_ice_candidate.cc", - "$bindings_modules_v8_output_dir/rtc_ice_candidate_init_or_rtc_ice_candidate.h", "$bindings_modules_v8_output_dir/string_or_array_buffer_or_array_buffer_view_or_ndef_message_init.cc", "$bindings_modules_v8_output_dir/string_or_array_buffer_or_array_buffer_view_or_ndef_message_init.h", "$bindings_modules_v8_output_dir/string_or_canvas_gradient_or_canvas_pattern.cc", @@ -117,10 +121,14 @@ bindings_modules_generated_union_type_files = [ "$bindings_modules_v8_output_dir/unsigned_long_enforce_range_sequence_or_gpu_origin_3d_dict.h", "$bindings_modules_v8_output_dir/usv_string_or_uint32_array.cc", "$bindings_modules_v8_output_dir/usv_string_or_uint32_array.h", + "$bindings_modules_v8_output_dir/usv_string_or_url_pattern_init.cc", + "$bindings_modules_v8_output_dir/usv_string_or_url_pattern_init.h", "$bindings_modules_v8_output_dir/usv_string_or_usv_string_sequence.cc", "$bindings_modules_v8_output_dir/usv_string_or_usv_string_sequence.h", "$bindings_modules_v8_output_dir/webgl_rendering_context_or_webgl2_rendering_context.cc", "$bindings_modules_v8_output_dir/webgl_rendering_context_or_webgl2_rendering_context.h", + "$bindings_modules_v8_output_dir/well_known_directory_or_file_system_handle.cc", + "$bindings_modules_v8_output_dir/well_known_directory_or_file_system_handle.h", "$bindings_modules_v8_output_dir/worklet_animation_effect_or_worklet_group_effect.cc", "$bindings_modules_v8_output_dir/worklet_animation_effect_or_worklet_group_effect.h", ] @@ -142,8 +150,8 @@ generated_modules_callback_function_files = [ "$bindings_modules_v8_output_dir/v8_decode_error_callback.h", "$bindings_modules_v8_output_dir/v8_decode_success_callback.cc", "$bindings_modules_v8_output_dir/v8_decode_success_callback.h", - "$bindings_modules_v8_output_dir/v8_idb_observer_callback.cc", - "$bindings_modules_v8_output_dir/v8_idb_observer_callback.h", + "$bindings_modules_v8_output_dir/v8_encoded_audio_chunk_output_callback.cc", + "$bindings_modules_v8_output_dir/v8_encoded_audio_chunk_output_callback.h", "$bindings_modules_v8_output_dir/v8_launch_consumer.cc", "$bindings_modules_v8_output_dir/v8_launch_consumer.h", "$bindings_modules_v8_output_dir/v8_lock_granted_callback.cc", @@ -184,8 +192,8 @@ generated_modules_callback_function_files = [ "$bindings_modules_v8_output_dir/v8_video_frame_output_callback.h", "$bindings_modules_v8_output_dir/v8_video_frame_request_callback.cc", "$bindings_modules_v8_output_dir/v8_video_frame_request_callback.h", - "$bindings_modules_v8_output_dir/v8_web_codecs_error_callback.cc", - "$bindings_modules_v8_output_dir/v8_web_codecs_error_callback.h", + "$bindings_modules_v8_output_dir/v8_webcodecs_error_callback.cc", + "$bindings_modules_v8_output_dir/v8_webcodecs_error_callback.h", "$bindings_modules_v8_output_dir/v8_xr_frame_request_callback.cc", "$bindings_modules_v8_output_dir/v8_xr_frame_request_callback.h", ] diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc index 41d0fc1cf41..327c0e8afe1 100644 --- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc +++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.cc @@ -5,7 +5,7 @@ #include "third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h" -#include "third_party/blink/public/mojom/file_system_access/native_file_system_manager.mojom-blink.h" +#include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom-blink.h" #include "third_party/blink/public/mojom/filesystem/file_system.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_crypto.h" @@ -13,8 +13,8 @@ #include "third_party/blink/renderer/bindings/modules/v8/serialization/web_crypto_sub_tags.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/modules/crypto/crypto_key.h" -#include "third_party/blink/renderer/modules/file_system_access/native_file_system_directory_handle.h" -#include "third_party/blink/renderer/modules/file_system_access/native_file_system_file_handle.h" +#include "third_party/blink/renderer/modules/file_system_access/file_system_directory_handle.h" +#include "third_party/blink/renderer/modules/file_system_access/file_system_file_handle.h" #include "third_party/blink/renderer/modules/filesystem/dom_file_system.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_certificate.h" #include "third_party/blink/renderer/modules/peerconnection/rtc_certificate_generator.h" @@ -52,9 +52,9 @@ ScriptWrappable* V8ScriptValueDeserializerForModules::ReadDOMObject( ExecutionContext::From(GetScriptState()), name, static_cast(raw_type), KURL(root_url)); } - case kNativeFileSystemFileHandleTag: - case kNativeFileSystemDirectoryHandleTag: - return ReadNativeFileSystemHandle(tag); + case kFileSystemFileHandleTag: + case kFileSystemDirectoryHandleTag: + return ReadFileSystemHandle(tag); case kRTCCertificateTag: { String pem_private_key; String pem_certificate; @@ -311,10 +311,9 @@ CryptoKey* V8ScriptValueDeserializerForModules::ReadCryptoKey() { return MakeGarbageCollected(key); } -NativeFileSystemHandle* -V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle( +FileSystemHandle* V8ScriptValueDeserializerForModules::ReadFileSystemHandle( SerializationTag tag) { - if (!RuntimeEnabledFeatures::NativeFileSystemEnabled( + if (!RuntimeEnabledFeatures::FileSystemAccessEnabled( ExecutionContext::From(GetScriptState()))) { return nullptr; } @@ -326,52 +325,52 @@ V8ScriptValueDeserializerForModules::ReadNativeFileSystemHandle( } // Find the FileSystemHandle's token. - SerializedScriptValue::NativeFileSystemTokensArray& tokens_array = - GetSerializedScriptValue()->NativeFileSystemTokens(); + SerializedScriptValue::FileSystemAccessTokensArray& tokens_array = + GetSerializedScriptValue()->FileSystemAccessTokens(); if (token_index >= tokens_array.size()) { return nullptr; } // IndexedDB code assumes that deserializing a SSV is non-destructive. So // rather than consuming the token here instead we clone it. - mojo::Remote token( + mojo::Remote token( std::move(tokens_array[token_index])); if (!token) { return nullptr; } - mojo::PendingRemote token_clone; + mojo::PendingRemote token_clone; token->Clone(token_clone.InitWithNewPipeAndPassReceiver()); tokens_array[token_index] = std::move(token_clone); - // Use the NativeFileSystemManager to redeem the token to clone the + // Use the FileSystemAccessManager to redeem the token to clone the // FileSystemHandle. ExecutionContext* execution_context = ExecutionContext::From(GetScriptState()); - mojo::Remote - native_file_system_manager; + mojo::Remote + file_system_access_manager; execution_context->GetBrowserInterfaceBroker().GetInterface( - native_file_system_manager.BindNewPipeAndPassReceiver()); + file_system_access_manager.BindNewPipeAndPassReceiver()); // Clone the FileSystemHandle object. switch (tag) { - case kNativeFileSystemFileHandleTag: { - mojo::PendingRemote file_handle; + case kFileSystemFileHandleTag: { + mojo::PendingRemote file_handle; - native_file_system_manager->GetFileHandleFromToken( + file_system_access_manager->GetFileHandleFromToken( token.Unbind(), file_handle.InitWithNewPipeAndPassReceiver()); - return MakeGarbageCollected( - execution_context, name, std::move(file_handle)); + return MakeGarbageCollected(execution_context, name, + std::move(file_handle)); } - case kNativeFileSystemDirectoryHandleTag: { - mojo::PendingRemote + case kFileSystemDirectoryHandleTag: { + mojo::PendingRemote directory_handle; - native_file_system_manager->GetDirectoryHandleFromToken( + file_system_access_manager->GetDirectoryHandleFromToken( token.Unbind(), directory_handle.InitWithNewPipeAndPassReceiver()); - return MakeGarbageCollected( + return MakeGarbageCollected( execution_context, name, std::move(directory_handle)); } default: { diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h index ccc7f4edec2..90408ee5f1d 100644 --- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h +++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_deserializer_for_modules.h @@ -11,7 +11,7 @@ namespace blink { class CryptoKey; -class NativeFileSystemHandle; +class FileSystemHandle; class RTCEncodedAudioFrame; class RTCEncodedVideoFrame; class VideoFrame; @@ -46,7 +46,7 @@ class MODULES_EXPORT V8ScriptValueDeserializerForModules final return true; } CryptoKey* ReadCryptoKey(); - NativeFileSystemHandle* ReadNativeFileSystemHandle(SerializationTag tag); + FileSystemHandle* ReadFileSystemHandle(SerializationTag tag); RTCEncodedAudioFrame* ReadRTCEncodedAudioFrame(); RTCEncodedVideoFrame* ReadRTCEncodedVideoFrame(); VideoFrame* ReadVideoFrame(); diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc index 30254b40031..c60809ee7b1 100644 --- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc +++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.cc @@ -62,18 +62,16 @@ bool V8ScriptValueSerializerForModules::WriteDOMObject( return true; } if (wrapper_type_info == V8FileSystemFileHandle::GetWrapperTypeInfo() && - RuntimeEnabledFeatures::NativeFileSystemEnabled( + RuntimeEnabledFeatures::FileSystemAccessEnabled( ExecutionContext::From(GetScriptState()))) { - return WriteNativeFileSystemHandle( - kNativeFileSystemFileHandleTag, - wrappable->ToImpl()); + return WriteFileSystemHandle(kFileSystemFileHandleTag, + wrappable->ToImpl()); } if (wrapper_type_info == V8FileSystemDirectoryHandle::GetWrapperTypeInfo() && - RuntimeEnabledFeatures::NativeFileSystemEnabled( + RuntimeEnabledFeatures::FileSystemAccessEnabled( ExecutionContext::From(GetScriptState()))) { - return WriteNativeFileSystemHandle( - kNativeFileSystemDirectoryHandleTag, - wrappable->ToImpl()); + return WriteFileSystemHandle(kFileSystemDirectoryHandleTag, + wrappable->ToImpl()); } if (wrapper_type_info == V8RTCCertificate::GetWrapperTypeInfo()) { RTCCertificate* certificate = wrappable->ToImpl(); @@ -110,16 +108,15 @@ bool V8ScriptValueSerializerForModules::WriteDOMObject( "storage."); return false; } - auto* video_frame = wrappable->ToImpl(); - - if (!video_frame->frame()) { - exception_state.ThrowDOMException( - DOMExceptionCode::kDataCloneError, - "Cannot serialize destroyed VideoFrame."); + scoped_refptr handle = + wrappable->ToImpl()->handle()->Clone(); + if (!handle) { + exception_state.ThrowDOMException(DOMExceptionCode::kDataCloneError, + "A VideoFrame could not be cloned " + "because it was closed."); return false; } - - return WriteVideoFrame(video_frame); + return WriteVideoFrameHandle(std::move(handle)); } return false; } @@ -301,20 +298,20 @@ bool V8ScriptValueSerializerForModules::WriteCryptoKey( return true; } -bool V8ScriptValueSerializerForModules::WriteNativeFileSystemHandle( +bool V8ScriptValueSerializerForModules::WriteFileSystemHandle( SerializationTag tag, - NativeFileSystemHandle* native_file_system_handle) { - mojo::PendingRemote token = - native_file_system_handle->Transfer(); + FileSystemHandle* file_system_handle) { + mojo::PendingRemote token = + file_system_handle->Transfer(); - SerializedScriptValue::NativeFileSystemTokensArray& tokens_array = - GetSerializedScriptValue()->NativeFileSystemTokens(); + SerializedScriptValue::FileSystemAccessTokensArray& tokens_array = + GetSerializedScriptValue()->FileSystemAccessTokens(); tokens_array.push_back(std::move(token)); const uint32_t token_index = static_cast(tokens_array.size() - 1); WriteTag(tag); - WriteUTF8String(native_file_system_handle->name()); + WriteUTF8String(file_system_handle->name()); WriteUint32(token_index); return true; } @@ -347,12 +344,12 @@ bool V8ScriptValueSerializerForModules::WriteRTCEncodedVideoFrame( return true; } -bool V8ScriptValueSerializerForModules::WriteVideoFrame( - VideoFrame* video_frame) { +bool V8ScriptValueSerializerForModules::WriteVideoFrameHandle( + scoped_refptr handle) { auto* attachment = GetSerializedScriptValue()->GetOrCreateAttachment(); auto& frames = attachment->Handles(); - frames.push_back(video_frame->handle()); + frames.push_back(std::move(handle)); const uint32_t index = static_cast(frames.size() - 1); WriteTag(kVideoFrameTag); diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h index d15725e12af..3ea3283c636 100644 --- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h +++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules.h @@ -5,16 +5,17 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_MODULES_V8_SERIALIZATION_V8_SCRIPT_VALUE_SERIALIZER_FOR_MODULES_H_ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_MODULES_V8_SERIALIZATION_V8_SCRIPT_VALUE_SERIALIZER_FOR_MODULES_H_ +#include "base/memory/scoped_refptr.h" #include "third_party/blink/public/platform/web_crypto_algorithm.h" #include "third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_serializer.h" #include "third_party/blink/renderer/modules/modules_export.h" namespace blink { -class NativeFileSystemHandle; +class FileSystemHandle; class RTCEncodedAudioFrame; class RTCEncodedVideoFrame; -class VideoFrame; +class VideoFrameHandle; class WebCryptoKey; // Extends V8ScriptValueSerializer with support for modules/ types. @@ -32,12 +33,11 @@ class MODULES_EXPORT V8ScriptValueSerializerForModules final private: void WriteOneByte(uint8_t byte) { WriteRawBytes(&byte, 1); } bool WriteCryptoKey(const WebCryptoKey&, ExceptionState&); - bool WriteNativeFileSystemHandle( - SerializationTag tag, - NativeFileSystemHandle* native_file_system_handle); + bool WriteFileSystemHandle(SerializationTag tag, + FileSystemHandle* file_system_handle); bool WriteRTCEncodedAudioFrame(RTCEncodedAudioFrame*); bool WriteRTCEncodedVideoFrame(RTCEncodedVideoFrame*); - bool WriteVideoFrame(VideoFrame*); + bool WriteVideoFrameHandle(scoped_refptr); }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules_test.cc b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules_test.cc index 78bb2480df3..170fa8abcf1 100644 --- a/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules_test.cc +++ b/chromium/third_party/blink/renderer/bindings/modules/v8/serialization/v8_script_value_serializer_for_modules_test.cc @@ -989,8 +989,8 @@ TEST(V8ScriptValueSerializerForModulesTest, RoundTripVideoFrame) { scoped_refptr media_frame = media::VideoFrame::CreateBlackFrame(kFrameSize); - // Pass a copy the reference to the video frame. - auto* blink_frame = MakeGarbageCollected(media_frame); + auto* blink_frame = MakeGarbageCollected( + media_frame, scope.GetExecutionContext()); // Round trip the frame and make sure the size is the same. v8::Local wrapper = ToV8(blink_frame, scope.GetScriptState()); @@ -1003,13 +1003,16 @@ TEST(V8ScriptValueSerializerForModulesTest, RoundTripVideoFrame) { EXPECT_FALSE(media_frame->HasOneRef()); - // Destroying either |blink_frame| or |new_frame| should remove all references + // Closing |blink_frame| and |new_frame| should remove all references // to |media_frame|. - blink_frame->destroy(); + blink_frame->close(); + EXPECT_FALSE(media_frame->HasOneRef()); + + new_frame->close(); EXPECT_TRUE(media_frame->HasOneRef()); } -TEST(V8ScriptValueSerializerForModulesTest, DestroyedVideoFrameThrows) { +TEST(V8ScriptValueSerializerForModulesTest, ClosedVideoFrameThrows) { V8TestingScope scope; ExceptionState exception_state(scope.GetIsolate(), ExceptionState::kExecutionContext, "Window", @@ -1020,10 +1023,11 @@ TEST(V8ScriptValueSerializerForModulesTest, DestroyedVideoFrameThrows) { media::VideoFrame::CreateBlackFrame(kFrameSize); // Create and destroy the frame. - auto* blink_frame = MakeGarbageCollected(media_frame); - blink_frame->destroy(); + auto* blink_frame = MakeGarbageCollected( + media_frame, scope.GetExecutionContext()); + blink_frame->close(); - // Serializing the destroyed frame should throw an error. + // Serializing the closed frame should throw an error. v8::Local wrapper = ToV8(blink_frame, scope.GetScriptState()); EXPECT_FALSE(V8ScriptValueSerializer(scope.GetScriptState()) .Serialize(wrapper, exception_state)); diff --git a/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc b/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc index fd4130e6fe4..1ec45264e7f 100644 --- a/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc +++ b/chromium/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc @@ -145,8 +145,6 @@ v8::Local ToV8(const IDBAny* impl, return v8::Undefined(isolate); case IDBAny::kNullType: return v8::Null(isolate); - case IDBAny::kDOMStringListType: - return ToV8(impl->DomStringList(), creation_context, isolate); case IDBAny::kIDBCursorType: return ToV8(impl->IdbCursor(), creation_context, isolate); case IDBAny::kIDBCursorWithValueType: @@ -544,8 +542,8 @@ static v8::Local DeserializeIDBValueData(v8::Isolate* isolate, scoped_refptr serialized_value = value->CreateSerializedValue(); - serialized_value->NativeFileSystemTokens() = - std::move(const_cast(value)->NativeFileSystemTokens()); + serialized_value->FileSystemAccessTokens() = + std::move(const_cast(value)->FileSystemAccessTokens()); SerializedScriptValue::DeserializeOptions options; options.blob_info = &value->BlobInfo(); diff --git a/chromium/third_party/blink/renderer/bindings/scripts/BUILD.gn b/chromium/third_party/blink/renderer/bindings/scripts/BUILD.gn index a6cc71426b1..ced07798d66 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/BUILD.gn +++ b/chromium/third_party/blink/renderer/bindings/scripts/BUILD.gn @@ -18,10 +18,7 @@ action("cached_lex_yacc_tables") { script = "blink_idl_parser.py" inputs = idl_lexer_parser_files - outputs = [ - "$bindings_scripts_output_dir/lextab.py", - "$bindings_scripts_output_dir/parsetab.pickle", - ] + outputs = [ "$bindings_scripts_output_dir/parsetab.pickle" ] args = [ rebase_path(bindings_scripts_output_dir, root_build_dir) ] } diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/.style.yapf b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/.style.yapf deleted file mode 100644 index 2ae9158e446..00000000000 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/.style.yapf +++ /dev/null @@ -1,4 +0,0 @@ -[style] -# https://www.chromium.org/blink/coding-style -based_on_style = pep8 -column_limit = 79 diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py index e190f7134b8..5496853c9bf 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/blink_v8_bridge.py @@ -29,8 +29,15 @@ def blink_class_name(idl_definition): # is implemented as |class EXTsRGB|, not as |ExtSRgb| nor |ExtsRgb|. if isinstance(idl_definition, (web_idl.CallbackFunction, web_idl.CallbackInterface, - web_idl.Enumeration, web_idl.NewUnion)): + web_idl.Enumeration)): return "V8{}".format(idl_definition.identifier) + elif isinstance(idl_definition, web_idl.NewUnion): + # Technically this name is not guaranteed to be unique because + # (X or sequence) and (X or Y or sequence) have the same + # name, but it's highly unlikely to cause a conflict in the actual use + # cases. Plus, we prefer a simple naming rule conformant to the + # Chromium coding style. So, we go with this way. + return "V8Union{}".format("Or".join(idl_definition.member_tokens)) else: return idl_definition.identifier @@ -49,17 +56,19 @@ def v8_bridge_class_name(idl_definition): return "V8{}".format(idl_definition.identifier) -def blink_type_info(idl_type): +def blink_type_info(idl_type, use_new_union=False): """ Returns the types of Blink implementation corresponding to the given IDL type. The returned object has the following attributes. - member_t: The type of a member variable. E.g. T => Member ref_t: The type of a local variable that references to an already-existing value. E.g. String => String& const_ref_t: A const-qualified reference type. value_t: The type of a variable that behaves as a value. E.g. String => String + member_t: The type of a member variable. E.g. T => Member + member_ref_t: The type used for input to and output from a member + variable. E.g. T* for Member and const String& for String. has_null_value: True if the Blink implementation type can represent IDL null value by itself without use of base::Optional. """ @@ -72,28 +81,38 @@ def blink_type_info(idl_type): ref_fmt="{}", const_ref_fmt="const {}", value_fmt="{}", - has_null_value=False): + has_null_value=False, + clear_member_var_fmt="{}.Clear()"): self.typename = typename - self.member_t = member_fmt.format(typename) + self.is_gc_type = is_gc_type(idl_type) self.ref_t = ref_fmt.format(typename) self.const_ref_t = const_ref_fmt.format(typename) self.value_t = value_fmt.format(typename) - # Whether Blink impl type can represent IDL null or not. + self.member_t = member_fmt.format(typename) + self.member_ref_t = (self.ref_t + if self.is_gc_type else self.const_ref_t) self.has_null_value = has_null_value + self._clear_member_var_fmt = clear_member_var_fmt + + def clear_member_var_expr(self, var_name): + """Returns an expression to reset the given member variable.""" + return self._clear_member_var_fmt.format(var_name) def is_gc_type(idl_type): idl_type = idl_type.unwrap() - return bool(idl_type.type_definition_object - and not idl_type.is_enumeration) + return bool( + idl_type.is_buffer_source_type or + (idl_type.type_definition_object and not idl_type.is_enumeration) + or (idl_type.new_union_definition_object and use_new_union)) def vector_element_type(idl_type): - # Add |Member| explicitly so that the complete type definition of + # Use |Member| explicitly so that the complete type definition of # |T| will not be required. - typename = blink_type_info(idl_type).typename - if is_gc_type(idl_type): - return "Member<{}>".format(typename) + type_info = blink_type_info(idl_type) + if type_info.is_gc_type: + return type_info.member_t else: - return typename + return type_info.typename real_type = idl_type.unwrap(typedef=True) @@ -113,15 +132,16 @@ def blink_type_info(idl_type): "double": "double", "unrestricted double": "double", } - return TypeInfo( - cxx_type[real_type.keyword_typename], const_ref_fmt="{}") + return TypeInfo(cxx_type[real_type.keyword_typename], + const_ref_fmt="{}", + clear_member_var_fmt="{} = 0") if real_type.is_string: - return TypeInfo( - "String", - ref_fmt="{}&", - const_ref_fmt="const {}&", - has_null_value=True) + return TypeInfo("String", + ref_fmt="{}&", + const_ref_fmt="const {}&", + has_null_value=True, + clear_member_var_fmt="{} = String()") if real_type.is_array_buffer: assert "AllowShared" not in real_type.extended_attributes @@ -168,7 +188,7 @@ def blink_type_info(idl_type): if real_type.type_definition_object: blink_impl_type = blink_class_name(real_type.type_definition_object) if real_type.is_enumeration: - return TypeInfo(blink_impl_type) + return TypeInfo(blink_impl_type, clear_member_var_fmt="") return TypeInfo( blink_impl_type, member_fmt="Member<{}>", @@ -181,18 +201,34 @@ def blink_type_info(idl_type): or real_type.is_variadic): typename = "VectorOf<{}>".format( vector_element_type(real_type.element_type)) - return TypeInfo(typename, ref_fmt="{}&", const_ref_fmt="const {}&") + return TypeInfo(typename, + ref_fmt="{}&", + const_ref_fmt="const {}&", + clear_member_var_fmt="{}.clear()") if real_type.is_record: typename = "VectorOfPairs<{}, {}>".format( vector_element_type(real_type.key_type), vector_element_type(real_type.value_type)) - return TypeInfo(typename, ref_fmt="{}&", const_ref_fmt="const {}&") + return TypeInfo(typename, + ref_fmt="{}&", + const_ref_fmt="const {}&", + clear_member_var_fmt="{}.clear()") if real_type.is_promise: return TypeInfo( "ScriptPromise", ref_fmt="{}&", const_ref_fmt="const {}&") + if real_type.is_union and use_new_union: + blink_impl_type = blink_class_name( + real_type.new_union_definition_object) + return TypeInfo(blink_impl_type, + member_fmt="Member<{}>", + ref_fmt="{}*", + const_ref_fmt="const {}*", + value_fmt="{}*", + has_null_value=False) + if real_type.is_union: blink_impl_type = blink_class_name(real_type.union_definition_object) return TypeInfo( @@ -205,15 +241,29 @@ def blink_type_info(idl_type): inner_type = blink_type_info(real_type.inner_type) if inner_type.has_null_value: return inner_type - return TypeInfo( - "base::Optional<{}>".format(inner_type.value_t), - ref_fmt="{}&", - const_ref_fmt="const {}&") + return TypeInfo("base::Optional<{}>".format(inner_type.value_t), + ref_fmt="{}&", + const_ref_fmt="const {}&", + clear_member_var_fmt="{}.reset()") assert False, "Unknown type: {}".format(idl_type.syntactic_form) -def native_value_tag(idl_type): +def native_value_tag(idl_type, argument=None, apply_optional_to_last_arg=True): + """Returns the tag type of NativeValueTraits.""" + assert isinstance(idl_type, web_idl.IdlType) + assert argument is None or isinstance(argument, web_idl.Argument) + + if (idl_type.is_optional and argument + and not (idl_type.is_nullable or argument.default_value) + and (apply_optional_to_last_arg + or argument != argument.owner.arguments[-1])): + return "IDLOptional<{}>".format(_native_value_tag_impl(idl_type)) + + return _native_value_tag_impl(idl_type) + + +def _native_value_tag_impl(idl_type): """Returns the tag type of NativeValueTraits.""" assert isinstance(idl_type, web_idl.IdlType) @@ -251,15 +301,16 @@ def native_value_tag(idl_type): if real_type.is_sequence: return "IDLSequence<{}>".format( - native_value_tag(real_type.element_type)) + _native_value_tag_impl(real_type.element_type)) if real_type.is_frozen_array: - return "IDLArray<{}>".format(native_value_tag(real_type.element_type)) + return "IDLArray<{}>".format( + _native_value_tag_impl(real_type.element_type)) if real_type.is_record: return "IDLRecord<{}, {}>".format( - native_value_tag(real_type.key_type), - native_value_tag(real_type.value_type)) + _native_value_tag_impl(real_type.key_type), + _native_value_tag_impl(real_type.value_type)) if real_type.is_promise: return "IDLPromise" @@ -271,40 +322,48 @@ def native_value_tag(idl_type): return "IDLUnionNotINT<{}>".format(class_name) if real_type.is_nullable: - return "IDLNullable<{}>".format(native_value_tag(real_type.inner_type)) + return "IDLNullable<{}>".format( + _native_value_tag_impl(real_type.inner_type)) assert False, "Unknown type: {}".format(idl_type.syntactic_form) -def make_blink_to_v8_value(v8_var_name, blink_value_expr, idl_type, - v8_creation_context): +def make_blink_to_v8_value( + v8_var_name, + blink_value_expr, + idl_type, + argument=None, + error_exit_return_statement="return v8::MaybeLocal();", + creation_context_script_state="${script_state}"): """ Returns a SymbolNode whose definition converts a Blink value to a v8::Value. """ assert isinstance(v8_var_name, str) assert isinstance(blink_value_expr, str) assert isinstance(idl_type, web_idl.IdlType) - assert isinstance(v8_creation_context, str) + assert argument is None or isinstance(argument, web_idl.Argument) + assert isinstance(error_exit_return_statement, str) + assert isinstance(creation_context_script_state, str) + + T = TextNode + F = lambda *args, **kwargs: T(_format(*args, **kwargs)) def create_definition(symbol_node): - if (idl_type.unwrap(typedef=True).is_nullable - and idl_type.unwrap().is_string): - pattern = ("v8::Local {v8_var_name} = " - "{blink_value_expr}.IsNull() " - "? v8::Null(${isolate}).As() " - ": ToV8(" - "{blink_value_expr}, {v8_creation_context}, ${isolate})" - ".As();") - else: - pattern = ( - "auto&& {v8_var_name} = ToV8(" - "{blink_value_expr}, {v8_creation_context}, ${isolate});") - node = TextNode( - _format(pattern, - v8_var_name=v8_var_name, - blink_value_expr=blink_value_expr, - v8_creation_context=v8_creation_context)) - return SymbolDefinitionNode(symbol_node, [node]) + binds = { + "blink_value_expr": blink_value_expr, + "creation_context_script_state": creation_context_script_state, + "native_value_tag": native_value_tag(idl_type, argument=argument), + "v8_var_name": v8_var_name, + } + pattern = ("!ToV8Traits<{native_value_tag}>::ToV8(" + "{creation_context_script_state}, {blink_value_expr})" + ".ToLocal(&{v8_var_name})") + nodes = [ + F("v8::Local {v8_var_name};", **binds), + CxxUnlikelyIfNode(cond=F(pattern, **binds), + body=T(error_exit_return_statement)), + ] + return SymbolDefinitionNode(symbol_node, nodes) return SymbolNode(v8_var_name, definition_constructor=create_definition) @@ -340,9 +399,12 @@ def make_default_value_expr(idl_type, default_value): else var = ${assignment_value}; """ + assert isinstance(idl_type, web_idl.IdlType) + assert (default_value is None + or isinstance(default_value, web_idl.LiteralConstant)) assert default_value.is_type_compatible_with(idl_type) - class DefaultValueExpr: + class DefaultValueExpr(object): _ALLOWED_SYMBOLS_IN_DEPS = ("isolate") def __init__(self, initializer_expr, initializer_deps, @@ -491,8 +553,8 @@ def make_default_value_expr(idl_type, default_value): def make_v8_to_blink_value(blink_var_name, v8_value_expr, idl_type, - argument_index=None, - default_value=None, + argument=None, + error_exit_return_statement="return;", cg_context=None): """ Returns a SymbolNode whose definition converts a v8::Value to a Blink value. @@ -500,9 +562,8 @@ def make_v8_to_blink_value(blink_var_name, assert isinstance(blink_var_name, str) assert isinstance(v8_value_expr, str) assert isinstance(idl_type, web_idl.IdlType) - assert (argument_index is None or isinstance(argument_index, (int, long))) - assert (default_value is None - or isinstance(default_value, web_idl.LiteralConstant)) + assert argument is None or isinstance(argument, web_idl.Argument) + assert isinstance(error_exit_return_statement, str) T = TextNode F = lambda *args, **kwargs: T(_format(*args, **kwargs)) @@ -536,28 +597,34 @@ def make_v8_to_blink_value(blink_var_name, v8_value_expr) def create_definition(symbol_node): - if argument_index is None: + if argument is None: func_name = "NativeValue" arguments = ["${isolate}", v8_value_expr, "${exception_state}"] else: func_name = "ArgumentValue" arguments = [ "${isolate}", - str(argument_index), + str(argument.index), v8_value_expr, "${exception_state}", ] if "StringContext" in idl_type.effective_annotations: arguments.append("${execution_context_of_document_tree}") - blink_value_expr = _format( - "NativeValueTraits<{_1}>::{_2}({_3})", - _1=native_value_tag(idl_type), - _2=func_name, - _3=", ".join(arguments)) - default_expr = (make_default_value_expr(idl_type, default_value) - if default_value else None) + blink_value_expr = _format("NativeValueTraits<{_1}>::{_2}({_3})", + _1=native_value_tag( + idl_type, + argument=argument, + apply_optional_to_last_arg=False), + _2=func_name, + _3=", ".join(arguments)) + if argument and argument.default_value: + default_expr = make_default_value_expr(idl_type, + argument.default_value) + else: + default_expr = None exception_exit_node = CxxUnlikelyIfNode( - cond="${exception_state}.HadException()", body=T("return;")) + cond="${exception_state}.HadException()", + body=T(error_exit_return_statement)) if not (default_expr or fast_path_cond): return SymbolDefinitionNode(symbol_node, [ @@ -569,7 +636,10 @@ def make_v8_to_blink_value(blink_var_name, "decltype(NativeValueTraits<{}>::NativeValue(" "std::declval(), " "std::declval>(), " - "std::declval()))", native_value_tag(idl_type)) + "std::declval()))", + native_value_tag(idl_type, + argument=argument, + apply_optional_to_last_arg=False)) if default_expr and default_expr.is_initialization_lightweight: pattern = "{} ${{{}}}{{{}}};" args = [ @@ -620,7 +690,7 @@ def make_v8_to_blink_value_variadic(blink_var_name, v8_array, """ assert isinstance(blink_var_name, str) assert isinstance(v8_array, str) - assert isinstance(v8_array_start_index, (int, long)) + assert isinstance(v8_array_start_index, int) assert isinstance(idl_type, web_idl.IdlType) pattern = ("auto&& ${{{_1}}} = " diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_function.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_function.py index ff68193e392..f15a7edcb49 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_function.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_function.py @@ -49,13 +49,12 @@ def bind_local_vars(code_node, cg_context, is_construct_call=False): local_vars = [] local_vars.extend([ - S("argument_creation_context", - ("v8::Local ${argument_creation_context} = " - "CallbackRelevantScriptState()->GetContext()->Global();")), S("exception_state", ("ExceptionState ${exception_state}(" "${isolate}, ExceptionState::kExecutionContext," "${class_like_name}, ${property_name});")), S("isolate", "v8::Isolate* ${isolate} = GetIsolate();"), + S("script_state", + "ScriptState* ${script_state} = CallbackRelevantScriptState();"), ]) if cg_context.callback_function: @@ -311,9 +310,13 @@ bindings::CallbackInvokeHelper<{template_params}> helper( v8_arg_name = name_style.local_var_f("v8_arg{}_{}", index + 1, arguments[index].identifier) body.register_code_symbol( - make_blink_to_v8_value(v8_arg_name, arg_name, - arguments[index].idl_type, - "${argument_creation_context}")) + make_blink_to_v8_value( + v8_arg_name, + arg_name, + arguments[index].idl_type, + argument=arguments[index], + error_exit_return_statement=( + "return ${return_value_on_failure};"))) body.append( F("argv[{index}] = ${{{v8_arg}}};", index=index, @@ -322,10 +325,13 @@ bindings::CallbackInvokeHelper<{template_params}> helper( v8_arg_name = name_style.local_var_f("v8_arg{}_{}", len(arguments), arguments[-1].identifier) body.register_code_symbol( - make_blink_to_v8_value(v8_arg_name, - "{}[i]".format(variadic_arg_name), - arguments[-1].idl_type, - "${argument_creation_context}")) + make_blink_to_v8_value( + v8_arg_name, + "{}[i]".format(variadic_arg_name), + arguments[-1].idl_type.unwrap(variadic=True), + argument=arguments[-1], + error_exit_return_statement=( + "return ${return_value_on_failure};"))) body.append( CxxForLoopNode( cond=F("wtf_size_t i = 0; i < {var_arg}.size(); ++i", @@ -335,7 +341,7 @@ bindings::CallbackInvokeHelper<{template_params}> helper( non_var_arg_size=len(arguments) - 1, v8_arg=v8_arg_name), ], - weak_dep_syms=["argument_creation_context", "isolate"])) + weak_dep_syms=["isolate", "script_state"])) body.extend([ CxxUnlikelyIfNode(cond="!helper.Call(argc, argv)", @@ -589,11 +595,13 @@ def generate_callback_function(callback_function_identifier): source_node.accumulator.add_include_headers([ "third_party/blink/renderer/bindings/core/v8/callback_invoke_helper.h", "third_party/blink/renderer/bindings/core/v8/generated_code_helper.h", + "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h", ]) (header_forward_decls, header_include_headers, source_forward_decls, source_include_headers) = collect_forward_decls_and_include_headers( - [callback_function.return_type] + - map(lambda argument: argument.idl_type, callback_function.arguments)) + [callback_function.return_type] + list( + map(lambda argument: argument.idl_type, + callback_function.arguments))) header_node.accumulator.add_class_decls(header_forward_decls) header_node.accumulator.add_include_headers(header_include_headers) source_node.accumulator.add_class_decls(source_forward_decls) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py index f64cef88c48..45bc422d5b2 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_interface.py @@ -177,7 +177,7 @@ def generate_callback_interface(callback_interface_identifier): prop_install_mode=PropInstallMode.UNCONDITIONAL, trampoline_var_name=None, attribute_entries=[], - constant_entries=filter(is_unconditional, constant_entries), + constant_entries=list(filter(is_unconditional, constant_entries)), exposed_construct_entries=[], operation_entries=[]) (install_interface_template_decl, install_interface_template_def, @@ -286,12 +286,13 @@ def generate_callback_interface(callback_interface_identifier): source_node.accumulator.add_include_headers([ "third_party/blink/renderer/bindings/core/v8/callback_invoke_helper.h", "third_party/blink/renderer/bindings/core/v8/generated_code_helper.h", + "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h", ]) (header_forward_decls, header_include_headers, source_forward_decls, source_include_headers) = collect_forward_decls_and_include_headers( - [callback_interface.operation_groups[0][0].return_type] + - map(lambda argument: argument.idl_type, - callback_interface.operation_groups[0][0].arguments)) + [callback_interface.operation_groups[0][0].return_type] + list( + map(lambda argument: argument.idl_type, + callback_interface.operation_groups[0][0].arguments))) header_node.accumulator.add_class_decls(header_forward_decls) header_node.accumulator.add_include_headers(header_include_headers) source_node.accumulator.add_class_decls(source_forward_decls) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py index 52972fefe20..e5ae9d9629e 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py @@ -503,13 +503,13 @@ class CompositeNode(CodeNode): gensym_kwargs = {} template_vars = {} for arg in args: - assert isinstance(arg, (CodeNode, int, long, str)) + assert isinstance(arg, (CodeNode, int, str)) gensym = CodeNode.gensym() gensym_args.append("${{{}}}".format(gensym)) template_vars[gensym] = arg for key, value in kwargs.items(): - assert isinstance(key, (int, long, str)) - assert isinstance(value, (CodeNode, int, long, str)) + assert isinstance(key, (int, str)) + assert isinstance(value, (CodeNode, int, str)) gensym = CodeNode.gensym() gensym_kwargs[key] = "${{{}}}".format(gensym) template_vars[gensym] = value @@ -602,7 +602,7 @@ class ListNode(CodeNode): def insert(self, index, node): if node is None: return - assert isinstance(index, (int, long)) + assert isinstance(index, int) assert isinstance(node, CodeNode) assert node.outer is None and node.prev is None @@ -721,7 +721,7 @@ class SymbolScopeNode(SequenceNode): if not scope_chains: return counts - self_index = iter(scope_chains).next().index(self) + self_index = next(iter(scope_chains)).index(self) scope_chains = map( lambda scope_chain: scope_chain[self_index + 1:], scope_chains) scope_to_likeliness = {} diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py index a229a6c71c9..5fa288dabf2 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py @@ -109,7 +109,7 @@ def expr_and(terms): if any(term.is_always_false for term in terms): return _Expr(False) - terms = filter(lambda x: not x.is_always_true, terms) + terms = list(filter(lambda x: not x.is_always_true, terms)) if not terms: return _Expr(True) if len(terms) == 1: @@ -124,7 +124,7 @@ def expr_or(terms): if any(term.is_always_true for term in terms): return _Expr(True) - terms = filter(lambda x: not x.is_always_false, terms) + terms = list(filter(lambda x: not x.is_always_false, terms)) if not terms: return _Expr(False) if len(terms) == 1: @@ -222,7 +222,7 @@ def expr_from_exposure(exposure, elif exposure.only_in_secure_contexts is False: secure_context_term = _Expr(True) else: - terms = map(ref_enabled, exposure.only_in_secure_contexts) + terms = list(map(ref_enabled, exposure.only_in_secure_contexts)) secure_context_term = expr_or( [_Expr("${is_in_secure_context}"), expr_not(expr_and(terms))]) @@ -275,10 +275,11 @@ def expr_from_exposure(exposure, # [ContextEnabled] if exposure.context_enabled_features: - terms = map( - lambda feature: _Expr( - "${{context_feature_settings}}->is{}Enabled()".format( - feature)), exposure.context_enabled_features) + terms = list( + map( + lambda feature: _Expr( + "${{context_feature_settings}}->is{}Enabled()".format( + feature)), exposure.context_enabled_features)) context_enabled_terms.append( expr_and([_Expr("${context_feature_settings}"), expr_or(terms)])) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py index 87d26eec3ca..d88fac3a228 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py @@ -23,10 +23,11 @@ class _TemplateFormatter(string.Formatter): self._template_formatter_indexing_count_ = 0 def get_value(self, key, args, kwargs): - if isinstance(key, (int, long)): + if isinstance(key, int): return args[key] assert isinstance(key, str) if not key: + # TODO(crbug.com/1174969): # Prior to Python 3.1, when a positional argument specifier is # omitted, |format_string="{}"| produces |key=""|. Should be # removed once Python2 gets retired. diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py index 1f808e310d0..e24764c13bd 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py @@ -179,4 +179,5 @@ def write_code_node_to_file(code_node, filepath): filename=format_result.filename, stderr=format_result.error_message)) - web_idl.file_io.write_to_file_if_changed(filepath, format_result.contents) + web_idl.file_io.write_to_file_if_changed( + filepath, format_result.contents.encode('utf-8')) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py index bee4581d5f9..52b72f61554 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/dictionary.py @@ -886,7 +886,7 @@ def make_dict_trace_func(cg_context): _2 = _blink_member_name(member).value_var return TextNode(_format(pattern, _1=_1, _2=_2)) - body.extend(map(make_trace_member_node, own_members)) + body.extend(list(map(make_trace_member_node, own_members))) body.append(TextNode("BaseClass::Trace(visitor);")) return func_decl, func_def diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py index 5a6c82c1b8f..e09a559c389 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py @@ -244,11 +244,13 @@ const auto ${arg1_value} = arg1_value_maybe_enum.value(); cg_context.attribute.idl_type)) return - for index, argument in enumerate(cg_context.function_like.arguments): - name = name_style.arg_f("arg{}_{}", index + 1, argument.identifier) + for argument in cg_context.function_like.arguments: + name = name_style.arg_f("arg{}_{}", argument.index + 1, + argument.identifier) if argument.is_variadic: code_node.register_code_symbol( - make_v8_to_blink_value_variadic(name, "${info}", index, + make_v8_to_blink_value_variadic(name, "${info}", + argument.index, argument.idl_type)) else: v8_value = "${{info}}[{}]".format(argument.index) @@ -256,8 +258,7 @@ const auto ${arg1_value} = arg1_value_maybe_enum.value(); make_v8_to_blink_value(name, v8_value, argument.idl_type, - argument_index=index, - default_value=argument.default_value, + argument=argument, cg_context=cg_context)) @@ -582,7 +583,7 @@ def _make_blink_api_call(code_node, overriding_args=None): assert isinstance(code_node, SymbolScopeNode) assert isinstance(cg_context, CodeGenContext) - assert num_of_args is None or isinstance(num_of_args, (int, long)) + assert num_of_args is None or isinstance(num_of_args, int) assert (overriding_args is None or (isinstance(overriding_args, (list, tuple)) and all(isinstance(arg, str) for arg in overriding_args))) @@ -1060,8 +1061,9 @@ def _make_overload_dispatcher_per_arg_size(cg_context, items): # 12.4. if V is a platform object, ... def inheritance_length(func_and_type): - return len(func_and_type[1].type_definition_object. - inclusive_inherited_interfaces) + return (len(func_and_type[1].type_definition_object. + inclusive_inherited_interfaces), + func_and_type[1].type_definition_object.identifier) # Attempt to match from most derived to least derived. for func_like, idl_type in sorted( @@ -1118,16 +1120,12 @@ def _make_overload_dispatcher_per_arg_size(cg_context, items): "bindings::IsEsIterableObject" "(${isolate}, {value}, ${exception_state})") dispatcher_nodes.append( - TextNode("if (${exception_state}.HadException()) {\n" - " return;\n" - "}")) + CxxUnlikelyIfNode(cond="${exception_state}.HadException()", + body=TextNode("return;"))) # 12.10. if Type(V) is Object and ... - def is_es_object_type(t, u): - return (u.is_callback_interface or u.is_dictionary or u.is_record - or u.is_object) - - func_like = find(is_es_object_type) + func_like = find(lambda t, u: u.is_callback_interface or u.is_dictionary or + u.is_record or u.is_object) if func_like: dispatch_if("{value}->IsObject()") @@ -1196,8 +1194,10 @@ def make_overload_dispatcher(cg_context): did_use_break = did_use_break or can_fail conditional = expr_or( - map(lambda item: expr_from_exposure(item.function_like.exposure), - items)) + list( + map( + lambda item: expr_from_exposure(item.function_like.exposure + ), items))) if not conditional.is_always_true: node = CxxUnlikelyIfNode(cond=conditional, body=node) @@ -1442,34 +1442,18 @@ def make_steps_of_ce_reactions(cg_context): or cg_context.named_property_setter or cg_context.named_property_deleter) - T = TextNode - - nodes = [] - - ext_attrs = cg_context.member_like.extended_attributes - if "CustomElementCallbacks" in ext_attrs or "Reflect" in ext_attrs: - if "CustomElementCallbacks" in ext_attrs: - nodes.append(T("// [CustomElementCallbacks]")) - elif "Reflect" in ext_attrs: - nodes.append(T("// [Reflect]")) - nodes.append( - T("V0CustomElementProcessingStack::CallbackDeliveryScope " - "v0_custom_element_scope;")) - nodes[-1].accumulate( - CodeGenAccumulator.require_include_headers([ - "third_party/blink/renderer/core/html/custom/v0_custom_element_processing_stack.h" - ])) + if "CEReactions" not in cg_context.member_like.extended_attributes: + return None - if "CEReactions" in ext_attrs: - nodes.append(T("// [CEReactions]")) - nodes.append(T("CEReactionsScope ce_reactions_scope;")) - nodes[-1].accumulate( - CodeGenAccumulator.require_include_headers([ - "third_party/blink/renderer/core/html/custom/ce_reactions_scope.h" - ])) + nodes = [ + TextNode("// [CEReactions]"), + TextNode("CEReactionsScope ce_reactions_scope;"), + ] - if not nodes: - return None + nodes[-1].accumulate( + CodeGenAccumulator.require_include_headers([ + "third_party/blink/renderer/core/html/custom/ce_reactions_scope.h" + ])) # CEReactions scope is not tolerant of V8 exception, so it's necessary to # invoke custom element reactions before throwing an exception. Thus, put @@ -1812,12 +1796,12 @@ EventListener* event_handler = JSEventHandler::CreateOrNull( has_cereactions = True elif key == "Reflect": has_reflect = True - elif key in ("Affects", "CustomElementCallbacks", "DeprecateAs", - "Exposed", "LogActivity", "LogAllWorlds", "Measure", - "MeasureAs", "ReflectEmpty", "ReflectInvalid", - "ReflectMissing", "ReflectOnly", - "RuntimeCallStatsCounter", "RuntimeEnabled", - "SecureContext", "URL", "Unscopable"): + elif key in ("Affects", "DeprecateAs", "Exposed", "LogActivity", + "LogAllWorlds", "Measure", "MeasureAs", + "ReflectEmpty", "ReflectInvalid", "ReflectMissing", + "ReflectOnly", "RuntimeCallStatsCounter", + "RuntimeEnabled", "SecureContext", "URL", + "Unscopable"): pass else: return None @@ -2435,7 +2419,7 @@ if (${info}.ShouldThrowOnError()) { "blink_property_value", "${v8_property_value}", cg_context.indexed_property_setter.arguments[1].idl_type, - argument_index=2)) + argument=cg_context.indexed_property_setter.arguments[1])) body.extend([ TextNode("""\ @@ -2797,7 +2781,7 @@ if (!is_creating) { "blink_property_value", "${v8_property_value}", cg_context.named_property_setter.arguments[1].idl_type, - argument_index=2)) + argument=cg_context.named_property_setter.arguments[1])) if "Custom" in cg_context.named_property_setter.extended_attributes: text = _format( @@ -4652,7 +4636,7 @@ class _PropEntryConstructorGroup(_PropEntryBase): def __init__(self, is_context_dependent, exposure_conditional, world, constructor_group, ctor_callback_name, ctor_func_length): assert isinstance(ctor_callback_name, str) - assert isinstance(ctor_func_length, (int, long)) + assert isinstance(ctor_func_length, int) _PropEntryBase.__init__(self, is_context_dependent, exposure_conditional, world, constructor_group) @@ -4680,7 +4664,7 @@ class _PropEntryOperationGroup(_PropEntryBase): op_func_length, no_alloc_direct_callback_name=None): assert isinstance(op_callback_name, str) - assert isinstance(op_func_length, (int, long)) + assert isinstance(op_func_length, int) _PropEntryBase.__init__(self, is_context_dependent, exposure_conditional, world, operation_group) @@ -5199,9 +5183,9 @@ def make_install_interface_template(cg_context, function_name, class_name, ]) if class_like.identifier == "CSSStyleDeclaration": - css_properties = filter( - lambda attr: "CSSProperty" in attr.extended_attributes, - class_like.attributes) + css_properties = list( + filter(lambda attr: "CSSProperty" in attr.extended_attributes, + class_like.attributes)) if css_properties: prop_name_list = "".join( map(lambda attr: "\"{}\", ".format(attr.identifier), @@ -5228,8 +5212,9 @@ def make_install_interface_template(cg_context, function_name, class_name, // https://heycam.github.io/webidl/#es-DOMException-specialness { v8::Local intrinsic_error_prototype_interface_template = - v8::FunctionTemplate::New(${isolate}); - intrinsic_error_prototype_interface_template->RemovePrototype(); + v8::FunctionTemplate::New(${isolate}, nullptr, v8::Local(), + v8::Local(), 0, + v8::ConstructorBehavior::kThrow); intrinsic_error_prototype_interface_template->SetIntrinsicDataProperty( V8AtomicString(${isolate}, "prototype"), v8::kErrorPrototype); ${interface_function_template}->Inherit( @@ -5237,7 +5222,7 @@ def make_install_interface_template(cg_context, function_name, class_name, } """)) - if class_like.identifier == "NativeFileSystemDirectoryIterator": + if class_like.identifier == "FileSystemDirectoryIterator": body.append( T("""\ // Temporary @@asyncIterator support for FileSystemDirectoryHandle @@ -5245,8 +5230,9 @@ def make_install_interface_template(cg_context, function_name, class_name, { v8::Local intrinsic_iterator_prototype_interface_template = - v8::FunctionTemplate::New(${isolate}); - intrinsic_iterator_prototype_interface_template->RemovePrototype(); + v8::FunctionTemplate::New(${isolate}, nullptr, v8::Local(), + v8::Local(), 0, + v8::ConstructorBehavior::kThrow); intrinsic_iterator_prototype_interface_template->SetIntrinsicDataProperty( V8AtomicString(${isolate}, "prototype"), v8::kAsyncIteratorPrototype); ${interface_function_template}->Inherit( @@ -5272,8 +5258,9 @@ ${instance_object_template}->MarkAsUndetectable(); { v8::Local intrinsic_iterator_prototype_interface_template = - v8::FunctionTemplate::New(${isolate}); - intrinsic_iterator_prototype_interface_template->RemovePrototype(); + v8::FunctionTemplate::New(${isolate}, nullptr, v8::Local(), + v8::Local(), 0, + v8::ConstructorBehavior::kThrow); intrinsic_iterator_prototype_interface_template->SetIntrinsicDataProperty( V8AtomicString(${isolate}, "prototype"), v8::kIteratorPrototype); ${interface_function_template}->Inherit( @@ -5606,8 +5593,8 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ pattern, install_func="IDLMemberInstaller::InstallConstants", table_name=table_name) - constant_callback_entries = filter(lambda entry: entry.const_callback_name, - constant_entries) + constant_callback_entries = list( + filter(lambda entry: entry.const_callback_name, constant_entries)) install_properties(table_name, constant_callback_entries, _make_constant_callback_registration_table, installer_call_text) @@ -5617,8 +5604,8 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ pattern, install_func="IDLMemberInstaller::InstallConstants", table_name=table_name) - constant_value_entries = filter( - lambda entry: not entry.const_callback_name, constant_entries) + constant_value_entries = list( + filter(lambda entry: not entry.const_callback_name, constant_entries)) install_properties(table_name, constant_value_entries, _make_constant_value_registration_table, installer_call_text) @@ -5637,12 +5624,14 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ pattern, install_func="IDLMemberInstaller::InstallOperations", table_name=table_name) - entries = filter(lambda entry: not entry.no_alloc_direct_callback_name, - operation_entries) + entries = list( + filter(lambda entry: not entry.no_alloc_direct_callback_name, + operation_entries)) install_properties(table_name, entries, _make_operation_registration_table, installer_call_text) - entries = filter(lambda entry: entry.no_alloc_direct_callback_name, - operation_entries) + entries = list( + filter(lambda entry: entry.no_alloc_direct_callback_name, + operation_entries)) install_properties(table_name, entries, _make_operation_registration_table, installer_call_text) @@ -6324,8 +6313,8 @@ def make_v8_context_snapshot_api(cg_context, component, attribute_entries, return None, None derived_interfaces = cg_context.interface.deriveds - derived_names = map(lambda interface: interface.identifier, - derived_interfaces) + derived_names = list( + map(lambda interface: interface.identifier, derived_interfaces)) derived_names.append(cg_context.interface.identifier) if not ("Window" in derived_names or "HTMLDocument" in derived_names): return None, None @@ -6399,9 +6388,11 @@ def _make_v8_context_snapshot_get_reference_table_function( collect_callbacks(named_properties_object_callback_defs) collect_callbacks(cross_origin_property_callback_defs) - entry_nodes = map( - lambda name: TextNode("reinterpret_cast({}),".format(name)), - filter(None, callback_names)) + entry_nodes = list( + map( + lambda name: TextNode("reinterpret_cast({}),".format(name + )), + filter(None, callback_names))) table_node = ListNode([ TextNode("static const intptr_t kReferenceTable[] = {"), ListNode(entry_nodes), @@ -6438,10 +6429,11 @@ def _make_v8_context_snapshot_install_props_per_context_function( class_name=None, prop_install_mode=PropInstallMode.V8_CONTEXT_SNAPSHOT, trampoline_var_name=None, - attribute_entries=filter(selector, attribute_entries), - constant_entries=filter(selector, constant_entries), - exposed_construct_entries=filter(selector, exposed_construct_entries), - operation_entries=filter(selector, operation_entries)) + attribute_entries=list(filter(selector, attribute_entries)), + constant_entries=list(filter(selector, constant_entries)), + exposed_construct_entries=list( + filter(selector, exposed_construct_entries)), + operation_entries=list(filter(selector, operation_entries))) return func_decl, func_def @@ -6804,11 +6796,11 @@ def generate_class_like(class_like): class_name=impl_class_name, prop_install_mode=PropInstallMode.UNCONDITIONAL, trampoline_var_name=tp_install_unconditional_props, - attribute_entries=filter(is_unconditional, attribute_entries), - constant_entries=filter(is_unconditional, constant_entries), - exposed_construct_entries=filter(is_unconditional, - exposed_construct_entries), - operation_entries=filter(is_unconditional, operation_entries)) + attribute_entries=list(filter(is_unconditional, attribute_entries)), + constant_entries=list(filter(is_unconditional, constant_entries)), + exposed_construct_entries=list( + filter(is_unconditional, exposed_construct_entries)), + operation_entries=list(filter(is_unconditional, operation_entries))) (install_context_independent_props_decl, install_context_independent_props_def, install_context_independent_props_trampoline) = make_install_properties( @@ -6817,11 +6809,14 @@ def generate_class_like(class_like): class_name=impl_class_name, prop_install_mode=PropInstallMode.CONTEXT_INDEPENDENT, trampoline_var_name=tp_install_context_independent_props, - attribute_entries=filter(is_context_independent, attribute_entries), - constant_entries=filter(is_context_independent, constant_entries), - exposed_construct_entries=filter(is_context_independent, - exposed_construct_entries), - operation_entries=filter(is_context_independent, operation_entries)) + attribute_entries=list( + filter(is_context_independent, attribute_entries)), + constant_entries=list(filter(is_context_independent, + constant_entries)), + exposed_construct_entries=list( + filter(is_context_independent, exposed_construct_entries)), + operation_entries=list( + filter(is_context_independent, operation_entries))) (install_context_dependent_props_decl, install_context_dependent_props_def, install_context_dependent_props_trampoline) = make_install_properties( cg_context, @@ -6829,11 +6824,13 @@ def generate_class_like(class_like): class_name=impl_class_name, prop_install_mode=PropInstallMode.CONTEXT_DEPENDENT, trampoline_var_name=tp_install_context_dependent_props, - attribute_entries=filter(is_context_dependent, attribute_entries), - constant_entries=filter(is_context_dependent, constant_entries), - exposed_construct_entries=filter(is_context_dependent, - exposed_construct_entries), - operation_entries=filter(is_context_dependent, operation_entries)) + attribute_entries=list(filter(is_context_dependent, + attribute_entries)), + constant_entries=list(filter(is_context_dependent, constant_entries)), + exposed_construct_entries=list( + filter(is_context_dependent, exposed_construct_entries)), + operation_entries=list(filter(is_context_dependent, + operation_entries))) (install_interface_template_decl, install_interface_template_def, install_interface_template_trampoline) = make_install_interface_template( cg_context, diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py index b4c70553863..f3a2fcd772d 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/mako_renderer.py @@ -105,7 +105,7 @@ class MakoRenderer(object): on_error = self._caller_stack_on_error if (len(current) <= len(on_error) and all(current[i] == on_error[i] - for i in xrange(len(current)))): + for i in range(len(current)))): pass # Error happened in a deeper caller. else: self._caller_stack_on_error = list(self._caller_stack) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/path_manager.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/path_manager.py index 931347f0849..f74776cc373 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/path_manager.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/path_manager.py @@ -135,7 +135,8 @@ class PathManager(object): # # Avoid name_style.file not to make "Int32Array" into # "int_32_array". - filename = "V8_{}".format(idl_definition.identifier).lower() + filename = "v8_union_{}".format("_".join( + idl_definition.member_tokens)).lower() self._api_basename = filename self._impl_basename = filename elif isinstance(idl_definition, web_idl.Union): @@ -210,13 +211,13 @@ class PathManager(object): # //third_party/blink/renderer/bindings/scripts/utilities.py _BACKWARD_COMPATIBLE_UNION_FILEPATHS = { # modules/canvas2d/CanvasRenderingContext2D.idl - "CSSImageValueOrHTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvas": + "CSSImageValueOrHTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvasOrVideoFrame": "CanvasImageSource", # modules/canvas/htmlcanvas/html_canvas_element_module.idl "CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrImageBitmapRenderingContextOrGPUCanvasContext": "RenderingContext", # core/frame/window_or_worker_global_scope.idl - "HTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrImageBitmapOrOffscreenCanvas": + "HTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrImageBitmapOrOffscreenCanvasOrVideoFrame": "ImageBitmapSource", # bindings/tests/idls/core/TestTypedefs.idl "NodeOrLongSequenceOrEventOrXMLHttpRequestOrStringOrStringByteStringOrNodeListRecord": @@ -230,4 +231,7 @@ _BACKWARD_COMPATIBLE_UNION_FILEPATHS = { # modules/beacon/navigator_beacon.idl 'ReadableStreamOrBlobOrArrayBufferOrArrayBufferViewOrFormDataOrURLSearchParamsOrUSVString': 'ReadableStreamOrXMLHttpRequestBodyInit', + # modules/mediasource/source_buffer.idl + 'EncodedAudioChunkOrEncodedVideoChunkSequenceOrEncodedAudioChunkOrEncodedVideoChunk': + 'EncodedAVChunkSequenceOrEncodedAVChunk', } diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py index dc3493cc394..017d3d47bb3 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py @@ -70,8 +70,13 @@ def gn_format(contents, filename=None): def _invoke_format_command(command_line, filename, contents): - proc = subprocess.Popen( - command_line, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + kwargs = {} + if sys.version_info.major != 2: + kwargs['encoding'] = 'utf-8' + proc = subprocess.Popen(command_line, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + **kwargs) stdout_output, stderr_output = proc.communicate(input=contents) exit_code = proc.wait() diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py index 0fab5c2813b..ab569ee28ec 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import functools import multiprocessing from .package_initializer import package_initializer @@ -77,7 +78,7 @@ class TaskQueue(object): def report_worker_task_progress(): if not report_progress: return - done_count = reduce( + done_count = functools.reduce( lambda count, worker_task: count + bool(worker_task.ready()), self._worker_tasks, 0) report_progress(len(self._worker_tasks), done_count) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/union.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/union.py index db135ca9796..d55debdb474 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/union.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/union.py @@ -7,13 +7,21 @@ import web_idl from . import name_style from .blink_v8_bridge import blink_class_name from .blink_v8_bridge import blink_type_info +from .blink_v8_bridge import make_v8_to_blink_value +from .blink_v8_bridge import native_value_tag +from .blink_v8_bridge import v8_bridge_class_name from .code_node import EmptyNode from .code_node import ListNode +from .code_node import SymbolNode +from .code_node import SymbolScopeNode from .code_node import TextNode +from .code_node_cxx import CxxBlockNode from .code_node_cxx import CxxClassDefNode from .code_node_cxx import CxxFuncDeclNode from .code_node_cxx import CxxFuncDefNode from .code_node_cxx import CxxNamespaceNode +from .code_node_cxx import CxxSwitchNode +from .code_node_cxx import CxxUnlikelyIfNode from .codegen_accumulator import CodeGenAccumulator from .codegen_context import CodeGenContext from .codegen_format import format_template as _format @@ -43,8 +51,9 @@ class _UnionMember(object): self._api_pred = "Is{}".format(self._base_name) self._api_get = "GetAs{}".format(self._base_name) self._api_set = "Set" - self._member_var = name_style.member_var("member", self._base_name) - self._member_type = None + self._var_name = name_style.member_var("member", self._base_name) + self._idl_type = None + self._type_info = None self._typedef_aliases = () @property @@ -70,12 +79,16 @@ class _UnionMember(object): return self._api_set @property - def member_var(self): - return self._member_var + def var_name(self): + return self._var_name @property - def member_type(self): - return self._member_type + def idl_type(self): + return self._idl_type + + @property + def type_info(self): + return self._type_info @property def typedef_aliases(self): @@ -95,7 +108,8 @@ class _UnionMemberImpl(_UnionMember): _UnionMember.__init__(self, base_name=base_name) self._is_null = idl_type is None if not self._is_null: - self._member_type = blink_type_info(idl_type) + self._idl_type = idl_type + self._type_info = blink_type_info(idl_type) self._typedef_aliases = tuple([ _UnionMemberAlias(impl=self, typedef=typedef) for typedef in union.typedef_members @@ -103,13 +117,43 @@ class _UnionMemberImpl(_UnionMember): ]) +class _UnionMemberSubunion(_UnionMember): + def __init__(self, union, subunion): + assert isinstance(union, web_idl.NewUnion) + assert isinstance(subunion, web_idl.NewUnion) + + _UnionMember.__init__(self, base_name=blink_class_name(subunion)) + self._type_info = blink_type_info(subunion.idl_types[0], + use_new_union=True) + self._typedef_aliases = tuple( + map(lambda typedef: _UnionMemberAlias(impl=self, typedef=typedef), + subunion.aliasing_typedefs)) + self._blink_class_name = blink_class_name(subunion) + + @property + def blink_class_name(self): + return self._blink_class_name + + class _UnionMemberAlias(_UnionMember): def __init__(self, impl, typedef): - assert isinstance(impl, _UnionMemberImpl) + assert isinstance(impl, (_UnionMemberImpl, _UnionMemberSubunion)) assert isinstance(typedef, web_idl.Typedef) _UnionMember.__init__(self, base_name=typedef.identifier) - self._member_var = impl.member_var + self._var_name = impl.var_name + self._type_info = impl.type_info + + +def create_union_members(union): + assert isinstance(union, web_idl.NewUnion) + + union_members = map( + lambda member_type: _UnionMemberImpl(union, member_type), + union.flattened_member_types) + if union.does_include_nullable_type: + union_members.append(_UnionMemberImpl(union, idl_type=None)) + return tuple(union_members) def make_content_type_enum_class_def(cg_context): @@ -124,12 +168,424 @@ def make_content_type_enum_class_def(cg_context): member.content_type(with_enum_name=False))) return ListNode([ + TextNode("// The type of the content value of this IDL union."), TextNode("enum class ContentType {"), ListNode(map(TextNode, entries), separator=", "), TextNode("};"), ]) +def make_factory_methods(cg_context): + assert isinstance(cg_context, CodeGenContext) + + S = SymbolNode + T = TextNode + + func_decl = CxxFuncDeclNode(name="Create", + arg_decls=[ + "v8::Isolate* isolate", + "v8::Local v8_value", + "ExceptionState& exception_state", + ], + return_type="${class_name}*", + static=True) + + func_def = CxxFuncDefNode(name="Create", + arg_decls=[ + "v8::Isolate* isolate", + "v8::Local v8_value", + "ExceptionState& exception_state", + ], + return_type="${class_name}*", + class_name="${class_name}") + func_def.set_base_template_vars(cg_context.template_bindings()) + + body = func_def.body + body.add_template_vars({ + "isolate": "isolate", + "v8_value": "v8_value", + "exception_state": "exception_state", + }) + + # Create an instance from v8::Value based on the overload resolution + # algorithm. + # https://heycam.github.io/webidl/#dfn-overload-resolution-algorithm + + union_members = cg_context.union_members + member = None # Will be a found member in union_members. + + def find_by_member(test): + for member in union_members: + if test(member): + return member + return None + + def find_by_type(test): + for member in union_members: + if member.idl_type and test(member.idl_type): + return member + return None + + def dispatch_if(cond_text, value_symbol=None): + scope_node = SymbolScopeNode( + [T("return MakeGarbageCollected<${class_name}>(${blink_value});")]) + if not value_symbol: + value_symbol = make_v8_to_blink_value( + "blink_value", + "${v8_value}", + member.idl_type, + error_exit_return_statement="return nullptr;") + scope_node.register_code_symbol(value_symbol) + if cond_text is True: + body.append(CxxBlockNode(body=scope_node)) + else: + body.append(CxxUnlikelyIfNode(cond=cond_text, body=scope_node)) + + # 12.3. if V is null or undefined, ... + member = find_by_member(lambda m: m.is_null) + if member: + dispatch_if("${v8_value}->IsNullOrUndefined()", + S("blink_value", "auto&& ${blink_value} = nullptr;")) + + # 12.4. if V is a platform object, ... + interface_members = filter( + lambda member: member.idl_type and member.idl_type.is_interface, + union_members) + interface_members = sorted( + interface_members, + key=lambda member: (len(member.idl_type.type_definition_object. + inclusive_inherited_interfaces), member. + idl_type.type_definition_object.identifier), + reverse=True) + # Attempt to match from most derived to least derived. + for member in interface_members: + v8_bridge_name = v8_bridge_class_name( + member.idl_type.type_definition_object) + dispatch_if( + _format("{}::HasInstance(${isolate}, ${v8_value})", + v8_bridge_name)) + + # 12.5. if Type(V) is Object, V has an [[ArrayBufferData]] internal + # slot, ... + member = find_by_type(lambda t: t.is_array_buffer) + if member: + dispatch_if("${v8_value}->IsArrayBuffer() || " + "${v8_value}->IsSharedArrayBuffer()") + + # V8 specific optimization: ArrayBufferView + member = find_by_type(lambda t: t.is_array_buffer_view) + if member: + dispatch_if("${v8_value}->IsArrayBufferView()") + + # 12.6. if Type(V) is Object, V has a [[DataView]] internal slot, ... + member = find_by_type(lambda t: t.is_data_view) + if member: + dispatch_if("${v8_value}->IsDataView()") + + # 12.7. if Type(V) is Object, V has a [[TypedArrayName]] internal slot, ... + typed_array_types = ("Int8Array", "Int16Array", "Int32Array", "Uint8Array", + "Uint16Array", "Uint32Array", "Uint8ClampedArray", + "Float32Array", "Float64Array") + for typed_array_type in typed_array_types: + member = find_by_type(lambda t: t.keyword_typename == typed_array_type) + if member: + dispatch_if(_format("${v8_value}->Is{}()", typed_array_type)) + + # 12.8. if IsCallable(V) is true, ... + member = find_by_type(lambda t: t.is_callback_function) + if member: + dispatch_if("${v8_value}->IsFunction()") + + # 12.9. if Type(V) is Object and ... @@iterator ... + member = find_by_type(lambda t: t.is_sequence or t.is_frozen_array) + if member: + dispatch_if("${v8_value}->IsArray() || " # Excessive optimization + "bindings::IsEsIterableObject" + "(${isolate}, ${v8_value}, ${exception_state})") + body.append( + CxxUnlikelyIfNode(cond="${exception_state}.HadException()", + body=T("return nullptr;"))) + + # 12.10. if Type(V) is Object and ... + member = find_by_type(lambda t: t.is_callback_interface or t.is_dictionary + or t.is_record or t.is_object) + if member: + dispatch_if("${v8_value}->IsObject()") + + # 12.11. if Type(V) is Boolean and ... + member = find_by_type(lambda t: t.is_boolean) + if member: + dispatch_if("${v8_value}->IsBoolean()") + + # 12.12. if Type(V) is Number and ... + member = find_by_type(lambda t: t.is_numeric) + if member: + dispatch_if("${v8_value}->IsNumber()") + + # 12.13. if there is an entry in S that has ... a string type ... + # 12.14. if there is an entry in S that has ... a numeric type ... + # 12.15. if there is an entry in S that has ... boolean ... + member = find_by_type(lambda t: t.is_enumeration or t.is_string or t. + is_numeric or t.is_boolean) + if member: + dispatch_if(True) + else: + body.append( + T("${exception_state}.ThrowTypeError(" + "ExceptionMessages::ValueNotOfType(" + "UnionNameInIDL().Ascii().c_str()));")) + body.append(T("return nullptr;")) + + return func_decl, func_def + + +def make_constructors(cg_context): + assert isinstance(cg_context, CodeGenContext) + + decls = ListNode() + + for member in cg_context.union_members: + if member.is_null: + func_def = CxxFuncDefNode(name=cg_context.class_name, + arg_decls=["std::nullptr_t"], + return_type="", + explicit=True, + member_initializer_list=[ + "content_type_({})".format( + member.content_type()), + ]) + else: + func_def = CxxFuncDefNode( + name=cg_context.class_name, + arg_decls=["{} value".format(member.type_info.member_ref_t)], + return_type="", + explicit=True, + member_initializer_list=[ + "content_type_({})".format(member.content_type()), + "{}(value)".format(member.var_name), + ]) + decls.append(func_def) + + return decls, None + + +def make_accessor_functions(cg_context): + assert isinstance(cg_context, CodeGenContext) + + T = TextNode + F = lambda *args, **kwargs: T(_format(*args, **kwargs)) + + decls = ListNode() + defs = ListNode() + + func_def = CxxFuncDefNode(name="GetContentType", + arg_decls=[], + return_type="ContentType", + const=True) + func_def.set_base_template_vars(cg_context.template_bindings()) + func_def.body.append(T("return content_type_;")) + decls.extend([ + T("// Returns the type of the content value."), + func_def, + EmptyNode(), + ]) + + def make_api_pred(member): + func_def = CxxFuncDefNode(name=member.api_pred, + arg_decls=[], + return_type="bool", + const=True) + func_def.set_base_template_vars(cg_context.template_bindings()) + func_def.body.append( + F("return content_type_ == {};", member.content_type())) + return func_def + + def make_api_get(member): + func_def = CxxFuncDefNode(name=member.api_get, + arg_decls=[], + return_type=member.type_info.member_ref_t, + const=True) + func_def.set_base_template_vars(cg_context.template_bindings()) + func_def.body.extend([ + F("DCHECK_EQ(content_type_, {});", member.content_type()), + F("return {};", member.var_name), + ]) + return func_def + + def make_api_set(member): + func_def = CxxFuncDefNode( + name=member.api_set, + arg_decls=["{} value".format(member.type_info.member_ref_t)], + return_type="void") + func_def.set_base_template_vars(cg_context.template_bindings()) + func_def.body.extend([ + T("Clear();"), + F("{} = value;", member.var_name), + F("content_type_ = {};", member.content_type()), + ]) + return func_def + + def make_api_set_null(member): + func_def = CxxFuncDefNode(name=member.api_set, + arg_decls=["std::nullptr_t"], + return_type="void") + func_def.set_base_template_vars(cg_context.template_bindings()) + func_def.body.extend([ + T("Clear();"), + F("content_type_ = {};", member.content_type()), + ]) + return func_def + + for member in cg_context.union_members: + if member.is_null: + decls.append(make_api_pred(member)) + decls.append(make_api_set_null(member)) + else: + decls.append(make_api_pred(member)) + for alias in member.typedef_aliases: + decls.append(make_api_pred(alias)) + decls.append(make_api_get(member)) + for alias in member.typedef_aliases: + decls.append(make_api_get(alias)) + decls.append(make_api_set(member)) + decls.append(EmptyNode()) + + def make_api_subunion_pred(subunion, subunion_members): + func_def = CxxFuncDefNode(name=subunion.api_pred, + arg_decls=[], + return_type="bool", + const=True) + func_def.set_base_template_vars(cg_context.template_bindings()) + expr = " || ".join( + map( + lambda member: "content_type_ == {}".format( + member.content_type()), subunion_members)) + func_def.body.append(F("return {};", expr)) + return func_def, None + + def make_api_subunion_get(subunion, subunion_members): + func_decl = CxxFuncDeclNode(name=subunion.api_get, + arg_decls=[], + return_type=subunion.type_info.value_t, + const=True) + func_def = CxxFuncDefNode(name=subunion.api_get, + arg_decls=[], + return_type=subunion.type_info.value_t, + const=True, + class_name=cg_context.class_name) + func_def.set_base_template_vars(cg_context.template_bindings()) + node = CxxSwitchNode(cond="content_type_") + node.append(case=None, + body=[T("NOTREACHED();"), + T("return nullptr;")], + should_add_break=False) + for member in subunion_members: + node.append(case=member.content_type(), + body=F("return MakeGarbageCollected<{}>({}());", + subunion.blink_class_name, member.api_get), + should_add_break=False) + func_def.body.append(node) + return func_decl, func_def + + def make_api_subunion_set(subunion, subunion_members): + func_decl = CxxFuncDeclNode( + name=subunion.api_set, + arg_decls=["{} value".format(subunion.type_info.const_ref_t)], + return_type="void") + func_def = CxxFuncDefNode( + name=subunion.api_set, + arg_decls=["{} value".format(subunion.type_info.const_ref_t)], + return_type="void", + class_name=cg_context.class_name) + func_def.set_base_template_vars(cg_context.template_bindings()) + node = CxxSwitchNode(cond="value->GetContentType()") + for member in subunion_members: + node.append(case=F("{}::{}", subunion.blink_class_name, + member.content_type()), + body=F("Set(value->{}());", member.api_get)) + func_def.body.append(node) + return func_decl, func_def + + for subunion in cg_context.union.union_members: + subunion_members = create_union_members(subunion) + subunion = _UnionMemberSubunion(cg_context.union, subunion) + func_decl, func_def = make_api_subunion_pred(subunion, + subunion_members) + decls.append(func_decl) + defs.append(func_def) + defs.append(EmptyNode()) + func_decl, func_def = make_api_subunion_get(subunion, subunion_members) + decls.append(func_decl) + defs.append(func_def) + defs.append(EmptyNode()) + func_decl, func_def = make_api_subunion_set(subunion, subunion_members) + decls.append(func_decl) + defs.append(func_def) + defs.append(EmptyNode()) + decls.append(EmptyNode()) + + return decls, defs + + +def make_clear_function(cg_context): + assert isinstance(cg_context, CodeGenContext) + + func_decl = CxxFuncDeclNode(name="Clear", arg_decls=[], return_type="void") + + func_def = CxxFuncDefNode(name="Clear", + arg_decls=[], + return_type="void", + class_name=cg_context.class_name) + func_def.set_base_template_vars(cg_context.template_bindings()) + body = func_def.body + + for member in cg_context.union_members: + if member.is_null: + continue + clear_expr = member.type_info.clear_member_var_expr(member.var_name) + if clear_expr: + body.append(TextNode("{};".format(clear_expr))) + + return func_decl, func_def + + +def make_tov8value_function(cg_context): + assert isinstance(cg_context, CodeGenContext) + + func_decl = CxxFuncDeclNode(name="ToV8Value", + arg_decls=["ScriptState* script_state"], + return_type="v8::MaybeLocal", + override=True) + + func_def = CxxFuncDefNode(name="ToV8Value", + arg_decls=["ScriptState* script_state"], + return_type="v8::MaybeLocal", + class_name=cg_context.class_name) + func_def.set_base_template_vars(cg_context.template_bindings()) + body = func_def.body + body.add_template_vars({"script_state": "script_state"}) + + branches = CxxSwitchNode(cond="content_type_") + for member in cg_context.union_members: + if member.is_null: + text = "return v8::Null(${script_state}->GetIsolate());" + else: + text = _format("return ToV8Traits<{}>::ToV8(${script_state}, {});", + native_value_tag(member.idl_type), member.var_name) + branches.append(case=member.content_type(), + body=TextNode(text), + should_add_break=False) + + body.extend([ + branches, + EmptyNode(), + TextNode("NOTREACHED();"), + TextNode("return v8::MaybeLocal();"), + ]) + + return func_decl, func_def + + def make_trace_function(cg_context): assert isinstance(cg_context, CodeGenContext) @@ -152,20 +608,54 @@ def make_trace_function(cg_context): continue body.append( TextNode("TraceIfNeeded<{}>::Trace(visitor, {});".format( - member.member_type.member_t, member.member_var))) + member.type_info.member_t, member.var_name))) body.append(TextNode("${base_class_name}::Trace(visitor);")) return func_decl, func_def +def make_name_function(cg_context): + assert isinstance(cg_context, CodeGenContext) + + func_def = CxxFuncDefNode(name="UnionNameInIDL", + arg_decls=[], + return_type="String", + static=True) + func_def.set_base_template_vars(cg_context.template_bindings()) + body = func_def.body + + body.extend([ + TextNode("static constexpr const char* const member_names[] = {"), + ListNode(list( + map( + lambda name: TextNode("\"{}\"".format(name)), + sorted( + map(lambda idl_type: idl_type.syntactic_form, + cg_context.union.flattened_member_types)))), + separator=", "), + TextNode("};"), + TextNode("return ProduceUnionNameInIDL(member_names);"), + ]) + + return func_def, None + + def make_member_vars_def(cg_context): assert isinstance(cg_context, CodeGenContext) + member_vars_def = ListNode() + member_vars_def.extend([ + TextNode("ContentType content_type_;"), + EmptyNode(), + ]) + entries = [ - "{} {};".format(member.member_type.member_t, member.member_var) + "{} {};".format(member.type_info.member_t, member.var_name) for member in cg_context.union_members if not member.is_null ] - return ListNode(map(TextNode, entries)) + member_vars_def.extend(map(TextNode, entries)) + + return member_vars_def def generate_union(union_identifier): @@ -182,13 +672,8 @@ def generate_union(union_identifier): # Class names class_name = blink_class_name(union) - union_members = map( - lambda member_type: _UnionMemberImpl(union=union, idl_type=member_type - ), union.flattened_member_types) - if union.does_include_nullable_type: - union_members.append(_UnionMemberImpl(union=union, idl_type=None)) cg_context = CodeGenContext(union=union, - union_members=tuple(union_members), + union_members=create_union_members(union), class_name=class_name, base_class_name="bindings::UnionBase") @@ -218,7 +703,14 @@ def generate_union(union_identifier): # Implementation parts content_type_enum_class_def = make_content_type_enum_class_def(cg_context) - trace_decls, trace_defs = make_trace_function(cg_context) + factory_decls, factory_defs = make_factory_methods(cg_context) + ctor_decls, ctor_defs = make_constructors(cg_context) + accessor_decls, accessor_defs = make_accessor_functions(cg_context) + clear_func_decls, clear_func_defs = make_clear_function(cg_context) + tov8value_func_decls, tov8value_func_defs = make_tov8value_function( + cg_context) + trace_func_decls, trace_func_defs = make_trace_function(cg_context) + name_func_decls, name_func_defs = make_name_function(cg_context) member_vars_def = make_member_vars_def(cg_context) # Header part (copyright, include directives, and forward declarations) @@ -251,10 +743,28 @@ def generate_union(union_identifier): ]) # Assemble the parts. + header_node.accumulator.add_class_decls([ + "ExceptionState", + ]) header_node.accumulator.add_include_headers([ component_export_header(api_component, for_testing), "third_party/blink/renderer/platform/bindings/union_base.h", ]) + source_node.accumulator.add_include_headers([ + "third_party/blink/renderer/bindings/core/v8/generated_code_helper.h", + "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h", + "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h", + "third_party/blink/renderer/platform/bindings/exception_state.h", + ]) + header_node.accumulator.add_class_decls( + map(blink_class_name, union.union_members)) + source_node.accumulator.add_include_headers( + map(lambda subunion: PathManager(subunion).api_path(ext="h"), + union.union_members)) + source_node.accumulator.add_include_headers([ + PathManager(idl_type.type_definition_object).api_path(ext="h") + for idl_type in union.flattened_member_types if idl_type.is_interface + ]) (header_forward_decls, header_include_headers, source_forward_decls, source_include_headers) = collect_forward_decls_and_include_headers( union.flattened_member_types) @@ -266,16 +776,43 @@ def generate_union(union_identifier): header_blink_ns.body.append(class_def) header_blink_ns.body.append(EmptyNode()) - class_def.public_section.extend([ - content_type_enum_class_def, - EmptyNode(), - trace_decls, - EmptyNode(), - ]) - source_blink_ns.body.extend([ - trace_defs, - EmptyNode(), - ]) + class_def.public_section.append(content_type_enum_class_def) + class_def.public_section.append(EmptyNode()) + + class_def.public_section.append(factory_decls) + class_def.public_section.append(EmptyNode()) + source_blink_ns.body.append(factory_defs) + source_blink_ns.body.append(EmptyNode()) + + class_def.public_section.append(ctor_decls) + class_def.public_section.append(EmptyNode()) + source_blink_ns.body.append(ctor_defs) + source_blink_ns.body.append(EmptyNode()) + + class_def.public_section.append(accessor_decls) + class_def.public_section.append(EmptyNode()) + source_blink_ns.body.append(accessor_defs) + source_blink_ns.body.append(EmptyNode()) + + class_def.public_section.append(clear_func_decls) + class_def.public_section.append(EmptyNode()) + source_blink_ns.body.append(clear_func_defs) + source_blink_ns.body.append(EmptyNode()) + + class_def.public_section.append(tov8value_func_decls) + class_def.public_section.append(EmptyNode()) + source_blink_ns.body.append(tov8value_func_defs) + source_blink_ns.body.append(EmptyNode()) + + class_def.public_section.append(trace_func_decls) + class_def.public_section.append(EmptyNode()) + source_blink_ns.body.append(trace_func_defs) + source_blink_ns.body.append(EmptyNode()) + + class_def.private_section.append(name_func_decls) + class_def.private_section.append(EmptyNode()) + source_blink_ns.body.append(name_func_defs) + source_blink_ns.body.append(EmptyNode()) class_def.private_section.append(member_vars_def) class_def.private_section.append(EmptyNode()) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py b/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py index 130004eae83..04c0fabcef2 100755 --- a/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py @@ -80,7 +80,7 @@ def read_idl_file(reader, idl_filename): assert len(interfaces) == 1, ( "Expected one interface in file %r, found %d" % (idl_filename, len(interfaces))) - return (interfaces.values()[0], includes) + return (list(interfaces.values())[0], includes) def interface_is_global(interface): @@ -281,7 +281,7 @@ def main(): info_provider = create_component_info_provider( os.path.normpath(options.info_dir), options.target_component) - idl_filenames = map(str.strip, open(options.idl_files_list)) + idl_filenames = list(map(str.strip, open(options.idl_files_list))) generate_origin_trial_features(info_provider, options, idl_filenames) return 0 diff --git a/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py b/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py index 0fc86d4a24c..3db6074896b 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py @@ -394,7 +394,8 @@ class IdlInterface(object): else: raise ValueError('Unrecognized node class: %s' % child_class) - if len(filter(None, [self.iterable, self.maplike, self.setlike])) > 1: + if len(list(filter(None, + [self.iterable, self.maplike, self.setlike]))) > 1: raise ValueError( 'Interface can only have one of iterable<>, maplike<> and setlike<>.' ) @@ -512,6 +513,9 @@ class IdlAttribute(TypedObject): def accept(self, visitor): visitor.visit_attribute(self) + def __lt__(self, other): + return self.name < other.name + ################################################################################ # Constants @@ -852,7 +856,7 @@ class IdlIncludes(object): ################################################################################ -class Exposure: +class Exposure(object): """An Exposure holds one Exposed or RuntimeEnabled condition. Each exposure has two properties: exposed and runtime_enabled. Exposure(e, r) corresponds to [Exposed(e r)]. Exposure(e) corresponds to diff --git a/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py b/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py index 8d72865a6ca..b80eebdcd61 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py @@ -55,8 +55,8 @@ def validate_blink_idl_definitions(idl_filename, idl_file_basename, definitions. There is no filename convention in this case. - Otherwise, an IDL file is invalid. """ - targets = ( - definitions.interfaces.values() + definitions.dictionaries.values()) + targets = (list(definitions.interfaces.values()) + + list(definitions.dictionaries.values())) number_of_targets = len(targets) if number_of_targets > 1: raise Exception( diff --git a/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py b/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py index cd4f0c3513b..ab95e9c0b08 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/idl_types.py @@ -349,7 +349,7 @@ class IdlUnionType(IdlTypeBase): return True def single_matching_member_type(self, predicate): - matching_types = filter(predicate, self.flattened_member_types) + matching_types = list(filter(predicate, self.flattened_member_types)) if len(matching_types) > 1: raise ValueError('%s is ambiguous.' % self.name) return matching_types[0] if matching_types else None diff --git a/chromium/third_party/blink/renderer/bindings/scripts/scripts.gni b/chromium/third_party/blink/renderer/bindings/scripts/scripts.gni index af34ef234a9..eb796d6ba09 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/scripts.gni +++ b/chromium/third_party/blink/renderer/bindings/scripts/scripts.gni @@ -66,8 +66,7 @@ idl_compiler_files = get_path_info( # component_info_file = output pickle file for component wide info. # deps = dependencies template("compute_interfaces_info") { - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - python2_action(target_name) { + action(target_name) { script = "$bindings_scripts_dir/compute_interfaces_info_individual.py" if (defined(invoker.visibility)) { visibility = invoker.visibility @@ -114,8 +113,7 @@ template("compute_interfaces_info") { # output_file = The .in file to write, relative to the blink_gen_dir. # suffix = (Optional) String to be passed to script via --suffix template("generate_event_interfaces") { - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - python2_action(target_name) { + action(target_name) { # Write the file list to a unique temp file to avoid blowing out the # command line length limit. idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" @@ -166,7 +164,6 @@ template("idl_compiler") { idl_lexer_parser_files + idl_compiler_files # to be explicit (covered by # parsetab) _inputs += [ - "$bindings_scripts_output_dir/lextab.py", "$bindings_scripts_output_dir/parsetab.pickle", "$bindings_scripts_output_dir/cached_jinja_templates.stamp", "$bindings_dir/IDLExtendedAttributes.txt", @@ -199,8 +196,7 @@ template("idl_compiler") { # Spawning a python process per IDL file is slow. Use a single action # instead (crbug.com/821256). - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - python2_action(target_name) { + action(target_name) { script = _script inputs = _inputs public_deps = _public_deps @@ -249,8 +245,7 @@ template("idl_compiler") { template("idl_impl") { dictionary_impl_output_dir = "$root_gen_dir/third_party/blink/renderer/" - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - python2_action(target_name) { + action(target_name) { script = "//third_party/blink/renderer/bindings/scripts/idl_compiler.py" idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" write_file(idl_files_list, rebase_path(invoker.dict_idls, root_build_dir)) @@ -259,7 +254,6 @@ template("idl_impl") { idl_lexer_parser_files + idl_compiler_files # to be explicit (covered # by parsetab) inputs += [ - "$bindings_scripts_output_dir/lextab.py", "$bindings_scripts_output_dir/parsetab.pickle", "$bindings_scripts_output_dir/cached_jinja_templates.stamp", "$bindings_dir/IDLExtendedAttributes.txt", @@ -444,8 +438,7 @@ template("generate_global_constructors") { # deps = dependencies # template("generate_origin_trial_features") { - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - python2_action(target_name) { + action(target_name) { script = "//third_party/blink/renderer/bindings/scripts/generate_origin_trial_features.py" # Write the file list to a unique temp file to avoid blowing out the diff --git a/chromium/third_party/blink/renderer/bindings/scripts/utilities.py b/chromium/third_party/blink/renderer/bindings/scripts/utilities.py index af664e0f239..954c5ad02c5 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/utilities.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/utilities.py @@ -196,8 +196,9 @@ class ComponentInfoProviderModules(ComponentInfoProvider): @property def callback_functions(self): - return dict(self._component_info_core['callback_functions'].items() + - self._component_info_modules['callback_functions'].items()) + return dict( + list(self._component_info_core['callback_functions'].items()) + + list(self._component_info_modules['callback_functions'].items())) @property def specifier_for_export(self): @@ -209,8 +210,8 @@ class ComponentInfoProviderModules(ComponentInfoProvider): def load_interfaces_info_overall_pickle(info_dir): - with open(os.path.join(info_dir, - 'interfaces_info.pickle')) as interface_info_file: + with open(os.path.join(info_dir, 'interfaces_info.pickle'), + mode='rb') as interface_info_file: return pickle.load(interface_info_file) @@ -236,23 +237,20 @@ def merge_dict_recursively(target, diff): def create_component_info_provider_core(info_dir): interfaces_info = load_interfaces_info_overall_pickle(info_dir) - with open( - os.path.join(info_dir, 'core', - 'component_info_core.pickle')) as component_info_file: + with open(os.path.join(info_dir, 'core', 'component_info_core.pickle'), + mode='rb') as component_info_file: component_info = pickle.load(component_info_file) return ComponentInfoProviderCore(interfaces_info, component_info) def create_component_info_provider_modules(info_dir): interfaces_info = load_interfaces_info_overall_pickle(info_dir) - with open( - os.path.join(info_dir, 'core', - 'component_info_core.pickle')) as component_info_file: + with open(os.path.join(info_dir, 'core', 'component_info_core.pickle'), + mode='rb') as component_info_file: component_info_core = pickle.load(component_info_file) - with open( - os.path.join( - info_dir, 'modules', - 'component_info_modules.pickle')) as component_info_file: + with open(os.path.join(info_dir, 'modules', + 'component_info_modules.pickle'), + mode='rb') as component_info_file: component_info_modules = pickle.load(component_info_file) return ComponentInfoProviderModules(interfaces_info, component_info_core, component_info_modules) @@ -347,7 +345,7 @@ def write_file(new_text, destination_filename): def write_pickle_file(pickle_filename, data): # If |data| is same with the file content, we skip updating. if os.path.isfile(pickle_filename): - with open(pickle_filename) as pickle_file: + with open(pickle_filename, 'rb') as pickle_file: try: if pickle.load(pickle_file) == data: return @@ -477,13 +475,13 @@ def get_first_interface_name_from_idl(file_contents): def shorten_union_name(union_type): aliases = { # modules/canvas2d/CanvasRenderingContext2D.idl - 'CSSImageValueOrHTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvas': + 'CSSImageValueOrHTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrImageBitmapOrOffscreenCanvasOrVideoFrame': 'CanvasImageSource', # modules/canvas/htmlcanvas/html_canvas_element_module.idl 'CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrImageBitmapRenderingContextOrGPUCanvasContext': 'RenderingContext', # core/frame/window_or_worker_global_scope.idl - 'HTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrImageBitmapOrOffscreenCanvas': + 'HTMLImageElementOrSVGImageElementOrHTMLVideoElementOrHTMLCanvasElementOrBlobOrImageDataOrImageBitmapOrOffscreenCanvasOrVideoFrame': 'ImageBitmapSource', # bindings/tests/idls/core/TestTypedefs.idl 'NodeOrLongSequenceOrEventOrXMLHttpRequestOrStringOrStringByteStringOrNodeListRecord': @@ -497,6 +495,9 @@ def shorten_union_name(union_type): # modules/beacon/navigator_beacon.idl 'ReadableStreamOrBlobOrArrayBufferOrArrayBufferViewOrFormDataOrURLSearchParamsOrUSVString': 'ReadableStreamOrXMLHttpRequestBodyInit', + # modules/mediasource/source_buffer.idl + 'EncodedAudioChunkOrEncodedVideoChunkSequenceOrEncodedAudioChunkOrEncodedVideoChunk': + 'EncodedAVChunkSequenceOrEncodedAVChunk', } idl_type = union_type diff --git a/chromium/third_party/blink/renderer/bindings/scripts/v8_attributes.py b/chromium/third_party/blink/renderer/bindings/scripts/v8_attributes.py index 45aba557fc5..c3ba34281dd 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/v8_attributes.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/v8_attributes.py @@ -104,8 +104,7 @@ def attribute_context(interface, attribute, interfaces, component_info): is_ce_reactions = 'CEReactions' in extended_attributes if is_ce_reactions: includes.add('core/html/custom/ce_reactions_scope.h') - # [CustomElementCallbacks], [Reflect] - is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes + # [Reflect] is_reflect = 'Reflect' in extended_attributes # [ReflectOnly] reflect_only = extended_attribute_value_as_list(attribute, 'ReflectOnly') @@ -113,8 +112,6 @@ def attribute_context(interface, attribute, interfaces, component_info): reflect_only = map( lambda v: cpp_content_attribute_value_name(interface, v), reflect_only) - if is_custom_element_callbacks or is_reflect: - includes.add('core/html/custom/v0_custom_element_processing_stack.h') # [PerWorldBindings] if 'PerWorldBindings' in extended_attributes: assert idl_type.is_wrapper_type or 'LogActivity' in \ @@ -238,7 +235,6 @@ def attribute_context(interface, attribute, interfaces, component_info): 'is_check_security_for_receiver': is_check_security_for_receiver, 'is_check_security_for_return_value': is_check_security_for_return_value, - 'is_custom_element_callbacks': is_custom_element_callbacks, # TODO(yukishiino): Make all DOM attributes accessor-type properties. 'is_data_type_property': is_data_type_property(interface, attribute), 'is_getter_raises_exception': # [RaisesException] diff --git a/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py b/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py index a43260414db..a85b03abe75 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/v8_interface.py @@ -189,7 +189,7 @@ def context_enabled_features(attributes): return sorted([ member for member in members if member.get(KEY) and not member.get('exposed_test') - ]) + ], key=lambda item: item['name']) def member_filter_by_name(members, name): return [member for member in members if member[KEY] == name] @@ -612,7 +612,8 @@ def interface_context(interface, interfaces, component_info): sorted( origin_trial_features(interface, context['constants'], context['attributes'], context['methods']) + - context_enabled_features(context['attributes'])), + context_enabled_features(context['attributes']), + key=lambda item: item['name']), }) if context['optional_features']: includes.add('platform/bindings/v8_per_context_data.h') @@ -1356,9 +1357,9 @@ def resolution_tests_methods(effective_overloads): # Extract argument and IDL type to simplify accessing these in each loop. arguments = [method['arguments'][index] for method in methods] - arguments_methods = zip(arguments, methods) + arguments_methods = list(zip(arguments, methods)) idl_types = [argument['idl_type_object'] for argument in arguments] - idl_types_methods = zip(idl_types, methods) + idl_types_methods = list(zip(idl_types, methods)) # We can’t do a single loop through all methods or simply sort them, because # a method may be listed in multiple steps of the resolution algorithm, and diff --git a/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py b/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py index 5f1f89a3def..4548c9db43c 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py @@ -46,6 +46,10 @@ import v8_types import v8_utilities from v8_utilities import (has_extended_attribute_value, is_unforgeable) +# TODO(crbug.com/1174969): Remove this once Python2 is obsoleted. +if sys.version_info.major != 2: + basestring = str + def method_is_visible(method, interface_is_partial): if 'overloads' in method: @@ -183,9 +187,6 @@ def method_context(interface, method, component_info, is_visible=True): is_ce_reactions = 'CEReactions' in extended_attributes if is_ce_reactions: includes.add('core/html/custom/ce_reactions_scope.h') - is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes - if is_custom_element_callbacks: - includes.add('core/html/custom/v0_custom_element_processing_stack.h') is_raises_exception = 'RaisesException' in extended_attributes @@ -257,8 +258,6 @@ def method_context(interface, method, component_info, is_visible=True): 'CrossOrigin' in extended_attributes, 'is_custom': 'Custom' in extended_attributes, - 'is_custom_element_callbacks': - is_custom_element_callbacks, 'is_explicit_nullable': idl_type.is_explicit_nullable, 'is_new_object': diff --git a/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py b/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py index 2ecd6923320..fcfc48371b1 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/v8_utilities.py @@ -271,7 +271,7 @@ EXPOSED_WORKERS = set([ ]) -class ExposureSet: +class ExposureSet(object): """An ExposureSet is a collection of Exposure instructions.""" def __init__(self, exposures=None): diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/.style.yapf b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/.style.yapf deleted file mode 100644 index 2ae9158e446..00000000000 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/.style.yapf +++ /dev/null @@ -1,4 +0,0 @@ -[style] -# https://www.chromium.org/blink/coding-style -based_on_style = pep8 -column_limit = 79 diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/__init__.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/__init__.py index 7cf7f010d57..a2d17cc577d 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/__init__.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/__init__.py @@ -35,6 +35,7 @@ def _setup_sys_path(): _setup_sys_path() from . import file_io +from .argument import Argument from .ast_group import AstGroup from .attribute import Attribute from .callback_function import CallbackFunction diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py index 13fb7c7068d..b73b7710687 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py @@ -91,11 +91,13 @@ class CallbackInterface(UserDefinedType, WithExtendedAttributes, for operation_ir in ir.operations ]) self._operation_groups = tuple([ - OperationGroup( - operation_group_ir, - filter(lambda x: x.identifier == operation_group_ir.identifier, - self._operations), - owner=self) for operation_group_ir in ir.operation_groups + OperationGroup(operation_group_ir, + list( + filter( + lambda x: x.identifier == operation_group_ir + .identifier, self._operations)), + owner=self) + for operation_group_ir in ir.operation_groups ]) @property diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py index eafd940eba3..3a0c68bc162 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py @@ -166,4 +166,4 @@ class Database(object): return self._view_by_kind(Database._Kind.NEW_UNION) def _view_by_kind(self, kind): - return self._impl.find_by_kind(kind).values() + return list(self._impl.find_by_kind(kind).values()) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py index abaeef39c30..e36cf7439ae 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/exposure.py @@ -8,8 +8,11 @@ from .runtime_enabled_features import RuntimeEnabledFeatures class _Feature(str): """Represents a runtime-enabled feature.""" + def __new__(cls, value): + return str.__new__(cls, value) + def __init__(self, value): - str.__init__(self, value) + str.__init__(self) self._is_context_dependent = ( RuntimeEnabledFeatures.is_context_dependent(self)) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py index 648c70d803d..1712f19c672 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py @@ -71,8 +71,9 @@ class FunctionLike(WithIdentifier): def num_of_required_arguments(self): """Returns the number of required arguments.""" return len( - filter(lambda arg: not (arg.is_optional or arg.is_variadic), - self.arguments)) + list( + filter(lambda arg: not (arg.is_optional or arg.is_variadic), + self.arguments))) class OverloadGroup(WithIdentifier): @@ -171,8 +172,7 @@ class OverloadGroup(WithIdentifier): Returns the effective overload set. https://heycam.github.io/webidl/#compute-the-effective-overload-set """ - assert argument_count is None or isinstance(argument_count, - (int, long)) + assert argument_count is None or isinstance(argument_count, int) N = argument_count S = [] @@ -188,21 +188,21 @@ class OverloadGroup(WithIdentifier): S.append( OverloadGroup.EffectiveOverloadItem( - X, map(lambda arg: arg.idl_type, X.arguments), - map(lambda arg: arg.optionality, X.arguments))) + X, list(map(lambda arg: arg.idl_type, X.arguments)), + list(map(lambda arg: arg.optionality, X.arguments)))) if X.is_variadic: - for i in xrange(n, max(maxarg, N)): - t = map(lambda arg: arg.idl_type, X.arguments) - o = map(lambda arg: arg.optionality, X.arguments) - for _ in xrange(n, i + 1): + for i in range(n, max(maxarg, N)): + t = list(map(lambda arg: arg.idl_type, X.arguments)) + o = list(map(lambda arg: arg.optionality, X.arguments)) + for _ in range(n, i + 1): t.append(X.arguments[-1].idl_type) o.append(X.arguments[-1].optionality) S.append(OverloadGroup.EffectiveOverloadItem(X, t, o)) - t = map(lambda arg: arg.idl_type, X.arguments) - o = map(lambda arg: arg.optionality, X.arguments) - for i in xrange(n - 1, -1, -1): + t = list(map(lambda arg: arg.idl_type, X.arguments)) + o = list(map(lambda arg: arg.optionality, X.arguments)) + for i in range(n - 1, -1, -1): if X.arguments[i].optionality == IdlType.Optionality.REQUIRED: break S.append(OverloadGroup.EffectiveOverloadItem(X, t[:i], o[:i])) @@ -222,7 +222,7 @@ class OverloadGroup(WithIdentifier): for item in items) assert len(items) > 1 - for index in xrange(len(items[0].type_list)): + for index in range(len(items[0].type_list)): # Assume that the given items are valid, and we only need to test # the two types. if OverloadGroup.are_distinguishable_types( diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py index 8c1a717b758..c540cd1c7ef 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py @@ -211,7 +211,7 @@ class IdlCompiler(object): only_to_members_of_partial_or_mixin=False) propagate_to_exposure(propagate) - map(process_member_like, ir.iter_all_members()) + list(map(process_member_like, ir.iter_all_members())) def process_member_like(ir): propagate = functools.partial(propagate_extattr, ir=ir) @@ -237,7 +237,7 @@ class IdlCompiler(object): self._ir_map.move_to_new_phase() - map(process_interface_like, old_irs) + list(map(process_interface_like, old_irs)) def _determine_blink_headers(self): irs = self._ir_map.irs_of_kinds( @@ -425,9 +425,9 @@ class IdlCompiler(object): assert not new_interface.deriveds derived_set = identifier_to_derived_set.get( new_interface.identifier, set()) - new_interface.deriveds = map( - lambda id_: self._ref_to_idl_def_factory.create(id_), - sorted(derived_set)) + new_interface.deriveds = list( + map(lambda id_: self._ref_to_idl_def_factory.create(id_), + sorted(derived_set))) def _supplement_missing_html_constructor_operation(self): # Temporary mitigation of misuse of [HTMLConstructor] @@ -556,7 +556,8 @@ class IdlCompiler(object): self._ir_map.add(new_ir) for group in new_ir.iter_all_overload_groups(): - exposures = map(lambda overload: overload.exposure, group) + exposures = list(map(lambda overload: overload.exposure, + group)) # [Exposed] if any(not exposure.global_names_and_features @@ -656,8 +657,8 @@ class IdlCompiler(object): constructs = set() for global_name in global_names: constructs.update(exposed_map.get(global_name, [])) - new_ir.exposed_constructs = map( - self._ref_to_idl_def_factory.create, sorted(constructs)) + new_ir.exposed_constructs = list( + map(self._ref_to_idl_def_factory.create, sorted(constructs))) assert not new_ir.legacy_window_aliases if new_ir.identifier != 'Window': diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type.py index 5776c2c18d9..a11a473b08f 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type.py @@ -561,6 +561,10 @@ class IdlType(WithExtendedAttributes, WithDebugInfo): """ return None + @property + def new_union_definition_object(self): + return None + @property def union_definition_object(self): """ @@ -1149,6 +1153,7 @@ class UnionType(IdlType): debug_info=debug_info, pass_key=pass_key) self._member_types = tuple(member_types) + self._new_union_definition_object = None self._union_definition_object = None def __eq__(self, other): @@ -1222,6 +1227,17 @@ class UnionType(IdlType): return set(flatten(self)) + @property + def new_union_definition_object(self): + return self._new_union_definition_object + + def set_new_union_definition_object(self, union_definition_object): + # In Python2, we need to avoid circular imports. + from .union import NewUnion + assert isinstance(union_definition_object, NewUnion) + assert self._new_union_definition_object is None + self._new_union_definition_object = union_definition_object + @property def union_definition_object(self): return self._union_definition_object diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py index 65d24e529d1..067ef2eb0b2 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py @@ -180,8 +180,9 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, self._constructor_groups = tuple([ ConstructorGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._constructors), + list( + filter(lambda x: x.identifier == group_ir.identifier, + self._constructors)), owner=self) for group_ir in ir.constructor_groups ]) assert len(self._constructor_groups) <= 1 @@ -192,8 +193,9 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, self._named_constructor_groups = tuple([ ConstructorGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._named_constructors), + list( + filter(lambda x: x.identifier == group_ir.identifier, + self._named_constructors)), owner=self) for group_ir in ir.named_constructor_groups ]) self._operations = tuple([ @@ -203,22 +205,23 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, self._operation_groups = tuple([ OperationGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._operations), + list( + filter(lambda x: x.identifier == group_ir.identifier, + self._operations)), owner=self) for group_ir in ir.operation_groups ]) self._exposed_constructs = tuple(ir.exposed_constructs) self._legacy_window_aliases = tuple(ir.legacy_window_aliases) self._indexed_and_named_properties = None - indexed_and_named_property_operations = filter( - lambda x: x.is_indexed_or_named_property_operation, - self._operations) + indexed_and_named_property_operations = list( + filter(lambda x: x.is_indexed_or_named_property_operation, + self._operations)) if indexed_and_named_property_operations: self._indexed_and_named_properties = IndexedAndNamedProperties( indexed_and_named_property_operations, owner=self) self._stringifier = None - stringifier_operation_irs = filter(lambda x: x.is_stringifier, - ir.operations) + stringifier_operation_irs = list( + filter(lambda x: x.is_stringifier, ir.operations)) if stringifier_operation_irs: assert len(stringifier_operation_irs) == 1 op_ir = make_copy(stringifier_operation_irs[0]) @@ -231,8 +234,9 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, attribute = None if operation.stringifier_attribute: attr_id = operation.stringifier_attribute - attributes = filter(lambda x: x.identifier == attr_id, - self._attributes) + attributes = list( + filter(lambda x: x.identifier == attr_id, + self._attributes)) assert len(attributes) == 1 attribute = attributes[0] self._stringifier = Stringifier(operation, attribute, owner=self) @@ -578,8 +582,9 @@ class Iterable(WithDebugInfo): self._operation_groups = tuple([ OperationGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._operations), + list( + filter(lambda x: x.identifier == group_ir.identifier, + self._operations)), owner=owner) for group_ir in ir.operation_groups ]) @@ -666,8 +671,9 @@ class Maplike(WithDebugInfo): self._operation_groups = tuple([ OperationGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._operations), + list( + filter(lambda x: x.identifier == group_ir.identifier, + self._operations)), owner=owner) for group_ir in ir.operation_groups ]) @@ -755,8 +761,9 @@ class Setlike(WithDebugInfo): self._operation_groups = tuple([ OperationGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._operations), + list( + filter(lambda x: x.identifier == group_ir.identifier, + self._operations)), owner=owner) for group_ir in ir.operation_groups ]) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py index e9aeff4ab82..f306f890ca2 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import sys + from .argument import Argument from .ast_group import AstGroup from .attribute import Attribute @@ -30,6 +32,11 @@ from .operation import Operation from .typedef import Typedef +# TODO(crbug.com/1174969): Remove this once Python2 is obsoleted. +if sys.version_info.major != 2: + long = int + + def load_and_register_idl_definitions(filepaths, register_ir, create_ref_to_idl_def, idl_type_factory): """ @@ -160,7 +167,7 @@ class _IRBuilder(object): child_nodes = list(node.GetChildren()) extended_attributes = self._take_extended_attributes(child_nodes) - members = map(self._build_interface_member, child_nodes) + members = list(map(self._build_interface_member, child_nodes)) attributes = [] constants = [] operations = [] @@ -302,7 +309,7 @@ class _IRBuilder(object): child_nodes = list(node.GetChildren()) inherited = self._take_inheritance(child_nodes) extended_attributes = self._take_extended_attributes(child_nodes) - own_members = map(self._build_dictionary_member, child_nodes) + own_members = list(map(self._build_dictionary_member, child_nodes)) return Dictionary.IR( identifier=Identifier(node.GetName()), @@ -336,7 +343,7 @@ class _IRBuilder(object): child_nodes = list(node.GetChildren()) extended_attributes = self._take_extended_attributes(child_nodes) - members = map(self._build_interface_member, child_nodes) + members = list(map(self._build_interface_member, child_nodes)) constants = [] operations = [] for member in members: @@ -456,8 +463,8 @@ class _IRBuilder(object): assert len(child_nodes) == 1 child = child_nodes[0] if child.GetClass() == 'Arguments': - arguments = map(build_extattr_argument, - child.GetChildren()) + arguments = list( + map(build_extattr_argument, child.GetChildren())) elif child.GetClass() == 'Call': assert len(child.GetChildren()) == 1 grand_child = child.GetChildren()[0] @@ -486,7 +493,9 @@ class _IRBuilder(object): assert node.GetClass() == 'ExtAttributes' return ExtendedAttributes( - filter(None, map(build_extended_attribute, node.GetChildren()))) + list( + filter(None, map(build_extended_attribute, + node.GetChildren())))) def _build_inheritance(self, node): assert node.GetClass() == 'Inherit' @@ -506,7 +515,7 @@ class _IRBuilder(object): def _build_iterable(self, node): assert node.GetClass() == 'Iterable' - types = map(self._build_type, node.GetChildren()) + types = list(map(self._build_type, node.GetChildren())) assert len(types) == 1 or len(types) == 2 if len(types) == 1: # value iterator key_type, value_type = (None, types[0]) @@ -584,7 +593,7 @@ class _IRBuilder(object): def _build_maplike(self, node, interface_identifier): assert node.GetClass() == 'Maplike' assert isinstance(interface_identifier, Identifier) - types = map(self._build_type, node.GetChildren()) + types = list(map(self._build_type, node.GetChildren())) assert len(types) == 2 key_type, value_type = types is_readonly = bool(node.GetProperty('READONLY')) @@ -676,7 +685,7 @@ class _IRBuilder(object): def _build_setlike(self, node, interface_identifier): assert node.GetClass() == 'Setlike' assert isinstance(interface_identifier, Identifier) - types = map(self._build_type, node.GetChildren()) + types = list(map(self._build_type, node.GetChildren())) assert len(types) == 1 value_type = types[0] is_readonly = bool(node.GetProperty('READONLY')) @@ -838,7 +847,7 @@ class _IRBuilder(object): def build_union_type(node, extended_attributes): return self._idl_type_factory.union_type( - member_types=map(self._build_type, node.GetChildren()), + member_types=list(map(self._build_type, node.GetChildren())), is_optional=is_optional, extended_attributes=extended_attributes, debug_info=self._build_debug_info(node)) diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py index a7a2b11f3f0..a5b94872808 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py @@ -3,6 +3,14 @@ # found in the LICENSE file. +import sys + +# TODO(crbug.com/1174969): Remove this once Python2 is obsoleted. +if sys.version_info.major != 2: + long = int + basestring = str + + def make_copy(obj, memo=None): """ Creates a copy of the given object, which should be an IR or part of IR. diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py index 8ecef23326a..18c8f8f6588 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py @@ -107,11 +107,13 @@ class Namespace(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, for operation_ir in ir.operations ]) self._operation_groups = tuple([ - OperationGroup( - operation_group_ir, - filter(lambda x: x.identifier == operation_group_ir.identifier, - self._operations), - owner=self) for operation_group_ir in ir.operation_groups + OperationGroup(operation_group_ir, + list( + filter( + lambda x: x.identifier == operation_group_ir + .identifier, self._operations)), + owner=self) + for operation_group_ir in ir.operation_groups ]) @property diff --git a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/union.py b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/union.py index 0d0b4ea653a..bc2aab7fef7 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/web_idl/union.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/web_idl/union.py @@ -114,7 +114,7 @@ class NewUnion(WithIdentifier, WithCodeGeneratorInfo, WithComponent, union_members.add(sub_union_ir.public_object) components = set() - for_testing = False + for_testing = [False] def collect_primary_component(idl_type): type_definition_object = idl_type.type_definition_object @@ -122,12 +122,12 @@ class NewUnion(WithIdentifier, WithCodeGeneratorInfo, WithComponent, components.add(type_definition_object.components[0]) if (type_definition_object and type_definition_object.code_generator_info.for_testing): - for_testing = True + for_testing[0] = True for idl_type in flattened_member_types: idl_type.apply_to_all_composing_elements(collect_primary_component) code_generator_info = CodeGeneratorInfoMutable() - code_generator_info.set_for_testing(for_testing) + code_generator_info.set_for_testing(for_testing[0]) WithIdentifier.__init__(self, identifier) WithCodeGeneratorInfo.__init__(self, @@ -140,7 +140,8 @@ class NewUnion(WithIdentifier, WithCodeGeneratorInfo, WithComponent, idl_type.type_name_with_extended_attribute_key_values) sort_key_identifier = lambda x: x.identifier - self._union_types = tuple(ir.union_types) + self._idl_types = tuple(ir.union_types) + self._member_tokens = ir.token self._flattened_member_types = tuple( sorted(flattened_member_types, key=sort_key_typename)) self._does_include_nullable_type = does_include_nullable_type @@ -153,9 +154,19 @@ class NewUnion(WithIdentifier, WithCodeGeneratorInfo, WithComponent, sorted(ir.typedefs, key=sort_key_identifier)) ir.public_object = self - # TODO(yukishiino): Replace BackwardCompatibleUnion with NewUnion - # for union_type in self._union_types: - # union_type.set_union_definition_object(self) + + for idl_type in self._idl_types: + idl_type.set_new_union_definition_object(self) + + @property + def idl_types(self): + """Returns a list of IdlTypes which this object represents.""" + return self._idl_types + + @property + def member_tokens(self): + """Returns a list of unique names of union member types.""" + return self._member_tokens @property def flattened_member_types(self): diff --git a/chromium/third_party/blink/renderer/bindings/templates/attributes.cc.tmpl b/chromium/third_party/blink/renderer/bindings/templates/attributes.cc.tmpl index 91bd1051309..c313e1d036e 100644 --- a/chromium/third_party/blink/renderer/bindings/templates/attributes.cc.tmpl +++ b/chromium/third_party/blink/renderer/bindings/templates/attributes.cc.tmpl @@ -409,10 +409,6 @@ static void {{attribute.camel_case_name}}AttributeSetter{{world_suffix}}( if (!result) return; {% else %}{# attribute.is_put_forwards #} - {% if attribute.is_custom_element_callbacks or attribute.is_reflect %} - V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; - {% endif %} - {% if attribute.has_setter_exception_state %} {{define_exception_state}} {% endif %} diff --git a/chromium/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl b/chromium/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl index 8473ac96dab..e4bc040f22a 100644 --- a/chromium/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl +++ b/chromium/third_party/blink/renderer/bindings/templates/interface_base.cc.tmpl @@ -579,19 +579,21 @@ static void Install{{v8_class}}Template( // so there is no need to reuse this FunctionTemplate and register it in // V8PerIsolateData. v8::Local intrinsic_iterator_prototype_interface_template = - v8::FunctionTemplate::New(isolate); - intrinsic_iterator_prototype_interface_template->RemovePrototype(); + v8::FunctionTemplate::New(isolate, nullptr, v8::Local(), + v8::Local(), 0, + v8::ConstructorBehavior::kThrow); intrinsic_iterator_prototype_interface_template->SetIntrinsicDataProperty( V8AtomicString(isolate, "prototype"), v8::kIteratorPrototype); interface_template->Inherit(intrinsic_iterator_prototype_interface_template); {% endif %} - {% if interface_name == 'NativeFileSystemDirectoryIterator' %} + {% if interface_name == 'FileSystemDirectoryIterator' %} // Temporary @@asyncIterator support for FileSystemDirectoryHandle // TODO(https://crbug.com/1087157): Replace with proper bindings support. v8::Local intrinsic_iterator_prototype_interface_template = - v8::FunctionTemplate::New(isolate); - intrinsic_iterator_prototype_interface_template->RemovePrototype(); + v8::FunctionTemplate::New(isolate, nullptr, v8::Local(), + v8::Local(), 0, + v8::ConstructorBehavior::kThrow); intrinsic_iterator_prototype_interface_template->SetIntrinsicDataProperty( V8AtomicString(isolate, "prototype"), v8::kAsyncIteratorPrototype); interface_template->Inherit(intrinsic_iterator_prototype_interface_template); @@ -614,8 +616,9 @@ static void Install{{v8_class}}Template( // |interface_template| is instantiated, its prototype.__proto__ will point to // |intrinsic_error_prototype_interface_template|'s "prototype" property. v8::Local intrinsic_error_prototype_interface_template = - v8::FunctionTemplate::New(isolate); - intrinsic_error_prototype_interface_template->RemovePrototype(); + v8::FunctionTemplate::New(isolate, nullptr, v8::Local(), + v8::Local(), 0, + v8::ConstructorBehavior::kThrow); intrinsic_error_prototype_interface_template->SetIntrinsicDataProperty( V8AtomicString(isolate, "prototype"), v8::kErrorPrototype); interface_template->Inherit(intrinsic_error_prototype_interface_template); diff --git a/chromium/third_party/blink/renderer/bindings/templates/methods.cc.tmpl b/chromium/third_party/blink/renderer/bindings/templates/methods.cc.tmpl index 918ea13c32e..b1317339a0b 100644 --- a/chromium/third_party/blink/renderer/bindings/templates/methods.cc.tmpl +++ b/chromium/third_party/blink/renderer/bindings/templates/methods.cc.tmpl @@ -79,10 +79,6 @@ static void {{method.camel_case_name}}{{method.overload_index}}Method{{world_suf {% endif %} {% endif %} - {% if method.is_custom_element_callbacks %} - V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; - {% endif %} - {{function_call | trim | indent(2)}} } {% endfilter %} diff --git a/chromium/third_party/blink/renderer/build/scripts/PRESUBMIT.py b/chromium/third_party/blink/renderer/build/scripts/PRESUBMIT.py index 3578fcbf05f..4cc2799ee46 100644 --- a/chromium/third_party/blink/renderer/build/scripts/PRESUBMIT.py +++ b/chromium/third_party/blink/renderer/build/scripts/PRESUBMIT.py @@ -41,15 +41,16 @@ def _RunTests(input_api, output_api): tests = [{ 'file_name': 'json5_generator_unittest.py', 'affected_list': [r'.*json5_generator.*', r'.*\btests[\\\/].*'] - }, - { - 'file_name': 'make_runtime_features_utilities_unittest.py', - 'affected_list': [r'.*make_runtime_features_utilities.*'] - }, - { - 'file_name': 'make_document_policy_features_unittest.py', - 'affected_list': [r'.*make_document_policy_features.*'] - }] + }, { + 'file_name': 'make_runtime_features_utilities_unittest.py', + 'affected_list': [r'.*make_runtime_features_utilities.*'] + }, { + 'file_name': 'make_document_policy_features_unittest.py', + 'affected_list': [r'.*make_document_policy_features.*'] + }, { + 'file_name': 'make_document_policy_features_tests.py', + 'affected_list': [r'.*make_document_policy_features.*'] + }] test_commands = [] for test in tests: test_commands.append( diff --git a/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter.py b/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter.py index dd1978df233..db8096c4a89 100644 --- a/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter.py +++ b/chromium/third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter.py @@ -9,6 +9,7 @@ import re SPECIAL_TOKENS = [ # This list should be sorted by length. + 'WebCodecs', 'WebSocket', 'String16', 'Float32', diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py b/chromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py index 831136285e2..b779e079244 100755 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/css_properties.py @@ -67,6 +67,7 @@ class CSSProperties(object): # in the various generators for ComputedStyle. self._field_alias_expander = FieldAliasExpander(file_paths[1]) + # _alias_offset must be a power of 2. self._alias_offset = 1024 # 0: CSSPropertyID::kInvalid # 1: CSSPropertyID::kVariable @@ -224,7 +225,7 @@ class CSSProperties(object): updated_alias['enum_key'] = enum_key_for_css_property_alias( alias['name']) updated_alias['enum_value'] = aliased_property['enum_value'] + \ - self._alias_offset + self._alias_offset * len(aliased_property['aliases']) updated_alias['superclass'] = 'CSSUnresolvedProperty' updated_alias['namespace_group'] = \ 'Shorthand' if aliased_property['longhands'] else 'Longhand' @@ -320,15 +321,29 @@ class CSSProperties(object): set_if_none(property_, 'custom_compare', False) set_if_none(property_, 'mutable', False) - if property_['direction_aware_options']: - if not property_['style_builder_template']: + if property_['logical_property_group']: + group = property_['logical_property_group'] + assert 'name' in group, 'name option is required' + assert 'resolver' in group, 'resolver option is required' + logicals = { + 'block', 'inline', 'block-start', 'block-end', 'inline-start', + 'inline-end', 'start-start', 'start-end', 'end-start', + 'end-end' + } + physicals = { + 'vertical', 'horizontal', 'top', 'bottom', 'left', 'right', + 'top-left', 'top-right', 'bottom-right', 'bottom-left' + } + if group['resolver'] in logicals: + group['is_logical'] = True + elif group['resolver'] in physicals: + group['is_logical'] = False + else: + assert 0, 'invalid resolver option' + group['name'] = NameStyleConverter(group['name']) + group['resolver_name'] = NameStyleConverter(group['resolver']) + if not property_['style_builder_template'] and group['is_logical']: property_['style_builder_template'] = 'direction_aware' - options = property_['direction_aware_options'] - assert 'resolver' in options, 'resolver option is required' - assert 'physical_group' in options, 'physical_group option is required' - options['resolver_name'] = NameStyleConverter(options['resolver']) - options['physical_group_name'] = NameStyleConverter( - options['physical_group']) @property def default_parameters(self): diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/make_css_property_names.py b/chromium/third_party/blink/renderer/build/scripts/core/css/make_css_property_names.py index bc7c717cf1e..c6044f4971d 100755 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/make_css_property_names.py +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/make_css_property_names.py @@ -29,8 +29,8 @@ class CSSPropertyNamesWriter(json5_generator.Writer): 'core/css/templates/css_property_names.h.tmpl') def generate_header(self): return { - 'alias_offset': - self._css_properties.alias_offset, + 'alias_mask': + hex(0xffffffff - self._css_properties.alias_offset + 1), 'class_name': self.class_name, 'property_enums': diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py b/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py index 1799cd5a153..5f43ffabc26 100755 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py @@ -71,7 +71,7 @@ class Expansion(object): def enabled_longhands(self): include = lambda longhand: not longhand[ 'runtime_flag'] or self.is_enabled(longhand['runtime_flag']) - return filter(include, self._longhands) + return list(filter(include, self._longhands)) @property def index(self): @@ -87,8 +87,9 @@ class Expansion(object): def create_expansions(longhands): flags = collect_runtime_flags(longhands) - expansions = map(lambda mask: Expansion(longhands, flags, mask), - range(1 << len(flags))) + expansions = list( + map(lambda mask: Expansion(longhands, flags, mask), + range(1 << len(flags)))) assert len(expansions) > 0 # We generate 2^N expansions for N flags, so enforce some limit. assert len(flags) <= 4, 'Too many runtime flags for a single shorthand' @@ -114,14 +115,14 @@ class StylePropertyShorthandWriter(json5_generator.Writer): self._longhand_dictionary = defaultdict(list) for property_ in json5_properties.shorthands: - property_['longhand_enum_keys'] = map(enum_key_for_css_property, - property_['longhands']) - property_['longhand_property_ids'] = map(id_for_css_property, - property_['longhands']) - - longhands = map( - lambda name: json5_properties.properties_by_name[name], - property_['longhands']) + property_['longhand_enum_keys'] = list( + map(enum_key_for_css_property, property_['longhands'])) + property_['longhand_property_ids'] = list( + map(id_for_css_property, property_['longhands'])) + + longhands = list( + map(lambda name: json5_properties.properties_by_name[name], + property_['longhands'])) property_['expansions'] = create_expansions(longhands) for longhand_enum_key in property_['longhand_enum_keys']: self._longhand_dictionary[longhand_enum_key].append(property_) diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py index 75030ac577e..f72aadee17d 100755 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/make_css_property_instances.py @@ -42,8 +42,8 @@ class CSSPropertyInstancesWriter(json5_generator.Writer): aliases = self._css_properties.aliases # Lists of PropertyClassData. - self._property_classes_by_id = map(self.get_class, properties) - self._alias_classes_by_id = map(self.get_class, aliases) + self._property_classes_by_id = list(map(self.get_class, properties)) + self._alias_classes_by_id = list(map(self.get_class, aliases)) # Sort by enum value. self._property_classes_by_id.sort(key=lambda t: t.enum_value) diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl index 5ad18b5c21b..35137c4e1ba 100644 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.cc.tmpl @@ -25,7 +25,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/style_svg_resource.h" -#include "third_party/blink/renderer/core/style/svg_computed_style.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { @@ -88,23 +87,11 @@ const CSSProperty* {{class_name}}::SurrogateFor(TextDirection direction, return &GetCSSProperty{{property.surrogate_for.name.to_upper_camel_case()}}(); } {% endif %} - {% if property.computed_value_comparable %} -bool {{class_name}}::ComputedValuesEqual(const ComputedStyle& a, const ComputedStyle& b) const { - {% if property.computed_value_compare_fields %} - {% for field in property.computed_value_compare_fields %} - if (!(a.{{field}}() == b.{{field}}())) - return false; - {% endfor %} - return true; - {% else %} - return a.{{property.getter}}() == b.{{property.getter}}(); - {% endif %} -} - {% endif %} - {% if property.direction_aware_options %} - {% set options = property.direction_aware_options %} - {% set resolver_name = options.resolver_name.to_upper_camel_case() %} - {% set physical_group_name = options.physical_group_name.to_upper_camel_case() %} + {% if property.logical_property_group %} + {% set group = property.logical_property_group %} + {% set group_name = group.name.to_upper_camel_case() %} + {% set resolver_name = group.resolver_name.to_upper_camel_case() %} + {% if group.is_logical %} const CSSProperty* {{class_name}}::SurrogateFor(TextDirection direction, blink::WritingMode writing_mode) const { return &ResolveDirectionAwareProperty(direction, writing_mode); @@ -114,8 +101,19 @@ const CSSProperty& {{class_name}}::ResolveDirectionAwareProperty( TextDirection direction, blink::WritingMode writing_mode) const { return CSSDirectionAwareResolver::Resolve{{resolver_name}}(direction, writing_mode, - CSSDirectionAwareResolver::{{physical_group_name}}Group()); + CSSDirectionAwareResolver::Physical{{group_name}}Mapping()); } + +bool {{class_name}}::IsInSameLogicalPropertyGroupWithDifferentMappingLogic( + CSSPropertyID id) const { + return CSSDirectionAwareResolver::Physical{{group_name}}Mapping().Contains(id); +} + {% else %} +bool {{class_name}}::IsInSameLogicalPropertyGroupWithDifferentMappingLogic( + CSSPropertyID id) const { + return CSSDirectionAwareResolver::Logical{{group_name}}Mapping().Contains(id); +} + {% endif %} {% endif %} {{style_builder_functions(property)}} diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl index f0c48563ef7..f954b7bd400 100644 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_properties.h.tmpl @@ -22,14 +22,14 @@ class CSSParserLocalContext; class CSSValue; class LayoutObject; class Node; -class SVGComputedStyle; namespace {{namespace}} { {% for property in properties %} {% set class_name = property.name.to_upper_camel_case() %} {% set is_alias = property.alias_for %} -{% set is_surrogate = property.surrogate_for or property.direction_aware_options %} +{% set is_surrogate = property.surrogate_for or + (property.logical_property_group and property.logical_property_group.is_logical) %} {% set property_id = 'CSSPropertyID::' + property.enum_key %} {% set separator = '\'' + (property.separator or '\\0') + '\'' %} {% set flags = [ @@ -48,9 +48,9 @@ namespace {{namespace}} { (property.font and 'kAffectsFont' or ''), (property.is_background and 'kBackground' or ''), (property.is_border and 'kBorder' or ''), - (property.computed_value_comparable and 'kComputedValueComparable' or ''), (property.tree_scoped_value and 'kTreeScopedValue' or ''), (property.valid_for_highlight and 'kValidForHighlight' or ''), + (property.logical_property_group and 'kInLogicalPropertyGroup' or ''), ] | reject('==', '') | join(' | ') %} {% set ctor_args = (not is_alias and [property_id, flags, separator] or []) %} // {{property.name}} @@ -80,20 +80,18 @@ class {{class_name}} final : public {{property.superclass}} { {% if property.unvisited_property %} const CSSProperty* GetUnvisitedProperty() const override; {% endif %} - {% if property.surrogate_for or property.direction_aware_options %} + {% if is_surrogate %} const CSSProperty* SurrogateFor(TextDirection, blink::WritingMode) const override; {% endif %} {% for property_method in property.property_methods %} {{property_method.return_type}} {{property_method.name}}{{property_method.parameters}} const override; {% endfor %} - {% if property.computed_value_comparable %} - bool ComputedValuesEqual(const ComputedStyle& a, const ComputedStyle& b) const override; - {% endif %} - {% if property.direction_aware_options %} + {% if property.logical_property_group %} + bool IsInSameLogicalPropertyGroupWithDifferentMappingLogic(CSSPropertyID) const override; + {% if property.logical_property_group.is_logical %} const CSSProperty& ResolveDirectionAwareProperty(TextDirection, blink::WritingMode) const override; const CSSValue* CSSValueFromComputedStyleInternal( const ComputedStyle&, - const SVGComputedStyle&, const LayoutObject*, bool allow_visited_style) const override { // Directional properties are resolved by CSSDirectionAwareResolver @@ -101,6 +99,7 @@ class {{class_name}} final : public {{property.superclass}} { NOTREACHED(); return nullptr; } + {% endif %} {% endif %} {% if property.style_builder_declare %} void ApplyInitial(StyleResolverState&) const override; diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_instances.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_instances.cc.tmpl index b44bb8f47e7..1ddbddbb76e 100644 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_instances.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_instances.cc.tmpl @@ -31,8 +31,8 @@ const CSSProperty& Get{{property_class_data.property_id}}() { {% endfor %} const CSSUnresolvedProperty* GetAliasPropertyInternal(CSSPropertyID id) { - DCHECK_GT(id, lastCSSProperty); // last property id - DCHECK_LE(id, lastUnresolvedCSSProperty); // last unresolved property id + DCHECK_GT(id, kLastCSSProperty); // last property id + DCHECK_LE(id, kLastUnresolvedCSSProperty); // last unresolved property id switch (id) { {% for property_class_data in alias_classes_by_property_id %} case CSSPropertyID::{{property_class_data.enum_key}}: @@ -47,7 +47,7 @@ const CSSUnresolvedProperty* GetAliasPropertyInternal(CSSPropertyID id) { const CSSUnresolvedProperty& GetNonAliasPropertyInternal(CSSPropertyID id) { DCHECK_NE(id, CSSPropertyID::kInvalid); DCHECK_NE(id, CSSPropertyID::kVariable); - DCHECK_LE(id, lastCSSProperty); // last property id + DCHECK_LE(id, kLastCSSProperty); // last property id static constexpr const CSSUnresolvedProperty* const property_classes[] = { {% for property_class_data in property_classes_by_property_id %} &property_{{property_class_data.property_id.lower()}}, // {{property_class_data.property_id}} diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl index 2b57b4c969f..6e885ec4682 100644 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/properties/templates/style_builder_functions.tmpl @@ -33,9 +33,7 @@ void {{class_name}}::ApplyValue(StyleResolverState& state, const CSSValue& value {% endmacro %} {% macro set_value(property) %} - {% if property.svg %} -state.Style()->AccessSVGStyle().{{property.setter}} - {%- elif property.font %} + {%- if property.font %} state.GetFontBuilder().{{property.setter}} {%- else %} state.Style()->{{property.setter}} @@ -63,9 +61,7 @@ To(resolved_property).{{apply_call}}; {% macro style_builder_functions(property) %} {% if not property.style_builder_template %} {% call(property) apply_initial(property) %} - {% if property.svg %} - {{set_value(property)}}(SVGComputedStyle::{{property.initial}}()); - {% elif property.font %} + {% if property.font %} {{set_value(property)}}(FontBuilder::{{property.initial}}()); {% else %} {{set_value(property)}}(ComputedStyleInitialValues::{{property.initial}}()); @@ -75,9 +71,7 @@ To(resolved_property).{{apply_call}}; {% endif %} {% endcall %} {% call(property) apply_inherit(property) %} - {% if property.svg %} - {{set_value(property)}}(state.ParentStyle()->SvgStyle().{{property.getter}}()); - {% elif property.font %} + {% if property.font %} {{set_value(property)}}(state.ParentFontDescription().{{property.getter}}()); {% else %} {{set_value(property)}}(state.ParentStyle()->{{property.getter}}()); diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_property_names.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_property_names.cc.tmpl index 2d39cfdb6e0..8ad1fadc24f 100644 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_property_names.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_property_names.cc.tmpl @@ -41,9 +41,11 @@ const Property* FindProperty(const char* str, unsigned int len) { return {{class_name}}Hash::findPropertyImpl(str, len); } -CSSPropertyID cssPropertyID(const ExecutionContext* execution_context, const String& string) +CSSPropertyID CssPropertyID(const ExecutionContext* execution_context, + const String& string) { - return resolveCSSPropertyID(unresolvedCSSPropertyID(execution_context, string)); + return ResolveCSSPropertyID(UnresolvedCSSPropertyID(execution_context, + string)); } mojom::blink::CSSSampleId GetCSSSampleId(CSSPropertyID id) { diff --git a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_property_names.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_property_names.h.tmpl index 159f1785f06..575fdb77146 100644 --- a/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_property_names.h.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/core/css/templates/css_property_names.h.tmpl @@ -13,7 +13,7 @@ namespace WTF { class AtomicString; class String; -} +} // namespace WTF namespace blink { @@ -29,20 +29,34 @@ const CSSPropertyID kCSSPropertyAliasList[] = { {{property_aliases}} }; +// The lowest CSSPropertyID excluding kInvalid and kVariable. const int kIntFirstCSSProperty = {{first_property_id}}; -const CSSPropertyID firstCSSProperty = static_cast(kIntFirstCSSProperty); -const int numCSSProperties = {{properties_count}}; +const CSSPropertyID kFirstCSSProperty = + static_cast(kIntFirstCSSProperty); + +// The number of unresolved CSS properties excluding kInvalid and kVariable. +const int kNumCSSProperties = {{properties_count}}; + +// The highest resolved CSSPropertyID. const int kIntLastCSSProperty = {{last_property_id}}; -const CSSPropertyID lastCSSProperty = static_cast(kIntLastCSSProperty); -const CSSPropertyID lastUnresolvedCSSProperty = static_cast({{last_unresolved_property_id}}); -const CSSPropertyID kFirstHighPriorityCSSProperty = firstCSSProperty; +const CSSPropertyID kLastCSSProperty = + static_cast(kIntLastCSSProperty); + +// The highest unresolved CSSPropertyID. +const CSSPropertyID kLastUnresolvedCSSProperty = + static_cast({{last_unresolved_property_id}}); + +const CSSPropertyID kFirstHighPriorityCSSProperty = kFirstCSSProperty; const CSSPropertyID kLastHighPriorityCSSProperty = CSSPropertyID::{{last_high_priority_property_id}}; -const int numCSSPropertyIDs = static_cast(lastUnresolvedCSSProperty) + 1; -const size_t maxCSSPropertyNameLength = {{max_name_length}}; + +// 1 + . +const int kNumCSSPropertyIDs = static_cast(kLastUnresolvedCSSProperty) + 1; + +const size_t kMaxCSSPropertyNameLength = {{max_name_length}}; constexpr size_t kCSSPropertyIDBitLength = {{property_id_bit_length}}; static_assert((static_cast(1) << kCSSPropertyIDBitLength) > - static_cast(lastUnresolvedCSSProperty), + static_cast(kLastUnresolvedCSSProperty), "kCSSPropertyIDBitLength has enough bits"); static_assert(CSSPropertyID::kColor == kFirstHighPriorityCSSProperty, @@ -54,8 +68,8 @@ static_assert((static_cast(kLastHighPriorityCSSProperty) - "There should a low number of high-priority properties"); inline int GetCSSPropertyIDIndex(CSSPropertyID id) { - DCHECK_GE(id, firstCSSProperty); - DCHECK_LE(id, lastCSSProperty); + DCHECK_GE(id, kFirstCSSProperty); + DCHECK_LE(id, kLastCSSProperty); return static_cast(id) - kIntFirstCSSProperty; } @@ -64,47 +78,56 @@ constexpr bool IsHighPriority(CSSPropertyID id) { id <= kLastHighPriorityCSSProperty; } -inline bool isCSSPropertyIDWithName(CSSPropertyID id) +inline bool IsCSSPropertyIDWithName(CSSPropertyID id) { - return id >= firstCSSProperty && id <= lastUnresolvedCSSProperty; + return id >= kFirstCSSProperty && id <= kLastUnresolvedCSSProperty; } -inline bool isValidCSSPropertyID(CSSPropertyID id) +inline bool IsValidCSSPropertyID(CSSPropertyID id) { return id != CSSPropertyID::kInvalid; } -inline CSSPropertyID convertToCSSPropertyID(int value) +inline CSSPropertyID ConvertToCSSPropertyID(int value) { DCHECK_GE(value, static_cast(CSSPropertyID::kInvalid)); DCHECK_LE(value, kIntLastCSSProperty); return static_cast(value); } -inline CSSPropertyID resolveCSSPropertyID(CSSPropertyID id) +inline CSSPropertyID ResolveCSSPropertyID(CSSPropertyID id) { - return convertToCSSPropertyID(static_cast(id) & ~{{alias_offset}}); + return ConvertToCSSPropertyID(static_cast(id) & ~{{alias_mask}}); } -inline bool isPropertyAlias(CSSPropertyID id) { return static_cast(id) & {{alias_offset}}; } +inline bool IsPropertyAlias(CSSPropertyID id) { + return static_cast(id) & {{alias_mask}}; +} -CSSPropertyID CORE_EXPORT unresolvedCSSPropertyID(const ExecutionContext*, const WTF::String&); +CSSPropertyID CORE_EXPORT UnresolvedCSSPropertyID(const ExecutionContext*, + const WTF::String&); -CSSPropertyID CORE_EXPORT cssPropertyID(const ExecutionContext*, const WTF::String&); +CSSPropertyID CORE_EXPORT CssPropertyID(const ExecutionContext*, + const WTF::String&); class CSSPropertyIDList { STACK_ALLOCATED(); + public: - class Iterator { - STACK_ALLOCATED(); - public: - Iterator(int id) : id_(id) {} - CSSPropertyID operator*() const { return convertToCSSPropertyID(id_); } - Iterator& operator++() { id_++; return *this; } - bool operator!=(const Iterator& i) const { return id_ != i.id_; } - private: - int id_; - }; + class Iterator { + STACK_ALLOCATED(); + public: + Iterator(int id) : id_(id) {} + CSSPropertyID operator*() const { return ConvertToCSSPropertyID(id_); } + Iterator& operator++() { + id_++; + return *this; + } + bool operator!=(const Iterator& i) const { return id_ != i.id_; } + + private: + int id_; + }; Iterator begin() const { return Iterator(kIntFirstCSSProperty); } Iterator end() const { return Iterator(kIntLastCSSProperty + 1); } }; diff --git a/chromium/third_party/blink/renderer/build/scripts/core/style/make_computed_style_base.py b/chromium/third_party/blink/renderer/build/scripts/core/style/make_computed_style_base.py index 731f354bc94..8956cc69075 100755 --- a/chromium/third_party/blink/renderer/build/scripts/core/style/make_computed_style_base.py +++ b/chromium/third_party/blink/renderer/build/scripts/core/style/make_computed_style_base.py @@ -49,6 +49,7 @@ ALIGNMENT_ORDER = [ 'Font', 'FillLayer', 'NinePieceImage', + 'SVGPaint', 'IntrinsicLength', 'TextDecorationThickness', 'StyleAspectRatio', @@ -63,6 +64,7 @@ ALIGNMENT_ORDER = [ 'FloatSize', 'LengthPoint', 'Length', + 'UnzoomedLength', 'TextSizeAdjust', 'TabSize', 'float', diff --git a/chromium/third_party/blink/renderer/build/scripts/gperf.py b/chromium/third_party/blink/renderer/build/scripts/gperf.py index 5ee49056be4..db72660d471 100644 --- a/chromium/third_party/blink/renderer/build/scripts/gperf.py +++ b/chromium/third_party/blink/renderer/build/scripts/gperf.py @@ -95,7 +95,7 @@ def main(): open(args.output_file, 'wb').write( generate_gperf(gperf_path, - open(infile).read(), gperf_args)) + open(infile).read(), gperf_args).encode('utf-8')) if __name__ == '__main__': diff --git a/chromium/third_party/blink/renderer/build/scripts/in_file.py b/chromium/third_party/blink/renderer/build/scripts/in_file.py index 28adc050f1e..58113483e57 100644 --- a/chromium/third_party/blink/renderer/build/scripts/in_file.py +++ b/chromium/third_party/blink/renderer/build/scripts/in_file.py @@ -66,7 +66,7 @@ class InFile(object): self._defaults = defaults self._valid_values = copy.deepcopy( valid_values if valid_values else {}) - self._parse(map(str.strip, lines)) + self._parse(list(map(str.strip, lines))) @classmethod def load_from_files(self, file_paths, defaults, valid_values, diff --git a/chromium/third_party/blink/renderer/build/scripts/in_generator.py b/chromium/third_party/blink/renderer/build/scripts/in_generator.py index e46740a2e85..e8450b734e8 100644 --- a/chromium/third_party/blink/renderer/build/scripts/in_generator.py +++ b/chromium/third_party/blink/renderer/build/scripts/in_generator.py @@ -32,10 +32,15 @@ import os import os.path import shlex import shutil +import sys import optparse from in_file import InFile +# TODO(crbug.com/1174969): Remove this once Python2 is obsoleted. +if sys.version_info.major != 2: + basestring = str + ######################################################### # This is now deprecated - use json5_generator.py instead diff --git a/chromium/third_party/blink/renderer/build/scripts/make_document_policy_features_tests.py b/chromium/third_party/blink/renderer/build/scripts/make_document_policy_features_tests.py new file mode 100644 index 00000000000..b20267ef340 --- /dev/null +++ b/chromium/third_party/blink/renderer/build/scripts/make_document_policy_features_tests.py @@ -0,0 +1,27 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Note(crbug.com/1167597): Do NOT change the file name to end with +# '_test.py' or '_unittest.py' as these files will be recognized by +# 'run_blinkpy_tests.py' task, where jinja2 module is not available. + +import unittest +import os +from make_document_policy_features import DocumentPolicyFeatureWriter +from writer_test_util import path_to_test_file, WriterTest + + +class MakeDocumentPolicyFeaturesTest(WriterTest): + def test_default_value_control(self): + self._test_writer( + DocumentPolicyFeatureWriter, [ + path_to_test_file('document_policy_default_value_control', + 'input', 'document_policy_features.json5') + ], + path_to_test_file('document_policy_default_value_control', + 'output')) + + +if __name__ == "__main__": + unittest.main() diff --git a/chromium/third_party/blink/renderer/build/scripts/make_policy_helper.py b/chromium/third_party/blink/renderer/build/scripts/make_policy_helper.py index 854c7394b8a..cfcb13239c6 100644 --- a/chromium/third_party/blink/renderer/build/scripts/make_policy_helper.py +++ b/chromium/third_party/blink/renderer/build/scripts/make_policy_helper.py @@ -23,8 +23,15 @@ class FeaturePolicyFeatureWriter(json5_generator.Writer): # might be different. document_policy_features = [] + def to_devtools_enum_format(feature_policy_name): + """ Convert '-' separated feature_policy_name to cammel case devtool enum name """ + return ''.join( + [name.capitalize() for name in feature_policy_name.split('-')]) + for feature in self.json5_file.name_dictionaries: if feature['feature_policy_name']: + feature['devtools_enum_name'] = to_devtools_enum_format( + feature['feature_policy_name']) feature_policy_features.append(feature) elif feature['document_policy_name']: document_policy_features.append(feature) diff --git a/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py b/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py index cafe8d94a8e..6925a4fa580 100755 --- a/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py +++ b/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py @@ -138,7 +138,7 @@ class RuntimeFeatureWriter(BaseRuntimeFeatureWriter): except Exception: # If trouble unpickling, overwrite pass - with open(os.path.abspath(file_name), 'w') as pickle_file: + with open(os.path.abspath(file_name), 'wb') as pickle_file: pickle.dump(features_map, pickle_file) def _template_inputs(self): diff --git a/chromium/third_party/blink/renderer/build/scripts/name_utilities.py b/chromium/third_party/blink/renderer/build/scripts/name_utilities.py index b476f328d4d..374fa2f25c6 100644 --- a/chromium/third_party/blink/renderer/build/scripts/name_utilities.py +++ b/chromium/third_party/blink/renderer/build/scripts/name_utilities.py @@ -44,6 +44,10 @@ def cpp_name(entry): def enum_key_for_css_keyword(keyword): + # To make sure different enum keys are generated for infinity and -infinity. + # Design doc : https://bit.ly/349gXjq + if (not isinstance(keyword, str)) and keyword.original == '-infinity': + return 'kNegative' + _upper_camel_case(keyword) return 'k' + _upper_camel_case(keyword) diff --git a/chromium/third_party/blink/renderer/build/scripts/scripts.gni b/chromium/third_party/blink/renderer/build/scripts/scripts.gni index c82106642db..be6bab77d40 100644 --- a/chromium/third_party/blink/renderer/build/scripts/scripts.gni +++ b/chromium/third_party/blink/renderer/build/scripts/scripts.gni @@ -72,7 +72,7 @@ make_trie_helpers_files = # on Posix we want to run the system one on the path. if (host_os == "win") { gperf_exe = rebase_path("//third_party/gperf/bin/gperf.exe", root_build_dir) -} else if (is_mac) { +} else if (host_os == "mac") { gperf_exe = mac_bin_path + "gperf" } else { gperf_exe = "gperf" @@ -92,8 +92,7 @@ make_core_generated_deps = [ # - //third_party/blink/renderer/build/scripts # - //third_party template("blink_python_runner") { - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - python2_action(target_name) { + action(target_name) { script = "$_scripts_dir/run_with_pythonpath.py" sources = [ invoker.script ] if (defined(invoker.sources)) { diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/document_policy_features.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/document_policy_features.cc.tmpl index bf9f9115cef..b309b866ea7 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/document_policy_features.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/document_policy_features.cc.tmpl @@ -1,9 +1,10 @@ {% from 'templates/macros.tmpl' import license, source_files_for_generated_file %} {{license()}} -{{ source_files_for_generated_file(template_file, input_files) }} #include "base/no_destructor.h" +#include "base/feature_list.h" +#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/feature_policy/document_policy_features.h" #include "third_party/blink/public/common/feature_policy/policy_value.h" #include "third_party/blink/public/mojom/feature_policy/policy_value.mojom.h" @@ -13,17 +14,33 @@ namespace blink { const DocumentPolicyFeatureInfoMap& GetDocumentPolicyFeatureInfoMap() { - static const base::NoDestructor feature_info_map({ - {%- for feature in features %} - { - mojom::DocumentPolicyFeature::k{{feature.name}}, + static const base::NoDestructor feature_info_map([] { + DocumentPolicyFeatureInfoMap map({ + {%- for feature in features %} { - "{{feature.document_policy_name}}", - {{parse_default_value(feature.default_value, feature.value_type)}} + mojom::DocumentPolicyFeature::k{{feature.name}}, + { + "{{feature.document_policy_name}}", + {{parse_default_value(feature.default_value, feature.value_type)}} + } + }, + {%- endfor %} + }); + + {%- for feature in features %} + {%- if feature.default_value_behind_flag %} + {%- for flag, default_value in feature.default_value_behind_flag %} + {%- if not loop.first %} else {% endif %} + if (base::FeatureList::IsEnabled(features::k{{flag}})) { + map.find(mojom::DocumentPolicyFeature::k{{feature.name}})->second.default_value = + {{parse_default_value(default_value, feature.value_type)}}; } - }, + {%- endfor %} + {%- endif %} {%- endfor %} - }); + + return map; + }()); return *feature_info_map; } @@ -38,5 +55,3 @@ const DocumentPolicyNameFeatureMap& GetDocumentPolicyNameFeatureMap() { } } // namespace blink - - diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/fields/field.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/fields/field.tmpl index 91712d1b263..2e46f6e80e4 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/fields/field.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/fields/field.tmpl @@ -61,6 +61,12 @@ const {{field.type_name}}& {%- endfor -%} {% endmacro %} +{% macro group_setter_expression(group) %} +{% for group in group.path_without_root() -%} +{{group.member_name}}{{print_if(not loop.last, ".Access()->")}} +{%- endfor -%} +{% endmacro %} + {% macro declare_storage(field) %} {% if field.is_bit_field %} {{print_if(field.mutable, "mutable ")}}unsigned {{field.name}} : {{field.size}}; // {{field.type_name}} @@ -87,12 +93,15 @@ const {{field.type_name}}& {% for subgroup in group.subgroups %} {# If every field in this subgroup is to be compared, we can compare the group pointer instead. #} + {% set group_expression = group_getter_expression(subgroup) %} {% if subgroup.all_fields|rejectattr("custom_compare")|reject("in", fields_to_compare)|list|length == 0 -%} - {{boolean_and()}}{{subgroup.member_name}} == o.{{subgroup.member_name}} + {{boolean_and()}}{{group_expression}} == o.{{group_expression}} {# Otherwise, we would have to recursively generate comparison operations - on fields in the subgroup. #} + on fields in the subgroup. If the objects are the same, we can skip the + per-field comparisons. #} {% elif subgroup.all_fields|rejectattr("custom_compare")|select("in", fields_to_compare)|list|length > 0 -%} - {{fieldwise_compare(subgroup, fields_to_compare, boolean_and)}} + {{boolean_and()}}({{group_expression}}.Get() == o.{{group_expression}}.Get() +|| ({{fieldwise_compare(subgroup, fields_to_compare)}})) {% endif %} {% endfor %} {% for field in group.fields|rejectattr("custom_compare")|select("in", fields_to_compare) -%} @@ -102,10 +111,13 @@ const {{field.type_name}}& {% macro fieldwise_copy(group, fields_to_copy) %} {% for subgroup in group.subgroups %} + {% set group_expression = group_getter_expression(subgroup) %} {% if subgroup.all_fields|rejectattr("custom_copy")|reject("in", fields_to_copy)|list|length == 0 -%} - {{subgroup.member_name}} = other.{{subgroup.member_name}}; + {{group_setter_expression(subgroup)}} = other.{{group_expression}}; {% elif subgroup.all_fields|rejectattr("custom_copy")|select("in", fields_to_copy)|list|length > 0 -%} - {{fieldwise_copy(subgroup, fields_to_copy)}} +if ({{group_expression}}.Get() != other.{{group_expression}}.Get()) { +{{fieldwise_copy(subgroup, fields_to_copy)|indent(2, true)}} +} {% endif %} {% endfor %} {% for field in group.fields|rejectattr("custom_copy")|select("in", fields_to_copy) -%} @@ -118,12 +130,14 @@ const {{field.type_name}}& {% for subgroup in group.subgroups %} {# If every field in this subgroup is inherited, we directly compare the group pointer instead. #} + {% set group_expression = group_getter_expression(subgroup) %} {% if subgroup.all_fields|rejectattr("is_inherited")|list|length == 0 -%} - {{boolean_and()}}{{subgroup.member_name}}.Get() == o.{{subgroup.member_name}}.Get() + {{boolean_and()}}{{group_expression}}.Get() == o.{{group_expression}}.Get() {# Otherwise, we would have to recursively generate comparison operations on fields in the subgroup. #} {% elif subgroup.all_fields|selectattr("is_inherited")|list|length > 0 -%} - {{fieldwise_pointer_compare_inherited(subgroup, boolean_and)}} + {{boolean_and()}}({{group_expression}}.Get() == o.{{group_expression}}.Get() +|| ({{fieldwise_pointer_compare_inherited(subgroup)}})) {% endif %} {% endfor %} {% for field in group.fields if field.is_inherited -%} @@ -131,6 +145,14 @@ const {{field.type_name}}& {% endfor %} {% endmacro %} +{% macro diff_field(is_pointer_type, expr) %} +{% if is_pointer_type -%} +!DataEquivalent(a.{{expr}}, b.{{expr}}) +{%- else -%} +a.{{expr}} != b.{{expr}} +{%- endif %} +{% endmacro %} + {% macro fieldwise_diff(group_to_diff) %} {% for diff_group in group_to_diff.subgroups %} if (a.{{group_getter_expression(diff_group.group)}}.Get() != b.{{group_getter_expression(diff_group.group)}}.Get()) { @@ -138,7 +160,7 @@ if (a.{{group_getter_expression(diff_group.group)}}.Get() != b.{{group_getter_ex } {% endfor %} {% for field in group_to_diff.fields %} -if (a.{{getter_expression(field)}} != b.{{getter_expression(field)}}) +if ({{diff_field(field.wrapper_pointer_name, getter_expression(field))}}) return true; {% endfor %} {% for expression in group_to_diff.expressions %} diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl index dcdbb02a56c..d446c30767b 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/macros.tmpl @@ -76,3 +76,13 @@ case {{ length }}: {% macro print_if(predicate, str) -%} {% if predicate %}{{str}}{% endif %} {%- endmacro %} + + +{# See //docs/lacros.md for details on these Chrome OS defines. #} +{%- macro platform_define(platform) -%} +{%- if platform|lower == 'chromeos' -%} +(BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)) +{%- else -%} +defined(OS_{{platform | upper}}) +{%- endif -%} +{%- endmacro -%} diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl index fea0690b3f9..6cbd0173460 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl @@ -1,4 +1,4 @@ -{% from 'templates/macros.tmpl' import license, source_files_for_generated_file %} +{% from 'templates/macros.tmpl' import license, source_files_for_generated_file, platform_define %} {{license()}} {{source_files_for_generated_file(template_file, input_files)}} @@ -8,7 +8,8 @@ #include #include #include -#include "base/stl_util.h" +#include "base/containers/contains.h" +#include "build/chromeos_buildflags.h" #include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" @@ -100,7 +101,7 @@ bool origin_trials::FeatureEnabledForOS(OriginTrialFeature feature) { #if {%- for os in feature.origin_trial_os %} {%- if not loop.first %} ||{% endif %} - defined(OS_{{os | upper}}) + {{platform_define(os)}} {%- endfor %} return true; diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/policy_helper.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/policy_helper.cc.tmpl index b18e356c226..928c17a96a8 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/policy_helper.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/policy_helper.cc.tmpl @@ -6,13 +6,14 @@ #include "third_party/blink/renderer/core/feature_policy/policy_helper.h" #include "third_party/blink/public/mojom/feature_policy/document_policy_feature.mojom-blink.h" +#include "third_party/blink/public/mojom/feature_policy/feature_policy_feature.mojom-blink.h" #include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom-blink.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/origin_trials/origin_trials.h" +#include "third_party/blink/renderer/core/inspector/protocol/Page.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" namespace blink { - namespace { {% for feature in feature_policy_features %} @@ -50,8 +51,20 @@ const FeatureNameMap& GetDefaultFeatureNameMap() { return default_feature_name_map; } -const DocumentPolicyFeatureSet& GetAvailableDocumentPolicyFeatures() { + +DocumentPolicyFeatureSet& GetAvailableDocumentPolicyFeaturesInternal() { DEFINE_STATIC_LOCAL(DocumentPolicyFeatureSet, features, ()); + return features; +} + + +void ResetAvailableDocumentPolicyFeaturesForTest() { + GetAvailableDocumentPolicyFeaturesInternal().clear(); +} + + +const DocumentPolicyFeatureSet& GetAvailableDocumentPolicyFeatures() { + DocumentPolicyFeatureSet& features = GetAvailableDocumentPolicyFeaturesInternal(); if (features.IsEmpty()) { {% for feature in document_policy_features %} {% if not feature.depends_on or feature.name in dp_origin_trial_dependency_map %} @@ -99,4 +112,16 @@ bool DisabledByOriginTrial(mojom::blink::DocumentPolicyFeature feature, return false; } +String PermissionsPolicyFeatureToProtocol(mojom::blink::FeaturePolicyFeature feature) { + switch (feature) { + {% for feature in feature_policy_features %} + case mojom::blink::FeaturePolicyFeature::k{{feature.name}}: + return protocol::Page::PermissionsPolicyFeatureEnum::{{feature.devtools_enum_name}}; + {% endfor %} + case mojom::blink::FeaturePolicyFeature::kNotFound: + NOTREACHED(); + return ""; + } +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/runtime_enabled_features.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/runtime_enabled_features.cc.tmpl index ca5cbd86227..2b5eeb4e371 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/runtime_enabled_features.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/runtime_enabled_features.cc.tmpl @@ -1,9 +1,10 @@ -{% from 'templates/macros.tmpl' import license, source_files_for_generated_file %} +{% from 'templates/macros.tmpl' import license, source_files_for_generated_file, platform_define %} {{license()}} {{source_files_for_generated_file(template_file, input_files)}} #include "build/build_config.h" +#include "build/chromeos_buildflags.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" @@ -33,7 +34,7 @@ void RuntimeEnabledFeatures::Set{{feature_set|capitalize}}FeaturesEnabled(bool e // Platform-dependent features {% for platform in platforms %} -#if defined(OS_{{platform | upper}}) +#if {{platform_define(platform)}} {% for feature in features if feature.status_type == 'dict' and feature.status[platform] == feature_set %} Set{{feature.name}}Enabled(enable); {% endfor %} @@ -44,7 +45,7 @@ void RuntimeEnabledFeatures::Set{{feature_set|capitalize}}FeaturesEnabled(bool e #if {%- for platform in platforms %} {%- if not loop.first %} &&{% endif %} - !defined(OS_{{platform | upper}}) + !{{platform_define(platform)}} {%- endfor %} {% for feature in features if feature.status_type == 'dict' and feature.status['default'] == feature_set %} @@ -112,7 +113,7 @@ bool RuntimeEnabledFeatures::{{feature.data_member_name}} = {{'true' if feature. // Platform-dependent features {% for platform in platforms %} -#if defined(OS_{{platform | upper}}) +#if {{platform_define(platform)}} {% for feature in features %} {% if feature.status_type == 'dict' %} bool RuntimeEnabledFeatures::{{feature.data_member_name}} = {{'true' if feature.status[platform] == 'stable' else 'false'}}; @@ -125,7 +126,7 @@ bool RuntimeEnabledFeatures::{{feature.data_member_name}} = {{'true' if feature. #if {%- for platform in platforms %} {%- if not loop.first %} &&{% endif %} - !defined(OS_{{platform | upper}}) + !{{platform_define(platform)}} {%- endfor %} {% for feature in features %} diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl index 6f917df98a7..327431d6054 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl @@ -39,28 +39,16 @@ void Settings::Set{{setting.name.to_upper_camel_case()}}({{setting.type|to_passi return; \ {{setting.name.to_class_data_member()}} = {{setting.name.to_snake_case()}}; \ {% if setting.invalidate %} - Invalidate(SettingsDelegate::k{{setting.invalidate}}Change); \ + {% for type in setting.invalidate %} + Invalidate(SettingsDelegate::ChangeType::k{{type}}); \ + {% endfor %} {% endif %} } \ {% endfor %} void Settings::SetFromStrings(const String& name, const String& value) { \ {% for setting in settings %} if (name == "{{setting.name}}") { \ - Set{{setting.name.to_upper_camel_case()}}( \ - {% if setting.type == 'String' %} - value \ - {% elif setting.type == 'bool' %} - value.IsEmpty() || value == "true" \ - {% elif setting.type == 'int' %} - value.ToInt() \ - {% elif setting.type == 'float' %} - value.ToFloat() \ - {% elif setting.type == 'double' %} - value.ToDouble() \ - {% else %} - static_cast<{{setting.type}}>(value.ToInt()) \ - {% endif %} - ); \ + Set{{setting.name.to_upper_camel_case()}}(FromString<{{setting.type}}>()(value)); \ return; \ } \ {% endfor %} diff --git a/chromium/third_party/blink/renderer/build/scripts/writer_test_util.py b/chromium/third_party/blink/renderer/build/scripts/writer_test_util.py new file mode 100644 index 00000000000..f991dcaac2f --- /dev/null +++ b/chromium/third_party/blink/renderer/build/scripts/writer_test_util.py @@ -0,0 +1,111 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import contextlib +import difflib +import filecmp +import os +import shutil +import tempfile +import unittest + +from json5_generator import Json5File, Writer + + +@contextlib.contextmanager +def tmp_dir(): + tmp = tempfile.mkdtemp() + try: + yield tmp + finally: + shutil.rmtree(tmp) + + +def path_to_test_file(*path): + return os.path.join(os.path.dirname(__file__), 'tests', *path) + + +def diff(filename1, filename2): + with open(filename1) as file1: + file1_lines = file1.readlines() + with open(filename2) as file2: + file2_lines = file2.readlines() + + # Use Python's difflib module so that diffing works across platforms + return ''.join(difflib.context_diff(file1_lines, file2_lines)) + + +def is_identical_file(reference_filename, output_filename): + reference_basename = os.path.basename(reference_filename) + + if not os.path.isfile(reference_filename): + print 'Missing reference file!' + print '(if adding new test, update reference files)' + print reference_basename + print + return False + + if not filecmp.cmp(reference_filename, output_filename): + # cmp is much faster than diff, and usual case is "no difference", + # so only run diff if cmp detects a difference + print 'FAIL: %s' % reference_basename + print diff(reference_filename, output_filename) + return False + + return True + + +def compare_output_dir(reference_dir, output_dir): + """ + Compares output files in both reference_dir and output_dir. + + Note: this function ignores subdirectory content in both reference + dir and output_dir. + + Note: reference_dir should have all ref files ending with .ref suffix. + '.ref' suffix is added to bypass code formatter on reference files. + + :returns {bool}: Whether files in output dir matches files in ref dir + """ + ref_content = { + f[:-4] + for f in os.listdir(reference_dir) if f.endswith('.ref') + } + output_content = set(os.listdir(output_dir)) + + if ref_content != output_content: + print 'Output files does not match.' + print 'Following files are extra: {}'.format(output_content - + ref_content) + print 'Following files are missing: {}'.format(ref_content - + output_content) + return False + + for file_name in ref_content: + ref_file = os.path.join(reference_dir, file_name) + '.ref' + output_file = os.path.join(output_dir, file_name) + + if os.path.isdir(ref_file) and os.path.isdir(output_file): + continue + elif os.path.isdir(ref_file) or os.path.isdir(output_file): + return False + elif not is_identical_file(ref_file, output_file): + return False + + return True + + +class WriterTest(unittest.TestCase): + def _test_writer(self, writer_class, json5_files, reference_dir): + """ + :param writer_class {Writer}: a subclass to Writer + :param json5_files {List[str]}: json5 test input files + :param reference_dir {str}: directory to expected output files + """ + with tmp_dir() as tmp: + writer = writer_class(json5_files, tmp) + writer.write_files(tmp) + writer.cleanup_files(tmp) + + self.assertTrue(compare_output_dir(reference_dir, tmp)) diff --git a/chromium/third_party/blink/renderer/controller/BUILD.gn b/chromium/third_party/blink/renderer/controller/BUILD.gn index c5647d2dc50..8ca39927416 100644 --- a/chromium/third_party/blink/renderer/controller/BUILD.gn +++ b/chromium/third_party/blink/renderer/controller/BUILD.gn @@ -9,7 +9,10 @@ import("//third_party/blink/renderer/config.gni") import("//third_party/blink/renderer/core/core.gni") import("//third_party/blink/renderer/modules/modules.gni") -visibility = [ "//third_party/blink/*" ] +visibility = [ + "//:gn_all", + "//third_party/blink/*", +] component("controller") { output_name = "blink_controller" @@ -195,6 +198,7 @@ source_set("blink_unittests_sources") { testonly = true sources = [ + "performance_manager/renderer_resource_coordinator_impl_test.cc", "performance_manager/v8_detailed_memory_reporter_impl_test.cc", "performance_manager/v8_worker_memory_reporter_test.cc", "tests/run_all_tests.cc", @@ -224,6 +228,7 @@ source_set("blink_unittests_sources") { "//base:i18n", "//base/test:test_support", "//components/payments/mojom:mojom_blink", + "//components/performance_manager/public/mojom:mojom_blink", "//content/test:test_support", "//gpu:test_support", "//testing/gmock", diff --git a/chromium/third_party/blink/renderer/controller/DIR_METADATA b/chromium/third_party/blink/renderer/controller/DIR_METADATA new file mode 100644 index 00000000000..90b2e9cf1bc --- /dev/null +++ b/chromium/third_party/blink/renderer/controller/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink>Internals>Modularization" +} + +team_email: "platform-architecture-dev@chromium.org" diff --git a/chromium/third_party/blink/renderer/controller/OWNERS b/chromium/third_party/blink/renderer/controller/OWNERS index c4622a1fe9e..00ade91cf4e 100644 --- a/chromium/third_party/blink/renderer/controller/OWNERS +++ b/chromium/third_party/blink/renderer/controller/OWNERS @@ -4,6 +4,3 @@ nverne@chromium.org slangley@chromium.org tkent@chromium.org - -# TEAM: platform-architecture-dev@chromium.org -# COMPONENT: Blink>Internals>Modularization diff --git a/chromium/third_party/blink/renderer/controller/blink_initializer.cc b/chromium/third_party/blink/renderer/controller/blink_initializer.cc index c6b95e1854b..b71000750cf 100644 --- a/chromium/third_party/blink/renderer/controller/blink_initializer.cc +++ b/chromium/third_party/blink/renderer/controller/blink_initializer.cc @@ -38,7 +38,7 @@ #include "mojo/public/cpp/bindings/binder_map.h" #include "third_party/blink/public/common/experiments/memory_ablation_experiment.h" #include "third_party/blink/public/common/features.h" -#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom-blink.h" +#include "third_party/blink/public/mojom/optimization_guide/optimization_guide.mojom-blink.h" #include "third_party/blink/public/platform/interface_registry.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/web/blink.h" @@ -47,7 +47,6 @@ #include "third_party/blink/renderer/controller/dev_tools_frontend_impl.h" #include "third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.h" #include "third_party/blink/renderer/controller/performance_manager/v8_detailed_memory_reporter_impl.h" -#include "third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter.h" #include "third_party/blink/renderer/core/animation/animation_clock.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/execution_context/agent.h" @@ -167,7 +166,6 @@ void InitializeCommon(Platform* platform, mojo::BinderMap* binders) { // Initialize performance manager. RendererResourceCoordinatorImpl::MaybeInitialize(); - V8WorkerMemoryReporter::RegisterWebMemoryReporter(); } } // namespace diff --git a/chromium/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc b/chromium/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc index 7c15b9ea0e5..671189a4926 100644 --- a/chromium/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc +++ b/chromium/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc @@ -35,6 +35,7 @@ #include "third_party/blink/renderer/core/exported/web_view_impl.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/frame/web_frame_widget_impl.h" #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/core/inspector/dev_tools_host.h" #include "third_party/blink/renderer/core/page/page.h" @@ -65,9 +66,7 @@ const char DevToolsFrontendImpl::kSupplementName[] = "DevToolsFrontendImpl"; DevToolsFrontendImpl::DevToolsFrontendImpl( LocalFrame& frame, mojo::PendingAssociatedReceiver receiver) - : Supplement(frame), - host_(frame.DomWindow()), - receiver_(this, frame.DomWindow()) { + : Supplement(frame) { receiver_.Bind(std::move(receiver), frame.GetTaskRunner(TaskType::kMiscPlatformAPI)); } @@ -106,7 +105,10 @@ void DevToolsFrontendImpl::DidClearWindowObject() { void DevToolsFrontendImpl::SetupDevToolsFrontend( const String& api_script, mojo::PendingAssociatedRemote host) { - DCHECK(GetSupplementable()->IsMainFrame()); + LocalFrame* frame = GetSupplementable(); + DCHECK(frame->IsMainFrame()); + frame->GetWidgetForLocalRoot()->SetLayerTreeDebugState( + cc::LayerTreeDebugState()); api_script_ = api_script; host_.Bind(std::move(host), GetSupplementable()->GetTaskRunner(TaskType::kMiscPlatformAPI)); diff --git a/chromium/third_party/blink/renderer/controller/dev_tools_frontend_impl.h b/chromium/third_party/blink/renderer/controller/dev_tools_frontend_impl.h index a36f7842f13..7e7eadb9011 100644 --- a/chromium/third_party/blink/renderer/controller/dev_tools_frontend_impl.h +++ b/chromium/third_party/blink/renderer/controller/dev_tools_frontend_impl.h @@ -37,7 +37,6 @@ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/mojo/heap_mojo_associated_receiver.h" #include "third_party/blink/renderer/platform/mojo/heap_mojo_associated_remote.h" -#include "third_party/blink/renderer/platform/mojo/heap_mojo_wrapper_mode.h" #include "third_party/blink/renderer/platform/supplementable.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -84,13 +83,14 @@ class DevToolsFrontendImpl final Member devtools_host_; String api_script_; - HeapMojoAssociatedRemote - host_; + // The host_ must outlive the ExecutionContext of LocalFrame, so it should not + // be associated with the ExecutionContext of LocalFrame. + HeapMojoAssociatedRemote host_{nullptr}; + // The receiver_ must outlive the ExecutionContext of LocalFrame, so it should + // not be associated with the ExecutionContext of LocalFrame. HeapMojoAssociatedReceiver - receiver_; + DevToolsFrontendImpl> + receiver_{this, nullptr}; DISALLOW_COPY_AND_ASSIGN(DevToolsFrontendImpl); }; diff --git a/chromium/third_party/blink/renderer/controller/highest_pmf_reporter_test.cc b/chromium/third_party/blink/renderer/controller/highest_pmf_reporter_test.cc index 9aa0387d653..8ae8a7b1054 100644 --- a/chromium/third_party/blink/renderer/controller/highest_pmf_reporter_test.cc +++ b/chromium/third_party/blink/renderer/controller/highest_pmf_reporter_test.cc @@ -11,6 +11,8 @@ #include "third_party/blink/public/common/features.h" #include "third_party/blink/renderer/core/loader/empty_clients.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" +#include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" namespace blink { @@ -70,7 +72,9 @@ class MockMemoryUsageMonitor : public MemoryUsageMonitor { MockMemoryUsageMonitor( scoped_refptr task_runner_for_testing, const base::TickClock* clock) - : MemoryUsageMonitor(task_runner_for_testing, clock) { + : MemoryUsageMonitor(task_runner_for_testing, clock), + agent_group_scheduler_( + Thread::MainThread()->Scheduler()->CreateAgentGroupScheduler()) { memset(&mock_memory_usage_, 0, sizeof(mock_memory_usage_)); } ~MockMemoryUsageMonitor() override = default; @@ -115,11 +119,12 @@ class MockMemoryUsageMonitor : public MemoryUsageMonitor { Page* CreateDummyPage() { Page::PageClients page_clients; FillWithEmptyClients(page_clients); - return Page::CreateNonOrdinary(page_clients); + return Page::CreateNonOrdinary(page_clients, *agent_group_scheduler_); } MemoryUsage mock_memory_usage_; std::vector> dummy_pages_; + std::unique_ptr agent_group_scheduler_; }; class HighestPmfReporterTest : public PageTestBase { diff --git a/chromium/third_party/blink/renderer/controller/memory_usage_monitor.cc b/chromium/third_party/blink/renderer/controller/memory_usage_monitor.cc index 29693644b89..d78fba9a480 100644 --- a/chromium/third_party/blink/renderer/controller/memory_usage_monitor.cc +++ b/chromium/third_party/blink/renderer/controller/memory_usage_monitor.cc @@ -79,7 +79,7 @@ void MemoryUsageMonitor::TimerFired() { MemoryUsage usage = GetCurrentMemoryUsage(); for (auto& observer : observers_) observer.OnMemoryPing(usage); - if (!observers_.might_have_observers()) + if (observers_.empty()) StopMonitoring(); } diff --git a/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.cc b/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.cc index 090d4048a44..67c85abefc4 100644 --- a/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.cc +++ b/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.cc @@ -4,13 +4,20 @@ #include "third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.h" +#include + #include "base/bind.h" +#include "base/check.h" #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" +#include "third_party/blink/public/common/tokens/tokens.h" +#include "third_party/blink/public/mojom/frame/frame_owner_element_type.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" +#include "third_party/blink/renderer/core/frame/frame.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/frame/remote_frame.h" #include "third_party/blink/renderer/core/html/html_frame_owner_element.h" #include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" @@ -18,24 +25,30 @@ #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" +using performance_manager::mojom::blink::IframeAttributionData; +using performance_manager::mojom::blink::IframeAttributionDataPtr; +using performance_manager::mojom::blink::ProcessCoordinationUnit; +using performance_manager::mojom::blink::V8ContextDescription; +using performance_manager::mojom::blink::V8ContextDescriptionPtr; +using performance_manager::mojom::blink::V8ContextWorldType; + namespace WTF { // Copies the data by move. template <> -struct CrossThreadCopier< - performance_manager::mojom::blink::V8ContextDescriptionPtr> - : public WTF::CrossThreadCopierByValuePassThrough< - performance_manager::mojom::blink::V8ContextDescriptionPtr> {}; +struct CrossThreadCopier + : public WTF::CrossThreadCopierByValuePassThrough { +}; // Copies the data by move. template <> -struct CrossThreadCopier< - performance_manager::mojom::blink::IframeAttributionDataPtr> +struct CrossThreadCopier : public WTF::CrossThreadCopierByValuePassThrough< - performance_manager::mojom::blink::IframeAttributionDataPtr> {}; + IframeAttributionDataPtr> {}; // Copies the data using the copy constructor. template <> @@ -46,9 +59,9 @@ struct CrossThreadCopier namespace blink { -namespace { +using mojom::blink::FrameOwnerElementType; -using performance_manager::mojom::blink::V8ContextWorldType; +namespace { // Determines if the given stable world ID is an extension world ID. // Extensions IDs are 32-character strings containing characters in the range of @@ -67,6 +80,33 @@ bool IsExtensionStableWorldId(const String& stable_world_id) { return true; } +// Returns true if |owner| is an iframe, false otherwise. +// This will also return true for custom elements built on iframe, like +// and . Since the renderer has no knowledge of these they +// must be filtered out on the browser side. +bool ShouldSendIframeNotificationsFor(const HTMLFrameOwnerElement& owner) { + return owner.OwnerType() == FrameOwnerElementType::kIframe; +} + +// If |frame| is a RemoteFrame with a local parent, returns the parent. +// Otherwise returns nullptr. +LocalFrame* GetLocalParentOfRemoteFrame(const Frame& frame) { + if (IsA(frame)) { + if (Frame* parent = frame.Tree().Parent()) { + return DynamicTo(parent); + } + } + return nullptr; +} + +IframeAttributionDataPtr AttributionDataForOwner( + const HTMLFrameOwnerElement& owner) { + auto attribution_data = IframeAttributionData::New(); + attribution_data->id = owner.FastGetAttribute(html_names::kIdAttr); + attribution_data->src = owner.FastGetAttribute(html_names::kSrcAttr); + return attribution_data; +} + } // namespace RendererResourceCoordinatorImpl::~RendererResourceCoordinatorImpl() = default; @@ -80,9 +120,7 @@ void RendererResourceCoordinatorImpl::MaybeInitialize() { DCHECK(IsMainThread()); DCHECK(platform); - mojo::PendingRemote< - performance_manager::mojom::blink::ProcessCoordinationUnit> - remote; + mojo::PendingRemote remote; platform->GetBrowserInterfaceBroker()->GetInterface( remote.InitWithNewPipeAndPassReceiver()); RendererResourceCoordinator::Set( @@ -91,8 +129,7 @@ void RendererResourceCoordinatorImpl::MaybeInitialize() { void RendererResourceCoordinatorImpl::SetMainThreadTaskLoadIsLow( bool main_thread_task_load_is_low) { - if (!service_) - return; + DCHECK(service_); service_->SetMainThreadTaskLoadIsLow(main_thread_task_load_is_low); } @@ -100,14 +137,12 @@ void RendererResourceCoordinatorImpl::OnScriptStateCreated( ScriptState* script_state, ExecutionContext* execution_context) { DCHECK(script_state); - if (!service_) - return; + DCHECK(service_); - auto v8_desc = performance_manager::mojom::blink::V8ContextDescription::New(); + auto v8_desc = V8ContextDescription::New(); v8_desc->token = script_state->GetToken(); - performance_manager::mojom::blink::IframeAttributionDataPtr - iframe_attribution_data; + IframeAttributionDataPtr iframe_attribution_data; // Default the world name to being empty. @@ -162,12 +197,7 @@ void RendererResourceCoordinatorImpl::OnScriptStateCreated( // frame. auto* owner = To(local_frame->Owner()); DCHECK(owner); - iframe_attribution_data = - performance_manager::mojom::blink::IframeAttributionData::New(); - iframe_attribution_data->id = - owner->FastGetAttribute(html_names::kIdAttr); - iframe_attribution_data->src = - owner->FastGetAttribute(html_names::kSrcAttr); + iframe_attribution_data = AttributionDataForOwner(*owner); } } } @@ -189,18 +219,44 @@ void RendererResourceCoordinatorImpl::OnScriptStateDestroyed( DispatchOnV8ContextDestroyed(script_state->GetToken()); } +void RendererResourceCoordinatorImpl::OnBeforeContentFrameAttached( + const Frame& frame, + const HTMLFrameOwnerElement& owner) { + DCHECK(service_); + if (!ShouldSendIframeNotificationsFor(owner)) + return; + LocalFrame* parent = GetLocalParentOfRemoteFrame(frame); + if (!parent) + return; + service_->OnRemoteIframeAttached( + parent->GetLocalFrameToken(), + frame.GetFrameToken().GetAs(), + AttributionDataForOwner(owner)); +} + +void RendererResourceCoordinatorImpl::OnBeforeContentFrameDetached( + const Frame& frame, + const HTMLFrameOwnerElement& owner) { + DCHECK(service_); + if (!ShouldSendIframeNotificationsFor(owner)) + return; + LocalFrame* parent = GetLocalParentOfRemoteFrame(frame); + if (!parent) + return; + service_->OnRemoteIframeDetached( + parent->GetLocalFrameToken(), + frame.GetFrameToken().GetAs()); +} + RendererResourceCoordinatorImpl::RendererResourceCoordinatorImpl( - mojo::PendingRemote< - performance_manager::mojom::blink::ProcessCoordinationUnit> remote) { + mojo::PendingRemote remote) { service_.Bind(std::move(remote)); } void RendererResourceCoordinatorImpl::DispatchOnV8ContextCreated( - performance_manager::mojom::blink::V8ContextDescriptionPtr v8_desc, - performance_manager::mojom::blink::IframeAttributionDataPtr - iframe_attribution_data) { - if (!service_) - return; + V8ContextDescriptionPtr v8_desc, + IframeAttributionDataPtr iframe_attribution_data) { + DCHECK(service_); // Calls to this can arrive on any thread (due to workers, etc), but the // interface itself is bound to the main thread. In this case, once we've // collated the necessary data we bounce over to the main thread. Note that @@ -221,8 +277,7 @@ void RendererResourceCoordinatorImpl::DispatchOnV8ContextCreated( void RendererResourceCoordinatorImpl::DispatchOnV8ContextDetached( const blink::V8ContextToken& token) { - if (!service_) - return; + DCHECK(service_); // See DispatchOnV8ContextCreated for why this is both needed and safe. if (!IsMainThread()) { blink::PostCrossThreadTask( @@ -236,8 +291,7 @@ void RendererResourceCoordinatorImpl::DispatchOnV8ContextDetached( } void RendererResourceCoordinatorImpl::DispatchOnV8ContextDestroyed( const blink::V8ContextToken& token) { - if (!service_) - return; + DCHECK(service_); // See DispatchOnV8ContextCreated for why this is both needed and safe. if (!IsMainThread()) { blink::PostCrossThreadTask( diff --git a/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.h b/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.h index e02fd5b2dcb..a908f8076d8 100644 --- a/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.h +++ b/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.h @@ -37,8 +37,14 @@ class CONTROLLER_EXPORT RendererResourceCoordinatorImpl final ExecutionContext* execution_context) final; void OnScriptStateDetached(ScriptState* script_state) final; void OnScriptStateDestroyed(ScriptState* script_state) final; + void OnBeforeContentFrameAttached(const Frame& frame, + const HTMLFrameOwnerElement& owner) final; + void OnBeforeContentFrameDetached(const Frame& frame, + const HTMLFrameOwnerElement& owner) final; private: + friend class RendererResourceCoordinatorImplTest; + explicit RendererResourceCoordinatorImpl( mojo::PendingRemote< performance_manager::mojom::blink::ProcessCoordinationUnit> remote); diff --git a/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl_test.cc b/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl_test.cc new file mode 100644 index 00000000000..92185a64a31 --- /dev/null +++ b/chromium/third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl_test.cc @@ -0,0 +1,272 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/controller/performance_manager/renderer_resource_coordinator_impl.h" + +#include +#include + +#include "base/check.h" +#include "base/memory/ptr_util.h" +#include "components/performance_manager/public/mojom/coordination_unit.mojom-blink.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/tokens/tokens.h" +#include "third_party/blink/public/mojom/frame/tree_scope_type.mojom-blink.h" +#include "third_party/blink/renderer/core/frame/frame_test_helpers.h" +#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" +#include "third_party/blink/renderer/core/frame/web_remote_frame_impl.h" +#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/testing/url_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" +#include "v8/include/v8.h" + +namespace blink { + +namespace { + +using performance_manager::mojom::blink::IframeAttributionData; +using performance_manager::mojom::blink::IframeAttributionDataPtr; +using performance_manager::mojom::blink::ProcessCoordinationUnit; +using performance_manager::mojom::blink::V8ContextDescription; +using performance_manager::mojom::blink::V8ContextDescriptionPtr; +using ::testing::_; +using ::testing::AllOf; +using ::testing::Field; +using ::testing::InSequence; +using ::testing::Mock; +using ::testing::Pointee; + +class MockProcessCoordinationUnit : public ProcessCoordinationUnit { + public: + explicit MockProcessCoordinationUnit( + mojo::PendingReceiver receiver) + : receiver_(this, std::move(receiver)) {} + + // Don't mock uninteresting property signals. + void SetMainThreadTaskLoadIsLow(bool main_thread_task_load_is_low) final {} + + MOCK_METHOD(void, + OnV8ContextCreated, + (V8ContextDescriptionPtr description, + IframeAttributionDataPtr attribution), + (override)); + MOCK_METHOD(void, + OnV8ContextDetached, + (const blink::V8ContextToken& token), + (override)); + MOCK_METHOD(void, + OnV8ContextDestroyed, + (const blink::V8ContextToken& token), + (override)); + MOCK_METHOD(void, + OnRemoteIframeAttached, + (const blink::LocalFrameToken& parent_frame_token, + const blink::RemoteFrameToken& remote_frame_token, + IframeAttributionDataPtr attribution), + (override)); + MOCK_METHOD(void, + OnRemoteIframeDetached, + (const blink::LocalFrameToken& parent_frame_token, + const blink::RemoteFrameToken& remote_frame_token), + (override)); + + void VerifyExpectations() { + // Ensure that any pending Mojo messages are processed. + receiver_.FlushForTesting(); + Mock::VerifyAndClearExpectations(this); + } + + private: + mojo::Receiver receiver_; +}; + +MATCHER_P(MatchV8ContextDescription, + execution_context_token, + "V8ContextDescription::execution_context_token matches") { + return arg->execution_context_token == + blink::ExecutionContextToken(execution_context_token); +} + +MATCHER_P2(MatchAndSaveV8ContextDescription, + execution_context_token, + output_token, + "V8ContextDescription::execution_context_token matches") { + DCHECK(output_token); + *output_token = arg->token; + return arg->execution_context_token == + blink::ExecutionContextToken(execution_context_token); +} + +} // namespace + +class RendererResourceCoordinatorImplTest : public ::testing::Test { + protected: + void TearDown() override { + // Uninstall any RendererResourceCoordinator that was set by + // InitializeMockProcessCoordinationUnit. + RendererResourceCoordinator::Set(nullptr); + } + + template + void InitializeMockProcessCoordinationUnit() { + DCHECK(!mock_process_coordination_unit_); + DCHECK(!resource_coordinator_); + + mojo::PendingRemote pending_remote; + mock_process_coordination_unit_ = std::make_unique( + pending_remote.InitWithNewPipeAndPassReceiver()); + + // Create a RendererResourceCoordinator bound to the other end of the + // MockProcessCoordinationUnit's remote. + // Can't use make_unique with a private constructor. + resource_coordinator_ = base::WrapUnique( + new RendererResourceCoordinatorImpl(std::move(pending_remote))); + RendererResourceCoordinator::Set(resource_coordinator_.get()); + } + + std::unique_ptr mock_process_coordination_unit_; + std::unique_ptr resource_coordinator_; +}; + +TEST_F(RendererResourceCoordinatorImplTest, IframeNotifications) { + InitializeMockProcessCoordinationUnit< + ::testing::StrictMock>(); + + frame_test_helpers::WebViewHelper helper; + helper.InitializeAndLoad("about:blank"); + + // The ", + url_test_helpers::ToKURL("https://example.com/subframe.html")); + mock_process_coordination_unit_->VerifyExpectations(); + + // Swap for a remote frame. + WebRemoteFrameImpl* remote_frame = frame_test_helpers::CreateRemote(); + EXPECT_CALL(*mock_process_coordination_unit_, + OnRemoteIframeAttached(main_frame->GetLocalFrameToken(), + remote_frame->GetRemoteFrameToken(), + iframe_attribution_matcher)); + main_frame->FirstChild()->Swap(remote_frame); + mock_process_coordination_unit_->VerifyExpectations(); + + // Create another remote frame, this time with a remote parent. No + // notification should be received. + frame_test_helpers::CreateRemoteChild(*remote_frame); + mock_process_coordination_unit_->VerifyExpectations(); + + // Test frame swaps. Each one should send a detach notification for the + // current frame and an attach notification for the new frame. + + // Save the V8ContextToken reported in OnV8ContextCreated so it can be + // compared with the token in the matching OnV8ContextDetached. + blink::V8ContextToken current_v8_context_token; + + // Remote -> Remote + WebRemoteFrameImpl* new_remote_frame = frame_test_helpers::CreateRemote(); + { + InSequence seq; + EXPECT_CALL(*mock_process_coordination_unit_, + OnRemoteIframeDetached(main_frame->GetLocalFrameToken(), + remote_frame->GetRemoteFrameToken())); + EXPECT_CALL(*mock_process_coordination_unit_, + OnRemoteIframeAttached(main_frame->GetLocalFrameToken(), + new_remote_frame->GetRemoteFrameToken(), + iframe_attribution_matcher)); + } + main_frame->FirstChild()->Swap(new_remote_frame); + mock_process_coordination_unit_->VerifyExpectations(); + + // Remote -> Local + WebLocalFrameImpl* local_frame = helper.CreateProvisional(*new_remote_frame); + { + InSequence seq; + EXPECT_CALL( + *mock_process_coordination_unit_, + OnRemoteIframeDetached(main_frame->GetLocalFrameToken(), + new_remote_frame->GetRemoteFrameToken())); + EXPECT_CALL(*mock_process_coordination_unit_, + OnV8ContextCreated(MatchAndSaveV8ContextDescription( + local_frame->GetLocalFrameToken(), + ¤t_v8_context_token), + iframe_attribution_matcher)); + } + // Committing a navigation in the provisional frame swaps it in. + frame_test_helpers::LoadFrame(local_frame, "data:text/html,"); + mock_process_coordination_unit_->VerifyExpectations(); + + // Local -> Local + WebLocalFrameImpl* new_local_frame = helper.CreateProvisional(*local_frame); + { + InSequence seq; + EXPECT_CALL(*mock_process_coordination_unit_, + OnV8ContextDetached(current_v8_context_token)); + EXPECT_CALL(*mock_process_coordination_unit_, + OnV8ContextCreated(MatchAndSaveV8ContextDescription( + new_local_frame->GetLocalFrameToken(), + ¤t_v8_context_token), + iframe_attribution_matcher)); + } + // Committing a navigation in the provisional frame swaps it in. + frame_test_helpers::LoadFrame(new_local_frame, "data:text/html,"); + mock_process_coordination_unit_->VerifyExpectations(); + + // Local -> Remote + remote_frame = frame_test_helpers::CreateRemote(); + { + InSequence seq; + EXPECT_CALL(*mock_process_coordination_unit_, + OnV8ContextDetached(current_v8_context_token)); + EXPECT_CALL(*mock_process_coordination_unit_, + OnRemoteIframeAttached(main_frame->GetLocalFrameToken(), + remote_frame->GetRemoteFrameToken(), + iframe_attribution_matcher)); + } + main_frame->FirstChild()->Swap(remote_frame); + mock_process_coordination_unit_->VerifyExpectations(); +} + +TEST_F(RendererResourceCoordinatorImplTest, NonIframeNotifications) { + // Don't care about mocked methods except for OnRemoteIframeAttached. + InitializeMockProcessCoordinationUnit< + ::testing::NiceMock>(); + + frame_test_helpers::WebViewHelper helper; + helper.InitializeAndLoad("about:blank"); + + // Create an empty frame. + WebLocalFrameImpl* main_frame = helper.GetWebView()->MainFrameImpl(); + frame_test_helpers::LoadHTMLString( + main_frame, + "" + "", + url_test_helpers::ToKURL("https://example.com/subframe.html")); + + // Swap for a remote frame. Since this is not an iframe, there should be no + // notification. + WebRemoteFrameImpl* remote_frame = frame_test_helpers::CreateRemote(); + EXPECT_CALL(*mock_process_coordination_unit_, OnRemoteIframeAttached(_, _, _)) + .Times(0); + main_frame->FirstChild()->Swap(remote_frame); + mock_process_coordination_unit_->VerifyExpectations(); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/controller/performance_manager/v8_detailed_memory_reporter_impl.cc b/chromium/third_party/blink/renderer/controller/performance_manager/v8_detailed_memory_reporter_impl.cc index 28935fda495..da92fe51e65 100644 --- a/chromium/third_party/blink/renderer/controller/performance_manager/v8_detailed_memory_reporter_impl.cc +++ b/chromium/third_party/blink/renderer/controller/performance_manager/v8_detailed_memory_reporter_impl.cc @@ -19,6 +19,7 @@ #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" +#include "third_party/blink/renderer/platform/heap/thread_state.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "v8/include/v8.h" @@ -51,6 +52,7 @@ class FrameAssociatedMeasurementDelegate : public v8::MeasureMemoryDelegate { const std::vector, size_t>>& context_sizes_in_bytes, size_t unattributed_size_in_bytes) override { + DCHECK(IsMainThread()); mojom::blink::PerIsolateV8MemoryUsagePtr isolate_memory_usage = mojom::blink::PerIsolateV8MemoryUsage::New(); for (const auto& context_and_size : context_sizes_in_bytes) { @@ -63,8 +65,8 @@ class FrameAssociatedMeasurementDelegate : public v8::MeasureMemoryDelegate { // TODO(crbug.com/1080672): It would be prefereable to count the // V8SchemaRegistry context's overhead with unassociated_bytes, but at // present there isn't a public API that allows this distinction. - ++(isolate_memory_usage->num_unassociated_contexts); - isolate_memory_usage->unassociated_context_bytes_used += size; + ++(isolate_memory_usage->num_detached_contexts); + isolate_memory_usage->detached_bytes_used += size; continue; } if (DOMWrapperWorld::World(context).GetWorldId() != @@ -85,7 +87,7 @@ class FrameAssociatedMeasurementDelegate : public v8::MeasureMemoryDelegate { #endif isolate_memory_usage->contexts.push_back(std::move(context_memory_usage)); } - isolate_memory_usage->unassociated_bytes_used = unattributed_size_in_bytes; + isolate_memory_usage->shared_bytes_used = unattributed_size_in_bytes; std::move(callback_).Run(std::move(isolate_memory_usage)); } @@ -128,6 +130,7 @@ class V8ProcessMemoryReporter : public RefCounted { result_(mojom::blink::PerProcessV8MemoryUsage::New()) {} void StartMeasurements(V8DetailedMemoryReporterImpl::Mode mode) { + DCHECK(IsMainThread()); v8::Isolate* isolate = v8::Isolate::GetCurrent(); // 1. Start measurement of the main V8 isolate. if (!isolate) { @@ -136,7 +139,7 @@ class V8ProcessMemoryReporter : public RefCounted { MainMeasurementComplete(mojom::blink::PerIsolateV8MemoryUsage::New()); } else { auto delegate = std::make_unique( - WTF::Bind(&V8ProcessMemoryReporter::MainMeasurementComplete, + WTF::Bind(&V8ProcessMemoryReporter::MainV8MeasurementComplete, scoped_refptr(this))); isolate->MeasureMemory(std::move(delegate), @@ -150,6 +153,30 @@ class V8ProcessMemoryReporter : public RefCounted { } private: + void MainV8MeasurementComplete( + mojom::blink::PerIsolateV8MemoryUsagePtr isolate_memory_usage) { + // At this point measurement of the main V8 isolate is done and we + // can measure the corresponding Blink memory. Note that the order + // of the measurements is important because the V8 measurement does + // a GC and we want to get the Blink memory after the GC. + // This function and V8ProcessMemoryReporter::StartMeasurements both + // run on the main thread of the renderer. This means that the Blink + // heap given by ThreadState::Current() is attached to the main V8 + // isolate given by v8::Isolate::GetCurrent(). + ThreadState::Current()->CollectNodeAndCssStatistics( + WTF::Bind(&V8ProcessMemoryReporter::MainBlinkMeasurementComplete, + scoped_refptr(this), + std::move(isolate_memory_usage))); + } + + void MainBlinkMeasurementComplete( + mojom::blink::PerIsolateV8MemoryUsagePtr isolate_memory_usage, + size_t node_bytes, + size_t css_bytes) { + isolate_memory_usage->blink_bytes_used = node_bytes + css_bytes; + MainMeasurementComplete(std::move(isolate_memory_usage)); + } + void MainMeasurementComplete( mojom::blink::PerIsolateV8MemoryUsagePtr isolate_memory_usage) { result_->isolates.push_back(std::move(isolate_memory_usage)); @@ -163,6 +190,9 @@ class V8ProcessMemoryReporter : public RefCounted { auto context_memory_usage = mojom::blink::PerContextV8MemoryUsage::New(); context_memory_usage->token = ToExecutionContextToken(worker.token); context_memory_usage->bytes_used = worker.bytes; + if (!worker.url.IsNull()) { + context_memory_usage->url = worker.url.GetString(); + } worker_memory_usage->contexts.push_back(std::move(context_memory_usage)); result_->isolates.push_back(std::move(worker_memory_usage)); } diff --git a/chromium/third_party/blink/renderer/controller/performance_manager/v8_detailed_memory_reporter_impl_test.cc b/chromium/third_party/blink/renderer/controller/performance_manager/v8_detailed_memory_reporter_impl_test.cc index 089baf0ccac..f075c9ea5c2 100644 --- a/chromium/third_party/blink/renderer/controller/performance_manager/v8_detailed_memory_reporter_impl_test.cc +++ b/chromium/third_party/blink/renderer/controller/performance_manager/v8_detailed_memory_reporter_impl_test.cc @@ -39,6 +39,11 @@ class MemoryUsageChecker { // only check the lower bound. EXPECT_LE(1000000u, entry->bytes_used); ++actual_context_count; + if (entry->token.Is()) { + EXPECT_EQ(String("http://fake.url/"), entry->url); + } else { + EXPECT_FALSE(entry->url); + } } } EXPECT_EQ(expected_context_count_, actual_context_count); diff --git a/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter.cc b/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter.cc index c363490451e..b9bf705966f 100644 --- a/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter.cc +++ b/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter.cc @@ -9,7 +9,6 @@ #include "base/check.h" #include "base/time/time.h" -#include "third_party/blink/renderer/bindings/core/v8/v8_measure_memory_breakdown.h" #include "third_party/blink/renderer/core/timing/measure_memory/measure_memory_controller.h" #include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h" @@ -40,6 +39,14 @@ const base::TimeDelta V8WorkerMemoryReporter::kTimeout = base::TimeDelta::FromSeconds(60); namespace { + +// TODO(906991): Remove this once PlzDedicatedWorker ships. Until then +// the browser does not know URLs of dedicated workers, so we pass them +// together with the measurement result. We limit the max length of the +// URLs to reduce memory allocations and the traffic between the renderer +// and the browser processes. +constexpr size_t kMaxReportedUrlLength = 2000; + // This delegate is provided to v8::Isolate::MeasureMemory API. // V8 calls MeasurementComplete with the measurement result. // @@ -65,7 +72,7 @@ class WorkerMeasurementDelegate : public v8::MeasureMemoryDelegate { private: void NotifyMeasurementSuccess( - V8WorkerMemoryReporter::WorkerMemoryUsage memory_usage); + std::unique_ptr memory_usage); void NotifyMeasurementFailure(); base::WeakPtr worker_memory_reporter_; WorkerThread* worker_thread_; @@ -92,8 +99,17 @@ void WorkerMeasurementDelegate::MeasurementComplete( for (auto& context_size : context_sizes) { bytes += context_size.second; } - NotifyMeasurementSuccess(V8WorkerMemoryReporter::WorkerMemoryUsage{ - To(global_scope)->GetWorkerToken(), bytes}); + auto* worker_global_scope = To(global_scope); + auto memory_usage = + std::make_unique(); + memory_usage->token = worker_global_scope->GetWorkerToken(); + memory_usage->bytes = bytes; + if (worker_global_scope->IsUrlValid() && + worker_global_scope->Url().GetString().length() < kMaxReportedUrlLength) { + // Copy the URL to send it over to the main thread. + memory_usage->url = worker_global_scope->Url().Copy(); + } + NotifyMeasurementSuccess(std::move(memory_usage)); } void WorkerMeasurementDelegate::NotifyMeasurementFailure() { @@ -105,11 +121,11 @@ void WorkerMeasurementDelegate::NotifyMeasurementFailure() { } void WorkerMeasurementDelegate::NotifyMeasurementSuccess( - V8WorkerMemoryReporter::WorkerMemoryUsage memory_usage) { + std::unique_ptr memory_usage) { DCHECK(worker_thread_->IsCurrentThread()); DCHECK(!did_notify_); V8WorkerMemoryReporter::NotifyMeasurementSuccess( - worker_thread_, worker_memory_reporter_, memory_usage); + worker_thread_, worker_memory_reporter_, std::move(memory_usage)); did_notify_ = true; } @@ -170,12 +186,12 @@ void V8WorkerMemoryReporter::StartMeasurement( void V8WorkerMemoryReporter::NotifyMeasurementSuccess( WorkerThread* worker_thread, base::WeakPtr worker_memory_reporter, - WorkerMemoryUsage memory_usage) { + std::unique_ptr memory_usage) { DCHECK(worker_thread->IsCurrentThread()); PostCrossThreadTask( *Thread::MainThread()->GetTaskRunner(), FROM_HERE, CrossThreadBindOnce(&V8WorkerMemoryReporter::OnMeasurementSuccess, - worker_memory_reporter, memory_usage)); + worker_memory_reporter, std::move(memory_usage))); } // static @@ -201,11 +217,11 @@ void V8WorkerMemoryReporter::OnMeasurementFailure() { } void V8WorkerMemoryReporter::OnMeasurementSuccess( - WorkerMemoryUsage memory_usage) { + std::unique_ptr memory_usage) { DCHECK(IsMainThread()); if (state_ == State::kDone) return; - result_.workers.emplace_back(memory_usage); + result_.workers.emplace_back(*memory_usage); ++success_count_; if (success_count_ + failure_count_ == worker_count_) { InvokeCallback(); @@ -234,50 +250,4 @@ void V8WorkerMemoryReporter::InvokeCallback() { state_ = State::kDone; } -namespace { - -// Used by the performance.measureMemory Web API. It forwards the incoming -// memory measurement request to V8WorkerMemoryReporter and adapts the result -// to match the format of the Web API. -// -// It will be removed in the future when performance.measureMemory switches -// to a mojo-based implementation that queries PerformanceManager in the -// browser process. -class WebMemoryReporter : public MeasureMemoryController::V8MemoryReporter { - void GetMemoryUsage(MeasureMemoryController::ResultCallback callback, - v8::MeasureMemoryExecution execution) override { - V8WorkerMemoryReporter::GetMemoryUsage( - WTF::Bind(&WebMemoryReporter::ForwardResults, std::move(callback)), - execution); - } - - // Adapts the result to match the format expected by MeasureMemoryController. - static void ForwardResults(MeasureMemoryController::ResultCallback callback, - const V8WorkerMemoryReporter::Result& result) { - HeapVector> new_result; - const String kDedicatedWorkerGlobalScope("DedicatedWorkerGlobalScope"); - const String kJS("JS"); - const Vector kWorkerMemoryTypes = {kDedicatedWorkerGlobalScope, - kJS}; - const Vector kEmptyAttribution = {}; - for (const auto& worker : result.workers) { - if (worker.token.Is()) { - MeasureMemoryBreakdown* entry = MeasureMemoryBreakdown::Create(); - entry->setBytes(worker.bytes); - entry->setUserAgentSpecificTypes(kWorkerMemoryTypes); - entry->setAttribution(kEmptyAttribution); - new_result.push_back(entry); - } - } - std::move(callback).Run(new_result); - } -}; - -} // anonymous namespace - -void V8WorkerMemoryReporter::RegisterWebMemoryReporter() { - MeasureMemoryController::SetDedicatedWorkerMemoryReporter( - new WebMemoryReporter()); -} - } // namespace blink diff --git a/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter.h b/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter.h index e60db41b63d..484b3314c85 100644 --- a/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter.h +++ b/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter.h @@ -11,6 +11,7 @@ #include "base/time/time.h" #include "third_party/blink/public/common/tokens/tokens.h" #include "third_party/blink/renderer/controller/controller_export.h" +#include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "v8/include/v8.h" @@ -40,6 +41,12 @@ class CONTROLLER_EXPORT V8WorkerMemoryReporter { struct WorkerMemoryUsage { WorkerToken token; size_t bytes; + // TODO(906991): Remove this once PlzDedicatedWorker ships. Until then + // the browser does not know URLs of dedicated workers, so we pass them + // together with the measurement result. + // URLs longer than kMaxReportedUrlLength are skipped. In such a case + // url.IsNull() returns true. + KURL url; }; struct Result { @@ -54,15 +61,13 @@ class CONTROLLER_EXPORT V8WorkerMemoryReporter { v8::MeasureMemoryExecution mode); // These functions are called by WorkerMeasurementDelegate on a worker thread. - static void NotifyMeasurementSuccess(WorkerThread*, - base::WeakPtr, - WorkerMemoryUsage memory_usage); + static void NotifyMeasurementSuccess( + WorkerThread*, + base::WeakPtr, + std::unique_ptr memory_usage); static void NotifyMeasurementFailure(WorkerThread*, base::WeakPtr); - // Injects the implementation for the performance.measureMemory Web API. - static void RegisterWebMemoryReporter(); - private: // The initial state is kWaiting. // Transition from kWaiting to kDone happens on two events: @@ -86,7 +91,7 @@ class CONTROLLER_EXPORT V8WorkerMemoryReporter { // Functions that run on the main thread. void OnTimeout(); void OnMeasurementFailure(); - void OnMeasurementSuccess(WorkerMemoryUsage memory_usage); + void OnMeasurementSuccess(std::unique_ptr memory_usage); void InvokeCallback(); base::WeakPtr GetWeakPtr() { return weak_factory_.GetWeakPtr(); diff --git a/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter_test.cc b/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter_test.cc index 8bf9115b080..100d2eebb28 100644 --- a/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter_test.cc +++ b/chromium/third_party/blink/renderer/controller/performance_manager/v8_worker_memory_reporter_test.cc @@ -68,6 +68,7 @@ class MemoryUsageChecker { EXPECT_THAT(expected_counts, testing::Contains(worker_count_)); if (worker_count_ == 1) { EXPECT_LE(bytes_per_worker_lower_bound_, result.workers[0].bytes); + EXPECT_EQ(KURL("http://fake.url/"), result.workers[0].url); } called_ = true; if (callback_action_ == CallbackAction::kExitRunLoop) { @@ -98,7 +99,7 @@ TEST_F(V8WorkerMemoryReporterTest, OnMeasurementSuccess) { EXPECT_CALL(mock_callback, Callback(result)).Times(1); for (auto& worker : result.workers) { - reporter.OnMeasurementSuccess(worker); + reporter.OnMeasurementSuccess(std::make_unique(worker)); } } @@ -112,9 +113,11 @@ TEST_F(V8WorkerMemoryReporterTest, OnMeasurementFailure) { WorkerMemoryUsage{WorkerToken(DedicatedWorkerToken()), 2}})}; EXPECT_CALL(mock_callback, Callback(result)).Times(1); - reporter.OnMeasurementSuccess(result.workers[0]); + reporter.OnMeasurementSuccess( + std::make_unique(result.workers[0])); reporter.OnMeasurementFailure(); - reporter.OnMeasurementSuccess(result.workers[1]); + reporter.OnMeasurementSuccess( + std::make_unique(result.workers[1])); } TEST_F(V8WorkerMemoryReporterTest, OnTimeout) { @@ -128,11 +131,13 @@ TEST_F(V8WorkerMemoryReporterTest, OnTimeout) { EXPECT_CALL(mock_callback, Callback(result)).Times(1); - reporter.OnMeasurementSuccess(result.workers[0]); - reporter.OnMeasurementSuccess(result.workers[1]); - reporter.OnTimeout(); reporter.OnMeasurementSuccess( - WorkerMemoryUsage{WorkerToken(SharedWorkerToken()), 2}); + std::make_unique(result.workers[0])); + reporter.OnMeasurementSuccess( + std::make_unique(result.workers[1])); + reporter.OnTimeout(); + reporter.OnMeasurementSuccess(std::make_unique( + WorkerMemoryUsage{WorkerToken(SharedWorkerToken()), 2})); reporter.OnMeasurementFailure(); } @@ -146,8 +151,10 @@ TEST_F(V8WorkerMemoryReporterTest, OnTimeoutNoop) { WorkerMemoryUsage{WorkerToken(DedicatedWorkerToken()), 2}})}; EXPECT_CALL(mock_callback, Callback(result)).Times(1); - reporter.OnMeasurementSuccess(result.workers[0]); - reporter.OnMeasurementSuccess(result.workers[1]); + reporter.OnMeasurementSuccess( + std::make_unique(result.workers[0])); + reporter.OnMeasurementSuccess( + std::make_unique(result.workers[1])); reporter.OnTimeout(); } diff --git a/chromium/third_party/blink/renderer/core/BUILD.gn b/chromium/third_party/blink/renderer/core/BUILD.gn index 991cd09342e..fef22a645f6 100644 --- a/chromium/third_party/blink/renderer/core/BUILD.gn +++ b/chromium/third_party/blink/renderer/core/BUILD.gn @@ -24,6 +24,7 @@ import("//third_party/blink/renderer/core/context_features/build.gni") import("//third_party/blink/renderer/core/core.gni") import("//third_party/blink/renderer/core/css/build.gni") import("//third_party/blink/renderer/core/display_lock/build.gni") +import("//third_party/blink/renderer/core/document_transition/build.gni") import("//third_party/blink/renderer/core/dom/build.gni") import("//third_party/blink/renderer/core/editing/build.gni") import("//third_party/blink/renderer/core/events/build.gni") @@ -193,6 +194,9 @@ component("core") { rebase_path(blink_core_sources_context_features, "", "context_features") sources += rebase_path(blink_core_sources_css, "", "css") sources += rebase_path(blink_core_sources_display_lock, "", "display_lock") + sources += rebase_path(blink_core_sources_document_transition, + "", + "document_transition") sources += rebase_path(blink_core_sources_dom, "", "dom") sources += rebase_path(blink_core_sources_editing, "", "editing") sources += rebase_path(blink_core_sources_events, "", "events") @@ -255,14 +259,21 @@ component("core") { "//third_party/blink/renderer/core/exported", "//third_party/blink/renderer/core/probe", "//third_party/blink/renderer/core/typed_arrays", + "//third_party/blink/renderer/core/xml:xpath_generated", "//third_party/blink/renderer/platform", + "//third_party/blink/renderer/platform/wtf", + "//ui/accessibility:ax_base", "//ui/base/cursor:cursor_base", + "//ui/base/dragdrop/mojom:mojom_blink_headers", + "//ui/base/dragdrop/mojom:mojom_shared", "//url", "//v8", ] + deps = [ "//build:chromeos_buildflags", "//components/paint_preview/common", + "//components/performance_manager/public/mojom:mojom_blink", "//components/shared_highlighting/core/common", "//gpu/config", "//mojo/public/cpp/bindings:bindings", @@ -274,16 +285,13 @@ component("core") { "//services/service_manager/public/cpp", "//skia", "//skia:skcms", + "//storage/common", "//third_party/blink/public:buildflags", "//third_party/blink/public:image_resources_grit", "//third_party/blink/public:resources", "//third_party/blink/public/common", "//third_party/blink/public/strings", "//third_party/blink/renderer/core/typed_arrays:typed_arrays", - "//third_party/blink/renderer/core/xml:xpath_generated", - "//third_party/blink/renderer/platform", - "//third_party/blink/renderer/platform/wtf", - "//ui/accessibility:ax_base", "//ui/base/cursor:cursor_base", "//ui/base/cursor/mojom:cursor_type_blink", "//ui/base/dragdrop/mojom:mojom_blink", @@ -400,8 +408,11 @@ source_set("testing") { "testing/internal_settings.h", "testing/internals.cc", "testing/internals.h", + "testing/intersection_observer_test_helper.h", "testing/mock_clipboard_host.cc", "testing/mock_clipboard_host.h", + "testing/mock_function_scope.cc", + "testing/mock_function_scope.h", "testing/mock_hyphenation.cc", "testing/mock_hyphenation.h", "testing/mock_policy_container_host.cc", @@ -413,6 +424,8 @@ source_set("testing") { "testing/origin_trials_test_partial.h", "testing/record_test.cc", "testing/record_test.h", + "testing/scoped_fake_ukm_recorder.cc", + "testing/scoped_fake_ukm_recorder.h", "testing/scoped_mock_overlay_scrollbars.h", "testing/sequence_test.cc", "testing/sequence_test.h", @@ -923,22 +936,16 @@ blink_python_runner("make_core_generated_css_tokenizer_codepoints") { blink_python_runner("make_core_generated_css_primitive_value_unit_trie") { visibility = [] # Allow re-assignment of list. visibility = [ ":*" ] - - # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. - script = "//build/util/python2_action.py" + script = "../build/scripts/core/css/make_css_primitive_value_unit_trie.py" input_file = "css/css_primitive_value_units.json5" inputs = make_trie_helpers_files + [ input_file, - "../build/scripts/core/css/make_css_primitive_value_unit_trie.py", "../build/scripts/core/css/templates/css_primitive_value_unit_trie.cc.tmpl", ] outputs = [ "$blink_core_output_dir/css/css_primitive_value_unit_trie.cc" ] args = [ - rebase_path( - "../build/scripts/core/css/make_css_primitive_value_unit_trie.py", - root_build_dir), rebase_path(input_file, root_build_dir), "--output_dir", "$rel_blink_core_gen_dir/css", @@ -1186,45 +1193,17 @@ source_set("unit_tests") { "css/mock_css_paint_image_generator.h", "display_lock/display_lock_context_test.cc", "display_lock/display_lock_utilities_test.cc", - "dom/attr_test.cc", - "dom/document_statistics_collector_test.cc", - "dom/document_test.cc", - "dom/dom_node_ids_test.cc", - "dom/element_test.cc", - "dom/events/event_path_test.cc", - "dom/events/event_target_test.cc", - "dom/events/listener_leak_test.cc", - "dom/first_letter_pseudo_element_test.cc", - "dom/flat_tree_traversal_test.cc", - "dom/idle_deadline_test.cc", - "dom/layout_tree_builder_traversal_test.cc", - "dom/live_node_list_registry_test.cc", - "dom/mutation_observer_test.cc", - "dom/names_map_test.cc", - "dom/node_test.cc", - "dom/nth_index_cache_test.cc", - "dom/range_test.cc", - "dom/scripted_animation_controller_test.cc", - "dom/scripted_idle_task_controller_test.cc", - "dom/shadow_dom_v0_test.cc", - "dom/slot_assignment_test.cc", - "dom/space_split_string_test.cc", - "dom/static_range_test.cc", - "dom/text_test.cc", - "dom/tree_scope_adopter_test.cc", - "dom/tree_scope_test.cc", - "dom/weak_identifier_map_test.cc", - "dom/whitespace_attacher_test.cc", + "document_transition/document_transition_test.cc", "editing/caret_display_item_client_test.cc", "editing/finder/text_finder_test.cc", "editing/keyboard_test.cc", "editing/link_selection_test.cc", "events/message_event_test.cc", + "events/mouse_event_test.cc", "events/pointer_event_factory_test.cc", "events/pointer_event_util_test.cc", "events/touch_event_test.cc", "events/web_input_event_conversion_test.cc", - "execution_context/agent_metrics_collector_test.cc", "execution_context/execution_context_lifecycle_state_observer_test.cc", "exported/web_document_subresource_filter_test.cc", "exported/web_document_test.cc", @@ -1245,6 +1224,8 @@ source_set("unit_tests") { "exported/web_selector_test.cc", "exported/web_view_test.cc", "feature_policy/document_policy_parser_test.cc", + "feature_policy/document_policy_sim_test.cc", + "feature_policy/feature_policy_devtools_support_test.cc", "feature_policy/feature_policy_test.cc", "feature_policy/policy_test.cc", "fetch/blob_bytes_consumer_test.cc", @@ -1266,17 +1247,18 @@ source_set("unit_tests") { "frame/ad_tracker_test.cc", "frame/browser_controls_test.cc", "frame/csp/content_security_policy_test.cc", + "frame/csp/conversion_util_test.cc", "frame/csp/csp_directive_list_test.cc", "frame/csp/csp_source_test.cc", - "frame/csp/media_list_directive_test.cc", "frame/csp/require_trusted_types_for_directive_test.cc", "frame/csp/source_list_directive_test.cc", - "frame/csp/string_list_directive_test.cc", + "frame/csp/trusted_types_directive_test.cc", "frame/deprecation_report_body_test.cc", "frame/document_loading_rendering_test.cc", "frame/document_policy_violation_report_body_test.cc", "frame/dom_timer_test.cc", "frame/find_in_page_test.cc", + "frame/frame_content_as_text_test.cc", "frame/frame_overlay_test.cc", "frame/frame_serializer_test.cc", "frame/frame_test.cc", @@ -1311,8 +1293,10 @@ source_set("unit_tests") { "input/scroll_snap_test.cc", "input/touch_action_test.cc", "input/touch_event_manager_test.cc", + "inspector/inspector_contrast_test.cc", "inspector/inspector_emulation_agent_test.cc", "inspector/inspector_history_test.cc", + "inspector/inspector_media_context_impl_unittest.cc", "inspector/inspector_session_state_test.cc", "inspector/inspector_style_resolver_test.cc", "inspector/main_thread_debugger_test.cc", @@ -1322,6 +1306,7 @@ source_set("unit_tests") { "layout/api/selection_state_test.cc", "layout/collapsed_border_value_test.cc", "layout/force_legacy_layout_test.cc", + "layout/geometry/axis_test.cc", "layout/geometry/logical_rect_test.cc", "layout/geometry/physical_rect_test.cc", "layout/geometry/physical_size_test.cc", @@ -1337,6 +1322,7 @@ source_set("unit_tests") { "layout/layout_grid_test.cc", "layout/layout_image_test.cc", "layout/layout_inline_test.cc", + "layout/layout_list_marker_test.cc", "layout/layout_media_test.cc", "layout/layout_multi_column_flow_thread_test.cc", "layout/layout_object_test.cc", @@ -1359,6 +1345,7 @@ source_set("unit_tests") { "layout/line/abstract_inline_text_box_test.cc", "layout/line/inline_text_box_test.cc", "layout/line/line_orientation_utils_test.cc", + "layout/list_marker_test.cc", "layout/map_coordinates_test.cc", "layout/min_max_size_test.cc", "layout/multi_column_fragmentainer_group_test.cc", @@ -1376,14 +1363,12 @@ source_set("unit_tests") { "layout/ng/inline/ng_fragment_items_builder_test.cc", "layout/ng/inline/ng_fragment_items_test.cc", "layout/ng/inline/ng_inline_cursor_test.cc", - "layout/ng/inline/ng_inline_fragment_traversal_test.cc", "layout/ng/inline/ng_inline_items_builder_test.cc", "layout/ng/inline/ng_inline_layout_algorithm_test.cc", "layout/ng/inline/ng_inline_node_test.cc", "layout/ng/inline/ng_line_breaker_test.cc", "layout/ng/inline/ng_offset_mapping_test.cc", "layout/ng/inline/ng_physical_line_box_fragment_test.cc", - "layout/ng/inline/ng_physical_text_fragment_test.cc", "layout/ng/list/layout_ng_list_item_test.cc", "layout/ng/ng_absolute_utils_test.cc", "layout/ng/ng_base_layout_algorithm_test.cc", @@ -1404,7 +1389,9 @@ source_set("unit_tests") { "layout/ng/ng_length_utils_test.cc", "layout/ng/ng_out_of_flow_layout_part_test.cc", "layout/ng/ng_physical_box_fragment_test.cc", + "layout/ng/ng_physical_fragment_test.cc", "layout/ng/ng_relative_utils_test.cc", + "layout/ng/table/ng_table_layout_algorithm_helpers_test.cc", "layout/overflow_model_test.cc", "layout/paint_containment_test.cc", "layout/scroll_anchor_test.cc", @@ -1438,7 +1425,6 @@ source_set("unit_tests") { "loader/navigation_policy_test.cc", "loader/ping_loader_test.cc", "loader/prerender_test.cc", - "loader/previews_resource_loading_hints_test.cc", "loader/programmatic_scroll_test.cc", "loader/progress_tracker_test.cc", "loader/resource/css_style_sheet_resource_test.cc", @@ -1449,6 +1435,7 @@ source_set("unit_tests") { "loader/resource/mock_image_resource_observer.cc", "loader/resource/mock_image_resource_observer.h", "loader/resource/multipart_image_resource_parser_test.cc", + "loader/resource/script_resource_test.cc", "loader/resource_load_observer_for_frame_test.cc", "loader/threadable_loader_test.cc", "loader/threaded_icon_loader_test.cc", @@ -1479,6 +1466,7 @@ source_set("unit_tests") { "page/scrolling/snap_coordinator_test.cc", "page/scrolling/text_fragment_anchor_metrics_test.cc", "page/scrolling/text_fragment_anchor_test.cc", + "page/scrolling/text_fragment_finder_test.cc", "page/scrolling/text_fragment_selector_generator_test.cc", "page/scrolling/text_fragment_selector_test.cc", "page/slot_scoped_traversal_test.cc", @@ -1511,8 +1499,6 @@ source_set("unit_tests") { "paint/largest_contentful_paint_calculator_test.cc", "paint/link_highlight_impl_test.cc", "paint/ng/ng_box_fragment_painter_test.cc", - "paint/ng/ng_paint_fragment_test.cc", - "paint/ng/ng_paint_fragment_traversal_test.cc", "paint/ng/ng_text_fragment_painter_test.cc", "paint/nine_piece_image_grid_test.cc", "paint/object_paint_invalidator_test.cc", @@ -1564,10 +1550,10 @@ source_set("unit_tests") { "svg/animation/smil_time_container_test.cc", "svg/animation/svg_smil_element_test.cc", "svg/graphics/svg_image_test.cc", - "svg/svg_external_document_cache_test.cc", "svg/svg_foreign_object_element_test.cc", "svg/svg_path_parser_test.cc", "svg/svg_path_query_test.cc", + "svg/svg_resource_document_content_test.cc", "svg/svg_text_content_element_test.cc", "svg/svg_use_element_test.cc", "svg/unsafe_svg_attribute_sanitization_test.cc", @@ -1595,13 +1581,14 @@ source_set("unit_tests") { "xml/xpath_functions_test.cc", ] - # If you create a new subdirectory 'foo' that contains unit tets, list them in + # If you create a new subdirectory 'foo' that contains unit tests, list them in # 'foo/build.gni' to define blink_core_tests_foo, and add any dependencies in # the deps section below. sources += rebase_path(blink_core_tests_accessibility, "", "accessibility") sources += rebase_path(blink_core_tests_animation, "", "animation") sources += rebase_path(blink_core_tests_clipboard, "", "clipboard") sources += rebase_path(blink_core_tests_css, "", "css") + sources += rebase_path(blink_core_tests_dom, "", "dom") sources += rebase_path(blink_core_tests_editing, "", "editing") sources += rebase_path(blink_core_tests_fileapi, "", "fileapi") sources += rebase_path(blink_core_tests_html, "", "html") @@ -1643,16 +1630,11 @@ source_set("unit_tests") { "//ui/accessibility:ax_base", "//ui/base/cursor:cursor_base", "//ui/base/cursor/mojom:cursor_type_blink", + "//ui/base/dragdrop/mojom:mojom_blink", ] data_deps = [ ":unit_tests_data" ] - # FIXME: Enable mojo unittests on Android after fixing data dependency. - # crbug.com/741925 - if (!is_android) { - deps += [ "//third_party/blink/renderer/core/mojo:unit_tests" ] - } - if (!is_mac) { sources += [ "scroll/scroll_animator_test.cc", @@ -1691,7 +1673,10 @@ group("js_files_for_form_controls_web_tests") { source_set("perf_tests") { testonly = true - sources = [ "layout/visual_rect_mapping_perftest.cc" ] + sources = [ + "layout/svg/svg_hit_test_perftest.cc", + "layout/visual_rect_mapping_perftest.cc", + ] configs += [ ":blink_core_pch", @@ -1716,6 +1701,7 @@ source_set("unit_test_support") { "frame/frame_test_helpers.h", "html/media/html_media_test_helper.cc", "html/media/html_media_test_helper.h", + "mobile_metrics/mobile_metrics_test_helpers.h", "script/mock_script_element_base.h", "testing/core_unit_test_helper.cc", "testing/core_unit_test_helper.h", @@ -1739,6 +1725,8 @@ source_set("unit_test_support") { "testing/sim/sim_request.h", "testing/sim/sim_test.cc", "testing/sim/sim_test.h", + "testing/sim/sim_web_frame_widget.cc", + "testing/sim/sim_web_frame_widget.h", "workers/worker_thread_test_helper.h", ] @@ -1806,6 +1794,17 @@ fuzzer_test("content_security_policy_fuzzer") { seed_corpus = "//testing/libfuzzer/fuzzers/content_security_policy_corpus" } +fuzzer_test("content_security_policy_conversion_util_fuzzer") { + sources = [ "frame/csp/conversion_util_fuzzer.cc" ] + deps = [ + ":core", + "//third_party/blink/renderer/core:testing", + "//third_party/blink/renderer/platform:blink_fuzzer_test_support", + ] + dict = "//testing/libfuzzer/fuzzers/dicts/content_security_policy.dict" + seed_corpus = "//testing/libfuzzer/fuzzers/content_security_policy_corpus" +} + fuzzer_test("css_parser_proto_fuzzer") { sources = [ "css/parser/css_parser_proto_fuzzer.cc", diff --git a/chromium/third_party/blink/renderer/core/DEPS b/chromium/third_party/blink/renderer/core/DEPS index c1d86ea88d1..c1ed3d8ea87 100644 --- a/chromium/third_party/blink/renderer/core/DEPS +++ b/chromium/third_party/blink/renderer/core/DEPS @@ -4,6 +4,7 @@ include_rules = [ "+base/bits.h", "+base/cancelable_callback.h", "+base/files/file.h", + "+base/i18n/uchar.h", "+base/mac/foundation_util.h", "+base/mac/mac_util.h", "+base/mac/scoped_cftyperef.h", @@ -23,7 +24,7 @@ include_rules = [ "+base/unguessable_token.h", "+build/mac", "+build/win", - "+cc/animation/animation_curve.h", + "+ui/gfx/animation/keyframe/animation_curve.h", "+cc/animation/animation_host.h", "+cc/animation/scroll_offset_animations.h", "+cc/animation/scroll_offset_animation_curve.h", @@ -76,6 +77,7 @@ include_rules = [ "+services/network/public/cpp/cors/cors_error_status.h", "+services/network/public/cpp/features.h", "+services/network/public/cpp/ip_address_space_util.h", + "+services/network/public/cpp/is_potentially_trustworthy.h", "+services/network/public/cpp/request_destination.h", "+services/network/public/cpp/request_mode.h", "+services/network/public/cpp/web_sandbox_flags.h", @@ -85,6 +87,7 @@ include_rules = [ "+skia/public/mojom", "+skia/ext/image_operations.h", "+skia/ext/legacy_display_globals.h", + "+skia/ext/skia_utils_base.h", "+skia/ext/skia_utils_mac.h", "+third_party/blink/public/common", "+third_party/blink/public/mojom", @@ -126,6 +129,7 @@ include_rules = [ specific_include_rules = { # Additional allowed includes for tests. ".*_test(_.*)?\.(cc|h|mm)" : [ + "+base/timer/lap_timer.h", "+base/message_loop/message_loop.h", "+base/test/test_mock_time_task_runner.h", # Test harness may use cc directly instead of going through WebViewImpl etc. @@ -136,6 +140,7 @@ specific_include_rules = { # that the Web abstraction can go away. "+content/renderer/compositor", "+content/test", + "+testing/perf/perf_result_reporter.h", "+third_party/blink/renderer/core/frame/web_local_frame_impl.h", "+third_party/blink/renderer/core/frame/web_remote_frame_impl.h", "+gin", @@ -143,6 +148,7 @@ specific_include_rules = { ], "data_object_item.cc" : [ "+ui/gfx/codec" ], "chrome_client.h" : [ + "+components/viz/common/delegated_ink_metadata.h", "+components/viz/common/surfaces/frame_sink_id.h", ], "clipboard_utilities.cc" : [ "+net/base/escape.h" ], @@ -152,10 +158,6 @@ specific_include_rules = { "find_task_controller.cc" : [ "+third_party/blink/renderer/core/frame/web_local_frame_impl.h", ], - # TODO(darin): Remove once onion-souping is complete for prerendering. - "prerenderer_client.cc" : [ - "+third_party/blink/renderer/core/frame/web_local_frame_impl.h", - ], "html_media_element_test.cc": [ "+base/test/gtest_util.h", ], diff --git a/chromium/third_party/blink/renderer/core/DIR_METADATA b/chromium/third_party/blink/renderer/core/DIR_METADATA new file mode 100644 index 00000000000..fca4a1fc814 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink" +} + +team_email: "blink-dev@chromium.org" diff --git a/chromium/third_party/blink/renderer/core/OWNERS b/chromium/third_party/blink/renderer/core/OWNERS index b3dab08db5b..393b9d2952c 100644 --- a/chromium/third_party/blink/renderer/core/OWNERS +++ b/chromium/third_party/blink/renderer/core/OWNERS @@ -1,6 +1,11 @@ # Please prefer to use more specific OWNERS if possible. # For example, core/rendering/OWNERS for rendering changes. +# New owners should be proposed by email to blink-core-owners-discuss@chromium.org, +# similar to the committer nomination process. +# Once accepted, new owners should also be added to blink-core-owners-discuss@chromium.org. +# https://groups.google.com/a/chromium.org/g/blink-core-owners-discuss + # Reviewers (comments indicate areas of expertise): alexis.menard@intel.com # bokan reviews changes around viewport behavior, scrolling, cc/blink interaction, co-ordinate spaces and input events @@ -9,13 +14,13 @@ cbiesinger@chromium.org chrishtr@chromium.org clamy@chromium.org dcheng@chromium.org -# dtapuska reviews input-related changes -dtapuska@chromium.org dgozman@chromium.org # drott reviews font specific changes. drott@chromium.org dsinclair@chromium.org dstockwell@chromium.org +# dtapuska reviews input-related changes +dtapuska@chromium.org enne@chromium.org # flackr reviews animation- and scrolling-related changes. flackr@chromium.org @@ -25,12 +30,14 @@ foolip@chromium.org fs@opera.com fserb@chromium.org futhark@chromium.org +fwang@igalia.com haraken@chromium.org hayato@chromium.org hiroshige@chromium.org ikilpatrick@chromium.org inferno@chromium.org japhet@chromium.org +jarhar@chromium.org jbroman@chromium.org jfernandez@igalia.com jianli@chromium.org @@ -44,9 +51,6 @@ kouhei@chromium.org masonfreed@chromium.org mkwst@chromium.org mstensho@chromium.org -# nainar reviews changes in core/css,core/style -# and related code in core/dom and core/layout. -nainar@chromium.org nhiroki@chromium.org obrufau@igalia.com # pdr reviews many svg and text autosizing patches. @@ -65,13 +69,9 @@ szager@chromium.org thakis@chromium.org timloh@chromium.org tkent@chromium.org -tonyg@chromium.org vmpstr@chromium.org vollick@chromium.org wangxianzhu@chromium.org yhirano@chromium.org yoavweiss@chromium.org yutak@chromium.org - -# TEAM: blink-dev@chromium.org -# COMPONENT: Blink diff --git a/chromium/third_party/blink/renderer/core/accessibility/DIR_METADATA b/chromium/third_party/blink/renderer/core/accessibility/DIR_METADATA new file mode 100644 index 00000000000..7a89266091b --- /dev/null +++ b/chromium/third_party/blink/renderer/core/accessibility/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink>Accessibility" +} + +team_email: "chromium-accessibility@chromium.org" diff --git a/chromium/third_party/blink/renderer/core/accessibility/OWNERS b/chromium/third_party/blink/renderer/core/accessibility/OWNERS index 5eed66eb588..4e6cc130180 100644 --- a/chromium/third_party/blink/renderer/core/accessibility/OWNERS +++ b/chromium/third_party/blink/renderer/core/accessibility/OWNERS @@ -1,4 +1 @@ file://third_party/blink/renderer/modules/accessibility/OWNERS - -# TEAM: chromium-accessibility@chromium.org -# COMPONENT: Blink>Accessibility diff --git a/chromium/third_party/blink/renderer/core/accessibility/ax_object_cache.h b/chromium/third_party/blink/renderer/core/accessibility/ax_object_cache.h index f3e09384d83..c67098b16b4 100644 --- a/chromium/third_party/blink/renderer/core/accessibility/ax_object_cache.h +++ b/chromium/third_party/blink/renderer/core/accessibility/ax_object_cache.h @@ -45,7 +45,6 @@ class HTMLFrameOwnerElement; class HTMLSelectElement; class IntPoint; class LayoutRect; -class LineLayoutItem; class LocalFrameView; class CORE_EXPORT AXObjectCache : public GarbageCollected { @@ -63,6 +62,12 @@ class CORE_EXPORT AXObjectCache : public GarbageCollected { virtual void Dispose() = 0; + // A Freeze() occurs during a serialization run. + // Used here as a hint for DCHECKS to enforce the following behavior: + // objects in the ax hierarchy should not be destroyed during serialization. + virtual void Freeze() = 0; + virtual void Thaw() = 0; + // Register/remove popups virtual void InitializePopup(Document* document) = 0; virtual void DisposePopup(Document* document) = 0; @@ -76,7 +81,6 @@ class CORE_EXPORT AXObjectCache : public GarbageCollected { virtual void ListboxSelectedChildrenChanged(HTMLSelectElement*) = 0; virtual void ListboxActiveIndexChanged(HTMLSelectElement*) = 0; virtual void LocationChanged(const LayoutObject*) = 0; - virtual void RadiobuttonRemovedFromGroup(HTMLInputElement*) = 0; virtual void ImageLoaded(const LayoutObject*) = 0; virtual void Remove(AccessibleNode*) = 0; @@ -139,7 +143,7 @@ class CORE_EXPORT AXObjectCache : public GarbageCollected { Element*, const LayoutRect&) = 0; - virtual void InlineTextBoxesUpdated(LineLayoutItem) = 0; + virtual void InlineTextBoxesUpdated(LayoutObject*) = 0; // Called when the scroll offset changes. virtual void HandleScrollPositionChanged(LocalFrameView*) = 0; diff --git a/chromium/third_party/blink/renderer/core/accessibility/ax_object_cache_base.h b/chromium/third_party/blink/renderer/core/accessibility/ax_object_cache_base.h index d3290f14ed1..1ea08910d80 100644 --- a/chromium/third_party/blink/renderer/core/accessibility/ax_object_cache_base.h +++ b/chromium/third_party/blink/renderer/core/accessibility/ax_object_cache_base.h @@ -28,7 +28,8 @@ class CORE_EXPORT AXObjectCacheBase : public AXObjectCache { ~AXObjectCacheBase() override = default; virtual AXObject* Get(const Node*) = 0; - virtual AXObject* GetOrCreate(LayoutObject*) = 0; + virtual AXObject* GetOrCreate(LayoutObject*, + AXObject* parent_if_known = nullptr) = 0; protected: AXObjectCacheBase() = default; diff --git a/chromium/third_party/blink/renderer/core/animation/BUILD.gn b/chromium/third_party/blink/renderer/core/animation/BUILD.gn index a690dc32877..efc1cfc7c81 100644 --- a/chromium/third_party/blink/renderer/core/animation/BUILD.gn +++ b/chromium/third_party/blink/renderer/core/animation/BUILD.gn @@ -72,6 +72,8 @@ blink_core_sources("animation") { "css/css_transition_data.h", "css_angle_interpolation_type.cc", "css_angle_interpolation_type.h", + "css_aspect_ratio_interpolation_type.cc", + "css_aspect_ratio_interpolation_type.h", "css_basic_shape_interpolation_type.cc", "css_basic_shape_interpolation_type.h", "css_border_image_length_box_interpolation_type.cc", @@ -168,6 +170,8 @@ blink_core_sources("animation") { "image_slice_property_functions.h", "inert_effect.cc", "inert_effect.h", + "interpolable_aspect_ratio.cc", + "interpolable_aspect_ratio.h", "interpolable_filter.cc", "interpolable_filter.h", "interpolable_length.cc", diff --git a/chromium/third_party/blink/renderer/core/animation/DIR_METADATA b/chromium/third_party/blink/renderer/core/animation/DIR_METADATA new file mode 100644 index 00000000000..072e8c98258 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/animation/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink>Animation" +} + +team_email: "animations-dev@chromium.org" diff --git a/chromium/third_party/blink/renderer/core/animation/OWNERS b/chromium/third_party/blink/renderer/core/animation/OWNERS index ef3593179c5..e7571208635 100644 --- a/chromium/third_party/blink/renderer/core/animation/OWNERS +++ b/chromium/third_party/blink/renderer/core/animation/OWNERS @@ -8,6 +8,3 @@ alancutter@chromium.org ericwilligers@chromium.org per-file compositor_*=loyso@chromium.org - -# TEAM: animations-dev@chromium.org -# COMPONENT: Blink>Animation diff --git a/chromium/third_party/blink/renderer/core/animation/animatable.cc b/chromium/third_party/blink/renderer/core/animation/animatable.cc index 01fee49eac1..bb64f4e2334 100644 --- a/chromium/third_party/blink/renderer/core/animation/animatable.cc +++ b/chromium/third_party/blink/renderer/core/animation/animatable.cc @@ -73,6 +73,11 @@ Animation* Animatable::animate( if (exception_state.HadException()) return nullptr; + // Creation of the keyframe effect parses JavaScript, which could result + // in destruction of the execution context. Recheck that it is still valid. + if (!element->GetExecutionContext()) + return nullptr; + ReportFeaturePolicyViolationsIfNecessary(*element->GetExecutionContext(), *effect->Model()); if (!options.IsKeyframeAnimationOptions()) @@ -90,6 +95,9 @@ Animation* Animatable::animate( nullptr, exception_state); } + if (!animation) + return nullptr; + animation->setId(options_dict->id()); return animation; } @@ -107,6 +115,11 @@ Animation* Animatable::animate(ScriptState* script_state, if (exception_state.HadException()) return nullptr; + // Creation of the keyframe effect parses JavaScript, which could result + // in destruction of the execution context. Recheck that it is still valid. + if (!element->GetExecutionContext()) + return nullptr; + ReportFeaturePolicyViolationsIfNecessary(*element->GetExecutionContext(), *effect->Model()); return element->GetDocument().Timeline().Play(effect); diff --git a/chromium/third_party/blink/renderer/core/animation/animation.cc b/chromium/third_party/blink/renderer/core/animation/animation.cc index 3cd250acb32..5bededa4316 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation.cc +++ b/chromium/third_party/blink/renderer/core/animation/animation.cc @@ -53,6 +53,8 @@ #include "third_party/blink/renderer/core/css/properties/css_property_ref.h" #include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/css/style_change_reason.h" +#include "third_party/blink/renderer/core/display_lock/display_lock_document_state.h" +#include "third_party/blink/renderer/core/display_lock/display_lock_utilities.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/dom_node_ids.h" #include "third_party/blink/renderer/core/events/animation_playback_event.h" @@ -83,26 +85,6 @@ unsigned NextSequenceNumber() { return ++next; } -double SecondsToMilliseconds(double seconds) { - return seconds * 1000; -} - -double MillisecondsToSeconds(double milliseconds) { - return milliseconds / 1000; -} - -double Max(base::Optional a, double b) { - if (a.has_value()) - return std::max(a.value(), b); - return b; -} - -double Min(base::Optional a, double b) { - if (a.has_value()) - return std::min(a.value(), b); - return b; -} - PseudoPriority ConvertPseudoIdtoPriority(const PseudoId& pseudo) { if (pseudo == kPseudoIdNone) return PseudoPriority::kNone; @@ -180,6 +162,16 @@ AtomicString GetCSSTransitionCSSPropertyName(const Animation* animation) { ->TransitionCSSPropertyName() .ToAtomicString(); } + +bool GreaterThanOrEqualWithinTimeTolerance(const AnimationTimeDelta& a, + const AnimationTimeDelta& b) { + double a_ms = a.InMillisecondsF(); + double b_ms = b.InMillisecondsF(); + if (std::abs(a_ms - b_ms) < Animation::kTimeToleranceMs) + return true; + + return a_ms > b_ms; +} } // namespace Animation* Animation::Create(AnimationEffect* effect, @@ -294,13 +286,21 @@ void Animation::Dispose() { DCHECK(!compositor_animation_); } -double Animation::EffectEnd() const { - return content_ ? content_->SpecifiedTiming().EndTimeInternal() : 0; +AnimationTimeDelta Animation::EffectEnd() const { + return content_ ? AnimationTimeDelta::FromSecondsD( + content_->SpecifiedTiming().EndTimeInternal()) + : AnimationTimeDelta(); } -bool Animation::Limited(base::Optional current_time) const { - return (EffectivePlaybackRate() < 0 && current_time <= 0) || - (EffectivePlaybackRate() > 0 && current_time >= EffectEnd()); +bool Animation::Limited(base::Optional current_time) const { + if (!current_time) + return false; + + return (EffectivePlaybackRate() < 0 && + current_time <= AnimationTimeDelta()) || + (EffectivePlaybackRate() > 0 && + GreaterThanOrEqualWithinTimeTolerance(current_time.value(), + EffectEnd())); } Document* Animation::GetDocument() const { @@ -312,9 +312,9 @@ base::Optional Animation::TimelineTime() const { } // https://drafts.csswg.org/web-animations/#setting-the-current-time-of-an-animation. -void Animation::setCurrentTime(base::Optional new_current_time, +void Animation::setCurrentTime(CSSNumberish current_time, ExceptionState& exception_state) { - if (!new_current_time) { + if (current_time.IsNull()) { // If the current time is resolved, then throw a TypeError. if (CurrentTimeInternal()) { exception_state.ThrowTypeError( @@ -323,12 +323,25 @@ void Animation::setCurrentTime(base::Optional new_current_time, return; } - SetCurrentTimeInternal(MillisecondsToSeconds(new_current_time.value())); + if (current_time.IsCSSNumericValue()) { + // Throw exception for CSSNumberish that is a CSSNumericValue + exception_state.ThrowDOMException( + DOMExceptionCode::kNotSupportedError, + "Invalid startTime. CSSNumericValue not yet supported."); + return; + } + + DCHECK(current_time.IsDouble()); + // Convert from double to AnimationTimeDelta for internal use. + base::Optional new_current_time = + AnimationTimeDelta::FromMillisecondsD(current_time.GetAsDouble()); + + DCHECK(new_current_time); + SetCurrentTimeInternal(new_current_time.value()); // Synchronously resolve pending pause task. if (pending_pause_) { - SetHoldTimeAndPhase(MillisecondsToSeconds(new_current_time.value()), - TimelinePhase::kActive); + SetHoldTimeAndPhase(new_current_time, TimelinePhase::kActive); ApplyPendingPlaybackRate(); start_time_ = base::nullopt; pending_pause_ = false; @@ -345,19 +358,17 @@ void Animation::setCurrentTime(base::Optional new_current_time, NotifyProbe(); } -void Animation::setCurrentTime(base::Optional new_current_time) { +void Animation::setCurrentTime(CSSNumberish current_time) { NonThrowableExceptionState exception_state; - setCurrentTime(new_current_time, exception_state); + setCurrentTime(current_time, exception_state); } // https://drafts.csswg.org/web-animations/#setting-the-current-time-of-an-animation // See steps for silently setting the current time. The preliminary step of // handling an unresolved time are to be handled by the caller. -void Animation::SetCurrentTimeInternal(double new_current_time) { - DCHECK(std::isfinite(new_current_time)); - - base::Optional previous_start_time = start_time_; - base::Optional previous_hold_time = hold_time_; +void Animation::SetCurrentTimeInternal(AnimationTimeDelta new_current_time) { + base::Optional previous_start_time = start_time_; + base::Optional previous_hold_time = hold_time_; base::Optional previous_hold_phase = hold_phase_; // Update either the hold time or the start time. @@ -383,11 +394,8 @@ void Animation::SetCurrentTimeInternal(double new_current_time) { } void Animation::SetHoldTimeAndPhase( - base::Optional new_hold_time /* in seconds */, + base::Optional new_hold_time, TimelinePhase new_hold_phase) { - // new_hold_time must be valid, unless new_hold_phase is inactive. - DCHECK(new_hold_time || - (!new_hold_time && new_hold_phase == TimelinePhase::kInactive)); hold_time_ = new_hold_time; hold_phase_ = new_hold_phase; } @@ -397,18 +405,22 @@ void Animation::ResetHoldTimeAndPhase() { hold_phase_ = base::nullopt; } -base::Optional Animation::startTime() const { - return start_time_ - ? base::make_optional(SecondsToMilliseconds(start_time_.value())) - : base::nullopt; +void Animation::startTime(CSSNumberish& startTime) const { + startTime = + start_time_ + ? CSSNumberish::FromDouble(start_time_.value().InMillisecondsF()) + : CSSNumberish(); } // https://drafts.csswg.org/web-animations/#the-current-time-of-an-animation -base::Optional Animation::currentTime() const { +void Animation::currentTime(CSSNumberish& currentTime) const { // 1. If the animation’s hold time is resolved, // The current time is the animation’s hold time. - if (hold_time_.has_value()) - return SecondsToMilliseconds(hold_time_.value()); + if (hold_time_.has_value()) { + currentTime = + CSSNumberish::FromDouble(hold_time_.value().InMillisecondsF()); + return; + } // 2. If any of the following are true: // * the animation has no associated timeline, or @@ -416,28 +428,30 @@ base::Optional Animation::currentTime() const { // * the animation’s start time is unresolved. // The current time is an unresolved time value. if (!timeline_ || !timeline_->IsActive() || !start_time_) - return base::nullopt; + return; // 3. Otherwise, // current time = (timeline time - start time) × playback rate - base::Optional timeline_time = timeline_->CurrentTimeSeconds(); + base::Optional timeline_time = timeline_->CurrentTime(); // An active timeline should always have a value, and since inactive timeline // is handled in step 2 above, make sure that timeline_time has a value. DCHECK(timeline_time.has_value()); - double current_time = + AnimationTimeDelta calculated_current_time = (timeline_time.value() - start_time_.value()) * playback_rate_; - return SecondsToMilliseconds(current_time); + + currentTime = + CSSNumberish::FromDouble(calculated_current_time.InMillisecondsF()); } bool Animation::ValidateHoldTimeAndPhase() const { - return (hold_phase_ && hold_time_) || + return hold_phase_ || ((!hold_phase_ || hold_phase_ == TimelinePhase::kInactive) && !hold_time_); } -base::Optional Animation::CurrentTimeInternal() const { +base::Optional Animation::CurrentTimeInternal() const { DCHECK(ValidateHoldTimeAndPhase()); return hold_time_ ? hold_time_ : CalculateCurrentTime(); } @@ -447,7 +461,7 @@ TimelinePhase Animation::CurrentPhaseInternal() const { return hold_phase_ ? hold_phase_.value() : CalculateCurrentPhase(); } -base::Optional Animation::UnlimitedCurrentTime() const { +base::Optional Animation::UnlimitedCurrentTime() const { return CalculateAnimationPlayState() == kPaused || !start_time_ ? CurrentTimeInternal() : CalculateCurrentTime(); @@ -466,9 +480,11 @@ bool Animation::PreCommit( compositor_state_ && (Paused() || compositor_state_->playback_rate != EffectivePlaybackRate()); bool hard_change = - compositor_state_ && (compositor_state_->effect_changed || - compositor_state_->start_time != start_time_ || - !compositor_state_->start_time || !start_time_); + compositor_state_ && + (compositor_state_->effect_changed || !compositor_state_->start_time || + !start_time_ || + !IsWithinAnimationTimeEpsilon(compositor_state_->start_time.value(), + start_time_.value().InSecondsF())); // FIXME: softChange && !hardChange should generate a Pause/ThenStart, // not a Cancel, but we can't communicate these to the compositor yet. @@ -526,7 +542,8 @@ void Animation::PostCommit() { DCHECK_EQ(kStart, compositor_state_->pending_action); if (compositor_state_->start_time) { - DCHECK_EQ(start_time_.value(), compositor_state_->start_time.value()); + DCHECK(IsWithinAnimationTimeEpsilon(start_time_.value().InSecondsF(), + compositor_state_->start_time.value())); compositor_state_->pending_action = kNone; } } @@ -621,7 +638,7 @@ bool Animation::HasLowerCompositeOrdering( return animation1->SequenceNumber() < animation2->SequenceNumber(); } -void Animation::NotifyReady(double ready_time) { +void Animation::NotifyReady(AnimationTimeDelta ready_time) { // Complete the pending updates prior to updating the compositor state in // order to ensure a correct start time for the compositor state without the // need to duplicate the calculations. @@ -633,7 +650,9 @@ void Animation::NotifyReady(double ready_time) { if (compositor_state_ && compositor_state_->pending_action == kStart) { DCHECK(!compositor_state_->start_time); compositor_state_->pending_action = kNone; - compositor_state_->start_time = start_time_; + compositor_state_->start_time = + start_time_ ? base::make_optional(start_time_.value().InSecondsF()) + : base::nullopt; } // Notify of change to play state. @@ -643,8 +662,7 @@ void Animation::NotifyReady(double ready_time) { // Microtask for playing an animation. // Refer to Step 8.3 'pending play task' in // https://drafts.csswg.org/web-animations/#playing-an-animation-section. -void Animation::CommitPendingPlay(double ready_time) { - DCHECK(std::isfinite(ready_time)); +void Animation::CommitPendingPlay(AnimationTimeDelta ready_time) { DCHECK(start_time_ || hold_time_); DCHECK(pending_play_); pending_play_ = false; @@ -680,7 +698,7 @@ void Animation::CommitPendingPlay(double ready_time) { // If the playback rate is zero, let new start time be simply ready // time. // B.5 Set the start time of animation to new start time. - double current_time_to_match = + AnimationTimeDelta current_time_to_match = (ready_time - start_time_.value()) * playback_rate_; ApplyPendingPlaybackRate(); if (playback_rate_ == 0) { @@ -705,7 +723,7 @@ void Animation::CommitPendingPlay(double ready_time) { // Microtask for pausing an animation. // Refer to step 7 'pending pause task' in // https://drafts.csswg.org/web-animations-1/#pausing-an-animation-section -void Animation::CommitPendingPause(double ready_time) { +void Animation::CommitPendingPause(AnimationTimeDelta ready_time) { DCHECK(pending_pause_); pending_pause_ = false; @@ -769,7 +787,7 @@ void Animation::setTimeline(AnimationTimeline* timeline) { UpdateIfNecessary(); AnimationPlayState old_play_state = CalculateAnimationPlayState(); - base::Optional old_current_time = CurrentTimeInternal(); + base::Optional old_current_time = CurrentTimeInternal(); CancelAnimationOnCompositor(); @@ -795,7 +813,8 @@ void Animation::setTimeline(AnimationTimeline* timeline) { if (timeline) { if (!timeline->IsMonotonicallyIncreasing()) { ApplyPendingPlaybackRate(); - double boundary_time = (playback_rate_ > 0) ? 0 : EffectEnd(); + AnimationTimeDelta boundary_time = + (playback_rate_ > 0) ? AnimationTimeDelta() : EffectEnd(); switch (old_play_state) { case kIdle: break; @@ -851,11 +870,11 @@ void Animation::setTimeline(AnimationTimeline* timeline) { NotifyProbe(); } -base::Optional Animation::CalculateStartTime( - double current_time) const { - base::Optional start_time; +base::Optional Animation::CalculateStartTime( + AnimationTimeDelta current_time) const { + base::Optional start_time; if (timeline_) { - base::Optional timeline_time = timeline_->CurrentTimeSeconds(); + base::Optional timeline_time = timeline_->CurrentTime(); if (timeline_time) start_time = timeline_time.value() - current_time / playback_rate_; // TODO(crbug.com/916117): Handle NaN time for scroll-linked animations. @@ -864,16 +883,13 @@ base::Optional Animation::CalculateStartTime( return start_time; } -base::Optional Animation::CalculateCurrentTime() const { +base::Optional Animation::CalculateCurrentTime() const { if (!start_time_ || !timeline_ || !timeline_->IsActive()) return base::nullopt; - base::Optional timeline_time = timeline_->CurrentTimeSeconds(); - if (!timeline_time) { - // timeline_time can be null only when the timeline is inactive - DCHECK(!timeline_->IsActive()); - return base::nullopt; - } + base::Optional timeline_time = timeline_->CurrentTime(); + // timeline_ must be active here, make sure it is returning a current_time. + DCHECK(timeline_time); return (timeline_time.value() - start_time_.value()) * playback_rate_; } @@ -885,42 +901,56 @@ TimelinePhase Animation::CalculateCurrentPhase() const { } // https://drafts.csswg.org/web-animations/#setting-the-start-time-of-an-animation -void Animation::setStartTime(base::Optional start_time_ms, +void Animation::setStartTime(CSSNumberish start_time, ExceptionState& exception_state) { + if (!start_time.IsNull() && start_time.IsCSSNumericValue()) { + // Throw exception for CSSNumberish that is a CSSNumericValue + exception_state.ThrowDOMException( + DOMExceptionCode::kNotSupportedError, + "Invalid startTime. CSSNumericValue not yet supported."); + return; + } + + base::Optional new_start_time = + !start_time.IsNull() + ? base::make_optional( + AnimationTimeDelta::FromMillisecondsD(start_time.GetAsDouble())) + : base::nullopt; + bool had_start_time = start_time_.has_value(); // 1. Let timeline time be the current time value of the timeline that // animation is associated with. If there is no timeline associated with // animation or the associated timeline is inactive, let the timeline time // be unresolved. - base::Optional timeline_time = timeline_ && timeline_->IsActive() - ? timeline_->CurrentTimeSeconds() - : base::nullopt; + base::Optional timeline_time = + timeline_ && timeline_->IsActive() ? timeline_->CurrentTime() + : base::nullopt; // 2. If timeline time is unresolved and new start time is resolved, make // animation’s hold time unresolved. // This preserves the invariant that when we don’t have an active timeline it // is only possible to set either the start time or the animation’s current // time. - if (!timeline_time && start_time_ms) { + if (!timeline_time && new_start_time) { ResetHoldTimeAndPhase(); } // 3. Let previous current time be animation’s current time. - base::Optional previous_current_time = CurrentTimeInternal(); + base::Optional previous_current_time = + CurrentTimeInternal(); TimelinePhase previous_current_phase = CurrentPhaseInternal(); // 4. Apply any pending playback rate on animation. ApplyPendingPlaybackRate(); // 5. Set animation’s start time to new start time. - base::Optional new_start_time; - if (start_time_ms) { - new_start_time = MillisecondsToSeconds(start_time_ms.value()); + if (new_start_time) { // Snap to timeline time if within floating point tolerance to ensure // deterministic behavior in phase transitions. - if (timeline_time && IsWithinAnimationTimeEpsilon(timeline_time.value(), - new_start_time.value())) { + if (timeline_time && + IsWithinAnimationTimeEpsilon(timeline_time.value().InSecondsF(), + new_start_time.value().InSecondsF())) { new_start_time = timeline_time.value(); } } @@ -959,7 +989,7 @@ void Animation::setStartTime(base::Optional start_time_ms, UpdateFinishedState(UpdateType::kDiscontinuous, NotificationType::kAsync); // Update user agent. - base::Optional new_current_time = CurrentTimeInternal(); + base::Optional new_current_time = CurrentTimeInternal(); // Even when the animation is not outdated,call SetOutdated to ensure // the animation is tracked by its timeline for future timing // updates. @@ -972,9 +1002,9 @@ void Animation::setStartTime(base::Optional start_time_ms, NotifyProbe(); } -void Animation::setStartTime(base::Optional start_time_ms) { +void Animation::setStartTime(CSSNumberish start_time) { NonThrowableExceptionState exception_state; - setStartTime(start_time_ms, exception_state); + setStartTime(start_time, exception_state); } // https://drafts.csswg.org/web-animations-1/#setting-the-associated-effect @@ -1049,11 +1079,11 @@ void Animation::setEffect(AnimationEffect* new_effect) { // The timing phase is ‘before’. // Otherwise, // The timing phase is ‘after’. - base::Optional current_time = CurrentTimeInternal(); + base::Optional current_time = CurrentTimeInternal(); Timing::Phase phase; if (!current_time) phase = Timing::kPhaseNone; - else if (current_time < 0) + else if (current_time < AnimationTimeDelta()) phase = Timing::kPhaseBefore; else phase = Timing::kPhaseAfter; @@ -1177,7 +1207,7 @@ void Animation::pause(ExceptionState& exception_state) { return; // 3. Let seek time be a time value that is initially unresolved. - base::Optional seek_time; + base::Optional seek_time; // 4. Let has finite timeline be true if animation has an associated timeline // that is not monotonically increasing. @@ -1194,12 +1224,11 @@ void Animation::pause(ExceptionState& exception_state) { // steps. // Otherwise, // Set seek time to animation's associated effect end. - base::Optional current_time = CurrentTimeInternal(); - if (!current_time) { + if (!CurrentTimeInternal()) { if (playback_rate_ >= 0) { - seek_time = 0; + seek_time = AnimationTimeDelta(); } else { - if (EffectEnd() == std::numeric_limits::infinity()) { + if (EffectEnd().is_inf()) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, "Cannot play reversed Animation with infinite target effect end."); @@ -1283,7 +1312,7 @@ void Animation::PlayInternal(AutoRewind auto_rewind, bool enable_seek = auto_rewind == AutoRewind::kEnabled || reset_current_time_on_resume_; bool has_pending_ready_promise = false; - base::Optional seek_time; + base::Optional seek_time; bool has_finite_timeline = timeline_ && !timeline_->IsMonotonicallyIncreasing(); @@ -1311,21 +1340,23 @@ void Animation::PlayInternal(AutoRewind auto_rewind, // is unresolved, // 5c1. Set seek time to zero. double effective_playback_rate = EffectivePlaybackRate(); - base::Optional current_time = CurrentTimeInternal(); + base::Optional current_time = CurrentTimeInternal(); if (reset_current_time_on_resume_) { current_time = base::nullopt; reset_current_time_on_resume_ = false; } + base::Optional effect_end = EffectEnd(); if (effective_playback_rate > 0 && enable_seek && - (!current_time || current_time < 0 || current_time >= EffectEnd())) { - seek_time = 0; + (!current_time || current_time < AnimationTimeDelta() || + current_time >= effect_end)) { + seek_time = AnimationTimeDelta(); } else if (effective_playback_rate < 0 && enable_seek && - (!current_time || current_time <= 0 || + (!current_time || current_time <= AnimationTimeDelta() || current_time > EffectEnd())) { - if (EffectEnd() == std::numeric_limits::infinity()) { + if (EffectEnd().is_inf()) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, "Cannot play reversed Animation with infinite target effect end."); @@ -1333,7 +1364,7 @@ void Animation::PlayInternal(AutoRewind auto_rewind, } seek_time = EffectEnd(); } else if (effective_playback_rate == 0 && !current_time) { - seek_time = 0; + seek_time = AnimationTimeDelta(); } // 6. If seek time is resolved, @@ -1441,8 +1472,7 @@ void Animation::finish(ExceptionState& exception_state) { "Cannot finish Animation with a playbackRate of 0."); return; } - if (EffectivePlaybackRate() > 0 && - EffectEnd() == std::numeric_limits::infinity()) { + if (EffectivePlaybackRate() > 0 && EffectEnd().is_inf()) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, "Cannot finish Animation with an infinite target effect end."); @@ -1451,7 +1481,8 @@ void Animation::finish(ExceptionState& exception_state) { ApplyPendingPlaybackRate(); - double new_current_time = playback_rate_ < 0 ? 0 : EffectEnd(); + AnimationTimeDelta new_current_time = + playback_rate_ < 0 ? AnimationTimeDelta() : EffectEnd(); SetCurrentTimeInternal(new_current_time); if (!start_time_ && timeline_ && timeline_->IsActive()) @@ -1483,7 +1514,7 @@ void Animation::UpdateFinishedState(UpdateType update_type, // required to accommodate timelines that may change direction. Without this // distinction, a once-finished animation would remain finished even when its // timeline progresses in the opposite direction. - base::Optional unconstrained_current_time = + base::Optional unconstrained_current_time = did_seek ? CurrentTimeInternal() : CalculateCurrentTime(); // 2. Conditionally update the hold time. @@ -1497,22 +1528,42 @@ void Animation::UpdateFinishedState(UpdateType update_type, // boundary. The value of previous current time is used to retain this // value. double playback_rate = EffectivePlaybackRate(); - base::Optional hold_time; + base::Optional hold_time; TimelinePhase hold_phase; - if (playback_rate > 0 && unconstrained_current_time >= EffectEnd()) { - hold_time = did_seek ? unconstrained_current_time - : Max(previous_current_time_, EffectEnd()); + + if (playback_rate > 0 && + GreaterThanOrEqualWithinTimeTolerance( + unconstrained_current_time.value(), EffectEnd())) { + if (did_seek) { + hold_time = unconstrained_current_time; + } else { + if (previous_current_time_ > EffectEnd()) { + hold_time = previous_current_time_; + } else { + hold_time = EffectEnd(); + } + } hold_phase = did_seek ? TimelinePhase::kActive : CalculateCurrentPhase(); SetHoldTimeAndPhase(hold_time, hold_phase); - } else if (playback_rate < 0 && unconstrained_current_time <= 0) { - hold_time = did_seek ? unconstrained_current_time - : Min(previous_current_time_, 0); + } else if (playback_rate < 0 && + unconstrained_current_time.value() <= AnimationTimeDelta()) { + if (did_seek) { + hold_time = unconstrained_current_time; + } else { + if (previous_current_time_ <= AnimationTimeDelta()) { + hold_time = previous_current_time_; + } else { + hold_time = AnimationTimeDelta(); + } + } hold_phase = did_seek ? TimelinePhase::kActive : CalculateCurrentPhase(); // Hack for resolving precision issue at zero. - if (hold_time.value() == -0) - hold_time = 0; + if (hold_time.has_value() && + IsWithinAnimationTimeEpsilon(hold_time.value().InSecondsF(), -0)) { + hold_time = AnimationTimeDelta(); + } SetHoldTimeAndPhase(hold_time, hold_phase); } else if (playback_rate != 0) { @@ -1573,7 +1624,7 @@ void Animation::AsyncFinishMicrotask() { if (pending_finish_notification_) { // A pending play or pause must resolve before the finish promise. if (PendingInternal() && timeline_) - NotifyReady(timeline_->CurrentTimeSeconds().value_or(0)); + NotifyReady(timeline_->CurrentTime().value_or(AnimationTimeDelta())); CommitFinishNotification(); } @@ -1645,14 +1696,14 @@ void Animation::updatePlaybackRate(double playback_rate, // animation with the did seek flag set to false, and the // synchronously notify flag set to false. case kFinished: { - base::Optional unconstrained_current_time = + base::Optional unconstrained_current_time = CalculateCurrentTime(); - base::Optional timeline_time = - timeline_ ? timeline_->CurrentTimeSeconds() : base::nullopt; + base::Optional timeline_time = + timeline_ ? timeline_->CurrentTime() : base::nullopt; if (playback_rate) { if (timeline_time) { start_time_ = (timeline_time && unconstrained_current_time) - ? base::make_optional( + ? base::make_optional( (timeline_time.value() - unconstrained_current_time.value()) / playback_rate) @@ -1768,7 +1819,7 @@ void Animation::ApplyPendingPlaybackRate() { void Animation::setPlaybackRate(double playback_rate, ExceptionState& exception_state) { - base::Optional start_time_before = start_time_; + base::Optional start_time_before = start_time_; // 1. Clear any pending playback rate on animation. // 2. Let previous time be the value of the current time of animation before @@ -1777,9 +1828,10 @@ void Animation::setPlaybackRate(double playback_rate, // 4. If previous time is resolved, set the current time of animation to // previous time pending_playback_rate_ = base::nullopt; - base::Optional previous_current_time = currentTime(); + CSSNumberish previous_current_time; + currentTime(previous_current_time); playback_rate_ = playback_rate; - if (previous_current_time.has_value()) { + if (!previous_current_time.IsNull()) { setCurrentTime(previous_current_time, exception_state); } @@ -1855,7 +1907,7 @@ Animation::CheckCanStartAnimationOnCompositorInternal() const { // enable compositing provided the iteration duration is finite. Having an // infinite number of iterations in the animation should not impede the // ability to composite the animation. - if (std::isinf(EffectEnd()) && EffectivePlaybackRate() < 0) + if (EffectEnd().is_inf() && EffectivePlaybackRate() < 0) reasons |= CompositorAnimations::kInvalidAnimationOrEffect; // An Animation without a timeline effectively isn't playing, so there is no @@ -1893,10 +1945,13 @@ void Animation::StartAnimationOnCompositor( CheckCanStartAnimationOnCompositor(paint_artifact_compositor, nullptr), CompositorAnimations::kNoFailure); + // If PlaybackRate is 0, then we will run into divide by 0 issues. + DCHECK(!IsWithinAnimationTimeEpsilon(0, EffectivePlaybackRate())); + bool reversed = EffectivePlaybackRate() < 0; - base::Optional start_time = base::nullopt; - double time_offset = 0; + base::Optional start_time; + AnimationTimeDelta time_offset = AnimationTimeDelta(); // Start the animation on the compositor with either a start time or time // offset. The start time is used for synchronous updates where the // compositor start time must be in precise alignment with the specified time @@ -1905,27 +1960,30 @@ void Animation::StartAnimationOnCompositor( // Asynchronous updates have an associated pending play or pending pause // task associated with them. if (start_time_ && !PendingInternal()) { - start_time = timeline_->ZeroTimeInSeconds() + start_time_.value(); + start_time = timeline_->ZeroTime() + start_time_.value(); if (reversed) { start_time = start_time.value() - (EffectEnd() / fabs(EffectivePlaybackRate())); } - DCHECK(std::isfinite(start_time.value())); } else { - base::Optional current_time = CurrentTimeInternal(); + base::Optional current_time = CurrentTimeInternal(); DCHECK(current_time); time_offset = reversed ? EffectEnd() - current_time.value() : current_time.value(); time_offset = time_offset / fabs(EffectivePlaybackRate()); - DCHECK(std::isfinite(time_offset)); } DCHECK_NE(compositor_group_, 0); DCHECK(To(content_.Get())); + base::Optional start_time_s; + if (start_time) { + start_time_s = start_time.value().InSecondsF(); + } To(content_.Get()) - ->StartAnimationOnCompositor(compositor_group_, start_time, - base::TimeDelta::FromSecondsD(time_offset), - EffectivePlaybackRate()); + ->StartAnimationOnCompositor( + compositor_group_, start_time_s, + base::TimeDelta::FromSecondsD(time_offset.InSecondsF()), + EffectivePlaybackRate()); } // TODO(crbug.com/960944): Rename to SetPendingCommit. This method handles both @@ -1952,7 +2010,10 @@ void Animation::SetCompositorPending(bool effect_changed) { if (PendingInternal() || !compositor_state_ || compositor_state_->effect_changed || compositor_state_->playback_rate != EffectivePlaybackRate() || - compositor_state_->start_time != start_time_ || + compositor_state_->start_time.has_value() != start_time_.has_value() || + (compositor_state_->start_time && start_time_ && + !IsWithinAnimationTimeEpsilon(compositor_state_->start_time.value(), + start_time_.value().InSecondsF())) || !compositor_state_->start_time || !start_time_) { compositor_pending_ = true; document_->GetPendingAnimations().Add(this); @@ -2002,14 +2063,14 @@ bool Animation::Update(TimingUpdateReason reason) { UpdateFinishedState(UpdateType::kContinuous, NotificationType::kAsync); if (content_) { - base::Optional inherited_time; + base::Optional inherited_time; TimelinePhase inherited_phase = TimelinePhase::kInactive; if (!idle) { inherited_time = CurrentTimeInternal(); // Special case for end-exclusivity when playing backwards. - if (inherited_time == 0 && EffectivePlaybackRate() < 0) - inherited_time = -1; + if (inherited_time == AnimationTimeDelta() && EffectivePlaybackRate() < 0) + inherited_time = AnimationTimeDelta::FromSecondsD(-1); inherited_phase = CurrentPhaseInternal(); } @@ -2049,12 +2110,14 @@ bool Animation::Update(TimingUpdateReason reason) { void Animation::QueueFinishedEvent() { const AtomicString& event_type = event_type_names::kFinish; if (GetExecutionContext() && HasEventListeners(event_type)) { - base::Optional event_current_time = CurrentTimeInternal(); + base::Optional event_current_time = + CurrentTimeInternal(); + base::Optional event_current_time_ms; if (event_current_time) - event_current_time = SecondsToMilliseconds(event_current_time.value()); + event_current_time_ms = event_current_time.value().InMillisecondsF(); // TODO(crbug.com/916117): Handle NaN values for scroll-linked animations. pending_finished_event_ = MakeGarbageCollected( - event_type, event_current_time, TimelineTime()); + event_type, event_current_time_ms, TimelineTime()); pending_finished_event_->SetTarget(this); pending_finished_event_->SetCurrentTarget(this); document_->EnqueueAnimationFrameEvent(pending_finished_event_); @@ -2084,10 +2147,9 @@ base::Optional Animation::TimeToEffectChange() { return base::nullopt; if (!content_) { - base::Optional current_time = CurrentTimeInternal(); + base::Optional current_time = CurrentTimeInternal(); DCHECK(current_time); - return AnimationTimeDelta::FromSecondsD(-current_time.value() / - playback_rate_); + return -current_time.value() / playback_rate_; } if (!HasActiveAnimationsOnCompositor() && @@ -2100,7 +2162,8 @@ base::Optional Animation::TimeToEffectChange() { } void Animation::cancel() { - double current_time_before_cancel = CurrentTimeInternal().value_or(0); + AnimationTimeDelta current_time_before_cancel = + CurrentTimeInternal().value_or(AnimationTimeDelta()); AnimationPlayState initial_play_state = CalculateAnimationPlayState(); if (initial_play_state != kIdle) { ResetPendingTasks(); @@ -2223,7 +2286,7 @@ void Animation::AddedEventListener( UseCounter::Count(GetExecutionContext(), WebFeature::kAnimationFinishEvent); } -void Animation::PauseForTesting(double pause_time) { +void Animation::PauseForTesting(AnimationTimeDelta pause_time) { // Do not restart a canceled animation. if (CalculateAnimationPlayState() == kIdle) return; @@ -2232,11 +2295,11 @@ void Animation::PauseForTesting(double pause_time) { // animation. SetCurrentTimeInternal(pause_time); if (HasActiveAnimationsOnCompositor()) { - base::Optional current_time = CurrentTimeInternal(); + base::Optional current_time = CurrentTimeInternal(); DCHECK(current_time); To(content_.Get()) ->PauseAnimationForTestingOnCompositor( - base::TimeDelta::FromSecondsD(current_time.value())); + base::TimeDelta::FromSecondsD(current_time.value().InSecondsF())); } // Do not wait for animation ready to lock in the hold time. Otherwise, @@ -2420,11 +2483,13 @@ void Animation::RemoveReplacedAnimation() { replace_state_ = kRemoved; const AtomicString& event_type = event_type_names::kRemove; if (GetExecutionContext() && HasEventListeners(event_type)) { - base::Optional event_current_time = CurrentTimeInternal(); + base::Optional event_current_time = + CurrentTimeInternal(); + base::Optional event_current_time_ms; if (event_current_time) - event_current_time = SecondsToMilliseconds(event_current_time.value()); + event_current_time_ms = event_current_time.value().InMillisecondsF(); pending_remove_event_ = MakeGarbageCollected( - event_type, event_current_time, TimelineTime()); + event_type, event_current_time_ms, TimelineTime()); pending_remove_event_->SetTarget(this); pending_remove_event_->SetCurrentTarget(this); document_->EnqueueAnimationFrameEvent(pending_remove_event_); @@ -2533,6 +2598,24 @@ void Animation::commitStyles(ExceptionState& exception_state) { WrapWeakPersistent(inline_style), WrapWeakPersistent(target))); } +bool Animation::IsInDisplayLockedSubtree() { + Element* owning_element = OwningElement(); + if (!owning_element || !GetDocument()) + return false; + + base::TimeTicks display_lock_update_timestamp = + GetDocument()->GetDisplayLockDocumentState().GetLockUpdateTimestamp(); + + if (last_display_lock_update_time_ < display_lock_update_timestamp) { + const Element* element = + DisplayLockUtilities::NearestLockedExclusiveAncestor(*owning_element); + is_in_display_locked_subtree_ = !!element; + last_display_lock_update_time_ = display_lock_update_timestamp; + } + + return is_in_display_locked_subtree_; +} + void Animation::Trace(Visitor* visitor) const { visitor->Trace(content_); visitor->Trace(document_); diff --git a/chromium/third_party/blink/renderer/core/animation/animation.h b/chromium/third_party/blink/renderer/core/animation/animation.h index caeacc7cf95..1a512b861d3 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation.h +++ b/chromium/third_party/blink/renderer/core/animation/animation.h @@ -36,6 +36,7 @@ #include "base/macros.h" #include "base/memory/scoped_refptr.h" #include "base/optional.h" +#include "base/time/time.h" #include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_property.h" @@ -44,6 +45,7 @@ #include "third_party/blink/renderer/core/animation/compositor_animations.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/css_property_names.h" +#include "third_party/blink/renderer/core/css/cssom/css_numeric_value.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" #include "third_party/blink/renderer/core/dom/events/event_target.h" #include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" @@ -99,6 +101,10 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, // relative position. enum CompareAnimationsOrdering { kTreeOrder, kPointerOrder }; + // Only expect timing accuracy to within 1 microsecond. + // drafts.csswg.org/web-animations/#precision-of-time-values. + static constexpr double kTimeToleranceMs = 0.001; + static Animation* Create(AnimationEffect*, AnimationTimeline*, ExceptionState& = ASSERT_NO_EXCEPTION); @@ -141,12 +147,13 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, void cancel(); - base::Optional currentTime() const; - void setCurrentTime(base::Optional new_current_time, - ExceptionState& exception_state); - void setCurrentTime(base::Optional new_current_time); + void currentTime(CSSNumberish&) const; + base::Optional CurrentTimeInternal() const; + void setCurrentTime(CSSNumberish, ExceptionState& exception_state); + void setCurrentTime(CSSNumberish); + void SetCurrentTimeInternal(AnimationTimeDelta); - base::Optional UnlimitedCurrentTime() const; + base::Optional UnlimitedCurrentTime() const; // https://drafts.csswg.org/web-animations/#play-states String PlayStateString() const; @@ -202,10 +209,12 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, virtual void setTimeline(AnimationTimeline* timeline); Document* GetDocument() const; - base::Optional startTime() const; - base::Optional StartTimeInternal() const { return start_time_; } - virtual void setStartTime(base::Optional, ExceptionState&); - void setStartTime(base::Optional); + void startTime(CSSNumberish&) const; + base::Optional StartTimeInternal() const { + return start_time_; + } + virtual void setStartTime(CSSNumberish, ExceptionState&); + void setStartTime(CSSNumberish); const AnimationEffect* effect() const { return content_.Get(); } AnimationEffect* effect() { return content_.Get(); } @@ -216,7 +225,7 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, // Pausing via this method is not reflected in the value returned by // paused() and must never overlap with pausing via pause(). - void PauseForTesting(double pause_time); + void PauseForTesting(AnimationTimeDelta pause_time); void DisableCompositedAnimationForTesting(); // This should only be used for CSS @@ -238,9 +247,9 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, void CancelIncompatibleAnimationsOnCompositor(); bool HasActiveAnimationsOnCompositor(); void SetCompositorPending(bool effect_changed = false); - void NotifyReady(double ready_time); - void CommitPendingPlay(double ready_time); - void CommitPendingPause(double ready_time); + void NotifyReady(AnimationTimeDelta ready_time); + void CommitPendingPlay(AnimationTimeDelta ready_time); + void CommitPendingPause(AnimationTimeDelta ready_time); // CompositorAnimationClient implementation. CompositorAnimation* GetCompositorAnimation() const override { return compositor_animation_ ? compositor_animation_->GetAnimation() @@ -291,11 +300,16 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, // depends on computed values. virtual void FlushPendingUpdates() const {} + bool IsInDisplayLockedSubtree(); + + void SetCanCompositeBGColorAnim() { can_composite_bgcolor_anim_ = true; } + void ResetCanCompositeBGColorAnim() { can_composite_bgcolor_anim_ = false; } + bool CanCompositeBGColorAnim() const { return can_composite_bgcolor_anim_; } + protected: DispatchEventResult DispatchEventInternal(Event&) override; void AddedEventListener(const AtomicString& event_type, RegisteredEventListener&) override; - base::Optional CurrentTimeInternal() const; TimelinePhase CurrentPhaseInternal() const; virtual AnimationEffect::EventDelegate* CreateEventDelegate( Element* target, @@ -304,18 +318,16 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, } private: - void SetCurrentTimeInternal(double new_current_time); - void SetHoldTimeAndPhase( - base::Optional new_hold_time /* in seconds */, - TimelinePhase new_hold_phase); + void SetHoldTimeAndPhase(base::Optional new_hold_time, + TimelinePhase new_hold_phase); void ResetHoldTimeAndPhase(); bool ValidateHoldTimeAndPhase() const; void ClearOutdated(); void ForceServiceOnNextFrame(); - double EffectEnd() const; - bool Limited(base::Optional current_time) const; + AnimationTimeDelta EffectEnd() const; + bool Limited(base::Optional current_time) const; // Playback rate that will take effect once any pending tasks are resolved. // If there are no pending tasks, then the effective playback rate equals the @@ -323,8 +335,9 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, double EffectivePlaybackRate() const; void ApplyPendingPlaybackRate(); - base::Optional CalculateStartTime(double current_time) const; - base::Optional CalculateCurrentTime() const; + base::Optional CalculateStartTime( + AnimationTimeDelta current_time) const; + base::Optional CalculateCurrentTime() const; TimelinePhase CalculateCurrentPhase() const; void BeginUpdatingState(); @@ -387,10 +400,10 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, // effect when running a scheduled task in response to the animation being // ready. base::Optional pending_playback_rate_; - base::Optional start_time_; - base::Optional hold_time_; + base::Optional start_time_; + base::Optional hold_time_; base::Optional hold_phase_; - base::Optional previous_current_time_; + base::Optional previous_current_time_; bool reset_current_time_on_resume_ = false; unsigned sequence_number_; @@ -445,9 +458,17 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, USING_FAST_MALLOC(CompositorState); public: + // TODO(https://crbug.com/1166397): Convert composited animations to use + // AnimationTimeDelta for start_time_ and hold_time_. explicit CompositorState(Animation& animation) - : start_time(animation.start_time_), - hold_time(animation.hold_time_), + : start_time(animation.start_time_ + ? base::make_optional( + animation.start_time_.value().InSecondsF()) + : base::nullopt), + hold_time(animation.hold_time_ + ? base::make_optional( + animation.hold_time_.value().InSecondsF()) + : base::nullopt), playback_rate(animation.EffectivePlaybackRate()), effect_changed(false), pending_action(animation.start_time_ ? kNone : kStart) {} @@ -503,6 +524,20 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, bool effect_suppressed_; + // True if the background color animation can be composited. Set by the + // BackgroundColorPaintWorklet::GetBGColorPaintWorkletParams. We keep it here + // instead of ElementAnimations such that when we create a compositor + // animation, we know which animation should fall back. Note that when we + // extend the native paint worklet to composite other types of animations in + // the future, we might need to extend this to be a fall back reasons. + bool can_composite_bgcolor_anim_ = false; + + // Animations with an owning element stop ticking if there is an active + // display lock on an ancestor element. Cache the status to minimize the + // number of tree walks. + base::TimeTicks last_display_lock_update_time_ = base::TimeTicks(); + bool is_in_display_locked_subtree_ = false; + FRIEND_TEST_ALL_PREFIXES(AnimationAnimationTestCompositeAfterPaint, NoCompositeWithoutCompositedElementId); FRIEND_TEST_ALL_PREFIXES(AnimationAnimationTestNoCompositing, diff --git a/chromium/third_party/blink/renderer/core/animation/animation.idl b/chromium/third_party/blink/renderer/core/animation/animation.idl index ee01f455ec1..0bdb34f11c0 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation.idl +++ b/chromium/third_party/blink/renderer/core/animation/animation.idl @@ -41,8 +41,8 @@ enum ReplaceState { "active", "removed", "persisted" }; [CallWith=ExecutionContext, RaisesException] constructor(optional AnimationEffect? effect = null, optional AnimationTimeline? timeline); [Measure] attribute AnimationEffect? effect; [RuntimeEnabled=WebAnimationsAPI] attribute AnimationTimeline? timeline; - [Measure, RaisesException=Setter] attribute double? startTime; - [Measure, RaisesException=Setter] attribute double? currentTime; + [Measure, RaisesException=Setter] attribute CSSNumberish? startTime; + [Measure, RaisesException=Setter] attribute CSSNumberish? currentTime; [Measure, RaisesException=Setter] attribute double playbackRate; [Measure] readonly attribute AnimationPlayState playState; [RuntimeEnabled=WebAnimationsAPI, Measure] readonly attribute ReplaceState replaceState; diff --git a/chromium/third_party/blink/renderer/core/animation/animation_effect.cc b/chromium/third_party/blink/renderer/core/animation/animation_effect.cc index 286f2d33216..6cdacfffe51 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation_effect.cc +++ b/chromium/third_party/blink/renderer/core/animation/animation_effect.cc @@ -47,7 +47,7 @@ AnimationEffect::AnimationEffect(const Timing& timing, timing_(timing), event_delegate_(event_delegate), needs_update_(true), - cancel_time_(0) { + cancel_time_(AnimationTimeDelta()) { timing_.AssertValid(); } @@ -131,7 +131,7 @@ base::Optional TimelinePhaseToTimingPhase( } void AnimationEffect::UpdateInheritedTime( - base::Optional inherited_time, + base::Optional inherited_time, base::Optional inherited_timeline_phase, TimingUpdateReason reason) const { base::Optional playback_rate = base::nullopt; @@ -152,7 +152,9 @@ void AnimationEffect::UpdateInheritedTime( last_update_time_ = inherited_time; last_update_phase_ = timeline_phase; - const base::Optional local_time = inherited_time; + const base::Optional local_time = + inherited_time ? base::make_optional(inherited_time.value().InSecondsF()) + : base::nullopt; if (needs_update) { Timing::CalculatedTiming calculated = SpecifiedTiming().CalculateTimings( local_time, timeline_phase, direction, IsA(this), diff --git a/chromium/third_party/blink/renderer/core/animation/animation_effect.h b/chromium/third_party/blink/renderer/core/animation/animation_effect.h index a2373d4f7de..c876426d7e9 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation_effect.h +++ b/chromium/third_party/blink/renderer/core/animation/animation_effect.h @@ -114,8 +114,10 @@ class CORE_EXPORT AnimationEffect : public ScriptWrappable { ComputedEffectTiming* getComputedTiming() const; void updateTiming(OptionalEffectTiming*, ExceptionState& = ASSERT_NO_EXCEPTION); - double GetCancelTime() const { return cancel_time_; } - void SetCancelTime(double cancel_time) { cancel_time_ = cancel_time; } + AnimationTimeDelta GetCancelTime() const { return cancel_time_; } + void SetCancelTime(AnimationTimeDelta cancel_time) { + cancel_time_ = cancel_time; + } // Attach/Detach the AnimationEffect from its owning animation. virtual void Attach(AnimationEffectOwner* owner) { owner_ = owner; } @@ -134,7 +136,7 @@ class CORE_EXPORT AnimationEffect : public ScriptWrappable { // When AnimationEffect receives a new inherited time via updateInheritedTime // it will (if necessary) recalculate timings and (if necessary) call // updateChildrenAndEffects. - void UpdateInheritedTime(base::Optional inherited_time, + void UpdateInheritedTime(base::Optional inherited_time, base::Optional inherited_phase, TimingUpdateReason) const; void Invalidate() const { needs_update_ = true; } @@ -168,9 +170,9 @@ class CORE_EXPORT AnimationEffect : public ScriptWrappable { mutable Timing::CalculatedTiming calculated_; mutable bool needs_update_; - mutable base::Optional last_update_time_; + mutable base::Optional last_update_time_; mutable base::Optional last_update_phase_; - double cancel_time_; + AnimationTimeDelta cancel_time_; const Timing::CalculatedTiming& EnsureCalculated() const; }; diff --git a/chromium/third_party/blink/renderer/core/animation/animation_effect_test.cc b/chromium/third_party/blink/renderer/core/animation/animation_effect_test.cc index bacd7956bf9..9a810175445 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation_effect_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/animation_effect_test.cc @@ -84,8 +84,9 @@ class TestAnimationEffect : public AnimationEffect { void UpdateInheritedTime(double time, TimingUpdateReason reason) { event_delegate_->Reset(); - AnimationEffect::UpdateInheritedTime( - time, /*inherited_phase*/ base::nullopt, reason); + AnimationEffect::UpdateInheritedTime(AnimationTimeDelta::FromSecondsD(time), + /*inherited_phase*/ base::nullopt, + reason); } void UpdateChildrenAndEffects() const override {} diff --git a/chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc b/chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc index fd95d13cd49..86a7a8b13d0 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc +++ b/chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc @@ -79,7 +79,7 @@ CSSPropertyID AnimationInputHelpers::KeyframeAttributeToCSSProperty( builder.Append('-'); builder.Append(property[i]); } - return cssPropertyID(document.GetExecutionContext(), builder.ToString()); + return CssPropertyID(document.GetExecutionContext(), builder.ToString()); } CSSPropertyID AnimationInputHelpers::KeyframeAttributeToPresentationAttribute( @@ -92,7 +92,7 @@ CSSPropertyID AnimationInputHelpers::KeyframeAttributeToPresentationAttribute( String unprefixed_property = RemoveSVGPrefix(property); if (SVGElement::IsAnimatableCSSProperty(QualifiedName( g_null_atom, AtomicString(unprefixed_property), g_null_atom))) { - return cssPropertyID(element->GetExecutionContext(), unprefixed_property); + return CssPropertyID(element->GetExecutionContext(), unprefixed_property); } return CSSPropertyID::kInvalid; } diff --git a/chromium/third_party/blink/renderer/core/animation/animation_test.cc b/chromium/third_party/blink/renderer/core/animation/animation_test.cc index 151f3417187..5916636297d 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/animation_test.cc @@ -68,14 +68,6 @@ namespace blink { -namespace { - -double MillisecondsToSeconds(double milliseconds) { - return milliseconds / 1000; -} - -} // namespace - void ExpectRelativeErrorWithinEpsilon(double expected, double observed) { EXPECT_NEAR(1.0, observed / expected, std::numeric_limits::epsilon()); } @@ -97,7 +89,7 @@ class AnimationAnimationTestNoCompositing : public RenderingTest { timeline = GetDocument().Timeline(); timeline->ResetForTesting(); animation = timeline->Play(nullptr); - animation->setStartTime(0); + animation->setStartTime(CSSNumberish::FromDouble(0)); animation->setEffect(MakeAnimation()); } @@ -193,8 +185,10 @@ class AnimationAnimationTestNoCompositing : public RenderingTest { } bool SimulateFrame(double time_ms) { - if (animation->pending()) - animation->NotifyReady(MillisecondsToSeconds(last_frame_time)); + if (animation->pending()) { + animation->NotifyReady( + AnimationTimeDelta::FromMillisecondsD(last_frame_time)); + } SimulateMicrotask(); last_frame_time = time_ms; @@ -222,6 +216,33 @@ class AnimationAnimationTestNoCompositing : public RenderingTest { GetPage().Animator().ServiceScriptedAnimations(new_time); } + bool StartTimeIsSet(Persistent animation) { + CSSNumberish start_time; + animation->startTime(start_time); + return !start_time.IsNull(); + } + + bool CurrentTimeIsSet(Persistent animation) { + CSSNumberish current_time; + animation->currentTime(current_time); + return !current_time.IsNull(); + } + + double GetStartTimeMs(Persistent animation) { + CSSNumberish start_time; + animation->startTime(start_time); + return start_time.GetAsDouble(); + } + + double GetCurrentTimeMs(Persistent animation) { + CSSNumberish current_time; + animation->currentTime(current_time); + return current_time.GetAsDouble(); + } + +#define EXPECT_TIME(expected, observed) \ + EXPECT_NEAR(expected, observed, Animation::kTimeToleranceMs) + Persistent timeline; Persistent animation; @@ -231,6 +252,38 @@ class AnimationAnimationTestNoCompositing : public RenderingTest { class AnimationAnimationTestCompositing : public AnimationAnimationTestNoCompositing { + public: + Animation* CreateAnimation(CSSPropertyID property_id, + String from, + String to) { + Timing timing; + timing.iteration_duration = AnimationTimeDelta::FromSecondsD(30); + + Persistent start_keyframe = + MakeGarbageCollected(); + start_keyframe->SetCSSPropertyValue( + property_id, from, SecureContextMode::kInsecureContext, nullptr); + Persistent end_keyframe = + MakeGarbageCollected(); + end_keyframe->SetCSSPropertyValue( + property_id, to, SecureContextMode::kInsecureContext, nullptr); + + StringKeyframeVector keyframes; + keyframes.push_back(start_keyframe); + keyframes.push_back(end_keyframe); + + Element* element = GetElementById("target"); + auto* model = MakeGarbageCollected(keyframes); + + NonThrowableExceptionState exception_state; + DocumentTimeline* timeline = + MakeGarbageCollected(&GetDocument()); + return Animation::Create( + MakeGarbageCollected(element, model, timing), timeline, + exception_state); + } + + private: void SetUp() override { EnableCompositing(); AnimationAnimationTestNoCompositing::SetUp(); @@ -250,155 +303,158 @@ class AnimationAnimationTestCompositeAfterPaint TEST_F(AnimationAnimationTestNoCompositing, InitialState) { SetUpWithoutStartingTimeline(); animation = timeline->Play(nullptr); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); EXPECT_TRUE(animation->pending()); EXPECT_FALSE(animation->Paused()); EXPECT_EQ(1, animation->playbackRate()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_FALSE(StartTimeIsSet(animation)); StartTimeline(); EXPECT_EQ("finished", animation->playState()); - EXPECT_EQ(0, timeline->CurrentTimeMilliseconds()); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, timeline->CurrentTimeMilliseconds().value()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); EXPECT_FALSE(animation->Paused()); EXPECT_FALSE(animation->pending()); EXPECT_EQ(1, animation->playbackRate()); - EXPECT_EQ(0, animation->startTime()); + EXPECT_TIME(0, GetStartTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, CurrentTimeDoesNotSetOutdated) { EXPECT_FALSE(animation->Outdated()); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); EXPECT_FALSE(animation->Outdated()); // FIXME: We should split simulateFrame into a version that doesn't update // the animation and one that does, as most of the tests don't require // update() to be called. GetDocument().GetAnimationClock().UpdateTime( base::TimeTicks() + base::TimeDelta::FromMilliseconds(10000)); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); EXPECT_FALSE(animation->Outdated()); } TEST_F(AnimationAnimationTestNoCompositing, SetCurrentTime) { EXPECT_EQ("running", animation->playState()); - animation->setCurrentTime(10000); + animation->setCurrentTime(CSSNumberish::FromDouble(10000)); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); SimulateFrame(10000); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetCurrentTimeNegative) { - animation->setCurrentTime(-10000); + animation->setCurrentTime(CSSNumberish::FromDouble(-10000)); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(-10000, animation->currentTime()); + EXPECT_TIME(-10000, GetCurrentTimeMs(animation)); SimulateFrame(20000); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); animation->setPlaybackRate(-2); - animation->setCurrentTime(-10000); + animation->setCurrentTime(CSSNumberish::FromDouble(-10000)); EXPECT_EQ("finished", animation->playState()); // A seek can set current time outside the range [0, EffectEnd()]. - EXPECT_EQ(-10000, animation->currentTime()); + EXPECT_TIME(-10000, GetCurrentTimeMs(animation)); SimulateFrame(40000); // Hold current time even though outside normal range for the animation. EXPECT_FALSE(animation->pending()); EXPECT_EQ("finished", animation->playState()); - EXPECT_EQ(-10000, animation->currentTime()); + EXPECT_TIME(-10000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetCurrentTimeNegativeWithoutSimultaneousPlaybackRateChange) { SimulateFrame(20000); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); EXPECT_EQ("running", animation->playState()); // Reversing the direction preserves current time. animation->setPlaybackRate(-1); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); SimulateAwaitReady(); SimulateFrame(30000); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); EXPECT_EQ("running", animation->playState()); - animation->setCurrentTime(-10000); + animation->setCurrentTime(CSSNumberish::FromDouble(-10000)); EXPECT_EQ("finished", animation->playState()); } TEST_F(AnimationAnimationTestNoCompositing, SetCurrentTimePastContentEnd) { - animation->setCurrentTime(50000); + animation->setCurrentTime(CSSNumberish::FromDouble(50000)); EXPECT_EQ("finished", animation->playState()); - EXPECT_EQ(50000, animation->currentTime()); + EXPECT_TIME(50000, GetCurrentTimeMs(animation)); SimulateFrame(20000); EXPECT_EQ("finished", animation->playState()); - EXPECT_EQ(50000, animation->currentTime()); + EXPECT_TIME(50000, GetCurrentTimeMs(animation)); // Reversing the play direction changes the play state from finished to // running. animation->setPlaybackRate(-2); - animation->setCurrentTime(50000); + animation->setCurrentTime(CSSNumberish::FromDouble(50000)); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(50000, animation->currentTime()); + EXPECT_TIME(50000, GetCurrentTimeMs(animation)); SimulateAwaitReady(); SimulateFrame(40000); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetCurrentTimeMax) { double limit = std::numeric_limits::max(); - animation->setCurrentTime(limit); - ExpectRelativeErrorWithinEpsilon(limit, animation->currentTime().value()); + animation->setCurrentTime(CSSNumberish::FromDouble(limit)); + CSSNumberish current_time; + animation->currentTime(current_time); + ExpectRelativeErrorWithinEpsilon(limit, current_time.GetAsDouble()); SimulateFrame(100000); - ExpectRelativeErrorWithinEpsilon(limit, animation->currentTime().value()); + animation->currentTime(current_time); + ExpectRelativeErrorWithinEpsilon(limit, current_time.GetAsDouble()); } TEST_F(AnimationAnimationTestNoCompositing, SetCurrentTimeSetsStartTime) { - EXPECT_EQ(0, animation->startTime()); - animation->setCurrentTime(1000); - EXPECT_EQ(-1000, animation->startTime()); + EXPECT_TIME(0, GetStartTimeMs(animation)); + animation->setCurrentTime(CSSNumberish::FromDouble(1000)); + EXPECT_TIME(-1000, GetStartTimeMs(animation)); SimulateFrame(1000); - EXPECT_EQ(-1000, animation->startTime()); - EXPECT_EQ(2000, animation->currentTime()); + EXPECT_TIME(-1000, GetStartTimeMs(animation)); + EXPECT_TIME(2000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetStartTime) { SimulateFrame(20000); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(0, animation->startTime()); - EXPECT_EQ(20000, animation->currentTime()); - animation->setStartTime(10000); + EXPECT_TIME(0, GetStartTimeMs(animation)); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); + animation->setStartTime(CSSNumberish::FromDouble(10000)); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(10000, animation->startTime()); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetStartTimeMs(animation)); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); SimulateFrame(30000); - EXPECT_EQ(10000, animation->startTime()); - EXPECT_EQ(20000, animation->currentTime()); - animation->setStartTime(-20000); + EXPECT_TIME(10000, GetStartTimeMs(animation)); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); + animation->setStartTime(CSSNumberish::FromDouble(-20000)); EXPECT_EQ("finished", animation->playState()); } TEST_F(AnimationAnimationTestNoCompositing, SetStartTimeLimitsAnimation) { // Setting the start time is a seek operation, which is not constrained by the // normal limits on the animation. - animation->setStartTime(-50000); + animation->setStartTime(CSSNumberish::FromDouble(-50000)); EXPECT_EQ("finished", animation->playState()); EXPECT_TRUE(animation->Limited()); - EXPECT_EQ(50000, animation->currentTime()); + EXPECT_TIME(50000, GetCurrentTimeMs(animation)); animation->setPlaybackRate(-1); EXPECT_EQ("running", animation->playState()); - animation->setStartTime(-100000); + animation->setStartTime(CSSNumberish::FromDouble(-100000)); EXPECT_EQ("finished", animation->playState()); - EXPECT_EQ(-100000, animation->currentTime()); + EXPECT_TIME(-100000, GetCurrentTimeMs(animation)); EXPECT_TRUE(animation->Limited()); } @@ -406,15 +462,15 @@ TEST_F(AnimationAnimationTestNoCompositing, SetStartTimeOnLimitedAnimation) { // The setStartTime method is a seek and thus not constrained by the normal // limits on the animation. SimulateFrame(30000); - animation->setStartTime(-10000); + animation->setStartTime(CSSNumberish::FromDouble(-10000)); EXPECT_EQ("finished", animation->playState()); - EXPECT_EQ(40000, animation->currentTime()); + EXPECT_TIME(40000, GetCurrentTimeMs(animation)); EXPECT_TRUE(animation->Limited()); - animation->setCurrentTime(50000); - EXPECT_EQ(50000, animation->currentTime()); - animation->setStartTime(-40000); - EXPECT_EQ(70000, animation->currentTime()); + animation->setCurrentTime(CSSNumberish::FromDouble(50000)); + EXPECT_TIME(50000, GetCurrentTimeMs(animation)); + animation->setStartTime(CSSNumberish::FromDouble(-40000)); + EXPECT_TIME(70000, GetCurrentTimeMs(animation)); EXPECT_EQ("finished", animation->playState()); EXPECT_TRUE(animation->Limited()); } @@ -426,11 +482,11 @@ TEST_F(AnimationAnimationTestNoCompositing, StartTimePauseFinish) { EXPECT_TRUE(animation->pending()); SimulateAwaitReady(); EXPECT_FALSE(animation->pending()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_FALSE(StartTimeIsSet(animation)); animation->finish(exception_state); EXPECT_EQ("finished", animation->playState()); EXPECT_FALSE(animation->pending()); - EXPECT_EQ(-30000, animation->startTime()); + EXPECT_TIME(-30000, GetStartTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, FinishWhenPaused) { @@ -449,24 +505,24 @@ TEST_F(AnimationAnimationTestNoCompositing, FinishWhenPaused) { TEST_F(AnimationAnimationTestNoCompositing, StartTimeFinishPause) { NonThrowableExceptionState exception_state; animation->finish(exception_state); - EXPECT_EQ(-30000, animation->startTime()); + EXPECT_TIME(-30000, GetStartTimeMs(animation)); animation->pause(); EXPECT_EQ("paused", animation->playState()); EXPECT_TRUE(animation->pending()); SimulateAwaitReady(); EXPECT_FALSE(animation->pending()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_FALSE(StartTimeIsSet(animation)); } TEST_F(AnimationAnimationTestNoCompositing, StartTimeWithZeroPlaybackRate) { animation->setPlaybackRate(0); EXPECT_EQ("running", animation->playState()); SimulateAwaitReady(); - EXPECT_TRUE(animation->startTime().has_value()); + EXPECT_TRUE(StartTimeIsSet(animation)); SimulateFrame(10000); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, PausePlay) { @@ -475,13 +531,13 @@ TEST_F(AnimationAnimationTestNoCompositing, PausePlay) { animation->pause(); EXPECT_EQ("paused", animation->playState()); EXPECT_TRUE(animation->pending()); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); // Resume playing the animation at the 20s mark. SimulateFrame(20000); EXPECT_EQ("paused", animation->playState()); EXPECT_FALSE(animation->pending()); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); animation->play(); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); @@ -490,19 +546,19 @@ TEST_F(AnimationAnimationTestNoCompositing, PausePlay) { // Advance another 10s. SimulateFrame(30000); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, PlayRewindsToStart) { // Auto-replay when starting from limit. - animation->setCurrentTime(30000); + animation->setCurrentTime(CSSNumberish::FromDouble(30000)); animation->play(); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); // Auto-replay when starting past the upper bound. - animation->setCurrentTime(40000); + animation->setCurrentTime(CSSNumberish::FromDouble(40000)); animation->play(); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); @@ -510,11 +566,11 @@ TEST_F(AnimationAnimationTestNoCompositing, PlayRewindsToStart) { // from a negative value of current time. SimulateFrame(10000); EXPECT_FALSE(animation->pending()); - animation->setCurrentTime(-10000); + animation->setCurrentTime(CSSNumberish::FromDouble(-10000)); EXPECT_EQ("running", animation->playState()); EXPECT_FALSE(animation->pending()); animation->play(); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); SimulateAwaitReady(); @@ -526,14 +582,14 @@ TEST_F(AnimationAnimationTestNoCompositing, PlayRewindsToEnd) { // Snap to end when playing a reversed animation from the start. animation->setPlaybackRate(-1); animation->play(); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); // Snap to end if playing a reversed animation starting past the upper limit. - animation->setCurrentTime(40000); + animation->setCurrentTime(CSSNumberish::FromDouble(40000)); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); animation->play(); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); EXPECT_TRUE(animation->pending()); SimulateFrame(10000); @@ -542,9 +598,9 @@ TEST_F(AnimationAnimationTestNoCompositing, PlayRewindsToEnd) { // Snap to the end if playing a reversed animation starting with a negative // value for current time. - animation->setCurrentTime(-10000); + animation->setCurrentTime(CSSNumberish::FromDouble(-10000)); animation->play(); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); @@ -559,15 +615,15 @@ TEST_F(AnimationAnimationTestNoCompositing, // becomes the hold time. animation->setPlaybackRate(0); animation->play(); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); - animation->setCurrentTime(40000); + animation->setCurrentTime(CSSNumberish::FromDouble(40000)); animation->play(); - EXPECT_EQ(40000, animation->currentTime()); + EXPECT_TIME(40000, GetCurrentTimeMs(animation)); - animation->setCurrentTime(-10000); + animation->setCurrentTime(CSSNumberish::FromDouble(-10000)); animation->play(); - EXPECT_EQ(-10000, animation->currentTime()); + EXPECT_TIME(-10000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, @@ -583,76 +639,76 @@ TEST_F(AnimationAnimationTestNoCompositing, } TEST_F(AnimationAnimationTestNoCompositing, Reverse) { - animation->setCurrentTime(10000); + animation->setCurrentTime(CSSNumberish::FromDouble(10000)); animation->pause(); animation->reverse(); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); // Effective playback rate does not kick in until the animation is ready. EXPECT_EQ(1, animation->playbackRate()); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); SimulateAwaitReady(); EXPECT_FALSE(animation->pending()); EXPECT_EQ(-1, animation->playbackRate()); // Updating the playback rate does not change current time. - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, ReverseHoldsCurrentTimeWithPlaybackRateZero) { - animation->setCurrentTime(10000); + animation->setCurrentTime(CSSNumberish::FromDouble(10000)); animation->setPlaybackRate(0); animation->pause(); animation->reverse(); SimulateAwaitReady(); EXPECT_EQ("running", animation->playState()); EXPECT_EQ(0, animation->playbackRate()); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); SimulateFrame(20000); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, ReverseSeeksToStart) { - animation->setCurrentTime(-10000); + animation->setCurrentTime(CSSNumberish::FromDouble(-10000)); animation->setPlaybackRate(-1); animation->reverse(); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, ReverseSeeksToEnd) { - animation->setCurrentTime(40000); + animation->setCurrentTime(CSSNumberish::FromDouble(40000)); animation->reverse(); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, ReverseBeyondLimit) { - animation->setCurrentTime(40000); + animation->setCurrentTime(CSSNumberish::FromDouble(40000)); animation->setPlaybackRate(-1); animation->reverse(); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); - animation->setCurrentTime(-10000); + animation->setCurrentTime(CSSNumberish::FromDouble(-10000)); animation->reverse(); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, Finish) { NonThrowableExceptionState exception_state; animation->finish(exception_state); // Finished snaps to the end of the animation. - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); EXPECT_EQ("finished", animation->playState()); // Finished is a synchronous operation. EXPECT_FALSE(animation->pending()); animation->setPlaybackRate(-1); animation->finish(exception_state); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); EXPECT_EQ("finished", animation->playState()); EXPECT_FALSE(animation->pending()); } @@ -660,28 +716,28 @@ TEST_F(AnimationAnimationTestNoCompositing, Finish) { TEST_F(AnimationAnimationTestNoCompositing, FinishAfterEffectEnd) { NonThrowableExceptionState exception_state; // OK to set current time out of bounds. - animation->setCurrentTime(40000); + animation->setCurrentTime(CSSNumberish::FromDouble(40000)); animation->finish(exception_state); // The finish method triggers a snap to the upper boundary. - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, FinishBeforeStart) { NonThrowableExceptionState exception_state; - animation->setCurrentTime(-10000); + animation->setCurrentTime(CSSNumberish::FromDouble(-10000)); animation->setPlaybackRate(-1); animation->finish(exception_state); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, FinishDoesNothingWithPlaybackRateZero) { // Cannot finish an animation that has a playback rate of zero. DummyExceptionStateForTesting exception_state; - animation->setCurrentTime(10000); + animation->setCurrentTime(CSSNumberish::FromDouble(10000)); animation->setPlaybackRate(0); animation->finish(exception_state); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); EXPECT_TRUE(exception_state.HadException()); } @@ -693,11 +749,11 @@ TEST_F(AnimationAnimationTestNoCompositing, FinishRaisesException) { timing.iteration_count = std::numeric_limits::infinity(); animation->setEffect(MakeGarbageCollected( nullptr, MakeEmptyEffectModel(), timing)); - animation->setCurrentTime(10000); + animation->setCurrentTime(CSSNumberish::FromDouble(10000)); DummyExceptionStateForTesting exception_state; animation->finish(exception_state); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); EXPECT_TRUE(exception_state.HadException()); EXPECT_EQ(DOMExceptionCode::kInvalidStateError, exception_state.CodeAs()); @@ -705,12 +761,12 @@ TEST_F(AnimationAnimationTestNoCompositing, FinishRaisesException) { TEST_F(AnimationAnimationTestNoCompositing, LimitingAtEffectEnd) { SimulateFrame(30000); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); EXPECT_TRUE(animation->Limited()); // Cannot run past the end of the animation without a seek. SimulateFrame(40000); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); EXPECT_FALSE(animation->Paused()); } @@ -720,11 +776,11 @@ TEST_F(AnimationAnimationTestNoCompositing, LimitingAtStart) { SimulateAwaitReady(); SimulateFrame(45000); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); EXPECT_TRUE(animation->Limited()); SimulateFrame(60000); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); EXPECT_FALSE(animation->Paused()); } @@ -732,75 +788,75 @@ TEST_F(AnimationAnimationTestNoCompositing, LimitingWithNoEffect) { animation->setEffect(nullptr); EXPECT_TRUE(animation->Limited()); SimulateFrame(30000); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetPlaybackRate) { animation->setPlaybackRate(2); SimulateAwaitReady(); EXPECT_EQ(2, animation->playbackRate()); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); SimulateFrame(10000); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetPlaybackRateWhilePaused) { SimulateFrame(10000); animation->pause(); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); animation->setPlaybackRate(2); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); SimulateAwaitReady(); SimulateFrame(20000); animation->play(); // Change to playback rate does not alter current time. - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); SimulateAwaitReady(); SimulateFrame(25000); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetPlaybackRateWhileLimited) { // Animation plays until it hits the upper bound. SimulateFrame(40000); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); EXPECT_TRUE(animation->Limited()); animation->setPlaybackRate(2); SimulateAwaitReady(); // Already at the end of the animation. SimulateFrame(50000); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); animation->setPlaybackRate(-2); SimulateAwaitReady(); SimulateFrame(60000); EXPECT_FALSE(animation->Limited()); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetPlaybackRateZero) { SimulateFrame(10000); animation->setPlaybackRate(0); - EXPECT_EQ(10000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); SimulateFrame(20000); - EXPECT_EQ(10000, animation->currentTime()); - animation->setCurrentTime(20000); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); + animation->setCurrentTime(CSSNumberish::FromDouble(20000)); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetPlaybackRateMax) { animation->setPlaybackRate(std::numeric_limits::max()); EXPECT_EQ(std::numeric_limits::max(), animation->playbackRate()); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); SimulateAwaitReady(); SimulateFrame(1); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, UpdatePlaybackRate) { @@ -808,10 +864,10 @@ TEST_F(AnimationAnimationTestNoCompositing, UpdatePlaybackRate) { EXPECT_EQ(1, animation->playbackRate()); SimulateAwaitReady(); EXPECT_EQ(2, animation->playbackRate()); - EXPECT_EQ(0, animation->currentTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); SimulateFrame(10000); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, UpdatePlaybackRateWhilePaused) { @@ -836,11 +892,11 @@ TEST_F(AnimationAnimationTestNoCompositing, UpdatePlaybackRateWhilePaused) { TEST_F(AnimationAnimationTestNoCompositing, UpdatePlaybackRateWhileLimited) { NonThrowableExceptionState exception_state; animation->finish(exception_state); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); // Updating playback rate does not affect current time. animation->updatePlaybackRate(2); - EXPECT_EQ(30000, animation->currentTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); // Updating payback rate is resolved immediately for an animation in the // finished state. @@ -863,36 +919,36 @@ TEST_F(AnimationAnimationTestNoCompositing, UpdatePlaybackRateWhileRunning) { TEST_F(AnimationAnimationTestNoCompositing, SetEffect) { animation = timeline->Play(nullptr); - animation->setStartTime(0); + animation->setStartTime(CSSNumberish::FromDouble(0)); AnimationEffect* effect1 = MakeAnimation(); AnimationEffect* effect2 = MakeAnimation(); animation->setEffect(effect1); EXPECT_EQ(effect1, animation->effect()); - EXPECT_EQ(0, animation->currentTime()); - animation->setCurrentTime(15000); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); + animation->setCurrentTime(CSSNumberish::FromDouble(15000)); animation->setEffect(effect2); - EXPECT_EQ(15000, animation->currentTime()); + EXPECT_TIME(15000, GetCurrentTimeMs(animation)); EXPECT_EQ(nullptr, effect1->GetAnimationForTesting()); EXPECT_EQ(animation, effect2->GetAnimationForTesting()); EXPECT_EQ(effect2, animation->effect()); } TEST_F(AnimationAnimationTestNoCompositing, SetEffectLimitsAnimation) { - animation->setCurrentTime(20000); + animation->setCurrentTime(CSSNumberish::FromDouble(20000)); animation->setEffect(MakeAnimation(10)); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); EXPECT_TRUE(animation->Limited()); SimulateFrame(10000); - EXPECT_EQ(20000, animation->currentTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, SetEffectUnlimitsAnimation) { - animation->setCurrentTime(40000); + animation->setCurrentTime(CSSNumberish::FromDouble(40000)); animation->setEffect(MakeAnimation(60)); EXPECT_FALSE(animation->Limited()); - EXPECT_EQ(40000, animation->currentTime()); + EXPECT_TIME(40000, GetCurrentTimeMs(animation)); SimulateFrame(10000); - EXPECT_EQ(50000, animation->currentTime()); + EXPECT_TIME(50000, GetCurrentTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, EmptyAnimationsDontUpdateEffects) { @@ -912,6 +968,10 @@ TEST_F(AnimationAnimationTestNoCompositing, AnimationsDisassociateFromEffect) { EXPECT_EQ(nullptr, animation2->effect()); } +#define EXPECT_TIMEDELTA(expected, observed) \ + EXPECT_NEAR(expected.InMillisecondsF(), observed.InMillisecondsF(), \ + Animation::kTimeToleranceMs) + TEST_F(AnimationAnimationTestNoCompositing, AnimationsReturnTimeToNextEffect) { Timing timing; timing.start_delay = 1; @@ -920,46 +980,48 @@ TEST_F(AnimationAnimationTestNoCompositing, AnimationsReturnTimeToNextEffect) { auto* keyframe_effect = MakeGarbageCollected( nullptr, MakeEmptyEffectModel(), timing); animation = timeline->Play(keyframe_effect); - animation->setStartTime(0); + animation->setStartTime(CSSNumberish::FromDouble(0)); // Next effect change at end of start delay. SimulateFrame(0); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(1), - animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(1), + animation->TimeToEffectChange().value()); // Next effect change at end of start delay. SimulateFrame(500); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(0.5), - animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(0.5), + animation->TimeToEffectChange().value()); // Start of active phase. SimulateFrame(1000); - EXPECT_EQ(AnimationTimeDelta(), animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + animation->TimeToEffectChange().value()); // Still in active phase. SimulateFrame(1500); - EXPECT_EQ(AnimationTimeDelta(), animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + animation->TimeToEffectChange().value()); // Start of the after phase. Next effect change at end of after phase. SimulateFrame(2000); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(1), - animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(1), + animation->TimeToEffectChange().value()); // Still in effect if fillmode = forward|both. SimulateFrame(3000); EXPECT_EQ(base::nullopt, animation->TimeToEffectChange()); // Reset to start of animation. Next effect at the end of the start delay. - animation->setCurrentTime(0); + animation->setCurrentTime(CSSNumberish::FromDouble(0)); SimulateFrame(3000); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(1), - animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(1), + animation->TimeToEffectChange().value()); // Start delay is scaled by playback rate. animation->setPlaybackRate(2); SimulateFrame(3000); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(0.5), - animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(0.5), + animation->TimeToEffectChange().value()); // Effectively a paused animation. animation->setPlaybackRate(0); @@ -967,23 +1029,24 @@ TEST_F(AnimationAnimationTestNoCompositing, AnimationsReturnTimeToNextEffect) { EXPECT_EQ(base::nullopt, animation->TimeToEffectChange()); // Reversed animation from end time. Next effect after end delay. - animation->setCurrentTime(3000); + animation->setCurrentTime(CSSNumberish::FromDouble(3000)); animation->setPlaybackRate(-1); animation->Update(kTimingUpdateOnDemand); SimulateFrame(3000); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(1), - animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(1), + animation->TimeToEffectChange().value()); // End delay is scaled by playback rate. animation->setPlaybackRate(-2); animation->Update(kTimingUpdateOnDemand); SimulateFrame(3000); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(0.5), - animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(0.5), + animation->TimeToEffectChange().value()); } TEST_F(AnimationAnimationTestNoCompositing, TimeToNextEffectWhenPaused) { - EXPECT_EQ(AnimationTimeDelta(), animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + animation->TimeToEffectChange().value()); animation->pause(); EXPECT_TRUE(animation->pending()); EXPECT_EQ("paused", animation->playState()); @@ -995,8 +1058,9 @@ TEST_F(AnimationAnimationTestNoCompositing, TimeToNextEffectWhenPaused) { TEST_F(AnimationAnimationTestNoCompositing, TimeToNextEffectWhenCancelledBeforeStart) { - EXPECT_EQ(AnimationTimeDelta(), animation->TimeToEffectChange()); - animation->setCurrentTime(-8000); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + animation->TimeToEffectChange().value()); + animation->setCurrentTime(CSSNumberish::FromDouble(-8000)); animation->setPlaybackRate(2); EXPECT_EQ("running", animation->playState()); animation->cancel(); @@ -1010,8 +1074,9 @@ TEST_F(AnimationAnimationTestNoCompositing, TEST_F(AnimationAnimationTestNoCompositing, TimeToNextEffectWhenCancelledBeforeStartReverse) { - EXPECT_EQ(AnimationTimeDelta(), animation->TimeToEffectChange()); - animation->setCurrentTime(9000); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + animation->TimeToEffectChange().value()); + animation->setCurrentTime(CSSNumberish::FromDouble(9000)); animation->setPlaybackRate(-3); EXPECT_EQ("running", animation->playState()); animation->cancel(); @@ -1023,7 +1088,8 @@ TEST_F(AnimationAnimationTestNoCompositing, TEST_F(AnimationAnimationTestNoCompositing, TimeToNextEffectSimpleCancelledBeforeStart) { - EXPECT_EQ(AnimationTimeDelta(), animation->TimeToEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + animation->TimeToEffectChange().value()); EXPECT_EQ("running", animation->playState()); animation->cancel(); EXPECT_EQ("idle", animation->playState()); @@ -1059,99 +1125,99 @@ TEST_F(AnimationAnimationTestNoCompositing, HasLowerCompositeOrdering) { TEST_F(AnimationAnimationTestNoCompositing, PlayAfterCancel) { animation->cancel(); EXPECT_EQ("idle", animation->playState()); - EXPECT_FALSE(animation->currentTime().has_value()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_FALSE(CurrentTimeIsSet(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); animation->play(); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); - EXPECT_EQ(0, animation->currentTime()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); SimulateAwaitReady(); EXPECT_FALSE(animation->pending()); - EXPECT_EQ(0, animation->currentTime()); - EXPECT_EQ(0, animation->startTime()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); + EXPECT_TIME(0, GetStartTimeMs(animation)); SimulateFrame(10000); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(10000, animation->currentTime()); - EXPECT_EQ(0, animation->startTime()); + EXPECT_TIME(10000, GetCurrentTimeMs(animation)); + EXPECT_TIME(0, GetStartTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, PlayBackwardsAfterCancel) { animation->setPlaybackRate(-1); - animation->setCurrentTime(15000); + animation->setCurrentTime(CSSNumberish::FromDouble(15000)); animation->cancel(); EXPECT_EQ("idle", animation->playState()); EXPECT_FALSE(animation->pending()); - EXPECT_FALSE(animation->currentTime().has_value()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_FALSE(CurrentTimeIsSet(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); // Snap to the end of the animation. animation->play(); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); - EXPECT_EQ(30000, animation->currentTime()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); SimulateAwaitReady(); EXPECT_FALSE(animation->pending()); - EXPECT_EQ(30000, animation->startTime()); + EXPECT_TIME(30000, GetStartTimeMs(animation)); SimulateFrame(10000); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(20000, animation->currentTime()); - EXPECT_EQ(30000, animation->startTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); + EXPECT_TIME(30000, GetStartTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, ReverseAfterCancel) { animation->cancel(); EXPECT_EQ("idle", animation->playState()); EXPECT_FALSE(animation->pending()); - EXPECT_FALSE(animation->currentTime().has_value()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_FALSE(CurrentTimeIsSet(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); // Reverse snaps to the end of the animation. animation->reverse(); EXPECT_EQ("running", animation->playState()); EXPECT_TRUE(animation->pending()); - EXPECT_EQ(30000, animation->currentTime()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); SimulateAwaitReady(); EXPECT_FALSE(animation->pending()); - EXPECT_EQ(30000, animation->startTime()); + EXPECT_TIME(30000, GetStartTimeMs(animation)); SimulateFrame(10000); EXPECT_EQ("running", animation->playState()); - EXPECT_EQ(20000, animation->currentTime()); - EXPECT_EQ(30000, animation->startTime()); + EXPECT_TIME(20000, GetCurrentTimeMs(animation)); + EXPECT_TIME(30000, GetStartTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, FinishAfterCancel) { NonThrowableExceptionState exception_state; animation->cancel(); EXPECT_EQ("idle", animation->playState()); - EXPECT_FALSE(animation->currentTime().has_value()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_FALSE(CurrentTimeIsSet(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); animation->finish(exception_state); EXPECT_EQ("finished", animation->playState()); - EXPECT_EQ(30000, animation->currentTime()); - EXPECT_EQ(-30000, animation->startTime()); + EXPECT_TIME(30000, GetCurrentTimeMs(animation)); + EXPECT_TIME(-30000, GetStartTimeMs(animation)); } TEST_F(AnimationAnimationTestNoCompositing, PauseAfterCancel) { animation->cancel(); EXPECT_EQ("idle", animation->playState()); - EXPECT_FALSE(animation->currentTime().has_value()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_FALSE(CurrentTimeIsSet(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); animation->pause(); EXPECT_EQ("paused", animation->playState()); EXPECT_TRUE(animation->pending()); - EXPECT_EQ(0, animation->currentTime()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); SimulateAwaitReady(); EXPECT_FALSE(animation->pending()); - EXPECT_EQ(0, animation->currentTime()); - EXPECT_FALSE(animation->startTime().has_value()); + EXPECT_TIME(0, GetCurrentTimeMs(animation)); + EXPECT_FALSE(StartTimeIsSet(animation)); } // crbug.com/1052217 @@ -1169,7 +1235,8 @@ TEST_F(AnimationAnimationTestNoCompositing, SetPlaybackRateAfterFinish) { EXPECT_EQ(animation->playbackRate(), -1); EXPECT_TRUE(animation->Outdated()); animation->Update(kTimingUpdateOnDemand); - EXPECT_EQ(0, animation->TimeToEffectChange()->InSecondsF()); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + animation->TimeToEffectChange().value()); EXPECT_FALSE(animation->Outdated()); } @@ -1189,7 +1256,8 @@ TEST_F(AnimationAnimationTestNoCompositing, UpdatePlaybackRateAfterFinish) { EXPECT_EQ(animation->playbackRate(), -1); EXPECT_TRUE(animation->Outdated()); animation->Update(kTimingUpdateOnDemand); - EXPECT_EQ(0, animation->TimeToEffectChange()->InSecondsF()); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + animation->TimeToEffectChange().value()); EXPECT_FALSE(animation->Outdated()); } @@ -1302,7 +1370,7 @@ TEST_F(AnimationAnimationTestCompositing, PreCommitRecordsHistograms) { // Now make the playback rate 0. This trips both the invalid animation and // unsupported timing parameter reasons. animation->setPlaybackRate(0); - animation->NotifyReady(100); + animation->NotifyReady(AnimationTimeDelta::FromSecondsD(100)); { HistogramTester histogram; ASSERT_TRUE(animation->PreCommit(0, nullptr, true)); @@ -1403,6 +1471,163 @@ TEST_F(AnimationAnimationTestCompositing, InfiniteDurationAnimation) { animation->CheckCanStartAnimationOnCompositor(nullptr)); } +// This test ensures that a background-color animation can start on compositor. +TEST_F(AnimationAnimationTestCompositing, BackgroundColorComposited) { + ScopedCompositeBGColorAnimationForTest composite_bgcolor_animation(true); + SetBodyInnerHTML(R"HTML( +
+
+ )HTML"); + + Animation* animation = + CreateAnimation(CSSPropertyID::kBackgroundColor, "red", "green"); + + UpdateAllLifecyclePhasesForTest(); + animation->play(); + // A basic condition for an animation to be compositable is that it is set so + // by BackgroundColorPaintWorklet::GetBGColorPaintWorkletParams. + animation->SetCanCompositeBGColorAnim(); + EXPECT_EQ(animation->CheckCanStartAnimationOnCompositor(nullptr), + CompositorAnimations::kNoFailure); +} + +// crbug.com/1149012 +// Regression test to ensure proper restart logic for composited animations on +// relative transforms after a size change. In this test, the transform depends +// on the width and height of the box and a change to either triggers a restart +// of the animation if running. +TEST_F(AnimationAnimationTestCompositing, + RestartCompositedAnimationOnSizeChange) { + // TODO(crbug.com/389359): Remove forced feature enabling once on by + // default. + ScopedCompositeRelativeKeyframesForTest composite_relative_keyframes(true); + SetBodyInnerHTML(R"HTML( +
+
+ )HTML"); + + Animation* animation = CreateAnimation( + CSSPropertyID::kTransform, "translate(100%, 100%)", "translate(0%, 0%)"); + + UpdateAllLifecyclePhasesForTest(); + animation->play(); + KeyframeEffect* keyframe_effect = + DynamicTo(animation->effect()); + ASSERT_TRUE(keyframe_effect); + + EXPECT_EQ(animation->CheckCanStartAnimationOnCompositor(nullptr), + CompositorAnimations::kNoFailure); + + GetDocument().GetPendingAnimations().Update(nullptr, true); + EXPECT_TRUE(animation->HasActiveAnimationsOnCompositor()); + + // Kick the animation out of the play-pending state. + animation->setStartTime(CSSNumberish::FromDouble(0)); + + // No size change and animation does not require a restart. + keyframe_effect->UpdateBoxSizeAndCheckTransformAxisAlignment( + FloatSize(100, 200)); + EXPECT_TRUE(animation->HasActiveAnimationsOnCompositor()); + + // Restart animation on a width change. + keyframe_effect->UpdateBoxSizeAndCheckTransformAxisAlignment( + FloatSize(200, 200)); + EXPECT_FALSE(animation->HasActiveAnimationsOnCompositor()); + + GetDocument().GetPendingAnimations().Update(nullptr, true); + EXPECT_TRUE(animation->HasActiveAnimationsOnCompositor()); + + // Restart animation on a height change. + keyframe_effect->UpdateBoxSizeAndCheckTransformAxisAlignment( + FloatSize(200, 300)); + EXPECT_FALSE(animation->HasActiveAnimationsOnCompositor()); +} + +// crbug.com/1149012 +// Regression test to ensure proper restart logic for composited animations on +// relative transforms after a size change. In this test, the transform only +// depends on width and a change to the height does not trigger a restart. +TEST_F(AnimationAnimationTestCompositing, + RestartCompositedAnimationOnWidthChange) { + // TODO(crbug.com/389359): Remove forced feature enabling once on by + // default. + ScopedCompositeRelativeKeyframesForTest composite_relative_keyframes(true); + SetBodyInnerHTML(R"HTML( +
+
+ )HTML"); + + animation = CreateAnimation(CSSPropertyID::kTransform, "translateX(100%)", + "translateX(0%)"); + + UpdateAllLifecyclePhasesForTest(); + animation->play(); + KeyframeEffect* keyframe_effect = + DynamicTo(animation->effect()); + ASSERT_TRUE(keyframe_effect); + + GetDocument().GetPendingAnimations().Update(nullptr, true); + EXPECT_TRUE(animation->HasActiveAnimationsOnCompositor()); + keyframe_effect->UpdateBoxSizeAndCheckTransformAxisAlignment( + FloatSize(100, 200)); + animation->setStartTime(CSSNumberish::FromDouble(0)); + + // Transform is not height dependent and a change to the height does not force + // an animation restart. + keyframe_effect->UpdateBoxSizeAndCheckTransformAxisAlignment( + FloatSize(100, 300)); + EXPECT_TRUE(animation->HasActiveAnimationsOnCompositor()); + + // Width change forces a restart. + keyframe_effect->UpdateBoxSizeAndCheckTransformAxisAlignment( + FloatSize(200, 300)); + EXPECT_FALSE(animation->HasActiveAnimationsOnCompositor()); +} + +// crbug.com/1149012 +// Regression test to ensure proper restart logic for composited animations on +// relative transforms after a size change. In this test, the transition only +// affects height and a change to the width does not trigger a restart. +TEST_F(AnimationAnimationTestCompositing, + RestartCompositedAnimationOnHeightChange) { + // TODO(crbug.com/389359): Remove forced feature enabling once on by + // default. + ScopedCompositeRelativeKeyframesForTest composite_relative_keyframes(true); + SetBodyInnerHTML(R"HTML( +
+
+ )HTML"); + + animation = CreateAnimation(CSSPropertyID::kTransform, "translateY(100%)", + "translateY(0%)"); + + UpdateAllLifecyclePhasesForTest(); + animation->play(); + KeyframeEffect* keyframe_effect = + DynamicTo(animation->effect()); + ASSERT_TRUE(keyframe_effect); + + GetDocument().GetPendingAnimations().Update(nullptr, true); + EXPECT_TRUE(animation->HasActiveAnimationsOnCompositor()); + keyframe_effect->UpdateBoxSizeAndCheckTransformAxisAlignment( + FloatSize(100, 200)); + animation->setStartTime(CSSNumberish::FromDouble(0)); + + // Transform is not width dependent and a change to the width does not force + // an animation restart. + keyframe_effect->UpdateBoxSizeAndCheckTransformAxisAlignment( + FloatSize(300, 200)); + EXPECT_TRUE(animation->HasActiveAnimationsOnCompositor()); + + // Height change forces a restart. + keyframe_effect->UpdateBoxSizeAndCheckTransformAxisAlignment( + FloatSize(300, 400)); + EXPECT_FALSE(animation->HasActiveAnimationsOnCompositor()); +} + TEST_F(AnimationAnimationTestCompositing, ScrollLinkedAnimationCanBeComposited) { ResetWithCompositedAnimation(); @@ -1533,7 +1758,7 @@ TEST_F(AnimationAnimationTestCompositing, UpdateAllLifecyclePhasesForTest(); const double TEST_START_TIME = 10; - scroll_animation->setStartTime(TEST_START_TIME); + scroll_animation->setStartTime(CSSNumberish::FromDouble(TEST_START_TIME)); scroll_animation->play(); EXPECT_EQ(scroll_animation->CheckCanStartAnimationOnCompositor(nullptr), CompositorAnimations::kNoFailure); @@ -1581,25 +1806,25 @@ TEST_F(AnimationAnimationTestNoCompositing, ScrollLinkedAnimationCreation) { Animation::Create(MakeAnimation(), scroll_timeline, exception_state); // Verify start and current times in Idle state. - EXPECT_FALSE(scroll_animation->startTime().has_value()); - EXPECT_FALSE(scroll_animation->currentTime().has_value()); + EXPECT_FALSE(StartTimeIsSet(scroll_animation)); + EXPECT_FALSE(CurrentTimeIsSet(scroll_animation)); scroll_animation->play(); // Verify start and current times in Pending state. - EXPECT_EQ(0, scroll_animation->startTime()); - EXPECT_EQ(20, scroll_animation->currentTime()); + EXPECT_TIME(0, GetStartTimeMs(scroll_animation)); + EXPECT_TIME(20, GetCurrentTimeMs(scroll_animation)); UpdateAllLifecyclePhasesForTest(); // Verify start and current times in Playing state. - EXPECT_EQ(0, scroll_animation->startTime()); - EXPECT_EQ(20, scroll_animation->currentTime()); + EXPECT_TIME(0, GetStartTimeMs(scroll_animation)); + EXPECT_TIME(20, GetCurrentTimeMs(scroll_animation)); // Verify current time after scroll. scrollable_area->SetScrollOffset(ScrollOffset(0, 40), mojom::blink::ScrollType::kProgrammatic); SimulateFrameForScrollAnimations(); - EXPECT_EQ(40, scroll_animation->currentTime()); + EXPECT_TIME(40, GetCurrentTimeMs(scroll_animation)); } // Verifies that finished composited scroll-linked animations restart on @@ -1671,14 +1896,14 @@ TEST_F(AnimationAnimationTestCompositing, // Advances the animation to "finished" state. The composited animation will // be destroyed accordingly. - scroll_animation->setCurrentTime(50000); + scroll_animation->setCurrentTime(CSSNumberish::FromDouble(50000)); EXPECT_EQ(scroll_animation->playState(), "finished"); scroll_animation->Update(kTimingUpdateForAnimationFrame); GetDocument().GetPendingAnimations().Update(nullptr, true); EXPECT_FALSE(scroll_animation->HasActiveAnimationsOnCompositor()); // Restarting the animation should create a new compositor animation. - scroll_animation->setCurrentTime(100); + scroll_animation->setCurrentTime(CSSNumberish::FromDouble(100)); UpdateAllLifecyclePhasesForTest(); EXPECT_EQ(scroll_animation->playState(), "running"); scroll_animation->Update(kTimingUpdateForAnimationFrame); @@ -1715,7 +1940,7 @@ TEST_F(AnimationAnimationTestNoCompositing, EXPECT_TRUE(animation->Update(kTimingUpdateForAnimationFrame)); // Asynchronous completion. - animation->setCurrentTime(50000); + animation->setCurrentTime(CSSNumberish::FromDouble(50000)); EXPECT_EQ("finished", animation->playState()); EXPECT_FALSE(animation->Update(kTimingUpdateForAnimationFrame)); } @@ -1735,7 +1960,7 @@ TEST_F(AnimationAnimationTestNoCompositing, EXPECT_TRUE(animation->HasPendingActivity()); // Resolving the finished promise clears the pending activity. - animation->setCurrentTime(50000); + animation->setCurrentTime(CSSNumberish::FromDouble(50000)); EXPECT_EQ("finished", animation->playState()); SimulateMicrotask(); EXPECT_FALSE(animation->Update(kTimingUpdateForAnimationFrame)); @@ -1786,7 +2011,7 @@ TEST_F(AnimationAnimationTestNoCompositing, EXPECT_TRUE(animation->HasPendingActivity()); // Finishing the animation asynchronously clears the pending activity. - animation->setCurrentTime(50000); + animation->setCurrentTime(CSSNumberish::FromDouble(50000)); EXPECT_EQ("finished", animation->playState()); SimulateMicrotask(); EXPECT_FALSE(animation->Update(kTimingUpdateForAnimationFrame)); @@ -2012,4 +2237,62 @@ TEST_F(AnimationAnimationTestCompositing, CompositorAnimations::kTimelineSourceHasInvalidCompositingState); } +TEST_F(AnimationAnimationTestCompositing, ContentVisibleDisplayLockTest) { + animation->cancel(); + RunDocumentLifecycle(); + + SetBodyInnerHTML(R"HTML( + +
+
+
+
+
+
+ )HTML"); + + RunDocumentLifecycle(); + + Element* outer = GetElementById("outer"); + Element* inner = GetElementById("inner"); + Element* target = GetElementById("target"); + + ElementAnimations* element_animations = target->GetElementAnimations(); + EXPECT_EQ(1u, element_animations->Animations().size()); + + Animation* animation = element_animations->Animations().begin()->key; + ASSERT_TRUE(!!animation); + EXPECT_FALSE(animation->IsInDisplayLockedSubtree()); + + inner->setAttribute(html_names::kStyleAttr, "content-visibility: hidden"); + RunDocumentLifecycle(); + EXPECT_TRUE(animation->IsInDisplayLockedSubtree()); + + inner->setAttribute(html_names::kStyleAttr, "content-visibility: visible"); + RunDocumentLifecycle(); + EXPECT_FALSE(animation->IsInDisplayLockedSubtree()); + + outer->setAttribute(html_names::kStyleAttr, "content-visibility: hidden"); + RunDocumentLifecycle(); + EXPECT_TRUE(animation->IsInDisplayLockedSubtree()); + + // Ensure that the animation has not been canceled even though display locked. + EXPECT_EQ(1u, target->GetElementAnimations()->Animations().size()); + EXPECT_EQ(animation->playState(), "running"); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/animation_time_delta.h b/chromium/third_party/blink/renderer/core/animation/animation_time_delta.h index 9c330f3443b..b7ab9757fcd 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation_time_delta.h +++ b/chromium/third_party/blink/renderer/core/animation/animation_time_delta.h @@ -41,6 +41,8 @@ class CORE_EXPORT AnimationTimeDelta { public: constexpr AnimationTimeDelta() : delta_(0) {} + constexpr explicit AnimationTimeDelta(base::TimeDelta time_delta) + : delta_(time_delta.InSecondsF()) {} static AnimationTimeDelta FromSecondsD(double time_s) { DCHECK(!std::isnan(time_s)); @@ -61,6 +63,9 @@ class CORE_EXPORT AnimationTimeDelta { bool is_max() const { return delta_ == std::numeric_limits::infinity(); } + + bool is_inf() const { return std::isinf(delta_); } + bool is_zero() const { return delta_ == 0; } AnimationTimeDelta operator+(AnimationTimeDelta other) const { @@ -72,6 +77,7 @@ class CORE_EXPORT AnimationTimeDelta { AnimationTimeDelta operator-(AnimationTimeDelta other) const { return AnimationTimeDelta(delta_ - other.delta_); } + AnimationTimeDelta operator-() { return AnimationTimeDelta(-delta_); } template AnimationTimeDelta operator*(T a) const { return AnimationTimeDelta(delta_ * a); diff --git a/chromium/third_party/blink/renderer/core/animation/animation_timeline.cc b/chromium/third_party/blink/renderer/core/animation/animation_timeline.cc index 3a3859f3f1c..e6a822b50c8 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation_timeline.cc +++ b/chromium/third_party/blink/renderer/core/animation/animation_timeline.cc @@ -46,6 +46,12 @@ void AnimationTimeline::currentTime(CSSNumberish& currentTime) { : CSSNumberish(); } +base::Optional AnimationTimeline::CurrentTime() { + base::Optional result = CurrentPhaseAndTime().time; + return result ? base::make_optional(AnimationTimeDelta(result.value())) + : base::nullopt; +} + base::Optional AnimationTimeline::CurrentTimeMilliseconds() { base::Optional result = CurrentPhaseAndTime().time; return result ? base::make_optional(result->InMillisecondsF()) diff --git a/chromium/third_party/blink/renderer/core/animation/animation_timeline.h b/chromium/third_party/blink/renderer/core/animation/animation_timeline.h index 6c16a91fd4e..8cc0a6252e8 100644 --- a/chromium/third_party/blink/renderer/core/animation/animation_timeline.h +++ b/chromium/third_party/blink/renderer/core/animation/animation_timeline.h @@ -36,6 +36,7 @@ class CORE_EXPORT AnimationTimeline : public ScriptWrappable { ~AnimationTimeline() override = default; virtual void currentTime(CSSNumberish&); + base::Optional CurrentTime(); base::Optional CurrentTimeMilliseconds(); base::Optional CurrentTimeSeconds(); @@ -48,7 +49,7 @@ class CORE_EXPORT AnimationTimeline : public ScriptWrappable { virtual bool IsScrollTimeline() const { return false; } virtual bool IsCSSScrollTimeline() const { return false; } virtual bool IsActive() const = 0; - virtual double ZeroTimeInSeconds() = 0; + virtual AnimationTimeDelta ZeroTime() = 0; // https://drafts.csswg.org/web-animations/#monotonically-increasing-timeline // A timeline is monotonically increasing if its reported current time is // always greater than or equal than its previously reported current time. diff --git a/chromium/third_party/blink/renderer/core/animation/build.gni b/chromium/third_party/blink/renderer/core/animation/build.gni index 65558126ec5..acf6f02e997 100644 --- a/chromium/third_party/blink/renderer/core/animation/build.gni +++ b/chromium/third_party/blink/renderer/core/animation/build.gni @@ -15,6 +15,8 @@ blink_core_tests_animation = [ "css/css_animations_test.cc", "css/css_scroll_timeline_test.cc", "css/css_transition_data_test.cc", + "css_color_interpolation_type_test.cc", + "css_interpolation_types_map_test.cc", "document_animations_test.cc", "document_timeline_test.cc", "effect_input_test.cc", diff --git a/chromium/third_party/blink/renderer/core/animation/compositor_animations.cc b/chromium/third_party/blink/renderer/core/animation/compositor_animations.cc index 51fb92a1f8c..204c414357d 100644 --- a/chromium/third_party/blink/renderer/core/animation/compositor_animations.cc +++ b/chromium/third_party/blink/renderer/core/animation/compositor_animations.cc @@ -153,6 +153,16 @@ bool HasIncompatibleAnimations(const Element& target_element, return false; } +void DefaultToUnsupportedProperty( + PropertyHandleSet* unsupported_properties, + const PropertyHandle& property, + CompositorAnimations::FailureReasons* reasons) { + (*reasons) |= CompositorAnimations::kUnsupportedCSSProperty; + if (unsupported_properties) { + unsupported_properties->insert(property); + } +} + } // namespace CompositorElementIdNamespace @@ -169,10 +179,11 @@ CompositorAnimations::CompositorElementNamespaceForProperty( return CompositorElementIdNamespace::kPrimaryTransform; case CSSPropertyID::kFilter: return CompositorElementIdNamespace::kEffectFilter; + case CSSPropertyID::kBackgroundColor: case CSSPropertyID::kVariable: - // TODO(crbug.com/883721): Variables should not require the target - // element to have any composited property tree nodes - i.e. should - // not need to check for existence of a property tree node. + // TODO(crbug.com/883721): Variables and background color should not + // require the target element to have any composited property tree nodes - + // i.e. should not need to check for existence of a property tree node. // For now, variable animations target the primary animation target // node - the effect namespace. return CompositorElementIdNamespace::kPrimaryEffect; @@ -272,6 +283,13 @@ CompositorAnimations::CheckCanStartEffectOnCompositor( // Backdrop-filter pixel moving filters do not change the layer bounds // like regular filters do, so they can still be composited. break; + case CSSPropertyID::kBackgroundColor: + if (!RuntimeEnabledFeatures::CompositeBGColorAnimationEnabled() || + !animation_to_add->CanCompositeBGColorAnim()) { + DefaultToUnsupportedProperty(unsupported_properties, property, + &reasons); + } + break; case CSSPropertyID::kVariable: { // Custom properties are supported only in the case of // OffMainThreadCSSPaintEnabled, and even then only for some specific @@ -287,10 +305,8 @@ CompositorAnimations::CheckCanStartEffectOnCompositor( !layout_object->Style()->HasCSSPaintImagesUsingCustomProperty( property.CustomPropertyName(), layout_object->GetDocument())) { - if (unsupported_properties) { - unsupported_properties->insert(property); - } - reasons |= kUnsupportedCSSProperty; + DefaultToUnsupportedProperty(unsupported_properties, property, + &reasons); } // TODO: Add support for keyframes containing different types if (!keyframes.front() || @@ -302,10 +318,8 @@ CompositorAnimations::CheckCanStartEffectOnCompositor( } else { // We skip the rest of the loop in this case for the same reason as // unsupported CSS properties - see below. - if (unsupported_properties) { - unsupported_properties->insert(property); - } - reasons |= kUnsupportedCSSProperty; + DefaultToUnsupportedProperty(unsupported_properties, property, + &reasons); continue; } break; @@ -316,10 +330,8 @@ CompositorAnimations::CheckCanStartEffectOnCompositor( // an unsupported property. // ii. GetCompositorKeyframeValue() will be false so we will // accidentally count this as kInvalidAnimationOrEffect as well. - if (unsupported_properties) { - unsupported_properties->insert(property); - } - reasons |= kUnsupportedCSSProperty; + DefaultToUnsupportedProperty(unsupported_properties, property, + &reasons); continue; } @@ -406,7 +418,7 @@ CompositorAnimations::CheckCanStartElementOnCompositor( (effect && effect->HasDirectCompositingReasons()); } if (!has_direct_compositing_reasons && - To(model).HasNonVariableProperty()) { + To(model).RequiresPropertyNode()) { reasons |= kTargetHasInvalidCompositingState; } } else { @@ -696,6 +708,8 @@ void CompositorAnimations::GetAnimationOnCompositor( DCHECK(!properties.IsEmpty()); for (const auto& property : properties) { AtomicString custom_property_name = ""; + CompositorPaintWorkletInput::NativePropertyType native_property_type = + CompositorPaintWorkletInput::NativePropertyType::kInvalid; // If the animation duration is infinite, it doesn't make sense to scale // the keyframe offset, so use a scale of 1.0. This is connected to // the known issue of how the Web Animations spec handles infinite @@ -749,6 +763,17 @@ void CompositorAnimations::GetAnimationOnCompositor( curve = std::move(transform_curve); break; } + case CSSPropertyID::kBackgroundColor: { + native_property_type = + CompositorPaintWorkletInput::NativePropertyType::kBackgroundColor; + auto float_curve = std::make_unique(); + target_property = compositor_target_property::NATIVE_PROPERTY; + AddKeyframesToCurve(*float_curve, values); + float_curve->SetTimingFunction(*timing.timing_function); + float_curve->SetScaledDuration(scale); + curve = std::move(float_curve); + break; + } case CSSPropertyID::kVariable: { DCHECK(RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled()); custom_property_name = property.CustomPropertyName(); @@ -776,8 +801,18 @@ void CompositorAnimations::GetAnimationOnCompositor( } DCHECK(curve.get()); - auto keyframe_model = std::make_unique( - *curve, target_property, 0, group, std::move(custom_property_name)); + std::unique_ptr keyframe_model; + if (!custom_property_name.IsEmpty()) { + keyframe_model = std::make_unique( + *curve, target_property, 0, group, std::move(custom_property_name)); + } else if (native_property_type != + CompositorPaintWorkletInput::NativePropertyType::kInvalid) { + keyframe_model = std::make_unique( + *curve, target_property, 0, group, native_property_type); + } else { + keyframe_model = std::make_unique( + *curve, target_property, 0, group); + } if (start_time) keyframe_model->SetStartTime(start_time.value()); @@ -834,8 +869,9 @@ CompositorAnimations::CheckCanStartTransformAnimationOnCompositorForSVG( if (layout_object->IsSVGViewportContainer()) { // Nested SVG doesn't support transforms for now. reasons |= kTransformRelatedPropertyCannotBeAcceleratedOnTarget; - } else if (layout_object->IsSVGForeignObject() && - layout_object->StyleRef().EffectiveZoom() != 1) { + } else if (layout_object->StyleRef().EffectiveZoom() != 1) { + // TODO(crbug.com/1186312): Composited transform animation with non-1 + // effective zoom is incorrectly scaled for now. // TODO(crbug.com/1134775): If a foreignObject's effect zoom is not 1, // its transform node contains an additional scale which would be removed // by composited animation. diff --git a/chromium/third_party/blink/renderer/core/animation/compositor_animations.h b/chromium/third_party/blink/renderer/core/animation/compositor_animations.h index ad0abb2462b..c107d8b8fed 100644 --- a/chromium/third_party/blink/renderer/core/animation/compositor_animations.h +++ b/chromium/third_party/blink/renderer/core/animation/compositor_animations.h @@ -47,6 +47,7 @@ class Animation; class CompositorAnimation; class Element; class KeyframeEffectModelBase; +class Node; class PaintArtifactCompositor; class SVGElement; diff --git a/chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc b/chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc index 69121bf03e4..63147572614 100644 --- a/chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc @@ -56,7 +56,6 @@ #include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/frame/frame_test_helpers.h" #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" -#include "third_party/blink/renderer/core/frame/web_view_frame_widget.h" #include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h" #include "third_party/blink/renderer/core/paint/object_paint_properties.h" @@ -183,7 +182,8 @@ class AnimationCompositorAnimationsTest : public PaintTestConfigurations, const Timing& timing, const KeyframeEffectModelBase& effect) { // TODO(crbug.com/725385): Remove once compositor uses InterpolationTypes. - auto style = GetDocument().GetStyleResolver().StyleForElement(element_); + auto style = GetDocument().GetStyleResolver().StyleForElement( + element_, StyleRecalcContext()); effect.SnapshotAllCompositorKeyframesIfNecessary(*element_.Get(), *style, nullptr); return CheckCanStartEffectOnCompositor(timing, *element_.Get(), nullptr, @@ -455,7 +455,8 @@ class AnimationCompositorAnimationsTest : public PaintTestConfigurations, // As the compositor code only understands CompositorKeyframeValues, we must // snapshot the effect to make those available. // TODO(crbug.com/725385): Remove once compositor uses InterpolationTypes. - auto style = GetDocument().GetStyleResolver().StyleForElement(element_); + auto style = GetDocument().GetStyleResolver().StyleForElement( + element_, StyleRecalcContext()); effect.SnapshotAllCompositorKeyframesIfNecessary(*element_.Get(), *style, nullptr); @@ -635,7 +636,8 @@ TEST_P(AnimationCompositorAnimationsTest, SetCustomProperty("--x", "5"); UpdateAllLifecyclePhasesForTest(); - auto style = GetDocument().GetStyleResolver().StyleForElement(element_); + auto style = GetDocument().GetStyleResolver().StyleForElement( + element_, StyleRecalcContext()); EXPECT_TRUE(style->NonInheritedVariables()); EXPECT_TRUE(style->NonInheritedVariables() ->GetData(AtomicString("--foo")) @@ -1334,7 +1336,7 @@ TEST_P(AnimationCompositorAnimationsTest, CanStartEffectOnCompositorBasic) { MakeGarbageCollected(non_css_frames_vector); EXPECT_TRUE(CanStartEffectOnCompositor(timing_, *non_css_frames) & CompositorAnimations::kAnimationAffectsNonCSSProperties); - EXPECT_TRUE(non_css_frames->HasNonVariableProperty()); + EXPECT_TRUE(non_css_frames->RequiresPropertyNode()); // NB: Important that non_css_frames_vector goes away and cleans up // before fake_name. } @@ -1737,7 +1739,7 @@ TEST_P(AnimationCompositorAnimationsTest, keyframe_model->TargetProperty()); EXPECT_EQ(keyframe_model->GetCustomPropertyNameForTesting(), property_name.Utf8().data()); - EXPECT_FALSE(effect->HasNonVariableProperty()); + EXPECT_FALSE(effect->RequiresPropertyNode()); } TEST_P(AnimationCompositorAnimationsTest, @@ -2065,8 +2067,7 @@ TEST_P(AnimationCompositorAnimationsTest, CompositedTransformAnimation) { ASSERT_NE(nullptr, cc_transform); EXPECT_TRUE(cc_transform->has_potential_animation); EXPECT_TRUE(cc_transform->is_currently_animating); - EXPECT_EQ(cc::kNotScaled, cc_transform->starting_animation_scale); - EXPECT_EQ(cc::kNotScaled, cc_transform->maximum_animation_scale); + EXPECT_EQ(1.f, cc_transform->maximum_animation_scale); // Make sure the animation is started on the compositor. EXPECT_EQ( @@ -2100,7 +2101,6 @@ TEST_P(AnimationCompositorAnimationsTest, CompositedScaleAnimation) { ASSERT_NE(nullptr, cc_transform); EXPECT_TRUE(cc_transform->has_potential_animation); EXPECT_TRUE(cc_transform->is_currently_animating); - EXPECT_EQ(2.f, cc_transform->starting_animation_scale); EXPECT_EQ(5.f, cc_transform->maximum_animation_scale); // Make sure the animation is started on the compositor. @@ -2242,6 +2242,9 @@ TEST_P(AnimationCompositorAnimationsTest, + + + )HTML"); auto CanStartAnimation = [&](const char* id) -> bool { @@ -2261,6 +2264,9 @@ TEST_P(AnimationCompositorAnimationsTest, EXPECT_TRUE(CanStartAnimation("use")); EXPECT_FALSE(CanStartAnimation("use-offset")); + EXPECT_FALSE(CanStartAnimation("svg-zoomed")); + EXPECT_FALSE(CanStartAnimation("rect-zoomed")); + To(GetDocument().getElementById("rect")) ->SetWebAnimatedAttribute( svg_names::kXAttr, diff --git a/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h b/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h index 83be42ab243..7bd0c3fd1b7 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h +++ b/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h @@ -7,6 +7,7 @@ #include "third_party/blink/renderer/core/animation/css/compositor_keyframe_value.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { diff --git a/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.cc b/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.cc index d84627765c8..cede2395cd2 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.cc +++ b/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.cc @@ -34,7 +34,8 @@ static CompositorKeyframeValue* CreateFromTransformProperties( CompositorKeyframeValue* CompositorKeyframeValueFactory::Create( const PropertyHandle& property, - const ComputedStyle& style) { + const ComputedStyle& style, + double offset) { const CSSProperty& css_property = property.GetCSSProperty(); #if DCHECK_IS_ON() // Variables are conditionally interpolable and compositable. @@ -67,6 +68,9 @@ CompositorKeyframeValue* CompositorKeyframeValueFactory::Create( return CreateFromTransformProperties(style.Scale(), style.EffectiveZoom(), nullptr); } + case CSSPropertyID::kBackgroundColor: { + return MakeGarbageCollected(offset); + } case CSSPropertyID::kVariable: { if (!RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled()) { return nullptr; diff --git a/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.h b/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.h index d4e55a9a6b1..17115618768 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.h +++ b/chromium/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.h @@ -18,7 +18,8 @@ class CompositorKeyframeValueFactory { public: static CompositorKeyframeValue* Create(const PropertyHandle&, - const ComputedStyle&); + const ComputedStyle&, + double offset); }; } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animation.cc b/chromium/third_party/blink/renderer/core/animation/css/css_animation.cc index e2e7beb7993..9e637788e15 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/css_animation.cc +++ b/chromium/third_party/blink/renderer/core/animation/css/css_animation.cc @@ -60,7 +60,7 @@ void CSSAnimation::setTimeline(AnimationTimeline* timeline) { ignore_css_timeline_ = true; } -void CSSAnimation::setStartTime(base::Optional start_time_ms, +void CSSAnimation::setStartTime(CSSNumberish start_time_ms, ExceptionState& exception_state) { PlayStateTransitionScope scope(*this); Animation::setStartTime(start_time_ms, exception_state); diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animation.h b/chromium/third_party/blink/renderer/core/animation/css/css_animation.h index 745f14f4876..32bfc8a162c 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/css_animation.h +++ b/chromium/third_party/blink/renderer/core/animation/css/css_animation.h @@ -51,7 +51,7 @@ class CORE_EXPORT CSSAnimation : public Animation { void play(ExceptionState& = ASSERT_NO_EXCEPTION) override; void reverse(ExceptionState& = ASSERT_NO_EXCEPTION) override; void setTimeline(AnimationTimeline*) override; - void setStartTime(base::Optional, ExceptionState&) override; + void setStartTime(CSSNumberish, ExceptionState&) override; // When set, subsequent changes to animation-play-state no longer affect the // play state. diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animations.cc b/chromium/third_party/blink/renderer/core/animation/css/css_animations.cc index 601832605c7..18dcabd7910 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/css_animations.cc +++ b/chromium/third_party/blink/renderer/core/animation/css/css_animations.cc @@ -434,11 +434,11 @@ AnimationTimeDelta IterationElapsedTime(const AnimationEffect& effect, CSSScrollTimeline* CreateCSSScrollTimeline( Element* element, - const CSSScrollTimeline::Options& options) { + CSSScrollTimeline::Options&& options) { if (!options.IsValid()) return nullptr; - auto* scroll_timeline = - MakeGarbageCollected(&element->GetDocument(), options); + auto* scroll_timeline = MakeGarbageCollected( + &element->GetDocument(), std::move(options)); // It's is not allowed for a style resolve to create timelines that // needs timing updates (i.e. AnimationTimeline::NeedsAnimationTimingUpdate() // must return false). Servicing animations after creation preserves this @@ -486,7 +486,7 @@ AnimationTimeline* ComputeTimeline(Element* element, if (timeline->Matches(options)) return existing_timeline; } - if (auto* timeline = CreateCSSScrollTimeline(element, options)) + if (auto* timeline = CreateCSSScrollTimeline(element, std::move(options))) return timeline; } return nullptr; @@ -760,7 +760,7 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update, DCHECK(!is_animation_style_change); base::Optional inherited_phase; - base::Optional inherited_time; + base::Optional inherited_time; if (timeline) { inherited_phase = base::make_optional(timeline->Phase()); @@ -770,7 +770,7 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update, ((timeline != existing_animation->Timeline()) || animation->ResetsCurrentTimeOnResume())) { if (!timeline->IsMonotonicallyIncreasing()) - inherited_time = timeline->CurrentTimeSeconds(); + inherited_time = timeline->CurrentTime(); } } @@ -792,13 +792,13 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update, ComputeTimeline(&element, timeline_name, scroll_timeline_rule, nullptr /* existing_timeline */); base::Optional inherited_phase; - base::Optional inherited_time; + base::Optional inherited_time; if (timeline) { if (timeline->IsMonotonicallyIncreasing()) { - inherited_time = 0; + inherited_time = AnimationTimeDelta(); } else { inherited_phase = base::make_optional(timeline->Phase()); - inherited_time = timeline->CurrentTimeSeconds(); + inherited_time = timeline->CurrentTime(); } } update.StartAnimation( @@ -1039,8 +1039,9 @@ void CSSAnimations::MaybeApplyPendingUpdate(Element* element) { // Set the current time as the start time for retargeted transitions if (retargeted_compositor_transitions.Contains(property)) { - animation->setStartTime( - element->GetDocument().Timeline().CurrentTimeMilliseconds()); + CSSNumberish current_time; + element->GetDocument().Timeline().currentTime(current_time); + animation->setStartTime(current_time); } animation->Update(kTimingUpdateOnDemand); running_transition->animation = animation; @@ -1239,9 +1240,9 @@ void CSSAnimations::CalculateTransitionUpdateForProperty( if (property.GetCSSProperty().IsCompositableProperty()) { CompositorKeyframeValue* from = CompositorKeyframeValueFactory::Create( - property, *state.before_change_style); - CompositorKeyframeValue* to = - CompositorKeyframeValueFactory::Create(property, state.style); + property, *state.before_change_style, start_keyframe->Offset().value()); + CompositorKeyframeValue* to = CompositorKeyframeValueFactory::Create( + property, state.style, end_keyframe->Offset().value()); start_keyframe->SetCompositorValue(from); end_keyframe->SetCompositorValue(to); } @@ -1253,8 +1254,8 @@ void CSSAnimations::CalculateTransitionUpdateForProperty( state.update.StartTransition( property, state.before_change_style, state.cloned_style, reversing_adjusted_start_value, reversing_shortening_factor, - *MakeGarbageCollected(model, timing, false, 0, - base::nullopt)); + *MakeGarbageCollected(model, timing, false, + AnimationTimeDelta(), base::nullopt)); DCHECK(!state.animating_element->GetElementAnimations() || !state.animating_element->GetElementAnimations() ->IsAnimationStyleChange()); @@ -1288,7 +1289,7 @@ void CSSAnimations::CalculateTransitionUpdateForStandardProperty( } CSSPropertyID resolved_id = - resolveCSSPropertyID(transition_property.unresolved_property); + ResolveCSSPropertyID(transition_property.unresolved_property); bool animate_all = resolved_id == CSSPropertyID::kAll; const StylePropertyShorthand& property_list = animate_all ? PropertiesForTransitionAll() @@ -1299,7 +1300,7 @@ void CSSAnimations::CalculateTransitionUpdateForStandardProperty( CSSPropertyID longhand_id = property_list.length() ? property_list.properties()[i]->PropertyID() : resolved_id; - DCHECK_GE(longhand_id, firstCSSProperty); + DCHECK_GE(longhand_id, kFirstCSSProperty); const CSSProperty& property = CSSProperty::Get(longhand_id) .ResolveDirectionAwareProperty(style.Direction(), @@ -1425,19 +1426,27 @@ scoped_refptr CSSAnimations::CalculateBeforeChangeStyle( a, b, Animation::CompareAnimationsOrdering::kPointerOrder); }); - // Sample animations and add to the interpolations map. + // Sample animations and add to the interpolatzions map. for (Animation* animation : animations) { - base::Optional current_time = animation->currentTime(); - if (!current_time) + CSSNumberish current_time_numberish; + animation->currentTime(current_time_numberish); + if (current_time_numberish.IsNull()) continue; + // CSSNumericValue is not yet supported, verify that it is not used + DCHECK(!current_time_numberish.IsCSSNumericValue()); + + base::Optional current_time = + AnimationTimeDelta::FromMillisecondsD( + current_time_numberish.GetAsDouble()); + auto* effect = DynamicTo(animation->effect()); if (!effect) continue; auto* inert_animation_for_sampling = MakeGarbageCollected( - effect->Model(), effect->SpecifiedTiming(), false, - current_time.value() / 1000, base::nullopt); + effect->Model(), effect->SpecifiedTiming(), false, current_time, + base::nullopt); HeapVector> sample; inert_animation_for_sampling->Sample(sample); @@ -1692,10 +1701,9 @@ void CSSAnimations::AnimationEventDelegate::OnEventCondition( previous_phase_ != Timing::kPhaseAfter) { // TODO(crbug.com/1059968): Determine if animation direction or playback // rate factor into the calculation of the elapsed time. - double cancel_time = animation_node.GetCancelTime(); + AnimationTimeDelta cancel_time = animation_node.GetCancelTime(); MaybeDispatch(Document::kAnimationCancelListener, - event_type_names::kAnimationcancel, - AnimationTimeDelta::FromSecondsD(cancel_time)); + event_type_names::kAnimationcancel, cancel_time); } if (!phase_change && current_phase == Timing::kPhaseActive && diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc b/chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc index 0857a0e4daa..9982f48ab31 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/css/css_animations_test.cc @@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/animation/animation.h" #include "third_party/blink/renderer/core/animation/document_timeline.h" #include "third_party/blink/renderer/core/animation/element_animations.h" +#include "third_party/blink/renderer/core/css/cssom/css_numeric_value.h" #include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/layout/layout_object.h" #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" @@ -38,7 +39,7 @@ class CSSAnimationsTest : public RenderingTest { SetUpAnimationClockForTesting(); // Advance timer to document time. platform()->AdvanceClockSeconds( - GetDocument().Timeline().ZeroTime().since_origin().InSecondsF()); + GetDocument().Timeline().ZeroTime().InSecondsF()); } void TearDown() override { @@ -263,8 +264,9 @@ class CSSAnimationsCompositorSyncTest : public CSSAnimationsTest { void VerifyCompositorOpacity(double expected_value) { cc::KeyframeModel* keyframe_model = GetCompositorKeyframeForOpacity(); base::TimeDelta iteration_time = CompositorIterationTime(); - const cc::FloatAnimationCurve* opacity_curve = - keyframe_model->curve()->ToFloatAnimationCurve(); + const gfx::FloatAnimationCurve* opacity_curve = + gfx::FloatAnimationCurve::ToFloatAnimationCurve( + keyframe_model->curve()); EXPECT_NEAR(expected_value, opacity_curve->GetValue(iteration_time), kTolerance); } @@ -347,15 +349,21 @@ TEST_F(CSSAnimationsCompositorSyncTest, SetStartTime) { Animation* animation = GetAnimation(); int compositor_group = animation->CompositorGroup(); + CSSNumberish start_time, current_time; + animation->startTime(start_time); + animation->currentTime(current_time); + // Partially rewind the animation via setStartTime. - double new_start_time = - animation->startTime().value() + animation->currentTime().value() / 2; + CSSNumberish new_start_time = CSSNumberish::FromDouble( + start_time.GetAsDouble() + (current_time.GetAsDouble() / 2)); + animation->setStartTime(new_start_time, ASSERT_NO_EXCEPTION); UpdateAllLifecyclePhasesForTest(); // Verify blink updates. - EXPECT_NEAR(250, animation->currentTime().value(), - kTimeToleranceMilliseconds); + animation->currentTime(current_time); + EXPECT_TRUE(current_time.IsDouble()); + EXPECT_NEAR(250, current_time.GetAsDouble(), kTimeToleranceMilliseconds); EXPECT_NEAR(0.75, element_->GetComputedStyle()->Opacity(), kTolerance); // Compositor animation needs to restart and will have a new compositor group. @@ -386,12 +394,14 @@ TEST_F(CSSAnimationsCompositorSyncTest, SetCurrentTime) { int compositor_group = animation->CompositorGroup(); // Advance current time. - animation->setCurrentTime(750, ASSERT_NO_EXCEPTION); + animation->setCurrentTime(CSSNumberish::FromDouble(750), ASSERT_NO_EXCEPTION); UpdateAllLifecyclePhasesForTest(); // Verify blink updates. - EXPECT_NEAR(750, animation->currentTime().value(), - kTimeToleranceMilliseconds); + CSSNumberish current_time; + animation->currentTime(current_time); + EXPECT_TRUE(current_time.IsDouble()); + EXPECT_NEAR(750, current_time.GetAsDouble(), kTimeToleranceMilliseconds); EXPECT_NEAR(0.25, element_->GetComputedStyle()->Opacity(), kTolerance); // Compositor animation needs to restart and will have a new compositor group. diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline.cc b/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline.cc index 179646a550c..d63409c1c28 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline.cc +++ b/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline.cc @@ -82,8 +82,10 @@ double ComputeElementOffsetThreshold(const CSSValue* value) { ScrollTimelineElementBasedOffset* ComputeElementBasedOffset( Document& document, const cssvalue::CSSElementOffsetValue* value) { - auto* offset = MakeGarbageCollected(); - offset->setTarget(ComputeElementOffsetTarget(document, value->Target())); + auto* offset = ScrollTimelineElementBasedOffset::Create(); + Element* target = ComputeElementOffsetTarget(document, value->Target()); + if (target) + offset->setTarget(target); offset->setEdge(ComputeElementOffsetEdge(value->Edge())); offset->setThreshold(ComputeElementOffsetThreshold(value->Threshold())); return offset; @@ -121,23 +123,22 @@ ScrollTimelineOffset* ComputeScrollOffset(Document& document, return MakeGarbageCollected(); } -HeapVector>* ComputeScrollOffsets( +HeapVector> ComputeScrollOffsets( Document& document, const CSSValue* start, const CSSValue* end) { - auto* offsets = - MakeGarbageCollected>>(); + HeapVector> offsets; - bool start_is_auto = IsAuto(start) || !start; - bool end_is_auto = IsAuto(end) || !end; + const bool start_is_auto = !start || IsAuto(start); + const bool end_is_auto = !end || IsAuto(end); // TODO(crbug.com/1094014): scroll_offsets will replace start and end // offsets once spec decision on multiple scroll offsets is finalized. // https://github.com/w3c/csswg-drafts/issues/4912 if (!start_is_auto) - offsets->push_back(ComputeScrollOffset(document, start)); + offsets.push_back(ComputeScrollOffset(document, start)); if (!end_is_auto || !start_is_auto) - offsets->push_back(ComputeScrollOffset(document, end)); + offsets.push_back(ComputeScrollOffset(document, end)); return offsets; } @@ -212,11 +213,11 @@ CSSScrollTimeline::Options::Options(Element* element, time_range_(ComputeTimeRange(rule.GetTimeRange())), rule_(&rule) {} -CSSScrollTimeline::CSSScrollTimeline(Document* document, const Options& options) +CSSScrollTimeline::CSSScrollTimeline(Document* document, Options&& options) : ScrollTimeline(document, options.source_, options.direction_, - options.offsets_, + std::move(options.offsets_), *options.time_range_), rule_(options.rule_) { DCHECK(options.IsValid()); @@ -229,10 +230,9 @@ const AtomicString& CSSScrollTimeline::Name() const { } bool CSSScrollTimeline::Matches(const Options& options) const { - DCHECK(options.offsets_); return (scrollSource() == options.source_) && (GetOrientation() == options.direction_) && - (ScrollOffsetsEqual(*options.offsets_)) && + (ScrollOffsetsEqual(options.offsets_)) && (GetTimeRange() == options.time_range_) && (rule_ == options.rule_); } diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline.h b/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline.h index c06419f378e..ef6811a5c33 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline.h +++ b/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline.h @@ -33,12 +33,12 @@ class CORE_EXPORT CSSScrollTimeline : public ScrollTimeline { Element* source_; ScrollTimeline::ScrollDirection direction_; - HeapVector>* offsets_; + HeapVector> offsets_; base::Optional time_range_; StyleRuleScrollTimeline* rule_; }; - CSSScrollTimeline(Document*, const Options&); + CSSScrollTimeline(Document*, Options&&); const AtomicString& Name() const; diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline_test.cc b/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline_test.cc index a693940dd30..3e6b652a202 100644 --- a/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/css/css_scroll_timeline_test.cc @@ -4,10 +4,16 @@ #include "third_party/blink/renderer/core/animation/css/css_scroll_timeline.h" +#include "third_party/blink/renderer/core/animation/document_animations.h" #include "third_party/blink/renderer/core/dom/id_target_observer.h" #include "third_party/blink/renderer/core/dom/id_target_observer_registry.h" +#include "third_party/blink/renderer/core/dom/node_computed_style.h" +#include "third_party/blink/renderer/core/html/html_div_element.h" #include "third_party/blink/renderer/core/html/html_element.h" #include "third_party/blink/renderer/core/html/html_style_element.h" +#include "third_party/blink/renderer/core/resize_observer/resize_observer.h" +#include "third_party/blink/renderer/core/resize_observer/resize_observer_entry.h" +#include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" #include "third_party/blink/renderer/platform/heap/thread_state.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" @@ -22,6 +28,10 @@ class CSSScrollTimelineTest : public PageTestBase, bool HasObservers(const AtomicString& id) { return GetDocument().GetIdTargetObserverRegistry().HasObservers(id); } + + DocumentAnimations& GetDocumentAnimations() const { + return GetDocument().GetDocumentAnimations(); + } }; TEST_F(CSSScrollTimelineTest, IdObserverElementRemoval) { @@ -217,4 +227,130 @@ TEST_F(CSSScrollTimelineTest, SharedTimelines) { EXPECT_NE(animations2[2]->timeline(), animations1[1]->timeline()); } +TEST_F(CSSScrollTimelineTest, MultipleLifecyclePasses) { + SetBodyInnerHTML(R"HTML( + +
+
+
+
+ )HTML"); + + Element* element = GetDocument().getElementById("element"); + ASSERT_TRUE(element); + + // According to the rules of the spec [1], the timeline is now inactive, + // because #scroller did not have a layout box at the time style recalc + // for #element happened. + // + // However, we do an additional style/layout pass if we detect new + // CSSScrollTimelines in this situation, hence we ultimately do expect + // the animation to apply [2]. + // + // See also DocumentAnimations::ValidateTimelines. + // + // [1] https://drafts.csswg.org/scroll-animations-1/#avoiding-cycles + // [2] https://github.com/w3c/csswg-drafts/issues/5261 + EXPECT_EQ(MakeRGB(0, 128, 0), + element->GetComputedStyle()->VisitedDependentColor( + GetCSSPropertyColor())); +} + +namespace { + +class AnimationTriggeringDelegate : public ResizeObserver::Delegate { + public: + explicit AnimationTriggeringDelegate(Element* element) : element_(element) {} + + void OnResize( + const HeapVector>& entries) override { + element_->setAttribute(blink::html_names::kClassAttr, "animate"); + } + + void Trace(Visitor* visitor) const override { + ResizeObserver::Delegate::Trace(visitor); + visitor->Trace(element_); + } + + private: + Member element_; +}; + +} // namespace + +TEST_F(CSSScrollTimelineTest, ResizeObserverTriggeredTimelines) { + SetBodyInnerHTML(R"HTML( + +
+ )HTML"); + + ASSERT_TRUE( + GetDocumentAnimations().GetUnvalidatedTimelinesForTesting().IsEmpty()); + + Element* element = MakeGarbageCollected(GetDocument()); + element->setAttribute(blink::html_names::kIdAttr, "element"); + + Element* scroller = MakeGarbageCollected(GetDocument()); + scroller->setAttribute(blink::html_names::kIdAttr, "scroller"); + scroller->AppendChild(MakeGarbageCollected(GetDocument())); + + Element* main = GetDocument().getElementById("main"); + ASSERT_TRUE(main); + main->AppendChild(element); + main->AppendChild(scroller); + + auto* delegate = MakeGarbageCollected(element); + ResizeObserver* observer = + ResizeObserver::Create(GetDocument().domWindow(), delegate); + observer->observe(element); + + UpdateAllLifecyclePhasesForTest(); + EXPECT_EQ(1u, + GetDocumentAnimations().GetUnvalidatedTimelinesForTesting().size()); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.cc new file mode 100644 index 00000000000..d0552b1a8d7 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.cc @@ -0,0 +1,164 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.h" + +#include +#include + +#include "base/memory/ptr_util.h" +#include "third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h" +#include "third_party/blink/renderer/core/css/resolver/style_builder_converter.h" +#include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h" +#include "third_party/blink/renderer/core/style/computed_style.h" +#include "third_party/blink/renderer/core/style/style_aspect_ratio.h" + +namespace blink { + +class CSSAspectRatioNonInterpolableValue final : public NonInterpolableValue { + public: + ~CSSAspectRatioNonInterpolableValue() final = default; + + static scoped_refptr Create( + StyleAspectRatio aspect_ratio) { + return base::AdoptRef( + new CSSAspectRatioNonInterpolableValue(aspect_ratio.GetType())); + } + + EAspectRatioType GetAspectRatioType() const { return type_; } + + bool IsCompatibleWith(const CSSAspectRatioNonInterpolableValue& other) const { + if (GetAspectRatioType() == EAspectRatioType::kAuto || + GetAspectRatioType() != other.GetAspectRatioType()) + return false; + return true; + } + + DECLARE_NON_INTERPOLABLE_VALUE_TYPE(); + + private: + explicit CSSAspectRatioNonInterpolableValue(EAspectRatioType type) + : type_(type) {} + + EAspectRatioType type_; +}; + +DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSAspectRatioNonInterpolableValue); +template <> +struct DowncastTraits { + static bool AllowFrom(const NonInterpolableValue* value) { + return value && AllowFrom(*value); + } + static bool AllowFrom(const NonInterpolableValue& value) { + return value.GetType() == CSSAspectRatioNonInterpolableValue::static_type_; + } +}; + +class InheritedAspectRatioChecker + : public CSSInterpolationType::CSSConversionChecker { + public: + explicit InheritedAspectRatioChecker(StyleAspectRatio aspect_ratio) + : aspect_ratio_(aspect_ratio) {} + + private: + bool IsValid(const StyleResolverState& state, + const InterpolationValue& underlying) const final { + return state.ParentStyle()->AspectRatio() == aspect_ratio_; + } + + const StyleAspectRatio aspect_ratio_; +}; + +std::unique_ptr +CSSAspectRatioInterpolationType::CreateInterpolableAspectRatio( + const StyleAspectRatio& aspect_ratio) { + std::unique_ptr result = + InterpolableAspectRatio::MaybeCreate(aspect_ratio); + return std::move(result); +} + +PairwiseInterpolationValue CSSAspectRatioInterpolationType::MaybeMergeSingles( + InterpolationValue&& start, + InterpolationValue&& end) const { + if (!To(*start.non_interpolable_value) + .IsCompatibleWith(To( + *end.non_interpolable_value))) { + return nullptr; + } + return PairwiseInterpolationValue(std::move(start.interpolable_value), + std::move(end.interpolable_value), + std::move(start.non_interpolable_value)); +} + +InterpolationValue CSSAspectRatioInterpolationType::MaybeConvertNeutral( + const InterpolationValue& underlying, + ConversionCheckers& conversion_checkers) const { + return InterpolationValue(underlying.interpolable_value->CloneAndZero(), + underlying.non_interpolable_value); +} + +InterpolationValue CSSAspectRatioInterpolationType::MaybeConvertInitial( + const StyleResolverState&, + ConversionCheckers& conversion_checkers) const { + StyleAspectRatio initial_ratio = ComputedStyle::InitialStyle().AspectRatio(); + return InterpolationValue( + CreateInterpolableAspectRatio(initial_ratio), + CSSAspectRatioNonInterpolableValue::Create(initial_ratio)); +} + +InterpolationValue CSSAspectRatioInterpolationType::MaybeConvertInherit( + const StyleResolverState& state, + ConversionCheckers& conversion_checkers) const { + if (!state.ParentStyle()) + return nullptr; + + StyleAspectRatio inherited_aspect_ratio = state.ParentStyle()->AspectRatio(); + conversion_checkers.push_back( + std::make_unique(inherited_aspect_ratio)); + if (inherited_aspect_ratio.IsAuto()) + return nullptr; + + return InterpolationValue( + CreateInterpolableAspectRatio(inherited_aspect_ratio), + CSSAspectRatioNonInterpolableValue::Create(inherited_aspect_ratio)); +} + +InterpolationValue +CSSAspectRatioInterpolationType::MaybeConvertStandardPropertyUnderlyingValue( + const ComputedStyle& style) const { + return InterpolationValue( + CreateInterpolableAspectRatio(style.AspectRatio()), + CSSAspectRatioNonInterpolableValue::Create(style.AspectRatio())); +} + +InterpolationValue CSSAspectRatioInterpolationType::MaybeConvertValue( + const CSSValue& value, + const StyleResolverState* state, + ConversionCheckers&) const { + StyleAspectRatio ratio = + StyleBuilderConverter::ConvertAspectRatio(*state, value); + return InterpolationValue(CreateInterpolableAspectRatio(ratio), + CSSAspectRatioNonInterpolableValue::Create(ratio)); +} + +void CSSAspectRatioInterpolationType::ApplyStandardPropertyValue( + const InterpolableValue& interpolable_value, + const NonInterpolableValue* non_interpolable_value, + StyleResolverState& state) const { + const auto& aspect_ratio = To(interpolable_value); + state.Style()->SetAspectRatio(StyleAspectRatio( + To(non_interpolable_value) + ->GetAspectRatioType(), + aspect_ratio.GetRatio())); +} +void CSSAspectRatioInterpolationType::Composite( + UnderlyingValueOwner& underlying_value_owner, + double underlying_fraction, + const InterpolationValue& value, + double interpolation_fraction) const { + underlying_value_owner.MutableValue().interpolable_value->ScaleAndAdd( + underlying_fraction, *value.interpolable_value); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.h new file mode 100644 index 00000000000..93d854058f7 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.h @@ -0,0 +1,53 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_CSS_ASPECT_RATIO_INTERPOLATION_TYPE_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_CSS_ASPECT_RATIO_INTERPOLATION_TYPE_H_ + +#include "third_party/blink/renderer/core/animation/css_interpolation_type.h" +#include "third_party/blink/renderer/core/css_value_keywords.h" + +namespace blink { + +class StyleAspectRatio; + +class CSSAspectRatioInterpolationType : public CSSInterpolationType { + public: + explicit CSSAspectRatioInterpolationType(PropertyHandle property) + : CSSInterpolationType(property) { + DCHECK_EQ(CSSPropertyID::kAspectRatio, + property.GetCSSProperty().PropertyID()); + } + + InterpolationValue MaybeConvertStandardPropertyUnderlyingValue( + const ComputedStyle&) const final; + PairwiseInterpolationValue MaybeMergeSingles( + InterpolationValue&& start, + InterpolationValue&& end) const final; + void ApplyStandardPropertyValue(const InterpolableValue&, + const NonInterpolableValue*, + StyleResolverState&) const final; + void Composite(UnderlyingValueOwner&, + double underlying_fraction, + const InterpolationValue&, + double interpolation_fraction) const final; + + static std::unique_ptr CreateInterpolableAspectRatio( + const StyleAspectRatio&); + + private: + InterpolationValue MaybeConvertNeutral(const InterpolationValue& underlying, + ConversionCheckers&) const final; + InterpolationValue MaybeConvertInitial(const StyleResolverState&, + ConversionCheckers&) const final; + InterpolationValue MaybeConvertInherit(const StyleResolverState&, + ConversionCheckers&) const final; + InterpolationValue MaybeConvertValue(const CSSValue&, + const StyleResolverState*, + ConversionCheckers&) const final; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_CSS_ASPECT_RATIO_INTERPOLATION_TYPE_H_ diff --git a/chromium/third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.cc index 1bb38aa0905..57b3fe7781d 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.cc @@ -34,8 +34,6 @@ const BasicShape* GetBasicShape(const CSSProperty& property, return nullptr; return style.ShapeOutside()->Shape(); case CSSPropertyID::kClipPath: { - if (!style.ClipPath()) - return nullptr; auto* clip_path_operation = DynamicTo(style.ClipPath()); if (!clip_path_operation) diff --git a/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc index 1a816361073..09adb2a97fb 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc @@ -88,7 +88,7 @@ class InheritedClipChecker : public CSSInterpolationType::CSSConversionChecker { const Vector inherited_length_list_; }; -class CSSClipNonInterpolableValue : public NonInterpolableValue { +class CSSClipNonInterpolableValue final : public NonInterpolableValue { public: ~CSSClipNonInterpolableValue() final = default; @@ -121,7 +121,7 @@ struct DowncastTraits { } }; -class UnderlyingAutosChecker +class UnderlyingAutosChecker final : public CSSInterpolationType::CSSConversionChecker { public: explicit UnderlyingAutosChecker(const ClipAutos& underlying_autos) diff --git a/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.cc index 7276cf1c59f..5f2a4f6b362 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.cc @@ -68,7 +68,9 @@ CSSColorInterpolationType::CreateInterpolableColor(CSSValueID keyword) { case CSSValueID::kInternalQuirkInherit: return CreateInterpolableColorForIndex(kQuirkInherit); case CSSValueID::kWebkitFocusRingColor: - return CreateInterpolableColor(LayoutTheme::GetTheme().FocusRingColor()); + // TODO(crbug.com/929098) Need to pass an appropriate color scheme here. + return CreateInterpolableColor(LayoutTheme::GetTheme().FocusRingColor( + ComputedStyle::InitialStyle().UsedColorScheme())); default: DCHECK(StyleColor::IsColorKeyword(keyword)); // TODO(crbug.com/929098) Need to pass an appropriate color scheme here. @@ -96,6 +98,20 @@ CSSColorInterpolationType::MaybeCreateInterpolableColor(const CSSValue& value) { return CreateInterpolableColor(identifier_value->GetValueID()); } +Color CSSColorInterpolationType::GetRGBA(const InterpolableValue& value) { + const InterpolableList& list = To(value); + DCHECK_GE(list.length(), kAlpha); + double color[kAlpha + 1]; + for (unsigned i = kRed; i <= kAlpha; i++) { + const InterpolableValue& current_value = *(list.Get(i)); + color[i] = To(current_value).Value(); + } + return Color(MakeRGBA(std::round(color[kRed] / color[kAlpha]), + std::round(color[kGreen] / color[kAlpha]), + std::round(color[kBlue] / color[kAlpha]), + color[kAlpha])); +} + static void AddPremultipliedColor(double& red, double& green, double& blue, @@ -141,8 +157,9 @@ Color CSSColorInterpolationType::ResolveInterpolableColor( *state.Style()) .Access(); } - AddPremultipliedColor(red, green, blue, alpha, currentcolor_fraction, - current_style_color.GetColor()); + AddPremultipliedColor( + red, green, blue, alpha, currentcolor_fraction, + current_style_color.Resolve(Color(), state.Style()->UsedColorScheme())); } const TextLinkColors& colors = state.GetDocument().GetTextLinkColors(); if (double webkit_activelink_fraction = diff --git a/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.h index 7708b1d428b..538e1d9171e 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.h +++ b/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.h @@ -15,7 +15,7 @@ namespace blink { class StyleColor; struct OptionalStyleColor; -class CSSColorInterpolationType : public CSSInterpolationType { +class CORE_EXPORT CSSColorInterpolationType : public CSSInterpolationType { public: CSSColorInterpolationType(PropertyHandle property, const PropertyRegistration* registration = nullptr) @@ -44,6 +44,10 @@ class CSSColorInterpolationType : public CSSInterpolationType { bool is_visited = false, bool is_text_decoration = false); + // Extract color info from a InterpolableValue-result, the input value must be + // a InterpolableList. + static Color GetRGBA(const InterpolableValue&); + private: InterpolationValue MaybeConvertNeutral(const InterpolationValue& underlying, ConversionCheckers&) const final; diff --git a/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type_test.cc b/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type_test.cc new file mode 100644 index 00000000000..3cc0c4ee5f2 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type_test.cc @@ -0,0 +1,32 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/animation/css_color_interpolation_type.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/platform/graphics/color.h" + +namespace blink { + +TEST(CSSColorInterpolationTypeTest, GetRGBA1) { + Color color(230, 120, 0, 255); + EXPECT_EQ(color, + CSSColorInterpolationType::GetRGBA( + *CSSColorInterpolationType::CreateInterpolableColor(color))); +} + +TEST(CSSColorInterpolationTypeTest, GetRGBA2) { + Color color(100, 190, 0, 1); + EXPECT_EQ(color, + CSSColorInterpolationType::GetRGBA( + *CSSColorInterpolationType::CreateInterpolableColor(color))); +} + +TEST(CSSColorInterpolationTypeTest, GetRGBA3) { + Color color(35, 140, 10, 10); + EXPECT_EQ(color, + CSSColorInterpolationType::GetRGBA( + *CSSColorInterpolationType::CreateInterpolableColor(color))); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/css_default_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_default_interpolation_type.h index 501fc9c4f09..ccd7a7045d0 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_default_interpolation_type.h +++ b/chromium/third_party/blink/renderer/core/animation/css_default_interpolation_type.h @@ -11,7 +11,8 @@ namespace blink { -class CORE_EXPORT CSSDefaultNonInterpolableValue : public NonInterpolableValue { +class CORE_EXPORT CSSDefaultNonInterpolableValue final + : public NonInterpolableValue { public: ~CSSDefaultNonInterpolableValue() final = default; diff --git a/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.cc index bee89cee486..c5d8b93ccfd 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.cc @@ -16,7 +16,7 @@ namespace blink { -class CSSFontVariationSettingsNonInterpolableValue +class CSSFontVariationSettingsNonInterpolableValue final : public NonInterpolableValue { public: ~CSSFontVariationSettingsNonInterpolableValue() final = default; @@ -65,7 +65,8 @@ static bool TagsMatch(const NonInterpolableValue& a, return GetTags(a) == GetTags(b); } -class UnderlyingTagsChecker : public InterpolationType::ConversionChecker { +class UnderlyingTagsChecker final + : public InterpolationType::ConversionChecker { public: explicit UnderlyingTagsChecker(const Vector& tags) : tags_(tags) {} ~UnderlyingTagsChecker() final = default; @@ -79,7 +80,7 @@ class UnderlyingTagsChecker : public InterpolationType::ConversionChecker { const Vector tags_; }; -class InheritedFontVariationSettingsChecker +class InheritedFontVariationSettingsChecker final : public CSSInterpolationType::CSSConversionChecker { public: explicit InheritedFontVariationSettingsChecker( diff --git a/chromium/third_party/blink/renderer/core/animation/css_image_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_image_interpolation_type.cc index b7d1d7c02f0..d52bbbf5a33 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_image_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_image_interpolation_type.cc @@ -34,7 +34,7 @@ const StyleImage* GetStyleImage(const CSSProperty& property, } } // namespace -class CSSImageNonInterpolableValue : public NonInterpolableValue { +class CSSImageNonInterpolableValue final : public NonInterpolableValue { public: ~CSSImageNonInterpolableValue() final = default; @@ -165,7 +165,7 @@ bool CSSImageInterpolationType::EqualNonInterpolableValues( To(*b)); } -class UnderlyingImageChecker +class UnderlyingImageChecker final : public CSSInterpolationType::CSSConversionChecker { public: UnderlyingImageChecker(const InterpolationValue& underlying) @@ -203,7 +203,7 @@ InterpolationValue CSSImageInterpolationType::MaybeConvertInitial( return nullptr; } -class InheritedImageChecker +class InheritedImageChecker final : public CSSInterpolationType::CSSConversionChecker { public: InheritedImageChecker(const CSSProperty& property, diff --git a/chromium/third_party/blink/renderer/core/animation/css_image_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_image_list_interpolation_type.cc index 52fc77278e9..e3090ccf7fd 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_image_list_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_image_list_interpolation_type.cc @@ -18,7 +18,7 @@ namespace blink { -class UnderlyingImageListChecker +class UnderlyingImageListChecker final : public CSSInterpolationType::CSSConversionChecker { public: explicit UnderlyingImageListChecker(const InterpolationValue& underlying) @@ -65,7 +65,7 @@ InterpolationValue CSSImageListInterpolationType::MaybeConvertStyleImageList( }); } -class InheritedImageListChecker +class InheritedImageListChecker final : public CSSInterpolationType::CSSConversionChecker { public: InheritedImageListChecker(const CSSProperty& property, diff --git a/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc b/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc index 71ea57ec1e4..27982868f56 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc @@ -9,6 +9,7 @@ #include "third_party/blink/public/mojom/feature_policy/feature_policy_feature.mojom-blink.h" #include "third_party/blink/renderer/core/animation/css_angle_interpolation_type.h" +#include "third_party/blink/renderer/core/animation/css_aspect_ratio_interpolation_type.h" #include "third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.h" #include "third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.h" #include "third_party/blink/renderer/core/animation/css_clip_interpolation_type.h" @@ -83,28 +84,22 @@ const InterpolationTypes& CSSInterpolationTypesMap::Get( DEFINE_STATIC_LOCAL(ApplicableTypesMap, all_applicable_types_map, ()); DEFINE_STATIC_LOCAL(ApplicableTypesMap, composited_applicable_types_map, ()); - ApplicableTypesMap& applicable_types_map = - allow_all_animations_ ? all_applicable_types_map - : composited_applicable_types_map; - - auto entry = applicable_types_map.find(property); - bool found_entry = entry != applicable_types_map.end(); - // Custom property interpolation types may change over time so don't trust the - // applicableTypesMap without checking the registry. + // applicable_types_map without checking the registry. Also since the static + // map is shared between documents, the registered type may be different in + // the different documents. if (registry_ && property.IsCSSCustomProperty()) { - const auto* registration = GetRegistration(registry_, property); - if (registration) { - if (found_entry) { - applicable_types_map.erase(entry); - } + if (const auto* registration = GetRegistration(registry_, property)) return registration->GetInterpolationTypes(); - } } - if (found_entry) { + ApplicableTypesMap& applicable_types_map = + allow_all_animations_ ? all_applicable_types_map + : composited_applicable_types_map; + + auto entry = applicable_types_map.find(property); + if (entry != applicable_types_map.end()) return *entry->value; - } std::unique_ptr applicable_types = std::make_unique(); @@ -179,6 +174,10 @@ const InterpolationTypes& CSSInterpolationTypesMap::Get( applicable_types->push_back( std::make_unique(used_property)); break; + case CSSPropertyID::kAspectRatio: + applicable_types->push_back( + std::make_unique(used_property)); + break; case CSSPropertyID::kFlexGrow: case CSSPropertyID::kFlexShrink: case CSSPropertyID::kFillOpacity: diff --git a/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map_test.cc b/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map_test.cc new file mode 100644 index 00000000000..8811ad19b65 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map_test.cc @@ -0,0 +1,49 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/animation/css_interpolation_types_map.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/feature_policy/document_policy.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" +#include "third_party/blink/renderer/core/css/property_registry.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/dom/document_init.h" +#include "third_party/blink/renderer/core/testing/null_execution_context.h" + +namespace blink { + +TEST(CSSInterpolationTypesMapTest, RegisteredCustomProperty) { + auto* execution_context = MakeGarbageCollected(); + execution_context->SetUpSecurityContextForTesting(); + execution_context->GetSecurityContext().SetDocumentPolicy( + DocumentPolicy::CreateWithHeaderPolicy({})); + + DocumentInit init = + DocumentInit::Create().WithExecutionContext(execution_context); + auto* document1 = MakeGarbageCollected(init); + auto* document2 = MakeGarbageCollected(init); + + AtomicString property_name("--x"); + PropertyRegistration* registration = + css_test_helpers::CreateLengthRegistration(property_name, 0); + PropertyRegistry* registry = MakeGarbageCollected(); + registry->RegisterProperty(property_name, *registration); + + CSSInterpolationTypesMap map1(nullptr, *document1); + CSSInterpolationTypesMap map2(registry, *document2); + + PropertyHandle handle(property_name); + auto& types1 = map1.Get(handle); + auto& types2 = map2.Get(handle); + EXPECT_NE(&types1, &types2); + EXPECT_EQ(types1.size(), 1u); + + auto& types1_1 = map1.Get(handle); + EXPECT_EQ(&types1, &types1_1); + + execution_context->NotifyContextDestroyed(); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc index 12c18f32300..936b3fbf773 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc @@ -155,12 +155,14 @@ void CSSLengthInterpolationType::ApplyStandardPropertyValue( const float kSlack = 1e-6; const float before_length = FloatValueForLength(before, 100); const float after_length = FloatValueForLength(after, 100); - // Test relative difference for large values to avoid floating point - // inaccuracies tripping the check. - const float delta = std::abs(before_length) < kSlack - ? after_length - before_length - : (after_length - before_length) / before_length; - DCHECK_LT(std::abs(delta), kSlack); + if (std::isfinite(before_length) && std::isfinite(after_length)) { + // Test relative difference for large values to avoid floating point + // inaccuracies tripping the check. + const float delta = std::abs(before_length) < kSlack + ? after_length - before_length + : (after_length - before_length) / before_length; + DCHECK_LT(std::abs(delta), kSlack); + } #endif return; } diff --git a/chromium/third_party/blink/renderer/core/animation/css_length_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_length_list_interpolation_type.cc index d05ce01f00f..93c37aa00ea 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_length_list_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_length_list_interpolation_type.cc @@ -65,7 +65,7 @@ InterpolationValue CSSLengthListInterpolationType::MaybeConvertInitial( return MaybeConvertLengthList(initial_length_list, 1); } -class InheritedLengthListChecker +class InheritedLengthListChecker final : public CSSInterpolationType::CSSConversionChecker { public: InheritedLengthListChecker(const CSSProperty& property, diff --git a/chromium/third_party/blink/renderer/core/animation/css_paint_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_paint_interpolation_type.cc index 61fdbd23305..8e14fe549c4 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_paint_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_paint_interpolation_type.cc @@ -30,9 +30,9 @@ bool GetColor(const CSSProperty& property, StyleColor& result) { switch (property.PropertyID()) { case CSSPropertyID::kFill: - return GetColorFromPaint(style.SvgStyle().FillPaint(), result); + return GetColorFromPaint(style.FillPaint(), result); case CSSPropertyID::kStroke: - return GetColorFromPaint(style.SvgStyle().StrokePaint(), result); + return GetColorFromPaint(style.StrokePaint(), result); default: NOTREACHED(); return false; @@ -126,15 +126,14 @@ void CSSPaintInterpolationType::ApplyStandardPropertyValue( StyleResolverState& state) const { Color color = CSSColorInterpolationType::ResolveInterpolableColor( interpolable_color, state); - SVGComputedStyle& mutable_svg_style = state.Style()->AccessSVGStyle(); switch (CssProperty().PropertyID()) { case CSSPropertyID::kFill: - mutable_svg_style.SetFillPaint(SVGPaint(color)); - mutable_svg_style.SetInternalVisitedFillPaint(SVGPaint(color)); + state.Style()->SetFillPaint(SVGPaint(color)); + state.Style()->SetInternalVisitedFillPaint(SVGPaint(color)); break; case CSSPropertyID::kStroke: - mutable_svg_style.SetStrokePaint(SVGPaint(color)); - mutable_svg_style.SetInternalVisitedStrokePaint(SVGPaint(color)); + state.Style()->SetStrokePaint(SVGPaint(color)); + state.Style()->SetInternalVisitedStrokePaint(SVGPaint(color)); break; default: NOTREACHED(); diff --git a/chromium/third_party/blink/renderer/core/animation/css_path_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_path_interpolation_type.cc index d60b39522ee..aa9fbc19052 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_path_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_path_interpolation_type.cc @@ -24,7 +24,7 @@ const StylePath* GetPath(const CSSProperty& property, const ComputedStyle& style) { switch (property.PropertyID()) { case CSSPropertyID::kD: - return style.SvgStyle().D(); + return style.D(); case CSSPropertyID::kOffsetPath: return DynamicTo(style.OffsetPath()); case CSSPropertyID::kClipPath: { diff --git a/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.cc index 9da7670ecb9..a61bdf0b566 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.cc @@ -81,7 +81,7 @@ class InheritedScaleChecker } // namespace -class CSSScaleNonInterpolableValue : public NonInterpolableValue { +class CSSScaleNonInterpolableValue final : public NonInterpolableValue { public: ~CSSScaleNonInterpolableValue() final = default; diff --git a/chromium/third_party/blink/renderer/core/animation/css_size_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_size_list_interpolation_type.cc index 829c2921e6e..cb79a29792b 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_size_list_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_size_list_interpolation_type.cc @@ -18,7 +18,7 @@ namespace blink { -class UnderlyingSizeListChecker +class UnderlyingSizeListChecker final : public CSSInterpolationType::CSSConversionChecker { public: explicit UnderlyingSizeListChecker(const NonInterpolableList& underlying_list) @@ -47,7 +47,7 @@ class UnderlyingSizeListChecker scoped_refptr underlying_list_; }; -class InheritedSizeListChecker +class InheritedSizeListChecker final : public CSSInterpolationType::CSSConversionChecker { public: InheritedSizeListChecker(const CSSProperty& property, diff --git a/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc index f3156672400..711c61fa9d2 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc @@ -13,7 +13,7 @@ namespace blink { -class CSSVisibilityNonInterpolableValue : public NonInterpolableValue { +class CSSVisibilityNonInterpolableValue final : public NonInterpolableValue { public: ~CSSVisibilityNonInterpolableValue() final = default; @@ -59,7 +59,7 @@ struct DowncastTraits { } }; -class UnderlyingVisibilityChecker +class UnderlyingVisibilityChecker final : public CSSInterpolationType::CSSConversionChecker { public: explicit UnderlyingVisibilityChecker(EVisibility visibility) diff --git a/chromium/third_party/blink/renderer/core/animation/document_animations.cc b/chromium/third_party/blink/renderer/core/animation/document_animations.cc index 74629dfc276..c7ed01c694e 100644 --- a/chromium/third_party/blink/renderer/core/animation/document_animations.cc +++ b/chromium/third_party/blink/renderer/core/animation/document_animations.cc @@ -71,6 +71,7 @@ DocumentAnimations::DocumentAnimations(Document* document) void DocumentAnimations::AddTimeline(AnimationTimeline& timeline) { timelines_.insert(&timeline); + unvalidated_timelines_.insert(&timeline); } void DocumentAnimations::UpdateAnimationTimingForAnimationFrame() { @@ -159,6 +160,15 @@ HeapVector> DocumentAnimations::getAnimations( return animations; } +void DocumentAnimations::ValidateTimelines() { + for (auto& timeline : unvalidated_timelines_) { + if (auto* scroll_timeline = DynamicTo(timeline.Get())) + scroll_timeline->ValidateState(); + } + + unvalidated_timelines_.clear(); +} + void DocumentAnimations::CacheCSSScrollTimeline(CSSScrollTimeline& timeline) { // We cache the least seen CSSScrollTimeline for a given name. cached_css_timelines_.Set(timeline.Name(), &timeline); @@ -172,6 +182,7 @@ CSSScrollTimeline* DocumentAnimations::FindCachedCSSScrollTimeline( void DocumentAnimations::Trace(Visitor* visitor) const { visitor->Trace(document_); visitor->Trace(timelines_); + visitor->Trace(unvalidated_timelines_); visitor->Trace(cached_css_timelines_); } diff --git a/chromium/third_party/blink/renderer/core/animation/document_animations.h b/chromium/third_party/blink/renderer/core/animation/document_animations.h index f5e30f0a731..759d9f34600 100644 --- a/chromium/third_party/blink/renderer/core/animation/document_animations.h +++ b/chromium/third_party/blink/renderer/core/animation/document_animations.h @@ -72,6 +72,22 @@ class CORE_EXPORT DocumentAnimations final HeapVector> getAnimations(const TreeScope&); + // All newly created AnimationTimelines are considered "unvalidated". This + // means that the internal state of the timeline is considered tentative, + // and that computing the actual state may require an additional style/layout + // pass. + // + // The lifecycle update will call this function after style and layout has + // completed. The function will then go though all unvalidated timelines, + // and compare the current state snapshot to a fresh state snapshot. If they + // are equal, then the tentative state turned out to be correct, and no + // further action is needed. Otherwise, all effects targets associated with + // the timeline are marked for recalc, which causes the style/layout phase + // to run again. + // + // https://github.com/w3c/csswg-drafts/issues/5261 + void ValidateTimelines(); + void CacheCSSScrollTimeline(CSSScrollTimeline&); CSSScrollTimeline* FindCachedCSSScrollTimeline(const AtomicString&); @@ -79,6 +95,10 @@ class CORE_EXPORT DocumentAnimations final const { return timelines_; } + const HeapHashSet>& + GetUnvalidatedTimelinesForTesting() const { + return unvalidated_timelines_; + } uint64_t current_transition_generation_; void Trace(Visitor*) const; @@ -90,6 +110,7 @@ class CORE_EXPORT DocumentAnimations final private: Member document_; HeapHashSet> timelines_; + HeapHashSet> unvalidated_timelines_; // We cache CSSScrollTimelines by name, such that multiple animations using // the same timeline can use the same CSSScrollTimeline instance. diff --git a/chromium/third_party/blink/renderer/core/animation/document_animations_test.cc b/chromium/third_party/blink/renderer/core/animation/document_animations_test.cc index 9e8ec4d63ba..75ab69b5cea 100644 --- a/chromium/third_party/blink/renderer/core/animation/document_animations_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/document_animations_test.cc @@ -24,7 +24,7 @@ class MockAnimationTimeline : public AnimationTimeline { MOCK_METHOD0(Phase, TimelinePhase()); MOCK_CONST_METHOD0(IsActive, bool()); - MOCK_METHOD0(ZeroTimeInSeconds, double()); + MOCK_METHOD0(ZeroTime, AnimationTimeDelta()); MOCK_METHOD0(InitialStartTimeForAnimations, base::Optional()); MOCK_METHOD0(NeedsAnimationTimingUpdate, bool()); diff --git a/chromium/third_party/blink/renderer/core/animation/document_timeline.cc b/chromium/third_party/blink/renderer/core/animation/document_timeline.cc index c05b1f14b81..6abfb137535 100644 --- a/chromium/third_party/blink/renderer/core/animation/document_timeline.cc +++ b/chromium/third_party/blink/renderer/core/animation/document_timeline.cc @@ -44,10 +44,11 @@ namespace { // Returns the current animation time for a given |document|. This is // the animation clock time capped to be at least this document's -// ZeroTime() such that the animation time is never negative when converted. +// CalculateZeroTime() such that the animation time is never negative when +// converted. base::TimeTicks CurrentAnimationTime(Document* document) { base::TimeTicks animation_time = document->GetAnimationClock().CurrentTime(); - base::TimeTicks document_zero_time = document->Timeline().ZeroTime(); + base::TimeTicks document_zero_time = document->Timeline().CalculateZeroTime(); // The AnimationClock time may be null or less than the local document's // zero time if we have not generated any frames for this document yet. If @@ -142,10 +143,11 @@ void DocumentTimeline::DocumentTimelineTiming::WakeAfter( void DocumentTimeline::DocumentTimelineTiming::Trace(Visitor* visitor) const { visitor->Trace(timeline_); + visitor->Trace(timer_); DocumentTimeline::PlatformTiming::Trace(visitor); } -base::TimeTicks DocumentTimeline::ZeroTime() { +base::TimeTicks DocumentTimeline::CalculateZeroTime() { if (!zero_time_initialized_ && document_->Loader()) { zero_time_ = document_->Loader()->GetTiming().ReferenceMonotonicTime() + origin_time_; @@ -172,12 +174,14 @@ AnimationTimeline::PhaseAndTime DocumentTimeline::CurrentPhaseAndTime() { base::Optional result = playback_rate_ == 0 - ? ZeroTime().since_origin() - : (CurrentAnimationTime(GetDocument()) - ZeroTime()) * playback_rate_; + ? CalculateZeroTime().since_origin() + : (CurrentAnimationTime(GetDocument()) - CalculateZeroTime()) * + playback_rate_; return {TimelinePhase::kActive, result}; } -void DocumentTimeline::PauseAnimationsForTesting(double pause_time) { +void DocumentTimeline::PauseAnimationsForTesting( + AnimationTimeDelta pause_time) { for (const auto& animation : animations_needing_update_) animation->PauseForTesting(pause_time); ServiceAnimations(kTimingUpdateOnDemand); diff --git a/chromium/third_party/blink/renderer/core/animation/document_timeline.h b/chromium/third_party/blink/renderer/core/animation/document_timeline.h index a1392ecdb62..87ae16853da 100644 --- a/chromium/third_party/blink/renderer/core/animation/document_timeline.h +++ b/chromium/third_party/blink/renderer/core/animation/document_timeline.h @@ -78,12 +78,14 @@ class CORE_EXPORT DocumentTimeline : public AnimationTimeline { // The zero time of DocumentTimeline is computed by adding a separate // |origin_time_| from DocumentTimelineOptions. // https://drafts.csswg.org/web-animations/#origin-time - base::TimeTicks ZeroTime(); - double ZeroTimeInSeconds() override { - return ZeroTime().since_origin().InSecondsF(); + // TODO(crbug.com/1162960) Convert DocumentTimeline::zero_time_ from + // base::TimeTicks to AnimationTimeDelta + base::TimeTicks CalculateZeroTime(); + AnimationTimeDelta ZeroTime() override { + return AnimationTimeDelta(CalculateZeroTime().since_origin()); } - void PauseAnimationsForTesting(double); + void PauseAnimationsForTesting(AnimationTimeDelta); void InvalidateKeyframeEffects(const TreeScope&); @@ -107,6 +109,8 @@ class CORE_EXPORT DocumentTimeline : public AnimationTimeline { base::TimeDelta origin_time_; // The origin time. This is computed by adding |origin_time_| to the time // origin of the document. + // TODO(crbug.com/1162960) Convert DocumentTimeline::zero_time_ from + // base::TimeTicks to AnimationTimeDelta base::TimeTicks zero_time_; bool zero_time_initialized_; @@ -119,7 +123,7 @@ class CORE_EXPORT DocumentTimeline : public AnimationTimeline { class DocumentTimelineTiming final : public PlatformTiming { public: - DocumentTimelineTiming(DocumentTimeline* timeline) + explicit DocumentTimelineTiming(DocumentTimeline* timeline) : timeline_(timeline), timer_(timeline->GetDocument()->GetTaskRunner( TaskType::kInternalDefault), @@ -136,7 +140,7 @@ class CORE_EXPORT DocumentTimeline : public AnimationTimeline { private: Member timeline_; - TaskRunnerTimer timer_; + HeapTaskRunnerTimer timer_; }; friend class AnimationDocumentTimelineTest; diff --git a/chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc b/chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc index f165b142f00..6df9206afa0 100644 --- a/chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc @@ -38,6 +38,7 @@ #include "third_party/blink/renderer/core/animation/keyframe_effect.h" #include "third_party/blink/renderer/core/animation/keyframe_effect_model.h" #include "third_party/blink/renderer/core/animation/pending_animations.h" +#include "third_party/blink/renderer/core/animation/timing_calculations.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/qualified_name.h" @@ -53,6 +54,10 @@ namespace { base::TimeTicks TimeTicksFromMillisecondsD(double seconds) { return base::TimeTicks() + base::TimeDelta::FromMillisecondsD(seconds); } + +#define EXPECT_TIME_NEAR(expected, value) \ + EXPECT_NEAR((expected).InMillisecondsF(), (value).InMillisecondsF(), \ + Animation::kTimeToleranceMs) } // namespace namespace blink { @@ -209,16 +214,16 @@ TEST_F(AnimationDocumentTimelineTest, CurrentTimeSeconds) { } TEST_F(AnimationDocumentTimelineTest, PlaybackRateNormal) { - base::TimeTicks zero_time = timeline->ZeroTime(); + base::TimeTicks zero_time = timeline->CalculateZeroTime(); timeline->SetPlaybackRate(1.0); EXPECT_EQ(1.0, timeline->PlaybackRate()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(1000)); - EXPECT_EQ(zero_time, timeline->ZeroTime()); + EXPECT_EQ(zero_time, timeline->CalculateZeroTime()); EXPECT_EQ(1000, timeline->CurrentTimeMilliseconds()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(2000)); - EXPECT_EQ(zero_time, timeline->ZeroTime()); + EXPECT_EQ(zero_time, timeline->CalculateZeroTime()); EXPECT_EQ(2000, timeline->CurrentTimeMilliseconds()); } @@ -229,33 +234,33 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRateNormalWithOriginTime) { timeline->ResetForTesting(); EXPECT_EQ(1.0, timeline->PlaybackRate()); - EXPECT_EQ(base::TimeTicks() + origin_time, timeline->ZeroTime()); + EXPECT_EQ(base::TimeTicks() + origin_time, timeline->CalculateZeroTime()); EXPECT_EQ(1000, timeline->CurrentTimeMilliseconds()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(100)); - EXPECT_EQ(base::TimeTicks() + origin_time, timeline->ZeroTime()); + EXPECT_EQ(base::TimeTicks() + origin_time, timeline->CalculateZeroTime()); EXPECT_EQ(1100, timeline->CurrentTimeMilliseconds()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(200)); - EXPECT_EQ(base::TimeTicks() + origin_time, timeline->ZeroTime()); + EXPECT_EQ(base::TimeTicks() + origin_time, timeline->CalculateZeroTime()); EXPECT_EQ(1200, timeline->CurrentTimeMilliseconds()); } TEST_F(AnimationDocumentTimelineTest, PlaybackRatePause) { GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(1000)); - EXPECT_EQ(base::TimeTicks(), timeline->ZeroTime()); + EXPECT_EQ(base::TimeTicks(), timeline->CalculateZeroTime()); EXPECT_EQ(1000, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(0.0); EXPECT_EQ(0.0, timeline->PlaybackRate()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(2000)); - EXPECT_EQ(TimeTicksFromMillisecondsD(1000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(1000), timeline->CalculateZeroTime()); EXPECT_EQ(1000, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(1.0); EXPECT_EQ(1.0, timeline->PlaybackRate()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(4000)); - EXPECT_EQ(TimeTicksFromMillisecondsD(1000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(1000), timeline->CalculateZeroTime()); EXPECT_EQ(3000, timeline->CurrentTimeMilliseconds()); } @@ -265,61 +270,61 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRatePauseWithOriginTime) { document.Get(), origin_time, platform_timing); timeline->ResetForTesting(); - EXPECT_EQ(base::TimeTicks() + origin_time, timeline->ZeroTime()); + EXPECT_EQ(base::TimeTicks() + origin_time, timeline->CalculateZeroTime()); EXPECT_EQ(1000, timeline->CurrentTimeMilliseconds()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(100)); - EXPECT_EQ(base::TimeTicks() + origin_time, timeline->ZeroTime()); + EXPECT_EQ(base::TimeTicks() + origin_time, timeline->CalculateZeroTime()); EXPECT_EQ(1100, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(0.0); EXPECT_EQ(0.0, timeline->PlaybackRate()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(200)); - EXPECT_EQ(TimeTicksFromMillisecondsD(1100), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(1100), timeline->CalculateZeroTime()); EXPECT_EQ(1100, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(1.0); EXPECT_EQ(1.0, timeline->PlaybackRate()); - EXPECT_EQ(TimeTicksFromMillisecondsD(-900), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(-900), timeline->CalculateZeroTime()); EXPECT_EQ(1100, timeline->CurrentTimeMilliseconds()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(400)); - EXPECT_EQ(TimeTicksFromMillisecondsD(-900), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(-900), timeline->CalculateZeroTime()); EXPECT_EQ(1300, timeline->CurrentTimeMilliseconds()); } TEST_F(AnimationDocumentTimelineTest, PlaybackRateSlow) { GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(1000)); - EXPECT_EQ(base::TimeTicks(), timeline->ZeroTime()); + EXPECT_EQ(base::TimeTicks(), timeline->CalculateZeroTime()); EXPECT_EQ(1000, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(0.5); EXPECT_EQ(0.5, timeline->PlaybackRate()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(3000)); - EXPECT_EQ(TimeTicksFromMillisecondsD(-1000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(-1000), timeline->CalculateZeroTime()); EXPECT_EQ(2000, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(1.0); EXPECT_EQ(1.0, timeline->PlaybackRate()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(4000)); - EXPECT_EQ(TimeTicksFromMillisecondsD(1000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(1000), timeline->CalculateZeroTime()); EXPECT_EQ(3000, timeline->CurrentTimeMilliseconds()); } TEST_F(AnimationDocumentTimelineTest, PlaybackRateFast) { GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(1000)); - EXPECT_EQ(base::TimeTicks(), timeline->ZeroTime()); + EXPECT_EQ(base::TimeTicks(), timeline->CalculateZeroTime()); EXPECT_EQ(1000, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(2.0); EXPECT_EQ(2.0, timeline->PlaybackRate()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(3000)); - EXPECT_EQ(TimeTicksFromMillisecondsD(500), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(500), timeline->CalculateZeroTime()); EXPECT_EQ(5000, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(1.0); EXPECT_EQ(1.0, timeline->PlaybackRate()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(4000)); - EXPECT_EQ(TimeTicksFromMillisecondsD(-2000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(-2000), timeline->CalculateZeroTime()); EXPECT_EQ(6000, timeline->CurrentTimeMilliseconds()); } @@ -329,30 +334,33 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRateFastWithOriginTime) { timeline->ResetForTesting(); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(100000)); - EXPECT_EQ(TimeTicksFromMillisecondsD(-1000000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(-1000000), + timeline->CalculateZeroTime()); EXPECT_EQ(1100000, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(2.0); EXPECT_EQ(2.0, timeline->PlaybackRate()); - EXPECT_EQ(TimeTicksFromMillisecondsD(-450000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(-450000), timeline->CalculateZeroTime()); EXPECT_EQ(1100000, timeline->CurrentTimeMilliseconds()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(300000)); - EXPECT_EQ(TimeTicksFromMillisecondsD(-450000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(-450000), timeline->CalculateZeroTime()); EXPECT_EQ(1500000, timeline->CurrentTimeMilliseconds()); timeline->SetPlaybackRate(1.0); EXPECT_EQ(1.0, timeline->PlaybackRate()); - EXPECT_EQ(TimeTicksFromMillisecondsD(-1200000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(-1200000), + timeline->CalculateZeroTime()); EXPECT_EQ(1500000, timeline->CurrentTimeMilliseconds()); GetAnimationClock().UpdateTime(TimeTicksFromMillisecondsD(400000)); - EXPECT_EQ(TimeTicksFromMillisecondsD(-1200000), timeline->ZeroTime()); + EXPECT_EQ(TimeTicksFromMillisecondsD(-1200000), + timeline->CalculateZeroTime()); EXPECT_EQ(1600000, timeline->CurrentTimeMilliseconds()); } TEST_F(AnimationDocumentTimelineTest, PauseForTesting) { - float seek_time = 1; + AnimationTimeDelta seek_time = AnimationTimeDelta::FromSecondsD(1); timing.fill_mode = Timing::FillMode::FORWARDS; auto* anim1 = MakeGarbageCollected( element.Get(), CreateEmptyEffectModel(), timing); @@ -362,8 +370,13 @@ TEST_F(AnimationDocumentTimelineTest, PauseForTesting) { Animation* animation2 = timeline->Play(anim2); timeline->PauseAnimationsForTesting(seek_time); - EXPECT_FLOAT_EQ(seek_time * 1000, animation1->currentTime().value()); - EXPECT_FLOAT_EQ(seek_time * 1000, animation2->currentTime().value()); + CSSNumberish current_time; + animation1->currentTime(current_time); + EXPECT_NEAR(seek_time.InMillisecondsF(), current_time.GetAsDouble(), + Animation::kTimeToleranceMs); + animation2->currentTime(current_time); + EXPECT_NEAR(seek_time.InMillisecondsF(), current_time.GetAsDouble(), + Animation::kTimeToleranceMs); } TEST_F(AnimationDocumentTimelineTest, DelayBeforeAnimationStart) { @@ -397,7 +410,7 @@ TEST_F(AnimationDocumentTimelineTest, UseAnimationAfterTimelineDeref) { Animation* animation = timeline->Play(nullptr); timeline.Clear(); // Test passes if this does not crash. - animation->setStartTime(0); + animation->setStartTime(CSSNumberish::FromDouble(0)); } TEST_F(AnimationDocumentTimelineTest, PlayAfterDocumentDeref) { @@ -459,8 +472,9 @@ TEST_F(AnimationDocumentTimelineRealTimeTest, DocumentTimeline* timeline = MakeGarbageCollected(document.Get(), origin_time); timeline->SetPlaybackRate(0.5); - EXPECT_EQ(origin_time * 2, - timeline->ZeroTime() - document->Timeline().ZeroTime()); + + EXPECT_TIME_NEAR(AnimationTimeDelta(origin_time) * 2, + timeline->ZeroTime() - document->Timeline().ZeroTime()); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/effect_stack_test.cc b/chromium/third_party/blink/renderer/core/animation/effect_stack_test.cc index 8f4ea26b32f..bf4f93ecf76 100644 --- a/chromium/third_party/blink/renderer/core/animation/effect_stack_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/effect_stack_test.cc @@ -34,14 +34,14 @@ class AnimationEffectStackTest : public PageTestBase { Animation* Play(KeyframeEffect* effect, double start_time) { Animation* animation = timeline->Play(effect); - animation->setStartTime(start_time * 1000); + animation->setStartTime(CSSNumberish::FromDouble(start_time * 1000)); animation->Update(kTimingUpdateOnDemand); return animation; } void UpdateTimeline(base::TimeDelta time) { GetDocument().GetAnimationClock().UpdateTime( - GetDocument().Timeline().ZeroTime() + time); + GetDocument().Timeline().CalculateZeroTime() + time); timeline->ServiceAnimations(kTimingUpdateForAnimationFrame); } @@ -68,8 +68,8 @@ class AnimationEffectStackTest : public PageTestBase { InertEffect* MakeInertEffect(KeyframeEffectModelBase* effect) { Timing timing; timing.fill_mode = Timing::FillMode::BOTH; - return MakeGarbageCollected(effect, timing, false, 0, - base::nullopt); + return MakeGarbageCollected( + effect, timing, false, AnimationTimeDelta(), base::nullopt); } KeyframeEffect* MakeKeyframeEffect(KeyframeEffectModelBase* effect, diff --git a/chromium/third_party/blink/renderer/core/animation/element_animations.cc b/chromium/third_party/blink/renderer/core/animation/element_animations.cc index 705df935c98..afad6b763cf 100644 --- a/chromium/third_party/blink/renderer/core/animation/element_animations.cc +++ b/chromium/third_party/blink/renderer/core/animation/element_animations.cc @@ -51,6 +51,8 @@ void UpdateAnimationFlagsForEffect(const KeyframeEffect& effect, style.SetHasCurrentFilterAnimation(true); if (effect.Affects(PropertyHandle(GetCSSPropertyBackdropFilter()))) style.SetHasCurrentBackdropFilterAnimation(true); + if (effect.Affects(PropertyHandle(GetCSSPropertyBackgroundColor()))) + style.SetHasCurrentBackgroundColorAnimation(true); } } // namespace @@ -151,4 +153,16 @@ bool ElementAnimations::UpdateBoxSizeAndCheckTransformAxisAlignment( return preserves_axis_alignment; } +bool ElementAnimations::IsIdentityOrTranslation() const { + for (auto& entry : animations_) { + if (auto* effect = DynamicTo(entry.key->effect())) { + if (!effect->IsCurrent() && !effect->IsInEffect()) + continue; + if (!effect->IsIdentityOrTranslation()) + return false; + } + } + return true; +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/element_animations.h b/chromium/third_party/blink/renderer/core/animation/element_animations.h index a0277a0724a..babb8cbff4c 100644 --- a/chromium/third_party/blink/renderer/core/animation/element_animations.h +++ b/chromium/third_party/blink/renderer/core/animation/element_animations.h @@ -89,6 +89,7 @@ class CORE_EXPORT ElementAnimations final void ClearBaseComputedStyle(); bool UpdateBoxSizeAndCheckTransformAxisAlignment(const FloatSize& box_size); + bool IsIdentityOrTranslation() const; void Trace(Visitor*) const; diff --git a/chromium/third_party/blink/renderer/core/animation/inert_effect.cc b/chromium/third_party/blink/renderer/core/animation/inert_effect.cc index 7599fe76593..210a2dfced5 100644 --- a/chromium/third_party/blink/renderer/core/animation/inert_effect.cc +++ b/chromium/third_party/blink/renderer/core/animation/inert_effect.cc @@ -37,7 +37,7 @@ namespace blink { InertEffect::InertEffect(KeyframeEffectModelBase* model, const Timing& timing, bool paused, - base::Optional inherited_time, + base::Optional inherited_time, base::Optional inherited_phase) : AnimationEffect(timing), model_(model), diff --git a/chromium/third_party/blink/renderer/core/animation/inert_effect.h b/chromium/third_party/blink/renderer/core/animation/inert_effect.h index 157b1207093..76e785839a5 100644 --- a/chromium/third_party/blink/renderer/core/animation/inert_effect.h +++ b/chromium/third_party/blink/renderer/core/animation/inert_effect.h @@ -45,7 +45,7 @@ class CORE_EXPORT InertEffect final : public AnimationEffect { InertEffect(KeyframeEffectModelBase*, const Timing&, bool paused, - base::Optional inherited_time, + base::Optional inherited_time, base::Optional inherited_phase); void Sample(HeapVector>&) const; @@ -66,7 +66,7 @@ class CORE_EXPORT InertEffect final : public AnimationEffect { private: Member model_; bool paused_; - base::Optional inherited_time_; + base::Optional inherited_time_; base::Optional inherited_phase_; }; diff --git a/chromium/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.cc b/chromium/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.cc new file mode 100644 index 00000000000..cfcbc5408f0 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.cc @@ -0,0 +1,65 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h" +#include "third_party/blink/renderer/core/animation/interpolable_value.h" +#include "third_party/blink/renderer/core/css/resolver/style_resolver_state.h" +#include "third_party/blink/renderer/core/style/style_aspect_ratio.h" +#include "third_party/blink/renderer/platform/runtime_enabled_features.h" + +namespace blink { + +// static +std::unique_ptr InterpolableAspectRatio::MaybeCreate( + const StyleAspectRatio& aspect_ratio) { + if (!RuntimeEnabledFeatures::CSSAspectRatioInterpolationEnabled()) + return nullptr; + + // Auto aspect ratio cannot be interpolated to / from. + if (aspect_ratio.IsAuto()) + return nullptr; + return std::make_unique(aspect_ratio.GetRatio()); +} + +InterpolableAspectRatio::InterpolableAspectRatio( + const FloatSize& aspect_ratio) { + // The StyleAspectRatio::IsAuto check in MaybeCreate should return true if we + // have a degenerate aspect ratio. + DCHECK(aspect_ratio.Height() > 0 && aspect_ratio.Width() > 0); + + value_ = std::make_unique( + log(aspect_ratio.Width() / aspect_ratio.Height())); +} + +FloatSize InterpolableAspectRatio::GetRatio() const { + return FloatSize(exp(To(*value_).Value()), 1); +} + +void InterpolableAspectRatio::Scale(double scale) { + value_->Scale(scale); +} + +void InterpolableAspectRatio::Add(const InterpolableValue& other) { + value_->Add(*To(other).value_); +} + +void InterpolableAspectRatio::AssertCanInterpolateWith( + const InterpolableValue& other) const { + const InterpolableAspectRatio& other_aspect_ratio = + To(other); + value_->AssertCanInterpolateWith(*other_aspect_ratio.value_); +} + +void InterpolableAspectRatio::Interpolate(const InterpolableValue& to, + const double progress, + InterpolableValue& result) const { + const InterpolableAspectRatio& aspect_ratio_to = + To(to); + InterpolableAspectRatio& aspect_ratio_result = + To(result); + value_->Interpolate(*aspect_ratio_to.value_, progress, + *aspect_ratio_result.value_); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h b/chromium/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h new file mode 100644 index 00000000000..36d29a1d8df --- /dev/null +++ b/chromium/third_party/blink/renderer/core/animation/interpolable_aspect_ratio.h @@ -0,0 +1,62 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_INTERPOLABLE_ASPECT_RATIO_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_INTERPOLABLE_ASPECT_RATIO_H_ + +#include +#include "third_party/blink/renderer/core/animation/interpolable_value.h" +#include "third_party/blink/renderer/core/style/style_aspect_ratio.h" + +namespace blink { + +// Represents a blink::StyleAspectRatio, converted into its logarithm for +// interpolation. +class CORE_EXPORT InterpolableAspectRatio final : public InterpolableValue { + public: + explicit InterpolableAspectRatio(const FloatSize& ratio); + explicit InterpolableAspectRatio(std::unique_ptr value) + : value_(std::move(value)) {} + + static std::unique_ptr MaybeCreate( + const StyleAspectRatio&); + + FloatSize GetRatio() const; + + // InterpolableValue implementation: + void Interpolate(const InterpolableValue& to, + const double progress, + InterpolableValue& result) const final; + bool IsAspectRatio() const final { return true; } + bool Equals(const InterpolableValue& other) const final { + NOTREACHED(); + return false; + } + void Scale(double scale) final; + void Add(const InterpolableValue& other) final; + void AssertCanInterpolateWith(const InterpolableValue& other) const final; + + private: + InterpolableAspectRatio* RawClone() const final { + return new InterpolableAspectRatio(value_->Clone()); + } + InterpolableAspectRatio* RawCloneAndZero() const final { + return new InterpolableAspectRatio(value_->CloneAndZero()); + } + + // Interpolable aspect ratio value is stored and interpolated as the log of + // the real aspect ratio. + std::unique_ptr value_; +}; + +template <> +struct DowncastTraits { + static bool AllowFrom(const InterpolableValue& interpolable_value) { + return interpolable_value.IsAspectRatio(); + } +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_ANIMATION_INTERPOLABLE_ASPECT_RATIO_H_ diff --git a/chromium/third_party/blink/renderer/core/animation/interpolable_length.cc b/chromium/third_party/blink/renderer/core/animation/interpolable_length.cc index 08e6cc60d5a..4e958c4de06 100644 --- a/chromium/third_party/blink/renderer/core/animation/interpolable_length.cc +++ b/chromium/third_party/blink/renderer/core/animation/interpolable_length.cc @@ -204,8 +204,11 @@ static UnitType IndexToUnitType(wtf_size_t index) { Length InterpolableLength::CreateLength( const CSSToLengthConversionData& conversion_data, ValueRange range) const { + // Passing true for ToCalcValue is a dirty hack to ensure that we don't create + // a degenerate value when animating 'background-position', while we know it + // may cause some minor animation glitches for the other properties. if (IsExpression()) - return Length(expression_->ToCalcValue(conversion_data, range)); + return Length(expression_->ToCalcValue(conversion_data, range, true)); bool has_percentage = HasPercentage(); double pixels = 0; diff --git a/chromium/third_party/blink/renderer/core/animation/interpolable_value.h b/chromium/third_party/blink/renderer/core/animation/interpolable_value.h index 0a846d2f464..21428f41228 100644 --- a/chromium/third_party/blink/renderer/core/animation/interpolable_value.h +++ b/chromium/third_party/blink/renderer/core/animation/interpolable_value.h @@ -39,6 +39,7 @@ class CORE_EXPORT InterpolableValue { virtual bool IsBool() const { return false; } virtual bool IsList() const { return false; } virtual bool IsLength() const { return false; } + virtual bool IsAspectRatio() const { return false; } virtual bool IsShadow() const { return false; } virtual bool IsFilter() const { return false; } virtual bool IsTransformList() const { return false; } diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe_effect.cc b/chromium/third_party/blink/renderer/core/animation/keyframe_effect.cc index 082b5a3ee9f..3cc8831033b 100644 --- a/chromium/third_party/blink/renderer/core/animation/keyframe_effect.cc +++ b/chromium/third_party/blink/renderer/core/animation/keyframe_effect.cc @@ -432,7 +432,7 @@ void KeyframeEffect::AttachCompositedLayers() { // very special element id for this animation so that the compositor animation // system recognize it. We do not use 0 as the element id because 0 is // kInvalidElementId. - if (compositor_animation && !Model()->HasNonVariableProperty()) { + if (compositor_animation && !Model()->RequiresPropertyNode()) { compositor_animation->AttachNoElement(); return; } @@ -503,12 +503,10 @@ bool KeyframeEffect::UpdateBoxSizeAndCheckTransformAxisAlignment( if (effect_target_size_) { if ((size_dependencies & TransformOperation::kDependsWidth) && (effect_target_size_->Width() != box_size.Width())) - GetAnimation()->RestartAnimationOnCompositor(); + RestartRunningAnimationOnCompositor(); else if ((size_dependencies & TransformOperation::kDependsHeight) && - (effect_target_size_->Width() != box_size.Height())) - GetAnimation()->RestartAnimationOnCompositor(); - } else if (size_dependencies) { - GetAnimation()->RestartAnimationOnCompositor(); + (effect_target_size_->Height() != box_size.Height())) + RestartRunningAnimationOnCompositor(); } } @@ -517,6 +515,40 @@ bool KeyframeEffect::UpdateBoxSizeAndCheckTransformAxisAlignment( return preserves_axis_alignment; } +void KeyframeEffect::RestartRunningAnimationOnCompositor() { + Animation* animation = GetAnimation(); + if (!animation) + return; + + // No need to to restart an animation that is in the process of starting up, + // paused or idle. + if (!animation->StartTimeInternal()) + return; + + animation->RestartAnimationOnCompositor(); +} + +bool KeyframeEffect::IsIdentityOrTranslation() const { + static const auto** properties = TransformProperties(); + for (size_t i = 0; i < num_transform_properties; i++) { + const auto* keyframes = + Model()->GetPropertySpecificKeyframes(PropertyHandle(*properties[i])); + if (!keyframes) + continue; + + for (const auto& keyframe : *keyframes) { + if (const auto* value = keyframe->GetCompositorKeyframeValue()) { + if (!To(value) + ->GetTransformOperations() + .IsIdentityOrTranslation()) { + return false; + } + } + } + } + return true; +} + EffectModel::CompositeOperation KeyframeEffect::CompositeInternal() const { return model_->Composite(); } @@ -744,7 +776,7 @@ void KeyframeEffect::CountAnimatedProperties() const { Document& document = target_element_->GetDocument(); for (const auto& property : model_->Properties()) { if (property.IsCSSProperty()) { - DCHECK(isValidCSSPropertyID(property.GetCSSProperty().PropertyID())); + DCHECK(IsValidCSSPropertyID(property.GetCSSProperty().PropertyID())); document.CountAnimatedProperty(property.GetCSSProperty().PropertyID()); } } diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe_effect.h b/chromium/third_party/blink/renderer/core/animation/keyframe_effect.h index e0e72423223..7e880f50f65 100644 --- a/chromium/third_party/blink/renderer/core/animation/keyframe_effect.h +++ b/chromium/third_party/blink/renderer/core/animation/keyframe_effect.h @@ -136,6 +136,7 @@ class CORE_EXPORT KeyframeEffect final : public AnimationEffect { void Trace(Visitor*) const override; bool UpdateBoxSizeAndCheckTransformAxisAlignment(const FloatSize& box_size); + bool IsIdentityOrTranslation() const; ActiveInterpolationsMap InterpolationsForCommitStyles(); @@ -165,6 +166,7 @@ class CORE_EXPORT KeyframeEffect final : public AnimationEffect { AnimationTimeDelta time_to_next_iteration) const override; bool HasIncompatibleStyle() const; bool HasMultipleTransformProperties() const; + void RestartRunningAnimationOnCompositor(); Member effect_target_; Member target_element_; diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model.cc b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model.cc index db13009db28..5eea620d145 100644 --- a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model.cc +++ b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model.cc @@ -96,15 +96,15 @@ bool KeyframeEffectModelBase::Sample( namespace { -static const size_t num_compositable_properties = 7; +static const size_t num_compositable_properties = 8; const CSSProperty** CompositableProperties() { static const CSSProperty* kCompositableProperties[num_compositable_properties] = { - &GetCSSPropertyOpacity(), &GetCSSPropertyRotate(), - &GetCSSPropertyScale(), &GetCSSPropertyTransform(), - &GetCSSPropertyTranslate(), &GetCSSPropertyFilter(), - &GetCSSPropertyBackdropFilter()}; + &GetCSSPropertyOpacity(), &GetCSSPropertyRotate(), + &GetCSSPropertyScale(), &GetCSSPropertyTransform(), + &GetCSSPropertyTranslate(), &GetCSSPropertyFilter(), + &GetCSSPropertyBackdropFilter(), &GetCSSPropertyBackgroundColor()}; return kCompositableProperties; } @@ -351,11 +351,13 @@ void KeyframeEffectModelBase::EnsureKeyframeGroups() const { } } -bool KeyframeEffectModelBase::HasNonVariableProperty() const { +bool KeyframeEffectModelBase::RequiresPropertyNode() const { for (const auto& keyframe : keyframes_) { for (const auto& property : keyframe->Properties()) { if (!property.IsCSSProperty() || - property.GetCSSProperty().PropertyID() != CSSPropertyID::kVariable) + (property.GetCSSProperty().PropertyID() != CSSPropertyID::kVariable && + property.GetCSSProperty().PropertyID() != + CSSPropertyID::kBackgroundColor)) return true; } } diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model.h b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model.h index 4331383890e..61ae955cf4d 100644 --- a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model.h +++ b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model.h @@ -157,7 +157,7 @@ class CORE_EXPORT KeyframeEffectModelBase : public EffectModel { return has_revert_; } - bool HasNonVariableProperty() const; + bool RequiresPropertyNode() const; bool IsTransformRelatedEffect() const override; diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model_test.cc b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model_test.cc index 681cc986ef0..4a75261a456 100644 --- a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model_test.cc @@ -160,7 +160,8 @@ const PropertySpecificKeyframeVector& ConstructEffectAndGetKeyframes( auto* effect = MakeGarbageCollected(keyframes); - auto style = document->GetStyleResolver().StyleForElement(element); + auto style = document->GetStyleResolver().StyleForElement( + element, StyleRecalcContext()); // Snapshot should update first time after construction EXPECT_TRUE(effect->SnapshotAllCompositorKeyframesIfNecessary( @@ -634,7 +635,8 @@ TEST_F(AnimationKeyframeEffectModel, CompositorSnapshotUpdateBasic) { KeyframesAtZeroAndOne(CSSPropertyID::kOpacity, "0", "1"); auto* effect = MakeGarbageCollected(keyframes); - auto style = GetDocument().GetStyleResolver().StyleForElement(element); + auto style = GetDocument().GetStyleResolver().StyleForElement( + element, StyleRecalcContext()); const CompositorKeyframeValue* value; @@ -670,7 +672,8 @@ TEST_F(AnimationKeyframeEffectModel, auto* effect = MakeGarbageCollected(opacity_keyframes); - auto style = GetDocument().GetStyleResolver().StyleForElement(element); + auto style = GetDocument().GetStyleResolver().StyleForElement( + element, StyleRecalcContext()); EXPECT_TRUE(effect->SnapshotAllCompositorKeyframesIfNecessary( *element, *style, nullptr)); diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_test.cc b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_test.cc index 8a17f8569f7..c7d170c625a 100644 --- a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_test.cc @@ -7,6 +7,7 @@ #include #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" #include "third_party/blink/renderer/bindings/core/v8/unrestricted_double_or_keyframe_effect_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" #include "third_party/blink/renderer/bindings/core/v8/v8_effect_timing.h" @@ -29,6 +30,10 @@ namespace blink { +#define EXPECT_TIMEDELTA(expected, observed) \ + EXPECT_NEAR(expected.InMillisecondsF(), observed.InMillisecondsF(), \ + Animation::kTimeToleranceMs) + using animation_test_helpers::SetV8ObjectPropertyAsNumber; using animation_test_helpers::SetV8ObjectPropertyAsString; @@ -227,8 +232,8 @@ TEST_F(AnimationKeyframeEffectV8Test, CanSetDuration) { KeyframeEffect* animation = CreateAnimationFromTiming( script_state, element.Get(), js_keyframes, duration); - EXPECT_EQ(duration / 1000, - animation->SpecifiedTiming().iteration_duration->InSecondsF()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromMillisecondsD(duration), + animation->SpecifiedTiming().iteration_duration.value()); } TEST_F(AnimationKeyframeEffectV8Test, CanOmitSpecifiedDuration) { @@ -367,35 +372,38 @@ TEST_F(KeyframeEffectTest, TimeToEffectChange) { Animation* animation = GetDocument().Timeline().Play(keyframe_effect); // Beginning of the animation. - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(100), - keyframe_effect->TimeToForwardsEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(100), + keyframe_effect->TimeToForwardsEffectChange()); EXPECT_EQ(AnimationTimeDelta::Max(), keyframe_effect->TimeToReverseEffectChange()); // End of the before phase. - animation->setCurrentTime(100000); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(100), - keyframe_effect->TimeToForwardsEffectChange()); - EXPECT_EQ(AnimationTimeDelta(), keyframe_effect->TimeToReverseEffectChange()); + animation->setCurrentTime(CSSNumberish::FromDouble(100000)); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(100), + keyframe_effect->TimeToForwardsEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + keyframe_effect->TimeToReverseEffectChange()); // Nearing the end of the active phase. - animation->setCurrentTime(199000); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(1), - keyframe_effect->TimeToForwardsEffectChange()); - EXPECT_EQ(AnimationTimeDelta(), keyframe_effect->TimeToReverseEffectChange()); + animation->setCurrentTime(CSSNumberish::FromDouble(199000)); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(1), + keyframe_effect->TimeToForwardsEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + keyframe_effect->TimeToReverseEffectChange()); // End of the active phase. - animation->setCurrentTime(200000); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(100), - keyframe_effect->TimeToForwardsEffectChange()); - EXPECT_EQ(AnimationTimeDelta(), keyframe_effect->TimeToReverseEffectChange()); + animation->setCurrentTime(CSSNumberish::FromDouble(200000)); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(100), + keyframe_effect->TimeToForwardsEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta(), + keyframe_effect->TimeToReverseEffectChange()); // End of the animation. - animation->setCurrentTime(300000); + animation->setCurrentTime(CSSNumberish::FromDouble(300000)); EXPECT_EQ(AnimationTimeDelta::Max(), keyframe_effect->TimeToForwardsEffectChange()); - EXPECT_EQ(AnimationTimeDelta::FromSecondsD(100), - keyframe_effect->TimeToReverseEffectChange()); + EXPECT_TIMEDELTA(AnimationTimeDelta::FromSecondsD(100), + keyframe_effect->TimeToReverseEffectChange()); } TEST_F(KeyframeEffectTest, CheckCanStartAnimationOnCompositorNoKeyframes) { diff --git a/chromium/third_party/blink/renderer/core/animation/length_property_functions.cc b/chromium/third_party/blink/renderer/core/animation/length_property_functions.cc index de2cc0c91df..2b78a53fb3f 100644 --- a/chromium/third_party/blink/renderer/core/animation/length_property_functions.cc +++ b/chromium/third_party/blink/renderer/core/animation/length_property_functions.cc @@ -130,10 +130,10 @@ bool LengthPropertyFunctions::GetLength(const CSSProperty& property, result = style.Bottom(); return true; case CSSPropertyID::kCx: - result = style.SvgStyle().Cx(); + result = style.Cx(); return true; case CSSPropertyID::kCy: - result = style.SvgStyle().Cy(); + result = style.Cy(); return true; case CSSPropertyID::kFlexBasis: result = style.FlexBasis(); @@ -184,16 +184,16 @@ bool LengthPropertyFunctions::GetLength(const CSSProperty& property, result = style.PaddingTop(); return true; case CSSPropertyID::kR: - result = style.SvgStyle().R(); + result = style.R(); return true; case CSSPropertyID::kRight: result = style.Right(); return true; case CSSPropertyID::kRx: - result = style.SvgStyle().Rx(); + result = style.Rx(); return true; case CSSPropertyID::kRy: - result = style.SvgStyle().Ry(); + result = style.Ry(); return true; case CSSPropertyID::kShapeMargin: result = style.ShapeMargin(); @@ -223,10 +223,10 @@ bool LengthPropertyFunctions::GetLength(const CSSProperty& property, result = style.Width(); return true; case CSSPropertyID::kX: - result = style.SvgStyle().X(); + result = style.X(); return true; case CSSPropertyID::kY: - result = style.SvgStyle().Y(); + result = style.Y(); return true; case CSSPropertyID::kBorderBottomWidth: @@ -277,9 +277,9 @@ bool LengthPropertyFunctions::GetLength(const CSSProperty& property, return true; case CSSPropertyID::kBaselineShift: - if (style.BaselineShift() != BS_LENGTH) + if (style.BaselineShiftType() != EBaselineShiftType::kLength) return false; - result = style.BaselineShiftValue(); + result = style.BaselineShift(); return true; case CSSPropertyID::kLineHeight: // Percent Lengths are used to represent numbers on line-height. @@ -322,7 +322,8 @@ bool LengthPropertyFunctions::SetLength(const CSSProperty& property, switch (property.PropertyID()) { // Setters that take a Length value. case CSSPropertyID::kBaselineShift: - style.SetBaselineShiftValue(value); + style.SetBaselineShiftType(EBaselineShiftType::kLength); + style.SetBaselineShift(value); return true; case CSSPropertyID::kBottom: style.SetBottom(value); diff --git a/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.h b/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.h index 82d035e4a71..80ead64fe8e 100644 --- a/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.h +++ b/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.h @@ -81,7 +81,7 @@ class CORE_EXPORT ListInterpolationFunctions { const NonInterpolableValue* b); }; -class CORE_EXPORT NonInterpolableList : public NonInterpolableValue { +class CORE_EXPORT NonInterpolableList final : public NonInterpolableValue { public: ~NonInterpolableList() final = default; diff --git a/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.cc b/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.cc index f3d696942e3..a4596e6a2f9 100644 --- a/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.cc +++ b/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.cc @@ -100,7 +100,7 @@ InterpolationValue PathInterpolationFunctions::ConvertValue( path_seg_types, style_path->GetWindRule())); } -class UnderlyingPathSegTypesChecker +class UnderlyingPathSegTypesChecker final : public InterpolationType::ConversionChecker { public: ~UnderlyingPathSegTypesChecker() final = default; diff --git a/chromium/third_party/blink/renderer/core/animation/pending_animations.cc b/chromium/third_party/blink/renderer/core/animation/pending_animations.cc index 8b96385792b..0377a3a87be 100644 --- a/chromium/third_party/blink/renderer/core/animation/pending_animations.cc +++ b/chromium/third_party/blink/renderer/core/animation/pending_animations.cc @@ -72,27 +72,27 @@ bool PendingAnimations::Update( animation->HasActiveAnimationsOnCompositor(); // Animations with a start time do not participate in compositor start-time // grouping. - if (animation->PreCommit(animation->startTime() ? 1 : compositor_group, - paint_artifact_compositor, start_on_compositor)) { + if (animation->PreCommit( + animation->StartTimeInternal() ? 1 : compositor_group, + paint_artifact_compositor, start_on_compositor)) { if (animation->HasActiveAnimationsOnCompositor() && - !had_compositor_animation && !animation->startTime()) { + !had_compositor_animation && !animation->StartTimeInternal()) { started_synchronized_on_compositor = true; } if (!animation->timeline() || !animation->timeline()->IsActive()) continue; - if (animation->Playing() && !animation->startTime()) { + if (animation->Playing() && !animation->StartTimeInternal()) { waiting_for_start_time.push_back(animation.Get()); } else if (animation->PendingInternal()) { DCHECK(animation->timeline()->IsActive() && - animation->timeline()->CurrentTimeSeconds()); + animation->timeline()->CurrentTime()); // A pending animation that is not waiting on a start time does not need // to be synchronized with animations that are starting up. Nonetheless, // it needs to notify the animation to resolve the ready promise and // commit the pending state. - animation->NotifyReady( - animation->timeline()->CurrentTimeSeconds().value_or(0)); + animation->NotifyReady(animation->timeline()->CurrentTime().value()); } } else { deferred.push_back(animation); @@ -108,11 +108,10 @@ bool PendingAnimations::Update( waiting_for_start_time); } else { for (auto& animation : waiting_for_start_time) { - DCHECK(!animation->startTime()); + DCHECK(!animation->StartTimeInternal()); DCHECK(animation->timeline()->IsActive() && - animation->timeline()->CurrentTimeSeconds()); - animation->NotifyReady( - animation->timeline()->CurrentTimeSeconds().value_or(0)); + animation->timeline()->CurrentTime()); + animation->NotifyReady(animation->timeline()->CurrentTime().value()); } } @@ -155,7 +154,7 @@ void PendingAnimations::NotifyCompositorAnimationStarted( animations.swap(waiting_for_compositor_animation_start_); for (auto animation : animations) { - if (animation->startTime() || !animation->PendingInternal() || + if (animation->StartTimeInternal() || !animation->PendingInternal() || !animation->timeline() || !animation->timeline()->IsActive()) { // Already started or no longer relevant. continue; @@ -168,10 +167,11 @@ void PendingAnimations::NotifyCompositorAnimationStarted( if (animation->timeline() && !animation->timeline()->IsMonotonicallyIncreasing()) { animation->NotifyReady( - animation->timeline()->CurrentTimeSeconds().value_or(0)); + animation->timeline()->CurrentTime().value_or(AnimationTimeDelta())); } else { - animation->NotifyReady(monotonic_animation_start_time - - animation->timeline()->ZeroTimeInSeconds()); + animation->NotifyReady( + AnimationTimeDelta::FromSecondsD(monotonic_animation_start_time) - + animation->timeline()->ZeroTime()); } } } @@ -192,7 +192,7 @@ void PendingAnimations::FlushWaitingNonCompositedAnimations() { return; // Start any main thread animations that were scheduled to wait on - // compositor synchronization from a previous frame. Otherwise, an + // compositor synchronization from a previous frame. Otherwise, a // continuous influx of new composited animations could delay the start // of non-composited animations indefinitely (crbug.com/666710). HeapVector> animations; @@ -202,9 +202,8 @@ void PendingAnimations::FlushWaitingNonCompositedAnimations() { waiting_for_compositor_animation_start_.push_back(animation); } else { DCHECK(animation->timeline()->IsActive() && - animation->timeline()->CurrentTimeSeconds()); - animation->NotifyReady( - animation->timeline()->CurrentTimeSeconds().value_or(0)); + animation->timeline()->CurrentTime()); + animation->NotifyReady(animation->timeline()->CurrentTime().value()); } } } @@ -212,6 +211,7 @@ void PendingAnimations::FlushWaitingNonCompositedAnimations() { void PendingAnimations::Trace(Visitor* visitor) const { visitor->Trace(pending_); visitor->Trace(waiting_for_compositor_animation_start_); + visitor->Trace(timer_); } void PendingAnimations::TimerFired(TimerBase*) { diff --git a/chromium/third_party/blink/renderer/core/animation/pending_animations.h b/chromium/third_party/blink/renderer/core/animation/pending_animations.h index bc700e8b808..5a7c0f7deda 100644 --- a/chromium/third_party/blink/renderer/core/animation/pending_animations.h +++ b/chromium/third_party/blink/renderer/core/animation/pending_animations.h @@ -103,7 +103,7 @@ class CORE_EXPORT PendingAnimations final HeapVector> pending_; HeapVector> waiting_for_compositor_animation_start_; - TaskRunnerTimer timer_; + HeapTaskRunnerTimer timer_; int compositor_group_; bool inside_timer_fired_; }; diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc index b260ad37970..259917a785b 100644 --- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc +++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc @@ -138,17 +138,16 @@ ScrollTimeline* ScrollTimeline::Create(Document& document, return nullptr; } - HeapVector>* scroll_offsets = - MakeGarbageCollected>>(); + HeapVector> scroll_offsets; if (options->scrollOffsets().IsEmpty()) { // TODO(crbug.com/1094014): scroll_offsets will replace start and end // offsets once spec decision on multiple scroll offsets is finalized. // https://github.com/w3c/csswg-drafts/issues/4912 if (!start_scroll_offset->IsDefaultValue()) - scroll_offsets->push_back(start_scroll_offset); + scroll_offsets.push_back(start_scroll_offset); if (!end_scroll_offset->IsDefaultValue() || !start_scroll_offset->IsDefaultValue()) - scroll_offsets->push_back(end_scroll_offset); + scroll_offsets.push_back(end_scroll_offset); } else { for (auto& offset : options->scrollOffsets()) { ScrollTimelineOffset* scroll_offset = @@ -159,13 +158,13 @@ ScrollTimeline* ScrollTimeline::Create(Document& document, } if (scroll_offset->IsDefaultValue() && (options->scrollOffsets().size() == 1 || - (scroll_offsets->size() + 1) < options->scrollOffsets().size())) { + (scroll_offsets.size() + 1) < options->scrollOffsets().size())) { exception_state.ThrowTypeError( "Invalid scrollOffsets: 'auto' can only be set as an end " "offset when start offset presents."); return nullptr; } - scroll_offsets->push_back(scroll_offset); + scroll_offsets.push_back(scroll_offset); } } @@ -182,15 +181,14 @@ ScrollTimeline::ScrollTimeline( Document* document, Element* scroll_source, ScrollDirection orientation, - HeapVector>* scroll_offsets, + HeapVector> scroll_offsets, base::Optional time_range) : AnimationTimeline(document), scroll_source_(scroll_source), resolved_scroll_source_(ResolveScrollSource(scroll_source_)), orientation_(orientation), - scroll_offsets_(scroll_offsets), + scroll_offsets_(std::move(scroll_offsets)), time_range_(time_range) { - DCHECK(scroll_offsets_); if (resolved_scroll_source_) { ScrollTimelineSet& set = GetScrollTimelineSet(); if (!set.Contains(resolved_scroll_source_)) { @@ -222,14 +220,12 @@ bool ScrollTimeline::ComputeIsActive() const { ScrollTimelineOffset* ScrollTimeline::StartScrollOffset() const { // Single entry offset in scrollOffsets is considered as 'end'. Thus, // resolving start offset only if there is at least 2 offsets. - return scroll_offsets_ && scroll_offsets_->size() >= 2 - ? scroll_offsets_->at(0) - : nullptr; + return scroll_offsets_.size() >= 2 ? scroll_offsets_.at(0) : nullptr; } ScrollTimelineOffset* ScrollTimeline::EndScrollOffset() const { // End offset is always the last offset in scrollOffsets if exists. - return scroll_offsets_ && scroll_offsets_->size() >= 1 - ? scroll_offsets_->at(scroll_offsets_->size() - 1) + return scroll_offsets_.size() >= 1 + ? scroll_offsets_.at(scroll_offsets_.size() - 1) : nullptr; } @@ -255,16 +251,16 @@ bool ScrollTimeline::ResolveScrollOffsets( auto orientation = ToPhysicalScrollOrientation(orientation_, *layout_box); - if (scroll_offsets_->size() == 0) { + if (scroll_offsets_.size() == 0) { // Start and end offsets resolve to 'auto'. resolved_offsets.push_back(0); resolved_offsets.push_back(max_offset); return true; } // Single entry offset in scrollOffsets is considered as 'end'. - if (scroll_offsets_->size() == 1) + if (scroll_offsets_.size() == 1) resolved_offsets.push_back(0); - for (auto& offset : *scroll_offsets_) { + for (auto& offset : scroll_offsets_) { auto resolved_offset = offset->ResolveOffset( resolved_scroll_source_, orientation, max_offset, max_offset); if (!resolved_offset) { @@ -274,7 +270,6 @@ bool ScrollTimeline::ResolveScrollOffsets( } resolved_offsets.push_back(resolved_offset.value()); } - // TODO(crbug.com/1094014): Implement clamping for overlapping offsets. DCHECK_GE(resolved_offsets.size(), 2u); return true; } @@ -286,12 +281,11 @@ AnimationTimeline::PhaseAndTime ScrollTimeline::CurrentPhaseAndTime() { bool ScrollTimeline::ScrollOffsetsEqual( const HeapVector>& other) const { - DCHECK(scroll_offsets_); - if (scroll_offsets_->size() != other.size()) + if (scroll_offsets_.size() != other.size()) return false; - size_t size = scroll_offsets_->size(); + size_t size = scroll_offsets_.size(); for (size_t i = 0; i < size; ++i) { - if (!DataEquivalent(scroll_offsets_->at(i), other.at(i))) + if (!DataEquivalent(scroll_offsets_.at(i), other.at(i))) return false; } return true; @@ -477,11 +471,7 @@ void ScrollTimeline::endScrollOffset(ScrollTimelineOffsetValue& out) const { const HeapVector ScrollTimeline::scrollOffsets() const { HeapVector scroll_offsets; - - if (!scroll_offsets_) - return scroll_offsets; - - for (auto& offset : *scroll_offsets_) { + for (auto& offset : scroll_offsets_) { scroll_offsets.push_back(offset->ToScrollTimelineOffsetValue()); // 'auto' can only be the end offset. DCHECK(!offset->IsDefaultValue() || scroll_offsets.size() == 2); @@ -614,6 +604,14 @@ void ScrollTimeline::InvalidateEffectTargetStyle() { animation->InvalidateEffectTargetStyle(); } +void ScrollTimeline::ValidateState() { + auto state = ComputeTimelineState(); + if (timeline_state_snapshotted_ == state) + return; + timeline_state_snapshotted_ = state; + InvalidateEffectTargetStyle(); +} + CompositorAnimationTimeline* ScrollTimeline::EnsureCompositorTimeline() { if (compositor_timeline_) return compositor_timeline_.get(); diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h index 019885d471d..445af19f636 100644 --- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h +++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h @@ -44,7 +44,7 @@ class CORE_EXPORT ScrollTimeline : public AnimationTimeline { ScrollTimeline(Document*, Element*, ScrollDirection, - HeapVector>*, + HeapVector>, base::Optional); bool IsScrollTimeline() const override { return true; } @@ -53,7 +53,7 @@ class CORE_EXPORT ScrollTimeline : public AnimationTimeline { // https://github.com/WICG/scroll-animations/issues/31 bool IsActive() const override; base::Optional InitialStartTimeForAnimations() override; - double ZeroTimeInSeconds() override { return 0; } + AnimationTimeDelta ZeroTime() override { return AnimationTimeDelta(); } void ServiceAnimations(TimingUpdateReason) override; void ScheduleNextService() override; @@ -95,6 +95,9 @@ class CORE_EXPORT ScrollTimeline : public AnimationTimeline { // for style recalc. void InvalidateEffectTargetStyle(); + // See DocumentAnimations::ValidateTimelines + void ValidateState(); + CompositorAnimationTimeline* EnsureCompositorTimeline() override; void UpdateCompositorTimeline() override; @@ -126,6 +129,7 @@ class CORE_EXPORT ScrollTimeline : public AnimationTimeline { size_t AttachedAnimationsCount() const { return scroll_animations_.size(); } private: + FRIEND_TEST_ALL_PREFIXES(ScrollTimelineTest, MultipleScrollOffsetsClamping); // https://wicg.github.io/scroll-animations/#avoiding-cycles // Snapshots scroll timeline current time and phase. // Called once per animation frame. @@ -166,7 +170,7 @@ class CORE_EXPORT ScrollTimeline : public AnimationTimeline { Member scroll_source_; Member resolved_scroll_source_; ScrollDirection orientation_; - Member>> scroll_offsets_; + HeapVector> scroll_offsets_; base::Optional time_range_; diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_offset.cc b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_offset.cc index 7555b92eca1..6631be00e8e 100644 --- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_offset.cc +++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_offset.cc @@ -58,8 +58,11 @@ bool ElementBasedOffsetsEqual(ScrollTimelineElementBasedOffset* o1, return true; if (!o1 || !o2) return false; - return (o1->edge() == o2->edge()) && (o1->target() == o2->target()) && - (o1->threshold() == o2->threshold()); + // TODO(crbug.com/1070871): Use targetOr(nullptr) after migration is done. + Element* target_or_null1 = o1->hasTarget() ? o1->target() : nullptr; + Element* target_or_null2 = o2->hasTarget() ? o2->target() : nullptr; + return target_or_null1 == target_or_null2 && o1->edge() == o2->edge() && + o1->threshold() == o2->threshold(); } CSSKeywordValue* GetCSSKeywordValue(const ScrollTimelineOffsetValue& offset) { diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc index 5321591f55a..ac3d1cd6811 100644 --- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc @@ -30,7 +30,7 @@ static constexpr double time_error_ms = 0.001 + 1e-13; #define EXPECT_TIME_NEAR(expected, value) \ EXPECT_NEAR(expected, value, time_error_ms) -HeapVector>* CreateScrollOffsets( +HeapVector> CreateScrollOffsets( ScrollTimelineOffset* start_scroll_offset = MakeGarbageCollected( CSSNumericLiteralValue::Create( @@ -41,10 +41,9 @@ HeapVector>* CreateScrollOffsets( CSSNumericLiteralValue::Create( 90.0, CSSPrimitiveValue::UnitType::kPixels))) { - HeapVector>* scroll_offsets = - MakeGarbageCollected>>(); - scroll_offsets->push_back(start_scroll_offset); - scroll_offsets->push_back(end_scroll_offset); + HeapVector> scroll_offsets; + scroll_offsets.push_back(start_scroll_offset); + scroll_offsets.push_back(end_scroll_offset); return scroll_offsets; } @@ -82,12 +81,12 @@ class TestScrollTimeline : public ScrollTimeline { public: TestScrollTimeline(Document* document, Element* scroll_source, - HeapVector>* scroll_offsets = + HeapVector> scroll_offsets = CreateScrollOffsets()) : ScrollTimeline(document, scroll_source, ScrollTimeline::Vertical, - scroll_offsets, + std::move(scroll_offsets), 100.0), next_service_scheduled_(false) {} @@ -801,7 +800,7 @@ TEST_F(ScrollTimelineTest, MultipleScrollOffsetsCurrentTimeCalculations) { auto* scroller = To(GetLayoutObjectByElementId("scroller")); ASSERT_TRUE(scroller); - ASSERT_TRUE(scroller->HasNonVisibleOverflow()); + ASSERT_TRUE(scroller->IsScrollContainer()); PaintLayerScrollableArea* scrollable_area = scroller->GetScrollableArea(); ASSERT_TRUE(scrollable_area); double time_range = 100.0; @@ -879,4 +878,68 @@ TEST_F(ScrollTimelineTest, MultipleScrollOffsetsCurrentTimeCalculations) { EXPECT_EQ(100, scroll_timeline->CurrentTimeMilliseconds().value()); } +TEST_F(ScrollTimelineTest, OverlappingScrollOffsets) { + SetBodyInnerHTML(R"HTML( + +
+
+
+ )HTML"); + + auto* scroller = + To(GetLayoutObjectByElementId("scroller")); + ASSERT_TRUE(scroller); + PaintLayerScrollableArea* scrollable_area = scroller->GetScrollableArea(); + ASSERT_TRUE(scrollable_area); + double time_range = 100.0; + ScrollTimelineOptions* options = ScrollTimelineOptions::Create(); + options->setTimeRange( + DoubleOrScrollTimelineAutoKeyword::FromDouble(time_range)); + options->setScrollSource(GetElementById("scroller")); + HeapVector scroll_offsets = { + OffsetFromString("90px"), OffsetFromString("40px"), + OffsetFromString("10px")}; + options->setScrollOffsets(scroll_offsets); + + ScrollTimeline* scroll_timeline = + ScrollTimeline::Create(GetDocument(), options, ASSERT_NO_EXCEPTION); + + scrollable_area->SetScrollOffset(ScrollOffset(0, 80), + mojom::blink::ScrollType::kProgrammatic); + SimulateFrame(); + EXPECT_EQ(0, scroll_timeline->CurrentTimeMilliseconds().value()); + + scrollable_area->SetScrollOffset(ScrollOffset(0, 95), + mojom::blink::ScrollType::kProgrammatic); + SimulateFrame(); + EXPECT_EQ(100, scroll_timeline->CurrentTimeMilliseconds().value()); + + scroll_offsets = {OffsetFromString("0px"), OffsetFromString("100px"), + OffsetFromString("50px")}; + options->setScrollOffsets(scroll_offsets); + + scroll_timeline = + ScrollTimeline::Create(GetDocument(), options, ASSERT_NO_EXCEPTION); + + scrollable_area->SetScrollOffset(ScrollOffset(0, 40), + mojom::blink::ScrollType::kProgrammatic); + SimulateFrame(); + EXPECT_EQ(20, scroll_timeline->CurrentTimeMilliseconds().value()); + + scroll_offsets = {OffsetFromString("50px"), OffsetFromString("0px"), + OffsetFromString("100px")}; + options->setScrollOffsets(scroll_offsets); + + scroll_timeline = + ScrollTimeline::Create(GetDocument(), options, ASSERT_NO_EXCEPTION); + + scrollable_area->SetScrollOffset(ScrollOffset(0, 60), + mojom::blink::ScrollType::kProgrammatic); + SimulateFrame(); + EXPECT_EQ(80, scroll_timeline->CurrentTimeMilliseconds().value()); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc index 9fe7b941f90..3e3a139d403 100644 --- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc @@ -16,13 +16,12 @@ namespace blink { namespace { -HeapVector>* CreateScrollOffsets( +HeapVector> CreateScrollOffsets( ScrollTimelineOffset* start_scroll_offset, ScrollTimelineOffset* end_scroll_offset) { - HeapVector>* scroll_offsets = - MakeGarbageCollected>>(); - scroll_offsets->push_back(start_scroll_offset); - scroll_offsets->push_back(end_scroll_offset); + HeapVector> scroll_offsets; + scroll_offsets.push_back(start_scroll_offset); + scroll_offsets.push_back(end_scroll_offset); return scroll_offsets; } diff --git a/chromium/third_party/blink/renderer/core/animation/string_keyframe.cc b/chromium/third_party/blink/renderer/core/animation/string_keyframe.cc index 0b2840a787d..4503d3bb652 100644 --- a/chromium/third_party/blink/renderer/core/animation/string_keyframe.cc +++ b/chromium/third_party/blink/renderer/core/animation/string_keyframe.cc @@ -340,7 +340,7 @@ bool StringKeyframe::CSSPropertySpecificKeyframe:: const ComputedStyle* parent_style) const { compositor_keyframe_value_cache_ = StyleResolver::CreateCompositorKeyframeValueSnapshot( - element, base_style, parent_style, property, value_.Get()); + element, base_style, parent_style, property, value_.Get(), offset_); return true; } diff --git a/chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc index 9c256e7127d..2162168aa4d 100644 --- a/chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc @@ -47,7 +47,7 @@ SVGPropertyBase* SVGPathInterpolationType::AppliedSVGValue( const InterpolableValue& interpolable_value, const NonInterpolableValue* non_interpolable_value) const { return MakeGarbageCollected( - MakeGarbageCollected( + *MakeGarbageCollected( PathInterpolationFunctions::AppliedValue(interpolable_value, non_interpolable_value))); } diff --git a/chromium/third_party/blink/renderer/core/animation/timing.cc b/chromium/third_party/blink/renderer/core/animation/timing.cc index 5a6d39467f4..8d57548ca6c 100644 --- a/chromium/third_party/blink/renderer/core/animation/timing.cc +++ b/chromium/third_party/blink/renderer/core/animation/timing.cc @@ -121,7 +121,7 @@ ComputedEffectTiming* Timing::getComputedTiming( computed_timing->setLocalTime( CSSNumberish::FromDouble(calculated_timing.local_time.value() * 1000)); } else { - computed_timing->setLocalTimeToNull(); + computed_timing->setLocalTime(CSSNumberish()); } if (calculated_timing.is_in_effect) { diff --git a/chromium/third_party/blink/renderer/core/animation/timing_calculations.h b/chromium/third_party/blink/renderer/core/animation/timing_calculations.h index b1ca293f721..2173cc75e7a 100644 --- a/chromium/third_party/blink/renderer/core/animation/timing_calculations.h +++ b/chromium/third_party/blink/renderer/core/animation/timing_calculations.h @@ -56,10 +56,14 @@ static inline bool IsWithinAnimationTimeEpsilon(double a, double b) { return std::abs(a - b) <= TimingCalculationEpsilon(); } -inline bool LessThanOrEqualToWithinEpsilon(double a, double b) { +static inline bool LessThanOrEqualToWithinEpsilon(double a, double b) { return a <= b + TimingCalculationEpsilon(); } +static inline bool GreaterThanOrEqualToWithinEpsilon(double a, double b) { + return a >= b - TimingCalculationEpsilon(); +} + static inline double MultiplyZeroAlwaysGivesZero(double x, double y) { DCHECK(!std::isnan(x)); DCHECK(!std::isnan(y)); diff --git a/chromium/third_party/blink/renderer/core/animation/timing_input_test.cc b/chromium/third_party/blink/renderer/core/animation/timing_input_test.cc index f5b7c8f7498..98834571a87 100644 --- a/chromium/third_party/blink/renderer/core/animation/timing_input_test.cc +++ b/chromium/third_party/blink/renderer/core/animation/timing_input_test.cc @@ -5,6 +5,7 @@ #include "third_party/blink/renderer/core/animation/timing_input.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" #include "third_party/blink/renderer/bindings/core/v8/unrestricted_double_or_keyframe_animation_options.h" #include "third_party/blink/renderer/bindings/core/v8/unrestricted_double_or_keyframe_effect_options.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" diff --git a/chromium/third_party/blink/renderer/core/animation/transition_keyframe.h b/chromium/third_party/blink/renderer/core/animation/transition_keyframe.h index e8c75ae0538..a5b39a1c6a0 100644 --- a/chromium/third_party/blink/renderer/core/animation/transition_keyframe.h +++ b/chromium/third_party/blink/renderer/core/animation/transition_keyframe.h @@ -78,6 +78,8 @@ class CORE_EXPORT TransitionKeyframe : public Keyframe { bool IsTransitionPropertySpecificKeyframe() const final { return true; } + const TypedInterpolationValue* GetValue() const { return value_.get(); } + void Trace(Visitor*) const override; private: diff --git a/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.cc b/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.cc index fd899c25b55..0ab3b9a41db 100644 --- a/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.cc +++ b/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.cc @@ -94,19 +94,17 @@ void WorkletAnimationController::ScrollSourceCompositingStateChanged( base::WeakPtr WorkletAnimationController::EnsureMainThreadMutatorDispatcher( - scoped_refptr* mutator_task_runner) { + scoped_refptr mutator_task_runner) { base::WeakPtr mutator_dispatcher; - if (!mutator_task_runner_) { + if (!main_thread_mutator_client_) { main_thread_mutator_client_ = AnimationWorkletMutatorDispatcherImpl::CreateMainThreadClient( - &mutator_dispatcher, &mutator_task_runner_); + mutator_dispatcher, std::move(mutator_task_runner)); main_thread_mutator_client_->SetDelegate(this); } DCHECK(main_thread_mutator_client_); - DCHECK(mutator_task_runner_); DCHECK(mutator_dispatcher); - *mutator_task_runner = mutator_task_runner_; return mutator_dispatcher; } diff --git a/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.h b/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.h index b9f5cad9e1d..b365819b6da 100644 --- a/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.h +++ b/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.h @@ -20,6 +20,7 @@ namespace blink { class AnimationWorkletMutatorDispatcherImpl; class Document; class MainThreadMutatorClient; +class Node; class WorkletAnimationBase; // Handles AnimationWorklet animations on the main-thread. @@ -36,7 +37,7 @@ class CORE_EXPORT WorkletAnimationController : public GarbageCollected, public MutatorClient { public: - WorkletAnimationController(Document*); + explicit WorkletAnimationController(Document*); ~WorkletAnimationController() override; void AttachAnimation(WorkletAnimationBase&); @@ -54,7 +55,7 @@ class CORE_EXPORT WorkletAnimationController base::WeakPtr EnsureMainThreadMutatorDispatcher( - scoped_refptr* mutator_task_runner); + scoped_refptr mutator_task_runner); void SetMutationUpdate( std::unique_ptr output) override; @@ -79,7 +80,6 @@ class CORE_EXPORT WorkletAnimationController // TODO(crbug.com/1090515): The following proxy is needed for platform/ to // access this class. We should bypass it eventually. std::unique_ptr main_thread_mutator_client_; - scoped_refptr mutator_task_runner_; Member document_; }; diff --git a/chromium/third_party/blink/renderer/core/animation_frame/DIR_METADATA b/chromium/third_party/blink/renderer/core/animation_frame/DIR_METADATA new file mode 100644 index 00000000000..4ae95d48d73 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/animation_frame/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink>Canvas" +} + +team_email: "paint-dev@chromium.org" diff --git a/chromium/third_party/blink/renderer/core/animation_frame/OWNERS b/chromium/third_party/blink/renderer/core/animation_frame/OWNERS index 5ef87b1aa3f..1e563633b29 100644 --- a/chromium/third_party/blink/renderer/core/animation_frame/OWNERS +++ b/chromium/third_party/blink/renderer/core/animation_frame/OWNERS @@ -1,4 +1 @@ fserb@chromium.org - -# TEAM: paint-dev@chromium.org -# COMPONENT: Blink>Canvas diff --git a/chromium/third_party/blink/renderer/core/aom/DIR_METADATA b/chromium/third_party/blink/renderer/core/aom/DIR_METADATA new file mode 100644 index 00000000000..7a89266091b --- /dev/null +++ b/chromium/third_party/blink/renderer/core/aom/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink>Accessibility" +} + +team_email: "chromium-accessibility@chromium.org" diff --git a/chromium/third_party/blink/renderer/core/aom/OWNERS b/chromium/third_party/blink/renderer/core/aom/OWNERS index 5eed66eb588..4e6cc130180 100644 --- a/chromium/third_party/blink/renderer/core/aom/OWNERS +++ b/chromium/third_party/blink/renderer/core/aom/OWNERS @@ -1,4 +1 @@ file://third_party/blink/renderer/modules/accessibility/OWNERS - -# TEAM: chromium-accessibility@chromium.org -# COMPONENT: Blink>Accessibility diff --git a/chromium/third_party/blink/renderer/core/aom/accessible_node.cc b/chromium/third_party/blink/renderer/core/aom/accessible_node.cc index 62252d26747..78a92e61b9a 100644 --- a/chromium/third_party/blink/renderer/core/aom/accessible_node.cc +++ b/chromium/third_party/blink/renderer/core/aom/accessible_node.cc @@ -55,6 +55,8 @@ QualifiedName GetCorrespondingARIAAttribute(AOMStringProperty property) { return html_names::kAriaSortAttr; case AOMStringProperty::kValueText: return html_names::kAriaValuetextAttr; + case AOMStringProperty::kVirtualContent: + return html_names::kAriaVirtualcontentAttr; } NOTREACHED(); @@ -910,6 +912,15 @@ void AccessibleNode::setValueText(const AtomicString& value_text) { NotifyAttributeChanged(html_names::kAriaValuetextAttr); } +AtomicString AccessibleNode::virtualContent() const { + return GetProperty(AOMStringProperty::kVirtualContent); +} + +void AccessibleNode::setVirtualContent(const AtomicString& virtual_content) { + SetStringProperty(AOMStringProperty::kVirtualContent, virtual_content); + NotifyAttributeChanged(html_names::kAriaVirtualcontentAttr); +} + AccessibleNodeList* AccessibleNode::childNodes() { return AccessibleNodeList::Create(children_); } @@ -991,6 +1002,7 @@ bool AccessibleNode::IsStringTokenProperty(AOMStringProperty property) { // supported. case AOMStringProperty::kRoleDescription: case AOMStringProperty::kValueText: + case AOMStringProperty::kVirtualContent: break; } return false; diff --git a/chromium/third_party/blink/renderer/core/aom/accessible_node.h b/chromium/third_party/blink/renderer/core/aom/accessible_node.h index 65d019df381..5858559030f 100644 --- a/chromium/third_party/blink/renderer/core/aom/accessible_node.h +++ b/chromium/third_party/blink/renderer/core/aom/accessible_node.h @@ -40,7 +40,8 @@ enum class AOMStringProperty { kRole, kRoleDescription, kSort, - kValueText + kValueText, + kVirtualContent }; // All of the properties of AccessibleNode that have type "boolean". @@ -337,6 +338,9 @@ class CORE_EXPORT AccessibleNode : public EventTargetWithInlineData { AtomicString valueText() const; void setValueText(const AtomicString&); + AtomicString virtualContent() const; + void setVirtualContent(const AtomicString&); + AccessibleNodeList* childNodes(); void appendChild(AccessibleNode*, ExceptionState&); diff --git a/chromium/third_party/blink/renderer/core/clipboard/DIR_METADATA b/chromium/third_party/blink/renderer/core/clipboard/DIR_METADATA new file mode 100644 index 00000000000..ae781d07399 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/clipboard/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink>DataTransfer" +} + +team_email: "storage-dev@chromium.org" diff --git a/chromium/third_party/blink/renderer/core/clipboard/OWNERS b/chromium/third_party/blink/renderer/core/clipboard/OWNERS index ddb3f8e0cbc..9d11d8bcf13 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/OWNERS +++ b/chromium/third_party/blink/renderer/core/clipboard/OWNERS @@ -4,6 +4,3 @@ huangdarwin@chromium.org # Secondary: dcheng@chromium.org pwnall@chromium.org - -# TEAM: storage-dev@chromium.org -# COMPONENT: Blink>DataTransfer diff --git a/chromium/third_party/blink/renderer/core/clipboard/clipboard_utilities.cc b/chromium/third_party/blink/renderer/core/clipboard/clipboard_utilities.cc index 45e0b1b4327..5234fc5c8bb 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/clipboard_utilities.cc +++ b/chromium/third_party/blink/renderer/core/clipboard/clipboard_utilities.cc @@ -30,6 +30,7 @@ #include "third_party/blink/renderer/core/clipboard/clipboard_utilities.h" +#include "base/i18n/uchar.h" #include "net/base/escape.h" #include "third_party/blink/renderer/platform/image-encoders/image_encoder.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" @@ -75,8 +76,9 @@ static String EscapeForHTML(const String& str) { {reinterpret_cast(str.Characters8()), str.length()}); return String(result.data(), result.size()); } - auto result = net::EscapeForHTML({str.Characters16(), str.length()}); - return String(result.data(), result.size()); + auto result = net::EscapeForHTML( + {base::i18n::ToChar16Ptr(str.Characters16()), str.length()}); + return String(base::i18n::ToUCharPtr(result.data()), result.size()); } String URLToImageMarkup(const KURL& url, const String& title) { diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_object.cc b/chromium/third_party/blink/renderer/core/clipboard/data_object.cc index 763ca4421e9..58d1c47df2c 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/data_object.cc +++ b/chromium/third_party/blink/renderer/core/clipboard/data_object.cc @@ -30,7 +30,9 @@ #include "third_party/blink/renderer/core/clipboard/data_object.h" +#include "base/feature_list.h" #include "base/notreached.h" +#include "third_party/blink/public/platform/file_path_conversion.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_drag_data.h" #include "third_party/blink/renderer/core/clipboard/clipboard_mime_types.h" @@ -40,6 +42,7 @@ #include "third_party/blink/renderer/core/clipboard/system_clipboard.h" #include "third_party/blink/renderer/platform/file_metadata.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" +#include "ui/base/ui_base_features.h" namespace blink { @@ -54,8 +57,28 @@ DataObject* DataObject::CreateFromClipboard(SystemClipboard* system_clipboard, for (const String& type : system_clipboard->ReadAvailableTypes()) { if (paste_mode == PasteMode::kPlainTextOnly && type != kMimeTypeTextPlain) continue; - data_object->item_list_.push_back(DataObjectItem::CreateFromClipboard( - system_clipboard, type, sequence_number)); + mojom::blink::ClipboardFilesPtr files; + if (type == kMimeTypeTextURIList && + base::FeatureList::IsEnabled(features::kClipboardFilenames)) { + files = system_clipboard->ReadFiles(); + // Ignore ReadFiles() result if clipboard sequence number has changed. + if (system_clipboard->SequenceNumber() != sequence_number) { + files->files.clear(); + } + for (const mojom::blink::DataTransferFilePtr& file : files->files) { + data_object->AddFilename( + FilePathToString(file->path), FilePathToString(file->display_name), + files->file_system_id, + base::MakeRefCounted( + std::move(file->file_system_access_token))); + } + } + if (files && !files->files.IsEmpty()) { + DraggedIsolatedFileSystem::PrepareForDataObject(data_object); + } else { + data_object->item_list_.push_back(DataObjectItem::CreateFromClipboard( + system_clipboard, type, sequence_number)); + } #if DCHECK_IS_ON() DCHECK(types_seen.insert(type).is_new_entry); #endif @@ -230,10 +253,10 @@ void DataObject::AddFilename( const String& filename, const String& display_name, const String& file_system_id, - scoped_refptr native_file_system_entry) { + scoped_refptr file_system_access_entry) { InternalAddFileItem(DataObjectItem::CreateFromFileWithFileSystemId( File::CreateForUserProvidedFile(filename, display_name), file_system_id, - std::move(native_file_system_entry))); + std::move(file_system_access_entry))); } void DataObject::AddSharedBuffer(scoped_refptr buffer, @@ -308,7 +331,7 @@ DataObject* DataObject::Create(WebDragData data) { has_file_system = true; data_object->AddFilename(item.filename_data, item.display_name_data, data.FilesystemId(), - item.native_file_system_entry); + item.file_system_access_entry); break; case WebDragData::Item::kStorageTypeBinaryData: // This should never happen when dragging in. diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_object.h b/chromium/third_party/blink/renderer/core/clipboard/data_object.h index b621b8e4fe0..d7982fb7c19 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/data_object.h +++ b/chromium/third_party/blink/renderer/core/clipboard/data_object.h @@ -99,8 +99,8 @@ class CORE_EXPORT DataObject : public GarbageCollected, void AddFilename(const String& filename, const String& display_name, const String& file_system_id, - scoped_refptr - native_file_system_entry = nullptr); + scoped_refptr + file_system_access_entry = nullptr); // Used for dragging in filesystem from the desktop. void SetFilesystemId(const String& file_system_id) { diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_object_item.cc b/chromium/third_party/blink/renderer/core/clipboard/data_object_item.cc index 800ce7d6c43..c0546a3cbba 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/data_object_item.cc +++ b/chromium/third_party/blink/renderer/core/clipboard/data_object_item.cc @@ -31,7 +31,7 @@ #include "third_party/blink/renderer/core/clipboard/data_object_item.h" #include "base/time/time.h" -#include "third_party/blink/public/mojom/file_system_access/native_file_system_drag_drop_token.mojom-blink.h" +#include "third_party/blink/public/mojom/file_system_access/file_system_access_data_transfer_token.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/core/clipboard/clipboard_mime_types.h" #include "third_party/blink/renderer/core/clipboard/system_clipboard.h" @@ -63,12 +63,12 @@ DataObjectItem* DataObjectItem::CreateFromFile(File* file) { DataObjectItem* DataObjectItem::CreateFromFileWithFileSystemId( File* file, const String& file_system_id, - scoped_refptr native_file_entry) { + scoped_refptr file_system_access_entry) { DataObjectItem* item = MakeGarbageCollected(kFileKind, file->type()); item->file_ = file; item->file_system_id_ = file_system_id; - item->native_file_system_entry_ = native_file_entry; + item->file_system_access_entry_ = file_system_access_entry; return item; } @@ -225,18 +225,19 @@ String DataObjectItem::FileSystemId() const { return file_system_id_; } -bool DataObjectItem::HasNativeFileSystemEntry() const { - return static_cast(native_file_system_entry_); +bool DataObjectItem::HasFileSystemAccessEntry() const { + return static_cast(file_system_access_entry_); } -mojo::PendingRemote -DataObjectItem::CloneNativeFileSystemEntryToken() const { - DCHECK(HasNativeFileSystemEntry()); - mojo::Remote token_cloner( - std::move(native_file_system_entry_->data)); - mojo::PendingRemote token_clone; +mojo::PendingRemote +DataObjectItem::CloneFileSystemAccessEntryToken() const { + DCHECK(HasFileSystemAccessEntry()); + mojo::Remote token_cloner( + std::move(file_system_access_entry_->data)); + mojo::PendingRemote + token_clone; token_cloner->Clone(token_clone.InitWithNewPipeAndPassReceiver()); - native_file_system_entry_->data = token_cloner.Unbind(); + file_system_access_entry_->data = token_cloner.Unbind(); return token_clone; } diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_object_item.h b/chromium/third_party/blink/renderer/core/clipboard/data_object_item.h index 5a9c4c137d9..f79f3e1d5f9 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/data_object_item.h +++ b/chromium/third_party/blink/renderer/core/clipboard/data_object_item.h @@ -33,8 +33,7 @@ #include "base/optional.h" #include "mojo/public/cpp/bindings/remote.h" -#include "third_party/blink/public/mojom/file_system_access/native_file_system_drag_drop_token.mojom-blink.h" -#include "third_party/blink/public/mojom/file_system_access/native_file_system_transfer_token.mojom-blink.h" +#include "third_party/blink/public/mojom/file_system_access/file_system_access_data_transfer_token.mojom-blink.h" #include "third_party/blink/public/platform/web_drag_data.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/fileapi/file.h" @@ -60,7 +59,8 @@ class CORE_EXPORT DataObjectItem final static DataObjectItem* CreateFromFileWithFileSystemId( File*, const String& file_system_id, - scoped_refptr native_file_entry = nullptr); + scoped_refptr file_system_access_entry = + nullptr); static DataObjectItem* CreateFromURL(const String& url, const String& title); static DataObjectItem* CreateFromHTML(const String& html, const KURL& base_url); @@ -95,9 +95,9 @@ class CORE_EXPORT DataObjectItem final bool HasFileSystemId() const; String FileSystemId() const; - bool HasNativeFileSystemEntry() const; - mojo::PendingRemote - CloneNativeFileSystemEntryToken() const; + bool HasFileSystemAccessEntry() const; + mojo::PendingRemote + CloneFileSystemAccessEntryToken() const; void Trace(Visitor*) const; @@ -107,7 +107,7 @@ class CORE_EXPORT DataObjectItem final kInternalSource, }; - scoped_refptr native_file_system_entry_; + scoped_refptr file_system_access_entry_; DataSource source_; ItemKind kind_; String type_; diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc b/chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc index ecc7cf0845d..1bc41417bbf 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc +++ b/chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc @@ -60,6 +60,7 @@ #include "third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h" #include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h" #include "third_party/skia/include/core/SkSurface.h" +#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-blink.h" namespace blink { @@ -147,7 +148,6 @@ class DraggedNodeImageBuilder { return DataTransfer::CreateDragImageForFrame( *local_frame_, 1.0f, - LayoutObject::ShouldRespectImageOrientation(dragged_layout_object), bounding_box.Size(), paint_offset, builder, border_box_properties); } @@ -159,10 +159,8 @@ class DraggedNodeImageBuilder { #endif }; -} // namespace - -static base::Optional ConvertEffectAllowedToDragOperation( - const String& op) { +base::Optional ConvertEffectAllowedToDragOperationsMask( + const AtomicString& op) { // Values specified in // https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-effectallowed if (op == "uninitialized") @@ -175,18 +173,24 @@ static base::Optional ConvertEffectAllowedToDragOperation( return kDragOperationLink; if (op == "move") return kDragOperationMove; - if (op == "copyLink") - return static_cast(kDragOperationCopy | kDragOperationLink); - if (op == "copyMove") - return static_cast(kDragOperationCopy | kDragOperationMove); - if (op == "linkMove") - return static_cast(kDragOperationLink | kDragOperationMove); + if (op == "copyLink") { + return static_cast(kDragOperationCopy | + kDragOperationLink); + } + if (op == "copyMove") { + return static_cast(kDragOperationCopy | + kDragOperationMove); + } + if (op == "linkMove") { + return static_cast(kDragOperationLink | + kDragOperationMove); + } if (op == "all") return kDragOperationEvery; return base::nullopt; } -static String ConvertDragOperationToEffectAllowed(DragOperation op) { +AtomicString ConvertDragOperationsMaskToEffectAllowed(DragOperationsMask op) { if (((op & kDragOperationMove) && (op & kDragOperationCopy) && (op & kDragOperationLink)) || (op == kDragOperationEvery)) @@ -209,8 +213,7 @@ static String ConvertDragOperationToEffectAllowed(DragOperation op) { // We provide the IE clipboard types (URL and Text), and the clipboard types // specified in the HTML spec. See // https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface -static String NormalizeType(const String& type, - bool* convert_to_url = nullptr) { +String NormalizeType(const String& type, bool* convert_to_url = nullptr) { String clean_type = type.StripWhiteSpace().LowerASCII(); if (clean_type == kMimeTypeText || clean_type.StartsWith(kMimeTypeTextPlainEtc)) @@ -223,6 +226,8 @@ static String NormalizeType(const String& type, return clean_type; } +} // namespace + // static DataTransfer* DataTransfer::Create() { DataTransfer* data = Create( @@ -241,7 +246,7 @@ DataTransfer* DataTransfer::Create(DataTransferType type, DataTransfer::~DataTransfer() = default; -void DataTransfer::setDropEffect(const String& effect) { +void DataTransfer::setDropEffect(const AtomicString& effect) { if (!IsForDragAndDrop()) return; @@ -253,18 +258,14 @@ void DataTransfer::setDropEffect(const String& effect) { // The specification states that dropEffect can be changed at all times, even // if the DataTransfer instance is protected or neutered. - // - // Allowing these changes seems inconsequential, but findDropZone() in - // EventHandler.cpp relies on being able to call setDropEffect during - // dragenter, when the DataTransfer policy is DataTransferTypesReadable. drop_effect_ = effect; } -void DataTransfer::setEffectAllowed(const String& effect) { +void DataTransfer::setEffectAllowed(const AtomicString& effect) { if (!IsForDragAndDrop()) return; - if (!ConvertEffectAllowedToDragOperation(effect)) { + if (!ConvertEffectAllowedToDragOperationsMask(effect)) { // This means that there was no conversion, and the effectAllowed that // we are passed isn't a valid effectAllowed, so we should ignore it, // and not set |effect_allowed_|. @@ -392,7 +393,6 @@ FloatSize DataTransfer::DeviceSpaceSize(const FloatSize& css_size, std::unique_ptr DataTransfer::CreateDragImageForFrame( LocalFrame& frame, float opacity, - RespectImageOrientationEnum image_orientation, const FloatSize& css_size, const FloatPoint& paint_offset, PaintRecordBuilder& builder, @@ -425,7 +425,10 @@ std::unique_ptr DataTransfer::CreateDragImageForFrame( float screen_device_scale_factor = chrome_client.GetScreenInfo(frame).device_scale_factor; - return DragImage::Create(image.get(), image_orientation, + // There is no orientation information in the image, so pass + // kDoNotRespectImageOrientation in order to avoid wasted work looking + // at orientation. + return DragImage::Create(image.get(), kDoNotRespectImageOrientation, screen_device_scale_factor, kInterpolationDefault, opacity); } @@ -559,41 +562,27 @@ bool DataTransfer::CanSetDragImage() const { policy_ == DataTransferAccessPolicy::kWritable; } -DragOperation DataTransfer::SourceOperation() const { - base::Optional op = - ConvertEffectAllowedToDragOperation(effect_allowed_); +DragOperationsMask DataTransfer::SourceOperation() const { + base::Optional op = + ConvertEffectAllowedToDragOperationsMask(effect_allowed_); DCHECK(op); return *op; } -DragOperation DataTransfer::DestinationOperation() const { - base::Optional op = - ConvertEffectAllowedToDragOperation(drop_effect_); - DCHECK(op == kDragOperationCopy || op == kDragOperationNone || - op == kDragOperationLink || op == kDragOperationMove || - op == kDragOperationEvery); - return *op; +ui::mojom::blink::DragOperation DataTransfer::DestinationOperation() const { + DCHECK(DropEffectIsInitialized()); + base::Optional op = + ConvertEffectAllowedToDragOperationsMask(drop_effect_); + return static_cast(*op); } -void DataTransfer::SetSourceOperation(DragOperation op) { - DCHECK_NE(op, kDragOperationPrivate); - effect_allowed_ = ConvertDragOperationToEffectAllowed(op); +void DataTransfer::SetSourceOperation(DragOperationsMask op) { + effect_allowed_ = ConvertDragOperationsMaskToEffectAllowed(op); } -void DataTransfer::SetDestinationOperation(DragOperation op) { - DCHECK(op == kDragOperationCopy || op == kDragOperationNone || - op == kDragOperationLink || op == kDragOperationMove); - drop_effect_ = ConvertDragOperationToEffectAllowed(op); -} - -bool DataTransfer::HasDropZoneType(const String& keyword) { - if (keyword.StartsWith("file:")) - return HasFileOfType(keyword.Substring(5)); - - if (keyword.StartsWith("string:")) - return HasStringOfType(keyword.Substring(7)); - - return false; +void DataTransfer::SetDestinationOperation(ui::mojom::blink::DragOperation op) { + drop_effect_ = ConvertDragOperationsMaskToEffectAllowed( + static_cast(op)); } DataTransferItemList* DataTransfer::items() { @@ -612,7 +601,6 @@ DataTransfer::DataTransfer(DataTransferType type, DataTransferAccessPolicy policy, DataObject* data_object) : policy_(policy), - drop_effect_("uninitialized"), effect_allowed_("uninitialized"), transfer_type_(type), data_object_(data_object), @@ -653,30 +641,6 @@ bool DataTransfer::HasStringOfType(const String& type) const { return data_object_->Types().Contains(type); } -DragOperation ConvertDropZoneOperationToDragOperation( - const String& drag_operation) { - if (drag_operation == "copy") - return kDragOperationCopy; - if (drag_operation == "move") - return kDragOperationMove; - if (drag_operation == "link") - return kDragOperationLink; - return kDragOperationNone; -} - -String ConvertDragOperationToDropZoneOperation(DragOperation operation) { - switch (operation) { - case kDragOperationCopy: - return String("copy"); - case kDragOperationMove: - return String("move"); - case kDragOperationLink: - return String("link"); - default: - return String("copy"); - } -} - void DataTransfer::Trace(Visitor* visitor) const { visitor->Trace(data_object_); visitor->Trace(drag_image_); diff --git a/chromium/third_party/blink/renderer/core/clipboard/data_transfer.h b/chromium/third_party/blink/renderer/core/clipboard/data_transfer.h index 5887f8abead..8884592ff33 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/data_transfer.h +++ b/chromium/third_party/blink/renderer/core/clipboard/data_transfer.h @@ -25,6 +25,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CLIPBOARD_DATA_TRANSFER_H_ #include + #include "third_party/blink/public/common/page/drag_operation.h" #include "third_party/blink/renderer/core/clipboard/data_object.h" #include "third_party/blink/renderer/core/core_export.h" @@ -33,6 +34,8 @@ #include "third_party/blink/renderer/platform/geometry/int_point.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/forward.h" +#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" +#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-blink-forward.h" namespace blink { @@ -77,15 +80,13 @@ class CORE_EXPORT DataTransfer final : public ScriptWrappable, bool IsForCopyAndPaste() const { return transfer_type_ == kCopyAndPaste; } bool IsForDragAndDrop() const { return transfer_type_ == kDragAndDrop; } - String dropEffect() const { - return DropEffectIsUninitialized() ? "none" : drop_effect_; - } - void setDropEffect(const String&); - bool DropEffectIsUninitialized() const { - return drop_effect_ == "uninitialized"; + AtomicString dropEffect() const { + return DropEffectIsInitialized() ? drop_effect_ : "none"; } - String effectAllowed() const { return effect_allowed_; } - void setEffectAllowed(const String&); + void setDropEffect(const AtomicString&); + bool DropEffectIsInitialized() const { return !drop_effect_.IsNull(); } + AtomicString effectAllowed() const { return effect_allowed_; } + void setEffectAllowed(const AtomicString&); void clearData(const String& type = String()); String getData(const String& type) const; @@ -123,12 +124,10 @@ class CORE_EXPORT DataTransfer final : public ScriptWrappable, // anyway. bool CanSetDragImage() const; - DragOperation SourceOperation() const; - DragOperation DestinationOperation() const; - void SetSourceOperation(DragOperation); - void SetDestinationOperation(DragOperation); - - bool HasDropZoneType(const String&); + DragOperationsMask SourceOperation() const; + ui::mojom::blink::DragOperation DestinationOperation() const; + void SetSourceOperation(DragOperationsMask); + void SetDestinationOperation(ui::mojom::blink::DragOperation); DataTransferItemList* items(); @@ -148,7 +147,6 @@ class CORE_EXPORT DataTransfer final : public ScriptWrappable, static std::unique_ptr CreateDragImageForFrame( LocalFrame&, float, - RespectImageOrientationEnum, const FloatSize& css_size, const FloatPoint& paint_offset, PaintRecordBuilder&, @@ -169,8 +167,8 @@ class CORE_EXPORT DataTransfer final : public ScriptWrappable, // Instead of using this member directly, prefer to use the can*() methods // above. DataTransferAccessPolicy policy_; - String drop_effect_; - String effect_allowed_; + AtomicString drop_effect_; + AtomicString effect_allowed_; DataTransferType transfer_type_; Member data_object_; @@ -181,10 +179,6 @@ class CORE_EXPORT DataTransfer final : public ScriptWrappable, Member drag_image_element_; }; -DragOperation ConvertDropZoneOperationToDragOperation( - const String& drag_operation); -String ConvertDragOperationToDropZoneOperation(DragOperation); - } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CLIPBOARD_DATA_TRANSFER_H_ diff --git a/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.cc b/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.cc index 3a11329c7ed..63a692a642a 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.cc +++ b/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.cc @@ -8,6 +8,7 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "mojo/public/cpp/system/platform_handle.h" +#include "skia/ext/skia_utils_base.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h" #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" #include "third_party/blink/public/platform/platform.h" @@ -42,10 +43,10 @@ SystemClipboard::SystemClipboard(LocalFrame* frame) frame->GetBrowserInterfaceBroker().GetInterface( clipboard_.BindNewPipeAndPassReceiver( frame->GetTaskRunner(TaskType::kUserInteraction))); -#if defined(OS_LINUX) || BUILDFLAG(IS_LACROS) +#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) is_selection_buffer_available_ = frame->GetSettings()->GetSelectionClipboardBufferAvailable(); -#endif // defined(OS_LINUX) || BUILDFLAG(IS_LACROS) +#endif // defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) } bool SystemClipboard::IsSelectionMode() const { @@ -183,7 +184,15 @@ void SystemClipboard::WriteImageWithTag(Image* image, SkBitmap bitmap; if (sk_sp sk_image = paint_image.GetSwSkImage()) sk_image->asLegacyBitmap(&bitmap); - clipboard_->WriteImage(bitmap); + // The bitmap backing a canvas can be in non-native skia pixel order (aka + // RGBA when kN32_SkColorType is BGRA-ordered, or higher bit-depth color-types + // like F16. The IPC to the browser requires the bitmap to be in N32 format + // so we convert it here if needed. + SkBitmap n32_bitmap; + if (skia::SkBitmapToN32OpaqueOrPremul(bitmap, &n32_bitmap)) + clipboard_->WriteImage(n32_bitmap); + else + clipboard_->WriteImage(SkBitmap()); if (url.IsValid() && !url.IsEmpty()) { #if !defined(OS_MAC) @@ -206,6 +215,14 @@ void SystemClipboard::WriteImage(const SkBitmap& bitmap) { clipboard_->WriteImage(bitmap); } +mojom::blink::ClipboardFilesPtr SystemClipboard::ReadFiles() { + mojom::blink::ClipboardFilesPtr files; + if (!IsValidBufferType(buffer_) || !clipboard_.is_bound()) + return files; + clipboard_->ReadFiles(buffer_, &files); + return files; +} + String SystemClipboard::ReadCustomData(const String& type) { if (!IsValidBufferType(buffer_) || !clipboard_.is_bound()) return String(); diff --git a/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.h b/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.h index ff393ac412f..52420eb13a4 100644 --- a/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.h +++ b/chromium/third_party/blink/renderer/core/clipboard/system_clipboard.h @@ -70,6 +70,9 @@ class CORE_EXPORT SystemClipboard final // Write the image only. void WriteImage(const SkBitmap&); + // Read files. + mojom::blink::ClipboardFilesPtr ReadFiles(); + String ReadCustomData(const String& type); void WriteDataObject(DataObject*); diff --git a/chromium/third_party/blink/renderer/core/content_capture/content_capture_task.cc b/chromium/third_party/blink/renderer/core/content_capture/content_capture_task.cc index 21f46317590..5c9dd3d0f4f 100644 --- a/chromium/third_party/blink/renderer/core/content_capture/content_capture_task.cc +++ b/chromium/third_party/blink/renderer/core/content_capture/content_capture_task.cc @@ -46,7 +46,12 @@ void ContentCaptureTask::TaskDelay::IncreaseDelayExponent() { ContentCaptureTask::ContentCaptureTask(LocalFrame& local_frame_root, TaskSession& task_session) - : local_frame_root_(&local_frame_root), task_session_(&task_session) { + : local_frame_root_(&local_frame_root), + task_session_(&task_session), + delay_task_( + local_frame_root_->GetTaskRunner(TaskType::kInternalContentCapture), + this, + &ContentCaptureTask::Run) { base::TimeDelta task_short_delay; base::TimeDelta task_long_delay; @@ -268,22 +273,14 @@ void ContentCaptureTask::ScheduleInternal(ScheduleReason reason) { base::TimeDelta delay = GetAndAdjustDelay(reason); // Return if the current task is about to run soon. - if (delay_task_ && delay_task_->IsActive() && - delay_task_->NextFireInterval() < delay) { + if (delay_task_.IsActive() && delay_task_.NextFireInterval() < delay) { return; } - if (!delay_task_) { - scoped_refptr task_runner = - local_frame_root_->GetTaskRunner(TaskType::kInternalContentCapture); - delay_task_ = std::make_unique>( - task_runner, this, &ContentCaptureTask::Run); - } - - if (delay_task_->IsActive()) - delay_task_->Stop(); + if (delay_task_.IsActive()) + delay_task_.Stop(); - delay_task_->StartOneShot(delay, FROM_HERE); + delay_task_.StartOneShot(delay, FROM_HERE); TRACE_EVENT_INSTANT1("content_capture", "ScheduleTask", TRACE_EVENT_SCOPE_THREAD, "reason", reason); if (histogram_reporter_) { @@ -308,17 +305,16 @@ bool ContentCaptureTask::ShouldPause() { } void ContentCaptureTask::CancelTask() { - if (delay_task_ && delay_task_->IsActive()) - delay_task_->Stop(); + if (delay_task_.IsActive()) + delay_task_.Stop(); } void ContentCaptureTask::ClearDocumentSessionsForTesting() { task_session_->ClearDocumentSessionsForTesting(); } base::TimeDelta ContentCaptureTask::GetTaskNextFireIntervalForTesting() const { - return delay_task_ && delay_task_->IsActive() - ? delay_task_->NextFireInterval() - : base::TimeDelta(); + return delay_task_.IsActive() ? delay_task_.NextFireInterval() + : base::TimeDelta(); } void ContentCaptureTask::CancelTaskForTesting() { @@ -328,6 +324,7 @@ void ContentCaptureTask::CancelTaskForTesting() { void ContentCaptureTask::Trace(Visitor* visitor) const { visitor->Trace(local_frame_root_); visitor->Trace(task_session_); + visitor->Trace(delay_task_); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/content_capture/content_capture_task.h b/chromium/third_party/blink/renderer/core/content_capture/content_capture_task.h index aa426d98f80..77cfabacc82 100644 --- a/chromium/third_party/blink/renderer/core/content_capture/content_capture_task.h +++ b/chromium/third_party/blink/renderer/core/content_capture/content_capture_task.h @@ -12,6 +12,7 @@ #include "third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.h" #include "third_party/blink/renderer/core/content_capture/task_session.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/heap/disallow_new_wrapper.h" #include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -142,7 +143,7 @@ class CORE_EXPORT ContentCaptureTask Member local_frame_root_; Member task_session_; - std::unique_ptr> delay_task_; + HeapTaskRunnerTimer delay_task_; TaskState task_state_ = TaskState::kStop; std::unique_ptr task_delay_; diff --git a/chromium/third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.cc b/chromium/third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.cc index 1cb90c88f41..b533148b1df 100644 --- a/chromium/third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.cc +++ b/chromium/third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.cc @@ -4,6 +4,7 @@ #include +#include "base/metrics/histogram_functions.h" #include "third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.h" namespace blink { @@ -17,14 +18,8 @@ constexpr char ContentCaptureTaskHistogramReporter::kTaskDelayInMs[]; constexpr char ContentCaptureTaskHistogramReporter::kTaskRunsPerCapture[]; ContentCaptureTaskHistogramReporter::ContentCaptureTaskHistogramReporter() - : capture_content_delay_time_histogram_(kCaptureContentDelayTime, - 500, - 30000, - 50), - capture_content_time_histogram_(kCaptureContentTime, 0, 50000, 50), + : capture_content_time_histogram_(kCaptureContentTime, 0, 50000, 50), send_content_time_histogram_(kSendContentTime, 0, 50000, 50), - sent_content_count_histogram_(kSentContentCount, 0, 10000, 50), - task_delay_time_in_ms_histogram_(kTaskDelayInMs, 1, 128000, 100), task_runs_per_capture_histogram_(kTaskRunsPerCapture, 0, 100, 50) {} ContentCaptureTaskHistogramReporter::~ContentCaptureTaskHistogramReporter() = @@ -45,9 +40,10 @@ void ContentCaptureTaskHistogramReporter::OnTaskScheduled( void ContentCaptureTaskHistogramReporter::OnTaskRun() { if (!task_scheduled_time_.is_null()) { - task_delay_time_in_ms_histogram_.CountMilliseconds(base::TimeTicks::Now() - - task_scheduled_time_); - task_scheduled_time_ = base::TimeTicks(); + base::UmaHistogramCustomTimes(kTaskDelayInMs, + base::TimeTicks::Now() - task_scheduled_time_, + base::TimeDelta::FromMilliseconds(1), + base::TimeDelta::FromSeconds(128), 100); } task_runs_per_capture_++; } @@ -81,8 +77,10 @@ void ContentCaptureTaskHistogramReporter::OnSendContentEnded( if (captured_content_change_time_) { base::TimeTicks content_change_time = captured_content_change_time_.value(); captured_content_change_time_.reset(); - capture_content_delay_time_histogram_.CountMilliseconds( - now - content_change_time); + base::UmaHistogramCustomTimes(kCaptureContentDelayTime, + now - content_change_time, + base::TimeDelta::FromMilliseconds(500), + base::TimeDelta::FromSeconds(30), 50); } if (!sent_content_count) return; @@ -97,7 +95,7 @@ void ContentCaptureTaskHistogramReporter::OnAllCapturedContentSent() { void ContentCaptureTaskHistogramReporter::RecordsSentContentCountPerDocument( size_t sent_content_count) { - sent_content_count_histogram_.Count(sent_content_count); + base::UmaHistogramCounts10000(kSentContentCount, sent_content_count); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.h b/chromium/third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.h index 388633de4c2..4201456d224 100644 --- a/chromium/third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.h +++ b/chromium/third_party/blink/renderer/core/content_capture/content_capture_task_histogram_reporter.h @@ -22,7 +22,8 @@ class CORE_EXPORT ContentCaptureTaskHistogramReporter static constexpr char kCaptureContentTime[] = "ContentCapture.CaptureContentTime2"; static constexpr char kSendContentTime[] = "ContentCapture.SendContentTime"; - static constexpr char kSentContentCount[] = "ContentCapture.SentContentCount"; + static constexpr char kSentContentCount[] = + "ContentCapture.SentContentCount2"; static constexpr char kTaskDelayInMs[] = "ContentCapture.TaskDelayTimeInMs"; static constexpr char kTaskRunsPerCapture[] = "ContentCapture.TaskRunsPerCapture"; @@ -66,21 +67,12 @@ class CORE_EXPORT ContentCaptureTaskHistogramReporter // and sending the content. size_t task_runs_per_capture_ = 0; - // Records time from first content change to content that has been sent, its - // range is 500ms from to 30s. - CustomCountHistogram capture_content_delay_time_histogram_; // Records time to capture the content, its range is from 0 to 50,000 // microseconds. CustomCountHistogram capture_content_time_histogram_; // Records time to send the content, its range is from 0 to 50,000 // microseconds. CustomCountHistogram send_content_time_histogram_; - // Records total count has been sent, its range is from 0 to 10,000. - LinearHistogram sent_content_count_histogram_; - // Records time taken for the task to start after it is schedule, its range is - // 1ms to 128s. The time of task that was scheduled for the retry wasn't - // measured because it is always 500ms. - CustomCountHistogram task_delay_time_in_ms_histogram_; // Records the number of times ContentCapture task run to complete a capture // which includes capturing and sending the content. CustomCountHistogram task_runs_per_capture_histogram_; diff --git a/chromium/third_party/blink/renderer/core/core_idl_files.gni b/chromium/third_party/blink/renderer/core/core_idl_files.gni index eec15ef4af6..96315711f9c 100644 --- a/chromium/third_party/blink/renderer/core/core_idl_files.gni +++ b/chromium/third_party/blink/renderer/core/core_idl_files.gni @@ -56,6 +56,7 @@ core_interface_idl_files_core_only = "clipboard/data_transfer.idl", "clipboard/data_transfer_item_list.idl", "css/css_condition_rule.idl", + "css/css_container_rule.idl", "css/css_counter_style_rule.idl", "css/css_font_face_rule.idl", "css/css_grouping_rule.idl", @@ -110,8 +111,10 @@ core_interface_idl_files_core_only = "css/style_media.idl", "css/style_sheet.idl", "css/style_sheet_list.idl", + "document_transition/document_transition.idl", "dom/abort_controller.idl", "dom/abort_signal.idl", + "dom/abstract_range.idl", "dom/attr.idl", "dom/cdata_section.idl", "dom/character_data.idl", @@ -123,6 +126,7 @@ core_interface_idl_files_core_only = "dom/dom_string_list.idl", "dom/dom_string_map.idl", "dom/dom_token_list.idl", + "dom/element.idl", "dom/events/custom_event.idl", "dom/events/event.idl", "dom/events/event_target.idl", @@ -201,6 +205,7 @@ core_interface_idl_files_core_only = "frame/test_report_body.idl", "frame/user_activation.idl", "frame/visual_viewport.idl", + "frame/window_controls_overlay.idl", "geometry/dom_matrix.idl", "geometry/dom_matrix_read_only.idl", "geometry/dom_point.idl", @@ -212,6 +217,7 @@ core_interface_idl_files_core_only = "html/canvas/image_data.idl", "html/canvas/text_metrics.idl", "html/custom/custom_element_registry.idl", + "html/custom/custom_state_set.idl", "html/custom/element_internals.idl", "html/forms/form_data.idl", "html/forms/form_data_event.idl", @@ -227,6 +233,7 @@ core_interface_idl_files_core_only = "html/forms/html_options_collection.idl", "html/forms/html_output_element.idl", "html/forms/html_select_element.idl", + "html/forms/html_select_menu_element.idl", "html/forms/html_text_area_element.idl", "html/forms/radio_node_list.idl", "html/forms/submit_event.idl", @@ -238,7 +245,6 @@ core_interface_idl_files_core_only = "html/html_body_element.idl", "html/html_br_element.idl", "html/html_collection.idl", - "html/html_content_element.idl", "html/html_data_element.idl", "html/html_details_element.idl", "html/html_dialog_element.idl", @@ -268,11 +274,11 @@ core_interface_idl_files_core_only = "html/html_paragraph_element.idl", "html/html_param_element.idl", "html/html_picture_element.idl", + "html/html_popup_element.idl", "html/html_pre_element.idl", "html/html_progress_element.idl", "html/html_quote_element.idl", "html/html_script_element.idl", - "html/html_shadow_element.idl", "html/html_slot_element.idl", "html/html_source_element.idl", "html/html_span_element.idl", @@ -318,7 +324,6 @@ core_interface_idl_files_core_only = "layout/ng/custom/layout_fragment.idl", "layout/ng/custom/layout_worklet_global_scope.idl", "loader/appcache/application_cache.idl", - "mathml/mathml_element.idl", "messaging/message_channel.idl", "messaging/message_port.idl", "mojo/mojo.idl", @@ -370,7 +375,6 @@ core_interface_idl_files_core_only = "svg/svg_component_transfer_function_element.idl", "svg/svg_defs_element.idl", "svg/svg_desc_element.idl", - "svg/svg_element.idl", "svg/svg_ellipse_element.idl", "svg/svg_fe_blend_element.idl", "svg/svg_fe_color_matrix_element.idl", @@ -498,7 +502,6 @@ core_interface_idl_files_modules_dependent = "clipboard/data_transfer_item.idl", "css/css.idl", "dom/document.idl", - "dom/element.idl", "dom/shadow_root.idl", "frame/navigator.idl", "frame/screen.idl", @@ -512,7 +515,9 @@ core_interface_idl_files_modules_dependent = "html/track/audio_track.idl", "html/track/video_track.idl", "inspector/dev_tools_host.idl", + "mathml/mathml_element.idl", "offscreencanvas/offscreen_canvas.idl", + "svg/svg_element.idl", "url/url.idl", "workers/dedicated_worker_global_scope.idl", "workers/shared_worker_global_scope.idl", @@ -530,6 +535,7 @@ core_partial_definition_idl_files = "css/cssom/element_computed_style_map.idl", "css/font_face_source.idl", "css/property_registration.idl", + "document_transition/document_transition_supplement.idl", "dom/accessibility_role.idl", "dom/aria_attributes.idl", "dom/aria_relationship_attributes.idl", @@ -555,6 +561,7 @@ core_partial_definition_idl_files = "frame/navigator_scheduling.idl", "frame/navigator_ua.idl", "frame/navigator_user_activation.idl", + "frame/navigator_window_controls_overlay.idl", "frame/window_event_handlers.idl", "frame/window_or_worker_global_scope.idl", "fullscreen/document_fullscreen.idl", @@ -613,6 +620,9 @@ core_callback_function_idl_files = "dom/function_string_callback.idl", "dom/idle_request_callback.idl", "dom/void_function.idl", + "streams/underlying_source_cancel_callback.idl", + "streams/underlying_source_pull_callback.idl", + "streams/underlying_source_start_callback.idl", ], "abspath") @@ -644,16 +654,18 @@ core_dictionary_idl_files = "css/property_definition.idl", "css/cssom/css_matrix_component_options.idl", "css/cssom/css_numeric_type.idl", + "document_transition/document_transition_init.idl", "dom/element_creation_options.idl", "dom/element_definition_options.idl", "dom/element_registration_options.idl", "dom/get_inner_html_options.idl", "dom/get_root_node_options.idl", "dom/idle_request_options.idl", + "dom/interest_cohort.idl", "dom/mutation_observer_init.idl", "dom/pointer_lock_options.idl", - "dom/set_inner_html_options.idl", "dom/shadow_root_init.idl", + "dom/static_range_init.idl", "dom/events/add_event_listener_options.idl", "dom/events/custom_event_init.idl", "dom/events/event_init.idl", @@ -691,6 +703,7 @@ core_dictionary_idl_files = "fetch/trust_token.idl", "fileapi/blob_property_bag.idl", "fileapi/file_property_bag.idl", + "frame/impression_params.idl", "frame/is_input_pending_options.idl", "frame/navigator_ua_brand_version.idl", "frame/reporting_observer_options.idl", @@ -707,7 +720,7 @@ core_dictionary_idl_files = "html/focus_options.idl", "html/assigned_nodes_options.idl", "html/canvas/baselines.idl", - "html/canvas/image_data_color_settings.idl", + "html/canvas/image_data_settings.idl", "html/canvas/image_encode_options.idl", "html/custom/validity_state_flags.idl", "html/forms/form_data_event_init.idl", @@ -745,9 +758,12 @@ core_dictionary_idl_files = "streams/readable_stream_get_reader_options.idl", "streams/readable_writable_pair.idl", "streams/stream_pipe_options.idl", + "streams/underlying_source.idl", "streams/queuing_strategy_init.idl", - "timing/measure_memory/measure_memory.idl", - "timing/measure_memory/measure_memory_breakdown.idl", + "timing/measure_memory/memory_measurement.idl", + "timing/measure_memory/memory_breakdown_entry.idl", + "timing/measure_memory/memory_attribution.idl", + "timing/measure_memory/memory_attribution_container.idl", "timing/performance_mark_options.idl", "timing/performance_measure_options.idl", "timing/performance_observer_init.idl", diff --git a/chromium/third_party/blink/renderer/core/core_initializer.cc b/chromium/third_party/blink/renderer/core/core_initializer.cc index c35f041759f..7198057dd28 100644 --- a/chromium/third_party/blink/renderer/core/core_initializer.cc +++ b/chromium/third_party/blink/renderer/core/core_initializer.cc @@ -142,8 +142,6 @@ void CoreInitializer::Initialize() { style_change_extra_data::Init(); - SecurityPolicy::Init(); - RegisterEventFactory(); StringImpl::FreezeStaticStrings(); diff --git a/chromium/third_party/blink/renderer/core/css/DIR_METADATA b/chromium/third_party/blink/renderer/core/css/DIR_METADATA new file mode 100644 index 00000000000..1876fb375cc --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/DIR_METADATA @@ -0,0 +1,5 @@ +monorail { + component: "Blink>CSS" +} + +team_email: "layout-dev@chromium.org" diff --git a/chromium/third_party/blink/renderer/core/css/OWNERS b/chromium/third_party/blink/renderer/core/css/OWNERS index a007a39a025..7c1cab453b7 100644 --- a/chromium/third_party/blink/renderer/core/css/OWNERS +++ b/chromium/third_party/blink/renderer/core/css/OWNERS @@ -3,6 +3,3 @@ andruud@chromium.org ericwilligers@chromium.org futhark@chromium.org xiaochengh@chromium.org - -# TEAM: layout-dev@chromium.org -# COMPONENT: Blink>CSS diff --git a/chromium/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.cc b/chromium/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.cc index a252ce58d37..060346478e7 100644 --- a/chromium/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.cc +++ b/chromium/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.cc @@ -68,8 +68,8 @@ void AbstractPropertySetCSSStyleDeclaration::setCSSText( String AbstractPropertySetCSSStyleDeclaration::getPropertyValue( const String& property_name) { CSSPropertyID property_id = - cssPropertyID(GetExecutionContext(), property_name); - if (!isValidCSSPropertyID(property_id)) + CssPropertyID(GetExecutionContext(), property_name); + if (!IsValidCSSPropertyID(property_id)) return String(); if (property_id == CSSPropertyID::kVariable) return PropertySet().GetPropertyValue(AtomicString(property_name)); @@ -79,8 +79,8 @@ String AbstractPropertySetCSSStyleDeclaration::getPropertyValue( String AbstractPropertySetCSSStyleDeclaration::getPropertyPriority( const String& property_name) { CSSPropertyID property_id = - cssPropertyID(GetExecutionContext(), property_name); - if (!isValidCSSPropertyID(property_id)) + CssPropertyID(GetExecutionContext(), property_name); + if (!IsValidCSSPropertyID(property_id)) return String(); bool important = false; @@ -94,14 +94,14 @@ String AbstractPropertySetCSSStyleDeclaration::getPropertyPriority( String AbstractPropertySetCSSStyleDeclaration::GetPropertyShorthand( const String& property_name) { CSSPropertyID property_id = - cssPropertyID(GetExecutionContext(), property_name); + CssPropertyID(GetExecutionContext(), property_name); // Custom properties don't have shorthands, so we can ignore them here. - if (!isValidCSSPropertyID(property_id) || + if (!IsValidCSSPropertyID(property_id) || !CSSProperty::Get(property_id).IsLonghand()) return String(); CSSPropertyID shorthand_id = PropertySet().GetPropertyShorthand(property_id); - if (!isValidCSSPropertyID(shorthand_id)) + if (!IsValidCSSPropertyID(shorthand_id)) return String(); return CSSProperty::Get(shorthand_id).GetPropertyNameString(); } @@ -109,10 +109,10 @@ String AbstractPropertySetCSSStyleDeclaration::GetPropertyShorthand( bool AbstractPropertySetCSSStyleDeclaration::IsPropertyImplicit( const String& property_name) { CSSPropertyID property_id = - cssPropertyID(GetExecutionContext(), property_name); + CssPropertyID(GetExecutionContext(), property_name); // Custom properties don't have shorthands, so we can ignore them here. - if (property_id < firstCSSProperty) + if (property_id < kFirstCSSProperty) return false; return PropertySet().IsPropertyImplicit(property_id); } @@ -124,8 +124,8 @@ void AbstractPropertySetCSSStyleDeclaration::setProperty( const String& priority, ExceptionState& exception_state) { CSSPropertyID property_id = - unresolvedCSSPropertyID(execution_context, property_name); - if (!isValidCSSPropertyID(property_id)) + UnresolvedCSSPropertyID(execution_context, property_name); + if (!IsValidCSSPropertyID(property_id)) return; bool important = EqualIgnoringASCIICase(priority, "important"); @@ -143,8 +143,8 @@ String AbstractPropertySetCSSStyleDeclaration::removeProperty( const String& property_name, ExceptionState& exception_state) { CSSPropertyID property_id = - cssPropertyID(GetExecutionContext(), property_name); - if (!isValidCSSPropertyID(property_id)) + CssPropertyID(GetExecutionContext(), property_name); + if (!IsValidCSSPropertyID(property_id)) return String(); StyleAttributeMutationScope mutation_scope(this); @@ -176,7 +176,7 @@ const CSSValue* AbstractPropertySetCSSStyleDeclaration::GetPropertyCSSValueInternal( AtomicString custom_property_name) { DCHECK_EQ(CSSPropertyID::kVariable, - cssPropertyID(GetExecutionContext(), custom_property_name)); + CssPropertyID(GetExecutionContext(), custom_property_name)); return PropertySet().GetPropertyCSSValue(custom_property_name); } diff --git a/chromium/third_party/blink/renderer/core/css/active_style_sheets.cc b/chromium/third_party/blink/renderer/core/css/active_style_sheets.cc index 3c9209e0847..b2b05ae2bab 100644 --- a/chromium/third_party/blink/renderer/core/css/active_style_sheets.cc +++ b/chromium/third_party/blink/renderer/core/css/active_style_sheets.cc @@ -124,4 +124,45 @@ ActiveSheetsChange CompareActiveStyleSheets( : kActiveSheetsChanged; } +namespace { + +bool HasMediaQueries(const ActiveStyleSheetVector& active_style_sheets) { + for (const auto& active_sheet : active_style_sheets) { + if (const MediaQuerySet* media_queries = + active_sheet.first->MediaQueries()) { + if (!media_queries->QueryVector().IsEmpty()) + return true; + } + StyleSheetContents* contents = active_sheet.first->Contents(); + if (contents->HasMediaQueries()) + return true; + } + return false; +} + +bool HasSizeDependentMediaQueries( + const ActiveStyleSheetVector& active_style_sheets) { + for (const auto& active_sheet : active_style_sheets) { + if (active_sheet.first->HasMediaQueryResults()) + return true; + StyleSheetContents* contents = active_sheet.first->Contents(); + if (!contents->HasRuleSet()) + continue; + if (contents->GetRuleSet().Features().HasMediaQueryResults()) + return true; + } + return false; +} + +} // namespace + +bool AffectedByMediaValueChange(const ActiveStyleSheetVector& active_sheets, + MediaValueChange change) { + if (change == MediaValueChange::kSize) + return HasSizeDependentMediaQueries(active_sheets); + + DCHECK(change == MediaValueChange::kOther); + return HasMediaQueries(active_sheets); +} + } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/active_style_sheets.h b/chromium/third_party/blink/renderer/core/css/active_style_sheets.h index 47f3ae5d58c..ce4d711c29c 100644 --- a/chromium/third_party/blink/renderer/core/css/active_style_sheets.h +++ b/chromium/third_party/blink/renderer/core/css/active_style_sheets.h @@ -6,6 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_ACTIVE_STYLE_SHEETS_H_ #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/media_value_change.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -27,6 +28,9 @@ CompareActiveStyleSheets(const ActiveStyleSheetVector& old_style_sheets, const ActiveStyleSheetVector& new_style_sheets, HeapHashSet>& changed_rule_sets); +bool AffectedByMediaValueChange(const ActiveStyleSheetVector& active_sheets, + MediaValueChange change); + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_ACTIVE_STYLE_SHEETS_H_ diff --git a/chromium/third_party/blink/renderer/core/css/active_style_sheets_test.cc b/chromium/third_party/blink/renderer/core/css/active_style_sheets_test.cc index f01a512e45f..d23055dc0df 100644 --- a/chromium/third_party/blink/renderer/core/css/active_style_sheets_test.cc +++ b/chromium/third_party/blink/renderer/core/css/active_style_sheets_test.cc @@ -510,7 +510,6 @@ TEST_F(ApplyRulesetsTest, RemoveSheetFromShadowTree) { shadow_root.setInnerHTML(""); UpdateAllLifecyclePhasesForTest(); - EXPECT_TRUE(GetStyleEngine().TreeBoundaryCrossingScopes().IsEmpty()); ASSERT_EQ(1u, shadow_root.StyleSheets().length()); StyleSheet* sheet = shadow_root.StyleSheets().item(0); @@ -523,8 +522,6 @@ TEST_F(ApplyRulesetsTest, RemoveSheetFromShadowTree) { std::make_pair(css_sheet, &css_sheet->Contents()->GetRuleSet())); GetStyleEngine().ApplyRuleSetChanges(shadow_root, old_style_sheets, ActiveStyleSheetVector()); - - EXPECT_TRUE(GetStyleEngine().TreeBoundaryCrossingScopes().IsEmpty()); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/background_color_paint_image_generator.cc b/chromium/third_party/blink/renderer/core/css/background_color_paint_image_generator.cc new file mode 100644 index 00000000000..61e1b6a0672 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/background_color_paint_image_generator.cc @@ -0,0 +1,30 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/background_color_paint_image_generator.h" + +namespace blink { + +namespace { + +BackgroundColorPaintImageGenerator:: + BackgroundColorPaintImageGeneratorCreateFunction g_create_function = + nullptr; + +} // namespace + +// static +void BackgroundColorPaintImageGenerator::Init( + BackgroundColorPaintImageGeneratorCreateFunction create_function) { + DCHECK(!g_create_function); + g_create_function = create_function; +} + +BackgroundColorPaintImageGenerator* BackgroundColorPaintImageGenerator::Create( + LocalFrame& local_root) { + DCHECK(g_create_function); + return g_create_function(local_root); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/background_color_paint_image_generator.h b/chromium/third_party/blink/renderer/core/css/background_color_paint_image_generator.h new file mode 100644 index 00000000000..08a77b9f1ec --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/background_color_paint_image_generator.h @@ -0,0 +1,47 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_BACKGROUND_COLOR_PAINT_IMAGE_GENERATOR_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_BACKGROUND_COLOR_PAINT_IMAGE_GENERATOR_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/native_paint_image_generator.h" +#include "third_party/blink/renderer/platform/geometry/float_size.h" +#include "third_party/blink/renderer/platform/graphics/color.h" +#include "third_party/skia/include/core/SkColor.h" + +namespace blink { + +class Image; +class LocalFrame; +class Node; + +class CORE_EXPORT BackgroundColorPaintImageGenerator + : public NativePaintImageGenerator { + public: + static BackgroundColorPaintImageGenerator* Create(LocalFrame&); + + ~BackgroundColorPaintImageGenerator() override = default; + + typedef BackgroundColorPaintImageGenerator* ( + *BackgroundColorPaintImageGeneratorCreateFunction)(LocalFrame&); + static void Init( + BackgroundColorPaintImageGeneratorCreateFunction create_function); + + virtual scoped_refptr Paint(const FloatSize& container_size, + const Node*, + const Vector& animated_colors, + const Vector& offsets) = 0; + + // Get the animated colors and offsets from the animation keyframes. + // Returning false meaning that we need to fall back to the main thread for + // the animation. + virtual bool GetBGColorPaintWorkletParams(Node* node, + Vector* animated_colors, + Vector* offsets) = 0; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_BACKGROUND_COLOR_PAINT_IMAGE_GENERATOR_H_ diff --git a/chromium/third_party/blink/renderer/core/css/build.gni b/chromium/third_party/blink/renderer/core/css/build.gni index fc0c8c1d548..0b3d30b94dd 100644 --- a/chromium/third_party/blink/renderer/core/css/build.gni +++ b/chromium/third_party/blink/renderer/core/css/build.gni @@ -7,12 +7,22 @@ blink_core_sources_css = [ "abstract_property_set_css_style_declaration.h", "active_style_sheets.cc", "active_style_sheets.h", + "background_color_paint_image_generator.cc", + "background_color_paint_image_generator.h", "basic_shape_functions.cc", "basic_shape_functions.h", "binary_data_font_face_source.cc", "binary_data_font_face_source.h", "computed_style_css_value_mapping.cc", "computed_style_css_value_mapping.h", + "counter_style.cc", + "counter_style.h", + "counter_style_map.cc", + "counter_style_map.h", + "container_query.cc", + "container_query.h", + "container_query_evaluator.cc", + "container_query_evaluator.h", "css_axis_value.cc", "css_axis_value.h", "css_basic_shape_values.cc", @@ -27,6 +37,8 @@ blink_core_sources_css = [ "css_computed_style_declaration.h", "css_condition_rule.cc", "css_condition_rule.h", + "css_container_rule.cc", + "css_container_rule.h", "css_content_distribution_value.cc", "css_content_distribution_value.h", "css_counter_style_rule.cc", @@ -204,6 +216,8 @@ blink_core_sources_css = [ "css_uri_value.h", "css_value.cc", "css_value.h", + "css_value_clamping_utils.h", + "css_value_clamping_utils.cc", "css_value_id_mappings.h", "css_value_list.cc", "css_value_list.h", @@ -381,9 +395,6 @@ blink_core_sources_css = [ "media_values_cached.h", "media_values_dynamic.cc", "media_values_dynamic.h", - "media_values_initial_viewport.cc", - "media_values_initial_viewport.h", - "native_paint_image_generator.cc", "native_paint_image_generator.h", "offscreen_font_selector.cc", "offscreen_font_selector.h", @@ -573,6 +584,8 @@ blink_core_sources_css = [ "style_recalc_root.h", "style_rule.cc", "style_rule.h", + "style_rule_counter_style.cc", + "style_rule_counter_style.h", "style_rule_css_style_declaration.cc", "style_rule_css_style_declaration.h", "style_rule_import.cc", @@ -603,6 +616,8 @@ blink_core_tests_css = [ "active_style_sheets_test.cc", "affected_by_pseudo_test.cc", "computed_style_css_value_mapping_test.cc", + "container_query_test.cc", + "container_query_evaluator_test.cc", "css_computed_style_declaration_test.cc", "css_element_offset_value_test.cc", "css_font_face_source_test.cc", @@ -621,6 +636,9 @@ blink_core_tests_css = [ "css_style_declaration_test.cc", "css_style_sheet_test.cc", "css_syntax_string_parser_test.cc", + "css_value_clamping_utils_test.cc", + "counter_style_map_test.cc", + "counter_style_test.cc", "cssom/computed_style_property_map_test.cc", "cssom/cross_thread_style_value_test.cc", "cssom/css_math_invert_test.cc", @@ -647,7 +665,6 @@ blink_core_tests_css = [ "media_query_list_test.cc", "media_query_matcher_test.cc", "media_query_set_test.cc", - "media_values_initial_viewport_test.cc", "media_values_test.cc", "parser/css_lazy_parsing_test.cc", "parser/css_parser_fast_paths_test.cc", @@ -684,7 +701,6 @@ blink_core_tests_css = [ "resolver/style_adjuster_test.cc", "resolver/style_builder_test.cc", "resolver/style_cascade_test.cc", - "resolver/style_resolver_state_test.cc", "resolver/style_resolver_test.cc", "rule_feature_set_test.cc", "rule_set_test.cc", diff --git a/chromium/third_party/blink/renderer/core/css/container_query.cc b/chromium/third_party/blink/renderer/core/css/container_query.cc new file mode 100644 index 00000000000..6b75aa2459c --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/container_query.cc @@ -0,0 +1,41 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/container_query.h" +#include "third_party/blink/renderer/core/css/media_query_exp.h" + +namespace blink { + +namespace { + +PhysicalAxes ComputeQueriedAxes(const MediaQuerySet& media_queries) { + PhysicalAxes axes(kPhysicalAxisNone); + + for (const auto& media_query : media_queries.QueryVector()) { + for (const auto& expression : media_query->Expressions()) { + if (expression.IsWidthDependent()) + axes |= PhysicalAxes(kPhysicalAxisHorizontal); + if (expression.IsHeightDependent()) + axes |= PhysicalAxes(kPhysicalAxisVertical); + } + } + + return axes; +} + +} // namespace + +ContainerQuery::ContainerQuery(scoped_refptr media_queries) + : media_queries_(media_queries), + queried_axes_(ComputeQueriedAxes(*media_queries)) {} + +ContainerQuery::ContainerQuery(const ContainerQuery& other) + : media_queries_(other.media_queries_->Copy()), + queried_axes_(other.queried_axes_) {} + +String ContainerQuery::ToString() const { + return media_queries_->MediaText(); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/container_query.h b/chromium/third_party/blink/renderer/core/css/container_query.h new file mode 100644 index 00000000000..1257645c088 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/container_query.h @@ -0,0 +1,37 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CONTAINER_QUERY_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CONTAINER_QUERY_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/media_list.h" +#include "third_party/blink/renderer/core/layout/geometry/axis.h" + +namespace blink { + +class CORE_EXPORT ContainerQuery final + : public GarbageCollected { + public: + explicit ContainerQuery(scoped_refptr); + ContainerQuery(const ContainerQuery&); + + PhysicalAxes QueriedAxes() const { return queried_axes_; } + + String ToString() const; + + void Trace(Visitor*) const {} + + private: + friend class ContainerQueryTest; + friend class ContainerQueryEvaluator; + + // TODO(crbug.com/1145970): Refactor to avoid internal MediaQuerySet. + scoped_refptr media_queries_; + PhysicalAxes queried_axes_{kPhysicalAxisNone}; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CONTAINER_QUERY_H_ diff --git a/chromium/third_party/blink/renderer/core/css/container_query_evaluator.cc b/chromium/third_party/blink/renderer/core/css/container_query_evaluator.cc new file mode 100644 index 00000000000..aee25f87272 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/container_query_evaluator.cc @@ -0,0 +1,79 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/container_query_evaluator.h" +#include "third_party/blink/renderer/core/css/container_query.h" + +#include "third_party/blink/renderer/core/css/media_values_cached.h" + +namespace blink { + +namespace { + +bool IsSufficientlyContained(PhysicalAxes contained_axes, + PhysicalAxes queried_axes) { + return (contained_axes & queried_axes) == queried_axes; +} + +} // namespace + +ContainerQueryEvaluator::ContainerQueryEvaluator(PhysicalSize size, + PhysicalAxes contained_axes) { + SetData(size, contained_axes); +} + +bool ContainerQueryEvaluator::Eval( + const ContainerQuery& container_query) const { + if (!IsSufficientlyContained(contained_axes_, container_query.QueriedAxes())) + return false; + return media_query_evaluator_->Eval(*container_query.media_queries_); +} + +void ContainerQueryEvaluator::Add(const ContainerQuery& query, bool result) { + results_.Set(&query, result); +} + +bool ContainerQueryEvaluator::ContainerChanged(PhysicalSize size, + PhysicalAxes contained_axes) { + if (size_ == size && contained_axes_ == contained_axes) + return false; + + SetData(size, contained_axes); + + if (!ResultsChanged()) + return false; + + // We can clear the results here because we will always recaculate the style + // of all descendants which depend on this evaluator whenever we return + // 'true' from this function, so the results will always be repopulated. + results_.clear(); + + return true; +} + +void ContainerQueryEvaluator::Trace(Visitor* visitor) const { + visitor->Trace(media_query_evaluator_); + visitor->Trace(results_); +} + +void ContainerQueryEvaluator::SetData(PhysicalSize size, + PhysicalAxes contained_axes) { + size_ = size; + contained_axes_ = contained_axes; + + auto* cached_values = MakeGarbageCollected(); + cached_values->OverrideViewportDimensions(size_.width, size_.height); + media_query_evaluator_ = + MakeGarbageCollected(*cached_values); +} + +bool ContainerQueryEvaluator::ResultsChanged() const { + for (const auto& result : results_) { + if (Eval(*result.key) != result.value) + return true; + } + return false; +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/container_query_evaluator.h b/chromium/third_party/blink/renderer/core/css/container_query_evaluator.h new file mode 100644 index 00000000000..939d0488b3a --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/container_query_evaluator.h @@ -0,0 +1,65 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CONTAINER_QUERY_EVALUATOR_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CONTAINER_QUERY_EVALUATOR_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/media_query_evaluator.h" +#include "third_party/blink/renderer/core/layout/geometry/axis.h" +#include "third_party/blink/renderer/core/layout/geometry/physical_size.h" +#include "third_party/blink/renderer/platform/heap/handle.h" + +namespace blink { + +class ContainerQuery; + +class CORE_EXPORT ContainerQueryEvaluator final + : public GarbageCollected { + public: + ContainerQueryEvaluator(PhysicalSize, PhysicalAxes contained_axes); + + bool Eval(const ContainerQuery&) const; + + // Add a dependent query to this evaluator. During calls to ContainerChanged, + // all dependent queries are checked to see if the new size/axis information + // causes a change in the evaluation result. + void Add(const ContainerQuery&, bool result); + + bool EvalAndAdd(const ContainerQuery& query) { + bool result = Eval(query); + Add(query, result); + return result; + } + + // Update the size/axis information of the evaluator. + // + // A return value of 'false' means that the update has no effect on the + // evaluation of queries associated with this evaluator, and therefore we do + // not need to perform style recalc of any elements which depend on this + // evaluator. + // + // A return value of 'true' means that the update *may* have an effect, and + // therefore elements that depends on this evaluator need style recalc. + // + // Dependent queries are cleared when 'true' is returned (and left unchanged + // otherwise). + bool ContainerChanged(PhysicalSize, PhysicalAxes contained_axes); + + void Trace(Visitor*) const; + + private: + void SetData(PhysicalSize, PhysicalAxes contained_axes); + bool ResultsChanged() const; + + // TODO(crbug.com/1145970): Don't lean on MediaQueryEvaluator. + Member media_query_evaluator_; + PhysicalSize size_; + PhysicalAxes contained_axes_; + HeapHashMap, bool> results_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CONTAINER_QUERY_EVALUATOR_H_ diff --git a/chromium/third_party/blink/renderer/core/css/container_query_evaluator_test.cc b/chromium/third_party/blink/renderer/core/css/container_query_evaluator_test.cc new file mode 100644 index 00000000000..60d2e5c45d2 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/container_query_evaluator_test.cc @@ -0,0 +1,248 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/container_query_evaluator.h" + +#include "third_party/blink/renderer/core/css/container_query.h" +#include "third_party/blink/renderer/core/css/css_container_rule.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" +#include "third_party/blink/renderer/core/css/style_engine.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/dom/element.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" +#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" + +namespace blink { + +class ContainerQueryEvaluatorTest : public PageTestBase, + private ScopedCSSContainerQueriesForTest { + public: + ContainerQueryEvaluatorTest() : ScopedCSSContainerQueriesForTest(true) {} + + ContainerQuery* ParseContainer(String query) { + String rule = "@container " + query + " {}"; + auto* style_rule = DynamicTo( + css_test_helpers::ParseRule(GetDocument(), rule)); + if (!style_rule) + return nullptr; + return &style_rule->GetContainerQuery(); + } + + bool Eval(String query, + double width, + double height, + PhysicalAxes contained_axes) { + ContainerQuery* container_query = ParseContainer(query); + DCHECK(container_query); + auto* evaluator = MakeGarbageCollected( + PhysicalSize(LayoutUnit(width), LayoutUnit(height)), contained_axes); + return evaluator->Eval(*container_query); + } + + const PhysicalAxes none{kPhysicalAxisNone}; + const PhysicalAxes both{kPhysicalAxisBoth}; + const PhysicalAxes horizontal{kPhysicalAxisHorizontal}; + const PhysicalAxes vertical{kPhysicalAxisVertical}; +}; + +TEST_F(ContainerQueryEvaluatorTest, ContainmentMatch) { + { + String query = "(min-width: 100px)"; + EXPECT_TRUE(Eval(query, 100.0, 100.0, horizontal)); + EXPECT_TRUE(Eval(query, 100.0, 100.0, both)); + EXPECT_FALSE(Eval(query, 100.0, 100.0, vertical)); + EXPECT_FALSE(Eval(query, 100.0, 100.0, none)); + EXPECT_FALSE(Eval(query, 99.0, 100.0, horizontal)); + } + + { + String query = "(min-height: 100px)"; + EXPECT_TRUE(Eval(query, 100.0, 100.0, vertical)); + EXPECT_TRUE(Eval(query, 100.0, 100.0, both)); + EXPECT_FALSE(Eval(query, 100.0, 100.0, horizontal)); + EXPECT_FALSE(Eval(query, 100.0, 100.0, none)); + EXPECT_FALSE(Eval(query, 100.0, 99.0, vertical)); + } + + { + String query = "(min-width: 100px) and (min-height: 100px)"; + EXPECT_TRUE(Eval(query, 100.0, 100.0, both)); + EXPECT_FALSE(Eval(query, 100.0, 100.0, vertical)); + EXPECT_FALSE(Eval(query, 100.0, 100.0, horizontal)); + EXPECT_FALSE(Eval(query, 100.0, 100.0, none)); + EXPECT_FALSE(Eval(query, 100.0, 99.0, both)); + EXPECT_FALSE(Eval(query, 99.0, 100.0, both)); + } +} + +TEST_F(ContainerQueryEvaluatorTest, ContainerChanged) { + PhysicalSize size_100(LayoutUnit(100), LayoutUnit(100)); + PhysicalSize size_200(LayoutUnit(200), LayoutUnit(200)); + + ContainerQuery* container_query_100 = ParseContainer("(min-width: 100px)"); + ContainerQuery* container_query_200 = ParseContainer("(min-width: 200px)"); + ASSERT_TRUE(container_query_100); + ASSERT_TRUE(container_query_200); + + auto* evaluator = + MakeGarbageCollected(size_100, horizontal); + ASSERT_TRUE(evaluator); + + EXPECT_TRUE(evaluator->EvalAndAdd(*container_query_100)); + EXPECT_FALSE(evaluator->EvalAndAdd(*container_query_200)); + + EXPECT_FALSE(evaluator->ContainerChanged(size_100, horizontal)); + EXPECT_TRUE(evaluator->EvalAndAdd(*container_query_100)); + EXPECT_FALSE(evaluator->EvalAndAdd(*container_query_200)); + + EXPECT_TRUE(evaluator->ContainerChanged(size_200, horizontal)); + EXPECT_TRUE(evaluator->EvalAndAdd(*container_query_100)); + EXPECT_TRUE(evaluator->EvalAndAdd(*container_query_200)); + + EXPECT_FALSE(evaluator->ContainerChanged(size_200, horizontal)); + EXPECT_TRUE(evaluator->EvalAndAdd(*container_query_100)); + EXPECT_TRUE(evaluator->EvalAndAdd(*container_query_200)); + + EXPECT_TRUE(evaluator->ContainerChanged(size_200, vertical)); + EXPECT_FALSE(evaluator->EvalAndAdd(*container_query_100)); + EXPECT_FALSE(evaluator->EvalAndAdd(*container_query_200)); +} + +TEST_F(ContainerQueryEvaluatorTest, SizeInvalidation) { + SetBodyInnerHTML(R"HTML( + +
+
+
+
+
+
+
+
+ )HTML"); + + Element* container = GetDocument().getElementById("container"); + ASSERT_TRUE(container); + ASSERT_TRUE(container->GetContainerQueryEvaluator()); + + { + // Causes re-layout, but the size does not change + container->SetInlineStyleProperty(CSSPropertyID::kFloat, "left"); + + unsigned before_count = GetStyleEngine().StyleForElementCount(); + + UpdateAllLifecyclePhasesForTest(); + + unsigned after_count = GetStyleEngine().StyleForElementCount(); + + // Only #container should be affected. In particular, we should not + // recalc any style for
children of #container. + EXPECT_EQ(1u, after_count - before_count); + } + + { + // The size of the container changes, but it does not matter for + // the result of the query (min-width: 500px). + container->SetInlineStyleProperty(CSSPropertyID::kWidth, "600px"); + + unsigned before_count = GetStyleEngine().StyleForElementCount(); + + UpdateAllLifecyclePhasesForTest(); + + unsigned after_count = GetStyleEngine().StyleForElementCount(); + + // Only #container should be affected. In particular, we should not + // recalc any style for
children of #container. + EXPECT_EQ(1u, after_count - before_count); + } +} + +TEST_F(ContainerQueryEvaluatorTest, DependentQueries) { + PhysicalSize size_100(LayoutUnit(100), LayoutUnit(100)); + PhysicalSize size_150(LayoutUnit(150), LayoutUnit(150)); + PhysicalSize size_200(LayoutUnit(200), LayoutUnit(200)); + PhysicalSize size_300(LayoutUnit(300), LayoutUnit(300)); + PhysicalSize size_400(LayoutUnit(400), LayoutUnit(400)); + + ContainerQuery* query_min_200px = ParseContainer("(min-width: 200px)"); + ContainerQuery* query_max_300px = ParseContainer("(max-width: 300px)"); + ASSERT_TRUE(query_min_200px); + + auto* evaluator = + MakeGarbageCollected(size_100, horizontal); + + evaluator->EvalAndAdd(*query_min_200px); + evaluator->EvalAndAdd(*query_max_300px); + // Updating with the same size as we initially had should not invalidate + // any query results. + EXPECT_FALSE(evaluator->ContainerChanged(size_100, horizontal)); + + // Makes no difference for either of (min-width: 200px), (max-width: 300px): + EXPECT_FALSE(evaluator->ContainerChanged(size_150, horizontal)); + + // (min-width: 200px) becomes true: + EXPECT_TRUE(evaluator->ContainerChanged(size_200, horizontal)); + + evaluator->EvalAndAdd(*query_min_200px); + evaluator->EvalAndAdd(*query_max_300px); + EXPECT_FALSE(evaluator->ContainerChanged(size_200, horizontal)); + + // Makes no difference for either of (min-width: 200px), (max-width: 300px): + EXPECT_FALSE(evaluator->ContainerChanged(size_300, horizontal)); + + // (max-width: 300px) becomes false: + EXPECT_TRUE(evaluator->ContainerChanged(size_400, horizontal)); +} + +TEST_F(ContainerQueryEvaluatorTest, EvaluatorOnDetachLayoutTree) { + SetBodyInnerHTML(R"HTML( + +
+
+
+
+
+
+ )HTML"); + + Element* container1 = GetDocument().getElementById("container1"); + ASSERT_TRUE(container1); + ASSERT_TRUE(container1->GetContainerQueryEvaluator()); + + // DetachLayoutTree with performing_reattach=false: + container1->remove(); + UpdateAllLifecyclePhasesForTest(); + EXPECT_FALSE(container1->GetContainerQueryEvaluator()) + << "ContainerQueryEvaluator should be removed"; + + // DetachLayoutTree with performing_reattach=true: + Element* container2 = GetDocument().getElementById("container2"); + ASSERT_TRUE(container2); + ASSERT_TRUE(container2->GetContainerQueryEvaluator()); + container2->SetInlineStyleProperty(CSSPropertyID::kDisplay, "none"); + UpdateAllLifecyclePhasesForTest(); + EXPECT_TRUE(container2->GetContainerQueryEvaluator()) + << "ContainerQueryEvaluator should persist"; +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/container_query_test.cc b/chromium/third_party/blink/renderer/core/css/container_query_test.cc new file mode 100644 index 00000000000..57f1d190e94 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/container_query_test.cc @@ -0,0 +1,198 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/container_query.h" + +#include "third_party/blink/renderer/core/css/css_container_rule.h" +#include "third_party/blink/renderer/core/css/css_test_helpers.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/dom/element.h" +#include "third_party/blink/renderer/core/dom/node_computed_style.h" +#include "third_party/blink/renderer/core/style/computed_style.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" +#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" + +namespace blink { + +class ContainerQueryTest : public PageTestBase, + private ScopedCSSContainerQueriesForTest { + public: + ContainerQueryTest() : ScopedCSSContainerQueriesForTest(true) {} + + StyleRuleContainer* ParseAtContainer(String rule_string) { + return DynamicTo( + css_test_helpers::ParseRule(GetDocument(), rule_string)); + } + + ContainerQuery* ParseContainerQuery(String query) { + String rule = "@container " + query + " {}"; + StyleRuleContainer* container = ParseAtContainer(rule); + if (!container) + return nullptr; + return &container->GetContainerQuery(); + } + + PhysicalAxes QueriedAxes(String query) { + ContainerQuery* container_query = ParseContainerQuery(query); + DCHECK(container_query); + return container_query->QueriedAxes(); + } + + String SerializeCondition(StyleRuleContainer* container) { + if (!container) + return ""; + return container->GetContainerQuery().ToString(); + } + + // TODO(crbug.com/1145970): Remove this when ContainerQuery no longer + // relies on MediaQuerySet. + MediaQuerySet& GetMediaQuerySet(ContainerQuery& container_query) { + return *container_query.media_queries_; + } +}; + +TEST_F(ContainerQueryTest, PreludeParsing) { + // Valid: + EXPECT_EQ( + "(min-width: 300px)", + SerializeCondition(ParseAtContainer("@container (min-width: 300px) {}"))); + EXPECT_EQ( + "(max-width: 500px)", + SerializeCondition(ParseAtContainer("@container (max-width: 500px) {}"))); + + // TODO(crbug.com/1145970): The MediaQuery parser emits a "not all" + // MediaQuery for parse failures. When ContainerQuery has its own parser, + // it should probably return nullptr instead. + + // Invalid: + EXPECT_EQ("not all", + SerializeCondition(ParseAtContainer("@container 100px {}"))); + EXPECT_EQ("not all", + SerializeCondition(ParseAtContainer("@container calc(1) {}"))); +} + +TEST_F(ContainerQueryTest, RuleParsing) { + StyleRuleContainer* container = ParseAtContainer(R"CSS( + @container (min-width: 100px) { + div { width: 100px; } + span { height: 100px; } + } + )CSS"); + ASSERT_TRUE(container); + + CSSStyleSheet* sheet = css_test_helpers::CreateStyleSheet(GetDocument()); + auto* rule = + DynamicTo(container->CreateCSSOMWrapper(sheet)); + ASSERT_TRUE(rule); + ASSERT_EQ(2u, rule->length()); + + auto* div_rule = rule->Item(0); + ASSERT_TRUE(div_rule); + EXPECT_EQ("div { width: 100px; }", div_rule->cssText()); + + auto* span_rule = rule->Item(1); + ASSERT_TRUE(span_rule); + EXPECT_EQ("span { height: 100px; }", span_rule->cssText()); +} + +TEST_F(ContainerQueryTest, RuleCopy) { + StyleRuleContainer* container = ParseAtContainer(R"CSS( + @container (min-width: 100px) { + div { width: 100px; } + } + )CSS"); + ASSERT_TRUE(container); + + // Copy via StyleRuleBase to test switch dispatch. + auto* copy_base = static_cast(container)->Copy(); + auto* copy = DynamicTo(copy_base); + ASSERT_TRUE(copy); + + // The StyleRuleContainer object should be copied. + EXPECT_NE(container, copy); + + // The rules should be copied. + auto rules = container->ChildRules(); + auto rules_copy = copy->ChildRules(); + ASSERT_EQ(1u, rules.size()); + ASSERT_EQ(1u, rules_copy.size()); + EXPECT_NE(rules[0], rules_copy[0]); + + // The ContainerQuery should be copied. + EXPECT_NE(&container->GetContainerQuery(), ©->GetContainerQuery()); + + // The inner MediaQuerySet should be copied. + EXPECT_NE(&GetMediaQuerySet(container->GetContainerQuery()), + &GetMediaQuerySet(copy->GetContainerQuery())); +} + +TEST_F(ContainerQueryTest, ContainerQueryEvaluation) { + SetBodyInnerHTML(R"HTML( + +
+
+
+ )HTML"); + Element* div = GetDocument().getElementById("div"); + ASSERT_TRUE(div); + EXPECT_EQ(2, div->ComputedStyleRef().ZIndex()); + + // Check that dependent elements are responsive to changes: + Element* container = GetDocument().getElementById("container"); + ASSERT_TRUE(container); + container->setAttribute(html_names::kClassAttr, "adjust"); + UpdateAllLifecyclePhasesForTest(); + EXPECT_EQ(3, div->ComputedStyleRef().ZIndex()); + + container->setAttribute(html_names::kClassAttr, ""); + UpdateAllLifecyclePhasesForTest(); + EXPECT_EQ(2, div->ComputedStyleRef().ZIndex()); +} + +TEST_F(ContainerQueryTest, QueriedAxes) { + auto horizontal = PhysicalAxes(kPhysicalAxisHorizontal); + auto vertical = PhysicalAxes(kPhysicalAxisVertical); + auto both = PhysicalAxes(kPhysicalAxisBoth); + auto none = PhysicalAxes(kPhysicalAxisNone); + + EXPECT_EQ(horizontal, QueriedAxes("(min-width: 1px)")); + EXPECT_EQ(horizontal, QueriedAxes("(max-width: 1px)")); + EXPECT_EQ(horizontal, QueriedAxes("(width: 1px)")); + + EXPECT_EQ(vertical, QueriedAxes("(min-height: 1px)")); + EXPECT_EQ(vertical, QueriedAxes("(max-height: 1px)")); + EXPECT_EQ(vertical, QueriedAxes("(height: 1px)")); + + EXPECT_EQ(both, QueriedAxes("(width: 1px) and (height: 1px)")); + EXPECT_EQ(both, QueriedAxes("(min-width: 1px) and (max-height: 1px)")); + + // TODO(crbug.com/1145970): We want to test the case where no axes are + // queried (kPhysicalAxisNone). This can (for now) be achieved by using + // some media query feature (e.g. "resolution"). Ultimately, using + // "resolution" will not be allowed in @container: we will then need to find + // another way to author a container query that queries no axes (or make it + // illegal altogether). + EXPECT_EQ(none, QueriedAxes("(resolution: 150dpi)")); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/counter_style.cc b/chromium/third_party/blink/renderer/core/css/counter_style.cc new file mode 100644 index 00000000000..b49e0fc43eb --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/counter_style.cc @@ -0,0 +1,686 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/counter_style.h" + +#include "third_party/blink/renderer/core/css/counter_style_map.h" +#include "third_party/blink/renderer/core/css/css_custom_ident_value.h" +#include "third_party/blink/renderer/core/css/css_identifier_value.h" +#include "third_party/blink/renderer/core/css/css_string_value.h" +#include "third_party/blink/renderer/core/css/css_value_list.h" +#include "third_party/blink/renderer/core/css/css_value_pair.h" +#include "third_party/blink/renderer/core/css/style_rule_counter_style.h" +#include "third_party/blink/renderer/core/css_value_keywords.h" +#include "third_party/blink/renderer/core/layout/list_marker_text.h" +#include "third_party/blink/renderer/platform/text/text_break_iterator.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" + +namespace blink { + +namespace { + +// User agents must support representations at least 60 Unicode codepoints long, +// but they may choose to instead use the fallback style for representations +// that would be longer than 60 codepoints. Since WTF::String may use UTF-16, we +// limit string length at 120. +const wtf_size_t kCounterLengthLimit = 120; + +bool HasSymbols(CounterStyleSystem system) { + switch (system) { + case CounterStyleSystem::kCyclic: + case CounterStyleSystem::kFixed: + case CounterStyleSystem::kSymbolic: + case CounterStyleSystem::kAlphabetic: + case CounterStyleSystem::kNumeric: + case CounterStyleSystem::kAdditive: + return true; + case CounterStyleSystem::kUnresolvedExtends: + case CounterStyleSystem::kHebrew: + case CounterStyleSystem::kSimpChineseInformal: + case CounterStyleSystem::kSimpChineseFormal: + case CounterStyleSystem::kTradChineseInformal: + case CounterStyleSystem::kTradChineseFormal: + case CounterStyleSystem::kKoreanHangulFormal: + case CounterStyleSystem::kKoreanHanjaInformal: + case CounterStyleSystem::kKoreanHanjaFormal: + case CounterStyleSystem::kLowerArmenian: + case CounterStyleSystem::kUpperArmenian: + case CounterStyleSystem::kEthiopicNumeric: + return false; + } +} + +String SymbolToString(const CSSValue& value) { + if (const CSSStringValue* string = DynamicTo(value)) + return string->Value(); + return To(value).Value(); +} + +std::pair BoundsToIntegerPair(const CSSValuePair& bounds) { + int lower_bound, upper_bound; + if (bounds.First().IsIdentifierValue()) { + DCHECK_EQ(CSSValueID::kInfinite, + To(bounds.First()).GetValueID()); + lower_bound = std::numeric_limits::min(); + } else { + DCHECK(bounds.First().IsPrimitiveValue()); + lower_bound = To(bounds.First()).GetIntValue(); + } + if (bounds.Second().IsIdentifierValue()) { + DCHECK_EQ(CSSValueID::kInfinite, + To(bounds.Second()).GetValueID()); + upper_bound = std::numeric_limits::max(); + } else { + DCHECK(bounds.Second().IsPrimitiveValue()); + upper_bound = To(bounds.Second()).GetIntValue(); + } + return std::make_pair(lower_bound, upper_bound); +} + +// https://drafts.csswg.org/css-counter-styles/#cyclic-system +Vector CyclicAlgorithm(int value, wtf_size_t num_symbols) { + DCHECK(num_symbols); + value %= static_cast(num_symbols); + value -= 1; + if (value < 0) + value += num_symbols; + return {value}; +} + +// https://drafts.csswg.org/css-counter-styles/#fixed-system +Vector FixedAlgorithm(int value, + int first_symbol_value, + wtf_size_t num_symbols) { + if (value < first_symbol_value || + static_cast(value - first_symbol_value) >= num_symbols) + return Vector(); + return {value - first_symbol_value}; +} + +// https://drafts.csswg.org/css-counter-styles/#symbolic-system +Vector SymbolicAlgorithm(unsigned value, wtf_size_t num_symbols) { + DCHECK(num_symbols); + if (!value) + return Vector(); + wtf_size_t index = (value - 1) % num_symbols; + wtf_size_t repetitions = (value + num_symbols - 1) / num_symbols; + if (repetitions > kCounterLengthLimit) + return Vector(); + return Vector(repetitions, index); +} + +// https://drafts.csswg.org/css-counter-styles/#alphabetic-system +Vector AlphabeticAlgorithm(unsigned value, wtf_size_t num_symbols) { + DCHECK(num_symbols); + if (!value) + return Vector(); + Vector result; + while (value) { + value -= 1; + result.push_back(value % num_symbols); + value /= num_symbols; + + // Since length is logarithmic to value, we won't exceed the length limit. + DCHECK_LE(result.size(), kCounterLengthLimit); + } + std::reverse(result.begin(), result.end()); + return result; +} + +// https://drafts.csswg.org/css-counter-styles/#numeric-system +Vector NumericAlgorithm(unsigned value, wtf_size_t num_symbols) { + DCHECK_GT(num_symbols, 1u); + if (!value) + return {0}; + + Vector result; + while (value) { + result.push_back(value % num_symbols); + value /= num_symbols; + + // Since length is logarithmic to value, we won't exceed the length limit. + DCHECK_LE(result.size(), kCounterLengthLimit); + } + std::reverse(result.begin(), result.end()); + return result; +} + +// https://drafts.csswg.org/css-counter-styles/#additive-system +Vector AdditiveAlgorithm(unsigned value, + const Vector& weights) { + DCHECK(weights.size()); + if (!value) { + if (weights.back() == 0u) + return {weights.size() - 1}; + return Vector(); + } + + Vector result; + for (wtf_size_t index = 0; value && index < weights.size() && weights[index]; + ++index) { + wtf_size_t repetitions = value / weights[index]; + if (repetitions) { + if (result.size() + repetitions > kCounterLengthLimit) + return Vector(); + result.AppendVector(Vector(repetitions, index)); + } + value %= weights[index]; + } + if (value) + return Vector(); + return result; +} + +// TODO(crbug.com/687225): After @counter-style is shipped and the legacy +// code paths are removed, remove everything else of list_marker_text and move +// the implementation of the special algorithms here. + +String HebrewAlgorithm(unsigned value) { + if (value > 999999) + return String(); + return list_marker_text::GetText(EListStyleType::kHebrew, value); +} + +int AbsoluteValueForLegacyCJKAlgorithms(int value) { + // @counter-style algorithm works on absolute value, but the legacy + // implementation works on the original value (and handles negative sign on + // its own). Clamp to the signed int range before proceeding. + if (UNLIKELY(value == std::numeric_limits::min())) + return std::numeric_limits::max(); + else + return std::abs(value); +} + +String SimpChineseInformalAlgorithm(int value) { + return list_marker_text::GetText(EListStyleType::kSimpChineseInformal, + AbsoluteValueForLegacyCJKAlgorithms(value)); +} + +String SimpChineseFormalAlgorithm(int value) { + return list_marker_text::GetText(EListStyleType::kSimpChineseFormal, + AbsoluteValueForLegacyCJKAlgorithms(value)); +} + +String TradChineseInformalAlgorithm(int value) { + return list_marker_text::GetText(EListStyleType::kTradChineseInformal, + AbsoluteValueForLegacyCJKAlgorithms(value)); +} + +String TradChineseFormalAlgorithm(int value) { + return list_marker_text::GetText(EListStyleType::kTradChineseFormal, + AbsoluteValueForLegacyCJKAlgorithms(value)); +} + +String KoreanHangulFormalAlgorithm(int value) { + return list_marker_text::GetText(EListStyleType::kKoreanHangulFormal, + AbsoluteValueForLegacyCJKAlgorithms(value)); +} + +String KoreanHanjaInformalAlgorithm(int value) { + return list_marker_text::GetText(EListStyleType::kKoreanHanjaInformal, + AbsoluteValueForLegacyCJKAlgorithms(value)); +} + +String KoreanHanjaFormalAlgorithm(int value) { + return list_marker_text::GetText(EListStyleType::kKoreanHanjaFormal, + AbsoluteValueForLegacyCJKAlgorithms(value)); +} + +String LowerArmenianAlgorithm(unsigned value) { + if (value > 99999999) + return String(); + return list_marker_text::GetText(EListStyleType::kLowerArmenian, value); +} + +String UpperArmenianAlgorithm(unsigned value) { + if (value > 99999999) + return String(); + return list_marker_text::GetText(EListStyleType::kUpperArmenian, value); +} + +// https://drafts.csswg.org/css-counter-styles-3/#ethiopic-numeric-counter-style +String EthiopicNumericAlgorithm(unsigned value) { + // Ethiopic characters for 1-9 + static const UChar units[9] = {0x1369, 0x136A, 0x136B, 0x136C, 0x136D, + 0x136E, 0x136F, 0x1370, 0x1371}; + // Ethiopic characters for 10, 20, ..., 90 + static const UChar tens[9] = {0x1372, 0x1373, 0x1374, 0x1375, 0x1376, + 0x1377, 0x1378, 0x1379, 0x137A}; + if (!value) + return String(); + if (value < 10u) + return String(&units[value - 1], 1); + + // Generate characters in the reversed ordering + Vector result; + for (bool odd_group = false; value; odd_group = !odd_group) { + unsigned group_value = value % 100; + value /= 100; + if (!odd_group) { + // This adds an extra character for group 0. We'll remove it in the end. + result.push_back(kEthiopicNumberTenThousandCharacter); + } else { + if (group_value) + result.push_back(kEthiopicNumberHundredCharacter); + } + bool most_significant_group = !value; + bool remove_digits = !group_value || + (group_value == 1 && most_significant_group) || + (group_value == 1 && odd_group); + if (!remove_digits) { + if (unsigned unit = group_value % 10) + result.push_back(units[unit - 1]); + if (unsigned ten = group_value / 10) + result.push_back(tens[ten - 1]); + } + } + + std::reverse(result.begin(), result.end()); + // Remove the extra character from group 0 + result.pop_back(); + return String(result.data(), result.size()); +} + +} // namespace + +// static +CounterStyle& CounterStyle::GetDecimal() { + DEFINE_STATIC_LOCAL( + Persistent, decimal, + (CounterStyleMap::GetUACounterStyleMap()->FindCounterStyleAcrossScopes( + "decimal"))); + DCHECK(decimal); + return *decimal; +} + +// static +CounterStyleSystem CounterStyle::ToCounterStyleSystemEnum( + const CSSValue* value) { + if (!value) + return CounterStyleSystem::kSymbolic; + + CSSValueID system_keyword; + if (const auto* id = DynamicTo(value)) { + system_keyword = id->GetValueID(); + } else { + // Either fixed or extends. + DCHECK(value->IsValuePair()); + const CSSValuePair* pair = To(value); + DCHECK(pair->First().IsIdentifierValue()); + system_keyword = To(pair->First()).GetValueID(); + } + + switch (system_keyword) { + case CSSValueID::kCyclic: + return CounterStyleSystem::kCyclic; + case CSSValueID::kFixed: + return CounterStyleSystem::kFixed; + case CSSValueID::kSymbolic: + return CounterStyleSystem::kSymbolic; + case CSSValueID::kAlphabetic: + return CounterStyleSystem::kAlphabetic; + case CSSValueID::kNumeric: + return CounterStyleSystem::kNumeric; + case CSSValueID::kAdditive: + return CounterStyleSystem::kAdditive; + case CSSValueID::kInternalHebrew: + return CounterStyleSystem::kHebrew; + case CSSValueID::kInternalSimpChineseInformal: + return CounterStyleSystem::kSimpChineseInformal; + case CSSValueID::kInternalSimpChineseFormal: + return CounterStyleSystem::kSimpChineseFormal; + case CSSValueID::kInternalTradChineseInformal: + return CounterStyleSystem::kTradChineseInformal; + case CSSValueID::kInternalTradChineseFormal: + return CounterStyleSystem::kTradChineseFormal; + case CSSValueID::kInternalKoreanHangulFormal: + return CounterStyleSystem::kKoreanHangulFormal; + case CSSValueID::kInternalKoreanHanjaInformal: + return CounterStyleSystem::kKoreanHanjaInformal; + case CSSValueID::kInternalKoreanHanjaFormal: + return CounterStyleSystem::kKoreanHanjaFormal; + case CSSValueID::kInternalLowerArmenian: + return CounterStyleSystem::kLowerArmenian; + case CSSValueID::kInternalUpperArmenian: + return CounterStyleSystem::kUpperArmenian; + case CSSValueID::kInternalEthiopicNumeric: + return CounterStyleSystem::kEthiopicNumeric; + case CSSValueID::kExtends: + return CounterStyleSystem::kUnresolvedExtends; + default: + NOTREACHED(); + return CounterStyleSystem::kSymbolic; + } +} + +CounterStyle::~CounterStyle() = default; + +AtomicString CounterStyle::GetName() const { + return style_rule_->GetName(); +} + +// static +CounterStyle* CounterStyle::Create(const StyleRuleCounterStyle& rule) { + if (!rule.HasValidSymbols()) + return nullptr; + + return MakeGarbageCollected(rule); +} + +CounterStyle::CounterStyle(const StyleRuleCounterStyle& rule) + : style_rule_(rule), style_rule_version_(rule.GetVersion()) { + if (const CSSValue* system = rule.GetSystem()) { + system_ = ToCounterStyleSystemEnum(system); + + if (system_ == CounterStyleSystem::kUnresolvedExtends) { + const auto& second = To(system)->Second(); + extends_name_ = To(second).Value(); + } else if (system_ == CounterStyleSystem::kFixed && system->IsValuePair()) { + const auto& second = To(system)->Second(); + first_symbol_value_ = To(second).GetIntValue(); + } + } + + if (const CSSValue* fallback = rule.GetFallback()) + fallback_name_ = To(fallback)->Value(); + + if (HasSymbols(system_)) { + if (system_ == CounterStyleSystem::kAdditive) { + for (const CSSValue* symbol : + To(*rule.GetAdditiveSymbols())) { + const auto& pair = To(*symbol); + additive_weights_.push_back( + To(pair.First()).GetIntValue()); + symbols_.push_back(SymbolToString(pair.Second())); + } + } else { + for (const CSSValue* symbol : To(*rule.GetSymbols())) + symbols_.push_back(SymbolToString(*symbol)); + } + } + + if (const CSSValue* negative = rule.GetNegative()) { + if (const CSSValuePair* pair = DynamicTo(negative)) { + negative_prefix_ = SymbolToString(pair->First()); + negative_suffix_ = SymbolToString(pair->Second()); + } else { + negative_prefix_ = SymbolToString(*negative); + } + } + + if (const CSSValue* pad = rule.GetPad()) { + const CSSValuePair& pair = To(*pad); + pad_length_ = To(pair.First()).GetIntValue(); + pad_symbol_ = SymbolToString(pair.Second()); + } + + if (const CSSValue* range = rule.GetRange()) { + if (range->IsIdentifierValue()) { + DCHECK_EQ(CSSValueID::kAuto, To(range)->GetValueID()); + // Empty |range_| already means 'auto'. + } else { + for (const CSSValue* bounds : To(*range)) + range_.push_back(BoundsToIntegerPair(To(*bounds))); + } + } + + if (const CSSValue* prefix = rule.GetPrefix()) + prefix_ = SymbolToString(*prefix); + if (const CSSValue* suffix = rule.GetSuffix()) + suffix_ = SymbolToString(*suffix); + + // TODO(crbug.com/1166766): Implement 'speak-as'. +} + +void CounterStyle::ResolveExtends(CounterStyle& extended) { + DCHECK_NE(extended.system_, CounterStyleSystem::kUnresolvedExtends); + extended_style_ = extended; + + system_ = extended.system_; + + if (system_ == CounterStyleSystem::kFixed) + first_symbol_value_ = extended.first_symbol_value_; + + if (!style_rule_->GetFallback()) { + fallback_name_ = extended.fallback_name_; + fallback_style_ = nullptr; + } + + symbols_ = extended.symbols_; + if (system_ == CounterStyleSystem::kAdditive) + additive_weights_ = extended.additive_weights_; + + if (!style_rule_->GetNegative()) { + negative_prefix_ = extended.negative_prefix_; + negative_suffix_ = extended.negative_suffix_; + } + + if (!style_rule_->GetPad()) { + pad_length_ = extended.pad_length_; + pad_symbol_ = extended.pad_symbol_; + } + + if (!style_rule_->GetRange()) + range_ = extended.range_; + + if (!style_rule_->GetPrefix()) + prefix_ = extended.prefix_; + if (!style_rule_->GetSuffix()) + suffix_ = extended.suffix_; + + // TODO(crbug.com/1166766): Implement 'speak-as'. +} + +bool CounterStyle::RangeContains(int value) const { + if (range_.size()) { + for (const auto& bounds : range_) { + if (value >= bounds.first && value <= bounds.second) + return true; + } + return false; + } + + // 'range' value is auto + switch (system_) { + case CounterStyleSystem::kCyclic: + case CounterStyleSystem::kNumeric: + case CounterStyleSystem::kFixed: + case CounterStyleSystem::kSimpChineseInformal: + case CounterStyleSystem::kSimpChineseFormal: + case CounterStyleSystem::kTradChineseInformal: + case CounterStyleSystem::kTradChineseFormal: + case CounterStyleSystem::kKoreanHangulFormal: + case CounterStyleSystem::kKoreanHanjaInformal: + case CounterStyleSystem::kKoreanHanjaFormal: + return true; + case CounterStyleSystem::kSymbolic: + case CounterStyleSystem::kAlphabetic: + case CounterStyleSystem::kEthiopicNumeric: + return value >= 1; + case CounterStyleSystem::kAdditive: + return value >= 0; + case CounterStyleSystem::kHebrew: + return value >= 0 && value <= 999999; + case CounterStyleSystem::kLowerArmenian: + case CounterStyleSystem::kUpperArmenian: + return value >= 0 && value <= 99999999; + case CounterStyleSystem::kUnresolvedExtends: + NOTREACHED(); + return false; + } +} + +bool CounterStyle::NeedsNegativeSign(int value) const { + if (value >= 0) + return false; + switch (system_) { + case CounterStyleSystem::kSymbolic: + case CounterStyleSystem::kAlphabetic: + case CounterStyleSystem::kNumeric: + case CounterStyleSystem::kAdditive: + case CounterStyleSystem::kHebrew: + case CounterStyleSystem::kSimpChineseInformal: + case CounterStyleSystem::kSimpChineseFormal: + case CounterStyleSystem::kTradChineseInformal: + case CounterStyleSystem::kTradChineseFormal: + case CounterStyleSystem::kKoreanHangulFormal: + case CounterStyleSystem::kKoreanHanjaInformal: + case CounterStyleSystem::kKoreanHanjaFormal: + case CounterStyleSystem::kLowerArmenian: + case CounterStyleSystem::kUpperArmenian: + case CounterStyleSystem::kEthiopicNumeric: + return true; + case CounterStyleSystem::kCyclic: + case CounterStyleSystem::kFixed: + return false; + case CounterStyleSystem::kUnresolvedExtends: + NOTREACHED(); + return false; + } +} + +String CounterStyle::GenerateFallbackRepresentation(int value) const { + if (is_in_fallback_) { + // We are in a fallback cycle. Use decimal instead. + return GetDecimal().GenerateRepresentation(value); + } + + base::AutoReset in_fallback_scope(&is_in_fallback_, true); + return fallback_style_->GenerateRepresentation(value); +} + +String CounterStyle::GenerateRepresentation(int value) const { + DCHECK(!IsDirty()); + + if (pad_length_ > kCounterLengthLimit) + return GenerateFallbackRepresentation(value); + + String initial_representation = GenerateInitialRepresentation(value); + if (initial_representation.IsNull()) + return GenerateFallbackRepresentation(value); + + wtf_size_t initial_length = NumGraphemeClusters(initial_representation); + + // TODO(crbug.com/687225): Spec requires us to further increment + // |initial_length| by the length of the negative sign, but no current + // implementation is doing that. For backward compatibility, we don't do that + // for now. See https://github.com/w3c/csswg-drafts/issues/5906 for details. + // + // if (NeedsNegativeSign(value)) { + // initial_length += NumGraphemeClusters(negative_prefix_); + // initial_length += NumGraphemeClusters(negative_suffix_); + // } + + wtf_size_t pad_copies = + pad_length_ > initial_length ? pad_length_ - initial_length : 0; + + StringBuilder result; + if (NeedsNegativeSign(value)) + result.Append(negative_prefix_); + for (wtf_size_t i = 0; i < pad_copies; ++i) + result.Append(pad_symbol_); + result.Append(initial_representation); + if (NeedsNegativeSign(value)) + result.Append(negative_suffix_); + return result.ToString(); +} + +String CounterStyle::GenerateInitialRepresentation(int value) const { + if (!RangeContains(value)) + return String(); + + unsigned abs_value = + value == std::numeric_limits::min() + ? static_cast(std::numeric_limits::max()) + 1u + : std::abs(value); + + switch (system_) { + case CounterStyleSystem::kCyclic: + return IndexesToString(CyclicAlgorithm(value, symbols_.size())); + case CounterStyleSystem::kFixed: + return IndexesToString( + FixedAlgorithm(value, first_symbol_value_, symbols_.size())); + case CounterStyleSystem::kNumeric: + return IndexesToString(NumericAlgorithm(abs_value, symbols_.size())); + case CounterStyleSystem::kSymbolic: + return IndexesToString(SymbolicAlgorithm(abs_value, symbols_.size())); + case CounterStyleSystem::kAlphabetic: + return IndexesToString(AlphabeticAlgorithm(abs_value, symbols_.size())); + case CounterStyleSystem::kAdditive: + return IndexesToString(AdditiveAlgorithm(abs_value, additive_weights_)); + case CounterStyleSystem::kHebrew: + return HebrewAlgorithm(abs_value); + case CounterStyleSystem::kSimpChineseInformal: + return SimpChineseInformalAlgorithm(value); + case CounterStyleSystem::kSimpChineseFormal: + return SimpChineseFormalAlgorithm(value); + case CounterStyleSystem::kTradChineseInformal: + return TradChineseInformalAlgorithm(value); + case CounterStyleSystem::kTradChineseFormal: + return TradChineseFormalAlgorithm(value); + case CounterStyleSystem::kKoreanHangulFormal: + return KoreanHangulFormalAlgorithm(value); + case CounterStyleSystem::kKoreanHanjaInformal: + return KoreanHanjaInformalAlgorithm(value); + case CounterStyleSystem::kKoreanHanjaFormal: + return KoreanHanjaFormalAlgorithm(value); + case CounterStyleSystem::kLowerArmenian: + return LowerArmenianAlgorithm(abs_value); + case CounterStyleSystem::kUpperArmenian: + return UpperArmenianAlgorithm(abs_value); + case CounterStyleSystem::kEthiopicNumeric: + return EthiopicNumericAlgorithm(abs_value); + case CounterStyleSystem::kUnresolvedExtends: + NOTREACHED(); + return String(); + } +} + +String CounterStyle::IndexesToString( + const Vector& symbol_indexes) const { + if (symbol_indexes.IsEmpty()) + return String(); + + StringBuilder result; + for (wtf_size_t index : symbol_indexes) + result.Append(symbols_[index]); + return result.ToString(); +} + +void CounterStyle::TraverseAndMarkDirtyIfNeeded( + HeapHashSet>& visited_counter_styles) { + if (IsPredefined() || visited_counter_styles.Contains(this)) + return; + visited_counter_styles.insert(this); + + if (has_inexistent_references_ || + style_rule_version_ != style_rule_->GetVersion()) { + SetIsDirty(); + return; + } + + if (extended_style_) { + extended_style_->TraverseAndMarkDirtyIfNeeded(visited_counter_styles); + if (extended_style_->IsDirty()) { + SetIsDirty(); + return; + } + } + + if (fallback_style_) { + fallback_style_->TraverseAndMarkDirtyIfNeeded(visited_counter_styles); + if (fallback_style_->IsDirty()) { + SetIsDirty(); + return; + } + } +} + +void CounterStyle::Trace(Visitor* visitor) const { + visitor->Trace(style_rule_); + visitor->Trace(extended_style_); + visitor->Trace(fallback_style_); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/counter_style.h b/chromium/third_party/blink/renderer/core/css/counter_style.h new file mode 100644 index 00000000000..7dc26c957f8 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/counter_style.h @@ -0,0 +1,169 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_COUNTER_STYLE_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_COUNTER_STYLE_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" + +namespace blink { + +class StyleRuleCounterStyle; +class CSSValue; + +enum class CounterStyleSystem { + kCyclic, + kFixed, + kSymbolic, + kAlphabetic, + kNumeric, + kAdditive, + kHebrew, + kSimpChineseInformal, + kSimpChineseFormal, + kTradChineseInformal, + kTradChineseFormal, + kKoreanHangulFormal, + kKoreanHanjaInformal, + kKoreanHanjaFormal, + kLowerArmenian, + kUpperArmenian, + kEthiopicNumeric, + kUnresolvedExtends, +}; + +// Represents a valid counter style defined in a tree scope. +class CORE_EXPORT CounterStyle final : public GarbageCollected { + public: + static CounterStyle& GetDecimal(); + + static CounterStyleSystem ToCounterStyleSystemEnum(const CSSValue* value); + + // Returns nullptr if the @counter-style rule is invalid. + static CounterStyle* Create(const StyleRuleCounterStyle&); + + const StyleRuleCounterStyle& GetStyleRule() const { return *style_rule_; } + + AtomicString GetName() const; + CounterStyleSystem GetSystem() const { return system_; } + + bool IsPredefined() const { return is_predefined_; } + void SetIsPredefined() { is_predefined_ = true; } + + // Returns true for the predefined symbolic counter styles 'disc', 'circle', + // 'square', 'disclosure-open' and 'disclosure-closed'. + bool IsPredefinedSymbolMarker() const { return is_predefined_symbol_marker_; } + void SetIsPredefinedSymbolMarker() { is_predefined_symbol_marker_ = true; } + + // A CounterStyle object is dirtied when the information it holds becomes + // stale, e.g., when the style rule mutated or the 'extends' or 'fallback' + // counter styles mutated, etc. Once dirtied, it will never be reused, and + // will be removed or replaced by a newly created clean CounterStyle. + // Elements using dirty CounterStyles should update style and layout. + bool IsDirty() const { return is_dirty_; } + void SetIsDirty() { is_dirty_ = true; } + + void TraverseAndMarkDirtyIfNeeded(HeapHashSet>& visited); + + // Set to true when there's no counter style matching 'extends' or 'fallback', + // and therefore we are resorting to 'decimal'. + void SetHasInexistentReferences() { has_inexistent_references_ = true; } + + // https://drafts.csswg.org/css-counter-styles/#generate-a-counter + String GenerateRepresentation(int value) const; + + String GetPrefix() const { return prefix_; } + String GetSuffix() const { return suffix_; } + + AtomicString GetExtendsName() const { return extends_name_; } + const CounterStyle& GetExtendedStyle() const { return *extended_style_; } + bool HasUnresolvedExtends() const { + return system_ == CounterStyleSystem::kUnresolvedExtends; + } + void ResolveExtends(CounterStyle& extended); + + AtomicString GetFallbackName() const { return fallback_name_; } + const CounterStyle& GetFallbackStyle() const { return *fallback_style_; } + bool HasUnresolvedFallback() const { return !fallback_style_; } + void ResolveFallback(CounterStyle& fallback) { fallback_style_ = &fallback; } + + void Trace(Visitor*) const; + + explicit CounterStyle(const StyleRuleCounterStyle& rule); + ~CounterStyle(); + + private: + // https://drafts.csswg.org/css-counter-styles/#counter-style-range + bool RangeContains(int value) const; + + // Returns true if a negative sign is needed for the value. + // https://drafts.csswg.org/css-counter-styles/#counter-style-negative + bool NeedsNegativeSign(int value) const; + + // https://drafts.csswg.org/css-counter-styles/#initial-representation-for-the-counter-value + // Returns nullptr if the counter value cannot be represented with the given + // 'system', 'range' and 'symbols'/'additive-symbols' descriptor values. + String GenerateInitialRepresentation(int value) const; + + // Uses the fallback counter style to generate a representation for the value. + // It may recurse, and if it enters a loop, it uses 'decimal' instead. + String GenerateFallbackRepresentation(int value) const; + + String IndexesToString(const Vector& symbol_indexes) const; + + // The corresponding style rule in CSS. + Member style_rule_; + + // Tracks mutations of |style_rule_|. + int style_rule_version_; + + // The actual system of the counter style with 'extends' resolved. The value + // is kUnresolvedExtends temporarily before the resolution. + CounterStyleSystem system_ = CounterStyleSystem::kSymbolic; + + AtomicString extends_name_; + Member extended_style_; + + AtomicString fallback_name_ = "decimal"; + Member fallback_style_; + + // True if we are looking for a fallback counter style to generate a counter + // value. Supports cycle detection in fallback. + mutable bool is_in_fallback_ = false; + + // Value of 'symbols' for non-additive systems; Or symbol values in + // 'additive-symbols' for the 'additive' system. + Vector symbols_; + + // Additive weights, for the 'additive' system only. + Vector additive_weights_; + + // Value of 'range' descriptor. Empty vector means 'auto'. + Vector> range_; + + String prefix_; + String suffix_ = ". "; + + String negative_prefix_ = "-"; + String negative_suffix_; + + String pad_symbol_; + wtf_size_t pad_length_ = 0; + + // First symbol value, for 'fixed' system only. + wtf_size_t first_symbol_value_ = 1; + + bool is_predefined_ = false; + bool is_predefined_symbol_marker_ = false; + bool has_inexistent_references_ = false; + bool is_dirty_ = false; + + friend class CounterStyleMapTest; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_COUNTER_STYLE_H_ diff --git a/chromium/third_party/blink/renderer/core/css/counter_style_map.cc b/chromium/third_party/blink/renderer/core/css/counter_style_map.cc new file mode 100644 index 00000000000..e1feebc435c --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/counter_style_map.cc @@ -0,0 +1,296 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/counter_style_map.h" + +#include "third_party/blink/renderer/core/css/css_default_style_sheets.h" +#include "third_party/blink/renderer/core/css/resolver/scoped_style_resolver.h" +#include "third_party/blink/renderer/core/css/rule_set.h" +#include "third_party/blink/renderer/core/css/style_engine.h" +#include "third_party/blink/renderer/core/css/style_rule_counter_style.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" + +namespace blink { + +namespace { + +const char* predefined_symbol_markers[] = { + "disc", "square", "circle", "disclosure-open", "disclosure-closed"}; + +CounterStyleMap* CreateUACounterStyleMap() { + CounterStyleMap* map = + MakeGarbageCollected(nullptr, nullptr); + map->AddCounterStyles(*CSSDefaultStyleSheets::Instance().DefaultStyle()); + map->SetIsPredefined(); + for (const char* symbol_marker : predefined_symbol_markers) { + map->FindCounterStyleAcrossScopes(symbol_marker) + ->SetIsPredefinedSymbolMarker(); + } + HeapHashSet> dummy_visited; + map->ResolveReferences(dummy_visited); + return map; +} + +} // namespace + +void CounterStyleMap::SetIsPredefined() { + for (CounterStyle* counter_style : counter_styles_.Values()) + counter_style->SetIsPredefined(); +} + +// static +CounterStyleMap* CounterStyleMap::GetUACounterStyleMap() { + DEFINE_STATIC_LOCAL(Persistent, ua_counter_style_map, + (CreateUACounterStyleMap())); + return ua_counter_style_map; +} + +// static +CounterStyleMap* CounterStyleMap::GetUserCounterStyleMap(Document& document) { + return document.GetStyleEngine().GetUserCounterStyleMap(); +} + +// static +CounterStyleMap* CounterStyleMap::GetAuthorCounterStyleMap( + const TreeScope& scope) { + if (!scope.GetScopedStyleResolver()) + return nullptr; + return scope.GetScopedStyleResolver()->GetCounterStyleMap(); +} + +// static +CounterStyleMap* CounterStyleMap::CreateUserCounterStyleMap( + Document& document) { + return MakeGarbageCollected(&document, nullptr); +} + +// static +CounterStyleMap* CounterStyleMap::CreateAuthorCounterStyleMap( + TreeScope& tree_scope) { + return MakeGarbageCollected(&tree_scope.GetDocument(), + &tree_scope); +} + +CounterStyleMap::CounterStyleMap(Document* document, TreeScope* tree_scope) + : owner_document_(document), tree_scope_(tree_scope) { +#if DCHECK_IS_ON() + if (tree_scope) + DCHECK_EQ(document, &tree_scope->GetDocument()); +#endif +} + +void CounterStyleMap::AddCounterStyles(const RuleSet& rule_set) { + if (!rule_set.CounterStyleRules().size()) + return; + + for (StyleRuleCounterStyle* rule : rule_set.CounterStyleRules()) { + CounterStyle* counter_style = CounterStyle::Create(*rule); + if (!counter_style) { + DCHECK(owner_document_) << "Predefined counter style " << rule->GetName() + << " has invalid symbols"; + continue; + } + AtomicString name = rule->GetName(); + if (CounterStyle* replaced = counter_styles_.at(name)) + replaced->SetIsDirty(); + counter_styles_.Set(rule->GetName(), counter_style); + } + + if (owner_document_) + owner_document_->GetStyleEngine().MarkCounterStylesNeedUpdate(); +} + +CounterStyleMap* CounterStyleMap::GetAncestorMap() const { + if (tree_scope_) { + // Resursively walk up to parent scope to find an author CounterStyleMap. + for (TreeScope* scope = tree_scope_->ParentTreeScope(); scope; + scope = scope->ParentTreeScope()) { + if (CounterStyleMap* map = GetAuthorCounterStyleMap(*scope)) + return map; + } + + // Fallback to user counter style map + if (CounterStyleMap* user_map = GetUserCounterStyleMap(*owner_document_)) + return user_map; + } + + // Author and user counter style maps fall back to UA + if (owner_document_) + return GetUACounterStyleMap(); + + // UA counter style map doesn't have any fallback + return nullptr; +} + +CounterStyle* CounterStyleMap::FindCounterStyleAcrossScopes( + const AtomicString& name) const { + if (CounterStyle* style = counter_styles_.at(name)) + return style; + + if (CounterStyleMap* ancestor_map = GetAncestorMap()) + return ancestor_map->FindCounterStyleAcrossScopes(name); + + return nullptr; +} + +void CounterStyleMap::ResolveExtendsFor(CounterStyle& counter_style) { + DCHECK(counter_style.HasUnresolvedExtends()); + + HeapVector, 2> extends_chain; + HeapHashSet> unresolved_styles; + extends_chain.push_back(&counter_style); + do { + unresolved_styles.insert(extends_chain.back()); + AtomicString extends_name = extends_chain.back()->GetExtendsName(); + extends_chain.push_back(FindCounterStyleAcrossScopes(extends_name)); + } while (extends_chain.back() && + extends_chain.back()->HasUnresolvedExtends() && + !unresolved_styles.Contains(extends_chain.back())); + + // If one or more @counter-style rules form a cycle with their extends values, + // all of the counter styles participating in the cycle must be treated as if + // they were extending the 'decimal' counter style instead. + if (extends_chain.back() && extends_chain.back()->HasUnresolvedExtends()) { + CounterStyle* cycle_start = extends_chain.back(); + do { + extends_chain.back()->ResolveExtends(CounterStyle::GetDecimal()); + extends_chain.pop_back(); + } while (extends_chain.back() != cycle_start); + } + + CounterStyle* next = extends_chain.back(); + while (extends_chain.size() > 1u) { + extends_chain.pop_back(); + if (next) { + extends_chain.back()->ResolveExtends(*next); + } else { + extends_chain.back()->ResolveExtends(CounterStyle::GetDecimal()); + extends_chain.back()->SetHasInexistentReferences(); + } + + next = extends_chain.back(); + } +} + +void CounterStyleMap::ResolveFallbackFor(CounterStyle& counter_style) { + DCHECK(counter_style.HasUnresolvedFallback()); + AtomicString fallback_name = counter_style.GetFallbackName(); + CounterStyle* fallback_style = FindCounterStyleAcrossScopes(fallback_name); + if (fallback_style) { + counter_style.ResolveFallback(*fallback_style); + } else { + counter_style.ResolveFallback(CounterStyle::GetDecimal()); + counter_style.SetHasInexistentReferences(); + } +} + +void CounterStyleMap::ResolveReferences( + HeapHashSet>& visited_maps) { + if (visited_maps.Contains(this)) + return; + visited_maps.insert(this); + + // References in ancestor scopes must be resolved first. + if (CounterStyleMap* ancestor_map = GetAncestorMap()) + ancestor_map->ResolveReferences(visited_maps); + + for (CounterStyle* counter_style : counter_styles_.Values()) { + if (counter_style->HasUnresolvedExtends()) + ResolveExtendsFor(*counter_style); + if (counter_style->HasUnresolvedFallback()) + ResolveFallbackFor(*counter_style); + } +} + +void CounterStyleMap::MarkDirtyCounterStyles( + HeapHashSet>& visited_counter_styles) { + for (CounterStyle* counter_style : counter_styles_.Values()) + counter_style->TraverseAndMarkDirtyIfNeeded(visited_counter_styles); + + // Replace dirty CounterStyles by clean ones with unresolved references. + for (Member& counter_style_ref : counter_styles_.Values()) { + if (counter_style_ref->IsDirty()) { + CounterStyle* clean_style = + MakeGarbageCollected(counter_style_ref->GetStyleRule()); + counter_style_ref = clean_style; + } + } +} + +// static +void CounterStyleMap::MarkAllDirtyCounterStyles( + Document& document, + const HeapHashSet>& active_tree_scopes) { + // Traverse all CounterStyle objects in the document to mark dirtiness. + // We assume that there are not too many CounterStyle objects, so this won't + // be a performance bottleneck. + TRACE_EVENT0("blink", "CounterStyleMap::MarkAllDirtyCounterStyles"); + + HeapHashSet> visited_counter_styles; + + if (CounterStyleMap* user_map = GetUserCounterStyleMap(document)) + user_map->MarkDirtyCounterStyles(visited_counter_styles); + + if (CounterStyleMap* document_map = GetAuthorCounterStyleMap(document)) + document_map->MarkDirtyCounterStyles(visited_counter_styles); + + for (const TreeScope* scope : active_tree_scopes) { + if (CounterStyleMap* scoped_map = GetAuthorCounterStyleMap(*scope)) + scoped_map->MarkDirtyCounterStyles(visited_counter_styles); + } +} + +// static +void CounterStyleMap::ResolveAllReferences( + Document& document, + const HeapHashSet>& active_tree_scopes) { + // Traverse all counter style maps to find and update CounterStyles that are + // dirty or have unresolved references. We assume there are not too many + // CounterStyles, so that this won't be a performance bottleneck. + TRACE_EVENT0("blink", "CounterStyleMap::ResolveAllReferences"); + + HeapHashSet> visited_maps; + visited_maps.insert(GetUACounterStyleMap()); + + if (CounterStyleMap* user_map = GetUserCounterStyleMap(document)) + user_map->ResolveReferences(visited_maps); + + if (CounterStyleMap* document_map = GetAuthorCounterStyleMap(document)) + document_map->ResolveReferences(visited_maps); + + for (const TreeScope* scope : active_tree_scopes) { + if (CounterStyleMap* scoped_map = GetAuthorCounterStyleMap(*scope)) { + scoped_map->ResolveReferences(visited_maps); + +#if DCHECK_IS_ON() + for (CounterStyle* counter_style : scoped_map->counter_styles_.Values()) { + DCHECK(!counter_style->IsDirty()); + DCHECK(!counter_style->HasUnresolvedExtends()); + DCHECK(!counter_style->HasUnresolvedFallback()); + } +#endif + } + } +} + +void CounterStyleMap::Dispose() { + if (!counter_styles_.size()) + return; + + for (CounterStyle* counter_style : counter_styles_.Values()) + counter_style->SetIsDirty(); + counter_styles_.clear(); + + if (owner_document_) + owner_document_->GetStyleEngine().MarkCounterStylesNeedUpdate(); +} + +void CounterStyleMap::Trace(Visitor* visitor) const { + visitor->Trace(owner_document_); + visitor->Trace(tree_scope_); + visitor->Trace(counter_styles_); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/counter_style_map.h b/chromium/third_party/blink/renderer/core/css/counter_style_map.h new file mode 100644 index 00000000000..f87ef85775e --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/counter_style_map.h @@ -0,0 +1,66 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_COUNTER_STYLE_MAP_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_COUNTER_STYLE_MAP_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/css/counter_style.h" +#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" +#include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h" + +namespace blink { + +class Document; +class TreeScope; +class CounterStyle; +class RuleSet; + +class CORE_EXPORT CounterStyleMap : public GarbageCollected { + public: + static CounterStyleMap* GetUACounterStyleMap(); + static CounterStyleMap* GetUserCounterStyleMap(Document&); + static CounterStyleMap* GetAuthorCounterStyleMap(const TreeScope&); + + static CounterStyleMap* CreateUserCounterStyleMap(Document&); + static CounterStyleMap* CreateAuthorCounterStyleMap(TreeScope&); + + CounterStyle* FindCounterStyleAcrossScopes(const AtomicString& name) const; + + void AddCounterStyles(const RuleSet&); + void SetIsPredefined(); + + void ResolveReferences(HeapHashSet>& resolved_maps); + static void ResolveAllReferences(Document&, + const HeapHashSet>&); + + void MarkDirtyCounterStyles(HeapHashSet>& visited); + static void MarkAllDirtyCounterStyles(Document&, + const HeapHashSet>&); + + void Dispose(); + + CounterStyleMap(Document* document, TreeScope* tree_scope); + void Trace(Visitor*) const; + + private: + CounterStyleMap* GetAncestorMap() const; + + void ResolveExtendsFor(CounterStyle&); + void ResolveFallbackFor(CounterStyle&); + + // Null means these are user-agent rules. + Member owner_document_; + + // Null tree scope and non-null document means these are user rules. + Member tree_scope_; + + HeapHashMap> counter_styles_; + + friend class CounterStyleMapTest; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_COUNTER_STYLE_MAP_H_ diff --git a/chromium/third_party/blink/renderer/core/css/counter_style_map_test.cc b/chromium/third_party/blink/renderer/core/css/counter_style_map_test.cc new file mode 100644 index 00000000000..fce0ed27fe0 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/counter_style_map_test.cc @@ -0,0 +1,204 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/counter_style_map.h" + +#include "third_party/blink/renderer/core/dom/element.h" +#include "third_party/blink/renderer/core/dom/shadow_root.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" +#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" + +namespace blink { + +class CounterStyleMapTest : public PageTestBase, + private ScopedCSSAtRuleCounterStyleForTest { + public: + CounterStyleMapTest() : ScopedCSSAtRuleCounterStyleForTest(true) {} + + ShadowRoot& AttachShadowTo(const char* host_id) { + Element* host = GetElementById(host_id); + return host->AttachShadowRootInternal(ShadowRootType::kOpen); + } + + const CounterStyle& GetCounterStyle(const TreeScope& scope, + const AtomicString& name) { + return *CounterStyleMap::GetAuthorCounterStyleMap(scope) + ->counter_styles_.at(name); + } +}; + +TEST_F(CounterStyleMapTest, ExtendsUAStyle) { + SetHtmlInnerHTML(R"HTML( + + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle(GetDocument(), "foo"); + EXPECT_EQ("disc", foo.GetExtendedStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, ExtendsAuthorStyle) { + SetHtmlInnerHTML(R"HTML( + + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& bar = GetCounterStyle(GetDocument(), "bar"); + EXPECT_EQ("foo", bar.GetExtendedStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, ExtendsParentScopeStyle) { + SetHtmlInnerHTML(R"HTML( + +
+ )HTML"); + ShadowRoot& shadow = AttachShadowTo("host"); + shadow.setInnerHTML( + ""); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& bar = GetCounterStyle(shadow, "bar"); + EXPECT_EQ("foo", bar.GetExtendedStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, ExtendsCyclic) { + // Cyclic extends resolve to 'decimal'. + SetHtmlInnerHTML(R"HTML( + + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle(GetDocument(), "foo"); + EXPECT_EQ("bar", foo.GetExtendedStyle().GetName()); + + const CounterStyle& bar = GetCounterStyle(GetDocument(), "bar"); + EXPECT_EQ("decimal", bar.GetExtendedStyle().GetName()); + + const CounterStyle& baz = GetCounterStyle(GetDocument(), "baz"); + EXPECT_EQ("decimal", baz.GetExtendedStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, ExtendsNonexistentStyle) { + // Extending non-existent style resolves to 'decimal'. + SetHtmlInnerHTML(R"HTML( + + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle(GetDocument(), "foo"); + EXPECT_EQ("bar", foo.GetExtendedStyle().GetName()); + + const CounterStyle& bar = GetCounterStyle(GetDocument(), "bar"); + EXPECT_EQ("decimal", bar.GetExtendedStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, FallbackToUAStyle) { + SetHtmlInnerHTML(R"HTML( + + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle(GetDocument(), "foo"); + EXPECT_EQ("disc", foo.GetFallbackStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, FallbackToAuthorStyle) { + SetHtmlInnerHTML(R"HTML( + + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& bar = GetCounterStyle(GetDocument(), "bar"); + EXPECT_EQ("foo", bar.GetFallbackStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, FallbackOnExtends) { + SetHtmlInnerHTML(R"HTML( + + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& bar = GetCounterStyle(GetDocument(), "bar"); + EXPECT_EQ("disc", bar.GetFallbackStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, FallbackCyclic) { + // Cyclic fallbacks are allowed. We break cycles when generating counter text. + SetHtmlInnerHTML(R"HTML( + + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle(GetDocument(), "foo"); + EXPECT_EQ("bar", foo.GetFallbackStyle().GetName()); + + const CounterStyle& bar = GetCounterStyle(GetDocument(), "bar"); + EXPECT_EQ("foo", bar.GetFallbackStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, FallbackToNonexistentStyle) { + // Fallback to non-existent style resolves to 'decimal'. + SetHtmlInnerHTML(R"HTML( + + )HTML"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle(GetDocument(), "foo"); + EXPECT_EQ("bar", foo.GetFallbackStyle().GetName()); + + const CounterStyle& bar = GetCounterStyle(GetDocument(), "bar"); + EXPECT_EQ("decimal", bar.GetFallbackStyle().GetName()); +} + +TEST_F(CounterStyleMapTest, UpdateReferencesInChildScope) { + SetHtmlInnerHTML(R"HTML( + +
+ )HTML"); + ShadowRoot& shadow = AttachShadowTo("host"); + shadow.setInnerHTML( + ""); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle(GetDocument(), "foo"); + const CounterStyle& bar = GetCounterStyle(shadow, "bar"); + EXPECT_EQ(&foo, &bar.GetExtendedStyle()); + + GetDocument().QuerySelector("style")->remove(); + UpdateAllLifecyclePhasesForTest(); + + // After counter style rule changes in the parent scope, the original + // CounterStyle for 'bar' in child scopes will be dirtied, and will be + // replaced by a new CounterStyle object. + EXPECT_TRUE(foo.IsDirty()); + EXPECT_TRUE(bar.IsDirty()); + + const CounterStyle& new_bar = GetCounterStyle(shadow, "bar"); + EXPECT_NE(&bar, &new_bar); + EXPECT_EQ("decimal", new_bar.GetExtendedStyle().GetName()); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/counter_style_test.cc b/chromium/third_party/blink/renderer/core/css/counter_style_test.cc new file mode 100644 index 00000000000..a7606551b2a --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/counter_style_test.cc @@ -0,0 +1,627 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/counter_style.h" + +#include "third_party/blink/renderer/core/css/counter_style_map.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/testing/page_test_base.h" +#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" + +namespace blink { + +class CounterStyleTest : public PageTestBase, + private ScopedCSSAtRuleCounterStyleForTest { + public: + CounterStyleTest() : ScopedCSSAtRuleCounterStyleForTest(true) {} + + protected: + const CounterStyle& GetCounterStyle(const AtomicString& name) { + if (const CounterStyleMap* document_map = + CounterStyleMap::GetAuthorCounterStyleMap(GetDocument())) + return *document_map->FindCounterStyleAcrossScopes(name); + return *CounterStyleMap::GetUACounterStyleMap() + ->FindCounterStyleAcrossScopes(name); + } + + const CounterStyle AddCounterStyle(const AtomicString& name, + const String& descriptors) { + StringBuilder declaration; + declaration.Append("@counter-style "); + declaration.Append(name); + declaration.Append("{"); + declaration.Append(descriptors); + declaration.Append("}"); + InsertStyleElement(declaration.ToString().Utf8()); + UpdateAllLifecyclePhasesForTest(); + return GetCounterStyle(name); + } +}; + +TEST_F(CounterStyleTest, NumericAlgorithm) { + const CounterStyle& decimal = GetCounterStyle("decimal"); + EXPECT_EQ("-123", decimal.GenerateRepresentation(-123)); + EXPECT_EQ("0", decimal.GenerateRepresentation(0)); + EXPECT_EQ("456", decimal.GenerateRepresentation(456)); +} + +TEST_F(CounterStyleTest, AdditiveAlgorithm) { + const CounterStyle& upper_roman = GetCounterStyle("upper-roman"); + EXPECT_EQ("I", upper_roman.GenerateRepresentation(1)); + EXPECT_EQ("CDXLIV", upper_roman.GenerateRepresentation(444)); + EXPECT_EQ("MMMCMXCIX", upper_roman.GenerateRepresentation(3999)); + + // Can't represent 0. Fallback to 'decimal'. + EXPECT_EQ("0", upper_roman.GenerateRepresentation(0)); +} + +TEST_F(CounterStyleTest, ExtendsAdditive) { + InsertStyleElement("@counter-style foo { system: extends upper-roman; }"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle("foo"); + EXPECT_EQ("I", foo.GenerateRepresentation(1)); + EXPECT_EQ("CDXLIV", foo.GenerateRepresentation(444)); + EXPECT_EQ("MMMCMXCIX", foo.GenerateRepresentation(3999)); + + // Can't represent 0. Fallback to 'decimal'. + EXPECT_EQ("0", foo.GenerateRepresentation(0)); +} + +TEST_F(CounterStyleTest, AdditiveLengthLimit) { + InsertStyleElement( + "@counter-style foo { system: additive; additive-symbols: 1 I; }"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle("foo"); + EXPECT_EQ("I", foo.GenerateRepresentation(1)); + EXPECT_EQ("II", foo.GenerateRepresentation(2)); + EXPECT_EQ("III", foo.GenerateRepresentation(3)); + + // Length limit exceeded. Fallback to 'decimal'. + EXPECT_EQ("1000000", foo.GenerateRepresentation(1000000)); +} + +TEST_F(CounterStyleTest, AdditiveWithZero) { + InsertStyleElement( + "@counter-style foo { system: additive; additive-symbols: 1 I, 0 O; }"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle("foo"); + EXPECT_EQ("O", foo.GenerateRepresentation(0)); + EXPECT_EQ("I", foo.GenerateRepresentation(1)); + EXPECT_EQ("II", foo.GenerateRepresentation(2)); + EXPECT_EQ("III", foo.GenerateRepresentation(3)); +} + +TEST_F(CounterStyleTest, AlphabeticAlgorithm) { + const CounterStyle& lower_alpha = GetCounterStyle("lower-alpha"); + EXPECT_EQ("a", lower_alpha.GenerateRepresentation(1)); + EXPECT_EQ("ab", lower_alpha.GenerateRepresentation(28)); + EXPECT_EQ("cab", lower_alpha.GenerateRepresentation(26 + 26 * 26 * 3 + 2)); +} + +TEST_F(CounterStyleTest, CyclicAlgorithm) { + InsertStyleElement("@counter-style foo { system: cyclic; symbols: A B C; }"); + UpdateAllLifecyclePhasesForTest(); + + const CounterStyle& foo = GetCounterStyle("foo"); + EXPECT_EQ(String("B"), foo.GenerateRepresentation(-100)); + EXPECT_EQ(String("B"), foo.GenerateRepresentation(-1)); + EXPECT_EQ(String("C"), foo.GenerateRepresentation(0)); + EXPECT_EQ(String("A"), foo.GenerateRepresentation(1)); + EXPECT_EQ(String("B"), foo.GenerateRepresentation(2)); + EXPECT_EQ(String("C"), foo.GenerateRepresentation(3)); + EXPECT_EQ(String("A"), foo.GenerateRepresentation(4)); + EXPECT_EQ(String("A"), foo.GenerateRepresentation(100)); +} + +TEST_F(CounterStyleTest, FixedAlgorithm) { + const CounterStyle& eb = GetCounterStyle("cjk-earthly-branch"); + EXPECT_EQ(String(u"\u5B50"), eb.GenerateRepresentation(1)); + EXPECT_EQ(String(u"\u4EA5"), eb.GenerateRepresentation(12)); + + // Fallback to decimal + EXPECT_EQ("-1", eb.GenerateRepresentation(-1)); + EXPECT_EQ("0", eb.GenerateRepresentation(0)); +} + +TEST_F(CounterStyleTest, SymbolicAlgorithm) { + InsertStyleElement(R"HTML( + @counter-style upper-alpha-legal { + system: symbolic; + symbols: A B C D E F G H I J K L M + N O P Q R S T U V W X Y Z; + } + )HTML"); + UpdateAllLifecyclePhasesForTest(); + const CounterStyle& legal = GetCounterStyle("upper-alpha-legal"); + + EXPECT_EQ("A", legal.GenerateRepresentation(1)); + EXPECT_EQ("BB", legal.GenerateRepresentation(28)); + EXPECT_EQ("CCC", legal.GenerateRepresentation(55)); + + // Length limit exceeded. Fallback to 'decimal'. + EXPECT_EQ("1000000", legal.GenerateRepresentation(1000000)); +} + +TEST_F(CounterStyleTest, CyclicFallback) { + InsertStyleElement(R"HTML( + @counter-style foo { + system: fixed; + symbols: A B; + fallback: bar; + } + + @counter-style bar { + system: fixed; + symbols: C D E F; + fallback: baz; + } + + @counter-style baz { + system: additive; + additive-symbols: 5 V; + fallback: foo; + } + )HTML"); + + UpdateAllLifecyclePhasesForTest(); + const CounterStyle& foo = GetCounterStyle("foo"); + const CounterStyle& bar = GetCounterStyle("bar"); + const CounterStyle& baz = GetCounterStyle("baz"); + + // foo -> bar + EXPECT_EQ("E", foo.GenerateRepresentation(3)); + + // bar -> baz + EXPECT_EQ("V", bar.GenerateRepresentation(5)); + + // baz -> foo + EXPECT_EQ("A", baz.GenerateRepresentation(1)); + + // baz -> foo -> bar + EXPECT_EQ("F", baz.GenerateRepresentation(4)); + + // foo -> bar -> baz -> foo. Break fallback cycle with 'decimal'. + EXPECT_EQ("6", foo.GenerateRepresentation(6)); +} + +TEST_F(CounterStyleTest, CustomNegative) { + InsertStyleElement(R"CSS( + @counter-style financial-decimal { + system: extends decimal; + negative: '(' ')'; + } + + @counter-style extended { + system: extends financial-decimal; + } + )CSS"); + UpdateAllLifecyclePhasesForTest(); + + // Getting custom 'negative' directly from descriptor value. + const CounterStyle& financial_decimal = GetCounterStyle("financial-decimal"); + EXPECT_EQ("(999)", financial_decimal.GenerateRepresentation(-999)); + EXPECT_EQ("(1)", financial_decimal.GenerateRepresentation(-1)); + EXPECT_EQ("0", financial_decimal.GenerateRepresentation(0)); + EXPECT_EQ("1", financial_decimal.GenerateRepresentation(1)); + EXPECT_EQ("99", financial_decimal.GenerateRepresentation(99)); + + // Getting custom 'negative' indirectly by extending a counter style. + const CounterStyle& extended = GetCounterStyle("extended"); + EXPECT_EQ("(999)", extended.GenerateRepresentation(-999)); + EXPECT_EQ("(1)", extended.GenerateRepresentation(-1)); + EXPECT_EQ("0", extended.GenerateRepresentation(0)); + EXPECT_EQ("1", extended.GenerateRepresentation(1)); + EXPECT_EQ("99", extended.GenerateRepresentation(99)); +} + +TEST_F(CounterStyleTest, CustomPad) { + InsertStyleElement(R"CSS( + @counter-style financial-decimal-pad { + system: extends decimal; + negative: '(' ')'; + pad: 4 '0'; + } + + @counter-style extended { + system: extends financial-decimal-pad; + } + )CSS"); + UpdateAllLifecyclePhasesForTest(); + + // Getting custom 'pad' directly from descriptor value. + const CounterStyle& financial_decimal_pad = + GetCounterStyle("financial-decimal-pad"); + EXPECT_EQ("(0099)", financial_decimal_pad.GenerateRepresentation(-99)); + EXPECT_EQ("(0001)", financial_decimal_pad.GenerateRepresentation(-1)); + EXPECT_EQ("0000", financial_decimal_pad.GenerateRepresentation(0)); + EXPECT_EQ("0001", financial_decimal_pad.GenerateRepresentation(1)); + EXPECT_EQ("0099", financial_decimal_pad.GenerateRepresentation(99)); + + // Getting custom 'pad' indirectly by extending a counter style. + const CounterStyle& extended = GetCounterStyle("extended"); + EXPECT_EQ("(0099)", extended.GenerateRepresentation(-99)); + EXPECT_EQ("(0001)", extended.GenerateRepresentation(-1)); + EXPECT_EQ("0000", extended.GenerateRepresentation(0)); + EXPECT_EQ("0001", extended.GenerateRepresentation(1)); + EXPECT_EQ("0099", extended.GenerateRepresentation(99)); +} + +TEST_F(CounterStyleTest, PadLengthLimit) { + InsertStyleElement(R"CSS( + @counter-style foo { + system: extends decimal; + pad: 1000 '0'; + } + )CSS"); + UpdateAllLifecyclePhasesForTest(); + + // Pad length is too long. Fallback to 'decimal'. + const CounterStyle& foo = GetCounterStyle("foo"); + EXPECT_EQ("0", foo.GenerateRepresentation(0)); +} + +TEST_F(CounterStyleTest, SymbolicWithExtendedRange) { + InsertStyleElement(R"CSS( + @counter-style base { + system: symbolic; + symbols: A B; + } + + @counter-style custom { + system: extends base; + range: infinite -2, 0 infinite; + } + + @counter-style extended { + system: extends custom; + } + )CSS"); + UpdateAllLifecyclePhasesForTest(); + + // Getting custom 'range' directly from descriptor value. + const CounterStyle& custom = GetCounterStyle("custom"); + EXPECT_EQ("-AA", custom.GenerateRepresentation(-3)); + EXPECT_EQ("-B", custom.GenerateRepresentation(-2)); + // -1 is out of 'range' value. Fallback to 'decimal' + EXPECT_EQ("-1", custom.GenerateRepresentation(-1)); + // 0 is within 'range' but not representable. Fallback to 'decimal'. + EXPECT_EQ("0", custom.GenerateRepresentation(0)); + EXPECT_EQ("A", custom.GenerateRepresentation(1)); + + // Getting custom 'range' indirectly by extending a counter style. + const CounterStyle& extended = GetCounterStyle("extended"); + EXPECT_EQ("-AA", extended.GenerateRepresentation(-3)); + EXPECT_EQ("-B", extended.GenerateRepresentation(-2)); + EXPECT_EQ("-1", extended.GenerateRepresentation(-1)); + EXPECT_EQ("0", extended.GenerateRepresentation(0)); + EXPECT_EQ("A", extended.GenerateRepresentation(1)); +} + +TEST_F(CounterStyleTest, AdditiveWithExtendedRange) { + InsertStyleElement(R"CSS( + @counter-style base { + system: additive; + additive-symbols: 2 B, 1 A; + } + + @counter-style custom { + system: extends base; + range: infinite -2, 0 infinite; + } + + @counter-style extended { + system: extends custom; + } + )CSS"); + UpdateAllLifecyclePhasesForTest(); + + // Getting custom 'range' directly from descriptor value. + const CounterStyle& custom = GetCounterStyle("custom"); + EXPECT_EQ("-BA", custom.GenerateRepresentation(-3)); + EXPECT_EQ("-B", custom.GenerateRepresentation(-2)); + // -1 is out of 'range' value. Fallback to 'decimal'. + EXPECT_EQ("-1", custom.GenerateRepresentation(-1)); + // 0 is within 'range' but not representable. Fallback to 'decimal'. + EXPECT_EQ("0", custom.GenerateRepresentation(0)); + EXPECT_EQ("A", custom.GenerateRepresentation(1)); + + // Getting custom 'range' indirectly by extending a counter style. + const CounterStyle& extended = GetCounterStyle("extended"); + EXPECT_EQ("-BA", extended.GenerateRepresentation(-3)); + EXPECT_EQ("-B", extended.GenerateRepresentation(-2)); + EXPECT_EQ("-1", extended.GenerateRepresentation(-1)); + EXPECT_EQ("0", extended.GenerateRepresentation(0)); + EXPECT_EQ("A", extended.GenerateRepresentation(1)); +} + +TEST_F(CounterStyleTest, CustomFirstSymbolValue) { + InsertStyleElement(R"CSS( + @counter-style base { + system: fixed 2; + symbols: A B C; + } + + @counter-style extended { + system: extends base; + } + )CSS"); + UpdateAllLifecyclePhasesForTest(); + + // Getting custom first symbol value directly from descriptor value. + const CounterStyle& base = GetCounterStyle("base"); + EXPECT_EQ("1", base.GenerateRepresentation(1)); + EXPECT_EQ("A", base.GenerateRepresentation(2)); + EXPECT_EQ("B", base.GenerateRepresentation(3)); + EXPECT_EQ("C", base.GenerateRepresentation(4)); + EXPECT_EQ("5", base.GenerateRepresentation(5)); + + // Getting custom first symbol value indirectly using 'extends'. + const CounterStyle& extended = GetCounterStyle("extended"); + EXPECT_EQ("1", extended.GenerateRepresentation(1)); + EXPECT_EQ("A", extended.GenerateRepresentation(2)); + EXPECT_EQ("B", extended.GenerateRepresentation(3)); + EXPECT_EQ("C", extended.GenerateRepresentation(4)); + EXPECT_EQ("5", extended.GenerateRepresentation(5)); +} + +TEST_F(CounterStyleTest, ExtremeValuesCyclic) { + const CounterStyle& cyclic = + AddCounterStyle("cyclic", "system: cyclic; symbols: A B C;"); + EXPECT_EQ("A", + cyclic.GenerateRepresentation(std::numeric_limits::min())); + EXPECT_EQ("A", + cyclic.GenerateRepresentation(std::numeric_limits::max())); +} + +TEST_F(CounterStyleTest, ExtremeValuesNumeric) { + const CounterStyle& numeric = + AddCounterStyle("numeric", + "system: numeric; symbols: '0' '1' '2' '3' '4' '5' '6' " + "'7' '8' '9' A B C D E F"); + EXPECT_EQ("-80000000", + numeric.GenerateRepresentation(std::numeric_limits::min())); + EXPECT_EQ("7FFFFFFF", + numeric.GenerateRepresentation(std::numeric_limits::max())); +} + +TEST_F(CounterStyleTest, ExtremeValuesAlphabetic) { + const CounterStyle& alphabetic = AddCounterStyle( + "alphabetic", + "system: alphabetic; symbols: A B C; range: infinite infinite;"); + EXPECT_EQ("-ABAABABBBAACCCACACCB", + alphabetic.GenerateRepresentation(std::numeric_limits::min())); + EXPECT_EQ("ABAABABBBAACCCACACCA", + alphabetic.GenerateRepresentation(std::numeric_limits::max())); +} + +TEST_F(CounterStyleTest, ExtremeValuesAdditive) { + const CounterStyle& additive = + AddCounterStyle("additive", + "system: additive; range: infinite infinite;" + "additive-symbols: 2000000000 '2B'," + " 100000000 '1CM'," + " 40000000 '4DM'," + " 7000000 '7M'," + " 400000 '4CK'," + " 80000 '8DK'," + " 3000 '3K'," + " 600 '6C'," + " 40 '4D'," + " 8 '8I'," + " 7 '7I';"); + EXPECT_EQ("-2B1CM4DM7M4CK8DK3K6C4D8I", + additive.GenerateRepresentation(std::numeric_limits::min())); + EXPECT_EQ("2B1CM4DM7M4CK8DK3K6C4D7I", + additive.GenerateRepresentation(std::numeric_limits::max())); +} + +TEST_F(CounterStyleTest, ExtremeValuesSymbolic) { + // No symbolic counter style can possibly represent such large values without + // exceeding the length limit. Always fallbacks to 'decimal'. + const CounterStyle& symbolic = AddCounterStyle( + "symbolic", + "system: symbolic; symbols: A B C; range: infinite infinite;"); + EXPECT_EQ("-2147483648", + symbolic.GenerateRepresentation(std::numeric_limits::min())); + EXPECT_EQ("2147483647", + symbolic.GenerateRepresentation(std::numeric_limits::max())); +} + +TEST_F(CounterStyleTest, ExtremeValuesFixed) { + const CounterStyle& fixed = + AddCounterStyle("fixed", "system: fixed 2147483646; symbols: A B C D;"); + // An int subtraction would overflow and return 2 as the result. + EXPECT_EQ("-2147483648", + fixed.GenerateRepresentation(std::numeric_limits::min())); + EXPECT_EQ("B", fixed.GenerateRepresentation(std::numeric_limits::max())); +} + +TEST_F(CounterStyleTest, PrefixAndSuffix) { + const CounterStyle& base = AddCounterStyle( + "base", "system: symbolic; symbols: A; prefix: X; suffix: Y;"); + EXPECT_EQ("X", base.GetPrefix()); + EXPECT_EQ("Y", base.GetSuffix()); + + const CounterStyle& extended = + AddCounterStyle("extended", "system: extends base"); + EXPECT_EQ("X", extended.GetPrefix()); + EXPECT_EQ("Y", extended.GetSuffix()); +} + +TEST_F(CounterStyleTest, Hebrew) { + // Verifies that our 'hebrew' implementation matches the spec in the + // officially specified range 1-10999. + // https://drafts.csswg.org/css-counter-styles-3/#hebrew + const CounterStyle& hebrew_as_specced = + AddCounterStyle("hebrew-as-specced", R"CSS( + system: additive; + range: 1 10999; + additive-symbols: 10000 \5D9\5F3, 9000 \5D8\5F3, 8000 \5D7\5F3, 7000 \5D6\5F3, 6000 \5D5\5F3, 5000 \5D4\5F3, 4000 \5D3\5F3, 3000 \5D2\5F3, 2000 \5D1\5F3, 1000 \5D0\5F3, 400 \5EA, 300 \5E9, 200 \5E8, 100 \5E7, 90 \5E6, 80 \5E4, 70 \5E2, 60 \5E1, 50 \5E0, 40 \5DE, 30 \5DC, 20 \5DB, 19 \5D9\5D8, 18 \5D9\5D7, 17 \5D9\5D6, 16 \5D8\5D6, 15 \5D8\5D5, 10 \5D9, 9 \5D8, 8 \5D7, 7 \5D6, 6 \5D5, 5 \5D4, 4 \5D3, 3 \5D2, 2 \5D1, 1 \5D0; + )CSS"); + const CounterStyle& hebrew_as_implemented = GetCounterStyle("hebrew"); + for (int value = 1; value <= 10999; ++value) { + String expected = hebrew_as_specced.GenerateRepresentation(value); + String actual = hebrew_as_implemented.GenerateRepresentation(value); + EXPECT_EQ(expected, actual); + } +} + +TEST_F(CounterStyleTest, LowerArmenian) { + // Verifies that our 'lower-armenian' implementation matches the spec in the + // officially specified range 1-9999. + // https://drafts.csswg.org/css-counter-styles-3/#valdef-counter-style-name-lower-armenian + const CounterStyle& lower_armenian_as_specced = + AddCounterStyle("lower-armenian-as-specced", R"CSS( + system: additive; + range: 1 9999; + additive-symbols: 9000 "\584", 8000 "\583", 7000 "\582", 6000 "\581", 5000 "\580", 4000 "\57F", 3000 "\57E", 2000 "\57D", 1000 "\57C", 900 "\57B", 800 "\57A", 700 "\579", 600 "\578", 500 "\577", 400 "\576", 300 "\575", 200 "\574", 100 "\573", 90 "\572", 80 "\571", 70 "\570", 60 "\56F", 50 "\56E", 40 "\56D", 30 "\56C", 20 "\56B", 10 "\56A", 9 "\569", 8 "\568", 7 "\567", 6 "\566", 5 "\565", 4 "\564", 3 "\563", 2 "\562", 1 "\561"; + )CSS"); + const CounterStyle& lower_armenian_as_implemented = + GetCounterStyle("lower-armenian"); + for (int value = 1; value <= 9999; ++value) { + String expected = lower_armenian_as_specced.GenerateRepresentation(value); + String actual = lower_armenian_as_implemented.GenerateRepresentation(value); + EXPECT_EQ(expected, actual); + } +} + +TEST_F(CounterStyleTest, UpperArmenian) { + // Verifies that our 'upper-armenian' implementation matches the spec in the + // officially specified range 1-9999. + // https://drafts.csswg.org/css-counter-styles-3/#valdef-counter-style-name-upper-armenian + const CounterStyle& upper_armenian_as_specced = + AddCounterStyle("upper-armenian-as-specced", R"CSS( + system: additive; + range: 1 9999; + additive-symbols: 9000 \554, 8000 \553, 7000 \552, 6000 \551, 5000 \550, 4000 \54F, 3000 \54E, 2000 \54D, 1000 \54C, 900 \54B, 800 \54A, 700 \549, 600 \548, 500 \547, 400 \546, 300 \545, 200 \544, 100 \543, 90 \542, 80 \541, 70 \540, 60 \53F, 50 \53E, 40 \53D, 30 \53C, 20 \53B, 10 \53A, 9 \539, 8 \538, 7 \537, 6 \536, 5 \535, 4 \534, 3 \533, 2 \532, 1 \531; + )CSS"); + const CounterStyle& upper_armenian_as_implemented = + GetCounterStyle("upper-armenian"); + for (int value = 1; value <= 9999; ++value) { + String expected = upper_armenian_as_specced.GenerateRepresentation(value); + String actual = upper_armenian_as_implemented.GenerateRepresentation(value); + EXPECT_EQ(expected, actual); + } +} + +TEST_F(CounterStyleTest, KoreanHangulFormal) { + // Verifies that our 'korean-hangul-formal' implementation matches the spec in + // the officially specified range 1-9999. + // https://drafts.csswg.org/css-counter-styles-3/#korean-hangul-formal + const CounterStyle& korean_hangul_formal_as_specced = + AddCounterStyle("korean-hangul-formal-as-specced", R"CSS( + system: additive; + range: -9999 9999; + additive-symbols: 9000 \AD6C\CC9C, 8000 \D314\CC9C, 7000 \CE60\CC9C, 6000 \C721\CC9C, 5000 \C624\CC9C, 4000 \C0AC\CC9C, 3000 \C0BC\CC9C, 2000 \C774\CC9C, 1000 \C77C\CC9C, 900 \AD6C\BC31, 800 \D314\BC31, 700 \CE60\BC31, 600 \C721\BC31, 500 \C624\BC31, 400 \C0AC\BC31, 300 \C0BC\BC31, 200 \C774\BC31, 100 \C77C\BC31, 90 \AD6C\C2ED, 80 \D314\C2ED, 70 \CE60\C2ED, 60 \C721\C2ED, 50 \C624\C2ED, 40 \C0AC\C2ED, 30 \C0BC\C2ED, 20 \C774\C2ED, 10 \C77C\C2ED, 9 \AD6C, 8 \D314, 7 \CE60, 6 \C721, 5 \C624, 4 \C0AC, 3 \C0BC, 2 \C774, 1 \C77C, 0 \C601; + negative: "\B9C8\C774\B108\C2A4 "; + )CSS"); + const CounterStyle& korean_hangul_formal_as_implemented = + GetCounterStyle("korean-hangul-formal"); + for (int value = -9999; value <= 9999; ++value) { + String expected = + korean_hangul_formal_as_specced.GenerateRepresentation(value); + String actual = + korean_hangul_formal_as_implemented.GenerateRepresentation(value); + EXPECT_EQ(expected, actual); + } +} + +TEST_F(CounterStyleTest, KoreanHanjaFormal) { + // Verifies that our 'korean-hanja-formal' implementation matches the spec in + // the officially specified range 1-9999. + // https://drafts.csswg.org/css-counter-styles-3/#korean-hanja-formal + const CounterStyle& korean_hanja_formal_as_specced = + AddCounterStyle("korean-hanja-formal-as-specced", R"CSS( + system: additive; + range: -9999 9999; + additive-symbols: 9000 \4E5D\4EDF, 8000 \516B\4EDF, 7000 \4E03\4EDF, 6000 \516D\4EDF, 5000 \4E94\4EDF, 4000 \56DB\4EDF, 3000 \53C3\4EDF, 2000 \8CB3\4EDF, 1000 \58F9\4EDF, 900 \4E5D\767E, 800 \516B\767E, 700 \4E03\767E, 600 \516D\767E, 500 \4E94\767E, 400 \56DB\767E, 300 \53C3\767E, 200 \8CB3\767E, 100 \58F9\767E, 90 \4E5D\62FE, 80 \516B\62FE, 70 \4E03\62FE, 60 \516D\62FE, 50 \4E94\62FE, 40 \56DB\62FE, 30 \53C3\62FE, 20 \8CB3\62FE, 10 \58F9\62FE, 9 \4E5D, 8 \516B, 7 \4E03, 6 \516D, 5 \4E94, 4 \56DB, 3 \53C3, 2 \8CB3, 1 \58F9, 0 \96F6; + negative: "\B9C8\C774\B108\C2A4 "; + )CSS"); + const CounterStyle& korean_hanja_formal_as_implemented = + GetCounterStyle("korean-hanja-formal"); + for (int value = -9999; value <= 9999; ++value) { + String expected = + korean_hanja_formal_as_specced.GenerateRepresentation(value); + String actual = + korean_hanja_formal_as_implemented.GenerateRepresentation(value); + EXPECT_EQ(expected, actual); + } +} + +TEST_F(CounterStyleTest, KoreanHanjaInformal) { + // Verifies that our 'korean-hanja-informal' implementation matches the spec + // in the officially specified range 1-9999. + // https://drafts.csswg.org/css-counter-styles-3/#korean-hanja-informal + const CounterStyle& korean_hanja_informal_as_specced = + AddCounterStyle("korean-hanja-informal-as-specced", R"CSS( + system: additive; + range: -9999 9999; + additive-symbols: 9000 \4E5D\5343, 8000 \516B\5343, 7000 \4E03\5343, 6000 \516D\5343, 5000 \4E94\5343, 4000 \56DB\5343, 3000 \4E09\5343, 2000 \4E8C\5343, 1000 \5343, 900 \4E5D\767E, 800 \516B\767E, 700 \4E03\767E, 600 \516D\767E, 500 \4E94\767E, 400 \56DB\767E, 300 \4E09\767E, 200 \4E8C\767E, 100 \767E, 90 \4E5D\5341, 80 \516B\5341, 70 \4E03\5341, 60 \516D\5341, 50 \4E94\5341, 40 \56DB\5341, 30 \4E09\5341, 20 \4E8C\5341, 10 \5341, 9 \4E5D, 8 \516B, 7 \4E03, 6 \516D, 5 \4E94, 4 \56DB, 3 \4E09, 2 \4E8C, 1 \4E00, 0 \96F6; + negative: "\B9C8\C774\B108\C2A4 "; + )CSS"); + const CounterStyle& korean_hanja_informal_as_implemented = + GetCounterStyle("korean-hanja-informal"); + for (int value = -9999; value <= 9999; ++value) { + String expected = + korean_hanja_informal_as_specced.GenerateRepresentation(value); + String actual = + korean_hanja_informal_as_implemented.GenerateRepresentation(value); + EXPECT_EQ(expected, actual); + } +} + +TEST_F(CounterStyleTest, EthiopicNumeric) { + const CounterStyle& style = GetCounterStyle("ethiopic-numeric"); + EXPECT_EQ(String(u"\u1369"), style.GenerateRepresentation(1)); + EXPECT_EQ(String(u"\u136A"), style.GenerateRepresentation(2)); + EXPECT_EQ(String(u"\u136B"), style.GenerateRepresentation(3)); + EXPECT_EQ(String(u"\u136C"), style.GenerateRepresentation(4)); + EXPECT_EQ(String(u"\u136D"), style.GenerateRepresentation(5)); + EXPECT_EQ(String(u"\u136E"), style.GenerateRepresentation(6)); + EXPECT_EQ(String(u"\u136F"), style.GenerateRepresentation(7)); + EXPECT_EQ(String(u"\u1370"), style.GenerateRepresentation(8)); + EXPECT_EQ(String(u"\u1371"), style.GenerateRepresentation(9)); + EXPECT_EQ(String(u"\u1372"), style.GenerateRepresentation(10)); + EXPECT_EQ(String(u"\u1372\u1369"), style.GenerateRepresentation(11)); + EXPECT_EQ(String(u"\u1372\u136A"), style.GenerateRepresentation(12)); + EXPECT_EQ(String(u"\u1375\u136B"), style.GenerateRepresentation(43)); + EXPECT_EQ(String(u"\u1378\u136F"), style.GenerateRepresentation(77)); + EXPECT_EQ(String(u"\u1379"), style.GenerateRepresentation(80)); + EXPECT_EQ(String(u"\u137A\u1371"), style.GenerateRepresentation(99)); + EXPECT_EQ(String(u"\u137B"), style.GenerateRepresentation(100)); + EXPECT_EQ(String(u"\u137B\u1369"), style.GenerateRepresentation(101)); + EXPECT_EQ(String(u"\u136A\u137B\u1373\u136A"), + style.GenerateRepresentation(222)); + EXPECT_EQ(String(u"\u136D\u137B\u1375"), style.GenerateRepresentation(540)); + EXPECT_EQ(String(u"\u1371\u137B\u137A\u1371"), + style.GenerateRepresentation(999)); + EXPECT_EQ(String(u"\u1372\u137B"), style.GenerateRepresentation(1000)); + EXPECT_EQ(String(u"\u1372\u137B\u136D"), style.GenerateRepresentation(1005)); + EXPECT_EQ(String(u"\u1372\u137B\u1377"), style.GenerateRepresentation(1060)); + EXPECT_EQ(String(u"\u1372\u137B\u1377\u136D"), + style.GenerateRepresentation(1065)); + EXPECT_EQ(String(u"\u1372\u1370\u137B"), style.GenerateRepresentation(1800)); + EXPECT_EQ(String(u"\u1372\u1370\u137B\u1377"), + style.GenerateRepresentation(1860)); + EXPECT_EQ(String(u"\u1372\u1370\u137B\u1377\u136D"), + style.GenerateRepresentation(1865)); + EXPECT_EQ(String(u"\u1376\u1370\u137B\u1377\u136D"), + style.GenerateRepresentation(5865)); + EXPECT_EQ(String(u"\u1378\u137B\u136D"), style.GenerateRepresentation(7005)); + EXPECT_EQ(String(u"\u1378\u1370\u137B"), style.GenerateRepresentation(7800)); + EXPECT_EQ(String(u"\u1378\u1370\u137B\u1377\u136C"), + style.GenerateRepresentation(7864)); + EXPECT_EQ(String(u"\u137A\u1371\u137B\u137A\u1371"), + style.GenerateRepresentation(9999)); + EXPECT_EQ(String(u"\u137C"), style.GenerateRepresentation(10000)); + EXPECT_EQ(String(u"\u1378\u1370\u137B\u1369\u137C\u137A\u136A"), + style.GenerateRepresentation(78010092)); + EXPECT_EQ(String(u"\u137B\u137C\u1369"), + style.GenerateRepresentation(1000001)); +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.cc b/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.cc index a76ffa78c50..f2dfadd8e85 100644 --- a/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.cc +++ b/chromium/third_party/blink/renderer/core/css/css_computed_style_declaration.cc @@ -38,6 +38,8 @@ #include "third_party/blink/renderer/core/css/style_engine.h" #include "third_party/blink/renderer/core/css/zoom_adjusted_pixel_value.h" #include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/dom/flat_tree_traversal.h" +#include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/dom/pseudo_element.h" #include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/html/html_frame_owner_element.h" @@ -46,6 +48,7 @@ #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" +#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { @@ -78,6 +81,7 @@ const CSSPropertyID kComputedPropertyArray[] = { CSSPropertyID::kBorderBottomLeftRadius, CSSPropertyID::kBorderBottomRightRadius, CSSPropertyID::kBorderBottomStyle, CSSPropertyID::kBorderBottomWidth, CSSPropertyID::kBorderCollapse, + CSSPropertyID::kBorderEndEndRadius, CSSPropertyID::kBorderEndStartRadius, CSSPropertyID::kBorderImageOutset, CSSPropertyID::kBorderImageRepeat, CSSPropertyID::kBorderImageSlice, CSSPropertyID::kBorderImageSource, CSSPropertyID::kBorderImageWidth, CSSPropertyID::kBorderInlineEndColor, @@ -87,7 +91,8 @@ const CSSPropertyID kComputedPropertyArray[] = { CSSPropertyID::kBorderInlineStartWidth, CSSPropertyID::kBorderLeftColor, CSSPropertyID::kBorderLeftStyle, CSSPropertyID::kBorderLeftWidth, CSSPropertyID::kBorderRightColor, CSSPropertyID::kBorderRightStyle, - CSSPropertyID::kBorderRightWidth, CSSPropertyID::kBorderTopColor, + CSSPropertyID::kBorderRightWidth, CSSPropertyID::kBorderStartEndRadius, + CSSPropertyID::kBorderStartStartRadius, CSSPropertyID::kBorderTopColor, CSSPropertyID::kBorderTopLeftRadius, CSSPropertyID::kBorderTopRightRadius, CSSPropertyID::kBorderTopStyle, CSSPropertyID::kBorderTopWidth, CSSPropertyID::kBottom, CSSPropertyID::kBoxShadow, @@ -251,6 +256,21 @@ void LogUnimplementedPropertyID(const CSSProperty& property) { << property.GetPropertyName() << "'."; } +// TODO(crbug.com/1167696): We probably want to avoid doing this for +// performance reasons. +bool InclusiveAncestorMayDependOnContainerQueries(Node* node) { + if (!RuntimeEnabledFeatures::CSSContainerQueriesEnabled()) + return false; + for (Node& ancestor : FlatTreeTraversal::InclusiveAncestorsOf(*node)) { + const ComputedStyle* style = ancestor.GetComputedStyle(); + // Since DependsOnContainerQueries is stored on ComputedStyle, we have to + // behave as if the flag is set for nullptr-styles (display:none). + if (!style || style->DependsOnContainerQueries()) + return true; + } + return false; +} + } // namespace const Vector& @@ -278,20 +298,8 @@ CSSComputedStyleDeclaration::CSSComputedStyleDeclaration( CSSComputedStyleDeclaration::~CSSComputedStyleDeclaration() = default; String CSSComputedStyleDeclaration::cssText() const { - StringBuilder result; - static const Vector& properties = - ComputableProperties(GetExecutionContext()); - - for (unsigned i = 0; i < properties.size(); i++) { - if (i) - result.Append(' '); - result.Append(properties[i]->GetPropertyName()); - result.Append(": "); - result.Append(GetPropertyValue(properties[i]->PropertyID())); - result.Append(';'); - } - - return result.ToString(); + // CSSStyleDeclaration.cssText should return empty string for computed style. + return String(); } void CSSComputedStyleDeclaration::setCSSText(const ExecutionContext*, @@ -438,7 +446,8 @@ const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValue( LayoutObject* layout_object = StyledLayoutObject(); const ComputedStyle* style = ComputeComputedStyle(); - if (property_class.IsLayoutDependent(style, layout_object)) { + if (property_class.IsLayoutDependent(style, layout_object) || + InclusiveAncestorMayDependOnContainerQueries(styled_node)) { document.UpdateStyleAndLayoutForNode(styled_node, DocumentUpdateReason::kJavaScript); styled_node = StyledNode(); @@ -535,8 +544,8 @@ CSSRule* CSSComputedStyleDeclaration::parentRule() const { String CSSComputedStyleDeclaration::getPropertyValue( const String& property_name) { CSSPropertyID property_id = - cssPropertyID(GetExecutionContext(), property_name); - if (!isValidCSSPropertyID(property_id)) + CssPropertyID(GetExecutionContext(), property_name); + if (!IsValidCSSPropertyID(property_id)) return String(); if (property_id == CSSPropertyID::kVariable) { const CSSValue* value = GetPropertyCSSValue(AtomicString(property_name)); @@ -596,7 +605,7 @@ const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValueInternal( const CSSValue* CSSComputedStyleDeclaration::GetPropertyCSSValueInternal( AtomicString custom_property_name) { DCHECK_EQ(CSSPropertyID::kVariable, - cssPropertyID(GetExecutionContext(), custom_property_name)); + CssPropertyID(GetExecutionContext(), custom_property_name)); return GetPropertyCSSValue(custom_property_name); } diff --git a/chromium/third_party/blink/renderer/core/css/css_container_rule.cc b/chromium/third_party/blink/renderer/core/css/css_container_rule.cc new file mode 100644 index 00000000000..1dd370f41dc --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_container_rule.cc @@ -0,0 +1,24 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/css/css_container_rule.h" + +#include "third_party/blink/renderer/core/css/style_rule.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" + +namespace blink { + +CSSContainerRule::CSSContainerRule(StyleRuleContainer* container_rule, + CSSStyleSheet* parent) + : CSSConditionRule(container_rule, parent) {} + +CSSContainerRule::~CSSContainerRule() = default; + +String CSSContainerRule::cssText() const { + // TODO(crbug.com/1145970): Spec and implement serialization. + NOTIMPLEMENTED(); + return ""; +} + +} // namespace blink diff --git a/chromium/third_party/blink/renderer/core/css/css_container_rule.h b/chromium/third_party/blink/renderer/core/css/css_container_rule.h new file mode 100644 index 00000000000..dba352576e7 --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_container_rule.h @@ -0,0 +1,37 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_CONTAINER_RULE_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_CONTAINER_RULE_H_ + +#include "third_party/blink/renderer/core/css/css_condition_rule.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" + +namespace blink { + +class StyleRuleContainer; + +class CSSContainerRule final : public CSSConditionRule { + DEFINE_WRAPPERTYPEINFO(); + + public: + CSSContainerRule(StyleRuleContainer*, CSSStyleSheet*); + ~CSSContainerRule() override; + + String cssText() const override; + + private: + CSSRule::Type GetType() const override { return kContainerRule; } +}; + +template <> +struct DowncastTraits { + static bool AllowFrom(const CSSRule& rule) { + return rule.GetType() == CSSRule::kContainerRule; + } +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_CONTAINER_RULE_H_ diff --git a/chromium/third_party/blink/renderer/core/css/css_container_rule.idl b/chromium/third_party/blink/renderer/core/css/css_container_rule.idl new file mode 100644 index 00000000000..709dbcf83ce --- /dev/null +++ b/chromium/third_party/blink/renderer/core/css/css_container_rule.idl @@ -0,0 +1,10 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + Exposed=Window, + RuntimeEnabled=CSSContainerQueries +] interface CSSContainerRule : CSSConditionRule { + // TODO(crbug.com/1145970): Spec and implement. +}; diff --git a/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.cc b/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.cc index e6155be6da3..c6c4a622a2e 100644 --- a/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.cc +++ b/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.cc @@ -3,7 +3,15 @@ // found in the LICENSE file. #include "third_party/blink/renderer/core/css/css_counter_style_rule.h" -#include "third_party/blink/renderer/core/css/style_rule.h" +#include "third_party/blink/renderer/core/css/css_style_sheet.h" +#include "third_party/blink/renderer/core/css/parser/at_rule_descriptor_parser.h" +#include "third_party/blink/renderer/core/css/parser/css_parser_context.h" +#include "third_party/blink/renderer/core/css/parser/css_tokenizer.h" +#include "third_party/blink/renderer/core/css/properties/css_parsing_utils.h" +#include "third_party/blink/renderer/core/css/style_engine.h" +#include "third_party/blink/renderer/core/css/style_rule_counter_style.h" +#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { @@ -15,7 +23,84 @@ CSSCounterStyleRule::CSSCounterStyleRule( CSSCounterStyleRule::~CSSCounterStyleRule() = default; String CSSCounterStyleRule::cssText() const { - return String(); + StringBuilder result; + result.Append("@counter-style "); + result.Append(name()); + result.Append(" {"); + + // Note: The exact serialization isn't well specified. + String system_text = system(); + if (system_text.length()) { + result.Append(" system: "); + result.Append(system_text); + result.Append(";"); + } + + String symbols_text = symbols(); + if (symbols_text.length()) { + result.Append(" symbols: "); + result.Append(symbols_text); + result.Append(";"); + } + + String additive_symbols_text = additiveSymbols(); + if (additive_symbols_text.length()) { + result.Append(" additive-symbols: "); + result.Append(additive_symbols_text); + result.Append(";"); + } + + String negative_text = negative(); + if (negative_text.length()) { + result.Append(" negative: "); + result.Append(negative_text); + result.Append(";"); + } + + String prefix_text = prefix(); + if (prefix_text.length()) { + result.Append(" prefix: "); + result.Append(prefix_text); + result.Append(";"); + } + + String suffix_text = suffix(); + if (suffix_text.length()) { + result.Append(" suffix: "); + result.Append(suffix_text); + result.Append(";"); + } + + String pad_text = pad(); + if (pad_text.length()) { + result.Append(" pad: "); + result.Append(pad_text); + result.Append(";"); + } + + String range_text = range(); + if (range_text.length()) { + result.Append(" range: "); + result.Append(range_text); + result.Append(";"); + } + + String fallback_text = fallback(); + if (fallback_text.length()) { + result.Append(" fallback: "); + result.Append(fallback_text); + result.Append(";"); + } + + String speak_as_text = speakAs(); + if (speak_as_text.length()) { + result.Append(" speak-as: "); + result.Append(speak_as_text); + result.Append(";"); + } + + result.Append(" }"); + return result.ToString(); } void CSSCounterStyleRule::Reattach(StyleRuleBase* rule) { @@ -87,48 +172,103 @@ String CSSCounterStyleRule::fallback() const { return String(); } -void CSSCounterStyleRule::setName(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::SetterInternal( + const ExecutionContext* execution_context, + AtRuleDescriptorID descriptor_id, + const String& text) { + CSSStyleSheet* style_sheet = parentStyleSheet(); + auto& context = *MakeGarbageCollected( + ParserContext(execution_context->GetSecureContextMode()), style_sheet); + CSSTokenizer tokenizer(text); + auto tokens = tokenizer.TokenizeToEOF(); + CSSParserTokenRange token_range(tokens); + CSSValue* new_value = AtRuleDescriptorParser::ParseAtCounterStyleDescriptor( + descriptor_id, token_range, context); + if (!new_value || + !counter_style_rule_->NewValueInvalidOrEqual(descriptor_id, new_value)) + return; + + // TODO(xiaochengh): RuleMutationScope causes all rules of the tree scope to + // be re-collected and the entire CounterStyleMap rebuilt, while we only need + // to dirty one CounterStyle. Try to improve. + CSSStyleSheet::RuleMutationScope rule_mutation_scope(this); + + counter_style_rule_->SetDescriptorValue(descriptor_id, new_value); + if (Document* document = style_sheet->OwnerDocument()) + document->GetStyleEngine().MarkCounterStylesNeedUpdate(); +} + +void CSSCounterStyleRule::setName(const ExecutionContext* execution_context, + const String& text) { + CSSStyleSheet* style_sheet = parentStyleSheet(); + auto& context = *MakeGarbageCollected( + ParserContext(execution_context->GetSecureContextMode()), style_sheet); + CSSTokenizer tokenizer(text); + auto tokens = tokenizer.TokenizeToEOF(); + CSSParserTokenRange token_range(tokens); + AtomicString name = + css_parsing_utils::ConsumeCounterStyleNameInPrelude(token_range, context); + if (!name || name == counter_style_rule_->GetName()) + return; + + // Changing name may affect cascade result, which requires re-collecting all + // the rules and re-constructing the CounterStyleMap to handle. + CSSStyleSheet::RuleMutationScope rule_mutation_scope(this); + + counter_style_rule_->SetName(name); + if (Document* document = style_sheet->OwnerDocument()) + document->GetStyleEngine().MarkCounterStylesNeedUpdate(); } -void CSSCounterStyleRule::setSystem(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setSystem(const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::System, text); } -void CSSCounterStyleRule::setSymbols(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setSymbols(const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::Symbols, text); } -void CSSCounterStyleRule::setAdditiveSymbols(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setAdditiveSymbols( + const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::AdditiveSymbols, text); } -void CSSCounterStyleRule::setNegative(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setNegative(const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::Negative, text); } -void CSSCounterStyleRule::setPrefix(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setPrefix(const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::Prefix, text); } -void CSSCounterStyleRule::setSuffix(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setSuffix(const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::Suffix, text); } -void CSSCounterStyleRule::setRange(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setRange(const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::Range, text); } -void CSSCounterStyleRule::setPad(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setPad(const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::Pad, text); } -void CSSCounterStyleRule::setSpeakAs(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setSpeakAs(const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::SpeakAs, text); } -void CSSCounterStyleRule::setFallback(const String&) { - // TODO(crbug.com/687225): Implement +void CSSCounterStyleRule::setFallback(const ExecutionContext* execution_context, + const String& text) { + SetterInternal(execution_context, AtRuleDescriptorID::Fallback, text); } void CSSCounterStyleRule::Trace(Visitor* visitor) const { diff --git a/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.h b/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.h index 7581cb9ccde..6e8620d9d28 100644 --- a/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.h +++ b/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.h @@ -6,10 +6,12 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSS_COUNTER_STYLE_RULE_H_ #include "third_party/blink/renderer/core/css/css_rule.h" +#include "third_party/blink/renderer/core/css/parser/at_rule_descriptors.h" #include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { +class ExecutionContext; class StyleRuleCounterStyle; class CSSCounterStyleRule final : public CSSRule { @@ -34,23 +36,27 @@ class CSSCounterStyleRule final : public CSSRule { String speakAs() const; String fallback() const; - void setName(const String&); - void setSystem(const String&); - void setSymbols(const String&); - void setAdditiveSymbols(const String&); - void setNegative(const String&); - void setPrefix(const String&); - void setSuffix(const String&); - void setRange(const String&); - void setPad(const String&); - void setSpeakAs(const String&); - void setFallback(const String&); + void setName(const ExecutionContext*, const String&); + void setSystem(const ExecutionContext*, const String&); + void setSymbols(const ExecutionContext*, const String&); + void setAdditiveSymbols(const ExecutionContext*, const String&); + void setNegative(const ExecutionContext*, const String&); + void setPrefix(const ExecutionContext*, const String&); + void setSuffix(const ExecutionContext*, const String&); + void setRange(const ExecutionContext*, const String&); + void setPad(const ExecutionContext*, const String&); + void setSpeakAs(const ExecutionContext*, const String&); + void setFallback(const ExecutionContext*, const String&); void Trace(Visitor*) const override; private: CSSRule::Type GetType() const override { return kCounterStyleRule; } + void SetterInternal(const ExecutionContext*, + AtRuleDescriptorID, + const String&); + Member counter_style_rule_; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.idl b/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.idl index 4b1f8ef776a..88fcfc1fcbe 100644 --- a/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.idl +++ b/chromium/third_party/blink/renderer/core/css/css_counter_style_rule.idl @@ -5,15 +5,15 @@ // https://drafts.csswg.org/css-counter-styles-3/#the-csscounterstylerule-interface [Exposed=Window, RuntimeEnabled=CSSAtRuleCounterStyle] interface CSSCounterStyleRule : CSSRule { - attribute CSSOMString name; - attribute CSSOMString system; - attribute CSSOMString symbols; - attribute CSSOMString additiveSymbols; - attribute CSSOMString negative; - attribute CSSOMString prefix; - attribute CSSOMString suffix; - attribute CSSOMString range; - attribute CSSOMString pad; - attribute CSSOMString speakAs; - attribute CSSOMString fallback; + [SetterCallWith=ExecutionContext] attribute CSSOMString name; + [SetterCallWith=ExecutionContext] attribute CSSOMString system; + [SetterCallWith=ExecutionContext] attribute CSSOMString symbols; + [SetterCallWith=ExecutionContext] attribute CSSOMString additiveSymbols; + [SetterCallWith=ExecutionContext] attribute CSSOMString negative; + [SetterCallWith=ExecutionContext] attribute CSSOMString prefix; + [SetterCallWith=ExecutionContext] attribute CSSOMString suffix; + [SetterCallWith=ExecutionContext] attribute CSSOMString range; + [SetterCallWith=ExecutionContext] attribute CSSOMString pad; + [SetterCallWith=ExecutionContext] attribute CSSOMString speakAs; + [SetterCallWith=ExecutionContext] attribute CSSOMString fallback; }; diff --git a/chromium/third_party/blink/renderer/core/css/css_counter_value.cc b/chromium/third_party/blink/renderer/core/css/css_counter_value.cc index 34f1f796232..40de5d47af3 100644 --- a/chromium/third_party/blink/renderer/core/css/css_counter_value.cc +++ b/chromium/third_party/blink/renderer/core/css/css_counter_value.cc @@ -23,7 +23,7 @@ String CSSCounterValue::CustomCSSText() const { result.Append(", "); result.Append(separator_->CssText()); } - bool is_default_list_style = ListStyle() == CSSValueID::kDecimal; + bool is_default_list_style = ListStyle() == "decimal"; if (!is_default_list_style) { result.Append(", "); result.Append(list_style_->CssText()); diff --git a/chromium/third_party/blink/renderer/core/css/css_counter_value.h b/chromium/third_party/blink/renderer/core/css/css_counter_value.h index 004b56844de..36458e232e6 100644 --- a/chromium/third_party/blink/renderer/core/css/css_counter_value.h +++ b/chromium/third_party/blink/renderer/core/css/css_counter_value.h @@ -34,7 +34,7 @@ namespace cssvalue { class CSSCounterValue : public CSSValue { public: CSSCounterValue(CSSCustomIdentValue* identifier, - CSSIdentifierValue* list_style, + CSSCustomIdentValue* list_style, CSSStringValue* separator) : CSSValue(kCounterClass), identifier_(identifier), @@ -42,7 +42,7 @@ class CSSCounterValue : public CSSValue { separator_(separator) {} String Identifier() const { return identifier_->Value(); } - CSSValueID ListStyle() const { return list_style_->GetValueID(); } + AtomicString ListStyle() const { return list_style_->Value(); } String Separator() const { return separator_->Value(); } bool Equals(const CSSCounterValue& other) const { @@ -56,7 +56,7 @@ class CSSCounterValue : public CSSValue { private: Member identifier_; // string - Member list_style_; // ident + Member list_style_; // ident Member separator_; // string }; diff --git a/chromium/third_party/blink/renderer/core/css/css_default_style_sheets.cc b/chromium/third_party/blink/renderer/core/css/css_default_style_sheets.cc index 285d47e683c..47ee7c070c1 100644 --- a/chromium/third_party/blink/renderer/core/css/css_default_style_sheets.cc +++ b/chromium/third_party/blink/renderer/core/css/css_default_style_sheets.cc @@ -89,14 +89,16 @@ static StyleSheetContents* ParseUASheet(const String& str) { CSSDefaultStyleSheets::CSSDefaultStyleSheets() : media_controls_style_sheet_loader_(nullptr) { - // Strict-mode rules. - String forced_colors_style_sheet = - RuntimeEnabledFeatures::ForcedColorsEnabled() - ? UncompressResourceAsASCIIString(IDR_UASTYLE_THEME_FORCED_COLORS_CSS) + // Predefined @counter-style rules + String predefined_counter_styles_sheet = + RuntimeEnabledFeatures::CSSAtRuleCounterStyleEnabled() + ? UncompressResourceAsASCIIString( + IDR_UASTYLE_PREDEFINED_COUNTER_STYLES_CSS) : String(); + // Strict-mode rules. String default_rules = UncompressResourceAsASCIIString(IDR_UASTYLE_HTML_CSS) + LayoutTheme::GetTheme().ExtraDefaultStyleSheet() + - forced_colors_style_sheet; + predefined_counter_styles_sheet; default_style_sheet_ = ParseUASheet(default_rules); @@ -114,13 +116,11 @@ CSSDefaultStyleSheets::CSSDefaultStyleSheets() default_svg_style_->CompactRulesIfNeeded(); default_quirks_style_->CompactRulesIfNeeded(); default_print_style_->CompactRulesIfNeeded(); - default_forced_color_style_->CompactRulesIfNeeded(); DCHECK(default_style_->UniversalRules()->IsEmpty()); DCHECK(default_mathml_style_->UniversalRules()->IsEmpty()); DCHECK(default_svg_style_->UniversalRules()->IsEmpty()); DCHECK(default_quirks_style_->UniversalRules()->IsEmpty()); DCHECK(default_print_style_->UniversalRules()->IsEmpty()); - DCHECK(default_forced_color_style_->UniversalRules()->IsEmpty()); #endif } @@ -133,6 +133,7 @@ void CSSDefaultStyleSheets::PrepareForLeakDetection() { mathml_style_sheet_.Clear(); media_controls_style_sheet_.Clear(); text_track_style_sheet_.Clear(); + forced_colors_style_sheet_.Clear(); fullscreen_style_sheet_.Clear(); webxr_overlay_style_sheet_.Clear(); marker_style_sheet_.Clear(); @@ -153,14 +154,13 @@ void CSSDefaultStyleSheets::InitializeDefaultStyles() { default_svg_style_ = MakeGarbageCollected(); default_quirks_style_ = MakeGarbageCollected(); default_print_style_ = MakeGarbageCollected(); - default_forced_color_style_ = MakeGarbageCollected(); + default_media_controls_style_ = MakeGarbageCollected(); + default_forced_color_style_.Clear(); default_pseudo_element_style_.Clear(); default_style_->AddRulesFromSheet(DefaultStyleSheet(), ScreenEval()); default_quirks_style_->AddRulesFromSheet(QuirksStyleSheet(), ScreenEval()); default_print_style_->AddRulesFromSheet(DefaultStyleSheet(), PrintEval()); - default_forced_color_style_->AddRulesFromSheet(DefaultStyleSheet(), - ForcedColorsEval()); } RuleSet* CSSDefaultStyleSheets::DefaultViewSourceStyle() { @@ -218,8 +218,10 @@ bool CSSDefaultStyleSheets::EnsureDefaultStyleSheetsForElement( ParseUASheet(UncompressResourceAsASCIIString(IDR_UASTYLE_SVG_CSS)); default_svg_style_->AddRulesFromSheet(SvgStyleSheet(), ScreenEval()); default_print_style_->AddRulesFromSheet(SvgStyleSheet(), PrintEval()); - default_forced_color_style_->AddRulesFromSheet(SvgStyleSheet(), - ForcedColorsEval()); + if (default_forced_color_style_) { + default_forced_color_style_->AddRulesFromSheet(SvgStyleSheet(), + ForcedColorsEval()); + } changed_default_style = true; } @@ -241,11 +243,14 @@ bool CSSDefaultStyleSheets::EnsureDefaultStyleSheetsForElement( // and