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

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

Issue 2803483005: Remove lazy evaluation of HTMLTextAreaElement::value. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp ('k') | no next file » | 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 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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 cache->handleTextFormControlChanged(this); 824 cache->handleTextFormControlChanged(this);
825 } 825 }
826 } 826 }
827 827
828 String TextControlElement::innerEditorValue() const { 828 String TextControlElement::innerEditorValue() const {
829 DCHECK(!openShadowRoot()); 829 DCHECK(!openShadowRoot());
830 HTMLElement* innerEditor = innerEditorElement(); 830 HTMLElement* innerEditor = innerEditorElement();
831 if (!innerEditor || !isTextControl()) 831 if (!innerEditor || !isTextControl())
832 return emptyString; 832 return emptyString;
833 833
834 // Typically, innerEditor has 0 or one Text node followed by 0 or one <br>.
835 if (!innerEditor->hasChildren())
836 return emptyString;
837 Node& firstChild = *innerEditor->firstChild();
838 if (firstChild.isTextNode()) {
839 Node* secondChild = firstChild.nextSibling();
840 if (!secondChild)
841 return toText(firstChild).data();
842 if (!secondChild->nextSibling() && isHTMLBRElement(*secondChild))
843 return toText(firstChild).data();
844 } else if (!firstChild.nextSibling() && isHTMLBRElement(firstChild)) {
845 return emptyString;
846 }
847
834 StringBuilder result; 848 StringBuilder result;
835 for (Node& node : NodeTraversal::inclusiveDescendantsOf(*innerEditor)) { 849 for (Node& node : NodeTraversal::inclusiveDescendantsOf(*innerEditor)) {
836 if (isHTMLBRElement(node)) { 850 if (isHTMLBRElement(node)) {
837 DCHECK_EQ(&node, innerEditor->lastChild()); 851 DCHECK_EQ(&node, innerEditor->lastChild());
838 if (&node != innerEditor->lastChild()) 852 if (&node != innerEditor->lastChild())
839 result.append(newlineCharacter); 853 result.append(newlineCharacter);
840 } else if (node.isTextNode()) { 854 } else if (node.isTextNode()) {
841 result.append(toText(node).data()); 855 result.append(toText(node).data());
842 } 856 }
843 } 857 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 971
958 void TextControlElement::copyNonAttributePropertiesFromElement( 972 void TextControlElement::copyNonAttributePropertiesFromElement(
959 const Element& source) { 973 const Element& source) {
960 const TextControlElement& sourceElement = 974 const TextControlElement& sourceElement =
961 static_cast<const TextControlElement&>(source); 975 static_cast<const TextControlElement&>(source);
962 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; 976 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit;
963 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); 977 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source);
964 } 978 }
965 979
966 } // namespace blink 980 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698