Changeset 146999 in webkit
- Timestamp:
- Mar 27, 2013 11:26:15 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r146994 r146999 1 2013-03-27 Sergio Villar Senin <svillar@igalia.com> 2 3 Inserting a blank (" ") at the end of a line does not insert anything in Overtype mode 4 https://bugs.webkit.org/show_bug.cgi?id=113413 5 6 Reviewed by Ryosuke Niwa. 7 8 Updated the test to include the case of inserting a whitespace 9 both in the middle or at the end of a line. 10 11 * editing/execCommand/overtype-expected.txt: 12 * editing/execCommand/overtype.html: 13 1 14 2013-03-27 Zan Dobersek <zdobersek@igalia.com> 2 15 -
trunk/LayoutTests/editing/execCommand/overtype-expected.txt
r146907 r146999 14 14 " 15 15 16 After overwritting the first two characters:16 After overwritting the first character: 17 17 | " 18 18 " 19 19 | <b> 20 | "F O<#selection-caret>o"20 | "F<#selection-caret>oo" 21 21 | <a> 22 22 | href="http://www.google.com/" … … 31 31 " 32 32 | <b> 33 | "FO<#selection-caret> " 33 | "F <#selection-caret>o" 34 | <a> 35 | href="http://www.google.com/" 36 | <div> 37 | id="linkText" 38 | "bar" 39 | " 40 " 41 42 After inserting a blank at the line end: 43 | " 44 " 45 | <b> 46 | "F o <#selection-caret>" 34 47 | <a> 35 48 | href="http://www.google.com/" … … 44 57 " 45 58 | <b> 46 | "F OOSOME MORE<#selection-caret>"59 | "F o SOME MORE<#selection-caret>" 47 60 | <a> 48 61 | href="http://www.google.com/" … … 57 70 " 58 71 | <b> 59 | "F OOSOME MORE"72 | "F o SOME MORE" 60 73 | <a> 61 74 | href="http://www.google.com/" … … 70 83 " 71 84 | <b> 72 | "F OOSOME MORE"85 | "F o SOME MORE" 73 86 | <div> 74 87 | id="linkText" -
trunk/LayoutTests/editing/execCommand/overtype.html
r146907 r146999 30 30 internals.toggleOverwriteModeEnabled(document); 31 31 32 document.execCommand("InsertText", false, 'F O');33 Markup.dump(element, 'After overwritting the first two characters');32 document.execCommand("InsertText", false, 'F'); 33 Markup.dump(element, 'After overwritting the first character'); 34 34 35 35 document.execCommand("InsertText", false, ' '); 36 36 Markup.dump(element, 'After inserting a blank'); 37 37 38 document.execCommand("InsertText", false, 'O SOME MORE'); 38 moveSelectionForwardByCharacterCommand(); 39 document.execCommand("InsertText", false, ' '); 40 Markup.dump(element, 'After inserting a blank at the line end'); 41 42 document.execCommand("InsertText", false, 'SOME MORE'); 39 43 Markup.dump(element, 'Overwrite at the end of a line performs as a normal Insert'); 40 44 -
trunk/Source/WebCore/ChangeLog
r146995 r146999 1 2013-03-27 Sergio Villar Senin <svillar@igalia.com> 2 3 Inserting a blank (" ") at the end of a line does not insert anything in Overtype mode 4 https://bugs.webkit.org/show_bug.cgi?id=113413 5 6 Reviewed by Ryosuke Niwa. 7 8 Perform a "normal" insert instead of a replace when there is 9 nothing to replace (like at the end of a line) as this case is not 10 supported by the replacing code path. This will allow us to 11 properly rebalance whitespaces in those cases. 12 13 Updated the editing/execCommand/overtype.html test to check also 14 this use case. 15 16 * editing/InsertTextCommand.cpp: 17 (WebCore::InsertTextCommand::setEndingSelectionWithoutValidation): 18 (WebCore::InsertTextCommand::performTrivialReplace): 19 (WebCore::InsertTextCommand::performOverwrite): 20 (WebCore::InsertTextCommand::doApply): use the recently added 21 setEndingSelectionWithoutValidation() to avoid code duplication. 22 * editing/InsertTextCommand.h: 23 (InsertTextCommand): 24 1 25 2013-03-27 Dean Jackson <dino@apple.com> 2 26 -
trunk/Source/WebCore/editing/InsertTextCommand.cpp
r146907 r146999 76 76 } 77 77 78 void InsertTextCommand::setEndingSelectionWithoutValidation(const Position& startPosition, const Position& endPosition , bool selectInsertedText)78 void InsertTextCommand::setEndingSelectionWithoutValidation(const Position& startPosition, const Position& endPosition) 79 79 { 80 80 // We could have inserted a part of composed character sequence, … … 85 85 forcedEndingSelection.setIsDirectional(endingSelection().isDirectional()); 86 86 setEndingSelection(forcedEndingSelection); 87 88 if (!selectInsertedText)89 setEndingSelection(VisibleSelection(endingSelection().visibleEnd(), endingSelection().isDirectional()));90 87 } 91 88 … … 105 102 return false; 106 103 107 setEndingSelectionWithoutValidation(start, endPosition, selectInsertedText); 104 setEndingSelectionWithoutValidation(start, endPosition); 105 if (!selectInsertedText) 106 setEndingSelection(VisibleSelection(endingSelection().visibleEnd(), endingSelection().isDirectional())); 108 107 109 108 return true; … … 118 117 119 118 unsigned count = std::min(text.length(), textNode->length() - start.offsetInContainerNode()); 119 if (!count) 120 return false; 121 120 122 replaceTextInNode(textNode, start.offsetInContainerNode(), count, text); 121 123 122 124 Position endPosition = Position(textNode.release(), start.offsetInContainerNode() + text.length()); 123 setEndingSelectionWithoutValidation(start, endPosition, selectInsertedText); 125 setEndingSelectionWithoutValidation(start, endPosition); 126 if (!selectInsertedText) 127 setEndingSelection(VisibleSelection(endingSelection().visibleEnd(), endingSelection().isDirectional())); 124 128 125 129 return true; … … 217 221 } 218 222 219 // We could have inserted a part of composed character sequence, 220 // so we are basically treating ending selection as a range to avoid validation. 221 // <http://bugs.webkit.org/show_bug.cgi?id=15781> 222 VisibleSelection forcedEndingSelection; 223 forcedEndingSelection.setWithoutValidation(startPosition, endPosition); 224 forcedEndingSelection.setIsDirectional(endingSelection().isDirectional()); 225 setEndingSelection(forcedEndingSelection); 223 setEndingSelectionWithoutValidation(startPosition, endPosition); 226 224 227 225 // Handle the case where there is a typing style. -
trunk/Source/WebCore/editing/InsertTextCommand.h
r146907 r146999 74 74 bool performTrivialReplace(const String&, bool selectInsertedText); 75 75 bool performOverwrite(const String&, bool selectInsertedText); 76 void setEndingSelectionWithoutValidation(const Position& startPosition, const Position& endPosition , bool selectInsertedText);76 void setEndingSelectionWithoutValidation(const Position& startPosition, const Position& endPosition); 77 77 78 78 friend class TypingCommand;
Note: See TracChangeset
for help on using the changeset viewer.