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

Unified Diff: Source/WebCore/editing/markup.cpp

Issue 9008054: Merge 102392 - Line breaks are lost when pasted into textarea text starting with a blank line set... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 8 years, 12 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 | « LayoutTests/editing/input/paste-linebreak-into-initially-hidden-textarea-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/editing/markup.cpp
===================================================================
--- Source/WebCore/editing/markup.cpp (revision 103988)
+++ Source/WebCore/editing/markup.cpp (working copy)
@@ -49,6 +49,7 @@
#include "HTMLBodyElement.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
+#include "HTMLTextFormControlElement.h"
#include "KURL.h"
#include "MarkupAccumulator.h"
#include "Range.h"
@@ -917,7 +918,8 @@
&& !block->hasTagName(bodyTag)
&& !block->hasTagName(htmlTag)
&& block != editableRootForPosition(context->startPosition());
-
+ bool useLineBreak = enclosingTextFormControl(context->startPosition());
+
Vector<String> list;
string.split('\n', true, list); // true gets us empty strings in the list
size_t numLines = list.size();
@@ -928,7 +930,10 @@
if (s.isEmpty() && i + 1 == numLines) {
// For last line, use the "magic BR" rather than a P.
element = createBreakElement(document);
- element->setAttribute(classAttr, AppleInterchangeNewline);
+ element->setAttribute(classAttr, AppleInterchangeNewline);
+ } else if (useLineBreak) {
+ element = createBreakElement(document);
+ fillContainerFromString(fragment.get(), s);
} else {
if (useClonesOfEnclosingBlock)
element = block->cloneElementWithoutChildren();
« no previous file with comments | « LayoutTests/editing/input/paste-linebreak-into-initially-hidden-textarea-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698