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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTextAreaElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/TextControlElement.cpp
diff --git a/third_party/WebKit/Source/core/html/TextControlElement.cpp b/third_party/WebKit/Source/core/html/TextControlElement.cpp
index 07b02c61ee8450af8709263486b912496cf8533c..4c1e9485990b81c8fd48faf53abffaa89be1e518 100644
--- a/third_party/WebKit/Source/core/html/TextControlElement.cpp
+++ b/third_party/WebKit/Source/core/html/TextControlElement.cpp
@@ -831,6 +831,20 @@ String TextControlElement::innerEditorValue() const {
if (!innerEditor || !isTextControl())
return emptyString;
+ // Typically, innerEditor has 0 or one Text node followed by 0 or one <br>.
+ if (!innerEditor->hasChildren())
+ return emptyString;
+ Node& firstChild = *innerEditor->firstChild();
+ if (firstChild.isTextNode()) {
+ Node* secondChild = firstChild.nextSibling();
+ if (!secondChild)
+ return toText(firstChild).data();
+ if (!secondChild->nextSibling() && isHTMLBRElement(*secondChild))
+ return toText(firstChild).data();
+ } else if (!firstChild.nextSibling() && isHTMLBRElement(firstChild)) {
+ return emptyString;
+ }
+
StringBuilder result;
for (Node& node : NodeTraversal::inclusiveDescendantsOf(*innerEditor)) {
if (isHTMLBRElement(node)) {
« 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