| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // If our selection is not inside a list, bail out. | 55 // If our selection is not inside a list, bail out. |
| 56 RefPtr<Node> lastNodeInSelectedParagraph = start.deprecatedNode(); | 56 RefPtr<Node> lastNodeInSelectedParagraph = start.deprecatedNode(); |
| 57 RefPtr<Element> listNode = enclosingList(lastNodeInSelectedParagraph.get()); | 57 RefPtr<Element> listNode = enclosingList(lastNodeInSelectedParagraph.get()); |
| 58 if (!listNode) | 58 if (!listNode) |
| 59 return false; | 59 return false; |
| 60 | 60 |
| 61 // 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. | 61 // 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. |
| 62 RefPtr<Element> selectedListItem = enclosingBlock(lastNodeInSelectedParagrap
h.get()); | 62 RefPtr<Element> selectedListItem = enclosingBlock(lastNodeInSelectedParagrap
h.get()); |
| 63 | 63 |
| 64 // FIXME: we need to deal with the case where there is no li (malformed HTML
) | 64 // FIXME: we need to deal with the case where there is no li (malformed HTML
) |
| 65 if (!isHTMLLIElement(*selectedListItem)) | 65 if (!selectedListItem || !isHTMLLIElement(*selectedListItem)) |
| 66 return false; | 66 return false; |
| 67 | 67 |
| 68 // FIXME: previousElementSibling does not ignore non-rendered content like <
span></span>. Should we? | 68 // FIXME: previousElementSibling does not ignore non-rendered content like <
span></span>. Should we? |
| 69 RefPtr<Element> previousList = ElementTraversal::previousSibling(*selectedLi
stItem); | 69 RefPtr<Element> previousList = ElementTraversal::previousSibling(*selectedLi
stItem); |
| 70 RefPtr<Element> nextList = ElementTraversal::nextSibling(*selectedListItem); | 70 RefPtr<Element> nextList = ElementTraversal::nextSibling(*selectedListItem); |
| 71 | 71 |
| 72 // We should calculate visible range in list item because inserting new | 72 // We should calculate visible range in list item because inserting new |
| 73 // list element will change visibility of list item, e.g. :first-child | 73 // list element will change visibility of list item, e.g. :first-child |
| 74 // CSS selector. | 74 // CSS selector. |
| 75 RefPtrWillBeRawPtr<Element> newList = document().createElement(listNode->tag
QName(), false); | 75 RefPtrWillBeRawPtr<Element> newList = document().createElement(listNode->tag
QName(), false); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 void IndentOutdentCommand::formatRange(const Position& start, const Position& en
d, const Position&, RefPtr<Element>& blockquoteForNextIndent) | 238 void IndentOutdentCommand::formatRange(const Position& start, const Position& en
d, const Position&, RefPtr<Element>& blockquoteForNextIndent) |
| 239 { | 239 { |
| 240 if (tryIndentingAsListItem(start, end)) | 240 if (tryIndentingAsListItem(start, end)) |
| 241 blockquoteForNextIndent = nullptr; | 241 blockquoteForNextIndent = nullptr; |
| 242 else | 242 else |
| 243 indentIntoBlockquote(start, end, blockquoteForNextIndent); | 243 indentIntoBlockquote(start, end, blockquoteForNextIndent); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } | 246 } |
| OLD | NEW |