Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Side by Side Diff: Source/core/html/HTMLTextAreaElement.cpp

Issue 23035007: Replace HTMLTextFormControlElement::fixPlaceholderRenderer with an override of RenderTextControl::a… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 bool HTMLTextAreaElement::shouldUseInputMethod() 505 bool HTMLTextAreaElement::shouldUseInputMethod()
506 { 506 {
507 return true; 507 return true;
508 } 508 }
509 509
510 HTMLElement* HTMLTextAreaElement::placeholderElement() const 510 HTMLElement* HTMLTextAreaElement::placeholderElement() const
511 { 511 {
512 return m_placeholder; 512 return m_placeholder;
513 } 513 }
514 514
515 void HTMLTextAreaElement::attach(const AttachContext& context)
516 {
517 HTMLTextFormControlElement::attach(context);
518 fixPlaceholderRenderer(m_placeholder, innerTextElement());
519 }
520
521 bool HTMLTextAreaElement::matchesReadOnlyPseudoClass() const 515 bool HTMLTextAreaElement::matchesReadOnlyPseudoClass() const
522 { 516 {
523 return isReadOnly(); 517 return isReadOnly();
524 } 518 }
525 519
526 bool HTMLTextAreaElement::matchesReadWritePseudoClass() const 520 bool HTMLTextAreaElement::matchesReadWritePseudoClass() const
527 { 521 {
528 return !isReadOnly(); 522 return !isReadOnly();
529 } 523 }
530 524
531 void HTMLTextAreaElement::updatePlaceholderText() 525 void HTMLTextAreaElement::updatePlaceholderText()
532 { 526 {
533 String placeholderText = strippedPlaceholder(); 527 String placeholderText = strippedPlaceholder();
534 if (placeholderText.isEmpty()) { 528 if (placeholderText.isEmpty()) {
535 if (m_placeholder) { 529 if (m_placeholder) {
536 userAgentShadowRoot()->removeChild(m_placeholder, ASSERT_NO_EXCEPTIO N); 530 userAgentShadowRoot()->removeChild(m_placeholder, ASSERT_NO_EXCEPTIO N);
537 m_placeholder = 0; 531 m_placeholder = 0;
538 } 532 }
539 return; 533 return;
540 } 534 }
541 if (!m_placeholder) { 535 if (!m_placeholder) {
542 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); 536 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document());
543 m_placeholder = placeholder.get(); 537 m_placeholder = placeholder.get();
544 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS tring::ConstructFromLiteral)); 538 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS tring::ConstructFromLiteral));
545 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n extSibling(), ASSERT_NO_EXCEPTION); 539 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n extSibling(), ASSERT_NO_EXCEPTION);
546 } 540 }
547 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); 541 m_placeholder->setTextContent(placeholderText, ASSERT_NO_EXCEPTION);
548 fixPlaceholderRenderer(m_placeholder, innerTextElement());
549 } 542 }
550 543
551 } 544 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698