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

Side by Side Diff: Source/core/html/HTMLElement.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/html/HTMLElement.h ('k') | Source/core/html/HTMLElement.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 * 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 parent->replaceChild(newChild.release(), this, exceptionState); 444 parent->replaceChild(newChild.release(), this, exceptionState);
445 445
446 RefPtr<Node> node = next ? next->previousSibling() : 0; 446 RefPtr<Node> node = next ? next->previousSibling() : 0;
447 if (!exceptionState.hadException() && node && node->isTextNode()) 447 if (!exceptionState.hadException() && node && node->isTextNode())
448 mergeWithNextTextNode(node.release(), exceptionState); 448 mergeWithNextTextNode(node.release(), exceptionState);
449 449
450 if (!exceptionState.hadException() && prev && prev->isTextNode()) 450 if (!exceptionState.hadException() && prev && prev->isTextNode())
451 mergeWithNextTextNode(prev.release(), exceptionState); 451 mergeWithNextTextNode(prev.release(), exceptionState);
452 } 452 }
453 453
454 Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChi ld, ExceptionState& exceptionState)
455 {
456 if (!newChild) {
457 // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
458 exceptionState.throwTypeError("The node provided is null.");
459 return 0;
460 }
461
462 Node* returnValue = insertAdjacent(where, newChild, exceptionState);
463 return toElement(returnValue);
464 }
465
466 void HTMLElement::insertAdjacentText(const String& where, const String& text, Ex ceptionState& exceptionState)
467 {
468 RefPtr<Text> textNode = document().createTextNode(text);
469 insertAdjacent(where, textNode.get(), exceptionState);
470 }
471
472 void HTMLElement::applyAlignmentAttributeToStyle(const AtomicString& alignment, MutableStylePropertySet* style) 454 void HTMLElement::applyAlignmentAttributeToStyle(const AtomicString& alignment, MutableStylePropertySet* style)
473 { 455 {
474 // Vertical alignment with respect to the current baseline of the text 456 // Vertical alignment with respect to the current baseline of the text
475 // right or left means floating images. 457 // right or left means floating images.
476 CSSValueID floatValue = CSSValueInvalid; 458 CSSValueID floatValue = CSSValueInvalid;
477 CSSValueID verticalAlignValue = CSSValueInvalid; 459 CSSValueID verticalAlignValue = CSSValueInvalid;
478 460
479 if (equalIgnoringCase(alignment, "absmiddle")) 461 if (equalIgnoringCase(alignment, "absmiddle"))
480 verticalAlignValue = CSSValueMiddle; 462 verticalAlignValue = CSSValueMiddle;
481 else if (equalIgnoringCase(alignment, "absbottom")) 463 else if (equalIgnoringCase(alignment, "absbottom"))
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 #ifndef NDEBUG 950 #ifndef NDEBUG
969 951
970 // For use in the debugger 952 // For use in the debugger
971 void dumpInnerHTML(WebCore::HTMLElement*); 953 void dumpInnerHTML(WebCore::HTMLElement*);
972 954
973 void dumpInnerHTML(WebCore::HTMLElement* element) 955 void dumpInnerHTML(WebCore::HTMLElement* element)
974 { 956 {
975 printf("%s\n", element->innerHTML().ascii().data()); 957 printf("%s\n", element->innerHTML().ascii().data());
976 } 958 }
977 #endif 959 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLElement.h ('k') | Source/core/html/HTMLElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698