| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 if (node->childNodeCount()) | 519 if (node->childNodeCount()) |
| 520 return VisiblePosition(lastPositionInOrAfterNode(node), DOWNSTREAM); | 520 return VisiblePosition(lastPositionInOrAfterNode(node), DOWNSTREAM); |
| 521 ASSERT(node->parentNode()); | 521 ASSERT(node->parentNode()); |
| 522 ASSERT(!node->parentNode()->isShadowRoot()); | 522 ASSERT(!node->parentNode()->isShadowRoot()); |
| 523 return positionInParentAfterNode(node); | 523 return positionInParentAfterNode(node); |
| 524 } | 524 } |
| 525 | 525 |
| 526 // Create a range object with two visible positions, start and end. | 526 // Create a range object with two visible positions, start and end. |
| 527 // create(Document*, const Position&, const Position&); will use deprecatedEditi
ngOffset | 527 // create(Document*, const Position&, const Position&); will use deprecatedEditi
ngOffset |
| 528 // Use this function instead of create a regular range object (avoiding editing
offset). | 528 // Use this function instead of create a regular range object (avoiding editing
offset). |
| 529 PassRefPtr<Range> createRange(Document& document, const VisiblePosition& start,
const VisiblePosition& end, ExceptionState& es) | 529 PassRefPtr<Range> createRange(Document& document, const VisiblePosition& start,
const VisiblePosition& end, ExceptionState& exceptionState) |
| 530 { | 530 { |
| 531 RefPtr<Range> selectedRange = Range::create(document); | 531 RefPtr<Range> selectedRange = Range::create(document); |
| 532 selectedRange->setStart(start.deepEquivalent().containerNode(), start.deepEq
uivalent().computeOffsetInContainerNode(), es); | 532 selectedRange->setStart(start.deepEquivalent().containerNode(), start.deepEq
uivalent().computeOffsetInContainerNode(), exceptionState); |
| 533 if (!es.hadException()) | 533 if (!exceptionState.hadException()) |
| 534 selectedRange->setEnd(end.deepEquivalent().containerNode(), end.deepEqui
valent().computeOffsetInContainerNode(), es); | 534 selectedRange->setEnd(end.deepEquivalent().containerNode(), end.deepEqui
valent().computeOffsetInContainerNode(), exceptionState); |
| 535 return selectedRange.release(); | 535 return selectedRange.release(); |
| 536 } | 536 } |
| 537 | 537 |
| 538 bool isListElement(Node *n) | 538 bool isListElement(Node *n) |
| 539 { | 539 { |
| 540 return (n && (n->hasTagName(ulTag) || n->hasTagName(olTag) || n->hasTagName(
dlTag))); | 540 return (n && (n->hasTagName(ulTag) || n->hasTagName(olTag) || n->hasTagName(
dlTag))); |
| 541 } | 541 } |
| 542 | 542 |
| 543 bool isListItem(const Node *n) | 543 bool isListItem(const Node *n) |
| 544 { | 544 { |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 // if the selection starts just before a paragraph break, skip over it | 1153 // if the selection starts just before a paragraph break, skip over it |
| 1154 if (isEndOfParagraph(visiblePosition)) | 1154 if (isEndOfParagraph(visiblePosition)) |
| 1155 return visiblePosition.next().deepEquivalent().downstream(); | 1155 return visiblePosition.next().deepEquivalent().downstream(); |
| 1156 | 1156 |
| 1157 // otherwise, make sure to be at the start of the first selected node, | 1157 // otherwise, make sure to be at the start of the first selected node, |
| 1158 // instead of possibly at the end of the last node before the selection | 1158 // instead of possibly at the end of the last node before the selection |
| 1159 return visiblePosition.deepEquivalent().downstream(); | 1159 return visiblePosition.deepEquivalent().downstream(); |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 } // namespace WebCore | 1162 } // namespace WebCore |
| OLD | NEW |