OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 return 0; | 79 return 0; |
80 } | 80 } |
81 | 81 |
82 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, LegacyEditingOffset
offset) | 82 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, LegacyEditingOffset
offset) |
83 : m_anchorNode(anchorNode) | 83 : m_anchorNode(anchorNode) |
84 , m_offset(offset.value()) | 84 , m_offset(offset.value()) |
85 , m_anchorType(anchorTypeForLegacyEditingPosition(m_anchorNode.get(), m_offs
et)) | 85 , m_anchorType(anchorTypeForLegacyEditingPosition(m_anchorNode.get(), m_offs
et)) |
86 , m_isLegacyEditingPosition(true) | 86 , m_isLegacyEditingPosition(true) |
87 { | 87 { |
88 ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement()); | 88 ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement() || m_anchorNode->is
FirstLetterPseudoElement()); |
89 } | 89 } |
90 | 90 |
91 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, AnchorType anchorTyp
e) | 91 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, AnchorType anchorTyp
e) |
92 : m_anchorNode(anchorNode) | 92 : m_anchorNode(anchorNode) |
93 , m_offset(0) | 93 , m_offset(0) |
94 , m_anchorType(anchorType) | 94 , m_anchorType(anchorType) |
95 , m_isLegacyEditingPosition(false) | 95 , m_isLegacyEditingPosition(false) |
96 { | 96 { |
97 ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement()); | 97 ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement() || m_anchorNode->is
FirstLetterPseudoElement()); |
98 | 98 |
99 ASSERT(anchorType != PositionIsOffsetInAnchor); | 99 ASSERT(anchorType != PositionIsOffsetInAnchor); |
100 ASSERT(!((anchorType == PositionIsBeforeChildren || anchorType == PositionIs
AfterChildren) | 100 ASSERT(!((anchorType == PositionIsBeforeChildren || anchorType == PositionIs
AfterChildren) |
101 && (m_anchorNode->isTextNode() || editingIgnoresContent(m_anchorNode.get
())))); | 101 && (m_anchorNode->isTextNode() || editingIgnoresContent(m_anchorNode.get
())))); |
102 } | 102 } |
103 | 103 |
104 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, int offset, AnchorTy
pe anchorType) | 104 Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, int offset, AnchorTy
pe anchorType) |
105 : m_anchorNode(anchorNode) | 105 : m_anchorNode(anchorNode) |
106 , m_offset(offset) | 106 , m_offset(offset) |
107 , m_anchorType(anchorType) | 107 , m_anchorType(anchorType) |
108 , m_isLegacyEditingPosition(false) | 108 , m_isLegacyEditingPosition(false) |
109 { | 109 { |
110 ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement()); | 110 ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement() || m_anchorNode->is
FirstLetterPseudoElement()); |
111 | 111 |
112 ASSERT(anchorType == PositionIsOffsetInAnchor); | 112 ASSERT(anchorType == PositionIsOffsetInAnchor); |
113 } | 113 } |
114 | 114 |
115 Position::Position(PassRefPtrWillBeRawPtr<Text> textNode, unsigned offset) | 115 Position::Position(PassRefPtrWillBeRawPtr<Text> textNode, unsigned offset) |
116 : m_anchorNode(textNode) | 116 : m_anchorNode(textNode) |
117 , m_offset(static_cast<int>(offset)) | 117 , m_offset(static_cast<int>(offset)) |
118 , m_anchorType(PositionIsOffsetInAnchor) | 118 , m_anchorType(PositionIsOffsetInAnchor) |
119 , m_isLegacyEditingPosition(false) | 119 , m_isLegacyEditingPosition(false) |
120 { | 120 { |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 pos.showTreeForThis(); | 1306 pos.showTreeForThis(); |
1307 } | 1307 } |
1308 | 1308 |
1309 void showTree(const blink::Position* pos) | 1309 void showTree(const blink::Position* pos) |
1310 { | 1310 { |
1311 if (pos) | 1311 if (pos) |
1312 pos->showTreeForThis(); | 1312 pos->showTreeForThis(); |
1313 } | 1313 } |
1314 | 1314 |
1315 #endif | 1315 #endif |
OLD | NEW |