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

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

Issue 482903002: Get rid of loops looking for the first Element ancestor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 6 years, 4 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/accessibility/AXNodeObject.cpp ('k') | Source/core/dom/Position.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) 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 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 } 2270 }
2271 2271
2272 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.") ; 2272 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.") ;
2273 return 0; 2273 return 0;
2274 } 2274 }
2275 2275
2276 // Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml() 2276 // Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml()
2277 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionState& exceptionState) 2277 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionState& exceptionState)
2278 { 2278 {
2279 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) { 2279 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) {
2280 ContainerNode* parent = element->parentNode(); 2280 Element* parent = element->parentElement();
2281 if (!parent || !parent->isElementNode()) { 2281 if (!parent) {
2282 exceptionState.throwDOMException(NoModificationAllowedError, "The el ement has no parent."); 2282 exceptionState.throwDOMException(NoModificationAllowedError, "The el ement has no parent.");
2283 return 0; 2283 return 0;
2284 } 2284 }
2285 return toElement(parent); 2285 return parent;
2286 } 2286 }
2287 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd")) 2287 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd"))
2288 return element; 2288 return element;
2289 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.") ; 2289 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + wher e + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.") ;
2290 return 0; 2290 return 0;
2291 } 2291 }
2292 2292
2293 Element* Element::insertAdjacentElement(const String& where, Element* newChild, ExceptionState& exceptionState) 2293 Element* Element::insertAdjacentElement(const String& where, Element* newChild, ExceptionState& exceptionState)
2294 { 2294 {
2295 if (!newChild) { 2295 if (!newChild) {
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 { 3248 {
3249 #if ENABLE(OILPAN) 3249 #if ENABLE(OILPAN)
3250 if (hasRareData()) 3250 if (hasRareData())
3251 visitor->trace(elementRareData()); 3251 visitor->trace(elementRareData());
3252 visitor->trace(m_elementData); 3252 visitor->trace(m_elementData);
3253 #endif 3253 #endif
3254 ContainerNode::trace(visitor); 3254 ContainerNode::trace(visitor);
3255 } 3255 }
3256 3256
3257 } // namespace blink 3257 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXNodeObject.cpp ('k') | Source/core/dom/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698