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

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

Issue 420053002: Use tighter typing in editing: DeleteSelectionCommand (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 | « no previous file | Source/core/editing/DeleteSelectionCommand.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "core/editing/SplitTextNodeCommand.h" 57 #include "core/editing/SplitTextNodeCommand.h"
58 #include "core/editing/SplitTextNodeContainingElementCommand.h" 58 #include "core/editing/SplitTextNodeContainingElementCommand.h"
59 #include "core/editing/TextIterator.h" 59 #include "core/editing/TextIterator.h"
60 #include "core/editing/VisibleUnits.h" 60 #include "core/editing/VisibleUnits.h"
61 #include "core/editing/WrapContentsInDummySpanCommand.h" 61 #include "core/editing/WrapContentsInDummySpanCommand.h"
62 #include "core/editing/htmlediting.h" 62 #include "core/editing/htmlediting.h"
63 #include "core/editing/markup.h" 63 #include "core/editing/markup.h"
64 #include "core/events/ScopedEventQueue.h" 64 #include "core/events/ScopedEventQueue.h"
65 #include "core/frame/LocalFrame.h" 65 #include "core/frame/LocalFrame.h"
66 #include "core/html/HTMLBRElement.h" 66 #include "core/html/HTMLBRElement.h"
67 #include "core/html/HTMLDivElement.h"
67 #include "core/html/HTMLElement.h" 68 #include "core/html/HTMLElement.h"
68 #include "core/html/HTMLSpanElement.h" 69 #include "core/html/HTMLSpanElement.h"
69 #include "core/rendering/InlineTextBox.h" 70 #include "core/rendering/InlineTextBox.h"
70 #include "core/rendering/RenderBlock.h" 71 #include "core/rendering/RenderBlock.h"
71 #include "core/rendering/RenderListItem.h" 72 #include "core/rendering/RenderListItem.h"
72 #include "core/rendering/RenderText.h" 73 #include "core/rendering/RenderText.h"
73 74
74 namespace blink { 75 namespace blink {
75 76
76 using namespace HTMLNames; 77 using namespace HTMLNames;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 { 287 {
287 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea)); 288 applyCommandToComposite(InsertParagraphSeparatorCommand::create(document(), useDefaultParagraphElement, pasteBlockqutoeIntoUnquotedArea));
288 } 289 }
289 290
290 bool CompositeEditCommand::isRemovableBlock(const Node* node) 291 bool CompositeEditCommand::isRemovableBlock(const Node* node)
291 { 292 {
292 ASSERT(node); 293 ASSERT(node);
293 if (!isHTMLDivElement(*node)) 294 if (!isHTMLDivElement(*node))
294 return false; 295 return false;
295 296
296 ContainerNode* parentNode = node->parentNode(); 297 const HTMLDivElement& element = toHTMLDivElement(*node);
298 ContainerNode* parentNode = element.parentNode();
297 if (parentNode && parentNode->firstChild() != parentNode->lastChild()) 299 if (parentNode && parentNode->firstChild() != parentNode->lastChild())
298 return false; 300 return false;
299 301
300 if (!toElement(node)->hasAttributes()) 302 if (!element.hasAttributes())
301 return true; 303 return true;
302 304
303 return false; 305 return false;
304 } 306 }
305 307
306 void CompositeEditCommand::insertNodeBefore(PassRefPtrWillBeRawPtr<Node> insertC hild, PassRefPtrWillBeRawPtr<Node> refChild, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable) 308 void CompositeEditCommand::insertNodeBefore(PassRefPtrWillBeRawPtr<Node> insertC hild, PassRefPtrWillBeRawPtr<Node> refChild, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
307 { 309 {
308 ASSERT(!isHTMLBodyElement(*refChild)); 310 ASSERT(!isHTMLBodyElement(*refChild));
309 applyCommandToComposite(InsertNodeBeforeCommand::create(insertChild, refChil d, shouldAssumeContentIsAlwaysEditable)); 311 applyCommandToComposite(InsertNodeBeforeCommand::create(insertChild, refChil d, shouldAssumeContentIsAlwaysEditable));
310 } 312 }
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 } 1497 }
1496 1498
1497 void CompositeEditCommand::trace(Visitor* visitor) 1499 void CompositeEditCommand::trace(Visitor* visitor)
1498 { 1500 {
1499 visitor->trace(m_commands); 1501 visitor->trace(m_commands);
1500 visitor->trace(m_composition); 1502 visitor->trace(m_composition);
1501 EditCommand::trace(visitor); 1503 EditCommand::trace(visitor);
1502 } 1504 }
1503 1505
1504 } // namespace blink 1506 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/DeleteSelectionCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698