OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2010 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 // If the entire list is selected, then convert the whole list. | 226 // If the entire list is selected, then convert the whole list. |
227 if (switchListType && isNodeVisiblyContainedWithin(*listElement, current
Selection)) { | 227 if (switchListType && isNodeVisiblyContainedWithin(*listElement, current
Selection)) { |
228 bool rangeStartIsInList = visiblePositionBeforeNode(*listElement) ==
VisiblePosition(currentSelection.startPosition()); | 228 bool rangeStartIsInList = visiblePositionBeforeNode(*listElement) ==
VisiblePosition(currentSelection.startPosition()); |
229 bool rangeEndIsInList = visiblePositionAfterNode(*listElement) == Vi
siblePosition(currentSelection.endPosition()); | 229 bool rangeEndIsInList = visiblePositionAfterNode(*listElement) == Vi
siblePosition(currentSelection.endPosition()); |
230 | 230 |
231 RefPtrWillBeRawPtr<HTMLElement> newList = createHTMLElement(document
(), listTag); | 231 RefPtrWillBeRawPtr<HTMLElement> newList = createHTMLElement(document
(), listTag); |
232 insertNodeBefore(newList, listElement); | 232 insertNodeBefore(newList, listElement); |
233 | 233 |
234 Node* firstChildInList = enclosingListChild(VisiblePosition(firstPos
itionInNode(listElement.get())).deepEquivalent().deprecatedNode(), listElement.g
et()); | 234 Node* firstChildInList = enclosingListChild(VisiblePosition(firstPos
itionInNode(listElement.get())).deepEquivalent().deprecatedNode(), listElement.g
et()); |
235 Element* outerBlock = firstChildInList && firstChildInList->isBlockF
lowElement() ? toElement(firstChildInList) : listElement.get(); | 235 Element* outerBlock = firstChildInList && isBlockFlowElement(*firstC
hildInList) ? toElement(firstChildInList) : listElement.get(); |
236 | 236 |
237 moveParagraphWithClones(VisiblePosition(firstPositionInNode(listElem
ent.get())), VisiblePosition(lastPositionInNode(listElement.get())), newList.get
(), outerBlock); | 237 moveParagraphWithClones(VisiblePosition(firstPositionInNode(listElem
ent.get())), VisiblePosition(lastPositionInNode(listElement.get())), newList.get
(), outerBlock); |
238 | 238 |
239 // Manually remove listNode because moveParagraphWithClones sometime
s leaves it behind in the document. | 239 // Manually remove listNode because moveParagraphWithClones sometime
s leaves it behind in the document. |
240 // See the bug 33668 and editing/execCommand/insert-list-orphaned-it
em-with-nested-lists.html. | 240 // See the bug 33668 and editing/execCommand/insert-list-orphaned-it
em-with-nested-lists.html. |
241 // FIXME: This might be a bug in moveParagraphWithClones or deleteSe
lection. | 241 // FIXME: This might be a bug in moveParagraphWithClones or deleteSe
lection. |
242 if (listElement && listElement->inDocument()) | 242 if (listElement && listElement->inDocument()) |
243 removeNode(listElement); | 243 removeNode(listElement); |
244 | 244 |
245 newList = mergeWithNeighboringLists(newList); | 245 newList = mergeWithNeighboringLists(newList); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return listElement; | 412 return listElement; |
413 } | 413 } |
414 | 414 |
415 void InsertListCommand::trace(Visitor* visitor) | 415 void InsertListCommand::trace(Visitor* visitor) |
416 { | 416 { |
417 visitor->trace(m_listElement); | 417 visitor->trace(m_listElement); |
418 CompositeEditCommand::trace(visitor); | 418 CompositeEditCommand::trace(visitor); |
419 } | 419 } |
420 | 420 |
421 } | 421 } |
OLD | NEW |