12012-01-20 Shinya Kawanaka <shinyak@google.com>
2
3 Refactoring: Reconsider the attach order of light children when a shadow tree exists.
4 https://bugs.webkit.org/show_bug.cgi?id=76611
5
6 Reviewed by NOBODY (OOPS!).
7
8 Children of an element having a shadow root were to be attached in Element::attach(),
9 however it is natural that they were attached in a shadow tree
10 because their show and no show is determined in a shadow tree.
11 Since the children were attached in ContainerNode::attach(),
12 a HTMLContentElement must detach them before attaching them.
13
14 This patch changes its behavior. An element having a shadow root does not attach their
15 children. They should be attached in a shadow tree.
16
17 No new tests, no change in behavior.
18
19 * dom/ContainerNode.cpp:
20 (WebCore::ContainerNode::attachWithoutChildren):
21 Attaches only ContainerNode. Does not attach its children.
22 (WebCore::ContainerNode::detachWithoutChildren):
23 Detaches only ContainerNode. Does not detach its children.
24 * dom/ContainerNode.h:
25 * dom/Element.cpp:
26 (WebCore::Element::attach):
27 If Element has a shadow root, attaching children is due for the shadow root.
28 (WebCore::Element::detach):
29 If Element has a shadow root, detaching children is due for the shadow root.
30 * dom/ShadowRoot.cpp:
31 (WebCore::ShadowRoot::attach):
32 Attaches shadow hosts children when they are not attached in shadow tree.
33 Its children may be attached in HTMLContentElement.
34 (WebCore::ShadowRoot::detach):
35 Detaches shadow hosts children when they are not detached in shadow tree.
36 Its children may be detached in HTMLContentElement.
37 * dom/ShadowRoot.h:
38 * html/shadow/HTMLContentElement.cpp:
39 (WebCore::HTMLContentElement::attach):
40 Does not need to attach included elements, because they are not attached in ContainerNode anymore.
41 (WebCore::HTMLContentElement::detach):
42 Needs to detach included elements, because they won't detached in ContainerNode anymore.
43