| 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 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 PassRefPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName&
tagName, Document* document, HTMLFormElement* form) | 95 PassRefPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName&
tagName, Document* document, HTMLFormElement* form) |
| 96 { | 96 { |
| 97 RefPtr<HTMLTextAreaElement> textArea = adoptRef(new HTMLTextAreaElement(tagN
ame, document, form)); | 97 RefPtr<HTMLTextAreaElement> textArea = adoptRef(new HTMLTextAreaElement(tagN
ame, document, form)); |
| 98 textArea->ensureUserAgentShadowRoot(); | 98 textArea->ensureUserAgentShadowRoot(); |
| 99 return textArea.release(); | 99 return textArea.release(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot* root) | 102 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot* root) |
| 103 { | 103 { |
| 104 root->appendChild(TextControlInnerTextElement::create(document()), ASSERT_NO
_EXCEPTION); | 104 root->appendChild(TextControlInnerTextElement::create(document()), ASSERT_NO
_EXCEPTION, DeprecatedAttachNow); |
| 105 } | 105 } |
| 106 | 106 |
| 107 const AtomicString& HTMLTextAreaElement::formControlType() const | 107 const AtomicString& HTMLTextAreaElement::formControlType() const |
| 108 { | 108 { |
| 109 DEFINE_STATIC_LOCAL(const AtomicString, textarea, ("textarea", AtomicString:
:ConstructFromLiteral)); | 109 DEFINE_STATIC_LOCAL(const AtomicString, textarea, ("textarea", AtomicString:
:ConstructFromLiteral)); |
| 110 return textarea; | 110 return textarea; |
| 111 } | 111 } |
| 112 | 112 |
| 113 FormControlState HTMLTextAreaElement::saveFormControlState() const | 113 FormControlState HTMLTextAreaElement::saveFormControlState() const |
| 114 { | 114 { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 414 } |
| 415 size_t size = textNodes.size(); | 415 size_t size = textNodes.size(); |
| 416 for (size_t i = 0; i < size; ++i) | 416 for (size_t i = 0; i < size; ++i) |
| 417 removeChild(textNodes[i].get(), IGNORE_EXCEPTION); | 417 removeChild(textNodes[i].get(), IGNORE_EXCEPTION); |
| 418 | 418 |
| 419 // Normalize line endings. | 419 // Normalize line endings. |
| 420 String value = defaultValue; | 420 String value = defaultValue; |
| 421 value.replace("\r\n", "\n"); | 421 value.replace("\r\n", "\n"); |
| 422 value.replace('\r', '\n'); | 422 value.replace('\r', '\n'); |
| 423 | 423 |
| 424 insertBefore(document()->createTextNode(value), firstChild(), IGNORE_EXCEPTI
ON); | 424 insertBefore(document()->createTextNode(value), firstChild(), IGNORE_EXCEPTI
ON, DeprecatedAttachNow); |
| 425 | 425 |
| 426 if (!m_isDirty) | 426 if (!m_isDirty) |
| 427 setNonDirtyValue(value); | 427 setNonDirtyValue(value); |
| 428 } | 428 } |
| 429 | 429 |
| 430 int HTMLTextAreaElement::maxLength() const | 430 int HTMLTextAreaElement::maxLength() const |
| 431 { | 431 { |
| 432 bool ok; | 432 bool ok; |
| 433 int value = getAttribute(maxlengthAttr).string().toInt(&ok); | 433 int value = getAttribute(maxlengthAttr).string().toInt(&ok); |
| 434 return ok && value >= 0 ? value : -1; | 434 return ok && value >= 0 ? value : -1; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 if (m_placeholder) { | 535 if (m_placeholder) { |
| 536 userAgentShadowRoot()->removeChild(m_placeholder, ASSERT_NO_EXCEPTIO
N); | 536 userAgentShadowRoot()->removeChild(m_placeholder, ASSERT_NO_EXCEPTIO
N); |
| 537 m_placeholder = 0; | 537 m_placeholder = 0; |
| 538 } | 538 } |
| 539 return; | 539 return; |
| 540 } | 540 } |
| 541 if (!m_placeholder) { | 541 if (!m_placeholder) { |
| 542 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); | 542 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); |
| 543 m_placeholder = placeholder.get(); | 543 m_placeholder = placeholder.get(); |
| 544 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS
tring::ConstructFromLiteral)); | 544 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS
tring::ConstructFromLiteral)); |
| 545 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n
extSibling(), ASSERT_NO_EXCEPTION); | 545 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n
extSibling(), ASSERT_NO_EXCEPTION, DeprecatedAttachNow); |
| 546 } | 546 } |
| 547 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); | 547 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); |
| 548 fixPlaceholderRenderer(m_placeholder, innerTextElement()); | 548 fixPlaceholderRenderer(m_placeholder, innerTextElement()); |
| 549 } | 549 } |
| 550 | 550 |
| 551 } | 551 } |
| OLD | NEW |