| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 static VisibleSelectionTemplate Create(const SelectionTemplate<Strategy>&); | 62 static VisibleSelectionTemplate Create(const SelectionTemplate<Strategy>&); |
| 63 | 63 |
| 64 SelectionType GetSelectionType() const { return selection_type_; } | 64 SelectionType GetSelectionType() const { return selection_type_; } |
| 65 | 65 |
| 66 TextAffinity Affinity() const { return affinity_; } | 66 TextAffinity Affinity() const { return affinity_; } |
| 67 | 67 |
| 68 SelectionTemplate<Strategy> AsSelection() const; | 68 SelectionTemplate<Strategy> AsSelection() const; |
| 69 PositionTemplate<Strategy> Base() const { return base_; } | 69 PositionTemplate<Strategy> Base() const { return base_; } |
| 70 PositionTemplate<Strategy> Extent() const { return extent_; } | 70 PositionTemplate<Strategy> Extent() const { return extent_; } |
| 71 PositionTemplate<Strategy> Start() const { return start_; } | 71 PositionTemplate<Strategy> Start() const { return start_; } |
| 72 PositionTemplate<Strategy> end() const { return end_; } | 72 PositionTemplate<Strategy> End() const { return end_; } |
| 73 | 73 |
| 74 VisiblePositionTemplate<Strategy> VisibleStart() const { | 74 VisiblePositionTemplate<Strategy> VisibleStart() const { |
| 75 return CreateVisiblePosition( | 75 return CreateVisiblePosition( |
| 76 start_, IsRange() ? TextAffinity::kDownstream : Affinity()); | 76 start_, IsRange() ? TextAffinity::kDownstream : Affinity()); |
| 77 } | 77 } |
| 78 VisiblePositionTemplate<Strategy> VisibleEnd() const { | 78 VisiblePositionTemplate<Strategy> VisibleEnd() const { |
| 79 return CreateVisiblePosition( | 79 return CreateVisiblePosition( |
| 80 end_, IsRange() ? TextAffinity::kUpstream : Affinity()); | 80 end_, IsRange() ? TextAffinity::kUpstream : Affinity()); |
| 81 } | 81 } |
| 82 VisiblePositionTemplate<Strategy> VisibleBase() const { | 82 VisiblePositionTemplate<Strategy> VisibleBase() const { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 94 | 94 |
| 95 bool operator==(const VisibleSelectionTemplate&) const; | 95 bool operator==(const VisibleSelectionTemplate&) const; |
| 96 bool operator!=(const VisibleSelectionTemplate& other) const { | 96 bool operator!=(const VisibleSelectionTemplate& other) const { |
| 97 return !operator==(other); | 97 return !operator==(other); |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool IsNone() const { return GetSelectionType() == kNoSelection; } | 100 bool IsNone() const { return GetSelectionType() == kNoSelection; } |
| 101 bool IsCaret() const { return GetSelectionType() == kCaretSelection; } | 101 bool IsCaret() const { return GetSelectionType() == kCaretSelection; } |
| 102 bool IsRange() const { return GetSelectionType() == kRangeSelection; } | 102 bool IsRange() const { return GetSelectionType() == kRangeSelection; } |
| 103 bool IsNonOrphanedRange() const { | 103 bool IsNonOrphanedRange() const { |
| 104 return IsRange() && !Start().IsOrphan() && !end().IsOrphan(); | 104 return IsRange() && !Start().IsOrphan() && !End().IsOrphan(); |
| 105 } | 105 } |
| 106 bool IsNonOrphanedCaretOrRange() const { | 106 bool IsNonOrphanedCaretOrRange() const { |
| 107 return !IsNone() && !Start().IsOrphan() && !end().IsOrphan(); | 107 return !IsNone() && !Start().IsOrphan() && !End().IsOrphan(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 // True if base() <= extent(). | 110 // True if base() <= extent(). |
| 111 bool IsBaseFirst() const { return base_is_first_; } | 111 bool IsBaseFirst() const { return base_is_first_; } |
| 112 bool IsDirectional() const { return is_directional_; } | 112 bool IsDirectional() const { return is_directional_; } |
| 113 | 113 |
| 114 void AppendTrailingWhitespace(); | 114 void AppendTrailingWhitespace(); |
| 115 | 115 |
| 116 // TODO(yosin) Most callers probably don't want these functions, but | 116 // TODO(yosin) Most callers probably don't want these functions, but |
| 117 // are using them for historical reasons. |toNormalizedEphemeralRange()| | 117 // are using them for historical reasons. |toNormalizedEphemeralRange()| |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 #ifndef NDEBUG | 205 #ifndef NDEBUG |
| 206 // Outside the WebCore namespace for ease of invocation from gdb. | 206 // Outside the WebCore namespace for ease of invocation from gdb. |
| 207 void showTree(const blink::VisibleSelection&); | 207 void showTree(const blink::VisibleSelection&); |
| 208 void showTree(const blink::VisibleSelection*); | 208 void showTree(const blink::VisibleSelection*); |
| 209 void showTree(const blink::VisibleSelectionInFlatTree&); | 209 void showTree(const blink::VisibleSelectionInFlatTree&); |
| 210 void showTree(const blink::VisibleSelectionInFlatTree*); | 210 void showTree(const blink::VisibleSelectionInFlatTree*); |
| 211 #endif | 211 #endif |
| 212 | 212 |
| 213 #endif // VisibleSelection_h | 213 #endif // VisibleSelection_h |
| OLD | NEW |