Input elements don't work inside shadow tree
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2016 23:45:21 +0000 (23:45 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2016 23:45:21 +0000 (23:45 +0000)
commit6db3b765847c1049a3d23999b85bdfb2feafc2b2
tree3c1b89fe303829bfdf8e98b31e077291d163a488
parente86657b3d3646c398985124fe2b42c4610b63832
Input elements don't work inside shadow tree
https://bugs.webkit.org/show_bug.cgi?id=160427

Reviewed by Darin Adler.

Source/WebCore:

There is a bug in ComposedTreeIterator. If the iterator is initialized with an initial state where the root
is inside a shadow tree it won't iterate into slots.

If an input element is in a shadow tree it generates narrowly scoped style updates. When RenderTreeUpdater
applies such an update the update root will be inside the shadow tree and the bug will prevent the render tree
for slotted content from updating.

Added tests for both the iterator behavior and the specific symptom with input elements.

Tests: fast/shadow-dom/composed-tree-shadow-child-subtree.html
       fast/shadow-dom/input-element-in-shadow.html

* dom/ComposedTreeIterator.cpp:
(WebCore::ComposedTreeIterator::ComposedTreeIterator):

    Check and cache if the root is inside shadow tree.

(WebCore::ComposedTreeIterator::traverseNextInShadowTree):
* dom/ComposedTreeIterator.h:
(WebCore::ComposedTreeIterator::traverseNext):

    If it is, always use the shadow traversal code path.

LayoutTests:

* fast/shadow-dom/composed-tree-shadow-child-subtree-expected.txt: Added.
* fast/shadow-dom/composed-tree-shadow-child-subtree.html: Added.
* fast/shadow-dom/input-element-in-shadow-expected.html: Added.
* fast/shadow-dom/input-element-in-shadow.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206403 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/shadow-dom/composed-tree-shadow-child-subtree-expected.txt [new file with mode: 0644]
LayoutTests/fast/shadow-dom/composed-tree-shadow-child-subtree.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/input-element-in-shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/shadow-dom/input-element-in-shadow.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/dom/ComposedTreeIterator.cpp
Source/WebCore/dom/ComposedTreeIterator.h