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

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

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 10 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 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 TextControlElement::~TextControlElement() {} 74 TextControlElement::~TextControlElement() {}
75 75
76 Node::InsertionNotificationRequest TextControlElement::insertedInto( 76 Node::InsertionNotificationRequest TextControlElement::insertedInto(
77 ContainerNode* insertionPoint) { 77 ContainerNode* insertionPoint) {
78 HTMLFormControlElementWithState::insertedInto(insertionPoint); 78 HTMLFormControlElementWithState::insertedInto(insertionPoint);
79 if (!insertionPoint->isConnected()) 79 if (!insertionPoint->isConnected())
80 return InsertionDone; 80 return InsertionDone;
81 String initialValue = value(); 81 String initialValue = value();
82 setTextAsOfLastFormControlChangeEvent(initialValue.isNull() ? emptyString() 82 setTextAsOfLastFormControlChangeEvent(initialValue.isNull() ? emptyString
83 : initialValue); 83 : initialValue);
84 return InsertionDone; 84 return InsertionDone;
85 } 85 }
86 86
87 void TextControlElement::dispatchFocusEvent( 87 void TextControlElement::dispatchFocusEvent(
88 Element* oldFocusedElement, 88 Element* oldFocusedElement,
89 WebFocusType type, 89 WebFocusType type,
90 InputDeviceCapabilities* sourceCapabilities) { 90 InputDeviceCapabilities* sourceCapabilities) {
91 if (supportsPlaceholder()) 91 if (supportsPlaceholder())
92 updatePlaceholderVisibility(); 92 updatePlaceholderVisibility();
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 if (textIsChanged && layoutObject()) { 766 if (textIsChanged && layoutObject()) {
767 if (AXObjectCache* cache = document().existingAXObjectCache()) 767 if (AXObjectCache* cache = document().existingAXObjectCache())
768 cache->handleTextFormControlChanged(this); 768 cache->handleTextFormControlChanged(this);
769 } 769 }
770 } 770 }
771 771
772 String TextControlElement::innerEditorValue() const { 772 String TextControlElement::innerEditorValue() const {
773 DCHECK(!openShadowRoot()); 773 DCHECK(!openShadowRoot());
774 HTMLElement* innerEditor = innerEditorElement(); 774 HTMLElement* innerEditor = innerEditorElement();
775 if (!innerEditor || !isTextControl()) 775 if (!innerEditor || !isTextControl())
776 return emptyString(); 776 return emptyString;
777 777
778 StringBuilder result; 778 StringBuilder result;
779 for (Node& node : NodeTraversal::inclusiveDescendantsOf(*innerEditor)) { 779 for (Node& node : NodeTraversal::inclusiveDescendantsOf(*innerEditor)) {
780 if (isHTMLBRElement(node)) { 780 if (isHTMLBRElement(node)) {
781 DCHECK_EQ(&node, innerEditor->lastChild()); 781 DCHECK_EQ(&node, innerEditor->lastChild());
782 if (&node != innerEditor->lastChild()) 782 if (&node != innerEditor->lastChild())
783 result.append(newlineCharacter); 783 result.append(newlineCharacter);
784 } else if (node.isTextNode()) { 784 } else if (node.isTextNode()) {
785 result.append(toText(node).data()); 785 result.append(toText(node).data());
786 } 786 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 901
902 void TextControlElement::copyNonAttributePropertiesFromElement( 902 void TextControlElement::copyNonAttributePropertiesFromElement(
903 const Element& source) { 903 const Element& source) {
904 const TextControlElement& sourceElement = 904 const TextControlElement& sourceElement =
905 static_cast<const TextControlElement&>(source); 905 static_cast<const TextControlElement&>(source);
906 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; 906 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit;
907 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); 907 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source);
908 } 908 }
909 909
910 } // namespace blink 910 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698