| 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 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1854 return; | 1854 return; |
| 1855 } | 1855 } |
| 1856 | 1856 |
| 1857 m_startOfInsertedRange = start; | 1857 m_startOfInsertedRange = start; |
| 1858 m_endOfInsertedRange = end; | 1858 m_endOfInsertedRange = end; |
| 1859 | 1859 |
| 1860 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 1860 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1861 | 1861 |
| 1862 if (m_selectReplacement) { | 1862 if (m_selectReplacement) { |
| 1863 setEndingSelection(createVisibleSelection( | 1863 setEndingSelection(createVisibleSelection( |
| 1864 start, end, SelDefaultAffinity, endingSelection().isDirectional())); | 1864 SelectionInDOMTree::Builder() |
| 1865 .setBaseAndExtentDeprecated(start, end) |
| 1866 .setIsDirectional(endingSelection().isDirectional()) |
| 1867 .build())); |
| 1865 return; | 1868 return; |
| 1866 } | 1869 } |
| 1867 | 1870 |
| 1868 if (end.isNotNull()) { | 1871 if (end.isNotNull()) { |
| 1869 setEndingSelection(createVisibleSelection( | 1872 setEndingSelection(createVisibleSelection( |
| 1870 SelectionInDOMTree::Builder() | 1873 SelectionInDOMTree::Builder() |
| 1871 .collapse(end) | 1874 .collapse(end) |
| 1872 .setIsDirectional(endingSelection().isDirectional()) | 1875 .setIsDirectional(endingSelection().isDirectional()) |
| 1873 .build())); | 1876 .build())); |
| 1874 return; | 1877 return; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 VisiblePosition::beforeNode(nodeAfterInsertionPos))) { | 2078 VisiblePosition::beforeNode(nodeAfterInsertionPos))) { |
| 2076 removeNodeAndPruneAncestors(nodeAfterInsertionPos, editingState); | 2079 removeNodeAndPruneAncestors(nodeAfterInsertionPos, editingState); |
| 2077 if (editingState->isAborted()) | 2080 if (editingState->isAborted()) |
| 2078 return false; | 2081 return false; |
| 2079 } | 2082 } |
| 2080 | 2083 |
| 2081 m_startOfInsertedRange = start; | 2084 m_startOfInsertedRange = start; |
| 2082 m_endOfInsertedRange = end; | 2085 m_endOfInsertedRange = end; |
| 2083 | 2086 |
| 2084 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 2087 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 2085 VisibleSelection selectionAfterReplace = | 2088 VisibleSelection selectionAfterReplace = createVisibleSelection( |
| 2086 createVisibleSelection(m_selectReplacement ? start : end, end); | 2089 SelectionInDOMTree::Builder() |
| 2090 .setBaseAndExtentDeprecated(m_selectReplacement ? start : end, end) |
| 2091 .build()); |
| 2087 | 2092 |
| 2088 setEndingSelection(selectionAfterReplace); | 2093 setEndingSelection(selectionAfterReplace); |
| 2089 | 2094 |
| 2090 return true; | 2095 return true; |
| 2091 } | 2096 } |
| 2092 | 2097 |
| 2093 bool ReplaceSelectionCommand::isReplaceSelectionCommand() const { | 2098 bool ReplaceSelectionCommand::isReplaceSelectionCommand() const { |
| 2094 return true; | 2099 return true; |
| 2095 } | 2100 } |
| 2096 | 2101 |
| 2097 EphemeralRange ReplaceSelectionCommand::insertedRange() const { | 2102 EphemeralRange ReplaceSelectionCommand::insertedRange() const { |
| 2098 return EphemeralRange(m_startOfInsertedRange, m_endOfInsertedRange); | 2103 return EphemeralRange(m_startOfInsertedRange, m_endOfInsertedRange); |
| 2099 } | 2104 } |
| 2100 | 2105 |
| 2101 DEFINE_TRACE(ReplaceSelectionCommand) { | 2106 DEFINE_TRACE(ReplaceSelectionCommand) { |
| 2102 visitor->trace(m_startOfInsertedContent); | 2107 visitor->trace(m_startOfInsertedContent); |
| 2103 visitor->trace(m_endOfInsertedContent); | 2108 visitor->trace(m_endOfInsertedContent); |
| 2104 visitor->trace(m_insertionStyle); | 2109 visitor->trace(m_insertionStyle); |
| 2105 visitor->trace(m_documentFragment); | 2110 visitor->trace(m_documentFragment); |
| 2106 visitor->trace(m_startOfInsertedRange); | 2111 visitor->trace(m_startOfInsertedRange); |
| 2107 visitor->trace(m_endOfInsertedRange); | 2112 visitor->trace(m_endOfInsertedRange); |
| 2108 CompositeEditCommand::trace(visitor); | 2113 CompositeEditCommand::trace(visitor); |
| 2109 } | 2114 } |
| 2110 | 2115 |
| 2111 } // namespace blink | 2116 } // namespace blink |
| OLD | NEW |