| 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 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 } else if (lastPositionToSelect.isNotNull()) { | 1554 } else if (lastPositionToSelect.isNotNull()) { |
| 1555 start = end = lastPositionToSelect; | 1555 start = end = lastPositionToSelect; |
| 1556 } else { | 1556 } else { |
| 1557 return; | 1557 return; |
| 1558 } | 1558 } |
| 1559 | 1559 |
| 1560 m_startOfInsertedRange = start; | 1560 m_startOfInsertedRange = start; |
| 1561 m_endOfInsertedRange = end; | 1561 m_endOfInsertedRange = end; |
| 1562 | 1562 |
| 1563 if (m_selectReplacement) | 1563 if (m_selectReplacement) |
| 1564 setEndingSelection(VisibleSelection(start, end, SelDefaultAffinity, endi
ngSelection().isDirectional())); | 1564 setEndingSelection(createVisibleSelectionDeprecated(start, end, SelDefau
ltAffinity, endingSelection().isDirectional())); |
| 1565 else | 1565 else |
| 1566 setEndingSelection(VisibleSelection(end, SelDefaultAffinity, endingSelec
tion().isDirectional())); | 1566 setEndingSelection(createVisibleSelectionDeprecated(end, SelDefaultAffin
ity, endingSelection().isDirectional())); |
| 1567 } | 1567 } |
| 1568 | 1568 |
| 1569 void ReplaceSelectionCommand::mergeTextNodesAroundPosition(Position& position, P
osition& positionOnlyToBeUpdated, EditingState* editingState) | 1569 void ReplaceSelectionCommand::mergeTextNodesAroundPosition(Position& position, P
osition& positionOnlyToBeUpdated, EditingState* editingState) |
| 1570 { | 1570 { |
| 1571 bool positionIsOffsetInAnchor = position.isOffsetInAnchor(); | 1571 bool positionIsOffsetInAnchor = position.isOffsetInAnchor(); |
| 1572 bool positionOnlyToBeUpdatedIsOffsetInAnchor = positionOnlyToBeUpdated.isOff
setInAnchor(); | 1572 bool positionOnlyToBeUpdatedIsOffsetInAnchor = positionOnlyToBeUpdated.isOff
setInAnchor(); |
| 1573 Text* text = nullptr; | 1573 Text* text = nullptr; |
| 1574 if (positionIsOffsetInAnchor && position.computeContainerNode() && position.
computeContainerNode()->isTextNode()) { | 1574 if (positionIsOffsetInAnchor && position.computeContainerNode() && position.
computeContainerNode()->isTextNode()) { |
| 1575 text = toText(position.computeContainerNode()); | 1575 text = toText(position.computeContainerNode()); |
| 1576 } else { | 1576 } else { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 if (nodeAfterInsertionPos && nodeAfterInsertionPos->parentNode() && isHTMLBR
Element(*nodeAfterInsertionPos) | 1731 if (nodeAfterInsertionPos && nodeAfterInsertionPos->parentNode() && isHTMLBR
Element(*nodeAfterInsertionPos) |
| 1732 && shouldRemoveEndBR(toHTMLBRElement(nodeAfterInsertionPos), VisiblePosi
tion::beforeNode(nodeAfterInsertionPos))) { | 1732 && shouldRemoveEndBR(toHTMLBRElement(nodeAfterInsertionPos), VisiblePosi
tion::beforeNode(nodeAfterInsertionPos))) { |
| 1733 removeNodeAndPruneAncestors(nodeAfterInsertionPos, editingState); | 1733 removeNodeAndPruneAncestors(nodeAfterInsertionPos, editingState); |
| 1734 if (editingState->isAborted()) | 1734 if (editingState->isAborted()) |
| 1735 return false; | 1735 return false; |
| 1736 } | 1736 } |
| 1737 | 1737 |
| 1738 m_startOfInsertedRange = start; | 1738 m_startOfInsertedRange = start; |
| 1739 m_endOfInsertedRange = end; | 1739 m_endOfInsertedRange = end; |
| 1740 | 1740 |
| 1741 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1741 VisibleSelection selectionAfterReplace = createVisibleSelectionDeprecated(m_
selectReplacement ? start : end, end); |
| 1742 | 1742 |
| 1743 setEndingSelection(selectionAfterReplace); | 1743 setEndingSelection(selectionAfterReplace); |
| 1744 | 1744 |
| 1745 return true; | 1745 return true; |
| 1746 } | 1746 } |
| 1747 | 1747 |
| 1748 bool ReplaceSelectionCommand::isReplaceSelectionCommand() const | 1748 bool ReplaceSelectionCommand::isReplaceSelectionCommand() const |
| 1749 { | 1749 { |
| 1750 return true; | 1750 return true; |
| 1751 } | 1751 } |
| 1752 | 1752 |
| 1753 EphemeralRange ReplaceSelectionCommand::insertedRange() const | 1753 EphemeralRange ReplaceSelectionCommand::insertedRange() const |
| 1754 { | 1754 { |
| 1755 return EphemeralRange(m_startOfInsertedRange, m_endOfInsertedRange); | 1755 return EphemeralRange(m_startOfInsertedRange, m_endOfInsertedRange); |
| 1756 } | 1756 } |
| 1757 | 1757 |
| 1758 DEFINE_TRACE(ReplaceSelectionCommand) | 1758 DEFINE_TRACE(ReplaceSelectionCommand) |
| 1759 { | 1759 { |
| 1760 visitor->trace(m_startOfInsertedContent); | 1760 visitor->trace(m_startOfInsertedContent); |
| 1761 visitor->trace(m_endOfInsertedContent); | 1761 visitor->trace(m_endOfInsertedContent); |
| 1762 visitor->trace(m_insertionStyle); | 1762 visitor->trace(m_insertionStyle); |
| 1763 visitor->trace(m_documentFragment); | 1763 visitor->trace(m_documentFragment); |
| 1764 visitor->trace(m_startOfInsertedRange); | 1764 visitor->trace(m_startOfInsertedRange); |
| 1765 visitor->trace(m_endOfInsertedRange); | 1765 visitor->trace(m_endOfInsertedRange); |
| 1766 CompositeEditCommand::trace(visitor); | 1766 CompositeEditCommand::trace(visitor); |
| 1767 } | 1767 } |
| 1768 | 1768 |
| 1769 } // namespace blink | 1769 } // namespace blink |
| OLD | NEW |