| 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 setAttribute(rowsAttr, String::number(rows)); | 515 setAttribute(rowsAttr, String::number(rows)); |
| 516 } | 516 } |
| 517 | 517 |
| 518 bool HTMLTextAreaElement::shouldUseInputMethod() | 518 bool HTMLTextAreaElement::shouldUseInputMethod() |
| 519 { | 519 { |
| 520 return true; | 520 return true; |
| 521 } | 521 } |
| 522 | 522 |
| 523 HTMLElement* HTMLTextAreaElement::placeholderElement() const | 523 HTMLElement* HTMLTextAreaElement::placeholderElement() const |
| 524 { | 524 { |
| 525 return m_placeholder; | 525 return Handle<HTMLElement>(m_placeholder).raw(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 void HTMLTextAreaElement::attach() | 528 void HTMLTextAreaElement::attach() |
| 529 { | 529 { |
| 530 HTMLTextFormControlElement::attach(); | 530 HTMLTextFormControlElement::attach(); |
| 531 fixPlaceholderRenderer(m_placeholder, innerTextElement()); | 531 fixPlaceholderRenderer(Handle<HTMLElement>(m_placeholder).raw(), innerTextEl
ement()); |
| 532 } | 532 } |
| 533 | 533 |
| 534 bool HTMLTextAreaElement::matchesReadOnlyPseudoClass() const | 534 bool HTMLTextAreaElement::matchesReadOnlyPseudoClass() const |
| 535 { | 535 { |
| 536 return isReadOnly(); | 536 return isReadOnly(); |
| 537 } | 537 } |
| 538 | 538 |
| 539 bool HTMLTextAreaElement::matchesReadWritePseudoClass() const | 539 bool HTMLTextAreaElement::matchesReadWritePseudoClass() const |
| 540 { | 540 { |
| 541 return !isReadOnly(); | 541 return !isReadOnly(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 void HTMLTextAreaElement::updatePlaceholderText() | 544 void HTMLTextAreaElement::updatePlaceholderText() |
| 545 { | 545 { |
| 546 String placeholderText = strippedPlaceholder(); | 546 String placeholderText = strippedPlaceholder(); |
| 547 if (placeholderText.isEmpty()) { | 547 if (placeholderText.isEmpty()) { |
| 548 if (m_placeholder) { | 548 if (m_placeholder) { |
| 549 userAgentShadowRoot()->removeChild(m_placeholder, ASSERT_NO_EXCEPTIO
N); | 549 userAgentShadowRoot()->removeChild(Handle<HTMLElement>(m_placeholder
).raw(), ASSERT_NO_EXCEPTION); |
| 550 m_placeholder = 0; | 550 m_placeholder = nullptr; |
| 551 } | 551 } |
| 552 return; | 552 return; |
| 553 } | 553 } |
| 554 if (!m_placeholder) { | 554 if (!m_placeholder) { |
| 555 Handle<HTMLDivElement> placeholder = HTMLDivElement::create(document()); | 555 Handle<HTMLDivElement> placeholder = HTMLDivElement::create(document()); |
| 556 m_placeholder = placeholder.raw(); | 556 m_placeholder = placeholder; |
| 557 m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", Atomi
cString::ConstructFromLiteral)); | 557 m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", Atomi
cString::ConstructFromLiteral)); |
| 558 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n
extSibling(), ASSERT_NO_EXCEPTION); | 558 userAgentShadowRoot()->insertBefore(Handle<HTMLElement>(m_placeholder).r
aw(), innerTextElement()->nextSibling(), ASSERT_NO_EXCEPTION); |
| 559 } | 559 } |
| 560 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); | 560 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); |
| 561 fixPlaceholderRenderer(m_placeholder, innerTextElement()); | 561 fixPlaceholderRenderer(Handle<HTMLElement>(m_placeholder).raw(), innerTextEl
ement()); |
| 562 } | 562 } |
| 563 | 563 |
| 564 void HTMLTextAreaElement::acceptHeapVisitor(Visitor* visitor) const | 564 void HTMLTextAreaElement::acceptHeapVisitor(Visitor* visitor) const |
| 565 { | 565 { |
| 566 visitor->visit(m_placeholder); |
| 566 HTMLTextFormControlElement::acceptHeapVisitor(visitor); | 567 HTMLTextFormControlElement::acceptHeapVisitor(visitor); |
| 567 } | 568 } |
| 568 | 569 |
| 569 } | 570 } |
| OLD | NEW |