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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights |
6 * reserved. | 6 * reserved. |
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 static inline unsigned computeLengthForAPIValue(const String& text) { | 64 static inline unsigned computeLengthForAPIValue(const String& text) { |
65 unsigned length = text.length(); | 65 unsigned length = text.length(); |
66 unsigned crlfCount = 0; | 66 unsigned crlfCount = 0; |
67 for (unsigned i = 0; i < length; ++i) { | 67 for (unsigned i = 0; i < length; ++i) { |
68 if (text[i] == '\r' && i + 1 < length && text[i + 1] == '\n') | 68 if (text[i] == '\r' && i + 1 < length && text[i + 1] == '\n') |
69 crlfCount++; | 69 crlfCount++; |
70 } | 70 } |
71 return text.length() - crlfCount; | 71 return text.length() - crlfCount; |
72 } | 72 } |
73 | 73 |
74 HTMLTextAreaElement::HTMLTextAreaElement(Document& document, | 74 HTMLTextAreaElement::HTMLTextAreaElement(Document& document) |
75 HTMLFormElement* form) | 75 : TextControlElement(textareaTag, document), |
76 : TextControlElement(textareaTag, document, form), | |
77 m_rows(defaultRows), | 76 m_rows(defaultRows), |
78 m_cols(defaultCols), | 77 m_cols(defaultCols), |
79 m_wrap(SoftWrap), | 78 m_wrap(SoftWrap), |
80 m_isDirty(false), | 79 m_isDirty(false), |
81 m_valueIsUpToDate(true), | 80 m_valueIsUpToDate(true), |
82 m_isPlaceholderVisible(false) {} | 81 m_isPlaceholderVisible(false) {} |
83 | 82 |
84 HTMLTextAreaElement* HTMLTextAreaElement::create(Document& document, | 83 HTMLTextAreaElement* HTMLTextAreaElement::create(Document& document) { |
85 HTMLFormElement* form) { | 84 HTMLTextAreaElement* textArea = new HTMLTextAreaElement(document); |
86 HTMLTextAreaElement* textArea = new HTMLTextAreaElement(document, form); | |
87 textArea->ensureUserAgentShadowRoot(); | 85 textArea->ensureUserAgentShadowRoot(); |
88 return textArea; | 86 return textArea; |
89 } | 87 } |
90 | 88 |
91 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot& root) { | 89 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot& root) { |
92 root.appendChild(TextControlInnerEditorElement::create(document())); | 90 root.appendChild(TextControlInnerEditorElement::create(document())); |
93 } | 91 } |
94 | 92 |
95 const AtomicString& HTMLTextAreaElement::formControlType() const { | 93 const AtomicString& HTMLTextAreaElement::formControlType() const { |
96 DEFINE_STATIC_LOCAL(const AtomicString, textarea, ("textarea")); | 94 DEFINE_STATIC_LOCAL(const AtomicString, textarea, ("textarea")); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement( | 647 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement( |
650 const Element& source) { | 648 const Element& source) { |
651 const HTMLTextAreaElement& sourceElement = | 649 const HTMLTextAreaElement& sourceElement = |
652 static_cast<const HTMLTextAreaElement&>(source); | 650 static_cast<const HTMLTextAreaElement&>(source); |
653 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); | 651 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); |
654 m_isDirty = sourceElement.m_isDirty; | 652 m_isDirty = sourceElement.m_isDirty; |
655 TextControlElement::copyNonAttributePropertiesFromElement(source); | 653 TextControlElement::copyNonAttributePropertiesFromElement(source); |
656 } | 654 } |
657 | 655 |
658 } // namespace blink | 656 } // namespace blink |
OLD | NEW |