| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 continue; | 565 continue; |
| 566 } | 566 } |
| 567 removeElementAttribute(element, styleAttr); | 567 removeElementAttribute(element, styleAttr); |
| 568 } else if (newInlineStyle->style()->propertyCount() != inlineStyle->prop
ertyCount()) { | 568 } else if (newInlineStyle->style()->propertyCount() != inlineStyle->prop
ertyCount()) { |
| 569 setNodeAttribute(element, styleAttr, AtomicString(newInlineStyle->st
yle()->asText())); | 569 setNodeAttribute(element, styleAttr, AtomicString(newInlineStyle->st
yle()->asText())); |
| 570 } | 570 } |
| 571 | 571 |
| 572 // FIXME: Tolerate differences in id, class, and style attributes. | 572 // FIXME: Tolerate differences in id, class, and style attributes. |
| 573 if (element->parentNode() && isNonTableCellHTMLBlockElement(element) &&
areIdenticalElements(*element, *element->parentNode()) | 573 if (element->parentNode() && isNonTableCellHTMLBlockElement(element) &&
areIdenticalElements(*element, *element->parentNode()) |
| 574 && VisiblePosition::firstPositionInNode(element->parentNode()).deepE
quivalent() == VisiblePosition::firstPositionInNode(element).deepEquivalent() | 574 && VisiblePosition::firstPositionInNode(element->parentNode()).deepE
quivalent() == VisiblePosition::firstPositionInNode(element).deepEquivalent() |
| 575 && createVisiblePosition(lastPositionInNode(element->parentNode())).
deepEquivalent() == createVisiblePosition(lastPositionInNode(element)).deepEquiv
alent()) { | 575 && createVisiblePosition(Position::lastPositionInNode(element->paren
tNode())).deepEquivalent() == createVisiblePosition(Position::lastPositionInNode
(element)).deepEquivalent()) { |
| 576 insertedNodes.willRemoveNodePreservingChildren(*element); | 576 insertedNodes.willRemoveNodePreservingChildren(*element); |
| 577 removeNodePreservingChildren(element, editingState); | 577 removeNodePreservingChildren(element, editingState); |
| 578 if (editingState->isAborted()) | 578 if (editingState->isAborted()) |
| 579 return; | 579 return; |
| 580 continue; | 580 continue; |
| 581 } | 581 } |
| 582 | 582 |
| 583 if (element->parentNode() && element->parentNode()->layoutObjectIsRichly
Editable()) | 583 if (element->parentNode() && element->parentNode()->layoutObjectIsRichly
Editable()) |
| 584 removeElementAttribute(element, contenteditableAttr); | 584 removeElementAttribute(element, contenteditableAttr); |
| 585 | 585 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 } | 698 } |
| 699 } | 699 } |
| 700 } | 700 } |
| 701 | 701 |
| 702 void ReplaceSelectionCommand::moveElementOutOfAncestor(Element* element, Element
* ancestor, EditingState* editingState) | 702 void ReplaceSelectionCommand::moveElementOutOfAncestor(Element* element, Element
* ancestor, EditingState* editingState) |
| 703 { | 703 { |
| 704 if (!ancestor->parentNode()->hasEditableStyle()) | 704 if (!ancestor->parentNode()->hasEditableStyle()) |
| 705 return; | 705 return; |
| 706 | 706 |
| 707 VisiblePosition positionAtEndOfNode = createVisiblePosition(lastPositionInOr
AfterNode(element)); | 707 VisiblePosition positionAtEndOfNode = createVisiblePosition(lastPositionInOr
AfterNode(element)); |
| 708 VisiblePosition lastPositionInParagraph = createVisiblePosition(lastPosition
InNode(ancestor)); | 708 VisiblePosition lastPositionInParagraph = createVisiblePosition(Position::la
stPositionInNode(ancestor)); |
| 709 if (positionAtEndOfNode.deepEquivalent() == lastPositionInParagraph.deepEqui
valent()) { | 709 if (positionAtEndOfNode.deepEquivalent() == lastPositionInParagraph.deepEqui
valent()) { |
| 710 removeNode(element, editingState); | 710 removeNode(element, editingState); |
| 711 if (editingState->isAborted()) | 711 if (editingState->isAborted()) |
| 712 return; | 712 return; |
| 713 if (ancestor->nextSibling()) | 713 if (ancestor->nextSibling()) |
| 714 insertNodeBefore(element, ancestor->nextSibling(), editingState); | 714 insertNodeBefore(element, ancestor->nextSibling(), editingState); |
| 715 else | 715 else |
| 716 appendNode(element, ancestor->parentNode(), editingState); | 716 appendNode(element, ancestor->parentNode(), editingState); |
| 717 if (editingState->isAborted()) | 717 if (editingState->isAborted()) |
| 718 return; | 718 return; |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 visitor->trace(m_startOfInsertedContent); | 1717 visitor->trace(m_startOfInsertedContent); |
| 1718 visitor->trace(m_endOfInsertedContent); | 1718 visitor->trace(m_endOfInsertedContent); |
| 1719 visitor->trace(m_insertionStyle); | 1719 visitor->trace(m_insertionStyle); |
| 1720 visitor->trace(m_documentFragment); | 1720 visitor->trace(m_documentFragment); |
| 1721 visitor->trace(m_startOfInsertedRange); | 1721 visitor->trace(m_startOfInsertedRange); |
| 1722 visitor->trace(m_endOfInsertedRange); | 1722 visitor->trace(m_endOfInsertedRange); |
| 1723 CompositeEditCommand::trace(visitor); | 1723 CompositeEditCommand::trace(visitor); |
| 1724 } | 1724 } |
| 1725 | 1725 |
| 1726 } // namespace blink | 1726 } // namespace blink |
| OLD | NEW |