Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: Source/WebCore/editing/IndentOutdentCommand.cpp

Issue 10451004: Merge 116653 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « Source/WebCore/editing/DeleteSelectionCommand.cpp ('k') | Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698