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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.h

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) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 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 28 matching lines...) Expand all
39 enum ShouldIncludeTypingStyle { IncludeTypingStyle, IgnoreTypingStyle }; 39 enum ShouldIncludeTypingStyle { IncludeTypingStyle, IgnoreTypingStyle };
40 40
41 class CORE_EXPORT ApplyStyleCommand final : public CompositeEditCommand { 41 class CORE_EXPORT ApplyStyleCommand final : public CompositeEditCommand {
42 public: 42 public:
43 enum EPropertyLevel { PropertyDefault, ForceBlockProperties }; 43 enum EPropertyLevel { PropertyDefault, ForceBlockProperties };
44 enum InlineStyleRemovalMode { RemoveIfNeeded, RemoveAlways, RemoveNone }; 44 enum InlineStyleRemovalMode { RemoveIfNeeded, RemoveAlways, RemoveNone };
45 enum EAddStyledElement { AddStyledElement, DoNotAddStyledElement }; 45 enum EAddStyledElement { AddStyledElement, DoNotAddStyledElement };
46 typedef bool (*IsInlineElementToRemoveFunction)(const Element*); 46 typedef bool (*IsInlineElementToRemoveFunction)(const Element*);
47 47
48 static ApplyStyleCommand* create(Document& document, 48 static ApplyStyleCommand* create(Document& document,
49 EditCommandSource source,
49 const EditingStyle* style, 50 const EditingStyle* style,
50 InputEvent::InputType inputType, 51 InputEvent::InputType inputType,
51 EPropertyLevel level = PropertyDefault) { 52 EPropertyLevel level = PropertyDefault) {
52 return new ApplyStyleCommand(document, style, inputType, level); 53 return new ApplyStyleCommand(document, source, style, inputType, level);
53 } 54 }
54 static ApplyStyleCommand* create(Document& document, 55 static ApplyStyleCommand* create(Document& document,
55 const EditingStyle* style, 56 const EditingStyle* style,
56 const Position& start, 57 const Position& start,
57 const Position& end) { 58 const Position& end) {
58 return new ApplyStyleCommand(document, style, start, end); 59 return new ApplyStyleCommand(document, style, start, end);
59 } 60 }
60 static ApplyStyleCommand* create(Element* element, bool removeOnly) { 61 static ApplyStyleCommand* create(Element* element, bool removeOnly) {
61 return new ApplyStyleCommand(element, removeOnly); 62 return new ApplyStyleCommand(element, removeOnly);
62 } 63 }
63 static ApplyStyleCommand* create( 64 static ApplyStyleCommand* create(
64 Document& document, 65 Document& document,
65 const EditingStyle* style, 66 const EditingStyle* style,
66 IsInlineElementToRemoveFunction isInlineElementToRemoveFunction, 67 IsInlineElementToRemoveFunction isInlineElementToRemoveFunction,
67 InputEvent::InputType inputType) { 68 InputEvent::InputType inputType) {
68 return new ApplyStyleCommand(document, style, 69 return new ApplyStyleCommand(document, style,
69 isInlineElementToRemoveFunction, inputType); 70 isInlineElementToRemoveFunction, inputType);
70 } 71 }
71 72
72 DECLARE_VIRTUAL_TRACE(); 73 DECLARE_VIRTUAL_TRACE();
73 74
74 private: 75 private:
75 ApplyStyleCommand(Document&, 76 ApplyStyleCommand(Document&,
77 EditCommandSource,
76 const EditingStyle*, 78 const EditingStyle*,
77 InputEvent::InputType, 79 InputEvent::InputType,
78 EPropertyLevel); 80 EPropertyLevel);
79 ApplyStyleCommand(Document&, 81 ApplyStyleCommand(Document&,
80 const EditingStyle*, 82 const EditingStyle*,
81 const Position& start, 83 const Position& start,
82 const Position& end); 84 const Position& end);
83 ApplyStyleCommand(Element*, bool removeOnly); 85 ApplyStyleCommand(Element*, bool removeOnly);
84 ApplyStyleCommand(Document&, 86 ApplyStyleCommand(Document&,
85 const EditingStyle*, 87 const EditingStyle*,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 StyleAttributeShouldBeEmpty 210 StyleAttributeShouldBeEmpty
209 }; 211 };
210 bool isEmptyFontTag(const Element*, 212 bool isEmptyFontTag(const Element*,
211 ShouldStyleAttributeBeEmpty = StyleAttributeShouldBeEmpty); 213 ShouldStyleAttributeBeEmpty = StyleAttributeShouldBeEmpty);
212 bool isLegacyAppleHTMLSpanElement(const Node*); 214 bool isLegacyAppleHTMLSpanElement(const Node*);
213 bool isStyleSpanOrSpanWithOnlyStyleAttribute(const Element*); 215 bool isStyleSpanOrSpanWithOnlyStyleAttribute(const Element*);
214 216
215 } // namespace blink 217 } // namespace blink
216 218
217 #endif 219 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698