| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 c = text[i]; | 378 c = text[i]; |
| 379 if (c == '\r' || c == '\n') | 379 if (c == '\r' || c == '\n') |
| 380 break; | 380 break; |
| 381 } | 381 } |
| 382 | 382 |
| 383 fragment->appendChild(Text::create(&document(), text.substring(start, i
- start)), es); | 383 fragment->appendChild(Text::create(&document(), text.substring(start, i
- start)), es); |
| 384 if (es.hadException()) | 384 if (es.hadException()) |
| 385 return 0; | 385 return 0; |
| 386 | 386 |
| 387 if (c == '\r' || c == '\n') { | 387 if (c == '\r' || c == '\n') { |
| 388 fragment->appendChild(HTMLBRElement::create(&document()), es); | 388 fragment->appendChild(HTMLBRElement::create(document()), es); |
| 389 if (es.hadException()) | 389 if (es.hadException()) |
| 390 return 0; | 390 return 0; |
| 391 // Make sure \r\n doesn't result in two line breaks. | 391 // Make sure \r\n doesn't result in two line breaks. |
| 392 if (c == '\r' && i + 1 < length && text[i + 1] == '\n') | 392 if (c == '\r' && i + 1 < length && text[i + 1] == '\n') |
| 393 i++; | 393 i++; |
| 394 } | 394 } |
| 395 | 395 |
| 396 start = i + 1; // Character after line break. | 396 start = i + 1; // Character after line break. |
| 397 } | 397 } |
| 398 | 398 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 #ifndef NDEBUG | 1099 #ifndef NDEBUG |
| 1100 | 1100 |
| 1101 // For use in the debugger | 1101 // For use in the debugger |
| 1102 void dumpInnerHTML(WebCore::HTMLElement*); | 1102 void dumpInnerHTML(WebCore::HTMLElement*); |
| 1103 | 1103 |
| 1104 void dumpInnerHTML(WebCore::HTMLElement* element) | 1104 void dumpInnerHTML(WebCore::HTMLElement* element) |
| 1105 { | 1105 { |
| 1106 printf("%s\n", element->innerHTML().ascii().data()); | 1106 printf("%s\n", element->innerHTML().ascii().data()); |
| 1107 } | 1107 } |
| 1108 #endif | 1108 #endif |
| OLD | NEW |