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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 : HTMLTextFormControlElement(textareaTag, document, form) 81 : HTMLTextFormControlElement(textareaTag, document, form)
82 , m_rows(defaultRows) 82 , m_rows(defaultRows)
83 , m_cols(defaultCols) 83 , m_cols(defaultCols)
84 , m_wrap(SoftWrap) 84 , m_wrap(SoftWrap)
85 , m_isDirty(false) 85 , m_isDirty(false)
86 , m_valueIsUpToDate(true) 86 , m_valueIsUpToDate(true)
87 , m_isPlaceholderVisible(false) 87 , m_isPlaceholderVisible(false)
88 { 88 {
89 } 89 }
90 90
91 PassRefPtrWillBeRawPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(Document & document, HTMLFormElement* form) 91 RawPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(Document& document, HTML FormElement* form)
92 { 92 {
93 RefPtrWillBeRawPtr<HTMLTextAreaElement> textArea = adoptRefWillBeNoop(new HT MLTextAreaElement(document, form)); 93 RawPtr<HTMLTextAreaElement> textArea = new HTMLTextAreaElement(document, for m);
94 textArea->ensureUserAgentShadowRoot(); 94 textArea->ensureUserAgentShadowRoot();
95 return textArea.release(); 95 return textArea.release();
96 } 96 }
97 97
98 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot& root) 98 void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot& root)
99 { 99 {
100 root.appendChild(TextControlInnerEditorElement::create(document())); 100 root.appendChild(TextControlInnerEditorElement::create(document()));
101 } 101 }
102 102
103 const AtomicString& HTMLTextAreaElement::formControlType() const 103 const AtomicString& HTMLTextAreaElement::formControlType() const
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 351 }
352 352
353 String HTMLTextAreaElement::value() const 353 String HTMLTextAreaElement::value() const
354 { 354 {
355 updateValue(); 355 updateValue();
356 return m_value; 356 return m_value;
357 } 357 }
358 358
359 void HTMLTextAreaElement::setValue(const String& value, TextFieldEventBehavior e ventBehavior) 359 void HTMLTextAreaElement::setValue(const String& value, TextFieldEventBehavior e ventBehavior)
360 { 360 {
361 RefPtrWillBeRawPtr<HTMLTextAreaElement> protector(this); 361 RawPtr<HTMLTextAreaElement> protector(this);
362 setValueCommon(value, eventBehavior); 362 setValueCommon(value, eventBehavior);
363 m_isDirty = true; 363 m_isDirty = true;
364 if (document().focusedElement() == this) 364 if (document().focusedElement() == this)
365 document().frameHost()->chromeClient().didUpdateTextOfFocusedElementByNo nUserInput(); 365 document().frameHost()->chromeClient().didUpdateTextOfFocusedElementByNo nUserInput();
366 } 366 }
367 367
368 void HTMLTextAreaElement::setNonDirtyValue(const String& value) 368 void HTMLTextAreaElement::setNonDirtyValue(const String& value)
369 { 369 {
370 setValueCommon(value, DispatchNoEvent, SetSeletion); 370 setValueCommon(value, DispatchNoEvent, SetSeletion);
371 m_isDirty = false; 371 m_isDirty = false;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 for (Node* n = firstChild(); n; n = n->nextSibling()) { 433 for (Node* n = firstChild(); n; n = n->nextSibling()) {
434 if (n->isTextNode()) 434 if (n->isTextNode())
435 value.append(toText(n)->data()); 435 value.append(toText(n)->data());
436 } 436 }
437 437
438 return value.toString(); 438 return value.toString();
439 } 439 }
440 440
441 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue) 441 void HTMLTextAreaElement::setDefaultValue(const String& defaultValue)
442 { 442 {
443 RefPtrWillBeRawPtr<Node> protectFromMutationEvents(this); 443 RawPtr<Node> protectFromMutationEvents(this);
444 444
445 // To preserve comments, remove only the text nodes, then add a single text node. 445 // To preserve comments, remove only the text nodes, then add a single text node.
446 WillBeHeapVector<RefPtrWillBeMember<Node>> textNodes; 446 HeapVector<Member<Node>> textNodes;
447 for (Node* n = firstChild(); n; n = n->nextSibling()) { 447 for (Node* n = firstChild(); n; n = n->nextSibling()) {
448 if (n->isTextNode()) 448 if (n->isTextNode())
449 textNodes.append(n); 449 textNodes.append(n);
450 } 450 }
451 size_t size = textNodes.size(); 451 size_t size = textNodes.size();
452 for (size_t i = 0; i < size; ++i) 452 for (size_t i = 0; i < size; ++i)
453 removeChild(textNodes[i].get(), IGNORE_EXCEPTION); 453 removeChild(textNodes[i].get(), IGNORE_EXCEPTION);
454 454
455 // Normalize line endings. 455 // Normalize line endings.
456 String value = defaultValue; 456 String value = defaultValue;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 void HTMLTextAreaElement::updatePlaceholderText() 627 void HTMLTextAreaElement::updatePlaceholderText()
628 { 628 {
629 HTMLElement* placeholder = placeholderElement(); 629 HTMLElement* placeholder = placeholderElement();
630 const AtomicString& placeholderText = fastGetAttribute(placeholderAttr); 630 const AtomicString& placeholderText = fastGetAttribute(placeholderAttr);
631 if (placeholderText.isEmpty()) { 631 if (placeholderText.isEmpty()) {
632 if (placeholder) 632 if (placeholder)
633 userAgentShadowRoot()->removeChild(placeholder); 633 userAgentShadowRoot()->removeChild(placeholder);
634 return; 634 return;
635 } 635 }
636 if (!placeholder) { 636 if (!placeholder) {
637 RefPtrWillBeRawPtr<HTMLDivElement> newElement = HTMLDivElement::create(d ocument()); 637 RawPtr<HTMLDivElement> newElement = HTMLDivElement::create(document());
638 placeholder = newElement.get(); 638 placeholder = newElement.get();
639 placeholder->setShadowPseudoId(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral)); 639 placeholder->setShadowPseudoId(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral));
640 placeholder->setAttribute(idAttr, ShadowElementNames::placeholder()); 640 placeholder->setAttribute(idAttr, ShadowElementNames::placeholder());
641 placeholder->setInlineStyleProperty(CSSPropertyDisplay, isPlaceholderVis ible() ? CSSValueBlock : CSSValueNone, true); 641 placeholder->setInlineStyleProperty(CSSPropertyDisplay, isPlaceholderVis ible() ? CSSValueBlock : CSSValueNone, true);
642 userAgentShadowRoot()->insertBefore(placeholder, innerEditorElement()); 642 userAgentShadowRoot()->insertBefore(placeholder, innerEditorElement());
643 } 643 }
644 placeholder->setTextContent(placeholderText); 644 placeholder->setTextContent(placeholderText);
645 } 645 }
646 646
647 bool HTMLTextAreaElement::isInteractiveContent() const 647 bool HTMLTextAreaElement::isInteractiveContent() const
(...skipping 14 matching lines...) Expand all
662 662
663 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(const Element& s ource) 663 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(const Element& s ource)
664 { 664 {
665 const HTMLTextAreaElement& sourceElement = static_cast<const HTMLTextAreaEle ment&>(source); 665 const HTMLTextAreaElement& sourceElement = static_cast<const HTMLTextAreaEle ment&>(source);
666 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); 666 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion);
667 m_isDirty = sourceElement.m_isDirty; 667 m_isDirty = sourceElement.m_isDirty;
668 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); 668 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source);
669 } 669 }
670 670
671 } // namespace blink 671 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698