| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Computer, 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 16 matching lines...) Expand all Loading... |
| 27 #include "core/editing/SimplifyMarkupCommand.h" | 27 #include "core/editing/SimplifyMarkupCommand.h" |
| 28 | 28 |
| 29 #include "core/dom/NodeRenderStyle.h" | 29 #include "core/dom/NodeRenderStyle.h" |
| 30 #include "core/dom/NodeTraversal.h" | 30 #include "core/dom/NodeTraversal.h" |
| 31 #include "core/rendering/RenderInline.h" | 31 #include "core/rendering/RenderInline.h" |
| 32 #include "core/rendering/RenderObject.h" | 32 #include "core/rendering/RenderObject.h" |
| 33 #include "core/rendering/style/RenderStyle.h" | 33 #include "core/rendering/style/RenderStyle.h" |
| 34 | 34 |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 SimplifyMarkupCommand::SimplifyMarkupCommand(Document* document, Node* firstNode
, Node* nodeAfterLast) | 37 SimplifyMarkupCommand::SimplifyMarkupCommand(Document& document, Node* firstNode
, Node* nodeAfterLast) |
| 38 : CompositeEditCommand(document), m_firstNode(firstNode), m_nodeAfterLast(no
deAfterLast) | 38 : CompositeEditCommand(document), m_firstNode(firstNode), m_nodeAfterLast(no
deAfterLast) |
| 39 { | 39 { |
| 40 } | 40 } |
| 41 | 41 |
| 42 void SimplifyMarkupCommand::doApply() | 42 void SimplifyMarkupCommand::doApply() |
| 43 { | 43 { |
| 44 Node* rootNode = m_firstNode->parentNode(); | 44 Node* rootNode = m_firstNode->parentNode(); |
| 45 Vector<RefPtr<Node> > nodesToRemove; | 45 Vector<RefPtr<Node> > nodesToRemove; |
| 46 | 46 |
| 47 // Walk through the inserted nodes, to see if there are elements that could
be removed | 47 // Walk through the inserted nodes, to see if there are elements that could
be removed |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 return 0; | 116 return 0; |
| 117 | 117 |
| 118 removeNode(nodesToRemove[startNodeIndex], AssumeContentIsAlwaysEditable); | 118 removeNode(nodesToRemove[startNodeIndex], AssumeContentIsAlwaysEditable); |
| 119 insertNodeBefore(nodesToRemove[startNodeIndex], highestAncestorToRemove, Ass
umeContentIsAlwaysEditable); | 119 insertNodeBefore(nodesToRemove[startNodeIndex], highestAncestorToRemove, Ass
umeContentIsAlwaysEditable); |
| 120 removeNode(highestAncestorToRemove, AssumeContentIsAlwaysEditable); | 120 removeNode(highestAncestorToRemove, AssumeContentIsAlwaysEditable); |
| 121 | 121 |
| 122 return pastLastNodeToRemove - startNodeIndex - 1; | 122 return pastLastNodeToRemove - startNodeIndex - 1; |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace WebCore | 125 } // namespace WebCore |
| OLD | NEW |