Replace deprecatedIsCollapsibleWhitespace with RenderStyle::isCollapsibleWhiteSpace in TextIterator.
https://bugs.webkit.org/show_bug.cgi?id=130612.

Patch by Chang Shu <cshu@webkit.org> on 2014-03-22
Reviewed by Darin Adler.

Source/WebCore:

Some layout tests are affected by this change but the new behavior should be correct.

* editing/TextIterator.cpp:
(WebCore::TextIterator::handleTextNode):
(WebCore::TextIterator::handleTextBox):

LayoutTests:

* accessibility/table-scope-expected.txt:
* editing/deleting/delete-block-table-expected.txt:
* editing/pasteboard/paste-into-anchor-text-expected.txt:
* fast/dom/Element/offsetTop-table-cell-expected.txt:
* fast/html/object-border-expected.txt:
* fast/table/cell-in-row-before-misnested-text-crash-css-expected.txt:
* fast/table/cell-in-row-before-misnested-text-crash-expected.txt:
* fast/tokenizer/script_extra_close-expected.txt:
* fast/xsl/mozilla-tests-expected.txt:
* platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt:
* platform/mac/accessibility/table-multi-bodies-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166134 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7c7af58..988809e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,22 @@
+2014-03-22  Chang Shu  <cshu@webkit.org>
+
+        Replace deprecatedIsCollapsibleWhitespace with RenderStyle::isCollapsibleWhiteSpace in TextIterator.
+        https://bugs.webkit.org/show_bug.cgi?id=130612.
+
+        Reviewed by Darin Adler.
+
+        * accessibility/table-scope-expected.txt:
+        * editing/deleting/delete-block-table-expected.txt:
+        * editing/pasteboard/paste-into-anchor-text-expected.txt:
+        * fast/dom/Element/offsetTop-table-cell-expected.txt:
+        * fast/html/object-border-expected.txt:
+        * fast/table/cell-in-row-before-misnested-text-crash-css-expected.txt:
+        * fast/table/cell-in-row-before-misnested-text-crash-expected.txt:
+        * fast/tokenizer/script_extra_close-expected.txt:
+        * fast/xsl/mozilla-tests-expected.txt:
+        * platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt:
+        * platform/mac/accessibility/table-multi-bodies-expected.txt:
+
 2014-03-22  Michael Saboff  <msaboff@apple.com>
 
         toThis() on a JSWorkerGlobalScope should return a JSProxy and not undefined
diff --git a/LayoutTests/accessibility/table-scope-expected.txt b/LayoutTests/accessibility/table-scope-expected.txt
index 0b8dc75..3df55ef 100644
--- a/LayoutTests/accessibility/table-scope-expected.txt
+++ b/LayoutTests/accessibility/table-scope-expected.txt
@@ -1,8 +1,8 @@
 Community Courses -- Bath Autumn 1997
 Course Name	Course Tutor	Summary	Code	Fee
-After the Civil War	Dr. John Wroughton	 The course will examine the turbulent years in England after 1646. 6 weekly meetings starting Monday 13th October.	H27	£32	£32
-An Introduction to Anglo-Saxon England	Mark Cottle	 One day course introducing the early medieval period reconstruction the Anglo-Saxons and their society. Saturday 18th October.	H28	£18	£18
-The Glory that was Greece	 Birthplace of democracy, philosophy, heartland of theater, home of argument. The Romans may have done it but the Greeks did it first. Saturday day school 25th October 1997	H30	£18	£18
+After the Civil War	Dr. John Wroughton	The course will examine the turbulent years in England after 1646. 6 weekly meetings starting Monday 13th October.	H27	£32	£32
+An Introduction to Anglo-Saxon England	Mark Cottle	One day course introducing the early medieval period reconstruction the Anglo-Saxons and their society. Saturday 18th October.	H28	£18	£18
+The Glory that was Greece	Birthplace of democracy, philosophy, heartland of theater, home of argument. The Romans may have done it but the Greeks did it first. Saturday day school 25th October 1997	H30	£18	£18
 This tests the scope attribute on table cells will manifest as the right header elements on the cells in that row or column.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/LayoutTests/editing/deleting/delete-block-table-expected.txt b/LayoutTests/editing/deleting/delete-block-table-expected.txt
index 6cf0730..fc2b0f0 100644
--- a/LayoutTests/editing/deleting/delete-block-table-expected.txt
+++ b/LayoutTests/editing/deleting/delete-block-table-expected.txt
@@ -1,8 +1,8 @@
 This test checks that deleting into a table works properly. When deleting three times with the cursor after the character "a" in the "after" text after the table, the "a" should be deleted, as should the "o" of "buffalo" in the last table cell.
 
 Before
-Foo	 baz
-bar	 buffalfter
+Foo	baz
+bar	buffalfter
 execDeleteCommand: <div>Before</div> <table style="border:3px solid #aaa;"> <tbody><tr> <td> Foo </td> <td> baz </td> </tr> <tr> <td> bar </td> <td> buffalo </td> </tr> </tbody></table> <span id="start">fter</span>
 execDeleteCommand: <div>Before</div> <table style="border:3px solid #aaa;"> <tbody><tr> <td> Foo </td> <td> baz </td> </tr> <tr> <td> bar </td> <td> buffalofter</td></tr></tbody></table>
 execDeleteCommand: <div>Before</div> <table style="border:3px solid #aaa;"> <tbody><tr> <td> Foo </td> <td> baz </td> </tr> <tr> <td> bar </td> <td> buffalfter</td></tr></tbody></table>
diff --git a/LayoutTests/editing/pasteboard/paste-into-anchor-text-expected.txt b/LayoutTests/editing/pasteboard/paste-into-anchor-text-expected.txt
index 3a69b3c..6c390dc 100644
--- a/LayoutTests/editing/pasteboard/paste-into-anchor-text-expected.txt
+++ b/LayoutTests/editing/pasteboard/paste-into-anchor-text-expected.txt
@@ -5,5 +5,5 @@
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
   
-Canton Repository (subscription)                                                      	 all 7hello world9 news articles                                                      	
+Canton Repository (subscription)                                                      	all 7hello world9 news articles                                                      	
 
diff --git a/LayoutTests/fast/dom/Element/offsetTop-table-cell-expected.txt b/LayoutTests/fast/dom/Element/offsetTop-table-cell-expected.txt
index 5825289..1c6b1d0 100644
--- a/LayoutTests/fast/dom/Element/offsetTop-table-cell-expected.txt
+++ b/LayoutTests/fast/dom/Element/offsetTop-table-cell-expected.txt
@@ -11,5 +11,5 @@
 Test result: PASS
 x	
 This
-is more text.	 And a lot more text that should have the smallest offsetTop.
+is more text.	And a lot more text that should have the smallest offsetTop.
 
diff --git a/LayoutTests/fast/html/object-border-expected.txt b/LayoutTests/fast/html/object-border-expected.txt
index 932332a..3d01453 100644
--- a/LayoutTests/fast/html/object-border-expected.txt
+++ b/LayoutTests/fast/html/object-border-expected.txt
@@ -4,7 +4,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-Title	 Actual Image	 Expected Image
+Title	Actual Image	Expected Image
 Object Tag with border="50" px
 	
 PASS border-top-width is 50px.
diff --git a/LayoutTests/fast/table/cell-in-row-before-misnested-text-crash-css-expected.txt b/LayoutTests/fast/table/cell-in-row-before-misnested-text-crash-css-expected.txt
index 829eaa7..f444822 100644
--- a/LayoutTests/fast/table/cell-in-row-before-misnested-text-crash-css-expected.txt
+++ b/LayoutTests/fast/table/cell-in-row-before-misnested-text-crash-css-expected.txt
@@ -1,2 +1,2 @@
 This test checks whether a particular odd arrangement of DOM nodes results in render tree consistency violations.
-0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99	 xxx	Whee
+0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99	xxx	Whee
diff --git a/LayoutTests/fast/table/cell-in-row-before-misnested-text-crash-expected.txt b/LayoutTests/fast/table/cell-in-row-before-misnested-text-crash-expected.txt
index 829eaa7..f444822 100644
--- a/LayoutTests/fast/table/cell-in-row-before-misnested-text-crash-expected.txt
+++ b/LayoutTests/fast/table/cell-in-row-before-misnested-text-crash-expected.txt
@@ -1,2 +1,2 @@
 This test checks whether a particular odd arrangement of DOM nodes results in render tree consistency violations.
-0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99	 xxx	Whee
+0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99	xxx	Whee
diff --git a/LayoutTests/fast/tokenizer/script_extra_close-expected.txt b/LayoutTests/fast/tokenizer/script_extra_close-expected.txt
index 10f2c0c..79eb9a6 100644
--- a/LayoutTests/fast/tokenizer/script_extra_close-expected.txt
+++ b/LayoutTests/fast/tokenizer/script_extra_close-expected.txt
@@ -1 +1 @@
-TEST...	 PASSED. This text should show up.
+TEST...	PASSED. This text should show up.
diff --git a/LayoutTests/fast/xsl/mozilla-tests-expected.txt b/LayoutTests/fast/xsl/mozilla-tests-expected.txt
index f8af811..fbc35e9 100644
--- a/LayoutTests/fast/xsl/mozilla-tests-expected.txt
+++ b/LayoutTests/fast/xsl/mozilla-tests-expected.txt
@@ -76,95 +76,95 @@
 Desired Result:Red Text
 Result:Red Text
 Axis Identifiers (these should work, I need more test cases though)
-Test:	 <xsl:if test="descendant::z">true</xsl:if>
+Test:	<xsl:if test="descendant::z">true</xsl:if>
 Desired Result:	true
 Result:	true
-Test:	 <xsl:if test="not(descendant-or-self::no-element)">true</xsl:if>
+Test:	<xsl:if test="not(descendant-or-self::no-element)">true</xsl:if>
 Desired Result:	true
 Result:	true
-Test:	 <xsl:value-of select="count(x/attribute::*)"/>
+Test:	<xsl:value-of select="count(x/attribute::*)"/>
 Desired Result:	1
 Result:	1
 Creating Elements with xsl:element and xsl:attribute
-Test:	 <xsl:element name="FONT">
+Test:	<xsl:element name="FONT">
 <xsl:attribute name="COLOR">blue</xsl:attribute> 
 Passed 
 </xsl:element>
 Desired Result:	Passed
-Result:	 Passed
+Result:	Passed
 Using Attribute Sets
-Test:	 <FONT xsl:use-attribute-sets="style1">
+Test:	<FONT xsl:use-attribute-sets="style1">
 Passed 
 </FONT>
 Desired Result:	Passed
-Result:	 Passed
-Test:	 <xsl:element name="FONT" use-attribute-sets="style1 style2">
+Result:	Passed
+Test:	<xsl:element name="FONT" use-attribute-sets="style1 style2">
 Passed 
 </xsl:element>
 Desired Result:	Passed
-Result:	 Passed
+Result:	Passed
 Numbering (only simple numbering currently implemented)
-Test:	 <xsl:number value="4"/>
+Test:	<xsl:number value="4"/>
 Desired Result:	4
 Result:	4
-Test:	 see source
-Desired Result:	 1. x 
+Test:	see source
+Desired Result:	1. x 
 1. y
 1. z 
 Result:	1. x
 1. y
 1. z
 Additive Expressions
-Test:	 <xsl:value-of select="70+4"/>
+Test:	<xsl:value-of select="70+4"/>
 Desired Result:	74
 Result:	74
-Test:	 <xsl:value-of select="-70+4"/>
+Test:	<xsl:value-of select="-70+4"/>
 Desired Result:	-66
 Result:	-66
-Test:	 <xsl:value-of select="1900+70+8-4"/>
+Test:	<xsl:value-of select="1900+70+8-4"/>
 Desired Result:	1974
 Result:	1974
-Test:	 <xsl:value-of select="(4+5)-(9+9)"/>
+Test:	<xsl:value-of select="(4+5)-(9+9)"/>
 Desired Result:	-9
 Result:	-9
 Multiplicative Expressions
-Test:	 <xsl:value-of select="7*4"/>
+Test:	<xsl:value-of select="7*4"/>
 Desired Result:	28
 Result:	28
-Test:	 <xsl:value-of select="7mod 4"/>
+Test:	<xsl:value-of select="7mod 4"/>
 Desired Result:	3
 Result:	3
-Test:	 <xsl:value-of select="7div 4"/>
+Test:	<xsl:value-of select="7div 4"/>
 Desired Result:	1.75
 Result:	1.75
-Test:	 <xsl:value-of select="7div 0"/>
+Test:	<xsl:value-of select="7div 0"/>
 Desired Result:	Infinity
 Result:	Infinity
-Test:	 <xsl:value-of select="0 div 0"/>
+Test:	<xsl:value-of select="0 div 0"/>
 Desired Result:	NaN
 Result:	NaN
-Test:	 <xsl:variable name="x" select="7*3"/>
+Test:	<xsl:variable name="x" select="7*3"/>
 <xsl:variable name="y" select="3"/>
 <xsl:value-of select="$x div $y"/>
 Desired Result:	7
 Result:	7
 Precedence tests
-Test:	 <xsl:value-of select="2 mod 2 = 0"/>
+Test:	<xsl:value-of select="2 mod 2 = 0"/>
 Desired Result:	true
 Result:	true
-Test:	 <xsl:value-of select="5 mod 2 < 5 and 2*6 >= 12"/>
+Test:	<xsl:value-of select="5 mod 2 < 5 and 2*6 >= 12"/>
 Desired Result:	true
 Result:	true
-Test:	 <xsl:value-of select="5 mod 2 < 5 and 2*6>12"/>
+Test:	<xsl:value-of select="5 mod 2 < 5 and 2*6>12"/>
 Desired Result:	false
 Result:	false
-Test:	 <xsl:value-of select="4+5*3"/>
+Test:	<xsl:value-of select="4+5*3"/>
 Desired Result:	19
 Result:	19
-Test:	 <xsl:value-of select="4+5*3+(6-4)*7"/>
+Test:	<xsl:value-of select="4+5*3+(6-4)*7"/>
 Desired Result:	33
 Result:	33
 Automatic Result Type Conversion
-Test:	 <xsl:value-of select="'747' + 8"/>
+Test:	<xsl:value-of select="'747' + 8"/>
 Desired Result:	755
 Result:	755
diff --git a/LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt b/LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt
index 49d9d84..3685ef2 100644
--- a/LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt
+++ b/LayoutTests/platform/mac/accessibility/aria-grid-with-strange-hierarchy-expected.txt
@@ -1,4 +1,4 @@
- 	Name	Time	Popularity	 Price
+ 	Name	Time	Popularity	Price
 1	Test	Test	Test
 This tests that an ARIA grid with a hierarchy that ignores render elements in between will still expose the correct elements.
 
diff --git a/LayoutTests/platform/mac/accessibility/table-multi-bodies-expected.txt b/LayoutTests/platform/mac/accessibility/table-multi-bodies-expected.txt
index 8f5fa69..4bb5c24 100644
--- a/LayoutTests/platform/mac/accessibility/table-multi-bodies-expected.txt
+++ b/LayoutTests/platform/mac/accessibility/table-multi-bodies-expected.txt
@@ -1,7 +1,7 @@
  	Forum	Last Post	Threads	Posts
 English Forums
  	Main Discussion
-	 Want to communicate with other local fans? Do it here, too!	 Today 03:52pm	381	23,437
+	Want to communicate with other local fans? Do it here, too!	Today 03:52pm	381	23,437
 
 
 
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index d8d9c24..62f0728 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2014-03-22  Chang Shu  <cshu@webkit.org>
+
+        Replace deprecatedIsCollapsibleWhitespace with RenderStyle::isCollapsibleWhiteSpace in TextIterator.
+        https://bugs.webkit.org/show_bug.cgi?id=130612.
+
+        Reviewed by Darin Adler.
+
+        Some layout tests are affected by this change but the new behavior should be correct.
+
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::handleTextNode):
+        (WebCore::TextIterator::handleTextBox):
+
 2014-03-22  Sam Weinig  <sam@webkit.org>
 
         Switch HTMLConverter to use CSSPropertyIDs to refer to CSS properties
diff --git a/Source/WebCore/editing/TextIterator.cpp b/Source/WebCore/editing/TextIterator.cpp
index 0741226..b24e612 100644
--- a/Source/WebCore/editing/TextIterator.cpp
+++ b/Source/WebCore/editing/TextIterator.cpp
@@ -556,15 +556,15 @@
         unsigned end = (m_node == m_endContainer) ? static_cast<unsigned>(m_endOffset) : rendererText.length();
         unsigned runEnd = m_offset;
         unsigned runStart = m_offset;
-        while (runEnd < end && (deprecatedIsCollapsibleWhitespace(rendererText[runEnd]) || rendererText[runEnd] == '\t'))
+        while (runEnd < end && (renderer.style().isCollapsibleWhiteSpace(rendererText[runEnd]) || rendererText[runEnd] == '\t'))
             ++runEnd;
-        bool addSpaceForPrevious = m_lastTextNodeEndedWithCollapsedSpace && m_lastCharacter && !deprecatedIsCollapsibleWhitespace(m_lastCharacter);
+        bool addSpaceForPrevious = m_lastTextNodeEndedWithCollapsedSpace && m_lastCharacter && !renderer.style().isCollapsibleWhiteSpace(m_lastCharacter);
         if (runEnd > runStart || addSpaceForPrevious) {
             if (runEnd == rendererText.length()) {
                 m_lastTextNodeEndedWithCollapsedSpace = true;
                 return true;
             }
-            bool addSpaceForCurrent = runStart || (m_lastCharacter && !deprecatedIsCollapsibleWhitespace(m_lastCharacter));
+            bool addSpaceForCurrent = runStart || (m_lastCharacter && !renderer.style().isCollapsibleWhiteSpace(m_lastCharacter));
             if (addSpaceForCurrent || addSpaceForPrevious) {
                 emitCharacter(' ', textNode, nullptr, runStart, runEnd);
                 m_offset = runEnd;
@@ -572,7 +572,7 @@
             }
             runStart = runEnd;
         }
-        while (runEnd < end && !deprecatedIsCollapsibleWhitespace(rendererText[runEnd]))
+        while (runEnd < end && !renderer.style().isCollapsibleWhiteSpace(rendererText[runEnd]))
             ++runEnd;
         if (runStart < end)
             emitText(textNode, renderer, runStart, runEnd);
@@ -628,7 +628,7 @@
         // Check for collapsed space at the start of this run.
         InlineTextBox* firstTextBox = renderer.containsReversedText() ? (m_sortedTextBoxes.isEmpty() ? nullptr : m_sortedTextBoxes[0]) : renderer.firstTextBox();
         bool needSpace = m_lastTextNodeEndedWithCollapsedSpace || (m_textBox == firstTextBox && textBoxStart == runStart && runStart);
-        if (needSpace && !deprecatedIsCollapsibleWhitespace(m_lastCharacter) && m_lastCharacter) {
+        if (needSpace && !renderer.style().isCollapsibleWhiteSpace(m_lastCharacter) && m_lastCharacter) {
             if (m_lastTextNode == &textNode && runStart && rendererText[runStart - 1] == ' ') {
                 unsigned spaceRunStart = runStart - 1;
                 while (spaceRunStart && rendererText[spaceRunStart - 1] == ' ')