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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 } else { | 319 } else { |
320 const AtomicString& eventName = eventNameForAttributeName(name); | 320 const AtomicString& eventName = eventNameForAttributeName(name); |
321 if (!eventName.isNull()) | 321 if (!eventName.isNull()) |
322 setAttributeEventListener(eventName, createAttributeEventListener(th
is, name, value)); | 322 setAttributeEventListener(eventName, createAttributeEventListener(th
is, name, value)); |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 PassRefPtr<DocumentFragment> HTMLElement::textToFragment(const String& text, Exc
eptionState& exceptionState) | 326 PassRefPtr<DocumentFragment> HTMLElement::textToFragment(const String& text, Exc
eptionState& exceptionState) |
327 { | 327 { |
328 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document()); | 328 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document()); |
329 unsigned int i, length = text.length(); | 329 unsigned i, length = text.length(); |
330 UChar c = 0; | 330 UChar c = 0; |
331 for (unsigned int start = 0; start < length; ) { | 331 for (unsigned start = 0; start < length; ) { |
332 | 332 |
333 // Find next line break. | 333 // Find next line break. |
334 for (i = start; i < length; i++) { | 334 for (i = start; i < length; i++) { |
335 c = text[i]; | 335 c = text[i]; |
336 if (c == '\r' || c == '\n') | 336 if (c == '\r' || c == '\n') |
337 break; | 337 break; |
338 } | 338 } |
339 | 339 |
340 fragment->appendChild(Text::create(document(), text.substring(start, i -
start)), exceptionState); | 340 fragment->appendChild(Text::create(document(), text.substring(start, i -
start)), exceptionState); |
341 if (exceptionState.hadException()) | 341 if (exceptionState.hadException()) |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 } | 802 } |
803 | 803 |
804 void HTMLElement::addHTMLLengthToStyle(MutableStylePropertySet* style, CSSProper
tyID propertyID, const String& value) | 804 void HTMLElement::addHTMLLengthToStyle(MutableStylePropertySet* style, CSSProper
tyID propertyID, const String& value) |
805 { | 805 { |
806 // FIXME: This function should not spin up the CSS parser, but should instea
d just figure out the correct | 806 // FIXME: This function should not spin up the CSS parser, but should instea
d just figure out the correct |
807 // length unit and make the appropriate parsed value. | 807 // length unit and make the appropriate parsed value. |
808 | 808 |
809 // strip attribute garbage.. | 809 // strip attribute garbage.. |
810 StringImpl* v = value.impl(); | 810 StringImpl* v = value.impl(); |
811 if (v) { | 811 if (v) { |
812 unsigned int l = 0; | 812 unsigned length = 0; |
813 | 813 |
814 while (l < v->length() && (*v)[l] <= ' ') | 814 while (length < v->length() && (*v)[length] <= ' ') |
815 l++; | 815 length++; |
816 | 816 |
817 for (; l < v->length(); l++) { | 817 for (; length < v->length(); length++) { |
818 UChar cc = (*v)[l]; | 818 UChar cc = (*v)[length]; |
819 if (cc > '9') | 819 if (cc > '9') |
820 break; | 820 break; |
821 if (cc < '0') { | 821 if (cc < '0') { |
822 if (cc == '%' || cc == '*') | 822 if (cc == '%' || cc == '*') |
823 l++; | 823 length++; |
824 if (cc != '.') | 824 if (cc != '.') |
825 break; | 825 break; |
826 } | 826 } |
827 } | 827 } |
828 | 828 |
829 if (l != v->length()) { | 829 if (length != v->length()) { |
830 addPropertyToPresentationAttributeStyle(style, propertyID, v->substr
ing(0, l)); | 830 addPropertyToPresentationAttributeStyle(style, propertyID, v->substr
ing(0, length)); |
831 return; | 831 return; |
832 } | 832 } |
833 } | 833 } |
834 | 834 |
835 addPropertyToPresentationAttributeStyle(style, propertyID, value); | 835 addPropertyToPresentationAttributeStyle(style, propertyID, value); |
836 } | 836 } |
837 | 837 |
838 static RGBA32 parseColorStringWithCrazyLegacyRules(const String& colorString) | 838 static RGBA32 parseColorStringWithCrazyLegacyRules(const String& colorString) |
839 { | 839 { |
840 // Per spec, only look at the first 128 digits of the string. | 840 // Per spec, only look at the first 128 digits of the string. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 #ifndef NDEBUG | 968 #ifndef NDEBUG |
969 | 969 |
970 // For use in the debugger | 970 // For use in the debugger |
971 void dumpInnerHTML(WebCore::HTMLElement*); | 971 void dumpInnerHTML(WebCore::HTMLElement*); |
972 | 972 |
973 void dumpInnerHTML(WebCore::HTMLElement* element) | 973 void dumpInnerHTML(WebCore::HTMLElement* element) |
974 { | 974 { |
975 printf("%s\n", element->innerHTML().ascii().data()); | 975 printf("%s\n", element->innerHTML().ascii().data()); |
976 } | 976 } |
977 #endif | 977 #endif |
OLD | NEW |