| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2008 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 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "core/editing/commands/SetNodeAttributeCommand.h" | 26 #include "core/editing/commands/SetNodeAttributeCommand.h" |
| 27 | 27 |
| 28 #include "core/dom/Element.h" | 28 #include "core/dom/Element.h" |
| 29 #include "wtf/Assertions.h" | 29 #include "wtf/Assertions.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 SetNodeAttributeCommand::SetNodeAttributeCommand(PassRefPtrWillBeRawPtr<Element>
element, | 33 SetNodeAttributeCommand::SetNodeAttributeCommand(RawPtr<Element> element, |
| 34 const QualifiedName& attribute, const AtomicString& value) | 34 const QualifiedName& attribute, const AtomicString& value) |
| 35 : SimpleEditCommand(element->document()) | 35 : SimpleEditCommand(element->document()) |
| 36 , m_element(element) | 36 , m_element(element) |
| 37 , m_attribute(attribute) | 37 , m_attribute(attribute) |
| 38 , m_value(value) | 38 , m_value(value) |
| 39 { | 39 { |
| 40 ASSERT(m_element); | 40 ASSERT(m_element); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void SetNodeAttributeCommand::doApply(EditingState*) | 43 void SetNodeAttributeCommand::doApply(EditingState*) |
| 44 { | 44 { |
| 45 m_oldValue = m_element->getAttribute(m_attribute); | 45 m_oldValue = m_element->getAttribute(m_attribute); |
| 46 m_element->setAttribute(m_attribute, m_value); | 46 m_element->setAttribute(m_attribute, m_value); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void SetNodeAttributeCommand::doUnapply() | 49 void SetNodeAttributeCommand::doUnapply() |
| 50 { | 50 { |
| 51 m_element->setAttribute(m_attribute, m_oldValue); | 51 m_element->setAttribute(m_attribute, m_oldValue); |
| 52 m_oldValue = nullAtom; | 52 m_oldValue = nullAtom; |
| 53 } | 53 } |
| 54 | 54 |
| 55 DEFINE_TRACE(SetNodeAttributeCommand) | 55 DEFINE_TRACE(SetNodeAttributeCommand) |
| 56 { | 56 { |
| 57 visitor->trace(m_element); | 57 visitor->trace(m_element); |
| 58 SimpleEditCommand::trace(visitor); | 58 SimpleEditCommand::trace(visitor); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |