Changeset 154106 in webkit


Ignore:
Timestamp:
Aug 15, 2013 9:52:40 AM (11 years ago)
Author:
Antti Koivisto
Message:

<https://webkit.org/b/119834> Remove ElementShadow

Reviewed by Anders Carlsson.

It is 1:1 with ShadowRoot and has virtually no functionality. What little there is can be moved to ShadowRoot or Element.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.exp.in:
  • WebCore.xcodeproj/project.pbxproj:
  • css/StyleResolver.cpp:

(WebCore::StyleResolver::locateCousinList):

  • css/StyleScopeResolver.cpp:

(WebCore::StyleScopeResolver::styleSharingCandidateMatchesHostRules):
(WebCore::StyleScopeResolver::matchHostRules):

  • dom/ComposedShadowTreeWalker.cpp:

(WebCore::nodeCanBeDistributed):
(WebCore::ComposedShadowTreeWalker::traverseChild):

  • dom/ContainerNode.cpp:

(WebCore::childAttachedAllowedWhenAttachingChildren):

  • dom/ContainerNodeAlgorithms.cpp:

(WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument):
(WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument):
(WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree):
(WebCore::assertConnectedSubrameCountIsConsistent):

  • dom/ContainerNodeAlgorithms.h:

(WebCore::ChildFrameDisconnector::collectFrameOwners):

  • dom/DOMAllInOne.cpp:
  • dom/Document.cpp:
  • dom/Element.cpp:

(WebCore::Element::~Element):
(WebCore::Element::attach):
(WebCore::Element::detach):
(WebCore::Element::shadowRoot):
(WebCore::Element::didAffectSelector):
(WebCore::Element::addShadowRoot):
(WebCore::Element::removeShadowRoot):

Move addShadowRoot and removeShadowRoot here from ElementShadow.

(WebCore::Element::createShadowRoot):
(WebCore::Element::authorShadowRoot):
(WebCore::Element::userAgentShadowRoot):
(WebCore::Element::ensureUserAgentShadowRoot):
(WebCore::Element::childrenChanged):
(WebCore::Element::removeAllEventListeners):

  • dom/Element.h:

(WebCore::isShadowHost):

  • dom/ElementRareData.h:

(WebCore::ElementRareData::clearShadowRoot):
(WebCore::ElementRareData::shadowRoot):
(WebCore::ElementRareData::setShadowRoot):
(WebCore::ElementRareData::~ElementRareData):

  • dom/ElementShadow.cpp: Removed.
  • dom/ElementShadow.h: Removed.
  • dom/EventDispatcher.cpp:
  • dom/EventPathWalker.cpp:

(WebCore::EventPathWalker::moveToParent):

  • dom/Node.cpp:

(WebCore::Node::needsShadowTreeWalkerSlow):

  • dom/NodeRenderingContext.cpp:
  • dom/NodeRenderingContext.h:
  • dom/ShadowRoot.cpp:

(WebCore::ShadowRoot::attach):
(WebCore::ShadowRoot::detach):

Move attached() tests from ElementShadow.

(WebCore::ShadowRoot::childrenChanged):
(WebCore::ShadowRoot::removeAllEventListeners):

Move here from ElementShadow.

  • dom/ShadowRoot.h:

(WebCore::Node::shadowRoot):

  • dom/TreeScopeAdopter.cpp:
  • html/ColorInputType.cpp:

(WebCore::ColorInputType::createShadowSubtree):

  • html/FileInputType.cpp:

(WebCore::FileInputType::createShadowSubtree):
(WebCore::FileInputType::disabledAttributeChanged):
(WebCore::FileInputType::multipleAttributeChanged):

  • html/HTMLFormControlElement.cpp:
  • html/HTMLImageElement.cpp:

(WebCore::HTMLImageElement::canStartSelection):

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::updateType):

  • html/HTMLKeygenElement.cpp:
  • html/HTMLMediaElement.cpp:
  • html/HTMLTextAreaElement.cpp:
  • html/InputType.cpp:
  • html/RangeInputType.cpp:

(WebCore::RangeInputType::handleMouseDownEvent):
(WebCore::RangeInputType::createShadowSubtree):

  • html/TextFieldInputType.cpp:

(WebCore::TextFieldInputType::createShadowSubtree):

  • html/ValidationMessage.cpp:
  • html/shadow/ContentDistributor.cpp:

(WebCore::ContentDistributor::distribute):
(WebCore::ContentDistributor::ensureDistribution):

  • html/shadow/ContentDistributor.h:

(WebCore::ContentDistributor::isValid):

  • html/shadow/InsertionPoint.cpp:

(WebCore::InsertionPoint::childrenChanged):
(WebCore::InsertionPoint::insertedInto):
(WebCore::InsertionPoint::removedFrom):
(WebCore::resolveReprojection):

  • html/shadow/InsertionPoint.h:

(WebCore::shadowRootOfParentForDistribution):

  • html/shadow/SliderThumbElement.cpp:
  • inspector/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::unbind):
(WebCore::InspectorDOMAgent::buildObjectForNode):

  • page/FocusController.cpp:

(WebCore::FocusNavigationScope::focusNavigationScopeOwnedByShadowHost):

  • rendering/RenderFileUploadControl.cpp:

(WebCore::RenderFileUploadControl::uploadButton):

  • rendering/RenderTheme.cpp:
  • style/StyleResolveTree.cpp:

(WebCore::Style::resolveTree):

  • svg/SVGTRefElement.cpp:

(WebCore::SVGTRefElement::updateReferencedText):
(WebCore::SVGTRefElement::detachTarget):

  • svg/SVGUseElement.cpp:

(WebCore::SVGUseElement::clearResourceReferences):
(WebCore::SVGUseElement::buildShadowAndInstanceTree):
(WebCore::SVGUseElement::buildShadowTree):

  • testing/Internals.cpp:

(WebCore::Internals::ensureShadowRoot):
(WebCore::Internals::shadowRoot):

Location:
trunk/Source
Files:
2 deleted
52 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r154084 r154106  
    11671167    dom/Element.cpp
    11681168    dom/ElementRareData.cpp
    1169     dom/ElementShadow.cpp
    11701169    dom/EntityReference.cpp
    11711170    dom/ErrorEvent.cpp
  • trunk/Source/WebCore/ChangeLog

    r154103 r154106  
     12013-08-15  Antti Koivisto  <antti@apple.com>
     2
     3        <https://webkit.org/b/119834> Remove ElementShadow
     4
     5        Reviewed by Anders Carlsson.
     6
     7        It is 1:1 with ShadowRoot and has virtually no functionality. What little there is can be moved to ShadowRoot or Element.
     8
     9        * CMakeLists.txt:
     10        * GNUmakefile.list.am:
     11        * Target.pri:
     12        * WebCore.exp.in:
     13        * WebCore.xcodeproj/project.pbxproj:
     14        * css/StyleResolver.cpp:
     15        (WebCore::StyleResolver::locateCousinList):
     16        * css/StyleScopeResolver.cpp:
     17        (WebCore::StyleScopeResolver::styleSharingCandidateMatchesHostRules):
     18        (WebCore::StyleScopeResolver::matchHostRules):
     19        * dom/ComposedShadowTreeWalker.cpp:
     20        (WebCore::nodeCanBeDistributed):
     21        (WebCore::ComposedShadowTreeWalker::traverseChild):
     22        * dom/ContainerNode.cpp:
     23        (WebCore::childAttachedAllowedWhenAttachingChildren):
     24        * dom/ContainerNodeAlgorithms.cpp:
     25        (WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument):
     26        (WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument):
     27        (WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree):
     28        (WebCore::assertConnectedSubrameCountIsConsistent):
     29        * dom/ContainerNodeAlgorithms.h:
     30        (WebCore::ChildFrameDisconnector::collectFrameOwners):
     31        * dom/DOMAllInOne.cpp:
     32        * dom/Document.cpp:
     33        * dom/Element.cpp:
     34        (WebCore::Element::~Element):
     35        (WebCore::Element::attach):
     36        (WebCore::Element::detach):
     37        (WebCore::Element::shadowRoot):
     38        (WebCore::Element::didAffectSelector):
     39        (WebCore::Element::addShadowRoot):
     40        (WebCore::Element::removeShadowRoot):
     41       
     42            Move addShadowRoot and removeShadowRoot here from ElementShadow.
     43
     44        (WebCore::Element::createShadowRoot):
     45        (WebCore::Element::authorShadowRoot):
     46        (WebCore::Element::userAgentShadowRoot):
     47        (WebCore::Element::ensureUserAgentShadowRoot):
     48        (WebCore::Element::childrenChanged):
     49        (WebCore::Element::removeAllEventListeners):
     50        * dom/Element.h:
     51        (WebCore::isShadowHost):
     52        * dom/ElementRareData.h:
     53        (WebCore::ElementRareData::clearShadowRoot):
     54        (WebCore::ElementRareData::shadowRoot):
     55        (WebCore::ElementRareData::setShadowRoot):
     56        (WebCore::ElementRareData::~ElementRareData):
     57        * dom/ElementShadow.cpp: Removed.
     58        * dom/ElementShadow.h: Removed.
     59        * dom/EventDispatcher.cpp:
     60        * dom/EventPathWalker.cpp:
     61        (WebCore::EventPathWalker::moveToParent):
     62        * dom/Node.cpp:
     63        (WebCore::Node::needsShadowTreeWalkerSlow):
     64        * dom/NodeRenderingContext.cpp:
     65        * dom/NodeRenderingContext.h:
     66        * dom/ShadowRoot.cpp:
     67        (WebCore::ShadowRoot::attach):
     68        (WebCore::ShadowRoot::detach):
     69       
     70            Move attached() tests from ElementShadow.
     71
     72        (WebCore::ShadowRoot::childrenChanged):
     73        (WebCore::ShadowRoot::removeAllEventListeners):
     74       
     75            Move here from ElementShadow.
     76
     77        * dom/ShadowRoot.h:
     78        (WebCore::Node::shadowRoot):
     79        * dom/TreeScopeAdopter.cpp:
     80        * html/ColorInputType.cpp:
     81        (WebCore::ColorInputType::createShadowSubtree):
     82        * html/FileInputType.cpp:
     83        (WebCore::FileInputType::createShadowSubtree):
     84        (WebCore::FileInputType::disabledAttributeChanged):
     85        (WebCore::FileInputType::multipleAttributeChanged):
     86        * html/HTMLFormControlElement.cpp:
     87        * html/HTMLImageElement.cpp:
     88        (WebCore::HTMLImageElement::canStartSelection):
     89        * html/HTMLInputElement.cpp:
     90        (WebCore::HTMLInputElement::updateType):
     91        * html/HTMLKeygenElement.cpp:
     92        * html/HTMLMediaElement.cpp:
     93        * html/HTMLTextAreaElement.cpp:
     94        * html/InputType.cpp:
     95        * html/RangeInputType.cpp:
     96        (WebCore::RangeInputType::handleMouseDownEvent):
     97        (WebCore::RangeInputType::createShadowSubtree):
     98        * html/TextFieldInputType.cpp:
     99        (WebCore::TextFieldInputType::createShadowSubtree):
     100        * html/ValidationMessage.cpp:
     101        * html/shadow/ContentDistributor.cpp:
     102        (WebCore::ContentDistributor::distribute):
     103        (WebCore::ContentDistributor::ensureDistribution):
     104        * html/shadow/ContentDistributor.h:
     105        (WebCore::ContentDistributor::isValid):
     106        * html/shadow/InsertionPoint.cpp:
     107        (WebCore::InsertionPoint::childrenChanged):
     108        (WebCore::InsertionPoint::insertedInto):
     109        (WebCore::InsertionPoint::removedFrom):
     110        (WebCore::resolveReprojection):
     111        * html/shadow/InsertionPoint.h:
     112        (WebCore::shadowRootOfParentForDistribution):
     113        * html/shadow/SliderThumbElement.cpp:
     114        * inspector/InspectorDOMAgent.cpp:
     115        (WebCore::InspectorDOMAgent::unbind):
     116        (WebCore::InspectorDOMAgent::buildObjectForNode):
     117        * page/FocusController.cpp:
     118        (WebCore::FocusNavigationScope::focusNavigationScopeOwnedByShadowHost):
     119        * rendering/RenderFileUploadControl.cpp:
     120        (WebCore::RenderFileUploadControl::uploadButton):
     121        * rendering/RenderTheme.cpp:
     122        * style/StyleResolveTree.cpp:
     123        (WebCore::Style::resolveTree):
     124        * svg/SVGTRefElement.cpp:
     125        (WebCore::SVGTRefElement::updateReferencedText):
     126        (WebCore::SVGTRefElement::detachTarget):
     127        * svg/SVGUseElement.cpp:
     128        (WebCore::SVGUseElement::clearResourceReferences):
     129        (WebCore::SVGUseElement::buildShadowAndInstanceTree):
     130        (WebCore::SVGUseElement::buildShadowTree):
     131        * testing/Internals.cpp:
     132        (WebCore::Internals::ensureShadowRoot):
     133        (WebCore::Internals::shadowRoot):
     134
    11352013-08-15  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    2136
  • trunk/Source/WebCore/GNUmakefile.list.am

    r154084 r154106  
    29062906        Source/WebCore/dom/ElementRareData.cpp \
    29072907        Source/WebCore/dom/ElementRareData.h \
    2908         Source/WebCore/dom/ElementShadow.cpp \
    2909         Source/WebCore/dom/ElementShadow.h \
    29102908        Source/WebCore/dom/ElementTraversal.h \
    29112909        Source/WebCore/dom/Entity.h \
  • trunk/Source/WebCore/Target.pri

    r154084 r154106  
    402402    dom/Element.cpp \
    403403    dom/ElementRareData.cpp \
    404     dom/ElementShadow.cpp \
    405404    dom/EntityReference.cpp \
    406405    dom/ErrorEvent.cpp \
     
    16121611    dom/DatasetDOMStringMap.h \
    16131612    dom/Element.h \
    1614     dom/ElementShadow.h \
    16151613    dom/ElementTravesal.h \
    16161614    dom/Entity.h \
  • trunk/Source/WebCore/WebCore.exp.in

    r154088 r154106  
    16361636__ZNK7WebCore6Widget9frameRectEv
    16371637__ZNK7WebCore7Element10screenRectEv
     1638__ZNK7WebCore7Element10shadowRootEv
    16381639__ZNK7WebCore7Element12getAttributeERKN3WTF12AtomicStringE
    16391640__ZNK7WebCore7Element12getAttributeERKNS_13QualifiedNameE
    16401641__ZNK7WebCore7Element12hasAttributeERKN3WTF12AtomicStringE
    16411642__ZNK7WebCore7Element13pseudoElementENS_8PseudoIdE
    1642 __ZNK7WebCore7Element6shadowEv
    16431643__ZNK7WebCore7IntRect10intersectsERKS0_
    16441644__ZNK7WebCore7IntRect8containsERKS0_
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r154084 r154106  
    16441644                578DA20F1520EBA3006141C1 /* InspectorTypeBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 573D134614CE39FF0057ABCA /* InspectorTypeBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
    16451645                57B791A314C6A62900F202D1 /* ContentDistributor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B7919F14C6A62900F202D1 /* ContentDistributor.cpp */; };
    1646                 57B791A414C6A62900F202D1 /* ContentDistributor.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B791A014C6A62900F202D1 /* ContentDistributor.h */; };
     1646                57B791A414C6A62900F202D1 /* ContentDistributor.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B791A014C6A62900F202D1 /* ContentDistributor.h */; settings = {ATTRIBUTES = (Private, ); }; };
    16471647                57B791A914C6A63300F202D1 /* HTMLContentElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B791A714C6A63300F202D1 /* HTMLContentElement.cpp */; };
    16481648                57B791AA14C6A63300F202D1 /* HTMLContentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B791A814C6A63300F202D1 /* HTMLContentElement.h */; };
    16491649                57CF497414EE36D700ECFF14 /* InsertionPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */; };
    16501650                57CF497514EE36D700ECFF14 /* InsertionPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 57CF497314EE36D700ECFF14 /* InsertionPoint.h */; };
    1651                 57CF4C8614F7597A00ECFF14 /* ElementShadow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57CF4C8414F7597A00ECFF14 /* ElementShadow.cpp */; };
    1652                 57CF4C8714F7597A00ECFF14 /* ElementShadow.h in Headers */ = {isa = PBXBuildFile; fileRef = 57CF4C8514F7597A00ECFF14 /* ElementShadow.h */; };
    16531651                5905ADBF1302F3CE00F116DF /* XMLTreeViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */; };
    16541652                5905ADC01302F3CE00F116DF /* XMLTreeViewer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */; };
     
    80498047                57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InsertionPoint.cpp; sourceTree = "<group>"; };
    80508048                57CF497314EE36D700ECFF14 /* InsertionPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InsertionPoint.h; sourceTree = "<group>"; };
    8051                 57CF4C8414F7597A00ECFF14 /* ElementShadow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ElementShadow.cpp; sourceTree = "<group>"; };
    8052                 57CF4C8514F7597A00ECFF14 /* ElementShadow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementShadow.h; sourceTree = "<group>"; };
    80538049                5905ADBD1302F3CE00F116DF /* XMLTreeViewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTreeViewer.cpp; sourceTree = "<group>"; };
    80548050                5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTreeViewer.h; sourceTree = "<group>"; };
     
    2031920315                                4FAB48641643A66D00F70C07 /* ElementRareData.cpp */,
    2032020316                                637B7ADE0E8767B800E32194 /* ElementRareData.h */,
    20321                                 57CF4C8414F7597A00ECFF14 /* ElementShadow.cpp */,
    20322                                 57CF4C8514F7597A00ECFF14 /* ElementShadow.h */,
    2032320317                                E4D58EBA17B8F12800CBDCA8 /* ElementTraversal.h */,
    2032420318                                A8EA7EBA0A1945D000A8EF5F /* Entity.h */,
     
    2176721761                                63F5D4F70E8C4B7100C0BD04 /* ElementRareData.h in Headers */,
    2176821762                                FBDB619F16D6036500BB3394 /* ElementRuleCollector.h in Headers */,
    21769                                 57CF4C8714F7597A00ECFF14 /* ElementShadow.h in Headers */,
    2177021763                                A8CFF6BE0A156118000A4234 /* EllipsisBox.h in Headers */,
    2177121764                                F55B3DBC1251F12D003EF269 /* EmailInputType.h in Headers */,
     
    2500424997                                4FFC022D1643B726004E1638 /* ElementRareData.cpp in Sources */,
    2500524998                                FBDB619B16D6032A00BB3394 /* ElementRuleCollector.cpp in Sources */,
    25006                                 57CF4C8614F7597A00ECFF14 /* ElementShadow.cpp in Sources */,
    2500724999                                A8CFF6CB0A1561CD000A4234 /* EllipsisBox.cpp in Sources */,
    2500825000                                F55B3DBB1251F12D003EF269 /* EmailInputType.cpp in Sources */,
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r153927 r154106  
    5959#include "DocumentStyleSheetCollection.h"
    6060#include "ElementRuleCollector.h"
    61 #include "ElementShadow.h"
    6261#include "FontFeatureValue.h"
    6362#include "FontValue.h"
     
    492491                && currentNode->isElementNode() && !parentElementPreventsSharing(toElement(currentNode))
    493492#if ENABLE(SHADOW_DOM)
    494                 && !toElement(currentNode)->shadow()
     493                && !toElement(currentNode)->authorShadowRoot()
    495494#endif
    496495                ) {
  • trunk/Source/WebCore/css/StyleScopeResolver.cpp

    r152353 r154106  
    3434#include "ContentDistributor.h"
    3535#include "ContextFeatures.h"
    36 #include "ElementShadow.h"
    3736#include "HTMLNames.h"
    3837#include "HTMLStyleElement.h"
     
    200199        return false;
    201200
    202     ElementShadow* shadow = element->shadow();
    203     if (!shadow)
    204         return false;
    205 
    206201    // FIXME(99827): https://bugs.webkit.org/show_bug.cgi?id=99827
    207202    // add a new flag to ElementShadow and cache whether any@host @-rules are
    208203    // applied to the element or not. So we can avoid always traversing
    209204    // shadow roots.
    210     if (ShadowRoot* shadowRoot = shadow->shadowRoot()) {
     205    if (ShadowRoot* shadowRoot = element->shadowRoot()) {
    211206        if (atHostRuleSetFor(shadowRoot))
    212207            return true;
     
    218213{
    219214    if (m_atHostRules.isEmpty())
    220         return;
    221 
    222     ElementShadow* shadow = element->shadow();
    223     if (!shadow)
    224215        return;
    225216
     
    228219    // applied to the element or not. So we can quickly exit this method
    229220    // by using the flag.
    230     if (ShadowRoot* shadowRoot = shadow->shadowRoot()) {
     221    if (ShadowRoot* shadowRoot = element->shadowRoot()) {
    231222        if (RuleSet* ruleSet = atHostRuleSetFor(shadowRoot))
    232223            matchedRules.append(ruleSet);
  • trunk/Source/WebCore/dom/ComposedShadowTreeWalker.cpp

    r150464 r154106  
    3131#include "ContentDistributor.h"
    3232#include "Element.h"
    33 #include "ElementShadow.h"
    3433#include "HTMLContentElement.h"
    3534#include "InsertionPoint.h"
     
    3837namespace WebCore {
    3938
    40 static inline ElementShadow* shadowFor(const Node* node)
    41 {
    42     if (node && node->isElementNode())
    43         return toElement(node)->shadow();
    44     return 0;
    45 }
    46 
    4739static inline bool nodeCanBeDistributed(const Node* node)
    4840{
     
    5547        return false;
    5648
    57     if (parent->isElementNode() && toElement(parent)->shadow())
     49    if (parent->isElementNode() && toElement(parent)->shadowRoot())
    5850        return true;
    5951
     
    9890    ASSERT(node);
    9991    if (canCrossUpperBoundary()) {
    100         ElementShadow* shadow = shadowFor(node);
    101         return shadow ? traverseLightChildren(shadow->shadowRoot(), direction)
     92        return node->shadowRoot() ? traverseLightChildren(node->shadowRoot(), direction)
    10293            : traverseLightChildren(node, direction);
    10394    }
  • trunk/Source/WebCore/dom/ContainerNode.cpp

    r154047 r154106  
    10751075        return true;
    10761076
    1077     if (node->isElementNode() && toElement(node)->shadow())
     1077    if (node->isElementNode() && toElement(node)->shadowRoot())
    10781078        return true;
    10791079
  • trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp

    r149549 r154106  
    2828
    2929#include "Element.h"
    30 #include "ElementShadow.h"
    3130#include "HTMLFrameOwnerElement.h"
    3231
     
    4746        return;
    4847
    49     if (ElementShadow* shadow = toElement(node)->shadow()) {
    50         if (RefPtr<ShadowRoot> root = shadow->shadowRoot()) {
    51             if (node->inDocument() && root->host() == node)
    52                 notifyNodeInsertedIntoDocument(root.get());
    53         }
     48    if (RefPtr<ShadowRoot> root = toElement(node)->shadowRoot()) {
     49        if (node->inDocument() && root->host() == node)
     50            notifyNodeInsertedIntoDocument(root.get());
    5451    }
    5552}
     
    8380        node->document()->setCSSTarget(0);
    8481
    85     if (ElementShadow* shadow = toElement(node)->shadow()) {
    86         if (RefPtr<ShadowRoot> root = shadow->shadowRoot()) {
    87             if (!node->inDocument() && root->host() == node)
    88                 notifyNodeRemovedFromDocument(root.get());
    89         }
     82    if (RefPtr<ShadowRoot> root = toElement(node)->shadowRoot()) {
     83        if (!node->inDocument() && root->host() == node)
     84            notifyNodeRemovedFromDocument(root.get());
    9085    }
    9186}
     
    10196        return;
    10297
    103     if (ElementShadow* shadow = toElement(node)->shadow()) {
    104         if (RefPtr<ShadowRoot> root = shadow->shadowRoot())
    105             notifyNodeRemovedFromTree(root.get());
    106     }
    107 }
    108 
    109 void ChildFrameDisconnector::collectFrameOwners(ElementShadow* shadow)
    110 {
    111     if (ShadowRoot* root = shadow->shadowRoot())
    112         collectFrameOwners(root);
     98    if (RefPtr<ShadowRoot> root = toElement(node)->shadowRoot())
     99        notifyNodeRemovedFromTree(root.get());
    113100}
    114101
     
    122109            count++;
    123110
    124         if (ElementShadow* shadow = toElement(node)->shadow()) {
    125             if (ShadowRoot* root = shadow->shadowRoot())
    126                 count += assertConnectedSubrameCountIsConsistent(root);
    127         }
     111        if (ShadowRoot* root = toElement(node)->shadowRoot())
     112            count += assertConnectedSubrameCountIsConsistent(root);
    128113    }
    129114
  • trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h

    r143089 r154106  
    2828#include "InspectorInstrumentation.h"
    2929#include "NodeTraversal.h"
     30#include "ShadowRoot.h"
    3031#include <wtf/Assertions.h>
    3132
     
    276277private:
    277278    void collectFrameOwners(Node* root);
    278     void collectFrameOwners(ElementShadow*);
    279279    void disconnectCollectedFrameOwners();
    280280
     
    298298        collectFrameOwners(child);
    299299
    300     ElementShadow* shadow = root->isElementNode() ? toElement(root)->shadow() : 0;
     300    ShadowRoot* shadow = root->isElementNode() ? toElement(root)->shadowRoot() : 0;
    301301    if (shadow)
    302302        collectFrameOwners(shadow);
  • trunk/Source/WebCore/dom/DOMAllInOne.cpp

    r149262 r154106  
    7070#include "DocumentType.cpp"
    7171#include "Element.cpp"
    72 #include "ElementShadow.cpp"
    7372#include "EntityReference.cpp"
    7473#include "ErrorEvent.cpp"
  • trunk/Source/WebCore/dom/Document.cpp

    r154047 r154106  
    6060#include "Editor.h"
    6161#include "Element.h"
    62 #include "ElementShadow.h"
    6362#include "ElementTraversal.h"
    6463#include "EntityReference.h"
  • trunk/Source/WebCore/dom/Element.cpp

    r154054 r154106  
    3636#include "ClientRect.h"
    3737#include "ClientRectList.h"
     38#include "ContainerNodeAlgorithms.h"
    3839#include "CustomElementRegistry.h"
    3940#include "DOMTokenList.h"
     
    175176        data->setPseudoElement(BEFORE, 0);
    176177        data->setPseudoElement(AFTER, 0);
    177         data->clearShadow();
     178        removeShadowRoot();
    178179    }
    179180
     
    14271428
    14281429    // When a shadow root exists, it does the work of attaching the children.
    1429     if (ElementShadow* shadow = this->shadow()) {
     1430    if (ShadowRoot* shadowRoot = this->shadowRoot()) {
    14301431        parentPusher.push();
    1431         shadow->attach(context);
     1432        shadowRoot->attach(context);
    14321433    } else if (firstChild())
    14331434        parentPusher.push();
     
    14961497    }
    14971498
    1498     if (ElementShadow* shadow = this->shadow())
    1499         shadow->detach(context);
     1499    if (ShadowRoot* shadowRoot = this->shadowRoot())
     1500        shadowRoot->detach(context);
    15001501
    15011502    // Do not remove the element's hovered and active status
     
    15711572}
    15721573
    1573 ElementShadow* Element::shadow() const
    1574 {
    1575     return hasRareData() ? elementRareData()->shadow() : 0;
    1576 }
    1577 
    1578 ElementShadow& Element::ensureShadow()
    1579 {
    1580     return ensureElementRareData().ensureShadow();
     1574ShadowRoot* Element::shadowRoot() const
     1575{
     1576    return hasRareData() ? elementRareData()->shadowRoot() : 0;
    15811577}
    15821578
     
    15841580{
    15851581    setNeedsStyleRecalc();
     1582}
     1583
     1584void Element::addShadowRoot(PassRefPtr<ShadowRoot> newShadowRoot)
     1585{
     1586    ASSERT(!shadowRoot());
     1587
     1588    ShadowRoot* shadowRoot = newShadowRoot.get();
     1589    ensureElementRareData().setShadowRoot(newShadowRoot);
     1590
     1591    shadowRoot->setParentOrShadowHostNode(this);
     1592    shadowRoot->setParentTreeScope(treeScope());
     1593    shadowRoot->distributor().didShadowBoundaryChange(this);
     1594
     1595    ChildNodeInsertionNotifier(this).notify(shadowRoot);
     1596
     1597    // Existence of shadow roots requires the host and its children to do traversal using ComposedShadowTreeWalker.
     1598    setNeedsShadowTreeWalker();
     1599
     1600    // FIXME(94905): ShadowHost should be reattached during recalcStyle.
     1601    // Set some flag here and recreate shadow hosts' renderer in
     1602    // Element::recalcStyle.
     1603    if (attached())
     1604        lazyReattach();
     1605
     1606    InspectorInstrumentation::didPushShadowRoot(this, shadowRoot);
     1607}
     1608
     1609void Element::removeShadowRoot()
     1610{
     1611    RefPtr<ShadowRoot> oldRoot = shadowRoot();
     1612    if (!oldRoot)
     1613        return;
     1614    InspectorInstrumentation::willPopShadowRoot(this, oldRoot.get());
     1615    document()->removeFocusedNodeOfSubtree(oldRoot.get());
     1616
     1617    if (oldRoot->attached())
     1618        oldRoot->detach(Element::AttachContext());
     1619
     1620    elementRareData()->clearShadowRoot();
     1621
     1622    oldRoot->setParentOrShadowHostNode(0);
     1623    oldRoot->setParentTreeScope(document());
     1624
     1625    ChildNodeRemovalNotifier(this).notify(oldRoot.get());
     1626
     1627    oldRoot->distributor().invalidateDistribution(this);
    15861628}
    15871629
     
    15921634
    15931635#if ENABLE(SHADOW_DOM)
    1594     if (RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled())
    1595         return ensureShadow().addShadowRoot(this, ShadowRoot::AuthorShadowRoot);
     1636    if (RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled()) {
     1637        addShadowRoot(ShadowRoot::create(document(), ShadowRoot::AuthorShadowRoot));
     1638        return shadowRoot();
     1639    }
    15961640#endif
    15971641
     
    16031647        return 0;
    16041648    }
    1605     return ensureShadow().addShadowRoot(this, ShadowRoot::AuthorShadowRoot);
     1649    addShadowRoot(ShadowRoot::create(document(), ShadowRoot::AuthorShadowRoot));
     1650
     1651    return shadowRoot();
    16061652}
    16071653
    16081654ShadowRoot* Element::authorShadowRoot() const
    16091655{
    1610     ElementShadow* elementShadow = shadow();
    1611     if (!elementShadow)
    1612         return 0;
    1613     ShadowRoot* shadowRoot = elementShadow->shadowRoot();
     1656    ShadowRoot* shadowRoot = this->shadowRoot();
    16141657    if (shadowRoot->type() == ShadowRoot::AuthorShadowRoot)
    16151658        return shadowRoot;
     
    16191662ShadowRoot* Element::userAgentShadowRoot() const
    16201663{
    1621     if (ElementShadow* elementShadow = shadow()) {
    1622         if (ShadowRoot* shadowRoot = elementShadow->shadowRoot()) {
    1623             ASSERT(shadowRoot->type() == ShadowRoot::UserAgentShadowRoot);
    1624             return shadowRoot;
    1625         }
    1626     }
    1627 
     1664    if (ShadowRoot* shadowRoot = this->shadowRoot()) {
     1665        ASSERT(shadowRoot->type() == ShadowRoot::UserAgentShadowRoot);
     1666        return shadowRoot;
     1667    }
    16281668    return 0;
    16291669}
     
    16331673    ShadowRoot* shadowRoot = userAgentShadowRoot();
    16341674    if (!shadowRoot) {
    1635         shadowRoot = ensureShadow().addShadowRoot(this, ShadowRoot::UserAgentShadowRoot);
     1675        addShadowRoot(ShadowRoot::create(document(), ShadowRoot::UserAgentShadowRoot));
     1676        shadowRoot = userAgentShadowRoot();
    16361677        didAddUserAgentShadowRoot(shadowRoot);
    16371678    }
     
    17561797        checkForSiblingStyleChanges(this, renderStyle(), false, beforeChange, afterChange, childCountDelta);
    17571798
    1758     if (ElementShadow * shadow = this->shadow())
    1759         shadow->invalidateDistribution();
     1799    if (ShadowRoot* shadowRoot = this->shadowRoot())
     1800        shadowRoot->invalidateDistribution();
    17601801}
    17611802
     
    17631804{
    17641805    ContainerNode::removeAllEventListeners();
    1765     if (ElementShadow* shadow = this->shadow())
    1766         shadow->removeAllEventListeners();
     1806    if (ShadowRoot* shadowRoot = this->shadowRoot())
     1807        shadowRoot->removeAllEventListeners();
    17671808}
    17681809
  • trunk/Source/WebCore/dom/Element.h

    r154054 r154106  
    4444class Element;
    4545class ElementRareData;
    46 class ElementShadow;
    4746class HTMLDocument;
    4847class ShareableElementData;
     
    433432    void didAffectSelector(AffectedSelectorMask);
    434433
    435     ElementShadow* shadow() const;
    436     ElementShadow& ensureShadow();
     434    ShadowRoot* shadowRoot() const;
    437435    PassRefPtr<ShadowRoot> createShadowRoot(ExceptionCode&);
    438436    ShadowRoot* authorShadowRoot() const;
     
    764762    virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
    765763
    766     QualifiedName m_tagName;
     764    void addShadowRoot(PassRefPtr<ShadowRoot>);
     765    void removeShadowRoot();
     766
    767767    bool rareDataStyleAffectedByEmpty() const;
    768768    bool rareDataChildrenAffectedByHover() const;
     
    795795    bool isJavaScriptURLAttribute(const Attribute&) const;
    796796
     797    QualifiedName m_tagName;
    797798    RefPtr<ElementData> m_elementData;
    798799};
    799    
     800
    800801inline Element* toElement(Node* node)
    801802{
     
    963964inline bool isShadowHost(const Node* node)
    964965{
    965     return node && node->isElementNode() && toElement(node)->shadow();
     966    return node && node->isElementNode() && toElement(node)->shadowRoot();
    966967}
    967968
  • trunk/Source/WebCore/dom/ElementRareData.h

    r153926 r154106  
    2525#include "ClassList.h"
    2626#include "DatasetDOMStringMap.h"
    27 #include "ElementShadow.h"
    2827#include "NamedNodeMap.h"
    2928#include "NodeRareData.h"
    3029#include "PseudoElement.h"
     30#include "ShadowRoot.h"
    3131#include "StyleInheritedData.h"
    3232#include <wtf/OwnPtr.h>
     
    9797    void setChildIndex(unsigned index) { m_childIndex = index; }
    9898
    99     void clearShadow() { m_shadow = nullptr; }
    100     ElementShadow* shadow() const { return m_shadow.get(); }
    101     ElementShadow& ensureShadow()
    102     {
    103         if (!m_shadow)
    104             m_shadow = ElementShadow::create();
    105         return *m_shadow;
    106     }
     99    void clearShadowRoot() { m_shadowRoot = nullptr; }
     100    ShadowRoot* shadowRoot() const { return m_shadowRoot.get(); }
     101    void setShadowRoot(PassRefPtr<ShadowRoot> shadowRoot) { m_shadowRoot = shadowRoot; }
    107102
    108103    NamedNodeMap* attributeMap() const { return m_attributeMap.get(); }
     
    172167    OwnPtr<DatasetDOMStringMap> m_dataset;
    173168    OwnPtr<ClassList> m_classList;
    174     OwnPtr<ElementShadow> m_shadow;
     169    RefPtr<ShadowRoot> m_shadowRoot;
    175170    OwnPtr<NamedNodeMap> m_attributeMap;
    176171
     
    220215inline ElementRareData::~ElementRareData()
    221216{
    222     ASSERT(!m_shadow);
     217    ASSERT(!m_shadowRoot);
    223218    ASSERT(!m_generatedBefore);
    224219    ASSERT(!m_generatedAfter);
  • trunk/Source/WebCore/dom/EventDispatcher.cpp

    r150714 r154106  
    2828
    2929#include "ContainerNode.h"
    30 #include "ElementShadow.h"
    3130#include "EventContext.h"
    3231#include "EventDispatchMediator.h"
  • trunk/Source/WebCore/dom/EventPathWalker.cpp

    r149628 r154106  
    5353    ASSERT(m_node);
    5454    ASSERT(m_distributedNode);
    55     if (ElementShadow* shadow = shadowOfParent(m_node)) {
    56         if (InsertionPoint* insertionPoint = shadow->distributor().findInsertionPointFor(m_distributedNode)) {
     55    if (ShadowRoot* shadowRoot = m_node->parentElement() ? m_node->parentElement()->shadowRoot() : 0) {
     56        if (InsertionPoint* insertionPoint = shadowRoot->distributor().findInsertionPointFor(m_distributedNode)) {
    5757            m_node = insertionPoint;
    5858            m_isVisitingInsertionPointInReprojection = true;
  • trunk/Source/WebCore/dom/Node.cpp

    r154047 r154106  
    5050#include "Element.h"
    5151#include "ElementRareData.h"
    52 #include "ElementShadow.h"
    5352#include "ElementTraversal.h"
    5453#include "Event.h"
     
    10491048bool Node::needsShadowTreeWalkerSlow() const
    10501049{
    1051     return (isShadowRoot() || (isElementNode() && (isInsertionPoint() || isPseudoElement() || toElement(this)->hasPseudoElements() || toElement(this)->shadow())));
     1050    return (isShadowRoot() || (isElementNode() && (isInsertionPoint() || isPseudoElement() || toElement(this)->hasPseudoElements() || toElement(this)->shadowRoot())));
    10521051}
    10531052
  • trunk/Source/WebCore/dom/NodeRenderingContext.cpp

    r154047 r154106  
    2929#include "ContainerNode.h"
    3030#include "ContentDistributor.h"
    31 #include "ElementShadow.h"
    3231#include "FlowThreadController.h"
    3332#include "HTMLContentElement.h"
  • trunk/Source/WebCore/dom/NodeRenderingContext.h

    r154047 r154106  
    4242class RenderObject;
    4343class RenderStyle;
    44 class ElementShadow;
    4544
    4645class NodeRenderingContext {
  • trunk/Source/WebCore/dom/ShadowRoot.cpp

    r154047 r154106  
    2929
    3030#include "ContentDistributor.h"
    31 #include "ElementShadow.h"
    3231#include "ElementTraversal.h"
    3332#include "HistogramSupport.h"
     
    4241struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope {
    4342    unsigned countersAndFlags[1];
     43    ContentDistributor distributor;
    4444};
    4545
     
    149149void ShadowRoot::attach(const Element::AttachContext& context)
    150150{
     151    if (attached())
     152        return;
    151153    StyleResolver& styleResolver = document()->ensureStyleResolver();
    152154    styleResolver.pushParentShadowRoot(this);
     
    160162        }
    161163        if (child->isElementNode())
    162             toElement(child)->attach(context);
     164            toElement(child)->attach(childrenContext);
    163165    }
    164166
     
    171173void ShadowRoot::detach(const Element::AttachContext& context)
    172174{
     175    if (!attached())
     176        return;
    173177    Element::AttachContext childrenContext(context);
    174178    childrenContext.resolvedStyle = 0;
     
    191195
    192196    ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    193     owner()->invalidateDistribution();
     197    invalidateDistribution();
    194198}
    195199
     
    207211}
    208212
    209 }
     213void ShadowRoot::removeAllEventListeners()
     214{
     215    DocumentFragment::removeAllEventListeners();
     216    for (Node* node = firstChild(); node; node = NodeTraversal::next(node))
     217        node->removeAllEventListeners();
     218}
     219
     220}
  • trunk/Source/WebCore/dom/ShadowRoot.h

    r154047 r154106  
    2929
    3030#include "ContainerNode.h"
     31#include "ContentDistributor.h"
    3132#include "Document.h"
    3233#include "DocumentFragment.h"
     
    3637
    3738namespace WebCore {
    38 
    39 class ElementShadow;
    4039
    4140class ShadowRoot FINAL : public DocumentFragment, public TreeScope {
     
    6362
    6463    Element* host() const { return toElement(parentOrShadowHostNode()); }
    65     ElementShadow* owner() const { return host() ? host()->shadow() : 0; }
    6664
    6765    String innerHTML() const;
     
    7977
    8078    PassRefPtr<Node> cloneNode(bool, ExceptionCode&);
     79
     80    ContentDistributor& distributor() { return m_distributor; }
     81    void invalidateDistribution() { m_distributor.invalidateDistribution(host()); }
     82
     83    void removeAllEventListeners();
    8184
    8285private:
     
    97100    unsigned m_resetStyleInheritance : 1;
    98101    unsigned m_type : 1;
     102
     103    ContentDistributor m_distributor;
    99104};
    100105
     
    115120}
    116121
     122inline ShadowRoot* Node::shadowRoot() const
     123{
     124    if (!isElementNode())
     125        return 0;
     126    return toElement(this)->shadowRoot();
     127}
     128
    117129} // namespace
    118130
  • trunk/Source/WebCore/dom/TreeScopeAdopter.cpp

    r149549 r154106  
    2929#include "Document.h"
    3030#include "ElementRareData.h"
    31 #include "ElementShadow.h"
    3231#include "NodeRareData.h"
    3332#include "NodeTraversal.h"
  • trunk/Source/WebCore/html/ColorInputType.cpp

    r153541 r154106  
    3636#include "Chrome.h"
    3737#include "Color.h"
    38 #include "ElementShadow.h"
    3938#include "HTMLDataListElement.h"
    4039#include "HTMLDivElement.h"
     
    118117void ColorInputType::createShadowSubtree()
    119118{
    120     ASSERT(element()->shadow());
     119    ASSERT(element()->shadowRoot());
    121120
    122121    Document* document = element()->document();
  • trunk/Source/WebCore/html/FileInputType.cpp

    r150805 r154106  
    2525#include "Chrome.h"
    2626#include "DragData.h"
    27 #include "ElementShadow.h"
    2827#include "Event.h"
    2928#include "File.h"
     
    314313void FileInputType::createShadowSubtree()
    315314{
    316     ASSERT(element()->shadow());
     315    ASSERT(element()->shadowRoot());
    317316    element()->userAgentShadowRoot()->appendChild(element()->multiple() ? UploadButtonElement::createForMultiple(element()->document()): UploadButtonElement::create(element()->document()), IGNORE_EXCEPTION);
    318317}
     
    320319void FileInputType::disabledAttributeChanged()
    321320{
    322     ASSERT(element()->shadow());
     321    ASSERT(element()->shadowRoot());
    323322    UploadButtonElement* button = static_cast<UploadButtonElement*>(element()->userAgentShadowRoot()->firstChild());
    324323    if (button)
     
    328327void FileInputType::multipleAttributeChanged()
    329328{
    330     ASSERT(element()->shadow());
     329    ASSERT(element()->shadowRoot());
    331330    UploadButtonElement* button = static_cast<UploadButtonElement*>(element()->userAgentShadowRoot()->firstChild());
    332331    if (button)
  • trunk/Source/WebCore/html/HTMLFormControlElement.cpp

    r153783 r154106  
    2727
    2828#include "Attribute.h"
    29 #include "ElementShadow.h"
    3029#include "Event.h"
    3130#include "EventHandler.h"
  • trunk/Source/WebCore/html/HTMLImageElement.cpp

    r153970 r154106  
    179179bool HTMLImageElement::canStartSelection() const
    180180{
    181     if (shadow())
     181    if (shadowRoot())
    182182        return HTMLElement::canStartSelection();
    183183
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r153826 r154106  
    3636#include "Document.h"
    3737#include "Editor.h"
    38 #include "ElementShadow.h"
    3938#include "EventNames.h"
    4039#include "ExceptionCode.h"
     
    536535    }
    537536
    538     if (ElementShadow* elementShadow = shadowOfParentForDistribution(this))
    539         elementShadow->invalidateDistribution();
     537    if (ShadowRoot* shadowRoot = shadowRootOfParentForDistribution(this))
     538        shadowRoot->invalidateDistribution();
    540539
    541540    setChangedSinceLastFormControlChangeEvent(false);
  • trunk/Source/WebCore/html/HTMLKeygenElement.cpp

    r153926 r154106  
    2828#include "Attribute.h"
    2929#include "Document.h"
    30 #include "ElementShadow.h"
    3130#include "FormDataList.h"
    3231#include "HTMLNames.h"
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r153942 r154106  
    4141#include "DiagnosticLoggingKeys.h"
    4242#include "DocumentLoader.h"
    43 #include "ElementShadow.h"
    4443#include "ElementTraversal.h"
    4544#include "Event.h"
  • trunk/Source/WebCore/html/HTMLTextAreaElement.cpp

    r151282 r154106  
    3232#include "Document.h"
    3333#include "Editor.h"
    34 #include "ElementShadow.h"
    3534#include "Event.h"
    3635#include "EventHandler.h"
  • trunk/Source/WebCore/html/InputType.cpp

    r153647 r154106  
    3838#include "DateTimeInputType.h"
    3939#include "DateTimeLocalInputType.h"
    40 #include "ElementShadow.h"
    4140#include "EmailInputType.h"
    4241#include "ExceptionCode.h"
  • trunk/Source/WebCore/html/RangeInputType.cpp

    r151719 r154106  
    3434
    3535#include "AXObjectCache.h"
    36 #include "ElementShadow.h"
    3736#include "ExceptionCodePlaceholder.h"
    3837#include "HTMLDivElement.h"
     
    159158    if (event->button() != LeftButton || !targetNode)
    160159        return;
    161     ASSERT(element()->shadow());
     160    ASSERT(element()->shadowRoot());
    162161    if (targetNode != element() && !targetNode->isDescendantOf(element()->userAgentShadowRoot()))
    163162        return;
     
    257256void RangeInputType::createShadowSubtree()
    258257{
    259     ASSERT(element()->shadow());
     258    ASSERT(element()->shadowRoot());
    260259
    261260    Document* document = element()->document();
  • trunk/Source/WebCore/html/TextFieldInputType.cpp

    r150140 r154106  
    3636#include "Chrome.h"
    3737#include "Editor.h"
    38 #include "ElementShadow.h"
    3938#include "FormDataList.h"
    4039#include "Frame.h"
     
    226225void TextFieldInputType::createShadowSubtree()
    227226{
    228     ASSERT(element()->shadow());
     227    ASSERT(element()->shadowRoot());
    229228
    230229    ASSERT(!m_innerText);
  • trunk/Source/WebCore/html/ValidationMessage.cpp

    r153927 r154106  
    3434#include "CSSPropertyNames.h"
    3535#include "CSSValueKeywords.h"
    36 #include "ElementShadow.h"
    3736#include "ExceptionCodePlaceholder.h"
    3837#include "HTMLBRElement.h"
  • trunk/Source/WebCore/html/shadow/ContentDistributor.cpp

    r154047 r154106  
    2828#include "ContentDistributor.h"
    2929
    30 #include "ElementShadow.h"
    3130#include "ElementTraversal.h"
    3231#include "HTMLContentElement.h"
     
    7776    ASSERT(needsDistribution());
    7877    ASSERT(m_nodeToInsertionPoint.isEmpty());
    79     ASSERT(!host->containingShadowRoot() || host->containingShadowRoot()->owner()->distributor().isValid());
     78    ASSERT(!host->containingShadowRoot() || host->containingShadowRoot()->distributor().isValid());
    8079
    8180    m_validity = Valid;
     
    131130    ASSERT(shadowRoot);
    132131
    133     Vector<ElementShadow*, 8> elementShadows;
     132    Vector<ShadowRoot*, 8> shadowRoots;
    134133    for (Element* current = shadowRoot->host(); current; current = current->shadowHost()) {
    135         ElementShadow* elementShadow = current->shadow();
    136         if (!elementShadow->distributor().needsDistribution())
     134        ShadowRoot* currentRoot = current->shadowRoot();
     135        if (!currentRoot->distributor().needsDistribution())
    137136            break;
    138 
    139         elementShadows.append(elementShadow);
     137        shadowRoots.append(currentRoot);
    140138    }
    141139
    142     for (size_t i = elementShadows.size(); i > 0; --i)
    143         elementShadows[i - 1]->distributor().distribute(elementShadows[i - 1]->host());
     140    for (size_t i = shadowRoots.size(); i > 0; --i)
     141        shadowRoots[i - 1]->distributor().distribute(shadowRoots[i - 1]->host());
    144142}
    145 
    146143
    147144void ContentDistributor::invalidateDistribution(Element* host)
  • trunk/Source/WebCore/html/shadow/ContentDistributor.h

    r150480 r154106  
    6868
    6969    static void ensureDistribution(ShadowRoot*);
     70    void distribute(Element* host);
     71    bool needsDistribution() const;
    7072
    7173private:
    7274    const Vector<RefPtr<InsertionPoint> >& ensureInsertionPointList(ShadowRoot*);
    7375
    74     void distribute(Element* host);
    7576    bool invalidate(Element* host);
    7677
    7778    void setValidity(Validity validity) { m_validity = validity; }
    7879    bool isValid() const { return m_validity == Valid; }
    79     bool needsDistribution() const;
    8080    bool needsInvalidation() const { return m_validity != Invalidated; }
    8181
  • trunk/Source/WebCore/html/shadow/InsertionPoint.cpp

    r154047 r154106  
    3232#include "InsertionPoint.h"
    3333
    34 #include "ElementShadow.h"
    3534#include "HTMLNames.h"
    3635#include "QualifiedName.h"
     
    119118    HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    120119    if (ShadowRoot* root = containingShadowRoot())
    121         if (ElementShadow* rootOwner = root->owner())
    122             rootOwner->invalidateDistribution();
     120        root->invalidateDistribution();
    123121}
    124122
     
    128126
    129127    if (ShadowRoot* root = containingShadowRoot()) {
    130         if (ElementShadow* rootOwner = root->owner()) {
    131             rootOwner->distributor().didShadowBoundaryChange(root->host());
    132             rootOwner->distributor().invalidateInsertionPointList();
    133         }
     128        root->distributor().didShadowBoundaryChange(root->host());
     129        root->distributor().invalidateInsertionPointList();
    134130    }
    135131
     
    143139        root = insertionPoint->containingShadowRoot();
    144140
    145     // host can be null when removedFrom() is called from ElementShadow destructor.
    146     ElementShadow* rootOwner = root ? root->owner() : 0;
    147     if (rootOwner) {
    148         rootOwner->invalidateDistribution();
    149         rootOwner->distributor().invalidateInsertionPointList();
     141    if (root && root->host()) {
     142        root->invalidateDistribution();
     143        root->distributor().invalidateInsertionPointList();
    150144    }
    151145
     
    218212InsertionPoint* resolveReprojection(const Node* projectedNode)
    219213{
    220     if (ElementShadow* shadow = shadowOfParentForDistribution(projectedNode)) {
     214    if (ShadowRoot* shadowRoot = shadowRootOfParentForDistribution(projectedNode)) {
    221215        if (ShadowRoot* root = projectedNode->containingShadowRoot())
    222216            ContentDistributor::ensureDistribution(root);
    223         return shadow->distributor().findInsertionPointFor(projectedNode);
     217        return shadowRoot->distributor().findInsertionPointFor(projectedNode);
    224218    }
    225219    return 0;
  • trunk/Source/WebCore/html/shadow/InsertionPoint.h

    r151282 r154106  
    3333
    3434#include "ContentDistributor.h"
    35 #include "ElementShadow.h"
    3635#include "HTMLElement.h"
    3736#include "HTMLNames.h"
     
    138137}
    139138
    140 inline ElementShadow* shadowOfParentForDistribution(const Node* node)
     139inline ShadowRoot* shadowRootOfParentForDistribution(const Node* node)
    141140{
    142141    ASSERT(node);
    143142    if (Element* parent = parentElementForDistribution(node))
    144         return parent->shadow();
     143        return parent->shadowRoot();
    145144
    146145    return 0;
  • trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp

    r151947 r154106  
    3535
    3636#include "CSSValueKeywords.h"
    37 #include "ElementShadow.h"
    3837#include "Event.h"
    3938#include "EventHandler.h"
  • trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp

    r153826 r154106  
    5454#include "DocumentType.h"
    5555#include "Element.h"
    56 #include "ElementShadow.h"
    5756#include "Event.h"
    5857#include "EventContext.h"
     
    358357
    359358    if (node->isElementNode()) {
    360         if (ElementShadow* shadow = toElement(node)->shadow()) {
    361             if (ShadowRoot* root = shadow->shadowRoot())
    362                 unbind(root, nodesMap);
    363         }
     359        if (ShadowRoot* root = toElement(node)->shadowRoot())
     360            unbind(root, nodesMap);
    364361    }
    365362
     
    14161413        }
    14171414
    1418         ElementShadow* shadow = element->shadow();
    1419         if (shadow) {
     1415        if (ShadowRoot* root = element->shadowRoot()) {
    14201416            RefPtr<TypeBuilder::Array<TypeBuilder::DOM::Node> > shadowRoots = TypeBuilder::Array<TypeBuilder::DOM::Node>::create();
    1421             if (ShadowRoot* root = shadow->shadowRoot())
    1422                 shadowRoots->addItem(buildObjectForNode(root, 0, nodesMap));
     1417            shadowRoots->addItem(buildObjectForNode(root, 0, nodesMap));
    14231418            value->setShadowRoots(shadowRoots);
    14241419        }
  • trunk/Source/WebCore/page/FocusController.cpp

    r153939 r154106  
    3434#include "EditorClient.h"
    3535#include "Element.h"
    36 #include "ElementShadow.h"
    3736#include "ElementTraversal.h"
    3837#include "Event.h"
     
    104103{
    105104    ASSERT(isShadowHost(node));
    106     return FocusNavigationScope(toElement(node)->shadow()->shadowRoot());
     105    return FocusNavigationScope(toElement(node)->shadowRoot());
    107106}
    108107
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp

    r152149 r154106  
    2222#include "RenderFileUploadControl.h"
    2323
    24 #include "ElementShadow.h"
    2524#include "FileList.h"
    2625#include "Font.h"
     
    229228    HTMLInputElement* input = toHTMLInputElement(node());
    230229
    231     ASSERT(input->shadow());
    232 
    233     Node* buttonNode = input->shadow()->shadowRoot()->firstChild();
     230    ASSERT(input->shadowRoot());
     231
     232    Node* buttonNode = input->shadowRoot()->firstChild();
    234233    return buttonNode && buttonNode->isHTMLElement() && isHTMLInputElement(buttonNode) ? toHTMLInputElement(buttonNode) : 0;
    235234}
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r152208 r154106  
    5656
    5757#if ENABLE(DATALIST_ELEMENT)
    58 #include "ElementShadow.h"
    5958#include "HTMLCollection.h"
    6059#include "HTMLDataListElement.h"
  • trunk/Source/WebCore/style/StyleResolveTree.cpp

    r154047 r154106  
    241241        RenderStyle* currentStyle = current->renderStyle();
    242242
    243         if (ElementShadow* shadow = current->shadow()) {
    244             if (change >= Inherit || shadow->childNeedsStyleRecalc() || shadow->needsStyleRecalc()) {
     243        if (ShadowRoot* shadowRoot = current->shadowRoot()) {
     244            if (change >= Inherit || shadowRoot->childNeedsStyleRecalc() || shadowRoot->needsStyleRecalc()) {
    245245                parentPusher.push();
    246                 resolveShadowTree(shadow->shadowRoot(), currentStyle, change);
     246                resolveShadowTree(shadowRoot, currentStyle, change);
    247247            }
    248248        }
  • trunk/Source/WebCore/svg/SVGTRefElement.cpp

    r151800 r154106  
    2525#include "SVGTRefElement.h"
    2626
    27 #include "ElementShadow.h"
    2827#include "EventListener.h"
    2928#include "EventNames.h"
     
    151150        textContent = target->textContent();
    152151
    153     ASSERT(shadow());
    154     ShadowRoot* root = shadow()->shadowRoot();
     152    ASSERT(shadowRoot());
     153    ShadowRoot* root = shadowRoot();
    155154    if (!root->firstChild())
    156155        root->appendChild(Text::create(document(), textContent), ASSERT_NO_EXCEPTION);
     
    168167    String emptyContent;
    169168
    170     ASSERT(shadow());
    171     Node* container = shadow()->shadowRoot()->firstChild();
     169    ASSERT(shadowRoot());
     170    Node* container = shadowRoot()->firstChild();
    172171    if (container)
    173172        container->setTextContent(emptyContent, IGNORE_EXCEPTION);
  • trunk/Source/WebCore/svg/SVGUseElement.cpp

    r153939 r154106  
    3333#include "CachedSVGDocument.h"
    3434#include "Document.h"
    35 #include "ElementShadow.h"
    3635#include "ElementTraversal.h"
    3736#include "Event.h"
     
    389388{
    390389    // FIXME: We should try to optimize this, to at least allow partial reclones.
    391     if (ShadowRoot* shadowTreeRootElement = shadow()->shadowRoot())
     390    if (ShadowRoot* shadowTreeRootElement = shadowRoot())
    392391        shadowTreeRootElement->removeChildren();
    393392
     
    481480    ASSERT(m_targetElementInstance->correspondingElement() == target);
    482481
    483     ShadowRoot* shadowTreeRootElement = shadow()->shadowRoot();
     482    ShadowRoot* shadowTreeRootElement = shadowRoot();
    484483    ASSERT(shadowTreeRootElement);
    485484
     
    703702        removeDisallowedElementsFromSubtree(newChild.get());
    704703
    705     shadow()->shadowRoot()->appendChild(newChild.release());
     704    shadowRoot()->appendChild(newChild.release());
    706705}
    707706
  • trunk/Source/WebCore/testing/Internals.cpp

    r153838 r154106  
    4545#include "Editor.h"
    4646#include "Element.h"
    47 #include "ElementShadow.h"
    4847#include "EventHandler.h"
    4948#include "ExceptionCode.h"
     
    628627    }
    629628
    630     if (ElementShadow* shadow = host->shadow())
    631         return shadow->shadowRoot();
     629    if (ShadowRoot* shadowRoot = host->shadowRoot())
     630        return shadowRoot;
    632631
    633632    return host->createShadowRoot(ec).get();
     
    649648        return 0;
    650649    }
    651     if (ElementShadow* shadow = host->shadow())
    652         return shadow->shadowRoot();
    653     return 0;
     650    return host->shadowRoot();
    654651}
    655652
  • trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in

    r154102 r154106  
    303303        symbolWithPointer(?settings@Document@WebCore@@QBEPAVSettings@2@XZ, ?settings@Document@WebCore@@QEBAPEAVSettings@2@XZ)
    304304        symbolWithPointer(?settings@Frame@WebCore@@QBEPAVSettings@2@XZ, ?settings@Frame@WebCore@@QEBAPEAVSettings@2@XZ)
    305         symbolWithPointer(?shadow@Element@WebCore@@QBEPAVElementShadow@2@XZ, ?shadow@Element@WebCore@@QEBAPEAVElementShadow@2@XZ)
    306305        symbolWithPointer(?substring@String@WTF@@QBE?AV12@II@Z, ?substring@String@WTF@@QEBA?AV12@II@Z)
    307306        symbolWithPointer(?suggestedValue@HTMLInputElement@WebCore@@QBEABVString@WTF@@XZ, ?suggestedValue@HTMLInputElement@WebCore@@QEBAAEBVString@WTF@@XZ)
  • trunk/Source/WebKit/blackberry/WebCoreSupport/SuggestionBoxHandler.cpp

    r144063 r154106  
    3636#include "CSSValueKeywords.h"
    3737#include "DOMTokenList.h"
    38 #include "ElementShadow.h"
    3938#include "ExceptionCodePlaceholder.h"
    4039#include "HTMLCollection.h"
Note: See TracChangeset for help on using the changeset viewer.