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

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

Issue 8907027: Line breaks are lost when pasted into textarea text starting with a blank line set while textarea... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 9 years 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 | « Source/WebCore/ChangeLog ('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 102723)
+++ 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"
@@ -880,7 +881,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();
@@ -891,7 +893,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 | « Source/WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698