| OLD | NEW |
| 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 exceptionState.throwDOMException(NoModificationAllowedError, "The '" + l
ocalName() + "' element does not support text insertion."); | 411 exceptionState.throwDOMException(NoModificationAllowedError, "The '" + l
ocalName() + "' element does not support text insertion."); |
| 412 return; | 412 return; |
| 413 } | 413 } |
| 414 | 414 |
| 415 ContainerNode* parent = parentNode(); | 415 ContainerNode* parent = parentNode(); |
| 416 if (!parent) { | 416 if (!parent) { |
| 417 exceptionState.throwDOMException(NoModificationAllowedError, "The elemen
t has no parent."); | 417 exceptionState.throwDOMException(NoModificationAllowedError, "The elemen
t has no parent."); |
| 418 return; | 418 return; |
| 419 } | 419 } |
| 420 | 420 |
| 421 RefPtr<Node> prev = previousSibling(); | 421 RefPtrWillBeRawPtr<Node> prev = previousSibling(); |
| 422 RefPtr<Node> next = nextSibling(); | 422 RefPtrWillBeRawPtr<Node> next = nextSibling(); |
| 423 RefPtr<Node> newChild; | 423 RefPtrWillBeRawPtr<Node> newChild = nullptr; |
| 424 | 424 |
| 425 // Convert text to fragment with <br> tags instead of linebreaks if needed. | 425 // Convert text to fragment with <br> tags instead of linebreaks if needed. |
| 426 if (text.contains('\r') || text.contains('\n')) | 426 if (text.contains('\r') || text.contains('\n')) |
| 427 newChild = textToFragment(text, exceptionState); | 427 newChild = textToFragment(text, exceptionState); |
| 428 else | 428 else |
| 429 newChild = Text::create(document(), text); | 429 newChild = Text::create(document(), text); |
| 430 | 430 |
| 431 // textToFragment might cause mutation events. | 431 // textToFragment might cause mutation events. |
| 432 if (!this || !parentNode()) | 432 if (!this || !parentNode()) |
| 433 exceptionState.throwDOMException(HierarchyRequestError, "The element has
no parent."); | 433 exceptionState.throwDOMException(HierarchyRequestError, "The element has
no parent."); |
| 434 | 434 |
| 435 if (exceptionState.hadException()) | 435 if (exceptionState.hadException()) |
| 436 return; | 436 return; |
| 437 | 437 |
| 438 parent->replaceChild(newChild.release(), this, exceptionState); | 438 parent->replaceChild(newChild.release(), this, exceptionState); |
| 439 | 439 |
| 440 RefPtr<Node> node = next ? next->previousSibling() : 0; | 440 RefPtrWillBeRawPtr<Node> node = next ? next->previousSibling() : nullptr; |
| 441 if (!exceptionState.hadException() && node && node->isTextNode()) | 441 if (!exceptionState.hadException() && node && node->isTextNode()) |
| 442 mergeWithNextTextNode(node.release(), exceptionState); | 442 mergeWithNextTextNode(node.release(), exceptionState); |
| 443 | 443 |
| 444 if (!exceptionState.hadException() && prev && prev->isTextNode()) | 444 if (!exceptionState.hadException() && prev && prev->isTextNode()) |
| 445 mergeWithNextTextNode(prev.release(), exceptionState); | 445 mergeWithNextTextNode(prev.release(), exceptionState); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void HTMLElement::applyAlignmentAttributeToStyle(const AtomicString& alignment,
MutableStylePropertySet* style) | 448 void HTMLElement::applyAlignmentAttributeToStyle(const AtomicString& alignment,
MutableStylePropertySet* style) |
| 449 { | 449 { |
| 450 // Vertical alignment with respect to the current baseline of the text | 450 // Vertical alignment with respect to the current baseline of the text |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 #ifndef NDEBUG | 955 #ifndef NDEBUG |
| 956 | 956 |
| 957 // For use in the debugger | 957 // For use in the debugger |
| 958 void dumpInnerHTML(WebCore::HTMLElement*); | 958 void dumpInnerHTML(WebCore::HTMLElement*); |
| 959 | 959 |
| 960 void dumpInnerHTML(WebCore::HTMLElement* element) | 960 void dumpInnerHTML(WebCore::HTMLElement* element) |
| 961 { | 961 { |
| 962 printf("%s\n", element->innerHTML().ascii().data()); | 962 printf("%s\n", element->innerHTML().ascii().data()); |
| 963 } | 963 } |
| 964 #endif | 964 #endif |
| OLD | NEW |