OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 moveNodeOutOfAncestor(node, headerElement); | 631 moveNodeOutOfAncestor(node, headerElement); |
632 } | 632 } |
633 } | 633 } |
634 } | 634 } |
635 | 635 |
636 void ReplaceSelectionCommand::moveNodeOutOfAncestor(PassRefPtr<Node> prpNode, Pa
ssRefPtr<Node> prpAncestor) | 636 void ReplaceSelectionCommand::moveNodeOutOfAncestor(PassRefPtr<Node> prpNode, Pa
ssRefPtr<Node> prpAncestor) |
637 { | 637 { |
638 RefPtr<Node> node = prpNode; | 638 RefPtr<Node> node = prpNode; |
639 RefPtr<Node> ancestor = prpAncestor; | 639 RefPtr<Node> ancestor = prpAncestor; |
640 | 640 |
| 641 if (!ancestor->parentNode()->rendererIsEditable()) |
| 642 return; |
| 643 |
641 VisiblePosition positionAtEndOfNode = lastPositionInOrAfterNode(node.get()); | 644 VisiblePosition positionAtEndOfNode = lastPositionInOrAfterNode(node.get()); |
642 VisiblePosition lastPositionInParagraph = lastPositionInNode(ancestor.get())
; | 645 VisiblePosition lastPositionInParagraph = lastPositionInNode(ancestor.get())
; |
643 if (positionAtEndOfNode == lastPositionInParagraph) { | 646 if (positionAtEndOfNode == lastPositionInParagraph) { |
644 removeNode(node); | 647 removeNode(node); |
645 if (ancestor->nextSibling()) | 648 if (ancestor->nextSibling()) |
646 insertNodeBefore(node, ancestor->nextSibling()); | 649 insertNodeBefore(node, ancestor->nextSibling()); |
647 else | 650 else |
648 appendNode(node, ancestor->parentNode()); | 651 appendNode(node, ancestor->parentNode()); |
649 } else { | 652 } else { |
650 RefPtr<Node> nodeToSplitTo = splitTreeToNode(node.get(), ancestor.get(),
true); | 653 RefPtr<Node> nodeToSplitTo = splitTreeToNode(node.get(), ancestor.get(),
true); |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); | 1487 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
1485 | 1488 |
1486 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1489 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
1487 | 1490 |
1488 setEndingSelection(selectionAfterReplace); | 1491 setEndingSelection(selectionAfterReplace); |
1489 | 1492 |
1490 return true; | 1493 return true; |
1491 } | 1494 } |
1492 | 1495 |
1493 } // namespace WebCore | 1496 } // namespace WebCore |
OLD | NEW |