OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 { | 1410 { |
1411 return m_editAction; | 1411 return m_editAction; |
1412 } | 1412 } |
1413 | 1413 |
1414 // If the user is inserting a list into an existing list, instead of nesting the
list, | 1414 // If the user is inserting a list into an existing list, instead of nesting the
list, |
1415 // we put the list items into the existing list. | 1415 // we put the list items into the existing list. |
1416 Node* ReplaceSelectionCommand::insertAsListItems(PassRefPtr<HTMLElement> prpList
Element, Node* insertionBlock, const Position& insertPos, InsertedNodes& inserte
dNodes) | 1416 Node* ReplaceSelectionCommand::insertAsListItems(PassRefPtr<HTMLElement> prpList
Element, Node* insertionBlock, const Position& insertPos, InsertedNodes& inserte
dNodes) |
1417 { | 1417 { |
1418 RefPtr<HTMLElement> listElement = prpListElement; | 1418 RefPtr<HTMLElement> listElement = prpListElement; |
1419 | 1419 |
1420 while (listElement->hasChildNodes() && isListElement(listElement->firstChild
()) && listElement->childNodeCount() == 1) | 1420 while (listElement->hasChildNodes() && isListElement(listElement->firstChild
()) && listElement->hasOneChild()) |
1421 listElement = toHTMLElement(listElement->firstChild()); | 1421 listElement = toHTMLElement(listElement->firstChild()); |
1422 | 1422 |
1423 bool isStart = isStartOfParagraph(insertPos); | 1423 bool isStart = isStartOfParagraph(insertPos); |
1424 bool isEnd = isEndOfParagraph(insertPos); | 1424 bool isEnd = isEndOfParagraph(insertPos); |
1425 bool isMiddle = !isStart && !isEnd; | 1425 bool isMiddle = !isStart && !isEnd; |
1426 Node* lastNode = insertionBlock; | 1426 Node* lastNode = insertionBlock; |
1427 | 1427 |
1428 // If we're in the middle of a list item, we should split it into two separa
te | 1428 // If we're in the middle of a list item, we should split it into two separa
te |
1429 // list items and insert these nodes between them. | 1429 // list items and insert these nodes between them. |
1430 if (isMiddle) { | 1430 if (isMiddle) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1493 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); | 1493 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
1494 | 1494 |
1495 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1495 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
1496 | 1496 |
1497 setEndingSelection(selectionAfterReplace); | 1497 setEndingSelection(selectionAfterReplace); |
1498 | 1498 |
1499 return true; | 1499 return true; |
1500 } | 1500 } |
1501 | 1501 |
1502 } // namespace WebCore | 1502 } // namespace WebCore |
OLD | NEW |