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

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

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
104 { 104 {
105 DEFINE_STATIC_LOCAL(const AtomicString, textarea, ("textarea", AtomicString: :ConstructFromLiteral)); 105 DEFINE_STATIC_LOCAL(const AtomicString, textarea, ("textarea"));
106 return textarea; 106 return textarea;
107 } 107 }
108 108
109 FormControlState HTMLTextAreaElement::saveFormControlState() const 109 FormControlState HTMLTextAreaElement::saveFormControlState() const
110 { 110 {
111 return m_isDirty ? FormControlState(value()) : FormControlState(); 111 return m_isDirty ? FormControlState(value()) : FormControlState();
112 } 112 }
113 113
114 void HTMLTextAreaElement::restoreFormControlState(const FormControlState& state) 114 void HTMLTextAreaElement::restoreFormControlState(const FormControlState& state)
115 { 115 {
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 RefPtrWillBeRawPtr<HTMLDivElement> newElement = HTMLDivElement::create(d ocument());
638 placeholder = newElement.get(); 638 placeholder = newElement.get();
639 placeholder->setShadowPseudoId(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral)); 639 placeholder->setShadowPseudoId(AtomicString("-webkit-input-placeholder") );
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
648 { 648 {
649 return true; 649 return true;
650 } 650 }
651 651
652 bool HTMLTextAreaElement::supportsAutofocus() const 652 bool HTMLTextAreaElement::supportsAutofocus() const
653 { 653 {
654 return true; 654 return true;
655 } 655 }
656 656
657 const AtomicString& HTMLTextAreaElement::defaultAutocapitalize() const 657 const AtomicString& HTMLTextAreaElement::defaultAutocapitalize() const
658 { 658 {
659 DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences", AtomicStrin g::ConstructFromLiteral)); 659 DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences"));
660 return sentences; 660 return sentences;
661 } 661 }
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