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

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

Issue 214313002: Don't inherit block style if text is inserted after paragraph selection. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use Selection.collapse(). Created 6 years, 9 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 document().updateLayoutIgnorePendingStylesheets(); 368 document().updateLayoutIgnorePendingStylesheets();
369 RenderObject *r = node->renderer(); 369 RenderObject *r = node->renderer();
370 if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0) { 370 if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0) {
371 Position firstEditablePosition = firstEditablePositionInNode(node.ge t()); 371 Position firstEditablePosition = firstEditablePositionInNode(node.ge t());
372 if (firstEditablePosition.isNotNull()) 372 if (firstEditablePosition.isNotNull())
373 insertBlockPlaceholder(firstEditablePosition); 373 insertBlockPlaceholder(firstEditablePosition);
374 } 374 }
375 return; 375 return;
376 } 376 }
377 377
378 if (node == m_startBlock && !isEndOfBlock(VisiblePosition(firstPositionInNod e(m_startBlock.get())).previous())) 378 if (node == m_startBlock) {
379 m_needPlaceholder = true; 379 VisiblePosition previous = VisiblePosition(firstPositionInNode(m_startBl ock.get())).previous();
380 else if (node == m_endBlock && !isStartOfBlock(VisiblePosition(lastPositionI nNode(m_startBlock.get())).next())) 380 if (previous.isNotNull() && !isEndOfBlock(previous))
381 m_needPlaceholder = true; 381 m_needPlaceholder = true;
382 }
383 if (node == m_endBlock) {
384 VisiblePosition next = VisiblePosition(lastPositionInNode(m_endBlock.get ())).next();
385 if (next.isNotNull() && !isStartOfBlock(next))
386 m_needPlaceholder = true;
387 }
382 388
383 // FIXME: Update the endpoints of the range being deleted. 389 // FIXME: Update the endpoints of the range being deleted.
384 updatePositionForNodeRemoval(m_endingPosition, *node); 390 updatePositionForNodeRemoval(m_endingPosition, *node);
385 updatePositionForNodeRemoval(m_leadingWhitespace, *node); 391 updatePositionForNodeRemoval(m_leadingWhitespace, *node);
386 updatePositionForNodeRemoval(m_trailingWhitespace, *node); 392 updatePositionForNodeRemoval(m_trailingWhitespace, *node);
387 393
388 CompositeEditCommand::removeNode(node, shouldAssumeContentIsAlwaysEditable); 394 CompositeEditCommand::removeNode(node, shouldAssumeContentIsAlwaysEditable);
389 } 395 }
390 396
391 static void updatePositionForTextRemoval(Node* node, int offset, int count, Posi tion& position) 397 static void updatePositionForTextRemoval(Node* node, int offset, int count, Posi tion& position)
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 857
852 // Normally deletion doesn't preserve the typing style that was present before i t. For example, 858 // Normally deletion doesn't preserve the typing style that was present before i t. For example,
853 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't 859 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't
854 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. 860 // stick around. Deletion should preserve a typing style that *it* sets, howeve r.
855 bool DeleteSelectionCommand::preservesTypingStyle() const 861 bool DeleteSelectionCommand::preservesTypingStyle() const
856 { 862 {
857 return m_typingStyle; 863 return m_typingStyle;
858 } 864 }
859 865
860 } // namespace WebCore 866 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698