OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 412 } |
413 | 413 |
414 void CompositeEditCommand::updatePositionForNodeRemovalPreservingChildren(Positi
on& position, Node& node) | 414 void CompositeEditCommand::updatePositionForNodeRemovalPreservingChildren(Positi
on& position, Node& node) |
415 { | 415 { |
416 int offset = (position.anchorType() == Position::PositionIsOffsetInAnchor) ?
position.offsetInContainerNode() : 0; | 416 int offset = (position.anchorType() == Position::PositionIsOffsetInAnchor) ?
position.offsetInContainerNode() : 0; |
417 updatePositionForNodeRemoval(position, node); | 417 updatePositionForNodeRemoval(position, node); |
418 if (offset) | 418 if (offset) |
419 position.moveToOffset(offset); | 419 position.moveToOffset(offset); |
420 } | 420 } |
421 | 421 |
422 HTMLElement* CompositeEditCommand::replaceElementWithSpanPreservingChildrenAndAt
tributes(PassRefPtrWillBeRawPtr<HTMLElement> node) | 422 HTMLSpanElement* CompositeEditCommand::replaceElementWithSpanPreservingChildrenA
ndAttributes(PassRefPtrWillBeRawPtr<HTMLElement> node) |
423 { | 423 { |
424 // It would also be possible to implement all of ReplaceNodeWithSpanCommand | 424 // It would also be possible to implement all of ReplaceNodeWithSpanCommand |
425 // as a series of existing smaller edit commands. Someone who wanted to | 425 // as a series of existing smaller edit commands. Someone who wanted to |
426 // reduce the number of edit commands could do so here. | 426 // reduce the number of edit commands could do so here. |
427 RefPtrWillBeRawPtr<ReplaceNodeWithSpanCommand> command = ReplaceNodeWithSpan
Command::create(node); | 427 RefPtrWillBeRawPtr<ReplaceNodeWithSpanCommand> command = ReplaceNodeWithSpan
Command::create(node); |
428 applyCommandToComposite(command); | 428 applyCommandToComposite(command); |
429 // Returning a raw pointer here is OK because the command is retained by | 429 // Returning a raw pointer here is OK because the command is retained by |
430 // applyCommandToComposite (thus retaining the span), and the span is also | 430 // applyCommandToComposite (thus retaining the span), and the span is also |
431 // in the DOM tree, and thus alive whie it has a parent. | 431 // in the DOM tree, and thus alive whie it has a parent. |
432 ASSERT(command->spanElement()->inDocument()); | 432 ASSERT(command->spanElement()->inDocument()); |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 } | 1499 } |
1500 | 1500 |
1501 void CompositeEditCommand::trace(Visitor* visitor) | 1501 void CompositeEditCommand::trace(Visitor* visitor) |
1502 { | 1502 { |
1503 visitor->trace(m_commands); | 1503 visitor->trace(m_commands); |
1504 visitor->trace(m_composition); | 1504 visitor->trace(m_composition); |
1505 EditCommand::trace(visitor); | 1505 EditCommand::trace(visitor); |
1506 } | 1506 } |
1507 | 1507 |
1508 } // namespace blink | 1508 } // namespace blink |
OLD | NEW |