-
enrica@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=30946 <rdar://problem/7639184> Reviewed by Adele Peterson. WebCore: Do text insertion and whitespace rebalancing around the insertion in one step so that there's only one layout. This patch was originally made by Justin Garcia. Test: editing/inserting/rebalance-whitespace-1.html * editing/CompositeEditCommand.cpp: (WebCore::CompositeEditCommand::rebalanceWhitespaceAt): No behavior changes here, just pushed the code that determined the extent of whitespace surrounding a position to its own helper function. * editing/InsertTextCommand.cpp: (WebCore::InsertTextCommand::insertTextIntoNodeAndRebalanceWhitespace): Added. Find whitespace surrounding the insertion position, add the text to insert, rebalance that entire string, then insert it into the document. (WebCore::InsertTextCommand::input): * editing/InsertTextCommand.h: * editing/htmlediting.cpp: (WebCore::isWhitespace): Moved from CompositeEditCommand.cpp. (WebCore::extentOfWhitespaceForRebalancingAt): Moved code from rebalanceWhitespaceAt into this helper function. Obtains the offset of the start and end of whitespace around a particular position. * editing/htmlediting.h: LayoutTests: There are now regular spaces where nbsps were used unnecessarily before. Also, multi-character insertions now have their whitespace rebalanced, and this is reflected in a few tests. * editing/execCommand/5142012-3-expected.txt: * editing/inserting/rebalance-whitespace-1-expected.txt: Added. * editing/inserting/rebalance-whitespace-1.html: Added. * editing/pasteboard/5521237-expected.txt: * platform/mac/editing/execCommand/5482023-expected.checksum: * platform/mac/editing/execCommand/5482023-expected.png: Removed. * platform/mac/editing/execCommand/5482023-expected.txt: * platform/mac/editing/execCommand/remove-formatting-2-expected.checksum: * platform/mac/editing/execCommand/remove-formatting-2-expected.png: Removed. * platform/mac/editing/execCommand/remove-formatting-expected.checksum: * platform/mac/editing/execCommand/remove-formatting-expected.png: Removed. * platform/mac/editing/execCommand/remove-formatting-expected.txt: * platform/mac/editing/inserting/editable-html-element-expected.checksum: * platform/mac/editing/inserting/editable-html-element-expected.png: Removed. * platform/mac/editing/inserting/editable-html-element-expected.txt: * platform/mac/editing/pasteboard/4989774-expected.checksum: * platform/mac/editing/pasteboard/4989774-expected.png: Removed. * platform/mac/editing/pasteboard/4989774-expected.txt: * platform/mac/editing/selection/4983858-expected.checksum: * platform/mac/editing/selection/4983858-expected.png: Removed. * platform/mac/editing/selection/4983858-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55263 268f45cc-cd09-0410-ab3c-d52691b4dbfc
b5adb4e2