Changeset 206403 in webkit


Ignore:
Timestamp:
Sep 26, 2016 4:45:21 PM (8 years ago)
Author:
Antti Koivisto
Message:

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.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206398 r206403  
     12016-09-26  Antti Koivisto  <antti@apple.com>
     2
     3        Input elements don't work inside shadow tree
     4        https://bugs.webkit.org/show_bug.cgi?id=160427
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/shadow-dom/composed-tree-shadow-child-subtree-expected.txt: Added.
     9        * fast/shadow-dom/composed-tree-shadow-child-subtree.html: Added.
     10        * fast/shadow-dom/input-element-in-shadow-expected.html: Added.
     11        * fast/shadow-dom/input-element-in-shadow.html: Added.
     12
    1132016-09-26  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r206261 r206403  
    333333webkit.org/b/155233 fast/events/max-tabindex-focus.html [ Skip ]
    334334fast/shadow-dom/shadow-host-removal-crash.html [ Skip ]
     335fast/shadow-dom/input-element-in-shadow.html [ Skip ]
    335336
    336337# The file-wrapper part of <attachment> is not yet working on iOS
  • trunk/Source/WebCore/ChangeLog

    r206399 r206403  
     12016-09-26  Antti Koivisto  <antti@apple.com>
     2
     3        Input elements don't work inside shadow tree
     4        https://bugs.webkit.org/show_bug.cgi?id=160427
     5
     6        Reviewed by Darin Adler.
     7
     8        There is a bug in ComposedTreeIterator. If the iterator is initialized with an initial state where the root
     9        is inside a shadow tree it won't iterate into slots.
     10
     11        If an input element is in a shadow tree it generates narrowly scoped style updates. When RenderTreeUpdater
     12        applies such an update the update root will be inside the shadow tree and the bug will prevent the render tree
     13        for slotted content from updating.
     14
     15        Added tests for both the iterator behavior and the specific symptom with input elements.
     16
     17        Tests: fast/shadow-dom/composed-tree-shadow-child-subtree.html
     18               fast/shadow-dom/input-element-in-shadow.html
     19
     20        * dom/ComposedTreeIterator.cpp:
     21        (WebCore::ComposedTreeIterator::ComposedTreeIterator):
     22
     23            Check and cache if the root is inside shadow tree.
     24
     25        (WebCore::ComposedTreeIterator::traverseNextInShadowTree):
     26        * dom/ComposedTreeIterator.h:
     27        (WebCore::ComposedTreeIterator::traverseNext):
     28
     29            If it is, always use the shadow traversal code path.
     30
    1312016-09-26  Wenson Hsieh  <wenson_hsieh@apple.com>
    232
  • trunk/Source/WebCore/dom/ComposedTreeIterator.cpp

    r202091 r206403  
    5454
    5555ComposedTreeIterator::ComposedTreeIterator(ContainerNode& root, FirstChildTag)
     56    : m_rootIsInShadowTree(root.isInShadowTree())
    5657{
    5758    ASSERT(!is<ShadowRoot>(root));
     
    7475
    7576ComposedTreeIterator::ComposedTreeIterator(ContainerNode& root, Node& current)
     77    : m_rootIsInShadowTree(root.isInShadowTree())
    7678{
    7779    ASSERT(!is<ShadowRoot>(root));
     
    156158void ComposedTreeIterator::traverseNextInShadowTree()
    157159{
    158     ASSERT(m_contextStack.size() > 1);
     160    ASSERT(m_contextStack.size() > 1 || m_rootIsInShadowTree);
    159161
    160162    if (is<HTMLSlotElement>(current())) {
     
    176178void ComposedTreeIterator::traverseNextLeavingContext()
    177179{
    178     ASSERT(m_contextStack.size() > 1);
    179 
    180180    while (context().iterator == context().end && m_contextStack.size() > 1) {
    181181        m_contextStack.removeLast();
  • trunk/Source/WebCore/dom/ComposedTreeIterator.h

    r202091 r206403  
    8181    Node& current() { return *context().iterator; }
    8282
     83    bool m_rootIsInShadowTree { false };
    8384    bool m_didDropAssertions { false };
    8485    Vector<Context, 8> m_contextStack;
     
    9798    }
    9899
    99     if (m_contextStack.size() > 1) {
     100    if (m_contextStack.size() > 1 || m_rootIsInShadowTree) {
    100101        traverseNextInShadowTree();
    101102        return *this;
     
    110111    context().iterator.traverseNextSkippingChildren();
    111112
    112     if (context().iterator == context().end && m_contextStack.size() > 1)
     113    if (context().iterator == context().end)
    113114        traverseNextLeavingContext();
    114115   
Note: See TracChangeset for help on using the changeset viewer.