| 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& 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 Loading... |
| 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 |
| OLD | NEW |