| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 DISALLOW_ALLOCATION(); | 81 DISALLOW_ALLOCATION(); |
| 82 public: | 82 public: |
| 83 | 83 |
| 84 PositionAlgorithm() | 84 PositionAlgorithm() |
| 85 : m_offset(0) | 85 : m_offset(0) |
| 86 , m_anchorType(PositionAnchorType::OffsetInAnchor) | 86 , m_anchorType(PositionAnchorType::OffsetInAnchor) |
| 87 { | 87 { |
| 88 } | 88 } |
| 89 | 89 |
| 90 static const TreeScope* commonAncestorTreeScope(const PositionAlgorithm<Stra
tegy>&, const PositionAlgorithm<Strategy>& b); | 90 static const TreeScope* commonAncestorTreeScope(const PositionAlgorithm<Stra
tegy>&, const PositionAlgorithm<Strategy>& b); |
| 91 static PositionAlgorithm<Strategy> createLegacyEditingPosition(PassRefPtrWil
lBeRawPtr<Node> anchorNode, int offset); | 91 static PositionAlgorithm<Strategy> editingPositionOf(PassRefPtrWillBeRawPtr<
Node> anchorNode, int offset); |
| 92 | 92 |
| 93 // For creating before/after positions: | 93 // For creating before/after positions: |
| 94 PositionAlgorithm(PassRefPtrWillBeRawPtr<Node> anchorNode, PositionAnchorTyp
e); | 94 PositionAlgorithm(PassRefPtrWillBeRawPtr<Node> anchorNode, PositionAnchorTyp
e); |
| 95 | 95 |
| 96 // For creating offset positions: | 96 // For creating offset positions: |
| 97 // FIXME: This constructor should eventually go away. See bug 63040. | 97 // FIXME: This constructor should eventually go away. See bug 63040. |
| 98 PositionAlgorithm(PassRefPtrWillBeRawPtr<Node> anchorNode, int offset); | 98 PositionAlgorithm(PassRefPtrWillBeRawPtr<Node> anchorNode, int offset); |
| 99 | 99 |
| 100 PositionAlgorithm(const PositionAlgorithm&); | 100 PositionAlgorithm(const PositionAlgorithm&); |
| 101 | 101 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 int m_offset; | 251 int m_offset; |
| 252 PositionAnchorType m_anchorType; | 252 PositionAnchorType m_anchorType; |
| 253 }; | 253 }; |
| 254 | 254 |
| 255 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingStrat
egy>; | 255 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingStrat
egy>; |
| 256 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingInCom
posedTreeStrategy>; | 256 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionAlgorithm<EditingInCom
posedTreeStrategy>; |
| 257 | 257 |
| 258 using Position = PositionAlgorithm<EditingStrategy>; | 258 using Position = PositionAlgorithm<EditingStrategy>; |
| 259 using PositionInComposedTree = PositionAlgorithm<EditingInComposedTreeStrategy>; | 259 using PositionInComposedTree = PositionAlgorithm<EditingInComposedTreeStrategy>; |
| 260 | 260 |
| 261 inline Position createLegacyEditingPosition(PassRefPtrWillBeRawPtr<Node> node, i
nt offset) | |
| 262 { | |
| 263 return Position::createLegacyEditingPosition(node, offset); | |
| 264 } | |
| 265 | |
| 266 template <typename Strategy> | 261 template <typename Strategy> |
| 267 bool operator==(const PositionAlgorithm<Strategy>& a, const PositionAlgorithm<St
rategy>& b) | 262 bool operator==(const PositionAlgorithm<Strategy>& a, const PositionAlgorithm<St
rategy>& b) |
| 268 { | 263 { |
| 269 if (a.isNull()) | 264 if (a.isNull()) |
| 270 return b.isNull(); | 265 return b.isNull(); |
| 271 | 266 |
| 272 if (a.anchorNode() != b.anchorNode() || a.anchorType() != b.anchorType()) | 267 if (a.anchorNode() != b.anchorNode() || a.anchorType() != b.anchorType()) |
| 273 return false; | 268 return false; |
| 274 | 269 |
| 275 if (!a.isOffsetInAnchor()) { | 270 if (!a.isOffsetInAnchor()) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 450 |
| 456 } // namespace blink | 451 } // namespace blink |
| 457 | 452 |
| 458 #ifndef NDEBUG | 453 #ifndef NDEBUG |
| 459 // Outside the WebCore namespace for ease of invocation from gdb. | 454 // Outside the WebCore namespace for ease of invocation from gdb. |
| 460 void showTree(const blink::Position&); | 455 void showTree(const blink::Position&); |
| 461 void showTree(const blink::Position*); | 456 void showTree(const blink::Position*); |
| 462 #endif | 457 #endif |
| 463 | 458 |
| 464 #endif // Position_h | 459 #endif // Position_h |
| OLD | NEW |