Title: [199054] trunk
Revision
199054
Author
[email protected]
Date
2016-04-05 03:29:31 -0700 (Tue, 05 Apr 2016)

Log Message

Use RenderTreeUpdater for text node mutations
https://bugs.webkit.org/show_bug.cgi?id=156107

Reviewed by Andreas Kling.

Source/WebCore:

Use the new mechanism for updating render tree after text node content changes.

* dom/CharacterData.cpp:
(WebCore::CharacterData::parserAppendData):
(WebCore::CharacterData::setDataAndUpdate):
* dom/Text.cpp:
(WebCore::Text::createWithLengthLimit):
(WebCore::Text::updateRendererAfterContentChange):

    Update using RenderTreeUpdater.

(WebCore::Text::formatForDebugger):
* dom/Text.h:
(WebCore::Text::Text):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForElement):
(WebCore::Style::resetStyleForNonRenderedDescendants):
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::elementImplicitVisibility):
(WebCore::Style::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded): Deleted.
(WebCore::Style::textRendererIsNeeded): Deleted.
(WebCore::Style::createTextRendererIfNeeded): Deleted.
(WebCore::Style::attachTextRenderer): Deleted.
(WebCore::Style::detachTextRenderer): Deleted.
(WebCore::Style::updateTextRendererAfterContentChange): Deleted.
(WebCore::Style::resolveTextNode): Deleted.

    Kill the old code paths.

* style/StyleTreeResolver.h:

LayoutTests:

Mostly just revert non-rendered whitespace related changes from the earlier patches.

* editing/style/remove-underline-from-stylesheet-expected.txt:
* editing/style/typing-style-003-expected.txt:
* platform/ios-simulator/editing/style/typing-style-003-expected.txt: Removed.
* platform/mac-wk2/editing/mac/spelling/autocorrection-contraction-expected.txt:
* platform/mac/editing/inserting/editable-html-element-expected.txt:
* platform/mac/editing/inserting/editing-empty-divs-expected.txt:
* platform/mac/editing/inserting/insert-at-end-02-expected.txt:
* platform/mac/editing/pasteboard/4989774-expected.txt:
* platform/mac/editing/selection/4983858-expected.txt:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199053 => 199054)


--- trunk/LayoutTests/ChangeLog	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/ChangeLog	2016-04-05 10:29:31 UTC (rev 199054)
@@ -1,3 +1,22 @@
+2016-04-05  Antti Koivisto  <[email protected]>
+
+        Use RenderTreeUpdater for text node mutations
+        https://bugs.webkit.org/show_bug.cgi?id=156107
+
+        Reviewed by Andreas Kling.
+
+        Mostly just revert non-rendered whitespace related changes from the earlier patches.
+
+        * editing/style/remove-underline-from-stylesheet-expected.txt:
+        * editing/style/typing-style-003-expected.txt:
+        * platform/ios-simulator/editing/style/typing-style-003-expected.txt: Removed.
+        * platform/mac-wk2/editing/mac/spelling/autocorrection-contraction-expected.txt:
+        * platform/mac/editing/inserting/editable-html-element-expected.txt:
+        * platform/mac/editing/inserting/editing-empty-divs-expected.txt:
+        * platform/mac/editing/inserting/insert-at-end-02-expected.txt:
+        * platform/mac/editing/pasteboard/4989774-expected.txt:
+        * platform/mac/editing/selection/4983858-expected.txt:
+
 2016-04-04  Zalan Bujtas  <[email protected]>
 
         CSS Triangles Rendering Regression affecting CSS Ribbons.

Modified: trunk/LayoutTests/editing/mac/spelling/autocorrection-contraction-expected.txt (199053 => 199054)


--- trunk/LayoutTests/editing/mac/spelling/autocorrection-contraction-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/editing/mac/spelling/autocorrection-contraction-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -279,4 +279,4 @@
           RenderText {#text} at (0,0) size 160x28
             text run at (0,0) width 154: "would' wouldn't"
             text run at (153,0) width 7: " "
-caret: position 16 of child 0 {#text} of child 6 {DIV} of child 3 {DIV} of body
+caret: position 16 of child 0 {#text} of child 5 {DIV} of child 3 {DIV} of body

Modified: trunk/LayoutTests/editing/mac/spelling/autocorrection-removing-underline-after-paste-expected.txt (199053 => 199054)


--- trunk/LayoutTests/editing/mac/spelling/autocorrection-removing-underline-after-paste-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/editing/mac/spelling/autocorrection-removing-underline-after-paste-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -82,4 +82,4 @@
             text run at (0,28) width 34: "baz"
         RenderBlock {DIV} at (14,70) size 756x28
           RenderBR {BR} at (0,0) size 0x28
-caret: position 0 of child 0 {BR} of child 5 {DIV} of child 5 {DIV} of body
+caret: position 0 of child 0 {BR} of child 4 {DIV} of child 5 {DIV} of body

Modified: trunk/LayoutTests/editing/mac/spelling/autocorrection-removing-underline-expected.txt (199053 => 199054)


--- trunk/LayoutTests/editing/mac/spelling/autocorrection-removing-underline-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/editing/mac/spelling/autocorrection-removing-underline-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -78,4 +78,4 @@
           RenderInline {SPAN} at (0,0) size 1x28
         RenderBlock {DIV} at (14,42) size 756x28
           RenderBR {BR} at (0,0) size 0x28
-caret: position 0 of child 0 {BR} of child 3 {DIV} of child 5 {DIV} of body
+caret: position 0 of child 0 {BR} of child 2 {DIV} of child 5 {DIV} of body

Modified: trunk/LayoutTests/editing/mac/spelling/autocorrection-simple-expected.txt (199053 => 199054)


--- trunk/LayoutTests/editing/mac/spelling/autocorrection-simple-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/editing/mac/spelling/autocorrection-simple-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -137,4 +137,4 @@
         RenderBlock {DIV} at (14,42) size 756x28
           RenderText {#text} at (0,0) size 138x28
             text run at (0,0) width 138: "the notational,"
-caret: position 15 of child 0 {#text} of child 3 {DIV} of child 7 {DIV} of body
+caret: position 15 of child 0 {#text} of child 2 {DIV} of child 7 {DIV} of body

Modified: trunk/LayoutTests/editing/style/remove-underline-from-stylesheet-expected.txt (199053 => 199054)


--- trunk/LayoutTests/editing/style/remove-underline-from-stylesheet-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/editing/style/remove-underline-from-stylesheet-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -76,7 +76,5 @@
 | "xxxxxx "
 | "<#selection-anchor>xxxxxx<#selection-focus>"
 | " xxxxxx"
-| "
-"
 | <span>
 |   id="test"

Modified: trunk/LayoutTests/editing/style/typing-style-003-expected.txt (199053 => 199054)


--- trunk/LayoutTests/editing/style/typing-style-003-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/editing/style/typing-style-003-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -52,10 +52,10 @@
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 xxxxxxxxxxxxxxx
 execTypeCharacterCommand: x <span id="test"></span>
-execTypeCharacterCommand: xx <span id="test"></span>
-execTypeCharacterCommand: xxx <span id="test"></span>
-execBoldCommand: xxx <span id="test"></span>
-execTypeCharacterCommand: xxx<b>x</b> <span id="test"></span>
+execTypeCharacterCommand: xx<span id="test"></span>
+execTypeCharacterCommand: xxx<span id="test"></span>
+execBoldCommand: xxx<span id="test"></span>
+execTypeCharacterCommand: xxx<b>x</b><span id="test"></span>
 execTypeCharacterCommand: xxx<b>xx</b><span id="test"></span>
 execTypeCharacterCommand: xxx<b>xxx</b><span id="test"></span>
 execItalicCommand: xxx<b>xxx</b><span id="test"></span>

Modified: trunk/LayoutTests/fast/dom/beforeload/remove-bad-object-in-beforeload-listener-expected.txt (199053 => 199054)


--- trunk/LayoutTests/fast/dom/beforeload/remove-bad-object-in-beforeload-listener-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/fast/dom/beforeload/remove-bad-object-in-beforeload-listener-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -1,4 +1,3 @@
 This page tests that you can correctly remove an object element with an invalid data URL in its beforeload listener without causing a crash.
 
 PASS
-

Modified: trunk/LayoutTests/fast/dom/beforeload/remove-flash-in-beforeload-listener-expected.txt (199053 => 199054)


--- trunk/LayoutTests/fast/dom/beforeload/remove-flash-in-beforeload-listener-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/fast/dom/beforeload/remove-flash-in-beforeload-listener-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -1,4 +1,3 @@
 This page tests that you can correctly remove a flash object in a beforeload listener without causing a crash.
 
 PASS
-

Deleted: trunk/LayoutTests/platform/ios-simulator/editing/style/typing-style-003-expected.txt (199053 => 199054)


--- trunk/LayoutTests/platform/ios-simulator/editing/style/typing-style-003-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/platform/ios-simulator/editing/style/typing-style-003-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -1,72 +0,0 @@
-EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
-EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > B > DIV > BODY > HTML > #document to 1 of #text > B > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > B > DIV > BODY > HTML > #document to 1 of #text > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > B > DIV > BODY > HTML > #document to 1 of #text > B > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > B > DIV > BODY > HTML > #document to 2 of #text > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > B > DIV > BODY > HTML > #document to 2 of #text > B > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > B > DIV > BODY > HTML > #document to 3 of #text > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > B > DIV > BODY > HTML > #document to 1 of #text > I > B > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > B > DIV > BODY > HTML > #document to 1 of #text > I > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > B > DIV > BODY > HTML > #document to 1 of #text > I > B > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > I > B > DIV > BODY > HTML > #document to 2 of #text > I > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > I > B > DIV > BODY > HTML > #document to 2 of #text > I > B > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > I > B > DIV > BODY > HTML > #document to 3 of #text > I > B > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > DIV > BODY > HTML > #document to 1 of #text > I > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > I > DIV > BODY > HTML > #document to 1 of #text > I > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > I > DIV > BODY > HTML > #document to 1 of #text > I > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > I > DIV > BODY > HTML > #document to 2 of #text > I > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > I > DIV > BODY > HTML > #document to 2 of #text > I > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > I > DIV > BODY > HTML > #document to 3 of #text > I > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > DIV > BODY > HTML > #document to 2 of #text > DIV > BODY > HTML > #document toDOMRange:range from 3 of #text > DIV > BODY > HTML > #document to 3 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-xxxxxxxxxxxxxxx
-execTypeCharacterCommand: x <span id="test"></span>
-execTypeCharacterCommand: xx<span id="test"></span>
-execTypeCharacterCommand: xxx<span id="test"></span>
-execBoldCommand: xxx<span id="test"></span>
-execTypeCharacterCommand: xxx<b>x</b><span id="test"></span>
-execTypeCharacterCommand: xxx<b>xx</b><span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx</b><span id="test"></span>
-execItalicCommand: xxx<b>xxx</b><span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx<i>x</i></b><span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx<i>xx</i></b><span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx<i>xxx</i></b><span id="test"></span>
-execBoldCommand: xxx<b>xxx<i>xxx</i></b><span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>x</i><span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xx</i><span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i><span id="test"></span>
-execItalicCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i><span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i>x<span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i>xx<span id="test"></span>
-execTypeCharacterCommand: xxx<b>xxx</b><i><b>xxx</b>xxx</i>xxx<span id="test"></span>

Modified: trunk/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt (199053 => 199054)


--- trunk/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/platform/mac/editing/inserting/editable-html-element-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -22,6 +22,7 @@
           text run at (0,18) width 767: "inserting a paragraph separator doesn't split the body (inserting a paragraph separator usually splits/clones the enclosing"
           text run at (766,18) width 5: " "
           text run at (0,36) width 132: "block flow element)."
+        RenderText {#text} at (0,0) size 0x0
       RenderBlock {DIV} at (0,54) size 784x18
         RenderBR {BR} at (0,0) size 0x18
 caret: position 0 of child 0 {BR} of child 2 {DIV} of body

Modified: trunk/LayoutTests/platform/mac/editing/inserting/editing-empty-divs-expected.txt (199053 => 199054)


--- trunk/LayoutTests/platform/mac/editing/inserting/editing-empty-divs-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/platform/mac/editing/inserting/editing-empty-divs-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -65,6 +65,7 @@
       RenderBlock {DIV} at (0,230) size 708x22 [border: (1px dotted #0000FF)]
         RenderText {#text} at (1,1) size 8x18
           text run at (1,1) width 8: "c"
+        RenderText {#text} at (0,0) size 0x0
       RenderBlock {P} at (0,268) size 784x18
         RenderText {#text} at (0,0) size 240x18
           text run at (0,0) width 240: "This div contains a self-closing p tag."
@@ -80,5 +81,6 @@
         RenderBlock (anonymous) at (1,1) size 706x18
           RenderText {#text} at (0,0) size 8x18
             text run at (0,0) width 8: "c"
+          RenderText {#text} at (0,0) size 0x0
         RenderBlock {P} at (1,35) size 706x0
 caret: position 1 of child 0 {#text} of child 21 {DIV} of body

Modified: trunk/LayoutTests/platform/mac/editing/inserting/insert-at-end-02-expected.txt (199053 => 199054)


--- trunk/LayoutTests/platform/mac/editing/inserting/insert-at-end-02-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/platform/mac/editing/inserting/insert-at-end-02-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -29,4 +29,5 @@
         RenderBlock (anonymous) at (2,46) size 780x18
           RenderText {#text} at (0,0) size 8x18
             text run at (0,0) width 8: "x"
+          RenderText {#text} at (0,0) size 0x0
 caret: position 1 of child 5 {#text} of child 5 {DIV} of body

Modified: trunk/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt (199053 => 199054)


--- trunk/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -12,4 +12,6 @@
         text run at (634,103) width 102: "You should see"
         text run at (735,103) width 5: " "
         text run at (0,121) width 364: "several pictures above all in the same line/paragraph."
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
 caret: position 164 of child 4 {#text} of body

Modified: trunk/LayoutTests/platform/mac/editing/selection/4983858-expected.txt (199053 => 199054)


--- trunk/LayoutTests/platform/mac/editing/selection/4983858-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/platform/mac/editing/selection/4983858-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -10,6 +10,7 @@
           text run at (716,0) width 65: "paragraph"
           text run at (780,0) width 4: " "
           text run at (0,18) width 165: "below should be selected:"
+        RenderText {#text} at (0,0) size 0x0
       RenderBlock {DIV} at (0,36) size 784x18
         RenderText {#text} at (0,0) size 22x18
           text run at (0,0) width 22: "foo"

Modified: trunk/LayoutTests/platform/mac-wk2/editing/mac/spelling/autocorrection-contraction-expected.txt (199053 => 199054)


--- trunk/LayoutTests/platform/mac-wk2/editing/mac/spelling/autocorrection-contraction-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/platform/mac-wk2/editing/mac/spelling/autocorrection-contraction-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -259,4 +259,4 @@
           RenderText {#text} at (0,0) size 172x28
             text run at (0,0) width 166: "wouldn' wouldn't"
             text run at (165,0) width 7: " "
-caret: position 17 of child 0 {#text} of child 6 {DIV} of child 3 {DIV} of body
+caret: position 17 of child 0 {#text} of child 5 {DIV} of child 3 {DIV} of body

Modified: trunk/LayoutTests/plugins/focus-expected.txt (199053 => 199054)


--- trunk/LayoutTests/plugins/focus-expected.txt	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/LayoutTests/plugins/focus-expected.txt	2016-04-05 10:29:31 UTC (rev 199054)
@@ -24,4 +24,3 @@
 This tests focusing Embeds and Objects. See LayoutTests/java for Applet elements.
 
    Fallback contents.     Fallback contents. Fallback contents.      
-

Modified: trunk/Source/WebCore/ChangeLog (199053 => 199054)


--- trunk/Source/WebCore/ChangeLog	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/Source/WebCore/ChangeLog	2016-04-05 10:29:31 UTC (rev 199054)
@@ -1,3 +1,41 @@
+2016-04-05  Antti Koivisto  <[email protected]>
+
+        Use RenderTreeUpdater for text node mutations
+        https://bugs.webkit.org/show_bug.cgi?id=156107
+
+        Reviewed by Andreas Kling.
+
+        Use the new mechanism for updating render tree after text node content changes.
+
+        * dom/CharacterData.cpp:
+        (WebCore::CharacterData::parserAppendData):
+        (WebCore::CharacterData::setDataAndUpdate):
+        * dom/Text.cpp:
+        (WebCore::Text::createWithLengthLimit):
+        (WebCore::Text::updateRendererAfterContentChange):
+
+            Update using RenderTreeUpdater.
+
+        (WebCore::Text::formatForDebugger):
+        * dom/Text.h:
+        (WebCore::Text::Text):
+        * style/StyleTreeResolver.cpp:
+        (WebCore::Style::TreeResolver::styleForElement):
+        (WebCore::Style::resetStyleForNonRenderedDescendants):
+        (WebCore::Style::TreeResolver::resolveElement):
+        (WebCore::Style::elementImplicitVisibility):
+        (WebCore::Style::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded): Deleted.
+        (WebCore::Style::textRendererIsNeeded): Deleted.
+        (WebCore::Style::createTextRendererIfNeeded): Deleted.
+        (WebCore::Style::attachTextRenderer): Deleted.
+        (WebCore::Style::detachTextRenderer): Deleted.
+        (WebCore::Style::updateTextRendererAfterContentChange): Deleted.
+        (WebCore::Style::resolveTextNode): Deleted.
+
+            Kill the old code paths.
+
+        * style/StyleTreeResolver.h:
+
 2016-04-05  Hunseop Jeong  <[email protected]>
 
         [Curl][Soup] Fix the build after r199039

Modified: trunk/Source/WebCore/dom/CharacterData.cpp (199053 => 199054)


--- trunk/Source/WebCore/dom/CharacterData.cpp	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/Source/WebCore/dom/CharacterData.cpp	2016-04-05 10:29:31 UTC (rev 199054)
@@ -32,7 +32,6 @@
 #include "ProcessingInstruction.h"
 #include "RenderText.h"
 #include "StyleInheritedData.h"
-#include "StyleTreeResolver.h"
 #include "TextBreakIterator.h"
 #include <wtf/Ref.h>
 
@@ -89,8 +88,8 @@
         m_data.append(string.characters16() + offset, characterLengthLimit);
 
     ASSERT(!renderer() || is<Text>(*this));
-    if (is<Text>(*this))
-        Style::updateTextRendererAfterContentChange(downcast<Text>(*this), oldLength, 0);
+    if (is<Text>(*this) && parentNode())
+        downcast<Text>(*this).updateRendererAfterContentChange(oldLength, 0);
 
     document().incDOMTreeVersion();
     // We don't call dispatchModifiedEvent here because we don't want the
@@ -188,8 +187,8 @@
     m_data = newData;
 
     ASSERT(!renderer() || is<Text>(*this));
-    if (is<Text>(*this))
-        Style::updateTextRendererAfterContentChange(downcast<Text>(*this), offsetOfReplacedData, oldLength);
+    if (is<Text>(*this) && parentNode())
+        downcast<Text>(*this).updateRendererAfterContentChange(offsetOfReplacedData, oldLength);
 
     if (is<ProcessingInstruction>(*this))
         downcast<ProcessingInstruction>(*this).checkStyleSheet();

Modified: trunk/Source/WebCore/dom/Text.cpp (199053 => 199054)


--- trunk/Source/WebCore/dom/Text.cpp	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/Source/WebCore/dom/Text.cpp	2016-04-05 10:29:31 UTC (rev 199054)
@@ -26,12 +26,14 @@
 #include "RenderCombineText.h"
 #include "RenderSVGInlineText.h"
 #include "RenderText.h"
+#include "RenderTreeUpdater.h"
 #include "SVGElement.h"
 #include "SVGNames.h"
 #include "ScopedEventQueue.h"
 #include "ShadowRoot.h"
 #include "StyleInheritedData.h"
 #include "StyleResolver.h"
+#include "StyleUpdate.h"
 #include "TextNodeTraversal.h"
 #include <wtf/CheckedArithmetic.h>
 #include <wtf/text/CString.h>
@@ -217,6 +219,23 @@
     return result;
 }
 
+void Text::updateRendererAfterContentChange(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData)
+{
+    ASSERT(parentNode());
+    if (styleChangeType() == ReconstructRenderTree)
+        return;
+
+    auto textUpdate = std::make_unique<Style::Update>(document());
+    textUpdate->addText(*this);
+
+    RenderTreeUpdater renderTreeUpdater(document());
+    renderTreeUpdater.commit(WTFMove(textUpdate));
+
+    if (auto* renderer = this->renderer())
+        renderer->setTextWithOffset(data(), offsetOfReplacedData, lengthOfReplacedData);
+}
+
+
 #if ENABLE(TREE_DEBUGGING)
 void Text::formatForDebugger(char* buffer, unsigned length) const
 {

Modified: trunk/Source/WebCore/dom/Text.h (199053 => 199054)


--- trunk/Source/WebCore/dom/Text.h	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/Source/WebCore/dom/Text.h	2016-04-05 10:29:31 UTC (rev 199054)
@@ -53,6 +53,8 @@
 
     RenderText* renderer() const;
 
+    void updateRendererAfterContentChange(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
+
 protected:
     Text(Document& document, const String& data, ConstructionType type)
         : CharacterData(document, data, type)

Modified: trunk/Source/WebCore/style/RenderTreeUpdater.cpp (199053 => 199054)


--- trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2016-04-05 10:29:31 UTC (rev 199054)
@@ -90,7 +90,7 @@
 {
     ASSERT(&m_document == &styleUpdate->document());
 
-    if (!m_document.shouldCreateRenderers())
+    if (!m_document.shouldCreateRenderers() || !m_document.renderView())
         return;
 
     m_styleUpdate = WTFMove(styleUpdate);

Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (199053 => 199054)


--- trunk/Source/WebCore/style/StyleTreeResolver.cpp	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp	2016-04-05 10:29:31 UTC (rev 199054)
@@ -50,9 +50,6 @@
 
 namespace Style {
 
-static void attachTextRenderer(Text&, RenderTreePosition&);
-static void resolveTextNode(Text&, RenderTreePosition&);
-
 class SelectorFilterPusher {
 public:
     enum PushMode { Push, NoPush };
@@ -179,103 +176,6 @@
     return WTFMove(elementStyle.renderStyle);
 }
 
-static void invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(Node& current)
-{
-    // FIXME: This needs to traverse in composed tree order.
-
-    // This function finds sibling text renderers where the results of textRendererIsNeeded may have changed as a result of
-    // the current node gaining or losing the renderer. This can only affect white space text nodes.
-    for (Node* sibling = current.nextSibling(); sibling; sibling = sibling->nextSibling()) {
-        if (sibling->needsStyleRecalc())
-            return;
-        if (is<Element>(*sibling)) {
-            // Text renderers beyond rendered elements can't be affected.
-            if (!sibling->renderer() || RenderTreePosition::isRendererReparented(*sibling->renderer()))
-                continue;
-            return;
-        }
-        if (!is<Text>(*sibling))
-            continue;
-        Text& textSibling = downcast<Text>(*sibling);
-        if (!textSibling.containsOnlyWhitespace())
-            continue;
-        textSibling.setNeedsStyleRecalc();
-    }
-}
-
-static bool textRendererIsNeeded(const Text& textNode, const RenderTreePosition& renderTreePosition)
-{
-    const RenderElement& parentRenderer = renderTreePosition.parent();
-    if (!parentRenderer.canHaveChildren())
-        return false;
-    if (parentRenderer.element() && !parentRenderer.element()->childShouldCreateRenderer(textNode))
-        return false;
-    if (textNode.isEditingText())
-        return true;
-    if (!textNode.length())
-        return false;
-    if (!textNode.containsOnlyWhitespace())
-        return true;
-    // This text node has nothing but white space. We may still need a renderer in some cases.
-    if (parentRenderer.isTable() || parentRenderer.isTableRow() || parentRenderer.isTableSection() || parentRenderer.isRenderTableCol() || parentRenderer.isFrameSet())
-        return false;
-    if (parentRenderer.style().preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
-        return true;
-
-    RenderObject* previousRenderer = renderTreePosition.previousSiblingRenderer(textNode);
-    if (previousRenderer && previousRenderer->isBR()) // <span><br/> <br/></span>
-        return false;
-
-    if (parentRenderer.isRenderInline()) {
-        // <span><div/> <div/></span>
-        if (previousRenderer && !previousRenderer->isInline())
-            return false;
-    } else {
-        if (parentRenderer.isRenderBlock() && !parentRenderer.childrenInline() && (!previousRenderer || !previousRenderer->isInline()))
-            return false;
-        
-        RenderObject* first = parentRenderer.firstChild();
-        while (first && first->isFloatingOrOutOfFlowPositioned())
-            first = first->nextSibling();
-        RenderObject* nextRenderer = renderTreePosition.nextSiblingRenderer(textNode);
-        if (!first || nextRenderer == first) {
-            // Whitespace at the start of a block just goes away. Don't even make a render object for this text.
-            return false;
-        }
-    }
-    return true;
-}
-
-static void createTextRendererIfNeeded(Text& textNode, RenderTreePosition& renderTreePosition)
-{
-    ASSERT(!textNode.renderer());
-
-    if (!textRendererIsNeeded(textNode, renderTreePosition))
-        return;
-
-    auto newRenderer = textNode.createTextRenderer(renderTreePosition.parent().style());
-    ASSERT(newRenderer);
-
-    renderTreePosition.computeNextSibling(textNode);
-
-    if (!renderTreePosition.canInsert(*newRenderer))
-        return;
-
-    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
-    // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
-    newRenderer->setFlowThreadState(renderTreePosition.parent().flowThreadState());
-
-    textNode.setRenderer(newRenderer.get());
-    renderTreePosition.insert(*newRenderer.leakPtr());
-}
-
-void attachTextRenderer(Text& textNode, RenderTreePosition& renderTreePosition)
-{
-    createTextRendererIfNeeded(textNode, renderTreePosition);
-
-    textNode.clearNeedsStyleRecalc();
-}
-
 void detachTextRenderer(Text& textNode)
 {
     if (textNode.renderer())
@@ -283,21 +183,6 @@
     textNode.setRenderer(0);
 }
 
-void updateTextRendererAfterContentChange(Text& textNode, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData)
-{
-    auto* renderingParentNode = composedTreeAncestors(textNode).first();
-    if (!renderingParentNode || !renderingParentNode->renderer())
-        return;
-
-    bool hadRenderer = textNode.renderer();
-
-    RenderTreePosition renderTreePosition(*renderingParentNode->renderer());
-    resolveTextNode(textNode, renderTreePosition);
-
-    if (hadRenderer && textNode.renderer())
-        textNode.renderer()->setTextWithOffset(textNode.data(), offsetOfReplacedData, lengthOfReplacedData);
-}
-
 static void resetStyleForNonRenderedDescendants(Element& current)
 {
     // FIXME: This is not correct with shadow trees. This should be done with ComposedTreeIterator.
@@ -445,25 +330,6 @@
     return update;
 }
 
-void resolveTextNode(Text& text, RenderTreePosition& renderTreePosition)
-{
-    text.clearNeedsStyleRecalc();
-
-    bool hasRenderer = text.renderer();
-    bool needsRenderer = textRendererIsNeeded(text, renderTreePosition);
-    if (hasRenderer) {
-        if (needsRenderer)
-            return;
-        detachTextRenderer(text);
-        invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
-        return;
-    }
-    if (!needsRenderer)
-        return;
-    attachTextRenderer(text, renderTreePosition);
-    invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded(text);
-}
-
 #if PLATFORM(IOS)
 static EVisibility elementImplicitVisibility(const Element* element)
 {

Modified: trunk/Source/WebCore/style/StyleTreeResolver.h (199053 => 199054)


--- trunk/Source/WebCore/style/StyleTreeResolver.h	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/Source/WebCore/style/StyleTreeResolver.h	2016-04-05 10:29:31 UTC (rev 199054)
@@ -112,8 +112,6 @@
 void detachRenderTree(Element&, DetachType = NormalDetach);
 void detachTextRenderer(Text&);
 
-void updateTextRendererAfterContentChange(Text&, unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
-
 void queuePostResolutionCallback(std::function<void ()>);
 bool postResolutionCallbacksAreSuspended();
 

Modified: trunk/Source/WebCore/style/StyleUpdate.cpp (199053 => 199054)


--- trunk/Source/WebCore/style/StyleUpdate.cpp	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/Source/WebCore/style/StyleUpdate.cpp	2016-04-05 10:29:31 UTC (rev 199054)
@@ -63,7 +63,7 @@
 void Update::addElement(Element& element, Element* parent, ElementUpdate& change)
 {
     ASSERT(!m_elements.contains(&element));
-    ASSERT(!parent || composedTreeAncestors(element).first() == parent);
+    ASSERT(composedTreeAncestors(element).first() == parent);
 
     addPossibleRoot(parent);
     m_elements.add(&element, change);
@@ -72,12 +72,17 @@
 void Update::addText(Text& text, Element* parent)
 {
     ASSERT(!m_texts.contains(&text));
-    ASSERT(!parent || composedTreeAncestors(text).first() == parent);
+    ASSERT(composedTreeAncestors(text).first() == parent);
 
     addPossibleRoot(parent);
     m_texts.add(&text);
 }
 
+void Update::addText(Text& text)
+{
+    addText(text, composedTreeAncestors(text).first());
+}
+
 void Update::addPossibleRoot(Element* element)
 {
     if (!element) {

Modified: trunk/Source/WebCore/style/StyleUpdate.h (199053 => 199054)


--- trunk/Source/WebCore/style/StyleUpdate.h	2016-04-05 07:04:27 UTC (rev 199053)
+++ trunk/Source/WebCore/style/StyleUpdate.h	2016-04-05 10:29:31 UTC (rev 199054)
@@ -66,6 +66,7 @@
 
     void addElement(Element&, Element* parent, ElementUpdate&);
     void addText(Text&, Element* parent);
+    void addText(Text&);
 
 private:
     void addPossibleRoot(Element*);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to