| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 static const TreeScope* CommonAncestorTreeScope( | 63 static const TreeScope* CommonAncestorTreeScope( |
| 64 const PositionTemplate<Strategy>&, | 64 const PositionTemplate<Strategy>&, |
| 65 const PositionTemplate<Strategy>& b); | 65 const PositionTemplate<Strategy>& b); |
| 66 static PositionTemplate<Strategy> EditingPositionOf(Node* anchor_node, | 66 static PositionTemplate<Strategy> EditingPositionOf(Node* anchor_node, |
| 67 int offset); | 67 int offset); |
| 68 | 68 |
| 69 // For creating before/after positions: | 69 // For creating before/after positions: |
| 70 PositionTemplate(Node* anchor_node, PositionAnchorType); | 70 PositionTemplate(Node* anchor_node, PositionAnchorType); |
| 71 | 71 |
| 72 // For creating offset positions: | 72 // For creating offset positions: |
| 73 // FIXME: This constructor should eventually go away. See bug 63040. | 73 PositionTemplate(const Node& anchor_node, int offset); |
| 74 PositionTemplate(Node* anchor_node, int offset); | 74 // TODO(editing-dev): We should not pass |nullptr| as |anchor_node| for |
| 75 // |Position| constructor. |
| 76 // TODO(editing-dev): This constructor should eventually go away. See bug |
| 77 // http://wkb.ug/63040. |
| 78 PositionTemplate(const Node* anchor_node, int offset); |
| 75 | 79 |
| 76 PositionTemplate(const PositionTemplate&); | 80 PositionTemplate(const PositionTemplate&); |
| 77 | 81 |
| 78 PositionAnchorType AnchorType() const { return anchor_type_; } | 82 PositionAnchorType AnchorType() const { return anchor_type_; } |
| 79 bool IsAfterAnchor() const { | 83 bool IsAfterAnchor() const { |
| 80 return anchor_type_ == PositionAnchorType::kAfterAnchor; | 84 return anchor_type_ == PositionAnchorType::kAfterAnchor; |
| 81 } | 85 } |
| 82 bool IsAfterChildren() const { | 86 bool IsAfterChildren() const { |
| 83 return anchor_type_ == PositionAnchorType::kAfterChildren; | 87 return anchor_type_ == PositionAnchorType::kAfterChildren; |
| 84 } | 88 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 void ShowTreeForThisInFlatTree() const; | 206 void ShowTreeForThisInFlatTree() const; |
| 203 #endif | 207 #endif |
| 204 | 208 |
| 205 DECLARE_TRACE(); | 209 DECLARE_TRACE(); |
| 206 | 210 |
| 207 private: | 211 private: |
| 208 bool IsAfterAnchorOrAfterChildren() const { | 212 bool IsAfterAnchorOrAfterChildren() const { |
| 209 return IsAfterAnchor() || IsAfterChildren(); | 213 return IsAfterAnchor() || IsAfterChildren(); |
| 210 } | 214 } |
| 211 | 215 |
| 216 // TODO(editing-dev): Since we should consider |Position| is constant in |
| 217 // tree, we should use |Member<const Node>|. see http://crbug.com/735327 |
| 212 Member<Node> anchor_node_; | 218 Member<Node> anchor_node_; |
| 213 // m_offset can be the offset inside m_anchorNode, or if | 219 // m_offset can be the offset inside m_anchorNode, or if |
| 214 // editingIgnoresContent(m_anchorNode) returns true, then other places in | 220 // editingIgnoresContent(m_anchorNode) returns true, then other places in |
| 215 // editing will treat m_offset == 0 as "before the anchor" and m_offset > 0 as | 221 // editing will treat m_offset == 0 as "before the anchor" and m_offset > 0 as |
| 216 // "after the anchor node". See parentAnchoredEquivalent for more info. | 222 // "after the anchor node". See parentAnchoredEquivalent for more info. |
| 217 int offset_; | 223 int offset_; |
| 218 PositionAnchorType anchor_type_; | 224 PositionAnchorType anchor_type_; |
| 219 }; | 225 }; |
| 220 | 226 |
| 221 extern template class CORE_EXTERN_TEMPLATE_EXPORT | 227 extern template class CORE_EXTERN_TEMPLATE_EXPORT |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 283 |
| 278 } // namespace blink | 284 } // namespace blink |
| 279 | 285 |
| 280 #ifndef NDEBUG | 286 #ifndef NDEBUG |
| 281 // Outside the WebCore namespace for ease of invocation from gdb. | 287 // Outside the WebCore namespace for ease of invocation from gdb. |
| 282 void showTree(const blink::Position&); | 288 void showTree(const blink::Position&); |
| 283 void showTree(const blink::Position*); | 289 void showTree(const blink::Position*); |
| 284 #endif | 290 #endif |
| 285 | 291 |
| 286 #endif // Position_h | 292 #endif // Position_h |
| OLD | NEW |