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

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

Issue 147993006: Move insertAdjacentElement/insertAdjacentText to Element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: olc chunk mismatch Created 6 years, 10 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/Element.h ('k') | Source/core/dom/Element.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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 return 0; 2381 return 0;
2382 } 2382 }
2383 return toElement(parent); 2383 return toElement(parent);
2384 } 2384 }
2385 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd")) 2385 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd"))
2386 return element; 2386 return element;
2387 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.") ; 2387 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.") ;
2388 return 0; 2388 return 0;
2389 } 2389 }
2390 2390
2391 Element* Element::insertAdjacentElement(const String& where, Element* newChild, ExceptionState& exceptionState)
2392 {
2393 if (!newChild) {
2394 // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
2395 exceptionState.throwTypeError("The node provided is null.");
2396 return 0;
2397 }
2398
2399 Node* returnValue = insertAdjacent(where, newChild, exceptionState);
2400 return toElement(returnValue);
2401 }
2402
2403 void Element::insertAdjacentText(const String& where, const String& text, Except ionState& exceptionState)
2404 {
2405 RefPtr<Text> textNode = document().createTextNode(text);
2406 insertAdjacent(where, textNode.get(), exceptionState);
2407 }
2408
2391 void Element::insertAdjacentHTML(const String& where, const String& markup, Exce ptionState& exceptionState) 2409 void Element::insertAdjacentHTML(const String& where, const String& markup, Exce ptionState& exceptionState)
2392 { 2410 {
2393 RefPtr<Element> contextElement = contextElementForInsertion(where, this, exc eptionState); 2411 RefPtr<Element> contextElement = contextElementForInsertion(where, this, exc eptionState);
2394 if (!contextElement) 2412 if (!contextElement)
2395 return; 2413 return;
2396 2414
2397 RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement.get(), AllowScriptingContent, "insertAdjacentHTML", exceptionStat e); 2415 RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement.get(), AllowScriptingContent, "insertAdjacentHTML", exceptionStat e);
2398 if (!fragment) 2416 if (!fragment)
2399 return; 2417 return;
2400 insertAdjacent(where, fragment.get(), exceptionState); 2418 insertAdjacent(where, fragment.get(), exceptionState);
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3615 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3633 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3616 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3634 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3617 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3635 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3618 return false; 3636 return false;
3619 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3637 if (FullscreenElementStack::isActiveFullScreenElement(this))
3620 return false; 3638 return false;
3621 return true; 3639 return true;
3622 } 3640 }
3623 3641
3624 } // namespace WebCore 3642 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/Element.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698