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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 if (comparePositions(pos, upstreamStart) < 0) | 934 if (comparePositions(pos, upstreamStart) < 0) |
935 return nullptr; | 935 return nullptr; |
936 | 936 |
937 // Perform some checks to see if we need to perform work in this function. | 937 // Perform some checks to see if we need to perform work in this function. |
938 if (isBlock(upstreamStart.anchorNode())) { | 938 if (isBlock(upstreamStart.anchorNode())) { |
939 // If the block is the root editable element, always move content to a n
ew block, | 939 // If the block is the root editable element, always move content to a n
ew block, |
940 // since it is illegal to modify attributes on the root editable element
for editing. | 940 // since it is illegal to modify attributes on the root editable element
for editing. |
941 if (upstreamStart.anchorNode() == editableRootForPosition(upstreamStart)
) { | 941 if (upstreamStart.anchorNode() == editableRootForPosition(upstreamStart)
) { |
942 // If the block is the root editable element and it contains no visi
ble content, create a new | 942 // If the block is the root editable element and it contains no visi
ble content, create a new |
943 // block but don't try and move content into it, since there's nothi
ng for moveParagraphs to move. | 943 // block but don't try and move content into it, since there's nothi
ng for moveParagraphs to move. |
944 if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(upstream
Start.anchorNode()->layoutObject())) | 944 if (!hasRenderedNonAnonymousDescendantsWithHeight(upstreamStart.anch
orNode()->layoutObject())) |
945 return insertNewDefaultParagraphElementAt(upstreamStart); | 945 return insertNewDefaultParagraphElementAt(upstreamStart); |
946 } else if (isBlock(upstreamEnd.anchorNode())) { | 946 } else if (isBlock(upstreamEnd.anchorNode())) { |
947 if (!upstreamEnd.anchorNode()->isDescendantOf(upstreamStart.anchorNo
de())) { | 947 if (!upstreamEnd.anchorNode()->isDescendantOf(upstreamStart.anchorNo
de())) { |
948 // If the paragraph end is a descendant of paragraph start, then
we need to run | 948 // If the paragraph end is a descendant of paragraph start, then
we need to run |
949 // the rest of this function. If not, we can bail here. | 949 // the rest of this function. If not, we can bail here. |
950 return nullptr; | 950 return nullptr; |
951 } | 951 } |
952 } else if (enclosingBlock(upstreamEnd.anchorNode()) != upstreamStart.anc
horNode()) { | 952 } else if (enclosingBlock(upstreamEnd.anchorNode()) != upstreamStart.anc
horNode()) { |
953 // It should be an ancestor of the paragraph start. | 953 // It should be an ancestor of the paragraph start. |
954 // We can bail as we have a full block to work with. | 954 // We can bail as we have a full block to work with. |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 } | 1502 } |
1503 | 1503 |
1504 DEFINE_TRACE(CompositeEditCommand) | 1504 DEFINE_TRACE(CompositeEditCommand) |
1505 { | 1505 { |
1506 visitor->trace(m_commands); | 1506 visitor->trace(m_commands); |
1507 visitor->trace(m_composition); | 1507 visitor->trace(m_composition); |
1508 EditCommand::trace(visitor); | 1508 EditCommand::trace(visitor); |
1509 } | 1509 } |
1510 | 1510 |
1511 } // namespace blink | 1511 } // namespace blink |
OLD | NEW |