mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 03:49:42 +00:00
Bug 1808426 - Event handlers for form-associated img and custom elements occur within the form's context. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D166129
This commit is contained in:
parent
9ccd32860d
commit
8101dd08cb
@ -49,6 +49,16 @@ void HTMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
|
||||
nsGenericHTMLFormElement::GetEventTargetParent(aVisitor);
|
||||
}
|
||||
|
||||
nsINode* HTMLElement::GetScopeChainParent() const {
|
||||
if (IsFormAssociatedCustomElements()) {
|
||||
auto* form = GetFormInternal();
|
||||
if (form) {
|
||||
return form;
|
||||
}
|
||||
}
|
||||
return nsGenericHTMLFormElement::GetScopeChainParent();
|
||||
}
|
||||
|
||||
nsresult HTMLElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
||||
nsresult rv = nsGenericHTMLFormElement::BindToTree(aContext, aParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -25,6 +25,7 @@ class HTMLElement final : public nsGenericHTMLFormElement {
|
||||
|
||||
// nsINode
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
nsINode* GetScopeChainParent() const override;
|
||||
|
||||
// nsIContent
|
||||
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
||||
|
@ -502,6 +502,13 @@ void HTMLImageElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
|
||||
nsGenericHTMLElement::GetEventTargetParent(aVisitor);
|
||||
}
|
||||
|
||||
nsINode* HTMLImageElement::GetScopeChainParent() const {
|
||||
if (mForm) {
|
||||
return mForm;
|
||||
}
|
||||
return nsGenericHTMLElement::GetScopeChainParent();
|
||||
}
|
||||
|
||||
bool HTMLImageElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) {
|
||||
int32_t tabIndex = TabIndex();
|
||||
|
@ -69,6 +69,7 @@ class HTMLImageElement final : public nsGenericHTMLElement,
|
||||
const override;
|
||||
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
||||
nsINode* GetScopeChainParent() const override;
|
||||
|
||||
bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) override;
|
||||
|
@ -1,6 +0,0 @@
|
||||
[compile-event-handler-lexical-scopes-form-owner.html]
|
||||
[<img> has a form owner]
|
||||
expected: FAIL
|
||||
|
||||
[form-associated <x-foo> has a form owner]
|
||||
expected: FAIL
|
Loading…
x
Reference in New Issue
Block a user