OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008, 2009 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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 if (runEnd == element) | 987 if (runEnd == element) |
988 runEnd = nextSibling ? nextSibling->previousSibling() : parent->
lastChild(); | 988 runEnd = nextSibling ? nextSibling->previousSibling() : parent->
lastChild(); |
989 } | 989 } |
990 } | 990 } |
991 } | 991 } |
992 | 992 |
993 bool ApplyStyleCommand::removeInlineStyleFromElement(EditingStyle* style, HTMLEl
ement* element, EditingState* editingState, InlineStyleRemovalMode mode, Editing
Style* extractedStyle) | 993 bool ApplyStyleCommand::removeInlineStyleFromElement(EditingStyle* style, HTMLEl
ement* element, EditingState* editingState, InlineStyleRemovalMode mode, Editing
Style* extractedStyle) |
994 { | 994 { |
995 DCHECK(element); | 995 DCHECK(element); |
996 | 996 |
997 if (!element->parentNode() || !element->parentNode()->isContentEditable()) | 997 if (!element->parentNode() || !isContentEditable(*element->parentNode())) |
998 return false; | 998 return false; |
999 | 999 |
1000 if (isStyledInlineElementToRemove(element)) { | 1000 if (isStyledInlineElementToRemove(element)) { |
1001 if (mode == RemoveNone) | 1001 if (mode == RemoveNone) |
1002 return true; | 1002 return true; |
1003 if (extractedStyle) | 1003 if (extractedStyle) |
1004 extractedStyle->mergeInlineStyleOfElement(element, EditingStyle::Ove
rrideValues); | 1004 extractedStyle->mergeInlineStyleOfElement(element, EditingStyle::Ove
rrideValues); |
1005 removeNodePreservingChildren(element, editingState); | 1005 removeNodePreservingChildren(element, editingState); |
1006 if (editingState->isAborted()) | 1006 if (editingState->isAborted()) |
1007 return false; | 1007 return false; |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 DCHECK(elementToInsert); | 1479 DCHECK(elementToInsert); |
1480 Node* node = passedStartNode; | 1480 Node* node = passedStartNode; |
1481 Element* element = elementToInsert; | 1481 Element* element = elementToInsert; |
1482 | 1482 |
1483 insertNodeBefore(element, node, editingState); | 1483 insertNodeBefore(element, node, editingState); |
1484 if (editingState->isAborted()) | 1484 if (editingState->isAborted()) |
1485 return; | 1485 return; |
1486 | 1486 |
1487 while (node) { | 1487 while (node) { |
1488 Node* next = node->nextSibling(); | 1488 Node* next = node->nextSibling(); |
1489 if (node->isContentEditable()) { | 1489 if (isContentEditable(*node)) { |
1490 removeNode(node, editingState); | 1490 removeNode(node, editingState); |
1491 if (editingState->isAborted()) | 1491 if (editingState->isAborted()) |
1492 return; | 1492 return; |
1493 appendNode(node, element, editingState); | 1493 appendNode(node, element, editingState); |
1494 if (editingState->isAborted()) | 1494 if (editingState->isAborted()) |
1495 return; | 1495 return; |
1496 } | 1496 } |
1497 if (node == endNode) | 1497 if (node == endNode) |
1498 break; | 1498 break; |
1499 node = next; | 1499 node = next; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 DEFINE_TRACE(ApplyStyleCommand) | 1741 DEFINE_TRACE(ApplyStyleCommand) |
1742 { | 1742 { |
1743 visitor->trace(m_style); | 1743 visitor->trace(m_style); |
1744 visitor->trace(m_start); | 1744 visitor->trace(m_start); |
1745 visitor->trace(m_end); | 1745 visitor->trace(m_end); |
1746 visitor->trace(m_styledInlineElement); | 1746 visitor->trace(m_styledInlineElement); |
1747 CompositeEditCommand::trace(visitor); | 1747 CompositeEditCommand::trace(visitor); |
1748 } | 1748 } |
1749 | 1749 |
1750 } // namespace blink | 1750 } // namespace blink |
OLD | NEW |