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

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

Issue 9249040: Merge 104441 - insertAdjacentHTML doesn't play nice with DocumentFragment (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
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 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 Node* returnValue = insertAdjacent(where, newChild, ec); 588 Node* returnValue = insertAdjacent(where, newChild, ec);
589 ASSERT(!returnValue || returnValue->isElementNode()); 589 ASSERT(!returnValue || returnValue->isElementNode());
590 return static_cast<Element*>(returnValue); 590 return static_cast<Element*>(returnValue);
591 } 591 }
592 592
593 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in -html-documents.html#insertadjacenthtml() 593 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in -html-documents.html#insertadjacenthtml()
594 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionCode& ec) 594 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionCode& ec)
595 { 595 {
596 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) { 596 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) {
597 ContainerNode* parent = element->parentNode(); 597 ContainerNode* parent = element->parentNode();
598 if (parent && parent->isDocumentNode()) { 598 if (parent && !parent->isElementNode()) {
599 ec = NO_MODIFICATION_ALLOWED_ERR; 599 ec = NO_MODIFICATION_ALLOWED_ERR;
600 return 0; 600 return 0;
601 } 601 }
602 ASSERT(!parent || parent->isElementNode()); 602 ASSERT(!parent || parent->isElementNode());
603 return static_cast<Element*>(parent); 603 return static_cast<Element*>(parent);
604 } 604 }
605 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd")) 605 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd"))
606 return element; 606 return element;
607 ec = SYNTAX_ERR; 607 ec = SYNTAX_ERR;
608 return 0; 608 return 0;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 #ifndef NDEBUG 980 #ifndef NDEBUG
981 981
982 // For use in the debugger 982 // For use in the debugger
983 void dumpInnerHTML(WebCore::HTMLElement*); 983 void dumpInnerHTML(WebCore::HTMLElement*);
984 984
985 void dumpInnerHTML(WebCore::HTMLElement* element) 985 void dumpInnerHTML(WebCore::HTMLElement* element)
986 { 986 {
987 printf("%s\n", element->innerHTML().ascii().data()); 987 printf("%s\n", element->innerHTML().ascii().data());
988 } 988 }
989 #endif 989 #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