OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (!isHTMLLIElement(selectedListItem)) | 81 if (!isHTMLLIElement(selectedListItem)) |
82 return false; | 82 return false; |
83 | 83 |
84 // FIXME: previousElementSibling does not ignore non-rendered content like <
span></span>. Should we? | 84 // FIXME: previousElementSibling does not ignore non-rendered content like <
span></span>. Should we? |
85 Element* previousList = ElementTraversal::previousSibling(*selectedListItem)
; | 85 Element* previousList = ElementTraversal::previousSibling(*selectedListItem)
; |
86 Element* nextList = ElementTraversal::nextSibling(*selectedListItem); | 86 Element* nextList = ElementTraversal::nextSibling(*selectedListItem); |
87 | 87 |
88 // We should calculate visible range in list item because inserting new | 88 // We should calculate visible range in list item because inserting new |
89 // list element will change visibility of list item, e.g. :first-child | 89 // list element will change visibility of list item, e.g. :first-child |
90 // CSS selector. | 90 // CSS selector. |
91 HTMLElement* newList = toHTMLElement(document().createElement(listElement->t
agQName(), false)); | 91 HTMLElement* newList = toHTMLElement(document().createElement(listElement->t
agQName(), CreatedByCloneNode)); |
92 insertNodeBefore(newList, selectedListItem, editingState); | 92 insertNodeBefore(newList, selectedListItem, editingState); |
93 if (editingState->isAborted()) | 93 if (editingState->isAborted()) |
94 return false; | 94 return false; |
95 | 95 |
96 // We should clone all the children of the list item for indenting purposes.
However, in case the current | 96 // We should clone all the children of the list item for indenting purposes.
However, in case the current |
97 // selection does not encompass all its children, we need to explicitally ha
ndle the same. The original | 97 // selection does not encompass all its children, we need to explicitally ha
ndle the same. The original |
98 // list item too would require proper deletion in that case. | 98 // list item too would require proper deletion in that case. |
99 if (end.anchorNode() == selectedListItem || end.anchorNode()->isDescendantOf
(selectedListItem->lastChild())) { | 99 if (end.anchorNode() == selectedListItem || end.anchorNode()->isDescendantOf
(selectedListItem->lastChild())) { |
100 moveParagraphWithClones(createVisiblePosition(start), createVisiblePosit
ion(end), newList, selectedListItem, editingState); | 100 moveParagraphWithClones(createVisiblePosition(start), createVisiblePosit
ion(end), newList, selectedListItem, editingState); |
101 } else { | 101 } else { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 bool indentingAsListItemResult = tryIndentingAsListItem(start, end, editingS
tate); | 286 bool indentingAsListItemResult = tryIndentingAsListItem(start, end, editingS
tate); |
287 if (editingState->isAborted()) | 287 if (editingState->isAborted()) |
288 return; | 288 return; |
289 if (indentingAsListItemResult) | 289 if (indentingAsListItemResult) |
290 blockquoteForNextIndent = nullptr; | 290 blockquoteForNextIndent = nullptr; |
291 else | 291 else |
292 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); | 292 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); |
293 } | 293 } |
294 | 294 |
295 } // namespace blink | 295 } // namespace blink |
OLD | NEW |