Commit 10021fad authored by Klaus Weidner's avatar Klaus Weidner Committed by Chromium LUCI CQ

Fix onbeforexrselect event handler inheritance

The onbeforexrselect event is supposed to be part of GlobalEventHandlers
and separately inherited by {HTML,MathML,SVG}Element, Window, and
Document. The current implementation had added it at the Element
level which isn't correct, causing test failures in the idlharness
test.

Update the implementation to fix the inheritance, which unfortunately
adds a bit of extra boilerplate.

Also add objects to the idlharness test to verify the inheritance.

Spec: https://immersive-web.github.io/dom-overlays/#onbeforexrselect

Fixed: 1108685
Change-Id: I8df73304b7b2d9bd93df30b78953aa9b378f8cad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2317813
Commit-Queue: Klaus Weidner <klausw@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#846294}
parent 1e4db11a
......@@ -1440,8 +1440,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",
......@@ -1686,6 +1684,8 @@ generated_interface_sources_in_modules = [
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_lock.h",
"$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_lock_manager.cc",
"$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_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_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_media_capabilities.cc",
......@@ -2030,6 +2030,8 @@ generated_interface_sources_in_modules = [
"$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",
......
......@@ -1000,8 +1000,12 @@ 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",
......
......@@ -126,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",
......@@ -321,7 +322,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",
......@@ -373,7 +373,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",
......@@ -501,7 +500,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",
......@@ -515,7 +513,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",
......
......@@ -6,7 +6,7 @@ import("//third_party/blink/renderer/modules/modules.gni")
blink_modules_sources("xr") {
sources = [
"element_xr.h",
"global_event_handlers_xr.h",
"type_converters.cc",
"type_converters.h",
"xr_anchor.cc",
......
// 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.
// https://immersive-web.github.io/dom-overlays/#onbeforexrselect
[
ImplementedAs=GlobalEventHandlersXR
]
partial interface Document {
attribute EventHandler onbeforexrselect;
};
......@@ -2,15 +2,19 @@
// 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_MODULES_XR_ELEMENT_XR_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_ELEMENT_XR_H_
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_GLOBAL_EVENT_HANDLERS_XR_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_GLOBAL_EVENT_HANDLERS_XR_H_
#include "third_party/blink/renderer/modules/event_target_modules.h"
namespace blink {
class ElementXR {
STATIC_ONLY(ElementXR);
// TODO(https://crbug.com/1109272): This should be changed to a partial
// interface mixin once that's supported by the IDL generator. Currently,
// GlobalEventHandlers is an interface mixin with five separate implementing
// interfaces.
class GlobalEventHandlersXR {
STATIC_ONLY(GlobalEventHandlersXR);
public:
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(beforexrselect, kBeforexrselect)
......@@ -18,4 +22,4 @@ class ElementXR {
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_XR_ELEMENT_XR_H_
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_XR_GLOBAL_EVENT_HANDLERS_XR_H_
// 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.
// https://immersive-web.github.io/dom-overlays/#onbeforexrselect
[
ImplementedAs=GlobalEventHandlersXR
]
partial interface HTMLElement {
attribute EventHandler onbeforexrselect;
};
......@@ -66,6 +66,10 @@ modules_dictionary_idl_files = [
modules_typedefs_enums_only_idl_files = [ "xr_webgl_context.idl" ]
modules_dependency_idl_files = [
"element_xr.idl",
"document_xr.idl",
"html_element_xr.idl",
"mathml_element_xr.idl",
"navigator_xr.idl",
"svg_element_xr.idl",
"window_xr.idl",
]
// 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.
// https://immersive-web.github.io/dom-overlays/#onbeforexrselect
[
ImplementedAs=GlobalEventHandlersXR
]
partial interface MathMLElement {
attribute EventHandler onbeforexrselect;
};
// 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.
// https://immersive-web.github.io/dom-overlays/#onbeforexrselect
[
ImplementedAs=GlobalEventHandlersXR
]
partial interface SVGElement {
attribute EventHandler onbeforexrselect;
};
......@@ -5,8 +5,8 @@
// https://immersive-web.github.io/dom-overlays/#onbeforexrselect
[
ImplementedAs=ElementXR
ImplementedAs=GlobalEventHandlersXR
]
partial interface Element {
partial interface Window {
attribute EventHandler onbeforexrselect;
};
This is a testharness.js-based test.
PASS idl_test setup
PASS idl_test validation
PASS Partial interface mixin GlobalEventHandlers: original interface mixin defined
PASS Partial interface mixin GlobalEventHandlers: member names are unique
PASS Partial dictionary XRSessionInit: original dictionary defined
PASS Partial dictionary XRSessionInit: member names are unique
PASS Partial interface XRSession: original interface defined
PASS Partial interface XRSession: member names are unique
PASS Partial interface Document: member names are unique
PASS Partial interface Document[2]: member names are unique
PASS Partial interface Window: member names are unique
PASS Document includes GlobalEventHandlers: member names are unique
PASS Document includes DocumentAndElementEventHandlers: member names are unique
PASS Document includes NonElementParentNode: member names are unique
PASS Document includes ParentNode: member names are unique
PASS Document includes XPathEvaluatorBase: member names are unique
PASS HTMLElement includes GlobalEventHandlers: member names are unique
PASS HTMLElement includes DocumentAndElementEventHandlers: member names are unique
PASS HTMLElement includes ElementContentEditable: member names are unique
PASS HTMLElement includes HTMLOrSVGElement: member names are unique
PASS Window includes GlobalEventHandlers: member names are unique
PASS Window includes WindowEventHandlers: member names are unique
PASS Window includes WindowOrWorkerGlobalScope: member names are unique
PASS Window includes AnimationFrameProvider: member names are unique
PASS Window includes WindowSessionStorage: member names are unique
PASS Window includes WindowLocalStorage: member names are unique
PASS Element includes ParentNode: member names are unique
PASS Element includes NonDocumentTypeChildNode: member names are unique
PASS Element includes ChildNode: member names are unique
PASS Element includes Slottable: member names are unique
PASS XRSession interface: attribute domOverlayState
FAIL HTMLElement interface: attribute onbeforexrselect assert_own_property: expected property "onbeforexrselect" missing
FAIL Window interface: attribute onbeforexrselect assert_own_property: The global object must have a property "onbeforexrselect" expected property "onbeforexrselect" missing
FAIL Document interface: attribute onbeforexrselect assert_true: The prototype object must have a property "onbeforexrselect" expected true got false
Harness: the test ran to completion.
......@@ -7,10 +7,14 @@
idl_test(
['dom-overlays'],
['webxr', 'html', 'dom'],
['webxr', 'html', 'dom', 'SVG'],
async idl_array => {
self.svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
idl_array.add_objects({
// TODO: Add object instances
Document: ['document'],
HTMLElement: ['document.body'],
SVGElement: ['svgElement'],
Window: ['window']
});
}
);
......@@ -90,6 +90,7 @@ PASS oldChildWindow.onauxclick is newChildWindow.onauxclick
PASS oldChildWindow.onbeforeinstallprompt is newChildWindow.onbeforeinstallprompt
PASS oldChildWindow.onbeforeprint is newChildWindow.onbeforeprint
PASS oldChildWindow.onbeforeunload is newChildWindow.onbeforeunload
PASS oldChildWindow.onbeforexrselect is newChildWindow.onbeforexrselect
PASS oldChildWindow.onblur is newChildWindow.onblur
PASS oldChildWindow.oncancel is newChildWindow.oncancel
PASS oldChildWindow.oncanplay is newChildWindow.oncanplay
......
......@@ -54,6 +54,7 @@ PASS childWindow.onauxclick is null
PASS childWindow.onbeforeinstallprompt is null
PASS childWindow.onbeforeprint is null
PASS childWindow.onbeforeunload is null
PASS childWindow.onbeforexrselect is null
PASS childWindow.onblur is null
PASS childWindow.oncancel is null
PASS childWindow.oncanplay is null
......
......@@ -54,6 +54,7 @@ PASS childWindow.onauxclick is null
PASS childWindow.onbeforeinstallprompt is null
PASS childWindow.onbeforeprint is null
PASS childWindow.onbeforeunload is null
PASS childWindow.onbeforexrselect is null
PASS childWindow.onblur is null
PASS childWindow.oncancel is null
PASS childWindow.oncanplay is null
......
......@@ -73,6 +73,7 @@ PASS oldChildWindow.onauxclick is newChildWindow.onauxclick
PASS oldChildWindow.onbeforeinstallprompt is newChildWindow.onbeforeinstallprompt
PASS oldChildWindow.onbeforeprint is newChildWindow.onbeforeprint
PASS oldChildWindow.onbeforeunload is newChildWindow.onbeforeunload
PASS oldChildWindow.onbeforexrselect is newChildWindow.onbeforexrselect
PASS oldChildWindow.onblur is newChildWindow.onblur
PASS oldChildWindow.oncancel is newChildWindow.oncancel
PASS oldChildWindow.oncanplay is newChildWindow.oncanplay
......
......@@ -44,6 +44,7 @@ PASS childWindow.onauxclick is null
PASS childWindow.onbeforeinstallprompt is null
PASS childWindow.onbeforeprint is null
PASS childWindow.onbeforeunload is null
PASS childWindow.onbeforexrselect is null
PASS childWindow.onblur is null
PASS childWindow.oncancel is null
PASS childWindow.oncanplay is null
......
......@@ -44,6 +44,7 @@ PASS childWindow.onauxclick is null
PASS childWindow.onbeforeinstallprompt is null
PASS childWindow.onbeforeprint is null
PASS childWindow.onbeforeunload is null
PASS childWindow.onbeforexrselect is null
PASS childWindow.onblur is null
PASS childWindow.oncancel is null
PASS childWindow.oncanplay is null
......
......@@ -1291,6 +1291,7 @@ interface Document : Node
getter onbeforecopy
getter onbeforecut
getter onbeforepaste
getter onbeforexrselect
getter onblur
getter oncancel
getter oncanplay
......@@ -1488,6 +1489,7 @@ interface Document : Node
setter onbeforecopy
setter onbeforecut
setter onbeforepaste
setter onbeforexrselect
setter onblur
setter oncancel
setter oncanplay
......@@ -1695,7 +1697,6 @@ interface Element : Node
getter onbeforecopy
getter onbeforecut
getter onbeforepaste
getter onbeforexrselect
getter onfullscreenchange
getter onfullscreenerror
getter onsearch
......@@ -1811,7 +1812,6 @@ interface Element : Node
setter onbeforecopy
setter onbeforecut
setter onbeforepaste
setter onbeforexrselect
setter onfullscreenchange
setter onfullscreenerror
setter onsearch
......@@ -2521,6 +2521,7 @@ interface HTMLElement : Element
getter onanimationiteration
getter onanimationstart
getter onauxclick
getter onbeforexrselect
getter onblur
getter oncancel
getter oncanplay
......@@ -2636,6 +2637,7 @@ interface HTMLElement : Element
setter onanimationiteration
setter onanimationstart
setter onauxclick
setter onbeforexrselect
setter onblur
setter oncancel
setter oncanplay
......@@ -5940,6 +5942,7 @@ interface SVGElement : Element
getter onanimationiteration
getter onanimationstart
getter onauxclick
getter onbeforexrselect
getter onblur
getter oncancel
getter oncanplay
......@@ -6041,6 +6044,7 @@ interface SVGElement : Element
setter onanimationiteration
setter onanimationstart
setter onauxclick
setter onbeforexrselect
setter onblur
setter oncancel
setter oncanplay
......@@ -9682,6 +9686,7 @@ namespace CSS
getter onbeforeinstallprompt
getter onbeforeprint
getter onbeforeunload
getter onbeforexrselect
getter onblur
getter oncancel
getter oncanplay
......@@ -9883,6 +9888,7 @@ namespace CSS
setter onbeforeinstallprompt
setter onbeforeprint
setter onbeforeunload
setter onbeforexrselect
setter onblur
setter oncancel
setter oncanplay
......
......@@ -1674,6 +1674,7 @@ interface Document : Node
getter onbeforecopy
getter onbeforecut
getter onbeforepaste
getter onbeforexrselect
getter onblur
getter oncancel
getter oncanplay
......@@ -1876,6 +1877,7 @@ interface Document : Node
setter onbeforecopy
setter onbeforecut
setter onbeforepaste
setter onbeforexrselect
setter onblur
setter oncancel
setter oncanplay
......@@ -2125,7 +2127,6 @@ interface Element : Node
getter onbeforecut
getter onbeforematch
getter onbeforepaste
getter onbeforexrselect
getter onfullscreenchange
getter onfullscreenerror
getter onsearch
......@@ -2252,7 +2253,6 @@ interface Element : Node
setter onbeforecut
setter onbeforematch
setter onbeforepaste
setter onbeforexrselect
setter onfullscreenchange
setter onfullscreenerror
setter onsearch
......@@ -3013,6 +3013,7 @@ interface HTMLElement : Element
getter onanimationiteration
getter onanimationstart
getter onauxclick
getter onbeforexrselect
getter onblur
getter oncancel
getter oncanplay
......@@ -3132,6 +3133,7 @@ interface HTMLElement : Element
setter onanimationiteration
setter onanimationstart
setter onauxclick
setter onbeforexrselect
setter onblur
setter oncancel
setter oncanplay
......@@ -4819,6 +4821,7 @@ interface MathMLElement : Element
getter onanimationiteration
getter onanimationstart
getter onauxclick
getter onbeforexrselect
getter onblur
getter oncancel
getter oncanplay
......@@ -4920,6 +4923,7 @@ interface MathMLElement : Element
setter onanimationiteration
setter onanimationstart
setter onauxclick
setter onbeforexrselect
setter onblur
setter oncancel
setter oncanplay
......@@ -6947,6 +6951,7 @@ interface SVGElement : Element
getter onanimationiteration
getter onanimationstart
getter onauxclick
getter onbeforexrselect
getter onblur
getter oncancel
getter oncanplay
......@@ -7050,6 +7055,7 @@ interface SVGElement : Element
setter onanimationiteration
setter onanimationstart
setter onauxclick
setter onbeforexrselect
setter onblur
setter oncancel
setter oncanplay
......@@ -11040,6 +11046,7 @@ namespace CSS
getter onbeforeinstallprompt
getter onbeforeprint
getter onbeforeunload
getter onbeforexrselect
getter onblur
getter oncancel
getter oncanplay
......@@ -11253,6 +11260,7 @@ namespace CSS
setter onbeforeinstallprompt
setter onbeforeprint
setter onbeforeunload
setter onbeforexrselect
setter onblur
setter oncancel
setter oncanplay
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment