Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: Source/core/editing/CompositeEditCommand.cpp

Issue 430843002: Use tighter typing in editing: PlainTextRange / ReplaceNodeWithSpanCommand (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/CompositeEditCommand.h ('k') | Source/core/editing/PlainTextRange.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/editing/CompositeEditCommand.h ('k') | Source/core/editing/PlainTextRange.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698