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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 if (lastLeafInserted && lastLeafInserted->isTextNode() && !nodeHasVisibleRen
derText(toText(lastLeafInserted)) | 668 if (lastLeafInserted && lastLeafInserted->isTextNode() && !nodeHasVisibleRen
derText(toText(lastLeafInserted)) |
669 && !enclosingNodeWithTag(firstPositionInOrBeforeNode(lastLeafInserted),
selectTag) | 669 && !enclosingNodeWithTag(firstPositionInOrBeforeNode(lastLeafInserted),
selectTag) |
670 && !enclosingNodeWithTag(firstPositionInOrBeforeNode(lastLeafInserted),
scriptTag)) { | 670 && !enclosingNodeWithTag(firstPositionInOrBeforeNode(lastLeafInserted),
scriptTag)) { |
671 insertedNodes.willRemoveNode(lastLeafInserted); | 671 insertedNodes.willRemoveNode(lastLeafInserted); |
672 removeNode(lastLeafInserted); | 672 removeNode(lastLeafInserted); |
673 } | 673 } |
674 | 674 |
675 // We don't have to make sure that firstNodeInserted isn't inside a select o
r script element, because | 675 // We don't have to make sure that firstNodeInserted isn't inside a select o
r script element, because |
676 // it is a top level node in the fragment and the user can't insert into tho
se elements. | 676 // it is a top level node in the fragment and the user can't insert into tho
se elements. |
677 Node* firstNodeInserted = insertedNodes.firstNodeInserted(); | 677 Node* firstNodeInserted = insertedNodes.firstNodeInserted(); |
678 lastLeafInserted = insertedNodes.lastLeafInserted(); | |
679 if (firstNodeInserted && firstNodeInserted->isTextNode() && !nodeHasVisibleR
enderText(toText(firstNodeInserted))) { | 678 if (firstNodeInserted && firstNodeInserted->isTextNode() && !nodeHasVisibleR
enderText(toText(firstNodeInserted))) { |
680 insertedNodes.willRemoveNode(firstNodeInserted); | 679 insertedNodes.willRemoveNode(firstNodeInserted); |
681 removeNode(firstNodeInserted); | 680 removeNode(firstNodeInserted); |
682 } | 681 } |
683 } | 682 } |
684 | 683 |
685 VisiblePosition ReplaceSelectionCommand::positionAtEndOfInsertedContent() const | 684 VisiblePosition ReplaceSelectionCommand::positionAtEndOfInsertedContent() const |
686 { | 685 { |
687 // FIXME: Why is this hack here? What's special about <select> tags? | 686 // FIXME: Why is this hack here? What's special about <select> tags? |
688 Node* enclosingSelect = enclosingNodeWithTag(m_endOfInsertedContent, selectT
ag); | 687 Node* enclosingSelect = enclosingNodeWithTag(m_endOfInsertedContent, selectT
ag); |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); | 1484 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
1486 | 1485 |
1487 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1486 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
1488 | 1487 |
1489 setEndingSelection(selectionAfterReplace); | 1488 setEndingSelection(selectionAfterReplace); |
1490 | 1489 |
1491 return true; | 1490 return true; |
1492 } | 1491 } |
1493 | 1492 |
1494 } // namespace WebCore | 1493 } // namespace WebCore |
OLD | NEW |