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

Side by Side Diff: Source/core/editing/markup.cpp

Issue 99083002: WIP: Migrate generated bindings to new ExceptionState constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 7 years 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
« no previous file with comments | « Source/core/dom/shadow/ShadowRoot.cpp ('k') | Source/core/events/EventTarget.cpp » ('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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2011 Igalia S.L. 4 * Copyright (C) 2011 Igalia S.L.
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 14 matching lines...) Expand all
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "core/editing/markup.h" 30 #include "core/editing/markup.h"
31 31
32 #include "CSSPropertyNames.h" 32 #include "CSSPropertyNames.h"
33 #include "CSSValueKeywords.h" 33 #include "CSSValueKeywords.h"
34 #include "HTMLNames.h" 34 #include "HTMLNames.h"
35 #include "bindings/v8/ExceptionMessages.h"
36 #include "bindings/v8/ExceptionState.h" 35 #include "bindings/v8/ExceptionState.h"
37 #include "core/css/CSSPrimitiveValue.h" 36 #include "core/css/CSSPrimitiveValue.h"
38 #include "core/css/CSSValue.h" 37 #include "core/css/CSSValue.h"
39 #include "core/css/StylePropertySet.h" 38 #include "core/css/StylePropertySet.h"
40 #include "core/dom/CDATASection.h" 39 #include "core/dom/CDATASection.h"
41 #include "core/dom/ChildListMutationScope.h" 40 #include "core/dom/ChildListMutationScope.h"
42 #include "core/dom/ContextFeatures.h" 41 #include "core/dom/ContextFeatures.h"
43 #include "core/dom/DocumentFragment.h" 42 #include "core/dom/DocumentFragment.h"
44 #include "core/dom/ElementTraversal.h" 43 #include "core/dom/ElementTraversal.h"
45 #include "core/dom/ExceptionCode.h" 44 #include "core/dom/ExceptionCode.h"
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 Document& document = contextElement->hasTagName(templateTag) ? contextElemen t->document().ensureTemplateDocument() : contextElement->document(); 947 Document& document = contextElement->hasTagName(templateTag) ? contextElemen t->document().ensureTemplateDocument() : contextElement->document();
949 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); 948 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
950 949
951 if (document.isHTMLDocument()) { 950 if (document.isHTMLDocument()) {
952 fragment->parseHTML(markup, contextElement, parserContentPolicy); 951 fragment->parseHTML(markup, contextElement, parserContentPolicy);
953 return fragment; 952 return fragment;
954 } 953 }
955 954
956 bool wasValid = fragment->parseXML(markup, contextElement, parserContentPoli cy); 955 bool wasValid = fragment->parseXML(markup, contextElement, parserContentPoli cy);
957 if (!wasValid) { 956 if (!wasValid) {
958 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedT oExecute(method, "Node", "The provided markup is invalid XML, and therefore cann ot be inserted into an XML document.")); 957 exceptionState.throwDOMException(SyntaxError, "The provided markup is in valid XML, and therefore cannot be inserted into an XML document.");
959 return 0; 958 return 0;
960 } 959 }
961 return fragment.release(); 960 return fragment.release();
962 } 961 }
963 962
964 PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String& sourceString, const String& sourceMIMEType, Document& outputDoc) 963 PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String& sourceString, const String& sourceMIMEType, Document& outputDoc)
965 { 964 {
966 RefPtr<DocumentFragment> fragment = outputDoc.createDocumentFragment(); 965 RefPtr<DocumentFragment> fragment = outputDoc.createDocumentFragment();
967 966
968 if (sourceMIMEType == "text/html") { 967 if (sourceMIMEType == "text/html") {
(...skipping 25 matching lines...) Expand all
994 fragment->insertBefore(child, element); 993 fragment->insertBefore(child, element);
995 } 994 }
996 fragment->removeChild(element); 995 fragment->removeChild(element);
997 } 996 }
998 997
999 PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTML Element* element, ParserContentPolicy parserContentPolicy, ExceptionState& excep tionState) 998 PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTML Element* element, ParserContentPolicy parserContentPolicy, ExceptionState& excep tionState)
1000 { 999 {
1001 ASSERT(element); 1000 ASSERT(element);
1002 if (element->ieForbidsInsertHTML() || element->hasLocalName(colTag) || eleme nt->hasLocalName(colgroupTag) || element->hasLocalName(framesetTag) 1001 if (element->ieForbidsInsertHTML() || element->hasLocalName(colTag) || eleme nt->hasLocalName(colgroupTag) || element->hasLocalName(framesetTag)
1003 || element->hasLocalName(headTag) || element->hasLocalName(styleTag) || element->hasLocalName(titleTag)) { 1002 || element->hasLocalName(headTag) || element->hasLocalName(styleTag) || element->hasLocalName(titleTag)) {
1004 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::f ailedToExecute("createContextualFragment", "Range", "The range's container is '" + element->localName() + "', which is not supported.")); 1003 exceptionState.throwDOMException(NotSupportedError, "The range's contain er is '" + element->localName() + "', which is not supported.");
1005 return 0; 1004 return 0;
1006 } 1005 }
1007 1006
1008 RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, parserContentPolicy, "createContextualFragment", exceptionState); 1007 RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, parserContentPolicy, "createContextualFragment", exceptionState);
1009 if (!fragment) 1008 if (!fragment)
1010 return 0; 1009 return 0;
1011 1010
1012 // We need to pop <html> and <body> elements and remove <head> to 1011 // We need to pop <html> and <body> elements and remove <head> to
1013 // accommodate folks passing complete HTML documents to make the 1012 // accommodate folks passing complete HTML documents to make the
1014 // child of an element. 1013 // child of an element.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 return; 1082 return;
1084 1083
1085 RefPtr<Text> textNode = toText(node.get()); 1084 RefPtr<Text> textNode = toText(node.get());
1086 RefPtr<Text> textNext = toText(next); 1085 RefPtr<Text> textNext = toText(next);
1087 textNode->appendData(textNext->data()); 1086 textNode->appendData(textNext->data());
1088 if (textNext->parentNode()) // Might have been removed by mutation event. 1087 if (textNext->parentNode()) // Might have been removed by mutation event.
1089 textNext->remove(exceptionState); 1088 textNext->remove(exceptionState);
1090 } 1089 }
1091 1090
1092 } 1091 }
OLDNEW
« no previous file with comments | « Source/core/dom/shadow/ShadowRoot.cpp ('k') | Source/core/events/EventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698