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

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

Issue 24469004: Amusingly deprecate the generic version of 'ExceptionState::throwDOMException'. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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/Range.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 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 Document& document = contextElement->hasTagName(templateTag) ? contextElemen t->document().ensureTemplateDocument() : contextElement->document(); 944 Document& document = contextElement->hasTagName(templateTag) ? contextElemen t->document().ensureTemplateDocument() : contextElement->document();
945 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); 945 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
946 946
947 if (document.isHTMLDocument()) { 947 if (document.isHTMLDocument()) {
948 fragment->parseHTML(markup, contextElement, parserContentPolicy); 948 fragment->parseHTML(markup, contextElement, parserContentPolicy);
949 return fragment; 949 return fragment;
950 } 950 }
951 951
952 bool wasValid = fragment->parseXML(markup, contextElement, parserContentPoli cy); 952 bool wasValid = fragment->parseXML(markup, contextElement, parserContentPoli cy);
953 if (!wasValid) { 953 if (!wasValid) {
954 es.throwDOMException(SyntaxError); 954 es.throwUninformativeAndGenericDOMException(SyntaxError);
955 return 0; 955 return 0;
956 } 956 }
957 return fragment.release(); 957 return fragment.release();
958 } 958 }
959 959
960 PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String& sourceString, const String& sourceMIMEType, Document& outputDoc) 960 PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String& sourceString, const String& sourceMIMEType, Document& outputDoc)
961 { 961 {
962 RefPtr<DocumentFragment> fragment = outputDoc.createDocumentFragment(); 962 RefPtr<DocumentFragment> fragment = outputDoc.createDocumentFragment();
963 963
964 if (sourceMIMEType == "text/html") { 964 if (sourceMIMEType == "text/html") {
(...skipping 24 matching lines...) Expand all
989 element->removeChild(child.get()); 989 element->removeChild(child.get());
990 fragment->insertBefore(child, element); 990 fragment->insertBefore(child, element);
991 } 991 }
992 fragment->removeChild(element); 992 fragment->removeChild(element);
993 } 993 }
994 994
995 PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTML Element* element, ParserContentPolicy parserContentPolicy, ExceptionState& es) 995 PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTML Element* element, ParserContentPolicy parserContentPolicy, ExceptionState& es)
996 { 996 {
997 ASSERT(element); 997 ASSERT(element);
998 if (element->ieForbidsInsertHTML()) { 998 if (element->ieForbidsInsertHTML()) {
999 es.throwDOMException(NotSupportedError); 999 es.throwUninformativeAndGenericDOMException(NotSupportedError);
1000 return 0; 1000 return 0;
1001 } 1001 }
1002 1002
1003 if (element->hasLocalName(colTag) || element->hasLocalName(colgroupTag) || e lement->hasLocalName(framesetTag) 1003 if (element->hasLocalName(colTag) || element->hasLocalName(colgroupTag) || e lement->hasLocalName(framesetTag)
1004 || element->hasLocalName(headTag) || element->hasLocalName(styleTag) || element->hasLocalName(titleTag)) { 1004 || element->hasLocalName(headTag) || element->hasLocalName(styleTag) || element->hasLocalName(titleTag)) {
1005 es.throwDOMException(NotSupportedError); 1005 es.throwUninformativeAndGenericDOMException(NotSupportedError);
1006 return 0; 1006 return 0;
1007 } 1007 }
1008 1008
1009 RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, parserContentPolicy, es); 1009 RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, parserContentPolicy, es);
1010 if (!fragment) 1010 if (!fragment)
1011 return 0; 1011 return 0;
1012 1012
1013 // We need to pop <html> and <body> elements and remove <head> to 1013 // We need to pop <html> and <body> elements and remove <head> to
1014 // accommodate folks passing complete HTML documents to make the 1014 // accommodate folks passing complete HTML documents to make the
1015 // child of an element. 1015 // child of an element.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 if (containerNode->hasOneChild()) { 1068 if (containerNode->hasOneChild()) {
1069 containerNode->replaceChild(textNode.release(), containerNode->firstChil d(), es); 1069 containerNode->replaceChild(textNode.release(), containerNode->firstChil d(), es);
1070 return; 1070 return;
1071 } 1071 }
1072 1072
1073 containerNode->removeChildren(); 1073 containerNode->removeChildren();
1074 containerNode->appendChild(textNode.release(), es); 1074 containerNode->appendChild(textNode.release(), es);
1075 } 1075 }
1076 1076
1077 } 1077 }
OLDNEW
« no previous file with comments | « Source/core/dom/Range.cpp ('k') | Source/core/events/EventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698