Remove unnecessary sibling text renderers after attach
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Sep 2013 18:25:46 +0000 (18:25 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Sep 2013 18:25:46 +0000 (18:25 +0000)
commit31fee7f0a6b9557ee0e7171a8877f9d242bb96de
treea9df9eea4a44084833e6a6162cdb5014eb3c300d
parent3fc55678c97a54c49165e483ed914b9887866a85
Remove unnecessary sibling text renderers after attach
https://bugs.webkit.org/show_bug.cgi?id=120953

Source/WebCore:

Reviewed by the Swedish Review Team: Anders Carlsson and Andreas Kling.

The current createTextRenderersForSiblingsAfterAttachIfNeeded code only adds text renderers, never removes them.
Style changes can go either way.

The patch causes no visible changes in rendered output. The whitespace nodes that it affects are leftovers that
have no rendering effect. However it does change results of many dumpAsText and render tree dump based layout
tests as unnecessary text nodes disappear.

The main goal is to make results of dynamic attach and parsing time attach produce more similar results. As
an added bonus we get slightly simpler rendering trees.

Rendering tree dumps show us still leaving behind empty anonymous blocks when removing whitespace text nodes.
Those should collapse away too.

* style/StyleResolveTree.cpp:
(WebCore::Style::reattachTextRenderersForWhitespaceOnlySiblingsAfterAttachIfNeeded):

    Allow the code both create and remove text renderers.
    Tighten to bail out faster if case is not the exact one that matters.
    Use NodeRenderingTraversal to mirror textRendererIsNeeded.
    Renamed for clarity.

(WebCore::Style::updateTextRendererAfterContentChange):
(WebCore::Style::resolveLocal):
(WebCore::Style::updateTextStyle):
(WebCore::Style::attachRenderTree):

LayoutTests:

Reviewed by Anders Carlsson and Andreas Kling.

A bunch of spaces and empty lines disappear from dumpAsText test results.
Empty RenderTexts disapper from render tree dumps.

* css3/flexbox/flex-flow-auto-margins-expected.txt:
* css3/flexbox/flex-flow-auto-margins-no-available-space-expected.txt:
* css3/flexbox/flex-flow-border-expected.txt:
* css3/flexbox/flex-flow-margins-auto-size-expected.txt:
* css3/flexbox/flex-flow-margins-expected.txt:
* css3/flexbox/flex-flow-orientations-expected.txt:
* css3/flexbox/flex-flow-overflow-expected.txt:
* css3/flexbox/flex-flow-padding-expected.txt:
* css3/flexbox/flexbox-ignore-firstLetter-expected.txt:
* css3/flexbox/inline-flexbox-ignore-firstLine-expected.txt:
* css3/flexbox/intrinsic-min-width-applies-with-fixed-width-expected.txt:
* editing/selection/focus-crash-expected.txt:

    A few frame based tests also gain an extra space from alrgorithm fixes in creation direction.

* editing/style/toggle-style-bold-italic-expected.txt:
* editing/style/toggle-style-bold-italic-mixed-editability-expected.txt:
* fast/block/float/intruding-float-not-removed-writing-mode-expected.txt:
* fast/css/getComputedStyle/getComputedStyle-resolved-values-expected.txt:
* fast/css/import-style-update-expected.txt:
* fast/css/positioned-overflow-scroll-expected.txt:
* fast/dom/HTMLLinkElement/resolve-url-on-insertion-expected.txt:
* fast/dom/search-shadow-host-crash-expected.txt:
* fast/dynamic/inline-to-block-crash-expected.txt:
* fast/events/input-element-display-none-in-dragleave-crash-expected.txt:
* fast/flexbox/intrinsic-min-width-applies-with-fixed-width-expected.txt:
* fast/forms/select-listbox-focus-displaynone-expected.txt:
* fast/frames/repaint-display-none-crash-expected.txt:
* fast/inline/inline-with-empty-inline-children-expected.txt:
* fast/inline/out-of-flow-objects-and-whitespace-after-empty-inline-expected.txt:
* fast/repaint/text-in-relative-positioned-inline-expected.txt:
* fast/replaced/computed-image-width-with-percent-height-and-fixed-ancestor-expected.txt:
* fast/replaced/computed-image-width-with-percent-height-and-fixed-ancestor-vertical-lr-expected.txt:
* fast/replaced/preferred-widths-expected.txt:
* fast/spatial-navigation/snav-tiny-table-traversal-expected.txt:
* fast/table/min-max-width-preferred-size-expected.txt:
* fast/xsl/import-non-document-node-expected.txt:
* fullscreen/full-screen-fixed-pos-parent-expected.txt:
* http/tests/appcache/auth-expected.txt:
* http/tests/cache/subresource-expiration-1-expected.txt:
* http/tests/cache/subresource-expiration-2-expected.txt:
* http/tests/xmlhttprequest/send-array-buffer-expected.txt:
* http/tests/xmlhttprequest/send-data-view-expected.txt:
* http/tests/xmlhttprequest/send-undefined-and-null-expected.txt:
* platform/mac/editing/input/firstrectforcharacterrange-plain-expected.txt:
* platform/mac/editing/input/firstrectforcharacterrange-styled-expected.txt:
* platform/mac/editing/pasteboard/4989774-expected.txt:
* platform/mac/editing/pasteboard/paste-match-style-001-expected.txt:
* platform/mac/editing/selection/caret-ltr-2-expected.txt:
* platform/mac/editing/selection/caret-ltr-2-left-expected.txt:
* platform/mac/editing/selection/caret-ltr-expected.txt:
* platform/mac/editing/selection/caret-ltr-right-expected.txt:
* platform/mac/editing/selection/caret-rtl-2-expected.txt:
* platform/mac/editing/selection/caret-rtl-2-left-expected.txt:
* platform/mac/editing/selection/caret-rtl-expected.txt:
* platform/mac/editing/selection/caret-rtl-right-expected.txt:
* platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt:
* platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt:
* platform/mac/editing/spelling/autocorrection-in-textarea-expected.txt:
* platform/mac/editing/style/style-boundary-005-expected.txt:
* platform/mac/fast/AppleScript/001-expected.txt:
* platform/mac/fast/AppleScript/date-expected.txt:
* platform/mac/fast/forms/formmove3-expected.txt:
* platform/mac/fast/forms/input-align-image-expected.txt:
* platform/mac/fast/forms/preserveFormDuringResidualStyle-expected.txt:
* platform/mac/fast/invalid/003-expected.txt:
* platform/mac/fast/text/attributed-substring-from-range-002-expected.txt:
* platform/mac/tables/mozilla/bugs/bug647-expected.txt:
* userscripts/user-script-all-frames-expected.txt:
* userscripts/user-script-top-frame-only-expected.txt:

    Here too.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
68 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/flexbox/flex-flow-auto-margins-expected.txt
LayoutTests/css3/flexbox/flex-flow-auto-margins-no-available-space-expected.txt
LayoutTests/css3/flexbox/flex-flow-border-expected.txt
LayoutTests/css3/flexbox/flex-flow-margins-auto-size-expected.txt
LayoutTests/css3/flexbox/flex-flow-margins-expected.txt
LayoutTests/css3/flexbox/flex-flow-orientations-expected.txt
LayoutTests/css3/flexbox/flex-flow-overflow-expected.txt
LayoutTests/css3/flexbox/flex-flow-padding-expected.txt
LayoutTests/css3/flexbox/flexbox-ignore-firstLetter-expected.txt
LayoutTests/css3/flexbox/inline-flexbox-ignore-firstLine-expected.txt
LayoutTests/css3/flexbox/intrinsic-min-width-applies-with-fixed-width-expected.txt
LayoutTests/editing/selection/focus-crash-expected.txt
LayoutTests/editing/style/toggle-style-bold-italic-expected.txt
LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability-expected.txt
LayoutTests/fast/block/float/intruding-float-not-removed-writing-mode-expected.txt
LayoutTests/fast/css/getComputedStyle/getComputedStyle-resolved-values-expected.txt
LayoutTests/fast/css/import-style-update-expected.txt
LayoutTests/fast/css/positioned-overflow-scroll-expected.txt
LayoutTests/fast/dom/HTMLLinkElement/resolve-url-on-insertion-expected.txt
LayoutTests/fast/dom/search-shadow-host-crash-expected.txt
LayoutTests/fast/dynamic/inline-to-block-crash-expected.txt
LayoutTests/fast/events/input-element-display-none-in-dragleave-crash-expected.txt
LayoutTests/fast/flexbox/intrinsic-min-width-applies-with-fixed-width-expected.txt
LayoutTests/fast/forms/select-listbox-focus-displaynone-expected.txt
LayoutTests/fast/frames/repaint-display-none-crash-expected.txt
LayoutTests/fast/inline/inline-with-empty-inline-children-expected.txt
LayoutTests/fast/inline/out-of-flow-objects-and-whitespace-after-empty-inline-expected.txt
LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.txt
LayoutTests/fast/replaced/computed-image-width-with-percent-height-and-fixed-ancestor-expected.txt
LayoutTests/fast/replaced/computed-image-width-with-percent-height-and-fixed-ancestor-vertical-lr-expected.txt
LayoutTests/fast/replaced/preferred-widths-expected.txt
LayoutTests/fast/spatial-navigation/snav-tiny-table-traversal-expected.txt
LayoutTests/fast/table/min-max-width-preferred-size-expected.txt
LayoutTests/fast/xsl/import-non-document-node-expected.txt
LayoutTests/fullscreen/full-screen-fixed-pos-parent-expected.txt
LayoutTests/http/tests/appcache/auth-expected.txt
LayoutTests/http/tests/cache/subresource-expiration-1-expected.txt
LayoutTests/http/tests/cache/subresource-expiration-2-expected.txt
LayoutTests/http/tests/xmlhttprequest/send-array-buffer-expected.txt
LayoutTests/http/tests/xmlhttprequest/send-data-view-expected.txt
LayoutTests/http/tests/xmlhttprequest/send-undefined-and-null-expected.txt
LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-plain-expected.txt
LayoutTests/platform/mac/editing/input/firstrectforcharacterrange-styled-expected.txt
LayoutTests/platform/mac/editing/pasteboard/4989774-expected.txt
LayoutTests/platform/mac/editing/pasteboard/paste-match-style-001-expected.txt
LayoutTests/platform/mac/editing/selection/caret-ltr-2-expected.txt
LayoutTests/platform/mac/editing/selection/caret-ltr-2-left-expected.txt
LayoutTests/platform/mac/editing/selection/caret-ltr-expected.txt
LayoutTests/platform/mac/editing/selection/caret-ltr-right-expected.txt
LayoutTests/platform/mac/editing/selection/caret-rtl-2-expected.txt
LayoutTests/platform/mac/editing/selection/caret-rtl-2-left-expected.txt
LayoutTests/platform/mac/editing/selection/caret-rtl-expected.txt
LayoutTests/platform/mac/editing/selection/caret-rtl-right-expected.txt
LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt
LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt
LayoutTests/platform/mac/editing/style/style-boundary-005-expected.txt
LayoutTests/platform/mac/fast/AppleScript/001-expected.txt
LayoutTests/platform/mac/fast/forms/formmove3-expected.txt
LayoutTests/platform/mac/fast/forms/input-align-image-expected.txt
LayoutTests/platform/mac/fast/forms/preserveFormDuringResidualStyle-expected.txt
LayoutTests/platform/mac/fast/invalid/003-expected.txt
LayoutTests/platform/mac/fast/text/attributed-substring-from-range-002-expected.txt
LayoutTests/platform/mac/tables/mozilla/bugs/bug647-expected.txt
LayoutTests/userscripts/user-script-all-frames-expected.txt
LayoutTests/userscripts/user-script-top-frame-only-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/style/StyleResolveTree.cpp