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

Side by Side Diff: Source/WebCore/html/HTMLElement.cpp

Issue 9250020: Merge 104441 - insertAdjacentHTML doesn't play nice with DocumentFragment (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 11 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
« no previous file with comments | « LayoutTests/fast/dom/insertAdjacentHTML-DocumentFragment-crash-expected.txt ('k') | no next file » | 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 Node* returnValue = insertAdjacent(where, newChild, ec); 616 Node* returnValue = insertAdjacent(where, newChild, ec);
617 ASSERT(!returnValue || returnValue->isElementNode()); 617 ASSERT(!returnValue || returnValue->isElementNode());
618 return static_cast<Element*>(returnValue); 618 return static_cast<Element*>(returnValue);
619 } 619 }
620 620
621 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in -html-documents.html#insertadjacenthtml() 621 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in -html-documents.html#insertadjacenthtml()
622 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionCode& ec) 622 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionCode& ec)
623 { 623 {
624 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) { 624 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) {
625 ContainerNode* parent = element->parentNode(); 625 ContainerNode* parent = element->parentNode();
626 if (parent && parent->isDocumentNode()) { 626 if (parent && !parent->isElementNode()) {
627 ec = NO_MODIFICATION_ALLOWED_ERR; 627 ec = NO_MODIFICATION_ALLOWED_ERR;
628 return 0; 628 return 0;
629 } 629 }
630 ASSERT(!parent || parent->isElementNode()); 630 ASSERT(!parent || parent->isElementNode());
631 return static_cast<Element*>(parent); 631 return static_cast<Element*>(parent);
632 } 632 }
633 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd")) 633 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd"))
634 return element; 634 return element;
635 ec = SYNTAX_ERR; 635 ec = SYNTAX_ERR;
636 return 0; 636 return 0;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 #ifndef NDEBUG 1043 #ifndef NDEBUG
1044 1044
1045 // For use in the debugger 1045 // For use in the debugger
1046 void dumpInnerHTML(WebCore::HTMLElement*); 1046 void dumpInnerHTML(WebCore::HTMLElement*);
1047 1047
1048 void dumpInnerHTML(WebCore::HTMLElement* element) 1048 void dumpInnerHTML(WebCore::HTMLElement* element)
1049 { 1049 {
1050 printf("%s\n", element->innerHTML().ascii().data()); 1050 printf("%s\n", element->innerHTML().ascii().data());
1051 } 1051 }
1052 #endif 1052 #endif
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/insertAdjacentHTML-DocumentFragment-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698