Changeset 192763 in webkit


Ignore:
Timestamp:
Nov 24, 2015, 4:40:57 AM (10 years ago)
Author:
Antti Koivisto
Message:

REGRESSION (r190983): Non-element, non-text nodes should not be distributed to slots
https://bugs.webkit.org/show_bug.cgi?id=151566
rdar://problem/23430177

Reviewed by Zalan Bujtas.

Source/WebCore:

We don't invalidate slot assignments except for text or element children. Fix by not
not assigning other nodes to slots as it is not useful.

Test: fast/html/details-comment-crash.html

  • dom/SlotAssignment.cpp:

(WebCore::slotNameFromSlotAttribute):
(WebCore::SlotAssignment::findAssignedSlot):
(WebCore::SlotAssignment::assignSlots):

LayoutTests:

  • fast/html/details-comment-crash-expected.html: Added.
  • fast/html/details-comment-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r192752 r192763  
     12015-11-24  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r190983): Non-element, non-text nodes should not be distributed to slots
     4        https://bugs.webkit.org/show_bug.cgi?id=151566
     5        rdar://problem/23430177
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        * fast/html/details-comment-crash-expected.html: Added.
     10        * fast/html/details-comment-crash.html: Added.
     11
    1122015-11-23  Brady Eidson  <beidson@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r192758 r192763  
     12015-11-24  Antti Koivisto  <antti@apple.com>
     2
     3        REGRESSION (r190983): Non-element, non-text nodes should not be distributed to slots
     4        https://bugs.webkit.org/show_bug.cgi?id=151566
     5        rdar://problem/23430177
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        We don't invalidate slot assignments except for text or element children. Fix by not
     10        not assigning other nodes to slots as it is not useful.
     11
     12        Test: fast/html/details-comment-crash.html
     13
     14        * dom/SlotAssignment.cpp:
     15        (WebCore::slotNameFromSlotAttribute):
     16        (WebCore::SlotAssignment::findAssignedSlot):
     17        (WebCore::SlotAssignment::assignSlots):
     18
    1192015-11-23  David Kilzer  <ddkilzer@apple.com>
    220
  • trunk/Source/WebCore/dom/SlotAssignment.cpp

    r190840 r192763  
    4444static const AtomicString& slotNameFromSlotAttribute(const Node& child)
    4545{
    46     if (!is<Element>(child))
     46    if (is<Text>(child))
    4747        return SlotAssignment::defaultSlotName();
     48
    4849    return slotNameFromAttributeValue(downcast<Element>(child).fastGetAttribute(slotAttr));
    4950}
     
    6162HTMLSlotElement* SlotAssignment::findAssignedSlot(const Node& node, ShadowRoot& shadowRoot)
    6263{
     64    if (!is<Text>(node) && !is<Element>(node))
     65        return nullptr;
     66
    6367    if (!m_slotAssignmentsIsValid)
    6468        assignSlots(shadowRoot);
     
    221225    auto& host = *shadowRoot.host();
    222226    for (auto* child = host.firstChild(); child; child = child->nextSibling()) {
     227        if (!is<Text>(*child) && !is<Element>(*child))
     228            continue;
    223229        auto slotName = m_slotNameFunction(*child);
    224230        if (!slotName)
Note: See TracChangeset for help on using the changeset viewer.