| 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 | 27 |
| 28 #include "core/dom/NodeComputedStyle.h" | 28 #include "core/dom/NodeComputedStyle.h" |
| 29 #include "core/dom/NodeTraversal.h" | 29 #include "core/dom/NodeTraversal.h" |
| 30 #include "core/layout/LayoutInline.h" | 30 #include "core/layout/LayoutInline.h" |
| 31 #include "core/layout/LayoutObject.h" | 31 #include "core/layout/LayoutObject.h" |
| 32 #include "core/style/ComputedStyle.h" | 32 #include "core/style/ComputedStyle.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 SimplifyMarkupCommand::SimplifyMarkupCommand(Document& document, | 36 SimplifyMarkupCommand::SimplifyMarkupCommand(Document& document, |
| 37 CommandSource source, |
| 37 Node* firstNode, | 38 Node* firstNode, |
| 38 Node* nodeAfterLast) | 39 Node* nodeAfterLast) |
| 39 : CompositeEditCommand(document), | 40 : CompositeEditCommand(document, source), |
| 40 m_firstNode(firstNode), | 41 m_firstNode(firstNode), |
| 41 m_nodeAfterLast(nodeAfterLast) {} | 42 m_nodeAfterLast(nodeAfterLast) {} |
| 42 | 43 |
| 43 void SimplifyMarkupCommand::doApply(EditingState* editingState) { | 44 void SimplifyMarkupCommand::doApply(EditingState* editingState) { |
| 44 ContainerNode* rootNode = m_firstNode->parentNode(); | 45 ContainerNode* rootNode = m_firstNode->parentNode(); |
| 45 HeapVector<Member<ContainerNode>> nodesToRemove; | 46 HeapVector<Member<ContainerNode>> nodesToRemove; |
| 46 | 47 |
| 47 // Walk through the inserted nodes, to see if there are elements that could be | 48 // Walk through the inserted nodes, to see if there are elements that could be |
| 48 // removed without affecting the style. The goal is to produce leaner markup | 49 // removed without affecting the style. The goal is to produce leaner markup |
| 49 // even when starting from a verbose fragment. | 50 // even when starting from a verbose fragment. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return pastLastNodeToRemove - startNodeIndex - 1; | 152 return pastLastNodeToRemove - startNodeIndex - 1; |
| 152 } | 153 } |
| 153 | 154 |
| 154 DEFINE_TRACE(SimplifyMarkupCommand) { | 155 DEFINE_TRACE(SimplifyMarkupCommand) { |
| 155 visitor->trace(m_firstNode); | 156 visitor->trace(m_firstNode); |
| 156 visitor->trace(m_nodeAfterLast); | 157 visitor->trace(m_nodeAfterLast); |
| 157 CompositeEditCommand::trace(visitor); | 158 CompositeEditCommand::trace(visitor); |
| 158 } | 159 } |
| 159 | 160 |
| 160 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |