| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "wtf/text/CString.h" | 57 #include "wtf/text/CString.h" |
| 58 | 58 |
| 59 namespace WebCore { | 59 namespace WebCore { |
| 60 | 60 |
| 61 using namespace HTMLNames; | 61 using namespace HTMLNames; |
| 62 using namespace WTF; | 62 using namespace WTF; |
| 63 | 63 |
| 64 using std::min; | 64 using std::min; |
| 65 using std::max; | 65 using std::max; |
| 66 | 66 |
| 67 PassRefPtr<HTMLElement> HTMLElement::create(const QualifiedName& tagName, Docume
nt* document) | 67 PassRefPtr<HTMLElement> HTMLElement::create(const QualifiedName& tagName, Docume
nt& document) |
| 68 { | 68 { |
| 69 return adoptRef(new HTMLElement(tagName, document)); | 69 return adoptRef(new HTMLElement(tagName, document)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 String HTMLElement::nodeName() const | 72 String HTMLElement::nodeName() const |
| 73 { | 73 { |
| 74 // FIXME: Would be nice to have an atomicstring lookup based off uppercase | 74 // FIXME: Would be nice to have an atomicstring lookup based off uppercase |
| 75 // chars that does not have to copy the string on a hit in the hash. | 75 // chars that does not have to copy the string on a hit in the hash. |
| 76 // FIXME: We should have a way to detect XHTML elements and replace the hasP
refix() check with it. | 76 // FIXME: We should have a way to detect XHTML elements and replace the hasP
refix() check with it. |
| 77 if (document().isHTMLDocument() && !tagQName().hasPrefix()) | 77 if (document().isHTMLDocument() && !tagQName().hasPrefix()) |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 c = text[i]; | 381 c = text[i]; |
| 382 if (c == '\r' || c == '\n') | 382 if (c == '\r' || c == '\n') |
| 383 break; | 383 break; |
| 384 } | 384 } |
| 385 | 385 |
| 386 fragment->appendChild(Text::create(&document(), text.substring(start, i
- start)), es); | 386 fragment->appendChild(Text::create(&document(), text.substring(start, i
- start)), es); |
| 387 if (es.hadException()) | 387 if (es.hadException()) |
| 388 return 0; | 388 return 0; |
| 389 | 389 |
| 390 if (c == '\r' || c == '\n') { | 390 if (c == '\r' || c == '\n') { |
| 391 fragment->appendChild(HTMLBRElement::create(&document()), es); | 391 fragment->appendChild(HTMLBRElement::create(document()), es); |
| 392 if (es.hadException()) | 392 if (es.hadException()) |
| 393 return 0; | 393 return 0; |
| 394 // Make sure \r\n doesn't result in two line breaks. | 394 // Make sure \r\n doesn't result in two line breaks. |
| 395 if (c == '\r' && i + 1 < length && text[i + 1] == '\n') | 395 if (c == '\r' && i + 1 < length && text[i + 1] == '\n') |
| 396 i++; | 396 i++; |
| 397 } | 397 } |
| 398 | 398 |
| 399 start = i + 1; // Character after line break. | 399 start = i + 1; // Character after line break. |
| 400 } | 400 } |
| 401 | 401 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 #ifndef NDEBUG | 1102 #ifndef NDEBUG |
| 1103 | 1103 |
| 1104 // For use in the debugger | 1104 // For use in the debugger |
| 1105 void dumpInnerHTML(WebCore::HTMLElement*); | 1105 void dumpInnerHTML(WebCore::HTMLElement*); |
| 1106 | 1106 |
| 1107 void dumpInnerHTML(WebCore::HTMLElement* element) | 1107 void dumpInnerHTML(WebCore::HTMLElement* element) |
| 1108 { | 1108 { |
| 1109 printf("%s\n", element->innerHTML().ascii().data()); | 1109 printf("%s\n", element->innerHTML().ascii().data()); |
| 1110 } | 1110 } |
| 1111 #endif | 1111 #endif |
| OLD | NEW |