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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 { | 522 { |
523 return m_placeholder; | 523 return m_placeholder; |
524 } | 524 } |
525 | 525 |
526 void HTMLTextAreaElement::attach() | 526 void HTMLTextAreaElement::attach() |
527 { | 527 { |
528 HTMLTextFormControlElement::attach(); | 528 HTMLTextFormControlElement::attach(); |
529 fixPlaceholderRenderer(m_placeholder, innerTextElement()); | 529 fixPlaceholderRenderer(m_placeholder, innerTextElement()); |
530 } | 530 } |
531 | 531 |
| 532 bool HTMLTextAreaElement::shouldMatchReadOnlySelector() const |
| 533 { |
| 534 return readOnly(); |
| 535 } |
| 536 |
| 537 bool HTMLTextAreaElement::shouldMatchReadWriteSelector() const |
| 538 { |
| 539 return !readOnly(); |
| 540 } |
| 541 |
532 void HTMLTextAreaElement::updatePlaceholderText() | 542 void HTMLTextAreaElement::updatePlaceholderText() |
533 { | 543 { |
534 ExceptionCode ec = 0; | 544 ExceptionCode ec = 0; |
535 String placeholderText = strippedPlaceholder(); | 545 String placeholderText = strippedPlaceholder(); |
536 if (placeholderText.isEmpty()) { | 546 if (placeholderText.isEmpty()) { |
537 if (m_placeholder) { | 547 if (m_placeholder) { |
538 userAgentShadowRoot()->removeChild(m_placeholder, ec); | 548 userAgentShadowRoot()->removeChild(m_placeholder, ec); |
539 ASSERT(!ec); | 549 ASSERT(!ec); |
540 m_placeholder = 0; | 550 m_placeholder = 0; |
541 } | 551 } |
542 return; | 552 return; |
543 } | 553 } |
544 if (!m_placeholder) { | 554 if (!m_placeholder) { |
545 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); | 555 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); |
546 m_placeholder = placeholder.get(); | 556 m_placeholder = placeholder.get(); |
547 m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); | 557 m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); |
548 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n
extSibling(), ec); | 558 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n
extSibling(), ec); |
549 ASSERT(!ec); | 559 ASSERT(!ec); |
550 } | 560 } |
551 m_placeholder->setInnerText(placeholderText, ec); | 561 m_placeholder->setInnerText(placeholderText, ec); |
552 ASSERT(!ec); | 562 ASSERT(!ec); |
553 fixPlaceholderRenderer(m_placeholder, innerTextElement()); | 563 fixPlaceholderRenderer(m_placeholder, innerTextElement()); |
554 } | 564 } |
555 | 565 |
556 } | 566 } |
OLD | NEW |