| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 | 121 |
| 122 ApplyStyleCommand::ApplyStyleCommand(const Handle<Document>& document, const Edi
tingStyle* style, EditAction editingAction, EPropertyLevel propertyLevel) | 122 ApplyStyleCommand::ApplyStyleCommand(const Handle<Document>& document, const Edi
tingStyle* style, EditAction editingAction, EPropertyLevel propertyLevel) |
| 123 : CompositeEditCommand(document) | 123 : CompositeEditCommand(document) |
| 124 , m_style(style->copy()) | 124 , m_style(style->copy()) |
| 125 , m_editingAction(editingAction) | 125 , m_editingAction(editingAction) |
| 126 , m_propertyLevel(propertyLevel) | 126 , m_propertyLevel(propertyLevel) |
| 127 , m_start(endingSelection().start().downstream()) | 127 , m_start(endingSelection().start().downstream()) |
| 128 , m_end(endingSelection().end().upstream()) | 128 , m_end(endingSelection().end().upstream()) |
| 129 , m_useEndingSelection(true) | 129 , m_useEndingSelection(true) |
| 130 , m_styledInlineElement(0) | |
| 131 , m_removeOnly(false) | 130 , m_removeOnly(false) |
| 132 , m_isInlineElementToRemoveFunction(0) | 131 , m_isInlineElementToRemoveFunction(0) |
| 133 { | 132 { |
| 134 } | 133 } |
| 135 | 134 |
| 136 ApplyStyleCommand::ApplyStyleCommand(const Handle<Document>& document, const Edi
tingStyle* style, const Position& start, const Position& end, EditAction editing
Action, EPropertyLevel propertyLevel) | 135 ApplyStyleCommand::ApplyStyleCommand(const Handle<Document>& document, const Edi
tingStyle* style, const Position& start, const Position& end, EditAction editing
Action, EPropertyLevel propertyLevel) |
| 137 : CompositeEditCommand(document) | 136 : CompositeEditCommand(document) |
| 138 , m_style(style->copy()) | 137 , m_style(style->copy()) |
| 139 , m_editingAction(editingAction) | 138 , m_editingAction(editingAction) |
| 140 , m_propertyLevel(propertyLevel) | 139 , m_propertyLevel(propertyLevel) |
| 141 , m_start(start) | 140 , m_start(start) |
| 142 , m_end(end) | 141 , m_end(end) |
| 143 , m_useEndingSelection(false) | 142 , m_useEndingSelection(false) |
| 144 , m_styledInlineElement(0) | |
| 145 , m_removeOnly(false) | 143 , m_removeOnly(false) |
| 146 , m_isInlineElementToRemoveFunction(0) | 144 , m_isInlineElementToRemoveFunction(0) |
| 147 { | 145 { |
| 148 } | 146 } |
| 149 | 147 |
| 150 ApplyStyleCommand::ApplyStyleCommand(const Handle<Element>& element, bool remove
Only, EditAction editingAction) | 148 ApplyStyleCommand::ApplyStyleCommand(const Handle<Element>& element, bool remove
Only, EditAction editingAction) |
| 151 : CompositeEditCommand(element->document()) | 149 : CompositeEditCommand(element->document()) |
| 152 , m_style(EditingStyle::create()) | 150 , m_style(EditingStyle::create()) |
| 153 , m_editingAction(editingAction) | 151 , m_editingAction(editingAction) |
| 154 , m_propertyLevel(PropertyDefault) | 152 , m_propertyLevel(PropertyDefault) |
| 155 , m_start(endingSelection().start().downstream()) | 153 , m_start(endingSelection().start().downstream()) |
| 156 , m_end(endingSelection().end().upstream()) | 154 , m_end(endingSelection().end().upstream()) |
| 157 , m_useEndingSelection(true) | 155 , m_useEndingSelection(true) |
| 158 , m_styledInlineElement(element) | 156 , m_styledInlineElement(element) |
| 159 , m_removeOnly(removeOnly) | 157 , m_removeOnly(removeOnly) |
| 160 , m_isInlineElementToRemoveFunction(0) | 158 , m_isInlineElementToRemoveFunction(0) |
| 161 { | 159 { |
| 162 } | 160 } |
| 163 | 161 |
| 164 ApplyStyleCommand::ApplyStyleCommand(const Handle<Document>& document, const Edi
tingStyle* style, IsInlineElementToRemoveFunction isInlineElementToRemoveFunctio
n, EditAction editingAction) | 162 ApplyStyleCommand::ApplyStyleCommand(const Handle<Document>& document, const Edi
tingStyle* style, IsInlineElementToRemoveFunction isInlineElementToRemoveFunctio
n, EditAction editingAction) |
| 165 : CompositeEditCommand(document) | 163 : CompositeEditCommand(document) |
| 166 , m_style(style->copy()) | 164 , m_style(style->copy()) |
| 167 , m_editingAction(editingAction) | 165 , m_editingAction(editingAction) |
| 168 , m_propertyLevel(PropertyDefault) | 166 , m_propertyLevel(PropertyDefault) |
| 169 , m_start(endingSelection().start().downstream()) | 167 , m_start(endingSelection().start().downstream()) |
| 170 , m_end(endingSelection().end().upstream()) | 168 , m_end(endingSelection().end().upstream()) |
| 171 , m_useEndingSelection(true) | 169 , m_useEndingSelection(true) |
| 172 , m_styledInlineElement(0) | |
| 173 , m_removeOnly(true) | 170 , m_removeOnly(true) |
| 174 , m_isInlineElementToRemoveFunction(isInlineElementToRemoveFunction) | 171 , m_isInlineElementToRemoveFunction(isInlineElementToRemoveFunction) |
| 175 { | 172 { |
| 176 } | 173 } |
| 177 | 174 |
| 178 void ApplyStyleCommand::updateStartEnd(const Position& newStart, const Position&
newEnd) | 175 void ApplyStyleCommand::updateStartEnd(const Position& newStart, const Position&
newEnd) |
| 179 { | 176 { |
| 180 ASSERT(comparePositions(newEnd, newStart) >= 0); | 177 ASSERT(comparePositions(newEnd, newStart) >= 0); |
| 181 | 178 |
| 182 if (!m_useEndingSelection && (newStart != m_start || newEnd != m_end)) | 179 if (!m_useEndingSelection && (newStart != m_start || newEnd != m_end)) |
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 String textToMove = nextText->data(); | 1565 String textToMove = nextText->data(); |
| 1569 insertTextIntoNode(childText, childText->length(), textToMove); | 1566 insertTextIntoNode(childText, childText->length(), textToMove); |
| 1570 removeNode(next.raw()); | 1567 removeNode(next.raw()); |
| 1571 // don't move child node pointer. it may want to merge with more text no
des. | 1568 // don't move child node pointer. it may want to merge with more text no
des. |
| 1572 } | 1569 } |
| 1573 | 1570 |
| 1574 updateStartEnd(newStart, newEnd); | 1571 updateStartEnd(newStart, newEnd); |
| 1575 } | 1572 } |
| 1576 | 1573 |
| 1577 } | 1574 } |
| OLD | NEW |