OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 if (node->hasTagName(bodyTag)) | 131 if (node->hasTagName(bodyTag)) |
132 break; | 132 break; |
133 node = node->parentNode(); | 133 node = node->parentNode(); |
134 } | 134 } |
135 | 135 |
136 return highestRoot; | 136 return highestRoot; |
137 } | 137 } |
138 | 138 |
139 Node* lowestEditableAncestor(Node* node) | 139 Node* lowestEditableAncestor(Node* node) |
140 { | 140 { |
141 if (!node) | |
142 return 0; | |
143 | |
144 Node* lowestRoot = 0; | |
145 while (node) { | 141 while (node) { |
146 if (node->rendererIsEditable()) | 142 if (node->rendererIsEditable()) |
147 return node->rootEditableElement(); | 143 return node->rootEditableElement(); |
148 if (node->hasTagName(bodyTag)) | 144 if (node->hasTagName(bodyTag)) |
149 break; | 145 break; |
150 node = node->parentNode(); | 146 node = node->parentNode(); |
151 } | 147 } |
152 | 148 |
153 return lowestRoot; | 149 return 0; |
154 } | 150 } |
155 | 151 |
156 bool isEditablePosition(const Position& p, EditableType editableType, EUpdateSty
le updateStyle) | 152 bool isEditablePosition(const Position& p, EditableType editableType, EUpdateSty
le updateStyle) |
157 { | 153 { |
158 Node* node = p.deprecatedNode(); | 154 Node* node = p.deprecatedNode(); |
159 if (!node) | 155 if (!node) |
160 return false; | 156 return false; |
161 if (updateStyle == UpdateStyle) | 157 if (updateStyle == UpdateStyle) |
162 node->document().updateLayoutIgnorePendingStylesheets(); | 158 node->document().updateLayoutIgnorePendingStylesheets(); |
163 else | 159 else |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 // if the selection starts just before a paragraph break, skip over it | 1151 // if the selection starts just before a paragraph break, skip over it |
1156 if (isEndOfParagraph(visiblePosition)) | 1152 if (isEndOfParagraph(visiblePosition)) |
1157 return visiblePosition.next().deepEquivalent().downstream(); | 1153 return visiblePosition.next().deepEquivalent().downstream(); |
1158 | 1154 |
1159 // otherwise, make sure to be at the start of the first selected node, | 1155 // otherwise, make sure to be at the start of the first selected node, |
1160 // instead of possibly at the end of the last node before the selection | 1156 // instead of possibly at the end of the last node before the selection |
1161 return visiblePosition.deepEquivalent().downstream(); | 1157 return visiblePosition.deepEquivalent().downstream(); |
1162 } | 1158 } |
1163 | 1159 |
1164 } // namespace WebCore | 1160 } // namespace WebCore |
OLD | NEW |