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

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleSelection.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) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 template <typename Strategy> 65 template <typename Strategy>
66 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::create( 66 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::create(
67 const SelectionTemplate<Strategy>& selection) { 67 const SelectionTemplate<Strategy>& selection) {
68 return VisibleSelectionTemplate(selection); 68 return VisibleSelectionTemplate(selection);
69 } 69 }
70 70
71 VisibleSelection createVisibleSelection(const SelectionInDOMTree& selection) { 71 VisibleSelection createVisibleSelection(const SelectionInDOMTree& selection) {
72 return VisibleSelection::create(selection); 72 return VisibleSelection::create(selection);
73 } 73 }
74 74
75 VisibleSelection createVisibleSelection(const Position& pos,
76 TextAffinity affinity,
77 bool isDirectional) {
78 DCHECK(!needsLayoutTreeUpdate(pos));
79 SelectionInDOMTree::Builder builder;
80 builder.setAffinity(affinity).setIsDirectional(isDirectional);
81 if (pos.isNotNull())
82 builder.collapse(pos);
83 return createVisibleSelection(builder.build());
84 }
85
86 VisibleSelection createVisibleSelection(const Position& base, 75 VisibleSelection createVisibleSelection(const Position& base,
87 const Position& extent, 76 const Position& extent,
88 TextAffinity affinity, 77 TextAffinity affinity,
89 bool isDirectional) { 78 bool isDirectional) {
90 DCHECK(!needsLayoutTreeUpdate(base)); 79 DCHECK(!needsLayoutTreeUpdate(base));
91 DCHECK(!needsLayoutTreeUpdate(extent)); 80 DCHECK(!needsLayoutTreeUpdate(extent));
92 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid 81 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid
93 // of callers passing |base.istNull()| but |extent.isNotNull()|. 82 // of callers passing |base.istNull()| but |extent.isNotNull()|.
94 SelectionInDOMTree::Builder builder; 83 SelectionInDOMTree::Builder builder;
95 builder.setBaseAndExtentDeprecated(base, extent) 84 builder.setBaseAndExtentDeprecated(base, extent)
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 858
870 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 859 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
871 sel.showTreeForThis(); 860 sel.showTreeForThis();
872 } 861 }
873 862
874 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 863 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
875 if (sel) 864 if (sel)
876 sel->showTreeForThis(); 865 sel->showTreeForThis();
877 } 866 }
878 #endif 867 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698