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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 | 240 |
241 return highestRoot; | 241 return highestRoot; |
242 } | 242 } |
243 | 243 |
244 ContainerNode* highestEditableRoot(const PositionInComposedTree& position, Edita
bleType editableType) | 244 ContainerNode* highestEditableRoot(const PositionInComposedTree& position, Edita
bleType editableType) |
245 { | 245 { |
246 return highestEditableRoot(toPositionInDOMTree(position), editableType); | 246 return highestEditableRoot(toPositionInDOMTree(position), editableType); |
247 } | 247 } |
248 | 248 |
249 Element* lowestEditableAncestor(Node* node) | |
250 { | |
251 while (node) { | |
252 if (node->hasEditableStyle()) | |
253 return node->rootEditableElement(); | |
254 if (isHTMLBodyElement(*node)) | |
255 break; | |
256 node = node->parentNode(); | |
257 } | |
258 | |
259 return 0; | |
260 } | |
261 | |
262 bool isEditablePosition(const Position& p, EditableType editableType, EUpdateSty
le updateStyle) | 249 bool isEditablePosition(const Position& p, EditableType editableType, EUpdateSty
le updateStyle) |
263 { | 250 { |
264 Node* node = p.parentAnchoredEquivalent().anchorNode(); | 251 Node* node = p.parentAnchoredEquivalent().anchorNode(); |
265 if (!node) | 252 if (!node) |
266 return false; | 253 return false; |
267 if (updateStyle == UpdateStyle) | 254 if (updateStyle == UpdateStyle) |
268 node->document().updateLayoutIgnorePendingStylesheets(); | 255 node->document().updateLayoutIgnorePendingStylesheets(); |
269 else | 256 else |
270 ASSERT(updateStyle == DoNotUpdateStyle); | 257 ASSERT(updateStyle == DoNotUpdateStyle); |
271 | 258 |
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 // if the selection starts just before a paragraph break, skip over it | 1585 // if the selection starts just before a paragraph break, skip over it |
1599 if (isEndOfParagraph(visiblePosition)) | 1586 if (isEndOfParagraph(visiblePosition)) |
1600 return mostForwardCaretPosition(visiblePosition.next().deepEquivalent())
; | 1587 return mostForwardCaretPosition(visiblePosition.next().deepEquivalent())
; |
1601 | 1588 |
1602 // otherwise, make sure to be at the start of the first selected node, | 1589 // otherwise, make sure to be at the start of the first selected node, |
1603 // instead of possibly at the end of the last node before the selection | 1590 // instead of possibly at the end of the last node before the selection |
1604 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); | 1591 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); |
1605 } | 1592 } |
1606 | 1593 |
1607 } // namespace blink | 1594 } // namespace blink |
OLD | NEW |