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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp

Issue 2627103003: [EditCommandSource] Pass source through |CompositeEditCommand| ctor instead of |apply(source)| (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 25 matching lines...) Expand all
36 #include "core/html/HTMLBRElement.h" 36 #include "core/html/HTMLBRElement.h"
37 #include "core/html/HTMLElement.h" 37 #include "core/html/HTMLElement.h"
38 #include "core/style/ComputedStyle.h" 38 #include "core/style/ComputedStyle.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 using namespace HTMLNames; 42 using namespace HTMLNames;
43 43
44 ApplyBlockElementCommand::ApplyBlockElementCommand( 44 ApplyBlockElementCommand::ApplyBlockElementCommand(
45 Document& document, 45 Document& document,
46 EditCommandSource source,
46 const QualifiedName& tagName, 47 const QualifiedName& tagName,
47 const AtomicString& inlineStyle) 48 const AtomicString& inlineStyle)
48 : CompositeEditCommand(document), 49 : CompositeEditCommand(document, source),
49 m_tagName(tagName), 50 m_tagName(tagName),
50 m_inlineStyle(inlineStyle) {} 51 m_inlineStyle(inlineStyle) {}
51 52
52 ApplyBlockElementCommand::ApplyBlockElementCommand(Document& document, 53 ApplyBlockElementCommand::ApplyBlockElementCommand(Document& document,
54 EditCommandSource source,
53 const QualifiedName& tagName) 55 const QualifiedName& tagName)
54 : CompositeEditCommand(document), m_tagName(tagName) {} 56 : CompositeEditCommand(document, source), m_tagName(tagName) {}
55 57
56 void ApplyBlockElementCommand::doApply(EditingState* editingState) { 58 void ApplyBlockElementCommand::doApply(EditingState* editingState) {
57 if (!endingSelection().rootEditableElement()) 59 if (!endingSelection().rootEditableElement())
58 return; 60 return;
59 61
60 // ApplyBlockElementCommands are only created directly by editor commands' 62 // ApplyBlockElementCommands are only created directly by editor commands'
61 // execution, which updates layout before entering doApply(). 63 // execution, which updates layout before entering doApply().
62 DCHECK(!document().needsLayoutTreeUpdate()); 64 DCHECK(!document().needsLayoutTreeUpdate());
63 65
64 VisiblePosition visibleEnd = endingSelection().visibleEnd(); 66 VisiblePosition visibleEnd = endingSelection().visibleEnd();
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 404 }
403 405
404 HTMLElement* ApplyBlockElementCommand::createBlockElement() const { 406 HTMLElement* ApplyBlockElementCommand::createBlockElement() const {
405 HTMLElement* element = createHTMLElement(document(), m_tagName); 407 HTMLElement* element = createHTMLElement(document(), m_tagName);
406 if (m_inlineStyle.length()) 408 if (m_inlineStyle.length())
407 element->setAttribute(styleAttr, m_inlineStyle); 409 element->setAttribute(styleAttr, m_inlineStyle);
408 return element; 410 return element;
409 } 411 }
410 412
411 } // namespace blink 413 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698