| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 | 936 |
| 937 // If there are no VisiblePositions in the same block as pos then | 937 // If there are no VisiblePositions in the same block as pos then |
| 938 // upstreamStart will be outside the paragraph | 938 // upstreamStart will be outside the paragraph |
| 939 if (comparePositions(pos, upstreamStart) < 0) | 939 if (comparePositions(pos, upstreamStart) < 0) |
| 940 return nullptr; | 940 return nullptr; |
| 941 | 941 |
| 942 // Perform some checks to see if we need to perform work in this function. | 942 // Perform some checks to see if we need to perform work in this function. |
| 943 if (isEnclosingBlock(upstreamStart.anchorNode())) { | 943 if (isEnclosingBlock(upstreamStart.anchorNode())) { |
| 944 // If the block is the root editable element, always move content to a n
ew block, | 944 // If the block is the root editable element, always move content to a n
ew block, |
| 945 // since it is illegal to modify attributes on the root editable element
for editing. | 945 // since it is illegal to modify attributes on the root editable element
for editing. |
| 946 if (upstreamStart.anchorNode() == editableRootElementForPosition(upstrea
mStart)) { | 946 if (upstreamStart.anchorNode() == rootEditableElementOf(upstreamStart))
{ |
| 947 // If the block is the root editable element and it contains no visi
ble content, create a new | 947 // If the block is the root editable element and it contains no visi
ble content, create a new |
| 948 // block but don't try and move content into it, since there's nothi
ng for moveParagraphs to move. | 948 // block but don't try and move content into it, since there's nothi
ng for moveParagraphs to move. |
| 949 if (!hasRenderedNonAnonymousDescendantsWithHeight(upstreamStart.anch
orNode()->layoutObject())) | 949 if (!hasRenderedNonAnonymousDescendantsWithHeight(upstreamStart.anch
orNode()->layoutObject())) |
| 950 return insertNewDefaultParagraphElementAt(upstreamStart); | 950 return insertNewDefaultParagraphElementAt(upstreamStart); |
| 951 } else if (isEnclosingBlock(upstreamEnd.anchorNode())) { | 951 } else if (isEnclosingBlock(upstreamEnd.anchorNode())) { |
| 952 if (!upstreamEnd.anchorNode()->isDescendantOf(upstreamStart.anchorNo
de())) { | 952 if (!upstreamEnd.anchorNode()->isDescendantOf(upstreamStart.anchorNo
de())) { |
| 953 // If the paragraph end is a descendant of paragraph start, then
we need to run | 953 // If the paragraph end is a descendant of paragraph start, then
we need to run |
| 954 // the rest of this function. If not, we can bail here. | 954 // the rest of this function. If not, we can bail here. |
| 955 return nullptr; | 955 return nullptr; |
| 956 } | 956 } |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 pushAnchorElementDown(enclosingAnchor); | 1464 pushAnchorElementDown(enclosingAnchor); |
| 1465 enclosingAnchor = enclosingAnchorElement(original); | 1465 enclosingAnchor = enclosingAnchorElement(original); |
| 1466 } | 1466 } |
| 1467 if (!enclosingAnchor) | 1467 if (!enclosingAnchor) |
| 1468 return original; | 1468 return original; |
| 1469 | 1469 |
| 1470 result = positionInParentBeforeNode(*enclosingAnchor); | 1470 result = positionInParentBeforeNode(*enclosingAnchor); |
| 1471 } | 1471 } |
| 1472 } | 1472 } |
| 1473 | 1473 |
| 1474 if (result.isNull() || !editableRootElementForPosition(result)) | 1474 if (result.isNull() || !rootEditableElementOf(result)) |
| 1475 result = original; | 1475 result = original; |
| 1476 | 1476 |
| 1477 return result; | 1477 return result; |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 // Splits the tree parent by parent until we reach the specified ancestor. We us
e VisiblePositions | 1480 // Splits the tree parent by parent until we reach the specified ancestor. We us
e VisiblePositions |
| 1481 // to determine if the split is necessary. Returns the last split node. | 1481 // to determine if the split is necessary. Returns the last split node. |
| 1482 PassRefPtrWillBeRawPtr<Node> CompositeEditCommand::splitTreeToNode(Node* start,
Node* end, bool shouldSplitAncestor) | 1482 PassRefPtrWillBeRawPtr<Node> CompositeEditCommand::splitTreeToNode(Node* start,
Node* end, bool shouldSplitAncestor) |
| 1483 { | 1483 { |
| 1484 ASSERT(start); | 1484 ASSERT(start); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1507 } | 1507 } |
| 1508 | 1508 |
| 1509 DEFINE_TRACE(CompositeEditCommand) | 1509 DEFINE_TRACE(CompositeEditCommand) |
| 1510 { | 1510 { |
| 1511 visitor->trace(m_commands); | 1511 visitor->trace(m_commands); |
| 1512 visitor->trace(m_composition); | 1512 visitor->trace(m_composition); |
| 1513 EditCommand::trace(visitor); | 1513 EditCommand::trace(visitor); |
| 1514 } | 1514 } |
| 1515 | 1515 |
| 1516 } // namespace blink | 1516 } // namespace blink |
| OLD | NEW |