| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 DCHECK(!needsLayoutTreeUpdate(extent)); | 91 DCHECK(!needsLayoutTreeUpdate(extent)); |
| 92 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid | 92 // TODO(yosin): We should use |Builder::setBaseAndExtent()| once we get rid |
| 93 // of callers passing |base.istNull()| but |extent.isNotNull()|. | 93 // of callers passing |base.istNull()| but |extent.isNotNull()|. |
| 94 SelectionInDOMTree::Builder builder; | 94 SelectionInDOMTree::Builder builder; |
| 95 builder.setBaseAndExtentDeprecated(base, extent) | 95 builder.setBaseAndExtentDeprecated(base, extent) |
| 96 .setAffinity(affinity) | 96 .setAffinity(affinity) |
| 97 .setIsDirectional(isDirectional); | 97 .setIsDirectional(isDirectional); |
| 98 return createVisibleSelection(builder.build()); | 98 return createVisibleSelection(builder.build()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 VisibleSelection createVisibleSelection(const PositionWithAffinity& pos, | |
| 102 bool isDirectional) { | |
| 103 return createVisibleSelection(pos.position(), pos.affinity(), isDirectional); | |
| 104 } | |
| 105 | |
| 106 VisibleSelection createVisibleSelection(const VisiblePosition& base, | 101 VisibleSelection createVisibleSelection(const VisiblePosition& base, |
| 107 const VisiblePosition& extent, | 102 const VisiblePosition& extent, |
| 108 bool isDirectional) { | 103 bool isDirectional) { |
| 109 DCHECK(base.isValid()); | 104 DCHECK(base.isValid()); |
| 110 DCHECK(extent.isValid()); | 105 DCHECK(extent.isValid()); |
| 111 return createVisibleSelection(base.deepEquivalent(), extent.deepEquivalent(), | 106 return createVisibleSelection(base.deepEquivalent(), extent.deepEquivalent(), |
| 112 base.affinity(), isDirectional); | 107 base.affinity(), isDirectional); |
| 113 } | 108 } |
| 114 | 109 |
| 115 VisibleSelection createVisibleSelection(const EphemeralRange& range, | 110 VisibleSelection createVisibleSelection(const EphemeralRange& range, |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 if (!document) | 821 if (!document) |
| 827 return; | 822 return; |
| 828 DCHECK(!document->needsLayoutTreeUpdate()); | 823 DCHECK(!document->needsLayoutTreeUpdate()); |
| 829 const bool hasTrailingWhitespace = m_hasTrailingWhitespace; | 824 const bool hasTrailingWhitespace = m_hasTrailingWhitespace; |
| 830 validate(m_granularity); | 825 validate(m_granularity); |
| 831 if (!hasTrailingWhitespace) | 826 if (!hasTrailingWhitespace) |
| 832 return; | 827 return; |
| 833 appendTrailingWhitespace(); | 828 appendTrailingWhitespace(); |
| 834 } | 829 } |
| 835 | 830 |
| 836 | |
| 837 template <typename Strategy> | 831 template <typename Strategy> |
| 838 static bool equalSelectionsAlgorithm( | 832 static bool equalSelectionsAlgorithm( |
| 839 const VisibleSelectionTemplate<Strategy>& selection1, | 833 const VisibleSelectionTemplate<Strategy>& selection1, |
| 840 const VisibleSelectionTemplate<Strategy>& selection2) { | 834 const VisibleSelectionTemplate<Strategy>& selection2) { |
| 841 if (selection1.affinity() != selection2.affinity() || | 835 if (selection1.affinity() != selection2.affinity() || |
| 842 selection1.isDirectional() != selection2.isDirectional()) | 836 selection1.isDirectional() != selection2.isDirectional()) |
| 843 return false; | 837 return false; |
| 844 | 838 |
| 845 if (selection1.isNone()) | 839 if (selection1.isNone()) |
| 846 return selection2.isNone(); | 840 return selection2.isNone(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 921 |
| 928 void showTree(const blink::VisibleSelectionInFlatTree& sel) { | 922 void showTree(const blink::VisibleSelectionInFlatTree& sel) { |
| 929 sel.showTreeForThis(); | 923 sel.showTreeForThis(); |
| 930 } | 924 } |
| 931 | 925 |
| 932 void showTree(const blink::VisibleSelectionInFlatTree* sel) { | 926 void showTree(const blink::VisibleSelectionInFlatTree* sel) { |
| 933 if (sel) | 927 if (sel) |
| 934 sel->showTreeForThis(); | 928 sel->showTreeForThis(); |
| 935 } | 929 } |
| 936 #endif | 930 #endif |
| OLD | NEW |