OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2011 Igalia S.L. | 4 * Copyright (C) 2011 Igalia S.L. |
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // the structure and appearance of the copied markup. | 513 // the structure and appearance of the copied markup. |
514 specialCommonAncestor = ancestorToRetainStructureAndAppearance(commonAnc
estor); | 514 specialCommonAncestor = ancestorToRetainStructureAndAppearance(commonAnc
estor); |
515 | 515 |
516 if (Node* parentListNode = enclosingNodeOfType(firstPositionInOrBeforeNo
de(range->firstNode()), isListItem)) { | 516 if (Node* parentListNode = enclosingNodeOfType(firstPositionInOrBeforeNo
de(range->firstNode()), isListItem)) { |
517 if (WebCore::areRangesEqual(VisibleSelection::selectionFromContentsO
fNode(parentListNode).toNormalizedRange().get(), range)) { | 517 if (WebCore::areRangesEqual(VisibleSelection::selectionFromContentsO
fNode(parentListNode).toNormalizedRange().get(), range)) { |
518 specialCommonAncestor = parentListNode->parentNode(); | 518 specialCommonAncestor = parentListNode->parentNode(); |
519 while (specialCommonAncestor && !isListElement(specialCommonAnce
stor)) | 519 while (specialCommonAncestor && !isListElement(specialCommonAnce
stor)) |
520 specialCommonAncestor = specialCommonAncestor->parentNode(); | 520 specialCommonAncestor = specialCommonAncestor->parentNode(); |
521 } | 521 } |
522 } | 522 } |
523 | |
524 // Retain the Mail quote level by including all ancestor mail block quot
es. | |
525 if (Node* highestMailBlockquote = highestEnclosingNodeOfType(firstPositi
onInOrBeforeNode(range->firstNode()), isMailBlockquote, CanCrossEditingBoundary)
) | |
526 specialCommonAncestor = highestMailBlockquote; | |
527 } | 523 } |
528 | 524 |
529 Node* checkAncestor = specialCommonAncestor ? specialCommonAncestor : common
Ancestor; | 525 Node* checkAncestor = specialCommonAncestor ? specialCommonAncestor : common
Ancestor; |
530 if (checkAncestor->renderer()) { | 526 if (checkAncestor->renderer()) { |
531 Node* newSpecialCommonAncestor = highestEnclosingNodeOfType(firstPositio
nInNode(checkAncestor), &isElementPresentational, CanCrossEditingBoundary, check
Ancestor->renderer()->containingBlock()->node()); | 527 Node* newSpecialCommonAncestor = highestEnclosingNodeOfType(firstPositio
nInNode(checkAncestor), &isElementPresentational, CanCrossEditingBoundary, check
Ancestor->renderer()->containingBlock()->node()); |
532 if (newSpecialCommonAncestor) | 528 if (newSpecialCommonAncestor) |
533 specialCommonAncestor = newSpecialCommonAncestor; | 529 specialCommonAncestor = newSpecialCommonAncestor; |
534 } | 530 } |
535 | 531 |
536 // If a single tab is selected, commonAncestor will be a text node inside a
tab span. | 532 // If a single tab is selected, commonAncestor will be a text node inside a
tab span. |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 if (hasOneChild(containerNode.get())) { | 1088 if (hasOneChild(containerNode.get())) { |
1093 containerNode->replaceChild(textNode.release(), containerNode->firstChil
d(), ec); | 1089 containerNode->replaceChild(textNode.release(), containerNode->firstChil
d(), ec); |
1094 return; | 1090 return; |
1095 } | 1091 } |
1096 | 1092 |
1097 containerNode->removeChildren(); | 1093 containerNode->removeChildren(); |
1098 containerNode->appendChild(textNode.release(), ec); | 1094 containerNode->appendChild(textNode.release(), ec); |
1099 } | 1095 } |
1100 | 1096 |
1101 } | 1097 } |
OLD | NEW |