| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 bool IndentOutdentCommand::tryIndentingAsListItem(const Position& start, const P
osition& end) | 59 bool IndentOutdentCommand::tryIndentingAsListItem(const Position& start, const P
osition& end) |
| 60 { | 60 { |
| 61 // If our selection is not inside a list, bail out. | 61 // If our selection is not inside a list, bail out. |
| 62 Node* lastNodeInSelectedParagraph = start.deprecatedNode(); | 62 Node* lastNodeInSelectedParagraph = start.deprecatedNode(); |
| 63 RefPtr<Element> listNode = enclosingList(lastNodeInSelectedParagraph); | 63 RefPtr<Element> listNode = enclosingList(lastNodeInSelectedParagraph); |
| 64 if (!listNode) | 64 if (!listNode) |
| 65 return false; | 65 return false; |
| 66 | 66 |
| 67 // Find the block that we want to indent. If it's not a list item (e.g., a
div inside a list item), we bail out. | 67 // Find the block that we want to indent. If it's not a list item (e.g., a
div inside a list item), we bail out. |
| 68 Element* selectedListItem = static_cast<Element*>(enclosingBlock(lastNodeInS
electedParagraph)); | 68 Element* selectedListItem = enclosingBlock(lastNodeInSelectedParagraph); |
| 69 | 69 |
| 70 // FIXME: we need to deal with the case where there is no li (malformed HTML
) | 70 // FIXME: we need to deal with the case where there is no li (malformed HTML
) |
| 71 if (!selectedListItem->hasTagName(liTag)) | 71 if (!selectedListItem->hasTagName(liTag)) |
| 72 return false; | 72 return false; |
| 73 | 73 |
| 74 // FIXME: previousElementSibling does not ignore non-rendered content like <
span></span>. Should we? | 74 // FIXME: previousElementSibling does not ignore non-rendered content like <
span></span>. Should we? |
| 75 Element* previousList = selectedListItem->previousElementSibling(); | 75 Element* previousList = selectedListItem->previousElementSibling(); |
| 76 Element* nextList = selectedListItem->nextElementSibling(); | 76 Element* nextList = selectedListItem->nextElementSibling(); |
| 77 | 77 |
| 78 RefPtr<Element> newList = document()->createElement(listNode->tagQName(), fa
lse); | 78 RefPtr<Element> newList = document()->createElement(listNode->tagQName(), fa
lse); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 233 |
| 234 void IndentOutdentCommand::formatRange(const Position& start, const Position& en
d, const Position&, RefPtr<Element>& blockquoteForNextIndent) | 234 void IndentOutdentCommand::formatRange(const Position& start, const Position& en
d, const Position&, RefPtr<Element>& blockquoteForNextIndent) |
| 235 { | 235 { |
| 236 if (tryIndentingAsListItem(start, end)) | 236 if (tryIndentingAsListItem(start, end)) |
| 237 blockquoteForNextIndent = 0; | 237 blockquoteForNextIndent = 0; |
| 238 else | 238 else |
| 239 indentIntoBlockquote(start, end, blockquoteForNextIndent); | 239 indentIntoBlockquote(start, end, blockquoteForNextIndent); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } | 242 } |
| OLD | NEW |