Remove InsertionPoint and ContentDistributor
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Oct 2015 07:18:58 +0000 (07:18 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Oct 2015 07:18:58 +0000 (07:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150004

Rubber-stamped by Sam Weinig.

Now that <details> is on top of the modern Shadow DOM remove the last vestiges of the V0 Shadow DOM API.

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* css/SelectorChecker.cpp:
* css/StyleResolver.cpp:
* dom/ContainerNode.cpp:
* dom/Element.cpp:
(WebCore::shouldUseNodeRenderingTraversalSlowPath):
(WebCore::Element::resetNeedsNodeRenderingTraversalSlowPath):
* dom/Node.cpp:
(WebCore::Node::parentOrShadowHostElement):
(WebCore::Node::insertedInto):
(WebCore::Node::insertionParentForBinding): Deleted.
* dom/Node.h:
(WebCore::Node::isCharacterDataNode):
(WebCore::Node::isFrameOwnerElement):
(WebCore::Node::isPluginElement):
(WebCore::Node::isImageControlsRootElement):
(WebCore::Node::isImageControlsButtonElement):
(WebCore::Node::isDocumentFragment):
(WebCore::Node::isShadowRoot):
(WebCore::Node::isInsertionPointNode): Deleted.
(WebCore::Node::isInsertionPoint): Deleted.
* dom/NodeRenderingTraversal.cpp:
(WebCore::NodeRenderingTraversal::traverseParent):
(WebCore::NodeRenderingTraversal::traverseFirstChild):
(WebCore::NodeRenderingTraversal::traverseLastChild):
(WebCore::NodeRenderingTraversal::traverseNextSibling):
(WebCore::NodeRenderingTraversal::traversePreviousSibling):
(WebCore::NodeRenderingTraversal::parentSlow):
(WebCore::NodeRenderingTraversal::nextInScope):
(WebCore::NodeRenderingTraversal::previousInScope):
(WebCore::NodeRenderingTraversal::parentInScope):
(WebCore::NodeRenderingTraversal::lastChildInScope):
(WebCore::NodeRenderingTraversal::nodeCanBeDistributed): Deleted.
(WebCore::NodeRenderingTraversal::findFirstSiblingEnteringInsertionPoints): Deleted.
(WebCore::NodeRenderingTraversal::findFirstEnteringInsertionPoints): Deleted.
(WebCore::NodeRenderingTraversal::findFirstFromDistributedNode): Deleted.
(WebCore::NodeRenderingTraversal::findLastSiblingEnteringInsertionPoints): Deleted.
(WebCore::NodeRenderingTraversal::findLastEnteringInsertionPoints): Deleted.
(WebCore::NodeRenderingTraversal::findLastFromDistributedNode): Deleted.
* dom/ShadowRoot.h:
(WebCore::ShadowRoot::distributor): Deleted.
* html/HTMLInputElement.cpp:
* html/HTMLSlotElement.cpp:
* html/HTMLSlotElement.h:
* html/shadow/ContentDistributor.cpp: Removed.
* html/shadow/ContentDistributor.h: Removed.
* html/shadow/InsertionPoint.cpp: Removed.
* html/shadow/InsertionPoint.h: Removed.
* page/FocusController.cpp:
(WebCore::FocusController::previousFocusableElement):
* testing/Internals.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190845 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/dom/NodeRenderingTraversal.cpp
Source/WebCore/dom/ShadowRoot.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLSlotElement.cpp
Source/WebCore/html/HTMLSlotElement.h
Source/WebCore/html/shadow/ContentDistributor.cpp [deleted file]
Source/WebCore/html/shadow/ContentDistributor.h [deleted file]
Source/WebCore/html/shadow/InsertionPoint.cpp [deleted file]
Source/WebCore/html/shadow/InsertionPoint.h [deleted file]
Source/WebCore/page/FocusController.cpp
Source/WebCore/testing/Internals.cpp

index bac8f02..8240874 100644 (file)
@@ -1843,9 +1843,7 @@ set(WebCore_SOURCES
     html/parser/XSSAuditorDelegate.cpp
 
     html/shadow/AutoFillButtonElement.cpp
-    html/shadow/ContentDistributor.cpp
     html/shadow/DetailsMarkerControl.cpp
-    html/shadow/InsertionPoint.cpp
     html/shadow/MediaControlElementTypes.cpp
     html/shadow/MediaControlElements.cpp
     html/shadow/MediaControls.cpp
index b1baf2a..2a46791 100644 (file)
@@ -1,3 +1,66 @@
+2015-10-10  Antti Koivisto  <antti@apple.com>
+
+        Remove InsertionPoint and ContentDistributor
+        https://bugs.webkit.org/show_bug.cgi?id=150004
+
+        Rubber-stamped by Sam Weinig.
+
+        Now that <details> is on top of the modern Shadow DOM remove the last vestiges of the V0 Shadow DOM API.
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/SelectorChecker.cpp:
+        * css/StyleResolver.cpp:
+        * dom/ContainerNode.cpp:
+        * dom/Element.cpp:
+        (WebCore::shouldUseNodeRenderingTraversalSlowPath):
+        (WebCore::Element::resetNeedsNodeRenderingTraversalSlowPath):
+        * dom/Node.cpp:
+        (WebCore::Node::parentOrShadowHostElement):
+        (WebCore::Node::insertedInto):
+        (WebCore::Node::insertionParentForBinding): Deleted.
+        * dom/Node.h:
+        (WebCore::Node::isCharacterDataNode):
+        (WebCore::Node::isFrameOwnerElement):
+        (WebCore::Node::isPluginElement):
+        (WebCore::Node::isImageControlsRootElement):
+        (WebCore::Node::isImageControlsButtonElement):
+        (WebCore::Node::isDocumentFragment):
+        (WebCore::Node::isShadowRoot):
+        (WebCore::Node::isInsertionPointNode): Deleted.
+        (WebCore::Node::isInsertionPoint): Deleted.
+        * dom/NodeRenderingTraversal.cpp:
+        (WebCore::NodeRenderingTraversal::traverseParent):
+        (WebCore::NodeRenderingTraversal::traverseFirstChild):
+        (WebCore::NodeRenderingTraversal::traverseLastChild):
+        (WebCore::NodeRenderingTraversal::traverseNextSibling):
+        (WebCore::NodeRenderingTraversal::traversePreviousSibling):
+        (WebCore::NodeRenderingTraversal::parentSlow):
+        (WebCore::NodeRenderingTraversal::nextInScope):
+        (WebCore::NodeRenderingTraversal::previousInScope):
+        (WebCore::NodeRenderingTraversal::parentInScope):
+        (WebCore::NodeRenderingTraversal::lastChildInScope):
+        (WebCore::NodeRenderingTraversal::nodeCanBeDistributed): Deleted.
+        (WebCore::NodeRenderingTraversal::findFirstSiblingEnteringInsertionPoints): Deleted.
+        (WebCore::NodeRenderingTraversal::findFirstEnteringInsertionPoints): Deleted.
+        (WebCore::NodeRenderingTraversal::findFirstFromDistributedNode): Deleted.
+        (WebCore::NodeRenderingTraversal::findLastSiblingEnteringInsertionPoints): Deleted.
+        (WebCore::NodeRenderingTraversal::findLastEnteringInsertionPoints): Deleted.
+        (WebCore::NodeRenderingTraversal::findLastFromDistributedNode): Deleted.
+        * dom/ShadowRoot.h:
+        (WebCore::ShadowRoot::distributor): Deleted.
+        * html/HTMLInputElement.cpp:
+        * html/HTMLSlotElement.cpp:
+        * html/HTMLSlotElement.h:
+        * html/shadow/ContentDistributor.cpp: Removed.
+        * html/shadow/ContentDistributor.h: Removed.
+        * html/shadow/InsertionPoint.cpp: Removed.
+        * html/shadow/InsertionPoint.h: Removed.
+        * page/FocusController.cpp:
+        (WebCore::FocusController::previousFocusableElement):
+        * testing/Internals.cpp:
+
 2015-10-10  Simon Fraser  <simon.fraser@apple.com>
 
         Use references and more const in SVGPathUtilities
index 5a7c599..3c20223 100644 (file)
     <ClCompile Include="..\html\parser\XSSAuditor.cpp" />
     <ClCompile Include="..\html\parser\XSSAuditorDelegate.cpp" />
     <ClCompile Include="..\html\shadow\AutoFillButtonElement.cpp" />
-    <ClCompile Include="..\html\shadow\ContentDistributor.cpp" />
     <ClCompile Include="..\html\shadow\DetailsMarkerControl.cpp" />
-    <ClCompile Include="..\html\shadow\InsertionPoint.cpp" />
     <ClCompile Include="..\html\shadow\MediaControlElements.cpp" />
     <ClCompile Include="..\html\shadow\MediaControlElementTypes.cpp" />
     <ClCompile Include="..\html\shadow\MediaControls.cpp" />
     <ClInclude Include="..\html\parser\XSSAuditor.h" />
     <ClInclude Include="..\html\parser\XSSAuditorDelegate.h" />
     <ClInclude Include="..\html\shadow\AutoFillButtonElement.h" />
-    <ClInclude Include="..\html\shadow\ContentDistributor.h" />
     <ClInclude Include="..\html\shadow\DetailsMarkerControl.h" />
-    <ClInclude Include="..\html\shadow\InsertionPoint.h" />
     <ClInclude Include="..\html\shadow\MediaControlElements.h" />
     <ClInclude Include="..\html\shadow\MediaControlElementTypes.h" />
     <ClInclude Include="..\html\shadow\MediaControls.h" />
index 48d5d0f..92bfe84 100644 (file)
                53EF766C16531994004CBE49 /* SettingsMacros.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 53EF766A16530A61004CBE49 /* SettingsMacros.h */; };
                550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               57B791A314C6A62900F202D1 /* ContentDistributor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57B7919F14C6A62900F202D1 /* ContentDistributor.cpp */; };
-               57B791A414C6A62900F202D1 /* ContentDistributor.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B791A014C6A62900F202D1 /* ContentDistributor.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               57CF497414EE36D700ECFF14 /* InsertionPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */; };
-               57CF497514EE36D700ECFF14 /* InsertionPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 57CF497314EE36D700ECFF14 /* InsertionPoint.h */; };
                580371611A66F00A00BAF519 /* ClipRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5803715F1A66F00A00BAF519 /* ClipRect.cpp */; };
                580371621A66F00A00BAF519 /* ClipRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 580371601A66F00A00BAF519 /* ClipRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
                580371641A66F1D300BAF519 /* LayerFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = 580371631A66F1D300BAF519 /* LayerFragment.h */; settings = {ATTRIBUTES = (Private, ); }; };
                550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; };
-               57B7919F14C6A62900F202D1 /* ContentDistributor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentDistributor.cpp; sourceTree = "<group>"; };
-               57B791A014C6A62900F202D1 /* ContentDistributor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentDistributor.h; sourceTree = "<group>"; };
-               57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InsertionPoint.cpp; sourceTree = "<group>"; };
-               57CF497314EE36D700ECFF14 /* InsertionPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InsertionPoint.h; sourceTree = "<group>"; };
                5803715F1A66F00A00BAF519 /* ClipRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClipRect.cpp; sourceTree = "<group>"; };
                580371601A66F00A00BAF519 /* ClipRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipRect.h; sourceTree = "<group>"; };
                580371631A66F1D300BAF519 /* LayerFragment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerFragment.h; sourceTree = "<group>"; };
                                51C4AA5118B28357007BFE9B /* mac */,
                                7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */,
                                7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */,
-                               57B7919F14C6A62900F202D1 /* ContentDistributor.cpp */,
-                               57B791A014C6A62900F202D1 /* ContentDistributor.h */,
                                A7C9ABF61357A3BF00F5503F /* DetailsMarkerControl.cpp */,
                                A7C9ABF71357A3BF00F5503F /* DetailsMarkerControl.h */,
                                510192D318B6B9B7007FC7A1 /* ImageControlsRootElement.cpp */,
                                510192D418B6B9B7007FC7A1 /* ImageControlsRootElement.h */,
-                               57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */,
-                               57CF497314EE36D700ECFF14 /* InsertionPoint.h */,
                                417253A81354BBBC00360F2A /* MediaControlElements.cpp */,
                                417253A91354BBBC00360F2A /* MediaControlElements.h */,
                                DE49B2FF165F2FC60010338D /* MediaControlElementTypes.cpp */,
                                A818721C0977D3C0005826D9 /* ContainerNode.h in Headers */,
                                E1A1470811102B1500EEC0F3 /* ContainerNodeAlgorithms.h in Headers */,
                                BC5EB9810E82072500B25965 /* ContentData.h in Headers */,
-                               57B791A414C6A62900F202D1 /* ContentDistributor.h in Headers */,
                                51B45D211AB8D1E200117CD2 /* ContentExtension.h in Headers */,
                                5CDFA6C81AA4F2DA00EA8746 /* ContentExtensionActions.h in Headers */,
                                7C93F34E1AA6BF0700A98BAB /* ContentExtensionCompiler.h in Headers */,
                                37E3524D12450C6600BAF5D9 /* InputType.h in Headers */,
                                C348612415FDE21E007A1CC9 /* InputTypeNames.h in Headers */,
                                93309DEA099E64920056E581 /* InsertIntoTextNodeCommand.h in Headers */,
-                               57CF497514EE36D700ECFF14 /* InsertionPoint.h in Headers */,
                                93309DEC099E64920056E581 /* InsertLineBreakCommand.h in Headers */,
                                D07DEABA0A36554A00CA30F8 /* InsertListCommand.h in Headers */,
                                93309DEE099E64920056E581 /* InsertNodeBeforeCommand.h in Headers */,
                                A818721F0977D3C0005826D9 /* ContainerNode.cpp in Sources */,
                                A7A78CD51532BA62006C21E4 /* ContainerNodeAlgorithms.cpp in Sources */,
                                BC5EB9800E82072500B25965 /* ContentData.cpp in Sources */,
-                               57B791A314C6A62900F202D1 /* ContentDistributor.cpp in Sources */,
                                51B45D201AB8D1E200117CD2 /* ContentExtension.cpp in Sources */,
                                7C93F34D1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp in Sources */,
                                7CFDC57C1AC1D80500E24A57 /* ContentExtensionError.cpp in Sources */,
                                37E3524B12450C5200BAF5D9 /* InputType.cpp in Sources */,
                                C348612315FDE21E007A1CC9 /* InputTypeNames.cpp in Sources */,
                                93309DE9099E64920056E581 /* InsertIntoTextNodeCommand.cpp in Sources */,
-                               57CF497414EE36D700ECFF14 /* InsertionPoint.cpp in Sources */,
                                93309DEB099E64920056E581 /* InsertLineBreakCommand.cpp in Sources */,
                                D07DEAB90A36554A00CA30F8 /* InsertListCommand.cpp in Sources */,
                                93309DED099E64920056E581 /* InsertNodeBeforeCommand.cpp in Sources */,
index 311b2b2..fbb3485 100644 (file)
@@ -45,7 +45,6 @@
 #include "HTMLParserIdioms.h"
 #include "HTMLProgressElement.h"
 #include "HTMLStyleElement.h"
-#include "InsertionPoint.h"
 #include "InspectorInstrumentation.h"
 #include "NodeRenderStyle.h"
 #include "Page.h"
index 11540d1..1b913c1 100644 (file)
@@ -80,7 +80,6 @@
 #include "HTMLStyleElement.h"
 #include "HTMLTableElement.h"
 #include "HTMLTextAreaElement.h"
-#include "InsertionPoint.h"
 #include "InspectorInstrumentation.h"
 #include "KeyframeList.h"
 #include "LinkHash.h"
index 30722bb..7c71c0b 100644 (file)
@@ -37,7 +37,6 @@
 #include "HTMLOptionsCollection.h"
 #include "HTMLTableRowsCollection.h"
 #include "InlineTextBox.h"
-#include "InsertionPoint.h"
 #include "JSLazyEventListener.h"
 #include "JSNode.h"
 #include "LabelsNodeList.h"
index ec79268..fbe5570 100644 (file)
@@ -55,7 +55,6 @@
 #include "HTMLSelectElement.h"
 #include "HTMLTemplateElement.h"
 #include "IdTargetObserverRegistry.h"
-#include "InsertionPoint.h"
 #include "KeyboardEvent.h"
 #include "MainFrame.h"
 #include "MutationObserverInterestGroup.h"
@@ -1622,9 +1621,7 @@ ShadowRoot* Element::shadowRoot() const
 
 static bool shouldUseNodeRenderingTraversalSlowPath(const Element& element)
 {
-    if (element.isShadowRoot())
-        return true;
-    return element.isInsertionPoint() || element.shadowRoot();
+    return element.isShadowRoot() || element.shadowRoot();
 }
 
 void Element::resetNeedsNodeRenderingTraversalSlowPath()
index aeaad00..bca30a2 100644 (file)
@@ -46,7 +46,6 @@
 #include "HTMLImageElement.h"
 #include "HTMLSlotElement.h"
 #include "HTMLStyleElement.h"
-#include "InsertionPoint.h"
 #include "InspectorController.h"
 #include "KeyboardEvent.h"
 #include "Logging.h"
@@ -1133,11 +1132,6 @@ Element* Node::parentOrShadowHostElement() const
     return downcast<Element>(parent);
 }
 
-Node* Node::insertionParentForBinding() const
-{
-    return findInsertionPointOf(this);
-}
-
 Node::InsertionNotificationRequest Node::insertedInto(ContainerNode& insertionPoint)
 {
     ASSERT(insertionPoint.inDocument() || isContainerNode());
index 3615f78..a64e0c5 100644 (file)
@@ -257,7 +257,6 @@ public:
     virtual bool isCharacterDataNode() const { return false; }
     virtual bool isFrameOwnerElement() const { return false; }
     virtual bool isPluginElement() const { return false; }
-    virtual bool isInsertionPointNode() const { return false; }
 #if ENABLE(SERVICE_CONTROLS)
     virtual bool isImageControlsRootElement() const { return false; }
     virtual bool isImageControlsButtonElement() const { return false; }
@@ -267,9 +266,6 @@ public:
     bool isTreeScope() const;
     bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); }
     bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); }
-    bool isInsertionPoint() const { return getFlag(NeedsNodeRenderingTraversalSlowPathFlag) && isInsertionPointNode(); }
-    // Returns Node rather than InsertionPoint. Should be used only for language bindings.
-    Node* insertionParentForBinding() const;
 
     bool needsNodeRenderingTraversalSlowPath() const;
 
@@ -655,7 +651,6 @@ protected:
         CreateHTMLElement = CreateStyledElement | IsHTMLFlag,
         CreateSVGElement = CreateStyledElement | IsSVGFlag | HasCustomStyleResolveCallbacksFlag,
         CreateDocument = CreateContainer | InDocumentFlag,
-        CreateInsertionPoint = CreateHTMLElement | NeedsNodeRenderingTraversalSlowPathFlag,
         CreateEditingText = CreateText | IsEditingTextFlag,
         CreateMathMLElement = CreateStyledElement | IsMathMLFlag
     };
index c509cd9..f8f2a0a 100644 (file)
 #include "config.h"
 #include "NodeRenderingTraversal.h"
 
-#include "InsertionPoint.h"
 #include "ShadowRoot.h"
 
 namespace WebCore {
 
 namespace NodeRenderingTraversal {
 
-static Node* findFirstSiblingEnteringInsertionPoints(const Node*);
-static Node* findFirstEnteringInsertionPoints(const Node*);
-static Node* findFirstFromDistributedNode(const Node*, const InsertionPoint*);
-static Node* findLastSiblingEnteringInsertionPoints(const Node*);
-static Node* findLastEnteringInsertionPoints(const Node*);
-static Node* findLastFromDistributedNode(const Node*, const InsertionPoint*);
-
-static inline bool nodeCanBeDistributed(const Node* node)
-{
-    ASSERT(node);
-    Node* parent = parentNodeForDistribution(node);
-    if (!parent)
-        return false;
-
-    if (parent->isShadowRoot())
-        return false;
-
-    if (is<Element>(*parent) && downcast<Element>(*parent).shadowRoot())
-        return true;
-    
-    return false;
-}
-
-static Node* findFirstSiblingEnteringInsertionPoints(const Node* node)
-{
-    for (const Node* sibling = node; sibling; sibling = sibling->nextSibling()) {
-        if (Node* found = findFirstEnteringInsertionPoints(sibling))
-            return found;
-    }
-    return nullptr;
-}
-
-static Node* findFirstEnteringInsertionPoints(const Node* node)
-{
-    ASSERT(node);
-    if (!isActiveInsertionPoint(node))
-        return const_cast<Node*>(node);
-    const InsertionPoint& insertionPoint = downcast<InsertionPoint>(*node);
-    if (Node* found = findFirstFromDistributedNode(insertionPoint.firstDistributed(), &insertionPoint))
-        return found;
-    return findFirstSiblingEnteringInsertionPoints(node->firstChild());
-}
-
-static Node* findFirstFromDistributedNode(const Node* node, const InsertionPoint* insertionPoint)
-{
-    for (const Node* next = node; next; next = insertionPoint->nextDistributedTo(next)) {
-        if (Node* found = findFirstEnteringInsertionPoints(next))
-            return found;
-    }
-    return nullptr;
-}
-
-static Node* findLastSiblingEnteringInsertionPoints(const Node* node)
-{
-    for (const Node* sibling = node; sibling; sibling = sibling->previousSibling()) {
-        if (Node* found = findLastEnteringInsertionPoints(sibling))
-            return found;
-    }
-    return nullptr;
-}
-
-static Node* findLastEnteringInsertionPoints(const Node* node)
-{
-    ASSERT(node);
-    if (!isActiveInsertionPoint(node))
-        return const_cast<Node*>(node);
-    const InsertionPoint& insertionPoint = downcast<InsertionPoint>(*node);
-    if (Node* found = findLastFromDistributedNode(insertionPoint.lastDistributed(), &insertionPoint))
-        return found;
-    return findLastSiblingEnteringInsertionPoints(node->lastChild());
-}
-
-static Node* findLastFromDistributedNode(const Node* node, const InsertionPoint* insertionPoint)
-{
-    for (const Node* next = node; next; next = insertionPoint->previousDistributedTo(next)) {
-        if (Node* found = findLastEnteringInsertionPoints(next))
-            return found;
-    }
-    return nullptr;
-}
-
 enum ShadowRootCrossing { CrossShadowRoot, DontCrossShadowRoot };
 
 static ContainerNode* traverseParent(const Node* node, ShadowRootCrossing shadowRootCrossing)
@@ -123,25 +41,16 @@ static ContainerNode* traverseParent(const Node* node, ShadowRootCrossing shadow
     if (shadowRootCrossing == DontCrossShadowRoot  && node->isShadowRoot())
         return nullptr;
 
-    if (nodeCanBeDistributed(node)) {
-        if (InsertionPoint* insertionPoint = findInsertionPointOf(node))
-            return traverseParent(insertionPoint, shadowRootCrossing);
-        return nullptr;
-    }
     ContainerNode* parent = node->parentNode();
+    if (parent && parent->shadowRoot())
+        return nullptr;
+
     if (!parent)
         return nullptr;
 
     if (is<ShadowRoot>(*parent))
         return shadowRootCrossing == CrossShadowRoot ? downcast<ShadowRoot>(parent)->host() : parent;
 
-    if (is<InsertionPoint>(*parent)) {
-        const InsertionPoint& insertionPoint = downcast<InsertionPoint>(*parent);
-        if (insertionPoint.hasDistribution())
-            return nullptr;
-        if (insertionPoint.isActive())
-            return traverseParent(parent, shadowRootCrossing);
-    }
     return parent;
 }
 
@@ -153,7 +62,7 @@ static Node* traverseFirstChild(const Node* node, ShadowRootCrossing shadowRootC
             return nullptr;
         node = node->shadowRoot();
     }
-    return findFirstSiblingEnteringInsertionPoints(node->firstChild());
+    return node->firstChild();
 }
 
 static Node* traverseLastChild(const Node* node, ShadowRootCrossing shadowRootCrossing)
@@ -164,51 +73,19 @@ static Node* traverseLastChild(const Node* node, ShadowRootCrossing shadowRootCr
             return nullptr;
         node = node->shadowRoot();
     }
-    return findLastSiblingEnteringInsertionPoints(node->lastChild());
+    return node->lastChild();
 }
 
 static Node* traverseNextSibling(const Node* node)
 {
     ASSERT(node);
-
-    InsertionPoint* insertionPoint;
-    if (nodeCanBeDistributed(node) && (insertionPoint = findInsertionPointOf(node))) {
-        Node* found = findFirstFromDistributedNode(insertionPoint->nextDistributedTo(node), insertionPoint);
-        if (found)
-            return found;
-        return traverseNextSibling(insertionPoint);
-    }
-
-    for (const Node* sibling = node->nextSibling(); sibling; sibling = sibling->nextSibling()) {
-        if (Node* found = findFirstEnteringInsertionPoints(sibling))
-            return found;
-    }
-    if (node->parentNode() && isActiveInsertionPoint(node->parentNode()))
-        return traverseNextSibling(node->parentNode());
-
-    return nullptr;
+    return node->nextSibling();
 }
 
 static Node* traversePreviousSibling(const Node* node)
 {
     ASSERT(node);
-
-    InsertionPoint* insertionPoint;
-    if (nodeCanBeDistributed(node) && (insertionPoint = findInsertionPointOf(node))) {
-        Node* found = findLastFromDistributedNode(insertionPoint->previousDistributedTo(node), insertionPoint);
-        if (found)
-            return found;
-        return traversePreviousSibling(insertionPoint);
-    }
-
-    for (const Node* sibling = node->previousSibling(); sibling; sibling = sibling->previousSibling()) {
-        if (Node* found = findLastEnteringInsertionPoints(sibling))
-            return found;
-    }
-    if (node->parentNode() && isActiveInsertionPoint(node->parentNode()))
-        return traversePreviousSibling(node->parentNode());
-
-    return nullptr;
+    return node->previousSibling();
 }
 
 ContainerNode* parentSlow(const Node* node)
@@ -241,8 +118,6 @@ Node* previousSiblingSlow(const Node* node)
 
 Node* nextInScope(const Node* node)
 {
-    ASSERT(!isActiveInsertionPoint(node));
-
     if (Node* next = traverseFirstChild(node, DontCrossShadowRoot))
         return next;
     if (Node* next = traverseNextSibling(node))
@@ -255,8 +130,6 @@ Node* nextInScope(const Node* node)
 
 Node* previousInScope(const Node* node)
 {
-    ASSERT(!isActiveInsertionPoint(node));
-
     if (Node* current = traversePreviousSibling(node)) {
         while (Node* child = traverseLastChild(current, DontCrossShadowRoot))
             current = child;
@@ -267,15 +140,11 @@ Node* previousInScope(const Node* node)
 
 Node* parentInScope(const Node* node)
 {
-    ASSERT(!isActiveInsertionPoint(node));
-
     return traverseParent(node, DontCrossShadowRoot);
 }
 
 Node* lastChildInScope(const Node* node)
 {
-    ASSERT(!isActiveInsertionPoint(node));
-
     return traverseLastChild(node, DontCrossShadowRoot);
 }
 
index 9b6b1c9..6b2e6e3 100644 (file)
 namespace WebCore {
 
 class AuthorStyleSheets;
-class ContentDistributor;
 class HTMLSlotElement;
 class SlotAssignment;
 
-class ShadowRoot : public DocumentFragment, public TreeScope {
+class ShadowRoot final : public DocumentFragment, public TreeScope {
 public:
     enum class Type : uint8_t {
         UserAgent = 0,
@@ -86,8 +85,6 @@ public:
 
     virtual void removeAllEventListeners() override;
 
-    virtual ContentDistributor* distributor() { return nullptr; }
-
 #if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
     HTMLSlotElement* findAssignedSlot(const Node&);
 
index 130d004..971abfe 100644 (file)
@@ -49,7 +49,6 @@
 #include "HTMLOptionElement.h"
 #include "HTMLParserIdioms.h"
 #include "IdTargetObserver.h"
-#include "InsertionPoint.h"
 #include "KeyboardEvent.h"
 #include "Language.h"
 #include "LocalizedStrings.h"
index 4eaa60f..73cc961 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "ElementChildIterator.h"
 #include "HTMLNames.h"
+#include "ShadowRoot.h"
 
 namespace WebCore {
 
index dbeef97..0aca6ec 100644 (file)
@@ -29,7 +29,6 @@
 #if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
 
 #include "HTMLElement.h"
-#include "InsertionPoint.h"
 #include "Range.h"
 
 namespace WebCore {
diff --git a/Source/WebCore/html/shadow/ContentDistributor.cpp b/Source/WebCore/html/shadow/ContentDistributor.cpp
deleted file mode 100644 (file)
index 6daedb8..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ContentDistributor.h"
-
-#include "ElementIterator.h"
-#include "InsertionPoint.h"
-
-namespace WebCore {
-
-ContentDistributor::ContentDistributor()
-    : m_insertionPointListIsValid(true)
-    , m_validity(Undetermined)
-{
-}
-
-ContentDistributor::~ContentDistributor()
-{
-}
-
-void ContentDistributor::invalidateInsertionPointList()
-{
-    m_insertionPointListIsValid = false;
-    m_insertionPointList.clear();
-}
-
-const Vector<RefPtr<InsertionPoint>>& ContentDistributor::ensureInsertionPointList(ShadowRoot* shadowRoot)
-{
-    if (m_insertionPointListIsValid)
-        return m_insertionPointList;
-
-    m_insertionPointListIsValid = true;
-    ASSERT(m_insertionPointList.isEmpty());
-
-    for (auto& element : descendantsOfType<InsertionPoint>(*shadowRoot))
-        m_insertionPointList.append(&element);
-
-    return m_insertionPointList;
-}
-
-InsertionPoint* ContentDistributor::findInsertionPointFor(const Node* key) const
-{
-    return m_nodeToInsertionPoint.get(key);
-}
-
-void ContentDistributor::distribute(Element* host)
-{
-    ASSERT(needsDistribution());
-    ASSERT(m_nodeToInsertionPoint.isEmpty());
-    ASSERT(!host->containingShadowRoot()
-        || !host->containingShadowRoot()->distributor()
-        || host->containingShadowRoot()->distributor()->isValid());
-
-    m_validity = Valid;
-
-    if (ShadowRoot* root = host->shadowRoot()) {
-        for (auto& point : ensureInsertionPointList(root)) {
-            if (!point->isActive())
-                continue;
-
-            distributeSelectionsTo(point.get(), host);
-        }
-    }
-}
-
-bool ContentDistributor::invalidate(Element* host)
-{
-    ASSERT(needsInvalidation());
-    bool needsReattach = (m_validity == Undetermined) || !m_nodeToInsertionPoint.isEmpty();
-
-    if (ShadowRoot* root = host->shadowRoot()) {
-        for (auto& point : ensureInsertionPointList(root)) {
-            needsReattach = true;
-            point->clearDistribution();
-        }
-    }
-
-    m_validity = Invalidating;
-    m_nodeToInsertionPoint.clear();
-    return needsReattach;
-}
-
-void ContentDistributor::distributeSelectionsTo(InsertionPoint* insertionPoint, Element* host)
-{
-    for (Node* child = host->firstChild(); child; child = child->nextSibling()) {
-        ASSERT(!child->isInsertionPoint());
-
-        if (insertionPoint->matchTypeFor(child) != InsertionPoint::AlwaysMatches)
-            continue;
-
-        m_nodeToInsertionPoint.add(child, insertionPoint);
-    }
-
-    if (m_nodeToInsertionPoint.isEmpty())
-        return;
-    insertionPoint->setHasDistribution();
-}
-
-void ContentDistributor::ensureDistribution(ShadowRoot* shadowRoot)
-{
-    ASSERT(shadowRoot);
-
-    Vector<ShadowRoot*, 8> shadowRoots;
-    for (Element* current = shadowRoot->host(); current; current = current->shadowHost()) {
-        ShadowRoot* currentRoot = current->shadowRoot();
-        if (!currentRoot->distributor() || !currentRoot->distributor()->needsDistribution())
-            break;
-        shadowRoots.append(currentRoot);
-    }
-
-    for (size_t i = shadowRoots.size(); i > 0; --i)
-        shadowRoots[i - 1]->distributor()->distribute(shadowRoots[i - 1]->host());
-}
-
-void ContentDistributor::invalidateDistribution(Element* host)
-{
-    bool didNeedInvalidation = needsInvalidation();
-    bool needsReattach = didNeedInvalidation ? invalidate(host) : false;
-
-    if (needsReattach)
-        host->setNeedsStyleRecalc(ReconstructRenderTree);
-
-    if (didNeedInvalidation) {
-        ASSERT(m_validity == Invalidating);
-        m_validity = Invalidated;
-    }
-}
-
-void ContentDistributor::didShadowBoundaryChange(Element* host)
-{
-    setValidity(Undetermined);
-    invalidateDistribution(host);
-}
-
-}
diff --git a/Source/WebCore/html/shadow/ContentDistributor.h b/Source/WebCore/html/shadow/ContentDistributor.h
deleted file mode 100644 (file)
index 9967268..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ContentDistributor_h
-#define ContentDistributor_h
-
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class ContainerNode;
-class Element;
-class InsertionPoint;
-class Node;
-class ShadowRoot;
-
-class ContentDistributor {
-    WTF_MAKE_NONCOPYABLE(ContentDistributor);
-public:
-    enum Validity {
-        Valid = 0,
-        Invalidated = 1,
-        Invalidating = 2,
-        Undetermined = 3
-    };
-
-    ContentDistributor();
-    ~ContentDistributor();
-
-    void invalidateInsertionPointList();
-    
-    InsertionPoint* findInsertionPointFor(const Node* key) const;
-
-    void distributeSelectionsTo(InsertionPoint*, Element* host);
-
-    void invalidateDistribution(Element* host);
-    void didShadowBoundaryChange(Element* host);
-
-    static void ensureDistribution(ShadowRoot*);
-    void distribute(Element* host);
-    bool needsDistribution() const;
-
-private:
-    const Vector<RefPtr<InsertionPoint>>& ensureInsertionPointList(ShadowRoot*);
-
-    bool invalidate(Element* host);
-
-    void setValidity(Validity validity) { m_validity = validity; }
-    bool isValid() const { return m_validity == Valid; }
-    bool needsInvalidation() const { return m_validity != Invalidated; }
-
-    Vector<RefPtr<InsertionPoint>> m_insertionPointList;
-    HashMap<const Node*, RefPtr<InsertionPoint>> m_nodeToInsertionPoint;
-    bool m_insertionPointListIsValid;
-    unsigned m_validity : 2;
-};
-
-inline bool ContentDistributor::needsDistribution() const
-{
-    // During the invalidation, re-distribution should be suppressed.
-    return m_validity != Valid && m_validity != Invalidating;
-}
-
-}
-
-#endif
diff --git a/Source/WebCore/html/shadow/InsertionPoint.cpp b/Source/WebCore/html/shadow/InsertionPoint.cpp
deleted file mode 100644 (file)
index 5b1dd2c..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "InsertionPoint.h"
-
-#include "QualifiedName.h"
-#include "StaticNodeList.h"
-#include "Text.h"
-
-namespace WebCore {
-
-using namespace HTMLNames;
-
-InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document& document)
-    : HTMLElement(tagName, document, CreateInsertionPoint)
-    , m_hasDistribution(false)
-{
-}
-
-InsertionPoint::~InsertionPoint()
-{
-}
-
-bool InsertionPoint::shouldUseFallbackElements() const
-{
-    return isActive() && !hasDistribution();
-}
-
-bool InsertionPoint::isActive() const
-{
-    if (!containingShadowRoot())
-        return false;
-    const Node* node = parentNode();
-    while (node) {
-        if (node->isInsertionPoint())
-            return false;
-
-        node = node->parentNode();
-    }
-    return true;
-}
-
-bool InsertionPoint::rendererIsNeeded(const RenderStyle& style)
-{
-    return !isActive() && HTMLElement::rendererIsNeeded(style);
-}
-
-void InsertionPoint::childrenChanged(const ChildChange& change)
-{
-    HTMLElement::childrenChanged(change);
-    if (ShadowRoot* root = containingShadowRoot()) {
-        RELEASE_ASSERT(root->distributor());
-        root->distributor()->invalidateDistribution(root->host());
-    }
-}
-
-Node::InsertionNotificationRequest InsertionPoint::insertedInto(ContainerNode& insertionPoint)
-{
-    HTMLElement::insertedInto(insertionPoint);
-
-    if (ShadowRoot* root = containingShadowRoot()) {
-        RELEASE_ASSERT(root->distributor());
-        root->distributor()->didShadowBoundaryChange(root->host());
-        root->distributor()->invalidateInsertionPointList();
-    }
-
-    return InsertionDone;
-}
-
-void InsertionPoint::removedFrom(ContainerNode& insertionPoint)
-{
-    ShadowRoot* root = containingShadowRoot();
-    if (!root)
-        root = insertionPoint.containingShadowRoot();
-
-    if (root && root->host()) {
-        RELEASE_ASSERT(root->distributor());
-        root->distributor()->invalidateDistribution(root->host());
-        root->distributor()->invalidateInsertionPointList();
-    }
-
-    // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up.
-    clearDistribution();
-
-    HTMLElement::removedFrom(insertionPoint);
-}
-    
-Node* InsertionPoint::firstDistributed() const
-{
-    if (!m_hasDistribution)
-        return 0;
-    for (Node* current = shadowHost()->firstChild(); current; current = current->nextSibling()) {
-        if (matchTypeFor(current) == InsertionPoint::AlwaysMatches)
-            return current;
-    }
-    return 0;
-}
-
-Node* InsertionPoint::lastDistributed() const
-{
-    if (!m_hasDistribution)
-        return 0;
-    for (Node* current = shadowHost()->lastChild(); current; current = current->previousSibling()) {
-        if (matchTypeFor(current) == InsertionPoint::AlwaysMatches)
-            return current;
-    }
-    return 0;
-}
-
-Node* InsertionPoint::nextDistributedTo(const Node* node) const
-{
-    for (Node* current = node->nextSibling(); current; current = current->nextSibling()) {
-        if (matchTypeFor(current) == InsertionPoint::AlwaysMatches)
-            return current;
-    }
-    return 0;
-}
-
-Node* InsertionPoint::previousDistributedTo(const Node* node) const
-{
-    for (Node* current = node->previousSibling(); current; current = current->previousSibling()) {
-        if (matchTypeFor(current) == InsertionPoint::AlwaysMatches)
-            return current;
-    }
-    return 0;
-}
-
-InsertionPoint* findInsertionPointOf(const Node* projectedNode)
-{
-    if (ShadowRoot* shadowRoot = shadowRootOfParentForDistribution(projectedNode)) {
-        if (ShadowRoot* root = projectedNode->containingShadowRoot())
-            ContentDistributor::ensureDistribution(root);
-        if (auto* distributor = shadowRoot->distributor())
-            return distributor->findInsertionPointFor(projectedNode);
-    }
-    return 0;
-}
-
-void ShadowRootWithInsertionPoints::childrenChanged(const ChildChange& change)
-{
-    ContainerNode::childrenChanged(change);
-    
-    if (!isOrphan())
-        m_distributor.invalidateDistribution(host());
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/html/shadow/InsertionPoint.h b/Source/WebCore/html/shadow/InsertionPoint.h
deleted file mode 100644 (file)
index 0cedfe2..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef InsertionPoint_h
-#define InsertionPoint_h
-
-#include "ContentDistributor.h"
-#include "HTMLElement.h"
-#include "HTMLNames.h"
-#include "ShadowRoot.h"
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class InsertionPoint : public HTMLElement {
-public:
-    enum MatchType {
-        AlwaysMatches,
-        NeverMatches,
-    };
-
-    virtual ~InsertionPoint();
-
-    bool hasDistribution() const { return m_hasDistribution; }
-    void setHasDistribution() { m_hasDistribution = true; }
-    void clearDistribution() { m_hasDistribution = false; }
-    WEBCORE_EXPORT bool isActive() const;
-
-    virtual MatchType matchTypeFor(Node*) const { return AlwaysMatches; }
-
-    bool shouldUseFallbackElements() const;
-
-    Node* firstDistributed() const;
-    Node* lastDistributed() const;
-    Node* nextDistributedTo(const Node*) const;
-    Node* previousDistributedTo(const Node*) const;
-
-protected:
-    InsertionPoint(const QualifiedName&, Document&);
-    virtual bool rendererIsNeeded(const RenderStyle&) override;
-    virtual void childrenChanged(const ChildChange&) override;
-    virtual InsertionNotificationRequest insertedInto(ContainerNode&) override;
-    virtual void removedFrom(ContainerNode&) override;
-
-private:
-    virtual bool isInsertionPointNode() const override final { return true; }
-
-    bool m_hasDistribution;
-};
-
-class ShadowRootWithInsertionPoints : public ShadowRoot {
-public:
-    
-    static Ref<ShadowRootWithInsertionPoints> create(Document& document)
-    {
-        return adoptRef(*new ShadowRootWithInsertionPoints(document));
-    }
-    
-    virtual ContentDistributor* distributor() override { return &m_distributor; }
-    
-private:
-    ShadowRootWithInsertionPoints(Document& document)
-        : ShadowRoot(document, Type::UserAgent)
-    { }
-
-    virtual void childrenChanged(const ChildChange&) override;
-
-    ContentDistributor m_distributor;
-};
-
-inline bool isActiveInsertionPoint(const Node* node)
-{
-    return is<InsertionPoint>(node) && downcast<InsertionPoint>(*node).isActive();
-}
-
-inline Node* parentNodeForDistribution(const Node* node)
-{
-    ASSERT(node);
-
-    if (Node* parent = node->parentNode()) {
-        if (is<InsertionPoint>(*parent) && downcast<InsertionPoint>(*parent).shouldUseFallbackElements())
-            return parent->parentNode();
-        return parent;
-    }
-
-    return nullptr;
-}
-
-inline Element* parentElementForDistribution(const Node* node)
-{
-    if (Node* parent = parentNodeForDistribution(node)) {
-        if (is<Element>(*parent))
-            return downcast<Element>(parent);
-    }
-
-    return nullptr;
-}
-
-inline ShadowRoot* shadowRootOfParentForDistribution(const Node* node)
-{
-    ASSERT(node);
-    if (Element* parent = parentElementForDistribution(node))
-        return parent->shadowRoot();
-
-    return nullptr;
-}
-
-InsertionPoint* findInsertionPointOf(const Node*);
-
-inline bool hasShadowRootOrActiveInsertionPointParent(const Node& node)
-{
-    return hasShadowRootParent(node)
-        || isActiveInsertionPoint(findInsertionPointOf(&node))
-        || isActiveInsertionPoint(node.parentNode());
-}
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::InsertionPoint)
-    static bool isType(const WebCore::Node& node) { return node.isInsertionPoint(); }
-SPECIALIZE_TYPE_TRAITS_END()
-
-#endif // InsertionPoint_h
index 309a028..69746b7 100644 (file)
@@ -496,10 +496,8 @@ Element* FocusController::nextFocusableElement(FocusNavigationScope scope, Node*
 
 Element* FocusController::previousFocusableElement(FocusNavigationScope scope, Node* start, KeyboardEvent* event)
 {
-    using namespace NodeRenderingTraversal;
-
     Node* last = nullptr;
-    for (Node* node = scope.rootNode(); node; node = lastChildInScope(node))
+    for (Node* node = scope.rootNode(); node; node = NodeRenderingTraversal::lastChildInScope(node))
         last = node;
     ASSERT(last);
 
@@ -508,7 +506,7 @@ Element* FocusController::previousFocusableElement(FocusNavigationScope scope, N
     Node* startingNode;
     int startingTabIndex;
     if (start) {
-        startingNode = previousInScope(start);
+        startingNode = NodeRenderingTraversal::previousInScope(start);
         startingTabIndex = adjustedTabIndex(*start, *event);
     } else {
         startingNode = last;
@@ -517,7 +515,7 @@ Element* FocusController::previousFocusableElement(FocusNavigationScope scope, N
 
     // However, if a node is excluded from the normal tabbing cycle, the previous focusable node is determined by tree order
     if (startingTabIndex < 0) {
-        for (Node* node = startingNode; node; node = previousInScope(node)) {
+        for (Node* node = startingNode; node; node = NodeRenderingTraversal::previousInScope(node)) {
             if (!is<Element>(*node))
                 continue;
             Element& element = downcast<Element>(*node);
index 2157ac6..cb95faa 100644 (file)
@@ -37,7 +37,6 @@
 #include "ChromeClient.h"
 #include "ClientRect.h"
 #include "ClientRectList.h"
-#include "ContentDistributor.h"
 #include "Cursor.h"
 #include "DOMPath.h"
 #include "DOMStringList.h"