| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 DISALLOW_NEW(); | 59 DISALLOW_NEW(); |
| 60 public: | 60 public: |
| 61 | 61 |
| 62 PositionTemplate() | 62 PositionTemplate() |
| 63 : m_offset(0) | 63 : m_offset(0) |
| 64 , m_anchorType(PositionAnchorType::OffsetInAnchor) | 64 , m_anchorType(PositionAnchorType::OffsetInAnchor) |
| 65 { | 65 { |
| 66 } | 66 } |
| 67 | 67 |
| 68 static const TreeScope* commonAncestorTreeScope(const PositionTemplate<Strat
egy>&, const PositionTemplate<Strategy>& b); | 68 static const TreeScope* commonAncestorTreeScope(const PositionTemplate<Strat
egy>&, const PositionTemplate<Strategy>& b); |
| 69 static PositionTemplate<Strategy> editingPositionOf(PassRefPtrWillBeRawPtr<N
ode> anchorNode, int offset); | 69 static PositionTemplate<Strategy> editingPositionOf(RawPtr<Node> anchorNode,
int offset); |
| 70 | 70 |
| 71 // For creating before/after positions: | 71 // For creating before/after positions: |
| 72 PositionTemplate(PassRefPtrWillBeRawPtr<Node> anchorNode, PositionAnchorType
); | 72 PositionTemplate(RawPtr<Node> anchorNode, PositionAnchorType); |
| 73 | 73 |
| 74 // For creating offset positions: | 74 // For creating offset positions: |
| 75 // FIXME: This constructor should eventually go away. See bug 63040. | 75 // FIXME: This constructor should eventually go away. See bug 63040. |
| 76 PositionTemplate(PassRefPtrWillBeRawPtr<Node> anchorNode, int offset); | 76 PositionTemplate(RawPtr<Node> anchorNode, int offset); |
| 77 | 77 |
| 78 PositionTemplate(const PositionTemplate&); | 78 PositionTemplate(const PositionTemplate&); |
| 79 | 79 |
| 80 PositionAnchorType anchorType() const { return m_anchorType; } | 80 PositionAnchorType anchorType() const { return m_anchorType; } |
| 81 bool isAfterAnchor() const { return m_anchorType == PositionAnchorType::Afte
rAnchor; } | 81 bool isAfterAnchor() const { return m_anchorType == PositionAnchorType::Afte
rAnchor; } |
| 82 bool isAfterChildren() const { return m_anchorType == PositionAnchorType::Af
terChildren; } | 82 bool isAfterChildren() const { return m_anchorType == PositionAnchorType::Af
terChildren; } |
| 83 bool isBeforeAnchor() const { return m_anchorType == PositionAnchorType::Bef
oreAnchor; } | 83 bool isBeforeAnchor() const { return m_anchorType == PositionAnchorType::Bef
oreAnchor; } |
| 84 bool isBeforeChildren() const { return m_anchorType == PositionAnchorType::B
eforeChildren; } | 84 bool isBeforeChildren() const { return m_anchorType == PositionAnchorType::B
eforeChildren; } |
| 85 bool isOffsetInAnchor() const { return m_anchorType == PositionAnchorType::O
ffsetInAnchor; } | 85 bool isOffsetInAnchor() const { return m_anchorType == PositionAnchorType::O
ffsetInAnchor; } |
| 86 | 86 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 { | 179 { |
| 180 visitor->trace(m_anchorNode); | 180 visitor->trace(m_anchorNode); |
| 181 } | 181 } |
| 182 | 182 |
| 183 private: | 183 private: |
| 184 bool isAfterAnchorOrAfterChildren() const | 184 bool isAfterAnchorOrAfterChildren() const |
| 185 { | 185 { |
| 186 return isAfterAnchor() || isAfterChildren(); | 186 return isAfterAnchor() || isAfterChildren(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 RefPtrWillBeMember<Node> m_anchorNode; | 189 Member<Node> m_anchorNode; |
| 190 // m_offset can be the offset inside m_anchorNode, or if editingIgnoresConte
nt(m_anchorNode) | 190 // m_offset can be the offset inside m_anchorNode, or if editingIgnoresConte
nt(m_anchorNode) |
| 191 // returns true, then other places in editing will treat m_offset == 0 as "b
efore the anchor" | 191 // returns true, then other places in editing will treat m_offset == 0 as "b
efore the anchor" |
| 192 // and m_offset > 0 as "after the anchor node". See parentAnchoredEquivalen
t for more info. | 192 // and m_offset > 0 as "after the anchor node". See parentAnchoredEquivalen
t for more info. |
| 193 int m_offset; | 193 int m_offset; |
| 194 PositionAnchorType m_anchorType; | 194 PositionAnchorType m_anchorType; |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionTemplate<EditingStrate
gy>; | 197 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionTemplate<EditingStrate
gy>; |
| 198 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionTemplate<EditingInFlat
TreeStrategy>; | 198 extern template class CORE_EXTERN_TEMPLATE_EXPORT PositionTemplate<EditingInFlat
TreeStrategy>; |
| 199 | 199 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 } // namespace blink | 399 } // namespace blink |
| 400 | 400 |
| 401 #ifndef NDEBUG | 401 #ifndef NDEBUG |
| 402 // Outside the WebCore namespace for ease of invocation from gdb. | 402 // Outside the WebCore namespace for ease of invocation from gdb. |
| 403 void showTree(const blink::Position&); | 403 void showTree(const blink::Position&); |
| 404 void showTree(const blink::Position*); | 404 void showTree(const blink::Position*); |
| 405 #endif | 405 #endif |
| 406 | 406 |
| 407 #endif // Position_h | 407 #endif // Position_h |
| OLD | NEW |