Title: [159192] trunk
Revision
159192
Author
[email protected]
Date
2013-11-13 05:25:32 -0800 (Wed, 13 Nov 2013)

Log Message

Support overflow-wrap:break-word on simple line path
https://bugs.webkit.org/show_bug.cgi?id=124206

Source/WebCore: 

Reviewed by Andreas Kling.

Pure text documents are rendered with break-word. It is also common in discussion board type sites.
        
This also makes many <textarea>'s rendered using the simple line path.

Tests: fast/forms/basic-textareas-quirks-simple-lines.html
       fast/forms/linebox-overflow-in-textarea-padding-simple-lines.html
       fast/forms/negativeLineHeight-simple-lines.html
       fast/forms/textAreaLineHeight-simple-lines.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateShapeInsideInfoAfterStyleChange):
(WebCore::RenderBlock::markShapeInsideDescendantsForLayout):
        
    Invalidate the cached line layout mode on shape-inside style change.

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForText):
(WebCore::SimpleLineLayout::canUseFor):
(WebCore::SimpleLineLayout::createTextRuns):

LayoutTests: 

Reviewed by Andreas Kling.
        
Force these to use line boxes, add ref test versions comparing the paths.

* fast/forms/basic-textareas-quirks-simple-lines-expected.html: Added.
* fast/forms/basic-textareas-quirks-simple-lines.html: Added.
* fast/forms/basic-textareas-quirks.html:
* fast/forms/linebox-overflow-in-textarea-padding-simple-lines-expected.html: Added.
* fast/forms/linebox-overflow-in-textarea-padding-simple-lines.html: Added.
* fast/forms/linebox-overflow-in-textarea-padding.html:
* fast/forms/negativeLineHeight-simple-lines-expected.html: Added.
* fast/forms/negativeLineHeight-simple-lines.html: Added.
* fast/forms/negativeLineHeight.html:
* fast/forms/textAreaLineHeight-simple-lines-expected.html: Added.
* fast/forms/textAreaLineHeight-simple-lines.html: Added.
* fast/forms/textAreaLineHeight.html:
* fast/parser/entity-comment-in-textarea.html: Made this independent of line layout mode.
* fast/replaced/width100percent-textarea.html:
* platform/mac/fast/parser/entity-comment-in-textarea-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (159191 => 159192)


--- trunk/LayoutTests/ChangeLog	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/LayoutTests/ChangeLog	2013-11-13 13:25:32 UTC (rev 159192)
@@ -1,3 +1,28 @@
+2013-11-12  Antti Koivisto  <[email protected]>
+
+        Support overflow-wrap:break-word on simple line path
+        https://bugs.webkit.org/show_bug.cgi?id=124206
+
+        Reviewed by Andreas Kling.
+        
+        Force these to use line boxes, add ref test versions comparing the paths.
+
+        * fast/forms/basic-textareas-quirks-simple-lines-expected.html: Added.
+        * fast/forms/basic-textareas-quirks-simple-lines.html: Added.
+        * fast/forms/basic-textareas-quirks.html:
+        * fast/forms/linebox-overflow-in-textarea-padding-simple-lines-expected.html: Added.
+        * fast/forms/linebox-overflow-in-textarea-padding-simple-lines.html: Added.
+        * fast/forms/linebox-overflow-in-textarea-padding.html:
+        * fast/forms/negativeLineHeight-simple-lines-expected.html: Added.
+        * fast/forms/negativeLineHeight-simple-lines.html: Added.
+        * fast/forms/negativeLineHeight.html:
+        * fast/forms/textAreaLineHeight-simple-lines-expected.html: Added.
+        * fast/forms/textAreaLineHeight-simple-lines.html: Added.
+        * fast/forms/textAreaLineHeight.html:
+        * fast/parser/entity-comment-in-textarea.html: Made this independent of line layout mode.
+        * fast/replaced/width100percent-textarea.html:
+        * platform/mac/fast/parser/entity-comment-in-textarea-expected.txt:
+
 2013-11-13  Thiago de Barros Lacerda  <[email protected]>
 
         Removing fast/mediastream/constructors.html LayoutTest

Added: trunk/LayoutTests/fast/forms/basic-textareas-quirks-simple-lines-expected.html (0 => 159192)


--- trunk/LayoutTests/fast/forms/basic-textareas-quirks-simple-lines-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/basic-textareas-quirks-simple-lines-expected.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -0,0 +1,256 @@
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
+<html><head><style>
+div {
+  border:1px solid red;
+  width:350px;
+  font-size:14px;
+  line-height:14px;
+}
+.wrapper-div {
+  float:left;
+}
+</style></head>
+<body>
+
+<div class='wrapper-div'>
+Plain textarea with little content
+<div>
+A
+<textarea>Lorem ipsum dolor</textarea>
+B
+</div>
+
+Plain textarea
+<div>
+A
+<textarea>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+Disabled textarea
+<div>
+A
+<textarea DISABLED>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="padding:10px"
+<div>
+A
+<textarea style="padding:10px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="padding:0px"
+<div>
+A
+<textarea style="padding:0px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="margin:10px"
+<div>
+A
+<textarea style="margin:10px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="margin:0px"
+<div>
+A
+<textarea style="margin:0px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=3
+<div>
+A
+<textarea cols=3>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+rows=3
+<div>
+A
+<textarea rows=3>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=10
+<div>
+A
+<textarea cols=10>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+rows=10
+<div>
+A
+<textarea rows=10>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=5 rows=4
+<div>
+A
+<textarea cols=5 rows=4>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+</div>
+<div class='wrapper-div'>
+
+style="width:60px"
+<div>
+A
+<textarea style="width:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="width:60px;padding:20px"
+<div>
+A
+<textarea style="width:60px;padding:20px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="width:60px;padding:0"
+<div>
+A
+<textarea style="width:60px;padding:0">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="height:60px"
+<div>
+A
+<textarea style="height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="width:60px;height:60px"
+<div>
+A
+<textarea style="width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="overflow:hidden"
+<div>
+A
+<textarea style="overflow:hidden">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="overflow:scroll"
+<div>
+A
+<textarea style="overflow:scroll">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="overflow:hidden;width:60px;height:60px"
+<div>
+A
+<textarea style="overflow:hidden;width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="overflow:scroll;width:60px;height:60px"
+<div>
+A
+<textarea style="overflow:scroll;width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=5 style="width:60px;height:60px"
+<div>
+A
+<textarea cols=5 style="width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+rows=4 style="width:60px;height:60px"
+<div>
+A
+<textarea rows=4 style="width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=5 rows=4 style="width:60px;height:60px"
+<div>
+A
+<textarea cols=5 rows=4 style="width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+wrap="off"
+<div>
+A
+<textarea wrap="off"> 
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+</textarea> 
+B
+</div>
+
+wrap="hard"
+<div>
+A
+<textarea wrap="hard"> 
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+</textarea> 
+B
+</div>
+
+wrap="soft"
+<div>
+A
+<textarea wrap="soft"> 
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+</textarea> 
+B
+</div>
+</div>
+</body></html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/forms/basic-textareas-quirks-simple-lines.html (0 => 159192)


--- trunk/LayoutTests/fast/forms/basic-textareas-quirks-simple-lines.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/basic-textareas-quirks-simple-lines.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -0,0 +1,252 @@
+<html><head><style>
+div {
+  border:1px solid red;
+  width:350px;
+  font-size:14px;
+  line-height:14px;
+}
+.wrapper-div {
+  float:left;
+}
+</style></head>
+<body>
+
+<div class='wrapper-div'>
+Plain textarea with little content
+<div>
+A
+<textarea>Lorem ipsum dolor</textarea>
+B
+</div>
+
+Plain textarea
+<div>
+A
+<textarea>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+Disabled textarea
+<div>
+A
+<textarea DISABLED>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="padding:10px"
+<div>
+A
+<textarea style="padding:10px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="padding:0px"
+<div>
+A
+<textarea style="padding:0px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="margin:10px"
+<div>
+A
+<textarea style="margin:10px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="margin:0px"
+<div>
+A
+<textarea style="margin:0px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=3
+<div>
+A
+<textarea cols=3>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+rows=3
+<div>
+A
+<textarea rows=3>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=10
+<div>
+A
+<textarea cols=10>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+rows=10
+<div>
+A
+<textarea rows=10>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=5 rows=4
+<div>
+A
+<textarea cols=5 rows=4>Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+</div>
+<div class='wrapper-div'>
+
+style="width:60px"
+<div>
+A
+<textarea style="width:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="width:60px;padding:20px"
+<div>
+A
+<textarea style="width:60px;padding:20px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="width:60px;padding:0"
+<div>
+A
+<textarea style="width:60px;padding:0">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="height:60px"
+<div>
+A
+<textarea style="height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="width:60px;height:60px"
+<div>
+A
+<textarea style="width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="overflow:hidden"
+<div>
+A
+<textarea style="overflow:hidden">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="overflow:scroll"
+<div>
+A
+<textarea style="overflow:scroll">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="overflow:hidden;width:60px;height:60px"
+<div>
+A
+<textarea style="overflow:hidden;width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+style="overflow:scroll;width:60px;height:60px"
+<div>
+A
+<textarea style="overflow:scroll;width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=5 style="width:60px;height:60px"
+<div>
+A
+<textarea cols=5 style="width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+rows=4 style="width:60px;height:60px"
+<div>
+A
+<textarea rows=4 style="width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+cols=5 rows=4 style="width:60px;height:60px"
+<div>
+A
+<textarea cols=5 rows=4 style="width:60px;height:60px">Lorem ipsum dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv </textarea>
+B
+</div>
+
+wrap="off"
+<div>
+A
+<textarea wrap="off"> 
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+</textarea> 
+B
+</div>
+
+wrap="hard"
+<div>
+A
+<textarea wrap="hard"> 
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+</textarea> 
+B
+</div>
+
+wrap="soft"
+<div>
+A
+<textarea wrap="soft"> 
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+This is a text area with wrap="soft"
+</textarea> 
+B
+</div>
+</div>
+</body></html>
\ No newline at end of file

Modified: trunk/LayoutTests/fast/forms/basic-textareas-quirks.html (159191 => 159192)


--- trunk/LayoutTests/fast/forms/basic-textareas-quirks.html	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/LayoutTests/fast/forms/basic-textareas-quirks.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -1,3 +1,7 @@
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
 <html><head><style>
 div {
   border:1px solid red;

Added: trunk/LayoutTests/fast/forms/linebox-overflow-in-textarea-padding-simple-lines-expected.html (0 => 159192)


--- trunk/LayoutTests/fast/forms/linebox-overflow-in-textarea-padding-simple-lines-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/linebox-overflow-in-textarea-padding-simple-lines-expected.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -0,0 +1,26 @@
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
+<style>
+textarea, #foo {
+    font-size: 30px;
+    font-family: courier;
+    border: 3px solid yellow;
+    height: 50px;
+    width: 300px;
+    color: blue;
+    padding:15px;
+    line-height: 0px
+}
+#foo {
+    display:inline-block;
+    overflow:auto;
+    -webkit-box-sizing:border-box;
+}
+</style>
+
+<textarea>ggggggggg ggggggggg</textarea>
+<div id="foo"><div>ggggggggg ggggggggg</div></div>
+
+<p>This is a pixel test that tests the linebox overflow in the padding on textareas. The div on the right is styled to look like a textarea.</p>
\ No newline at end of file

Added: trunk/LayoutTests/fast/forms/linebox-overflow-in-textarea-padding-simple-lines.html (0 => 159192)


--- trunk/LayoutTests/fast/forms/linebox-overflow-in-textarea-padding-simple-lines.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/linebox-overflow-in-textarea-padding-simple-lines.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -0,0 +1,22 @@
+<style>
+textarea, #foo {
+    font-size: 30px;
+    font-family: courier;
+    border: 3px solid yellow;
+    height: 50px;
+    width: 300px;
+    color: blue;
+    padding:15px;
+    line-height: 0px
+}
+#foo {
+    display:inline-block;
+    overflow:auto;
+    -webkit-box-sizing:border-box;
+}
+</style>
+
+<textarea>ggggggggg ggggggggg</textarea>
+<div id="foo"><div>ggggggggg ggggggggg</div></div>
+
+<p>This is a pixel test that tests the linebox overflow in the padding on textareas. The div on the right is styled to look like a textarea.</p>
\ No newline at end of file

Modified: trunk/LayoutTests/fast/forms/linebox-overflow-in-textarea-padding.html (159191 => 159192)


--- trunk/LayoutTests/fast/forms/linebox-overflow-in-textarea-padding.html	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/LayoutTests/fast/forms/linebox-overflow-in-textarea-padding.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -1,3 +1,7 @@
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
 <style>
 textarea, #foo {
     font-size: 30px;

Added: trunk/LayoutTests/fast/forms/negativeLineHeight-simple-lines-expected.html (0 => 159192)


--- trunk/LayoutTests/fast/forms/negativeLineHeight-simple-lines-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/negativeLineHeight-simple-lines-expected.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -0,0 +1,27 @@
+<html lang="en">
+<head>
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
+	<style type="text/css">
+		.p { 			
+				border: dotted silver 1px;
+				font-style:italic;
+				font-family: Verdana, Arial, Helvetica;
+				font-size: 10pt;
+				line-height:-400%;
+				width:400px; height:200px;
+			}	
+	
+	</style>
+</head>
+<body>
+The textarea below should have standard line-height because textareas should ignore negative line-heights<br/>
+<p>	TEXTAREA<br/>
+		<textarea id="myTA" class="p">Demo text here that wraps a bit and should demonstrate the goodness of line-height</textarea>
+    <br/><br/>
+        
+</p>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/forms/negativeLineHeight-simple-lines.html (0 => 159192)


--- trunk/LayoutTests/fast/forms/negativeLineHeight-simple-lines.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/negativeLineHeight-simple-lines.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -0,0 +1,23 @@
+<html lang="en">
+<head>
+	<style type="text/css">
+		.p { 			
+				border: dotted silver 1px;
+				font-style:italic;
+				font-family: Verdana, Arial, Helvetica;
+				font-size: 10pt;
+				line-height:-400%;
+				width:400px; height:200px;
+			}	
+	
+	</style>
+</head>
+<body>
+The textarea below should have standard line-height because textareas should ignore negative line-heights<br/>
+<p>	TEXTAREA<br/>
+		<textarea id="myTA" class="p">Demo text here that wraps a bit and should demonstrate the goodness of line-height</textarea>
+    <br/><br/>
+        
+</p>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/fast/forms/negativeLineHeight.html (159191 => 159192)


--- trunk/LayoutTests/fast/forms/negativeLineHeight.html	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/LayoutTests/fast/forms/negativeLineHeight.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -1,5 +1,9 @@
 <html lang="en">
 <head>
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
 	<style type="text/css">
 		.p { 			
 				border: dotted silver 1px;

Added: trunk/LayoutTests/fast/forms/textAreaLineHeight-simple-lines-expected.html (0 => 159192)


--- trunk/LayoutTests/fast/forms/textAreaLineHeight-simple-lines-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/textAreaLineHeight-simple-lines-expected.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
+	<meta http-equiv="content-type" content="text/html; charset=utf-8">
+	<title>StyledTA</title>
+	<meta name="generator" content="BBEdit 8.2">
+	<style type="text/css">
+		.p { 			
+				border: dotted silver 1px;
+				font-style:italic;
+				font-family: Verdana, Arial, Helvetica;
+				font-size: 10pt;
+				line-height:400%;
+				width:400px; height:200px;
+			}	
+	
+	</style>
+</head>
+<body>
+line-height settings not reflected in textarea<br/>
+<p>	TEXTAREA<br/>
+		<textarea id="myTA" class="p">Demo text here that wraps a bit and should demonstrate the goodness of line-height</textarea>
+    <br/><br/>PARAGRAPH - works
+   		<p class="p">Demo text here that wraps a bit and should demonstrate the goodness of line-height</p>
+   <br/>DIV - works<br/>
+                <div class="p">Demo text here that wraps a bit and should demonstrate the goodness of line-height</div>
+    <br/><br/>Un-Styled Textarea<br/>
+                <textarea>Demo text here that wraps a bit and should demonstrate the goodness of line-height</textarea>
+    <br/><br/>Totally Blank Un-Styled Textarea<br/>
+                <textarea></textarea>
+    <br/><br/>Totally Blank STYLED Textarea<br/>
+                <textarea id="myTA" class="p"></textarea>
+        
+</p>
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/textAreaLineHeight-simple-lines.html (0 => 159192)


--- trunk/LayoutTests/fast/forms/textAreaLineHeight-simple-lines.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/textAreaLineHeight-simple-lines.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+	<meta http-equiv="content-type" content="text/html; charset=utf-8">
+	<title>StyledTA</title>
+	<meta name="generator" content="BBEdit 8.2">
+	<style type="text/css">
+		.p { 			
+				border: dotted silver 1px;
+				font-style:italic;
+				font-family: Verdana, Arial, Helvetica;
+				font-size: 10pt;
+				line-height:400%;
+				width:400px; height:200px;
+			}	
+	
+	</style>
+</head>
+<body>
+line-height settings not reflected in textarea<br/>
+<p>	TEXTAREA<br/>
+		<textarea id="myTA" class="p">Demo text here that wraps a bit and should demonstrate the goodness of line-height</textarea>
+    <br/><br/>PARAGRAPH - works
+   		<p class="p">Demo text here that wraps a bit and should demonstrate the goodness of line-height</p>
+   <br/>DIV - works<br/>
+                <div class="p">Demo text here that wraps a bit and should demonstrate the goodness of line-height</div>
+    <br/><br/>Un-Styled Textarea<br/>
+                <textarea>Demo text here that wraps a bit and should demonstrate the goodness of line-height</textarea>
+    <br/><br/>Totally Blank Un-Styled Textarea<br/>
+                <textarea></textarea>
+    <br/><br/>Totally Blank STYLED Textarea<br/>
+                <textarea id="myTA" class="p"></textarea>
+        
+</p>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/forms/textAreaLineHeight.html (159191 => 159192)


--- trunk/LayoutTests/fast/forms/textAreaLineHeight.html	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/LayoutTests/fast/forms/textAreaLineHeight.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -2,6 +2,10 @@
         "http://www.w3.org/TR/html4/strict.dtd">
 <html lang="en">
 <head>
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+</script>
 	<meta http-equiv="content-type" content="text/html; charset=utf-8">
 	<title>StyledTA</title>
 	<meta name="generator" content="BBEdit 8.2">

Modified: trunk/LayoutTests/fast/parser/entity-comment-in-textarea.html (159191 => 159192)


--- trunk/LayoutTests/fast/parser/entity-comment-in-textarea.html	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/LayoutTests/fast/parser/entity-comment-in-textarea.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -1,7 +1,7 @@
 <html>
 <body>
 <textarea>
-&lt;!-- </textarea> --&gt;
+&lt;!--</textarea> --&gt;
 This should be outside the textarea.
 </textarea>
 </body>

Modified: trunk/LayoutTests/fast/replaced/width100percent-textarea.html (159191 => 159192)


--- trunk/LayoutTests/fast/replaced/width100percent-textarea.html	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/LayoutTests/fast/replaced/width100percent-textarea.html	2013-11-13 13:25:32 UTC (rev 159192)
@@ -6,6 +6,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
 if (window.testRunner)
     testRunner.display();
 </script>

Modified: trunk/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.txt (159191 => 159192)


--- trunk/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.txt	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.txt	2013-11-13 13:25:32 UTC (rev 159192)
@@ -8,6 +8,5 @@
 layer at (10,10) size 161x32 clip at (11,11) size 159x30
   RenderTextControl {TEXTAREA} at (2,2) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     RenderBlock {DIV} at (3,3) size 155x13
-      RenderText {#text} at (0,0) size 29x13
+      RenderText {#text} at (0,0) size 26x13
         text run at (0,0) width 26: "<!--"
-        text run at (25,0) width 4: " "

Modified: trunk/LayoutTests/platform/mac-mountainlion/fast/parser/entity-comment-in-textarea-expected.txt (159191 => 159192)


--- trunk/LayoutTests/platform/mac-mountainlion/fast/parser/entity-comment-in-textarea-expected.txt	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/LayoutTests/platform/mac-mountainlion/fast/parser/entity-comment-in-textarea-expected.txt	2013-11-13 13:25:32 UTC (rev 159192)
@@ -8,6 +8,5 @@
 layer at (10,10) size 161x32 clip at (11,11) size 159x30
   RenderTextControl {TEXTAREA} at (2,2) size 161x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     RenderBlock {DIV} at (3,3) size 155x13
-      RenderText {#text} at (0,0) size 29x13
+      RenderText {#text} at (0,0) size 25x13
         text run at (0,0) width 25: "<!--"
-        text run at (24,0) width 5: " "

Modified: trunk/Source/WebCore/ChangeLog (159191 => 159192)


--- trunk/Source/WebCore/ChangeLog	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/Source/WebCore/ChangeLog	2013-11-13 13:25:32 UTC (rev 159192)
@@ -1,3 +1,30 @@
+2013-11-12  Antti Koivisto  <[email protected]>
+
+        Support overflow-wrap:break-word on simple line path
+        https://bugs.webkit.org/show_bug.cgi?id=124206
+
+        Reviewed by Andreas Kling.
+
+        Pure text documents are rendered with break-word. It is also common in discussion board type sites.
+        
+        This also makes many <textarea>'s rendered using the simple line path.
+
+        Tests: fast/forms/basic-textareas-quirks-simple-lines.html
+               fast/forms/linebox-overflow-in-textarea-padding-simple-lines.html
+               fast/forms/negativeLineHeight-simple-lines.html
+               fast/forms/textAreaLineHeight-simple-lines.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::updateShapeInsideInfoAfterStyleChange):
+        (WebCore::RenderBlock::markShapeInsideDescendantsForLayout):
+        
+            Invalidate the cached line layout mode on shape-inside style change.
+
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::canUseForText):
+        (WebCore::SimpleLineLayout::canUseFor):
+        (WebCore::SimpleLineLayout::createTextRuns):
+
 2013-11-13  Andreas Kling  <[email protected]>
 
         Turn some not-so-rare ElementRareData bits into Node flags.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (159191 => 159192)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-11-13 13:25:32 UTC (rev 159192)
@@ -1419,10 +1419,9 @@
     if (shapeInside) {
         ShapeInsideInfo* shapeInsideInfo = ensureShapeInsideInfo();
         shapeInsideInfo->dirtyShapeSize();
-    } else {
+    } else
         setShapeInsideInfo(nullptr);
-        markShapeInsideDescendantsForLayout();
-    }
+    markShapeInsideDescendantsForLayout();
 }
 
 ShapeInsideInfo* RenderBlock::ensureShapeInsideInfo()
@@ -1452,6 +1451,7 @@
         return;
     if (childrenInline()) {
         setNeedsLayout();
+        invalidateLineLayoutPath();
         return;
     }
 

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (159191 => 159192)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2013-11-13 13:17:19 UTC (rev 159191)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2013-11-13 13:25:32 UTC (rev 159192)
@@ -29,6 +29,7 @@
 #include "FontCache.h"
 #include "Frame.h"
 #include "GraphicsContext.h"
+#include "HTMLTextFormControlElement.h"
 #include "HitTestLocation.h"
 #include "HitTestRequest.h"
 #include "HitTestResult.h"
@@ -38,6 +39,7 @@
 #include "RenderBlockFlow.h"
 #include "RenderStyle.h"
 #include "RenderText.h"
+#include "RenderTextControl.h"
 #include "RenderView.h"
 #include "Settings.h"
 #include "SimpleLineLayoutResolver.h"
@@ -52,6 +54,9 @@
 template <typename CharacterType>
 static bool canUseForText(const CharacterType* text, unsigned length, const SimpleFontData& fontData)
 {
+    // FIXME: <textarea maxlength=0> generates empty text node.
+    if (!length)
+        return false;
     for (unsigned i = 0; i < length; ++i) {
         UChar character = text[i];
         if (character == ' ')
@@ -113,6 +118,12 @@
         return false;
     if (flow.parent()->isDeprecatedFlexibleBox())
         return false;
+    // FIXME: Implementation of wrap=hard looks into lineboxes.
+    if (flow.parent()->isTextArea() && flow.parent()->element()->fastHasAttribute(HTMLNames::wrapAttr))
+        return false;
+    // FIXME: Placeholders do something strange.
+    if (flow.parent()->isTextControl() && toRenderTextControl(*flow.parent()).textFormControlElement().placeholderElement())
+        return false;
     // These tests only works during layout. Outside layout this function may give false positives.
     if (flow.view().layoutState()) {
 #if ENABLE(CSS_SHAPES)
@@ -166,8 +177,6 @@
         return false;
     if (style.hasTextCombine())
         return false;
-    if (style.overflowWrap() != NormalOverflowWrap)
-        return false;
     if (style.backgroundClip() == TextFillBox)
         return false;
     if (style.borderFit() == BorderFitLines)
@@ -282,6 +291,7 @@
     bool collapseWhitespace = style.collapseWhiteSpace();
     bool preserveNewline = style.preserveNewline();
     bool wrapLines = style.autoWrap();
+    bool breakWordOnOverflow = style.overflowWrap() == BreakOverflowWrap && (wrapLines || preserveNewline);
 
     const CharacterType* text = textRenderer.text()->getCharacters<CharacterType>();
     const unsigned textLength = textRenderer.textLength();
@@ -362,6 +372,26 @@
                 lineRuns.append(Run(wordStart + 1, lineRuns.last().right));
             }
 
+            if (!lineWidth.fitsOnLine() && breakWordOnOverflow) {
+                // Backtrack and start measuring character-by-character.
+                lineWidth.addUncommittedWidth(-lineWidth.uncommittedWidth());
+                unsigned splitEnd = wordStart;
+                for (; splitEnd < wordEnd; ++splitEnd) {
+                    float charWidth = textWidth(textRenderer, text, textLength, splitEnd, splitEnd + 1, 0, font, tabWidth);
+                    lineWidth.addUncommittedWidth(charWidth);
+                    if (!lineWidth.fitsOnLine() && splitEnd > lineStart)
+                        break;
+                    lineWidth.commit();
+                }
+                lineRuns.last().end = splitEnd;
+                lineRuns.last().right = lineWidth.committedWidth();
+                lineEnd = splitEnd;
+                // To match line boxes, set single-space-only line width to zero.
+                if (text[lineRuns.last().start] == ' ' && lineRuns.last().start + 1 == lineRuns.last().end)
+                    lineRuns.last().right = lineRuns.last().left;
+                break;
+            }
+
             lineWidth.commit();
 
             lineRuns.last().right = lineWidth.committedWidth();
@@ -371,7 +401,7 @@
             if (collapseWhitespace)
                 wordEnd = skipWhitespaces(text, wordEnd, textLength, preserveNewline);
 
-            if (wrapLines && !lineWidth.fitsOnLine()) {
+            if (!lineWidth.fitsOnLine() && wrapLines) {
                 // The first run on the line overflows.
                 ASSERT(lineRuns.size() == 1);
                 break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to