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

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

Issue 23886003: Have HTMLElements / SVGElements constructors take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another Android build fix Created 7 years, 3 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
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.h ('k') | Source/core/html/HTMLTextFormControlElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 count++; 72 count++;
73 } 73 }
74 return count; 74 return count;
75 } 75 }
76 76
77 static inline unsigned computeLengthForSubmission(const String& text) 77 static inline unsigned computeLengthForSubmission(const String& text)
78 { 78 {
79 return text.length() + numberOfLineBreaks(text); 79 return text.length() + numberOfLineBreaks(text);
80 } 80 }
81 81
82 HTMLTextAreaElement::HTMLTextAreaElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form) 82 HTMLTextAreaElement::HTMLTextAreaElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form)
83 : HTMLTextFormControlElement(tagName, document, form) 83 : HTMLTextFormControlElement(tagName, document, form)
84 , m_rows(defaultRows) 84 , m_rows(defaultRows)
85 , m_cols(defaultCols) 85 , m_cols(defaultCols)
86 , m_wrap(SoftWrap) 86 , m_wrap(SoftWrap)
87 , m_placeholder(0) 87 , m_placeholder(0)
88 , m_isDirty(false) 88 , m_isDirty(false)
89 , m_wasModifiedByUser(false) 89 , m_wasModifiedByUser(false)
90 { 90 {
91 ASSERT(hasTagName(textareaTag)); 91 ASSERT(hasTagName(textareaTag));
92 setFormControlValueMatchesRenderer(true); 92 setFormControlValueMatchesRenderer(true);
93 ScriptWrappable::init(this); 93 ScriptWrappable::init(this);
94 } 94 }
95 95
96 PassRefPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) 96 PassRefPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form)
97 { 97 {
98 RefPtr<HTMLTextAreaElement> textArea = adoptRef(new HTMLTextAreaElement(tagN ame, document, form)); 98 RefPtr<HTMLTextAreaElement> textArea = adoptRef(new HTMLTextAreaElement(tagN ame, document, form));
99 textArea->ensureUserAgentShadowRoot(); 99 textArea->ensureUserAgentShadowRoot();
100 return textArea.release(); 100 return textArea.release();
101 } 101 }
102 102
103 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot* root) 103 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
104 { 104 {
105 root->appendChild(TextControlInnerTextElement::create(&document())); 105 root->appendChild(TextControlInnerTextElement::create(document()));
106 } 106 }
107 107
108 const AtomicString& HTMLTextAreaElement::formControlType() const 108 const AtomicString& HTMLTextAreaElement::formControlType() const
109 { 109 {
110 DEFINE_STATIC_LOCAL(const AtomicString, textarea, ("textarea", AtomicString: :ConstructFromLiteral)); 110 DEFINE_STATIC_LOCAL(const AtomicString, textarea, ("textarea", AtomicString: :ConstructFromLiteral));
111 return textarea; 111 return textarea;
112 } 112 }
113 113
114 FormControlState HTMLTextAreaElement::saveFormControlState() const 114 FormControlState HTMLTextAreaElement::saveFormControlState() const
115 { 115 {
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 { 533 {
534 String placeholderText = strippedPlaceholder(); 534 String placeholderText = strippedPlaceholder();
535 if (placeholderText.isEmpty()) { 535 if (placeholderText.isEmpty()) {
536 if (m_placeholder) { 536 if (m_placeholder) {
537 userAgentShadowRoot()->removeChild(m_placeholder); 537 userAgentShadowRoot()->removeChild(m_placeholder);
538 m_placeholder = 0; 538 m_placeholder = 0;
539 } 539 }
540 return; 540 return;
541 } 541 }
542 if (!m_placeholder) { 542 if (!m_placeholder) {
543 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(&document()) ; 543 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document());
544 m_placeholder = placeholder.get(); 544 m_placeholder = placeholder.get();
545 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS tring::ConstructFromLiteral)); 545 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS tring::ConstructFromLiteral));
546 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n extSibling()); 546 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n extSibling());
547 } 547 }
548 m_placeholder->setTextContent(placeholderText, ASSERT_NO_EXCEPTION); 548 m_placeholder->setTextContent(placeholderText, ASSERT_NO_EXCEPTION);
549 } 549 }
550 550
551 } 551 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.h ('k') | Source/core/html/HTMLTextFormControlElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698