Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(506)

Unified Diff: sky/engine/core/dom/Document.cpp

Issue 732203004: Clean up child checks in ContainerNode. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add back secondary hierarchy checks. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/DocumentFragment.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/Document.cpp
diff --git a/sky/engine/core/dom/Document.cpp b/sky/engine/core/dom/Document.cpp
index 2b2c4faa55f9aaaa49d19e04812d49660eeb6999..72d8c608e825542b77123989b2da6d9b661cc366 100644
--- a/sky/engine/core/dom/Document.cpp
+++ b/sky/engine/core/dom/Document.cpp
@@ -1678,78 +1678,6 @@ MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& r
return MouseEventWithHitTestResults(event, result);
}
-// DOM Section 1.1.1
-bool Document::childTypeAllowed(NodeType type) const
-{
- switch (type) {
- case DOCUMENT_FRAGMENT_NODE:
- case DOCUMENT_NODE:
- case TEXT_NODE:
- return false;
- case ELEMENT_NODE:
- // Documents may contain no more than one of each of these.
- // (One Element and one DocumentType.)
- for (Node* c = firstChild(); c; c = c->nextSibling())
- if (c->nodeType() == type)
- return false;
- return true;
- }
- return false;
-}
-
-bool Document::canReplaceChild(const Node& newChild, const Node& oldChild) const
-{
- if (oldChild.nodeType() == newChild.nodeType())
- return true;
-
- int numElements = 0;
-
- // First, check how many doctypes and elements we have, not counting
- // the child we're about to remove.
- for (Node* c = firstChild(); c; c = c->nextSibling()) {
- if (c == oldChild)
- continue;
-
- switch (c->nodeType()) {
- case ELEMENT_NODE:
- numElements++;
- break;
- default:
- break;
- }
- }
-
- // Then, see how many doctypes and elements might be added by the new child.
- if (newChild.isDocumentFragment()) {
- for (Node* c = toDocumentFragment(newChild).firstChild(); c; c = c->nextSibling()) {
- switch (c->nodeType()) {
- case DOCUMENT_FRAGMENT_NODE:
- case DOCUMENT_NODE:
- case TEXT_NODE:
- return false;
- case ELEMENT_NODE:
- numElements++;
- break;
- }
- }
- } else {
- switch (newChild.nodeType()) {
- case DOCUMENT_FRAGMENT_NODE:
- case DOCUMENT_NODE:
- case TEXT_NODE:
- return false;
- case ELEMENT_NODE:
- numElements++;
- break;
- }
- }
-
- if (numElements > 1)
- return false;
-
- return true;
-}
-
PassRefPtr<Node> Document::cloneNode(bool deep)
{
RefPtr<Document> clone = cloneDocumentWithoutChildren();
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/DocumentFragment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698