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

Side by Side Diff: Source/core/editing/commands/DeleteSelectionCommand.cpp

Issue 1286993006: Introduce isRenderedCharacter(Position) function (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T12:39:43 Created 5 years, 4 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
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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 m_downstreamEnd = Position::editingPositionOf(m_downstreamEn d.anchorNode(), offset); 563 m_downstreamEnd = Position::editingPositionOf(m_downstreamEn d.anchorNode(), offset);
564 } 564 }
565 } 565 }
566 } 566 }
567 } 567 }
568 } 568 }
569 569
570 void DeleteSelectionCommand::fixupWhitespace() 570 void DeleteSelectionCommand::fixupWhitespace()
571 { 571 {
572 document().updateLayoutIgnorePendingStylesheets(); 572 document().updateLayoutIgnorePendingStylesheets();
573 // FIXME: isRenderedCharacter should be removed, and we should use VisiblePo sition::characterAfter and VisiblePosition::characterBefore 573 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use
574 if (m_leadingWhitespace.isNotNull() && !m_leadingWhitespace.isRenderedCharac ter() && m_leadingWhitespace.anchorNode()->isTextNode()) { 574 // |VisiblePosition::characterAfter()| and
575 // |VisiblePosition::characterBefore()|
576 if (m_leadingWhitespace.isNotNull() && !isRenderedCharacter(m_leadingWhitesp ace) && m_leadingWhitespace.anchorNode()->isTextNode()) {
575 Text* textNode = toText(m_leadingWhitespace.anchorNode()); 577 Text* textNode = toText(m_leadingWhitespace.anchorNode());
576 ASSERT(!textNode->layoutObject() || textNode->layoutObject()->style()->c ollapseWhiteSpace()); 578 ASSERT(!textNode->layoutObject() || textNode->layoutObject()->style()->c ollapseWhiteSpace());
577 replaceTextInNodePreservingMarkers(textNode, m_leadingWhitespace.compute OffsetInContainerNode(), 1, nonBreakingSpaceString()); 579 replaceTextInNodePreservingMarkers(textNode, m_leadingWhitespace.compute OffsetInContainerNode(), 1, nonBreakingSpaceString());
578 } 580 }
579 if (m_trailingWhitespace.isNotNull() && !m_trailingWhitespace.isRenderedChar acter() && m_trailingWhitespace.anchorNode()->isTextNode()) { 581 if (m_trailingWhitespace.isNotNull() && !isRenderedCharacter(m_trailingWhite space) && m_trailingWhitespace.anchorNode()->isTextNode()) {
580 Text* textNode = toText(m_trailingWhitespace.anchorNode()); 582 Text* textNode = toText(m_trailingWhitespace.anchorNode());
581 ASSERT(!textNode->layoutObject() || textNode->layoutObject()->style()->c ollapseWhiteSpace()); 583 ASSERT(!textNode->layoutObject() || textNode->layoutObject()->style()->c ollapseWhiteSpace());
582 replaceTextInNodePreservingMarkers(textNode, m_trailingWhitespace.comput eOffsetInContainerNode(), 1, nonBreakingSpaceString()); 584 replaceTextInNodePreservingMarkers(textNode, m_trailingWhitespace.comput eOffsetInContainerNode(), 1, nonBreakingSpaceString());
583 } 585 }
584 } 586 }
585 587
586 // If a selection starts in one block and ends in another, we have to merge to b ring content before the 588 // If a selection starts in one block and ends in another, we have to merge to b ring content before the
587 // start together with content after the end. 589 // start together with content after the end.
588 void DeleteSelectionCommand::mergeParagraphs() 590 void DeleteSelectionCommand::mergeParagraphs()
589 { 591 {
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 visitor->trace(m_deleteIntoBlockquoteStyle); 899 visitor->trace(m_deleteIntoBlockquoteStyle);
898 visitor->trace(m_startRoot); 900 visitor->trace(m_startRoot);
899 visitor->trace(m_endRoot); 901 visitor->trace(m_endRoot);
900 visitor->trace(m_startTableRow); 902 visitor->trace(m_startTableRow);
901 visitor->trace(m_endTableRow); 903 visitor->trace(m_endTableRow);
902 visitor->trace(m_temporaryPlaceholder); 904 visitor->trace(m_temporaryPlaceholder);
903 CompositeEditCommand::trace(visitor); 905 CompositeEditCommand::trace(visitor);
904 } 906 }
905 907
906 } // namespace blink 908 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/Position.cpp ('k') | Source/core/editing/commands/InsertLineBreakCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698