Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: third_party/WebKit/WebCore/editing/TypingCommand.cpp

Issue 21165: Revert the merge. Mac build is mysteriously broken. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 selection.modify(SelectionController::EXTEND, SelectionControlle r::BACKWARD, granularity); 410 selection.modify(SelectionController::EXTEND, SelectionControlle r::BACKWARD, granularity);
411 // If the caret is just after a table, select the table and don't de lete anything. 411 // If the caret is just after a table, select the table and don't de lete anything.
412 } else if (Node* table = isFirstPositionAfterTable(visibleStart)) { 412 } else if (Node* table = isFirstPositionAfterTable(visibleStart)) {
413 setEndingSelection(Selection(Position(table, 0), endingSelection ().start(), DOWNSTREAM)); 413 setEndingSelection(Selection(Position(table, 0), endingSelection ().start(), DOWNSTREAM));
414 typingAddedToOpenCommand(); 414 typingAddedToOpenCommand();
415 return; 415 return;
416 } 416 }
417 417
418 selectionToDelete = selection.selection(); 418 selectionToDelete = selection.selection();
419 419
420 if (granularity == CharacterGranularity && selectionToDelete.end().n ode() == selectionToDelete.start().node() && selectionToDelete.end().offset() - selectionToDelete.start().offset() > 1) { 420 if (granularity == CharacterGranularity && selectionToDelete.end().o ffset() - selectionToDelete.start().offset() > 1) {
421 // If there are multiple Unicode code points to be deleted, adju st the range to match platform conventions. 421 // When we delete a ligature consisting of multiple Unicode char acters with a backspace key,
422 selectionToDelete.setWithoutValidation(selectionToDelete.end(), selectionToDelete.end().previous(BackwardDeletion)); 422 // we should not delete the ligature but delete only its last ch araceter. To check we are deleting
423 // a ligature, we retrieve the previous position of the caret an d count the number of
424 // characters to be deleted.
425 // To prevent from calculating the previous position every time when pressing a backspace key,
426 // we retrieve the previous position only when the given selecti on consists of two or more characters.
427 if (selectionToDelete.end().offset() - selectionToDelete.end().p revious(UsingComposedCharacters).offset() > 1)
428 selectionToDelete.setWithoutValidation(selectionToDelete.end (), selectionToDelete.end().previous(NotUsingComposedCharacters));
423 } 429 }
424 430
425 if (!startingSelection().isRange() || selectionToDelete.base() != st artingSelection().start()) 431 if (!startingSelection().isRange() || selectionToDelete.base() != st artingSelection().start())
426 selectionAfterUndo = selectionToDelete; 432 selectionAfterUndo = selectionToDelete;
427 else 433 else
428 // It's a little tricky to compute what the starting selection w ould have been in the original document. 434 // It's a little tricky to compute what the starting selection w ould have been in the original document.
429 // We can't let the Selection class's validation kick in or it'l l adjust for us based on 435 // We can't let the Selection class's validation kick in or it'l l adjust for us based on
430 // the current state of the document and we'll get the wrong res ult. 436 // the current state of the document and we'll get the wrong res ult.
431 selectionAfterUndo.setWithoutValidation(startingSelection().end( ), selectionToDelete.extent()); 437 selectionAfterUndo.setWithoutValidation(startingSelection().end( ), selectionToDelete.extent());
432 break; 438 break;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 return false; 554 return false;
549 } 555 }
550 556
551 bool TypingCommand::isTypingCommand() const 557 bool TypingCommand::isTypingCommand() const
552 { 558 {
553 return true; 559 return true;
554 } 560 }
555 561
556 } // namespace WebCore 562 } // namespace WebCore
557 563
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/editing/Editor.cpp ('k') | third_party/WebKit/WebCore/editing/htmlediting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698