OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005 Apple Computer, 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 namespace { | 43 namespace { |
44 | 44 |
45 bool isFirstVisiblePositionInNode(const VisiblePosition& visiblePosition, const
ContainerNode* node) | 45 bool isFirstVisiblePositionInNode(const VisiblePosition& visiblePosition, const
ContainerNode* node) |
46 { | 46 { |
47 if (visiblePosition.isNull()) | 47 if (visiblePosition.isNull()) |
48 return false; | 48 return false; |
49 | 49 |
50 if (!visiblePosition.deepEquivalent().computeContainerNode()->isDescendantOf
(node)) | 50 if (!visiblePosition.deepEquivalent().computeContainerNode()->isDescendantOf
(node)) |
51 return false; | 51 return false; |
52 | 52 |
53 VisiblePosition previous = visiblePosition.previous(); | 53 VisiblePosition previous = previousPositionOf(visiblePosition); |
54 return previous.isNull() || !previous.deepEquivalent().anchorNode()->isDesce
ndantOf(node); | 54 return previous.isNull() || !previous.deepEquivalent().anchorNode()->isDesce
ndantOf(node); |
55 } | 55 } |
56 | 56 |
57 bool isLastVisiblePositionInNode(const VisiblePosition& visiblePosition, const C
ontainerNode* node) | 57 bool isLastVisiblePositionInNode(const VisiblePosition& visiblePosition, const C
ontainerNode* node) |
58 { | 58 { |
59 if (visiblePosition.isNull()) | 59 if (visiblePosition.isNull()) |
60 return false; | 60 return false; |
61 | 61 |
62 if (!visiblePosition.deepEquivalent().computeContainerNode()->isDescendantOf
(node)) | 62 if (!visiblePosition.deepEquivalent().computeContainerNode()->isDescendantOf
(node)) |
63 return false; | 63 return false; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 // Make sure the cloned block quote renders. | 219 // Make sure the cloned block quote renders. |
220 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); | 220 addBlockPlaceholderIfNeeded(clonedBlockquote.get()); |
221 | 221 |
222 // Put the selection right before the break. | 222 // Put the selection right before the break. |
223 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
TextAffinity::Downstream, endingSelection().isDirectional())); | 223 setEndingSelection(VisibleSelection(positionBeforeNode(breakElement.get()),
TextAffinity::Downstream, endingSelection().isDirectional())); |
224 rebalanceWhitespace(); | 224 rebalanceWhitespace(); |
225 } | 225 } |
226 | 226 |
227 } // namespace blink | 227 } // namespace blink |
OLD | NEW |