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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 bool HTMLTextAreaElement::shouldUseInputMethod() | 512 bool HTMLTextAreaElement::shouldUseInputMethod() |
513 { | 513 { |
514 return true; | 514 return true; |
515 } | 515 } |
516 | 516 |
517 HTMLElement* HTMLTextAreaElement::placeholderElement() const | 517 HTMLElement* HTMLTextAreaElement::placeholderElement() const |
518 { | 518 { |
519 return m_placeholder; | 519 return m_placeholder; |
520 } | 520 } |
521 | 521 |
522 void HTMLTextAreaElement::attach(const AttachContext& context) | |
523 { | |
524 HTMLTextFormControlElement::attach(context); | |
525 fixPlaceholderRenderer(m_placeholder, innerTextElement()); | |
526 } | |
527 | |
528 bool HTMLTextAreaElement::matchesReadOnlyPseudoClass() const | 522 bool HTMLTextAreaElement::matchesReadOnlyPseudoClass() const |
529 { | 523 { |
530 return isReadOnly(); | 524 return isReadOnly(); |
531 } | 525 } |
532 | 526 |
533 bool HTMLTextAreaElement::matchesReadWritePseudoClass() const | 527 bool HTMLTextAreaElement::matchesReadWritePseudoClass() const |
534 { | 528 { |
535 return !isReadOnly(); | 529 return !isReadOnly(); |
536 } | 530 } |
537 | 531 |
538 void HTMLTextAreaElement::updatePlaceholderText() | 532 void HTMLTextAreaElement::updatePlaceholderText() |
539 { | 533 { |
540 String placeholderText = strippedPlaceholder(); | 534 String placeholderText = strippedPlaceholder(); |
541 if (placeholderText.isEmpty()) { | 535 if (placeholderText.isEmpty()) { |
542 if (m_placeholder) { | 536 if (m_placeholder) { |
543 userAgentShadowRoot()->removeChild(m_placeholder, ASSERT_NO_EXCEPTIO
N); | 537 userAgentShadowRoot()->removeChild(m_placeholder); |
544 m_placeholder = 0; | 538 m_placeholder = 0; |
545 } | 539 } |
546 return; | 540 return; |
547 } | 541 } |
548 if (!m_placeholder) { | 542 if (!m_placeholder) { |
549 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); | 543 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); |
550 m_placeholder = placeholder.get(); | 544 m_placeholder = placeholder.get(); |
551 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS
tring::ConstructFromLiteral)); | 545 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS
tring::ConstructFromLiteral)); |
552 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n
extSibling(), ASSERT_NO_EXCEPTION, DeprecatedAttachNow); | 546 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n
extSibling()); |
553 } | 547 } |
554 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); | 548 m_placeholder->setTextContent(placeholderText, ASSERT_NO_EXCEPTION); |
555 fixPlaceholderRenderer(m_placeholder, innerTextElement()); | |
556 } | 549 } |
557 | 550 |
558 } | 551 } |
OLD | NEW |