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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (!node || !node->isHTMLElement()) | 47 if (!node || !node->isHTMLElement()) |
48 return false; | 48 return false; |
49 if (!node->layoutObject() || !node->layoutObject()->isLayoutBlock()) | 49 if (!node->layoutObject() || !node->layoutObject()->isLayoutBlock()) |
50 return false; | 50 return false; |
51 const HTMLElement& element = toHTMLElement(*node); | 51 const HTMLElement& element = toHTMLElement(*node); |
52 // TODO(yosin): We should check OL/UL element has "list-style-type" CSS | 52 // TODO(yosin): We should check OL/UL element has "list-style-type" CSS |
53 // property to make sure they layout contents as list. | 53 // property to make sure they layout contents as list. |
54 return isHTMLUListElement(element) || isHTMLOListElement(element) || element
.hasTagName(blockquoteTag); | 54 return isHTMLUListElement(element) || isHTMLOListElement(element) || element
.hasTagName(blockquoteTag); |
55 } | 55 } |
56 | 56 |
57 static bool isInline(const Node* node) | |
58 { | |
59 return node && node->layoutObject() && node->layoutObject()->isInline(); | |
60 } | |
61 | |
62 | |
63 IndentOutdentCommand::IndentOutdentCommand(Document& document, EIndentType typeO
fAction) | 57 IndentOutdentCommand::IndentOutdentCommand(Document& document, EIndentType typeO
fAction) |
64 : ApplyBlockElementCommand(document, blockquoteTag, "margin: 0 0 0 40px; bor
der: none; padding: 0px;") | 58 : ApplyBlockElementCommand(document, blockquoteTag, "margin: 0 0 0 40px; bor
der: none; padding: 0px;") |
65 , m_typeOfAction(typeOfAction) | 59 , m_typeOfAction(typeOfAction) |
66 { | 60 { |
67 } | 61 } |
68 | 62 |
69 bool IndentOutdentCommand::tryIndentingAsListItem(const Position& start, const P
osition& end, EditingState* editingState) | 63 bool IndentOutdentCommand::tryIndentingAsListItem(const Position& start, const P
osition& end, EditingState* editingState) |
70 { | 64 { |
71 // If our selection is not inside a list, bail out. | 65 // If our selection is not inside a list, bail out. |
72 Node* lastNodeInSelectedParagraph = start.anchorNode(); | 66 Node* lastNodeInSelectedParagraph = start.anchorNode(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 bool indentingAsListItemResult = tryIndentingAsListItem(start, end, editingS
tate); | 280 bool indentingAsListItemResult = tryIndentingAsListItem(start, end, editingS
tate); |
287 if (editingState->isAborted()) | 281 if (editingState->isAborted()) |
288 return; | 282 return; |
289 if (indentingAsListItemResult) | 283 if (indentingAsListItemResult) |
290 blockquoteForNextIndent = nullptr; | 284 blockquoteForNextIndent = nullptr; |
291 else | 285 else |
292 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); | 286 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); |
293 } | 287 } |
294 | 288 |
295 } // namespace blink | 289 } // namespace blink |
OLD | NEW |