Index: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp |
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp |
index 8206cec2423b731be21597f5019e5d2dc235a9f9..cabca2c1c9c6e0f596ff47b762509922b00891f9 100644 |
--- a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp |
+++ b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp |
@@ -231,6 +231,8 @@ void StyleAdjuster::adjustComputedStyle(ComputedStyle& style, const ComputedStyl |
|| style.hasFilter())) |
style.setTransformStyle3D(TransformStyle3DFlat); |
+ adjustStyleForEditing(style); |
+ |
bool isSVGElement = element && element->isSVGElement(); |
if (isSVGElement) { |
// Only the root <svg> element in an SVG document fragment tree honors css position |
@@ -248,6 +250,19 @@ void StyleAdjuster::adjustComputedStyle(ComputedStyle& style, const ComputedStyl |
adjustStyleForAlignment(style, parentStyle); |
} |
+void StyleAdjuster::adjustStyleForEditing(ComputedStyle& style) |
+{ |
+ if (style.userModify() != READ_WRITE_PLAINTEXT_ONLY) |
+ return; |
+ // Collapsing whitespace is harmful in plain-text editing. |
+ if (style.whiteSpace() == NORMAL) |
+ style.setWhiteSpace(PRE_WRAP); |
+ else if (style.whiteSpace() == NOWRAP) |
+ style.setWhiteSpace(PRE); |
+ else if (style.whiteSpace() == PRE_LINE) |
+ style.setWhiteSpace(PRE_WRAP); |
+} |
+ |
void StyleAdjuster::adjustStyleForFirstLetter(ComputedStyle& style) |
{ |
if (style.styleType() != PseudoIdFirstLetter) |