OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 updatePseudoElement(AFTER, change); | 1670 updatePseudoElement(AFTER, change); |
1671 updatePseudoElement(BACKDROP, change); | 1671 updatePseudoElement(BACKDROP, change); |
1672 } | 1672 } |
1673 } | 1673 } |
1674 | 1674 |
1675 ElementShadow* Element::shadow() const | 1675 ElementShadow* Element::shadow() const |
1676 { | 1676 { |
1677 return hasRareData() ? elementRareData()->shadow() : 0; | 1677 return hasRareData() ? elementRareData()->shadow() : 0; |
1678 } | 1678 } |
1679 | 1679 |
1680 ElementShadow* Element::ensureShadow() | 1680 ElementShadow& Element::ensureShadow() |
1681 { | 1681 { |
1682 return ensureElementRareData()->ensureShadow(); | 1682 return ensureElementRareData()->ensureShadow(); |
1683 } | 1683 } |
1684 | 1684 |
1685 void Element::didAffectSelector(AffectedSelectorMask mask) | 1685 void Element::didAffectSelector(AffectedSelectorMask mask) |
1686 { | 1686 { |
1687 setNeedsStyleRecalc(); | 1687 setNeedsStyleRecalc(); |
1688 if (ElementShadow* elementShadow = shadowOfParentForDistribution(this)) | 1688 if (ElementShadow* elementShadow = shadowOfParentForDistribution(this)) |
1689 elementShadow->didAffectSelector(mask); | 1689 elementShadow->didAffectSelector(mask); |
1690 } | 1690 } |
1691 | 1691 |
1692 PassRefPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& es) | 1692 PassRefPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& es) |
1693 { | 1693 { |
1694 if (alwaysCreateUserAgentShadowRoot()) | 1694 if (alwaysCreateUserAgentShadowRoot()) |
1695 ensureUserAgentShadowRoot(); | 1695 ensureUserAgentShadowRoot(); |
1696 | 1696 |
1697 if (RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled()) | 1697 if (RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled()) |
1698 return ensureShadow()->addShadowRoot(this, ShadowRoot::AuthorShadowRoot)
; | 1698 return ensureShadow().addShadowRoot(this, ShadowRoot::AuthorShadowRoot); |
1699 | 1699 |
1700 // Since some elements recreates shadow root dynamically, multiple shadow | 1700 // Since some elements recreates shadow root dynamically, multiple shadow |
1701 // subtrees won't work well in that element. Until they are fixed, we disabl
e | 1701 // subtrees won't work well in that element. Until they are fixed, we disabl
e |
1702 // adding author shadow root for them. | 1702 // adding author shadow root for them. |
1703 if (!areAuthorShadowsAllowed()) { | 1703 if (!areAuthorShadowsAllowed()) { |
1704 es.throwUninformativeAndGenericDOMException(HierarchyRequestError); | 1704 es.throwUninformativeAndGenericDOMException(HierarchyRequestError); |
1705 return 0; | 1705 return 0; |
1706 } | 1706 } |
1707 return ensureShadow()->addShadowRoot(this, ShadowRoot::AuthorShadowRoot); | 1707 return ensureShadow().addShadowRoot(this, ShadowRoot::AuthorShadowRoot); |
1708 } | 1708 } |
1709 | 1709 |
1710 ShadowRoot* Element::shadowRoot() const | 1710 ShadowRoot* Element::shadowRoot() const |
1711 { | 1711 { |
1712 ElementShadow* elementShadow = shadow(); | 1712 ElementShadow* elementShadow = shadow(); |
1713 if (!elementShadow) | 1713 if (!elementShadow) |
1714 return 0; | 1714 return 0; |
1715 ShadowRoot* shadowRoot = elementShadow->youngestShadowRoot(); | 1715 ShadowRoot* shadowRoot = elementShadow->youngestShadowRoot(); |
1716 if (shadowRoot->type() == ShadowRoot::AuthorShadowRoot) | 1716 if (shadowRoot->type() == ShadowRoot::AuthorShadowRoot) |
1717 return shadowRoot; | 1717 return shadowRoot; |
(...skipping 13 matching lines...) Expand all Loading... |
1731 } | 1731 } |
1732 } | 1732 } |
1733 | 1733 |
1734 return 0; | 1734 return 0; |
1735 } | 1735 } |
1736 | 1736 |
1737 ShadowRoot* Element::ensureUserAgentShadowRoot() | 1737 ShadowRoot* Element::ensureUserAgentShadowRoot() |
1738 { | 1738 { |
1739 if (ShadowRoot* shadowRoot = userAgentShadowRoot()) | 1739 if (ShadowRoot* shadowRoot = userAgentShadowRoot()) |
1740 return shadowRoot; | 1740 return shadowRoot; |
1741 ShadowRoot* shadowRoot = ensureShadow()->addShadowRoot(this, ShadowRoot::Use
rAgentShadowRoot); | 1741 ShadowRoot* shadowRoot = ensureShadow().addShadowRoot(this, ShadowRoot::User
AgentShadowRoot); |
1742 didAddUserAgentShadowRoot(shadowRoot); | 1742 didAddUserAgentShadowRoot(shadowRoot); |
1743 return shadowRoot; | 1743 return shadowRoot; |
1744 } | 1744 } |
1745 | 1745 |
1746 bool Element::childTypeAllowed(NodeType type) const | 1746 bool Element::childTypeAllowed(NodeType type) const |
1747 { | 1747 { |
1748 switch (type) { | 1748 switch (type) { |
1749 case ELEMENT_NODE: | 1749 case ELEMENT_NODE: |
1750 case TEXT_NODE: | 1750 case TEXT_NODE: |
1751 case COMMENT_NODE: | 1751 case COMMENT_NODE: |
(...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3743 return 0; | 3743 return 0; |
3744 } | 3744 } |
3745 | 3745 |
3746 Attribute* UniqueElementData::attributeItem(unsigned index) | 3746 Attribute* UniqueElementData::attributeItem(unsigned index) |
3747 { | 3747 { |
3748 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 3748 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); |
3749 return &m_attributeVector.at(index); | 3749 return &m_attributeVector.at(index); |
3750 } | 3750 } |
3751 | 3751 |
3752 } // namespace WebCore | 3752 } // namespace WebCore |
OLD | NEW |