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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp

Issue 2442673002: Get rid of createVisibleSelection() taking one Position (Closed)
Patch Set: 2016-10-24T17:42:38 Created 4 years, 1 month 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
OLDNEW
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 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 start = end = lastPositionToSelect; 1852 start = end = lastPositionToSelect;
1853 } else { 1853 } else {
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 start, end, SelDefaultAffinity, endingSelection().isDirectional()));
1865 else 1865 return;
1866 }
1867
1868 if (end.isNotNull()) {
1866 setEndingSelection(createVisibleSelection( 1869 setEndingSelection(createVisibleSelection(
1867 end, SelDefaultAffinity, endingSelection().isDirectional())); 1870 SelectionInDOMTree::Builder()
1871 .collapse(end)
1872 .setIsDirectional(endingSelection().isDirectional())
1873 .build()));
1874 return;
1875 }
1876 setEndingSelection(createVisibleSelection(SelectionInDOMTree()));
1868 } 1877 }
1869 1878
1870 void ReplaceSelectionCommand::mergeTextNodesAroundPosition( 1879 void ReplaceSelectionCommand::mergeTextNodesAroundPosition(
1871 Position& position, 1880 Position& position,
1872 Position& positionOnlyToBeUpdated, 1881 Position& positionOnlyToBeUpdated,
1873 EditingState* editingState) { 1882 EditingState* editingState) {
1874 bool positionIsOffsetInAnchor = position.isOffsetInAnchor(); 1883 bool positionIsOffsetInAnchor = position.isOffsetInAnchor();
1875 bool positionOnlyToBeUpdatedIsOffsetInAnchor = 1884 bool positionOnlyToBeUpdatedIsOffsetInAnchor =
1876 positionOnlyToBeUpdated.isOffsetInAnchor(); 1885 positionOnlyToBeUpdated.isOffsetInAnchor();
1877 Text* text = nullptr; 1886 Text* text = nullptr;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 visitor->trace(m_startOfInsertedContent); 2102 visitor->trace(m_startOfInsertedContent);
2094 visitor->trace(m_endOfInsertedContent); 2103 visitor->trace(m_endOfInsertedContent);
2095 visitor->trace(m_insertionStyle); 2104 visitor->trace(m_insertionStyle);
2096 visitor->trace(m_documentFragment); 2105 visitor->trace(m_documentFragment);
2097 visitor->trace(m_startOfInsertedRange); 2106 visitor->trace(m_startOfInsertedRange);
2098 visitor->trace(m_endOfInsertedRange); 2107 visitor->trace(m_endOfInsertedRange);
2099 CompositeEditCommand::trace(visitor); 2108 CompositeEditCommand::trace(visitor);
2100 } 2109 }
2101 2110
2102 } // namespace blink 2111 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698