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

Side by Side Diff: WebCore/editing/DeleteSelectionCommand.cpp

Issue 3027024: Merge 63773 - 2010-07-20 Abhishek Arya <inferno@chromium.org>... (Closed) Base URL: svn://chrome-svn/chrome/branches/WebKit/472/
Patch Set: Created 10 years, 5 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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 Apple Computer, 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 530 }
531 } 531 }
532 } 532 }
533 } 533 }
534 } 534 }
535 535
536 void DeleteSelectionCommand::fixupWhitespace() 536 void DeleteSelectionCommand::fixupWhitespace()
537 { 537 {
538 updateLayout(); 538 updateLayout();
539 // FIXME: isRenderedCharacter should be removed, and we should use VisiblePo sition::characterAfter and VisiblePosition::characterBefore 539 // FIXME: isRenderedCharacter should be removed, and we should use VisiblePo sition::characterAfter and VisiblePosition::characterBefore
540 if (m_leadingWhitespace.isNotNull() && !m_leadingWhitespace.isRenderedCharac ter()) { 540 if (m_leadingWhitespace.isNotNull() && !m_leadingWhitespace.isRenderedCharac ter() && m_leadingWhitespace.node()->isTextNode()) {
541 Text* textNode = static_cast<Text*>(m_leadingWhitespace.node()); 541 Text* textNode = static_cast<Text*>(m_leadingWhitespace.node());
542 ASSERT(!textNode->renderer() || textNode->renderer()->style()->collapseW hiteSpace()); 542 ASSERT(!textNode->renderer() || textNode->renderer()->style()->collapseW hiteSpace());
543 replaceTextInNode(textNode, m_leadingWhitespace.deprecatedEditingOffset( ), 1, nonBreakingSpaceString()); 543 replaceTextInNode(textNode, m_leadingWhitespace.deprecatedEditingOffset( ), 1, nonBreakingSpaceString());
544 } 544 }
545 if (m_trailingWhitespace.isNotNull() && !m_trailingWhitespace.isRenderedChar acter()) { 545 if (m_trailingWhitespace.isNotNull() && !m_trailingWhitespace.isRenderedChar acter() && m_trailingWhitespace.node()->isTextNode()) {
546 Text* textNode = static_cast<Text*>(m_trailingWhitespace.node()); 546 Text* textNode = static_cast<Text*>(m_trailingWhitespace.node());
547 ASSERT(!textNode->renderer() ||textNode->renderer()->style()->collapseWh iteSpace()); 547 ASSERT(!textNode->renderer() ||textNode->renderer()->style()->collapseWh iteSpace());
548 replaceTextInNode(textNode, m_trailingWhitespace.deprecatedEditingOffset (), 1, nonBreakingSpaceString()); 548 replaceTextInNode(textNode, m_trailingWhitespace.deprecatedEditingOffset (), 1, nonBreakingSpaceString());
549 } 549 }
550 } 550 }
551 551
552 // If a selection starts in one block and ends in another, we have to merge to b ring content before the 552 // If a selection starts in one block and ends in another, we have to merge to b ring content before the
553 // start together with content after the end. 553 // start together with content after the end.
554 void DeleteSelectionCommand::mergeParagraphs() 554 void DeleteSelectionCommand::mergeParagraphs()
555 { 555 {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 814
815 // Normally deletion doesn't preserve the typing style that was present before i t. For example, 815 // Normally deletion doesn't preserve the typing style that was present before i t. For example,
816 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't 816 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't
817 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. 817 // stick around. Deletion should preserve a typing style that *it* sets, howeve r.
818 bool DeleteSelectionCommand::preservesTypingStyle() const 818 bool DeleteSelectionCommand::preservesTypingStyle() const
819 { 819 {
820 return m_typingStyle; 820 return m_typingStyle;
821 } 821 }
822 822
823 } // namespace WebCore 823 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/execCommand/editing-nontext-node-crash-expected.txt ('k') | WebCore/editing/InsertLineBreakCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698