| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 switchListType = true; | 356 switchListType = true; |
| 357 } | 357 } |
| 358 | 358 |
| 359 // If the list is of the desired type, and we are not removing the list, | 359 // If the list is of the desired type, and we are not removing the list, |
| 360 // then exit early. | 360 // then exit early. |
| 361 if (!switchListType && forceCreateList) | 361 if (!switchListType && forceCreateList) |
| 362 return true; | 362 return true; |
| 363 | 363 |
| 364 // If the entire list is selected, then convert the whole list. | 364 // If the entire list is selected, then convert the whole list. |
| 365 if (switchListType && | 365 if (switchListType && |
| 366 isNodeVisiblyContainedWithin(*listElement, currentSelection)) { | 366 isNodeVisiblyContainedWithin(*listElement, |
| 367 EphemeralRange(¤tSelection))) { |
| 367 bool rangeStartIsInList = | 368 bool rangeStartIsInList = |
| 368 visiblePositionBeforeNode(*listElement).deepEquivalent() == | 369 visiblePositionBeforeNode(*listElement).deepEquivalent() == |
| 369 createVisiblePosition(currentSelection.startPosition()) | 370 createVisiblePosition(currentSelection.startPosition()) |
| 370 .deepEquivalent(); | 371 .deepEquivalent(); |
| 371 bool rangeEndIsInList = | 372 bool rangeEndIsInList = |
| 372 visiblePositionAfterNode(*listElement).deepEquivalent() == | 373 visiblePositionAfterNode(*listElement).deepEquivalent() == |
| 373 createVisiblePosition(currentSelection.endPosition()) | 374 createVisiblePosition(currentSelection.endPosition()) |
| 374 .deepEquivalent(); | 375 .deepEquivalent(); |
| 375 | 376 |
| 376 HTMLElement* newList = createHTMLElement(document(), listTag); | 377 HTMLElement* newList = createHTMLElement(document(), listTag); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 endOfParagraph(validPos, CanSkipOverEditingBoundary); | 675 endOfParagraph(validPos, CanSkipOverEditingBoundary); |
| 675 moveParagraph(start, end, VisiblePosition::beforeNode(placeholder), | 676 moveParagraph(start, end, VisiblePosition::beforeNode(placeholder), |
| 676 editingState, PreserveSelection); | 677 editingState, PreserveSelection); |
| 677 } | 678 } |
| 678 | 679 |
| 679 DEFINE_TRACE(InsertListCommand) { | 680 DEFINE_TRACE(InsertListCommand) { |
| 680 CompositeEditCommand::trace(visitor); | 681 CompositeEditCommand::trace(visitor); |
| 681 } | 682 } |
| 682 | 683 |
| 683 } // namespace blink | 684 } // namespace blink |
| OLD | NEW |