Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e657338dfd4124f6bb30ce69535ca8f8813ff566
      
https://github.com/WebKit/WebKit/commit/e657338dfd4124f6bb30ce69535ca8f8813ff566
  Author: Ryosuke Niwa <rn...@webkit.org>
  Date:   2025-03-26 (Wed, 26 Mar 2025)

  Changed paths:
    A 
LayoutTests/fast/shadow-dom/declarative-shadow-dom-with-parser-form-element-pointer-expected.txt
    A 
LayoutTests/fast/shadow-dom/declarative-shadow-dom-with-parser-form-element-pointer.html
    M Source/WebCore/html/parser/HTMLConstructionSite.cpp
    M Source/WebCore/html/parser/HTMLElementStack.cpp
    M Source/WebCore/html/parser/HTMLElementStack.h

  Log Message:
  -----------
  Form controls inside a declarative shadow DOM erroneously get associated with 
form element in an outer tree
https://bugs.webkit.org/show_bug.cgi?id=290396

Reviewed by Anne van Kesteren.

The bug was caused by 
HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface not using 
nullptr
for the form element pointer [1] when constructing an element inside a 
declarative shadow DOM. Fixed the bug
by introducing a new counter which keeps track of the number of template 
elements in HTMLElementStack,
and checking this counter in 
HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface to check if
there is any template element in the stack of open elements [2] when creating 
an element for a token [3].

[1] https://html.spec.whatwg.org/multipage/parsing.html#form-element-pointer
[2] 
https://html.spec.whatwg.org/multipage/parsing.html#the-stack-of-open-elements
[3] 
https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token

* 
LayoutTests/fast/shadow-dom/declarative-shadow-dom-with-parser-form-element-pointer-expected.txt:
 Added.
* 
LayoutTests/fast/shadow-dom/declarative-shadow-dom-with-parser-form-element-pointer.html:
 Added.
* Source/WebCore/html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
* Source/WebCore/html/parser/HTMLElementStack.cpp:
(WebCore::HTMLElementStack::pushCommon):
(WebCore::HTMLElementStack::popCommon):
(WebCore::HTMLElementStack::removeNonTopCommon):
* Source/WebCore/html/parser/HTMLElementStack.h:
(WebCore::HTMLElementStack::containsTemplateElement const):

Canonical link: https://commits.webkit.org/292703@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to