| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 VisibleSelection createVisibleSelection(const VisiblePosition& base, | 106 VisibleSelection createVisibleSelection(const VisiblePosition& base, |
| 107 const VisiblePosition& extent, | 107 const VisiblePosition& extent, |
| 108 bool isDirectional) { | 108 bool isDirectional) { |
| 109 DCHECK(base.isValid()); | 109 DCHECK(base.isValid()); |
| 110 DCHECK(extent.isValid()); | 110 DCHECK(extent.isValid()); |
| 111 return createVisibleSelection(base.deepEquivalent(), extent.deepEquivalent(), | 111 return createVisibleSelection(base.deepEquivalent(), extent.deepEquivalent(), |
| 112 base.affinity(), isDirectional); | 112 base.affinity(), isDirectional); |
| 113 } | 113 } |
| 114 | 114 |
| 115 VisibleSelection createVisibleSelection(const EphemeralRange& range, | |
| 116 TextAffinity affinity, | |
| 117 bool isDirectional) { | |
| 118 DCHECK(!needsLayoutTreeUpdate(range.startPosition())); | |
| 119 DCHECK(!needsLayoutTreeUpdate(range.endPosition())); | |
| 120 SelectionInDOMTree::Builder builder; | |
| 121 builder.setBaseAndExtent(range).setAffinity(affinity).setIsDirectional( | |
| 122 isDirectional); | |
| 123 return createVisibleSelection(builder.build()); | |
| 124 } | |
| 125 | |
| 126 VisibleSelectionInFlatTree createVisibleSelection( | 115 VisibleSelectionInFlatTree createVisibleSelection( |
| 127 const SelectionInFlatTree& selection) { | 116 const SelectionInFlatTree& selection) { |
| 128 return VisibleSelectionInFlatTree::create(selection); | 117 return VisibleSelectionInFlatTree::create(selection); |
| 129 } | 118 } |
| 130 | 119 |
| 131 VisibleSelectionInFlatTree createVisibleSelection( | 120 VisibleSelectionInFlatTree createVisibleSelection( |
| 132 const PositionInFlatTree& base, | 121 const PositionInFlatTree& base, |
| 133 const PositionInFlatTree& extent, | 122 const PositionInFlatTree& extent, |
| 134 TextAffinity affinity, | 123 TextAffinity affinity, |
| 135 bool isDirectional) { | 124 bool isDirectional) { |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 if (!document) | 815 if (!document) |
| 827 return; | 816 return; |
| 828 DCHECK(!document->needsLayoutTreeUpdate()); | 817 DCHECK(!document->needsLayoutTreeUpdate()); |
| 829 const bool hasTrailingWhitespace = m_hasTrailingWhitespace; | 818 const bool hasTrailingWhitespace = m_hasTrailingWhitespace; |
| 830 validate(m_granularity); | 819 validate(m_granularity); |
| 831 if (!hasTrailingWhitespace) | 820 if (!hasTrailingWhitespace) |
| 832 return; | 821 return; |
| 833 appendTrailingWhitespace(); | 822 appendTrailingWhitespace(); |
| 834 } | 823 } |
| 835 | 824 |
| 836 | |
| 837 template <typename Strategy> | 825 template <typename Strategy> |
| 838 static bool equalSelectionsAlgorithm( | 826 static bool equalSelectionsAlgorithm( |
| 839 const VisibleSelectionTemplate<Strategy>& selection1, | 827 const VisibleSelectionTemplate<Strategy>& selection1, |
| 840 const VisibleSelectionTemplate<Strategy>& selection2) { | 828 const VisibleSelectionTemplate<Strategy>& selection2) { |
| 841 if (selection1.affinity() != selection2.affinity() || | 829 if (selection1.affinity() != selection2.affinity() || |
| 842 selection1.isDirectional() != selection2.isDirectional()) | 830 selection1.isDirectional() != selection2.isDirectional()) |
| 843 return false; | 831 return false; |
| 844 | 832 |
| 845 if (selection1.isNone()) | 833 if (selection1.isNone()) |
| 846 return selection2.isNone(); | 834 return selection2.isNone(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 915 |
| 928 void showTree(const blink::VisibleSelectionInFlatTree& sel) { | 916 void showTree(const blink::VisibleSelectionInFlatTree& sel) { |
| 929 sel.showTreeForThis(); | 917 sel.showTreeForThis(); |
| 930 } | 918 } |
| 931 | 919 |
| 932 void showTree(const blink::VisibleSelectionInFlatTree* sel) { | 920 void showTree(const blink::VisibleSelectionInFlatTree* sel) { |
| 933 if (sel) | 921 if (sel) |
| 934 sel->showTreeForThis(); | 922 sel->showTreeForThis(); |
| 935 } | 923 } |
| 936 #endif | 924 #endif |
| OLD | NEW |