| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 : TextAffinity::Downstream) | 98 : TextAffinity::Downstream) |
| 99 : affinity()); | 99 : affinity()); |
| 100 } | 100 } |
| 101 VisiblePositionTemplate<Strategy> visibleExtent() const { | 101 VisiblePositionTemplate<Strategy> visibleExtent() const { |
| 102 return createVisiblePosition( | 102 return createVisiblePosition( |
| 103 m_extent, isRange() ? (isBaseFirst() ? TextAffinity::Downstream | 103 m_extent, isRange() ? (isBaseFirst() ? TextAffinity::Downstream |
| 104 : TextAffinity::Upstream) | 104 : TextAffinity::Upstream) |
| 105 : affinity()); | 105 : affinity()); |
| 106 } | 106 } |
| 107 | 107 |
| 108 // These deprecated functions perform synchronous layout, messing up the | |
| 109 // pipeline. Callers should ensure clean layout and then switch to the | |
| 110 // un-deprecated functions above. | |
| 111 VisiblePositionTemplate<Strategy> visibleStartDeprecated() const { | |
| 112 return createVisiblePositionDeprecated( | |
| 113 m_start, isRange() ? TextAffinity::Downstream : affinity()); | |
| 114 } | |
| 115 VisiblePositionTemplate<Strategy> visibleEndDeprecated() const { | |
| 116 return createVisiblePositionDeprecated( | |
| 117 m_end, isRange() ? TextAffinity::Upstream : affinity()); | |
| 118 } | |
| 119 | |
| 120 bool operator==(const VisibleSelectionTemplate&) const; | 108 bool operator==(const VisibleSelectionTemplate&) const; |
| 121 bool operator!=(const VisibleSelectionTemplate& other) const { | 109 bool operator!=(const VisibleSelectionTemplate& other) const { |
| 122 return !operator==(other); | 110 return !operator==(other); |
| 123 } | 111 } |
| 124 | 112 |
| 125 bool isNone() const { return getSelectionType() == NoSelection; } | 113 bool isNone() const { return getSelectionType() == NoSelection; } |
| 126 bool isCaret() const { return getSelectionType() == CaretSelection; } | 114 bool isCaret() const { return getSelectionType() == CaretSelection; } |
| 127 bool isRange() const { return getSelectionType() == RangeSelection; } | 115 bool isRange() const { return getSelectionType() == RangeSelection; } |
| 128 bool isNonOrphanedRange() const { | 116 bool isNonOrphanedRange() const { |
| 129 return isRange() && !start().isOrphan() && !end().isOrphan(); | 117 return isRange() && !start().isOrphan() && !end().isOrphan(); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 createVisibleSelection(const VisiblePositionInFlatTree&, | 254 createVisibleSelection(const VisiblePositionInFlatTree&, |
| 267 bool isDirectional = false); | 255 bool isDirectional = false); |
| 268 CORE_EXPORT VisibleSelectionInFlatTree | 256 CORE_EXPORT VisibleSelectionInFlatTree |
| 269 createVisibleSelection(const VisiblePositionInFlatTree&, | 257 createVisibleSelection(const VisiblePositionInFlatTree&, |
| 270 const VisiblePositionInFlatTree&, | 258 const VisiblePositionInFlatTree&, |
| 271 bool isDirectional = false); | 259 bool isDirectional = false); |
| 272 CORE_EXPORT VisibleSelectionInFlatTree | 260 CORE_EXPORT VisibleSelectionInFlatTree |
| 273 createVisibleSelection(const PositionInFlatTreeWithAffinity&, | 261 createVisibleSelection(const PositionInFlatTreeWithAffinity&, |
| 274 bool isDirectional = false); | 262 bool isDirectional = false); |
| 275 | 263 |
| 276 // Callers of these functions should ensure clean layout by themselves and then | |
| 277 // switch to the proper versions (to be introduced). | |
| 278 CORE_EXPORT VisibleSelection | |
| 279 createVisibleSelectionDeprecated(const Position&, | |
| 280 TextAffinity, | |
| 281 bool isDirectional = false); | |
| 282 CORE_EXPORT VisibleSelection | |
| 283 createVisibleSelectionDeprecated(const Position& base, | |
| 284 const Position& extent, | |
| 285 TextAffinity = SelDefaultAffinity, | |
| 286 bool isDirectional = false); | |
| 287 CORE_EXPORT VisibleSelection | |
| 288 createVisibleSelectionDeprecated(const EphemeralRange&, | |
| 289 TextAffinity = SelDefaultAffinity, | |
| 290 bool isDirectional = false); | |
| 291 CORE_EXPORT VisibleSelection | |
| 292 createVisibleSelectionDeprecated(const VisiblePosition&, | |
| 293 bool isDirectional = false); | |
| 294 CORE_EXPORT VisibleSelection | |
| 295 createVisibleSelectionDeprecated(const VisiblePosition&, | |
| 296 const VisiblePosition&, | |
| 297 bool isDirectional = false); | |
| 298 CORE_EXPORT VisibleSelection | |
| 299 createVisibleSelectionDeprecated(const PositionWithAffinity&, | |
| 300 bool isDirectional = false); | |
| 301 | |
| 302 CORE_EXPORT VisibleSelectionInFlatTree | |
| 303 createVisibleSelectionDeprecated(const PositionInFlatTree&, | |
| 304 TextAffinity, | |
| 305 bool isDirectional = false); | |
| 306 CORE_EXPORT VisibleSelectionInFlatTree | |
| 307 createVisibleSelectionDeprecated(const PositionInFlatTree& base, | |
| 308 const PositionInFlatTree& extent, | |
| 309 TextAffinity = SelDefaultAffinity, | |
| 310 bool isDirectional = false); | |
| 311 CORE_EXPORT VisibleSelectionInFlatTree | |
| 312 createVisibleSelectionDeprecated(const EphemeralRangeInFlatTree&, | |
| 313 TextAffinity = SelDefaultAffinity, | |
| 314 bool isDirectional = false); | |
| 315 CORE_EXPORT VisibleSelectionInFlatTree | |
| 316 createVisibleSelectionDeprecated(const VisiblePositionInFlatTree&, | |
| 317 bool isDirectional = false); | |
| 318 CORE_EXPORT VisibleSelectionInFlatTree | |
| 319 createVisibleSelectionDeprecated(const VisiblePositionInFlatTree&, | |
| 320 const VisiblePositionInFlatTree&, | |
| 321 bool isDirectional = false); | |
| 322 CORE_EXPORT VisibleSelectionInFlatTree | |
| 323 createVisibleSelectionDeprecated(const PositionInFlatTreeWithAffinity&, | |
| 324 bool isDirectional = false); | |
| 325 | |
| 326 // We don't yet support multi-range selections, so we only ever have one range | 264 // We don't yet support multi-range selections, so we only ever have one range |
| 327 // to return. | 265 // to return. |
| 328 CORE_EXPORT EphemeralRange firstEphemeralRangeOf(const VisibleSelection&); | 266 CORE_EXPORT EphemeralRange firstEphemeralRangeOf(const VisibleSelection&); |
| 329 | 267 |
| 330 // TODO(sof): move more firstRangeOf() uses to be over EphemeralRange instead. | 268 // TODO(sof): move more firstRangeOf() uses to be over EphemeralRange instead. |
| 331 CORE_EXPORT Range* firstRangeOf(const VisibleSelection&); | 269 CORE_EXPORT Range* firstRangeOf(const VisibleSelection&); |
| 332 | 270 |
| 333 CORE_EXPORT std::ostream& operator<<(std::ostream&, const VisibleSelection&); | 271 CORE_EXPORT std::ostream& operator<<(std::ostream&, const VisibleSelection&); |
| 334 CORE_EXPORT std::ostream& operator<<(std::ostream&, | 272 CORE_EXPORT std::ostream& operator<<(std::ostream&, |
| 335 const VisibleSelectionInFlatTree&); | 273 const VisibleSelectionInFlatTree&); |
| 336 | 274 |
| 337 } // namespace blink | 275 } // namespace blink |
| 338 | 276 |
| 339 #ifndef NDEBUG | 277 #ifndef NDEBUG |
| 340 // Outside the WebCore namespace for ease of invocation from gdb. | 278 // Outside the WebCore namespace for ease of invocation from gdb. |
| 341 void showTree(const blink::VisibleSelection&); | 279 void showTree(const blink::VisibleSelection&); |
| 342 void showTree(const blink::VisibleSelection*); | 280 void showTree(const blink::VisibleSelection*); |
| 343 void showTree(const blink::VisibleSelectionInFlatTree&); | 281 void showTree(const blink::VisibleSelectionInFlatTree&); |
| 344 void showTree(const blink::VisibleSelectionInFlatTree*); | 282 void showTree(const blink::VisibleSelectionInFlatTree*); |
| 345 #endif | 283 #endif |
| 346 | 284 |
| 347 #endif // VisibleSelection_h | 285 #endif // VisibleSelection_h |
| OLD | NEW |