Changeset 148597 in webkit
- Timestamp:
- Apr 17, 2013 3:29:24 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r148596 r148597 1 2013-04-17 Claudio Saavedra <csaavedra@igalia.com> 2 3 execCommand("RemoveFormat") might remove format after the selection 4 https://bugs.webkit.org/show_bug.cgi?id=112240 5 6 Reviewed by Ryosuke Niwa. 7 8 * editing/execCommand/remove-format-multiple-elements-mac-expected.txt: Updated. 9 * editing/execCommand/script-tests/remove-format-multiple-elements-mac.js: 10 (selectFirstLine): Add this method to check that RemoveFormat works when 11 a whole line is selected. 12 1 13 2013-04-17 Zoltan Arvai <zarvai@inf.u-szeged.hu> 2 14 -
trunk/LayoutTests/editing/execCommand/remove-format-multiple-elements-mac-expected.txt
r147035 r148597 17 17 PASS RemoveFormat on last two words of "<q><b><div>hello world</div></b>WebKit</q>" yields "<div><q><b>hello </b></q>world</div>WebKit" 18 18 PASS RemoveFormat on second word of "<q><b><div>hello world</div></b>WebKit</q>" yields "<div><q><b>hello </b></q>world</div><q>WebKit</q>" 19 PASS RemoveFormat on first line of "<b><div>hello</div>webkit</b>" yields "<div>hello</div><b>webkit</b>" 19 20 PASS RemoveFormat on all of "<i style="font-weight:bold;">hello</i> <u>world</u>" yields "hello world" 20 21 PASS RemoveFormat on second word of "<font color="red"><b style="font-size: large;"><u>hello</u> world</b> WebKit</font>" yields "<font color="red"><b style="font-size: large;"><u>hello</u> </b></font>world<font color="red"> WebKit</font>" -
trunk/LayoutTests/editing/execCommand/script-tests/remove-format-multiple-elements-mac.js
r147035 r148597 52 52 } 53 53 54 function selectFirstLine(container) { 55 window.getSelection().setPosition(container, 0); 56 window.getSelection().modify('extend', 'forward', 'line'); 57 return 'first line'; 58 } 59 54 60 testRemoveFormat('hello', selectAll, 'hello'); 55 61 testRemoveFormat('<i>hello</i> <u>world</u>', selectAll, 'hello world'); … … 67 73 testRemoveFormat('<q><b><div>hello world</div></b>WebKit</q>', selectLastTwoWords, '<div><q><b>hello </b></q>world</div>WebKit'); 68 74 testRemoveFormat('<q><b><div>hello world</div></b>WebKit</q>', selectSecondWord, '<div><q><b>hello </b></q>world</div><q>WebKit</q>'); 75 testRemoveFormat('<b><div>hello</div>webkit</b>', selectFirstLine, '<div>hello</div><b>webkit</b>'); 69 76 70 77 testRemoveFormat('<i style="font-weight:bold;">hello</i> <u>world</u>', selectAll, 'hello world'); -
trunk/Source/WebCore/ChangeLog
r148595 r148597 1 2013-04-17 Claudio Saavedra <csaavedra@igalia.com> 2 3 execCommand("RemoveFormat") might remove format after the selection 4 https://bugs.webkit.org/show_bug.cgi?id=112240 5 6 Reviewed by Ryosuke Niwa. 7 8 Tests: editing/execCommand/remove-format-multiple-elements-mac.html 9 10 This bug is hit when ApplyStyleCommand is used to change the 11 style and the current selection ends in the beginning of a new node. 12 The bug is actually a two-fold thing: 13 14 1. There was no check as to whether the end node is really 15 selected or not, and format was always removed from it with 16 pushDownInlineStyleAroundNode(). An equivalent check for the start 17 node was already in place, so fix it analogously. 18 19 2. Previous stage might change the dom tree, resulting in a render 20 tree that is not up-to-date. Position::upstream() is later used 21 and, in order to be able to find a visually equivalent position in 22 a text node, this method needs the render tree to be up-to-date, 23 therefore, a call to updateLayoutIgnorePendingStylesheets() is 24 necessary. 25 26 * editing/ApplyStyleCommand.cpp: 27 (WebCore::ApplyStyleCommand::removeInlineStyle): Make sure that no 28 format is removed from the end node if it's not fully selected. 29 (WebCore::ApplyStyleCommand::nodeFullySelected): Call updateLayoutIgnorePendingStylesheets() 30 1 31 2013-04-17 Alberto Garcia <agarcia@igalia.com> 2 32 -
trunk/Source/WebCore/editing/ApplyStyleCommand.cpp
r148497 r148597 1077 1077 ASSERT(end.anchorNode()->inDocument()); 1078 1078 ASSERT(comparePositions(start, end) <= 0); 1079 // FIXME: We should assert that start/end are not in the middle of a text node. 1079 1080 1080 1081 Position pushDownStart = start.downstream(); … … 1086 1087 && pushDownStart.computeOffsetInContainerNode() == pushDownStartContainer->maxCharacterOffset()) 1087 1088 pushDownStart = nextVisuallyDistinctCandidate(pushDownStart); 1089 // If pushDownEnd is at the start of a text node, then this node is not fully selected. 1090 // Move it to the previous deep equivalent position to avoid removing the style from this node. 1088 1091 Position pushDownEnd = end.upstream(); 1092 Node* pushDownEndContainer = pushDownEnd.containerNode(); 1093 if (pushDownEndContainer && pushDownEndContainer->isTextNode() && !pushDownEnd.computeOffsetInContainerNode()) 1094 pushDownEnd = previousVisuallyDistinctCandidate(pushDownEnd); 1089 1095 1090 1096 pushDownInlineStyleAroundNode(style, pushDownStart.deprecatedNode()); … … 1153 1159 ASSERT(node->isElementNode()); 1154 1160 1161 // The tree may have changed and Position::upstream() relies on an up-to-date layout. 1162 node->document()->updateLayoutIgnorePendingStylesheets(); 1163 1155 1164 return comparePositions(firstPositionInOrBeforeNode(node), start) >= 0 1156 1165 && comparePositions(lastPositionInOrAfterNode(node).upstream(), end) <= 0;
Note: See TracChangeset
for help on using the changeset viewer.