OLD | NEW |
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 Loading... |
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& base, | |
76 const Position& extent, | |
77 TextAffinity affinity, | |
78 bool isDirectional) { | |
79 DCHECK(!needsLayoutTreeUpdate(base)); | |
80 DCHECK(!needsLayoutTreeUpdate(extent)); | |
81 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid | |
82 // of callers passing |base.istNull()| but |extent.isNotNull()|. | |
83 SelectionInDOMTree::Builder builder; | |
84 builder.setBaseAndExtentDeprecated(base, extent) | |
85 .setAffinity(affinity) | |
86 .setIsDirectional(isDirectional); | |
87 return createVisibleSelection(builder.build()); | |
88 } | |
89 | |
90 VisibleSelectionInFlatTree createVisibleSelection( | 75 VisibleSelectionInFlatTree createVisibleSelection( |
91 const SelectionInFlatTree& selection) { | 76 const SelectionInFlatTree& selection) { |
92 return VisibleSelectionInFlatTree::create(selection); | 77 return VisibleSelectionInFlatTree::create(selection); |
93 } | 78 } |
94 | 79 |
95 template <typename Strategy> | 80 template <typename Strategy> |
96 static SelectionType computeSelectionType( | 81 static SelectionType computeSelectionType( |
97 const PositionTemplate<Strategy>& start, | 82 const PositionTemplate<Strategy>& start, |
98 const PositionTemplate<Strategy>& end) { | 83 const PositionTemplate<Strategy>& end) { |
99 if (start.isNull()) { | 84 if (start.isNull()) { |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 | 834 |
850 void showTree(const blink::VisibleSelectionInFlatTree& sel) { | 835 void showTree(const blink::VisibleSelectionInFlatTree& sel) { |
851 sel.showTreeForThis(); | 836 sel.showTreeForThis(); |
852 } | 837 } |
853 | 838 |
854 void showTree(const blink::VisibleSelectionInFlatTree* sel) { | 839 void showTree(const blink::VisibleSelectionInFlatTree* sel) { |
855 if (sel) | 840 if (sel) |
856 sel->showTreeForThis(); | 841 sel->showTreeForThis(); |
857 } | 842 } |
858 #endif | 843 #endif |
OLD | NEW |