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

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

Issue 23311004: inline <br> does not get deleted when following some non-textual content (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch with changed layout testcase Created 7 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
« no previous file with comments | « LayoutTests/editing/deleting/delete-inline-br-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 bool upstreamStartIsBR = nodeAfterUpstreamStart->hasTagName(brTag); 317 bool upstreamStartIsBR = nodeAfterUpstreamStart->hasTagName(brTag);
318 bool downstreamStartIsBR = nodeAfterDownstreamStart->hasTagName(brTag); 318 bool downstreamStartIsBR = nodeAfterDownstreamStart->hasTagName(brTag);
319 bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && nodeAf terDownstreamStart == nodeAfterUpstreamEnd; 319 bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && nodeAf terDownstreamStart == nodeAfterUpstreamEnd;
320 if (isBROnLineByItself) { 320 if (isBROnLineByItself) {
321 removeNode(nodeAfterDownstreamStart); 321 removeNode(nodeAfterDownstreamStart);
322 return true; 322 return true;
323 } 323 }
324 324
325 // FIXME: This code doesn't belong in here. 325 // FIXME: This code doesn't belong in here.
326 // We detect the case where the start is an empty line consisting of BR not wrapped in a block element. 326 // We detect the case where the start is an empty line consisting of BR not wrapped in a block element.
327 if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(positionBef oreNode(nodeAfterUpstreamStart)) && isEndOfBlock(positionAfterNode(nodeAfterUpst reamStart)))) { 327 if (upstreamStartIsBR && downstreamStartIsBR
328 && !(isStartOfBlock(positionBeforeNode(nodeAfterUpstreamStart)) && isEnd OfBlock(positionAfterNode(nodeAfterDownstreamStart)))
329 && (!nodeAfterUpstreamEnd || nodeAfterUpstreamEnd->hasTagName(brTag) || nodeAfterUpstreamEnd->previousSibling() != nodeAfterUpstreamStart)) {
328 m_startsAtEmptyLine = true; 330 m_startsAtEmptyLine = true;
329 m_endingPosition = m_downstreamEnd; 331 m_endingPosition = m_downstreamEnd;
330 } 332 }
331 333
332 return false; 334 return false;
333 } 335 }
334 336
335 static Position firstEditablePositionInNode(Node* node) 337 static Position firstEditablePositionInNode(Node* node)
336 { 338 {
337 ASSERT(node); 339 ASSERT(node);
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 850
849 // Normally deletion doesn't preserve the typing style that was present before i t. For example, 851 // Normally deletion doesn't preserve the typing style that was present before i t. For example,
850 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't 852 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't
851 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. 853 // stick around. Deletion should preserve a typing style that *it* sets, howeve r.
852 bool DeleteSelectionCommand::preservesTypingStyle() const 854 bool DeleteSelectionCommand::preservesTypingStyle() const
853 { 855 {
854 return m_typingStyle; 856 return m_typingStyle;
855 } 857 }
856 858
857 } // namespace WebCore 859 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/deleting/delete-inline-br-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698