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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 14990005: Remove ENTITY_REFERENCE_NODE (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove some empty lines Created 7 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "core/dom/DOMImplementation.h" 58 #include "core/dom/DOMImplementation.h"
59 #include "core/dom/DOMNamedFlowCollection.h" 59 #include "core/dom/DOMNamedFlowCollection.h"
60 #include "core/dom/DocumentEventQueue.h" 60 #include "core/dom/DocumentEventQueue.h"
61 #include "core/dom/DocumentFragment.h" 61 #include "core/dom/DocumentFragment.h"
62 #include "core/dom/DocumentMarkerController.h" 62 #include "core/dom/DocumentMarkerController.h"
63 #include "core/dom/DocumentSharedObjectPool.h" 63 #include "core/dom/DocumentSharedObjectPool.h"
64 #include "core/dom/DocumentStyleSheetCollection.h" 64 #include "core/dom/DocumentStyleSheetCollection.h"
65 #include "core/dom/DocumentType.h" 65 #include "core/dom/DocumentType.h"
66 #include "core/dom/Element.h" 66 #include "core/dom/Element.h"
67 #include "core/dom/ElementShadow.h" 67 #include "core/dom/ElementShadow.h"
68 #include "core/dom/EntityReference.h"
69 #include "core/dom/Event.h" 68 #include "core/dom/Event.h"
70 #include "core/dom/EventFactory.h" 69 #include "core/dom/EventFactory.h"
71 #include "core/dom/EventListener.h" 70 #include "core/dom/EventListener.h"
72 #include "core/dom/EventNames.h" 71 #include "core/dom/EventNames.h"
73 #include "core/dom/ExceptionCode.h" 72 #include "core/dom/ExceptionCode.h"
74 #include "core/dom/ExceptionCodePlaceholder.h" 73 #include "core/dom/ExceptionCodePlaceholder.h"
75 #include "core/dom/HashChangeEvent.h" 74 #include "core/dom/HashChangeEvent.h"
76 #include "core/dom/NameNodeList.h" 75 #include "core/dom/NameNodeList.h"
77 #include "core/dom/NamedFlowCollection.h" 76 #include "core/dom/NamedFlowCollection.h"
78 #include "core/dom/NodeFilter.h" 77 #include "core/dom/NodeFilter.h"
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 ec = INVALID_CHARACTER_ERR; 868 ec = INVALID_CHARACTER_ERR;
870 return 0; 869 return 0;
871 } 870 }
872 if (isHTMLDocument()) { 871 if (isHTMLDocument()) {
873 ec = NOT_SUPPORTED_ERR; 872 ec = NOT_SUPPORTED_ERR;
874 return 0; 873 return 0;
875 } 874 }
876 return ProcessingInstruction::create(this, target, data); 875 return ProcessingInstruction::create(this, target, data);
877 } 876 }
878 877
879 PassRefPtr<EntityReference> Document::createEntityReference(const String& name, ExceptionCode& ec)
880 {
881 if (!isValidName(name)) {
882 ec = INVALID_CHARACTER_ERR;
883 return 0;
884 }
885 if (isHTMLDocument()) {
886 ec = NOT_SUPPORTED_ERR;
887 return 0;
888 }
889 return EntityReference::create(this, name);
890 }
891
892 PassRefPtr<Text> Document::createEditingTextNode(const String& text) 878 PassRefPtr<Text> Document::createEditingTextNode(const String& text)
893 { 879 {
894 return Text::createEditingText(this, text); 880 return Text::createEditingText(this, text);
895 } 881 }
896 882
897 PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration() 883 PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration()
898 { 884 {
899 return StylePropertySet::create()->ensureCSSStyleDeclaration(); 885 return StylePropertySet::create()->ensureCSSStyleDeclaration();
900 } 886 }
901 887
902 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCo de& ec) 888 PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCo de& ec)
903 { 889 {
904 ec = 0; 890 ec = 0;
905 891
906 if (!importedNode) { 892 if (!importedNode) {
907 ec = NOT_SUPPORTED_ERR; 893 ec = NOT_SUPPORTED_ERR;
908 return 0; 894 return 0;
909 } 895 }
910 896
911 switch (importedNode->nodeType()) { 897 switch (importedNode->nodeType()) {
912 case TEXT_NODE: 898 case TEXT_NODE:
913 return createTextNode(importedNode->nodeValue()); 899 return createTextNode(importedNode->nodeValue());
914 case CDATA_SECTION_NODE: 900 case CDATA_SECTION_NODE:
915 return createCDATASection(importedNode->nodeValue(), ec); 901 return createCDATASection(importedNode->nodeValue(), ec);
916 case ENTITY_REFERENCE_NODE:
917 return createEntityReference(importedNode->nodeName(), ec);
918 case PROCESSING_INSTRUCTION_NODE: 902 case PROCESSING_INSTRUCTION_NODE:
919 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), ec); 903 return createProcessingInstruction(importedNode->nodeName(), importedNod e->nodeValue(), ec);
920 case COMMENT_NODE: 904 case COMMENT_NODE:
921 return createComment(importedNode->nodeValue()); 905 return createComment(importedNode->nodeValue());
922 case ELEMENT_NODE: { 906 case ELEMENT_NODE: {
923 Element* oldElement = toElement(importedNode); 907 Element* oldElement = toElement(importedNode);
924 // FIXME: The following check might be unnecessary. Is it possible that 908 // FIXME: The following check might be unnecessary. Is it possible that
925 // oldElement has mismatched prefix/namespace? 909 // oldElement has mismatched prefix/namespace?
926 if (!hasValidNamespaceForElements(oldElement->tagQName())) { 910 if (!hasValidNamespaceForElements(oldElement->tagQName())) {
927 ec = NAMESPACE_ERR; 911 ec = NAMESPACE_ERR;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 } 965 }
982 966
983 967
984 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec) 968 PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
985 { 969 {
986 if (!source) { 970 if (!source) {
987 ec = NOT_SUPPORTED_ERR; 971 ec = NOT_SUPPORTED_ERR;
988 return 0; 972 return 0;
989 } 973 }
990 974
991 if (source->isReadOnlyNode()) {
992 ec = NO_MODIFICATION_ALLOWED_ERR;
993 return 0;
994 }
995
996 EventQueueScope scope; 975 EventQueueScope scope;
997 976
998 switch (source->nodeType()) { 977 switch (source->nodeType()) {
999 case ENTITY_NODE: 978 case ENTITY_NODE:
1000 case NOTATION_NODE: 979 case NOTATION_NODE:
1001 case DOCUMENT_NODE: 980 case DOCUMENT_NODE:
1002 case DOCUMENT_TYPE_NODE: 981 case DOCUMENT_TYPE_NODE:
1003 case XPATH_NAMESPACE_NODE: 982 case XPATH_NAMESPACE_NODE:
1004 ec = NOT_SUPPORTED_ERR; 983 ec = NOT_SUPPORTED_ERR;
1005 return 0; 984 return 0;
(...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 2813
2835 // DOM Section 1.1.1 2814 // DOM Section 1.1.1
2836 bool Document::childTypeAllowed(NodeType type) const 2815 bool Document::childTypeAllowed(NodeType type) const
2837 { 2816 {
2838 switch (type) { 2817 switch (type) {
2839 case ATTRIBUTE_NODE: 2818 case ATTRIBUTE_NODE:
2840 case CDATA_SECTION_NODE: 2819 case CDATA_SECTION_NODE:
2841 case DOCUMENT_FRAGMENT_NODE: 2820 case DOCUMENT_FRAGMENT_NODE:
2842 case DOCUMENT_NODE: 2821 case DOCUMENT_NODE:
2843 case ENTITY_NODE: 2822 case ENTITY_NODE:
2844 case ENTITY_REFERENCE_NODE:
2845 case NOTATION_NODE: 2823 case NOTATION_NODE:
2846 case TEXT_NODE: 2824 case TEXT_NODE:
2847 case XPATH_NAMESPACE_NODE: 2825 case XPATH_NAMESPACE_NODE:
2848 return false; 2826 return false;
2849 case COMMENT_NODE: 2827 case COMMENT_NODE:
2850 case PROCESSING_INSTRUCTION_NODE: 2828 case PROCESSING_INSTRUCTION_NODE:
2851 return true; 2829 return true;
2852 case DOCUMENT_TYPE_NODE: 2830 case DOCUMENT_TYPE_NODE:
2853 case ELEMENT_NODE: 2831 case ELEMENT_NODE:
2854 // Documents may contain no more than one of each of these. 2832 // Documents may contain no more than one of each of these.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 2871
2894 // Then, see how many doctypes and elements might be added by the new child. 2872 // Then, see how many doctypes and elements might be added by the new child.
2895 if (newChild->nodeType() == DOCUMENT_FRAGMENT_NODE) { 2873 if (newChild->nodeType() == DOCUMENT_FRAGMENT_NODE) {
2896 for (Node* c = newChild->firstChild(); c; c = c->nextSibling()) { 2874 for (Node* c = newChild->firstChild(); c; c = c->nextSibling()) {
2897 switch (c->nodeType()) { 2875 switch (c->nodeType()) {
2898 case ATTRIBUTE_NODE: 2876 case ATTRIBUTE_NODE:
2899 case CDATA_SECTION_NODE: 2877 case CDATA_SECTION_NODE:
2900 case DOCUMENT_FRAGMENT_NODE: 2878 case DOCUMENT_FRAGMENT_NODE:
2901 case DOCUMENT_NODE: 2879 case DOCUMENT_NODE:
2902 case ENTITY_NODE: 2880 case ENTITY_NODE:
2903 case ENTITY_REFERENCE_NODE:
2904 case NOTATION_NODE: 2881 case NOTATION_NODE:
2905 case TEXT_NODE: 2882 case TEXT_NODE:
2906 case XPATH_NAMESPACE_NODE: 2883 case XPATH_NAMESPACE_NODE:
2907 return false; 2884 return false;
2908 case COMMENT_NODE: 2885 case COMMENT_NODE:
2909 case PROCESSING_INSTRUCTION_NODE: 2886 case PROCESSING_INSTRUCTION_NODE:
2910 break; 2887 break;
2911 case DOCUMENT_TYPE_NODE: 2888 case DOCUMENT_TYPE_NODE:
2912 numDoctypes++; 2889 numDoctypes++;
2913 break; 2890 break;
2914 case ELEMENT_NODE: 2891 case ELEMENT_NODE:
2915 numElements++; 2892 numElements++;
2916 break; 2893 break;
2917 } 2894 }
2918 } 2895 }
2919 } else { 2896 } else {
2920 switch (newChild->nodeType()) { 2897 switch (newChild->nodeType()) {
2921 case ATTRIBUTE_NODE: 2898 case ATTRIBUTE_NODE:
2922 case CDATA_SECTION_NODE: 2899 case CDATA_SECTION_NODE:
2923 case DOCUMENT_FRAGMENT_NODE: 2900 case DOCUMENT_FRAGMENT_NODE:
2924 case DOCUMENT_NODE: 2901 case DOCUMENT_NODE:
2925 case ENTITY_NODE: 2902 case ENTITY_NODE:
2926 case ENTITY_REFERENCE_NODE:
2927 case NOTATION_NODE: 2903 case NOTATION_NODE:
2928 case TEXT_NODE: 2904 case TEXT_NODE:
2929 case XPATH_NAMESPACE_NODE: 2905 case XPATH_NAMESPACE_NODE:
2930 return false; 2906 return false;
2931 case COMMENT_NODE: 2907 case COMMENT_NODE:
2932 case PROCESSING_INSTRUCTION_NODE: 2908 case PROCESSING_INSTRUCTION_NODE:
2933 return true; 2909 return true;
2934 case DOCUMENT_TYPE_NODE: 2910 case DOCUMENT_TYPE_NODE:
2935 numDoctypes++; 2911 numDoctypes++;
2936 break; 2912 break;
(...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after
5667 return; 5643 return;
5668 5644
5669 Vector<RefPtr<Element> > associatedFormControls; 5645 Vector<RefPtr<Element> > associatedFormControls;
5670 copyToVector(m_associatedFormControls, associatedFormControls); 5646 copyToVector(m_associatedFormControls, associatedFormControls);
5671 5647
5672 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls); 5648 frame()->page()->chrome()->client()->didAssociateFormControls(associatedForm Controls);
5673 m_associatedFormControls.clear(); 5649 m_associatedFormControls.clear();
5674 } 5650 }
5675 5651
5676 } // namespace WebCore 5652 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698