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

Side by Side Diff: Source/core/editing/ApplyStyleCommand.h

Issue 418223004: Use tighter typing in editing/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Clean up Created 6 years, 5 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/ApplyStyleCommand.cpp » ('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, 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 16 matching lines...) Expand all
27 #define ApplyStyleCommand_h 27 #define ApplyStyleCommand_h
28 28
29 #include "core/editing/CompositeEditCommand.h" 29 #include "core/editing/CompositeEditCommand.h"
30 #include "core/editing/WritingDirection.h" 30 #include "core/editing/WritingDirection.h"
31 #include "core/html/HTMLElement.h" 31 #include "core/html/HTMLElement.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class CSSPrimitiveValue; 35 class CSSPrimitiveValue;
36 class EditingStyle; 36 class EditingStyle;
37 class HTMLSpanElement;
37 class StyleChange; 38 class StyleChange;
38 39
39 enum ShouldIncludeTypingStyle { 40 enum ShouldIncludeTypingStyle {
40 IncludeTypingStyle, 41 IncludeTypingStyle,
41 IgnoreTypingStyle 42 IgnoreTypingStyle
42 }; 43 };
43 44
44 class ApplyStyleCommand FINAL : public CompositeEditCommand { 45 class ApplyStyleCommand FINAL : public CompositeEditCommand {
45 public: 46 public:
46 enum EPropertyLevel { PropertyDefault, ForceBlockProperties }; 47 enum EPropertyLevel { PropertyDefault, ForceBlockProperties };
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void removeConflictingInlineStyleFromRun(EditingStyle*, RefPtrWillBeMember<N ode>& runStart, RefPtrWillBeMember<Node>& runEnd, PassRefPtrWillBeRawPtr<Node> p astEndNode); 83 void removeConflictingInlineStyleFromRun(EditingStyle*, RefPtrWillBeMember<N ode>& runStart, RefPtrWillBeMember<Node>& runEnd, PassRefPtrWillBeRawPtr<Node> p astEndNode);
83 bool removeInlineStyleFromElement(EditingStyle*, PassRefPtrWillBeRawPtr<HTML Element>, InlineStyleRemovalMode = RemoveIfNeeded, EditingStyle* extractedStyle = 0); 84 bool removeInlineStyleFromElement(EditingStyle*, PassRefPtrWillBeRawPtr<HTML Element>, InlineStyleRemovalMode = RemoveIfNeeded, EditingStyle* extractedStyle = 0);
84 inline bool shouldRemoveInlineStyleFromElement(EditingStyle* style, HTMLElem ent* element) {return removeInlineStyleFromElement(style, element, RemoveNone);} 85 inline bool shouldRemoveInlineStyleFromElement(EditingStyle* style, HTMLElem ent* element) {return removeInlineStyleFromElement(style, element, RemoveNone);}
85 void replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*); 86 void replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*);
86 bool removeImplicitlyStyledElement(EditingStyle*, HTMLElement*, InlineStyleR emovalMode, EditingStyle* extractedStyle); 87 bool removeImplicitlyStyledElement(EditingStyle*, HTMLElement*, InlineStyleR emovalMode, EditingStyle* extractedStyle);
87 bool removeCSSStyle(EditingStyle*, HTMLElement*, InlineStyleRemovalMode = Re moveIfNeeded, EditingStyle* extractedStyle = 0); 88 bool removeCSSStyle(EditingStyle*, HTMLElement*, InlineStyleRemovalMode = Re moveIfNeeded, EditingStyle* extractedStyle = 0);
88 HTMLElement* highestAncestorWithConflictingInlineStyle(EditingStyle*, Node*) ; 89 HTMLElement* highestAncestorWithConflictingInlineStyle(EditingStyle*, Node*) ;
89 void applyInlineStyleToPushDown(Node*, EditingStyle*); 90 void applyInlineStyleToPushDown(Node*, EditingStyle*);
90 void pushDownInlineStyleAroundNode(EditingStyle*, Node*); 91 void pushDownInlineStyleAroundNode(EditingStyle*, Node*);
91 void removeInlineStyle(EditingStyle* , const Position& start, const Position & end); 92 void removeInlineStyle(EditingStyle* , const Position& start, const Position & end);
92 bool nodeFullySelected(Node*, const Position& start, const Position& end) co nst; 93 bool elementFullySelected(HTMLElement&, const Position& start, const Positio n& end) const;
93 94
94 // style-application helpers 95 // style-application helpers
95 void applyBlockStyle(EditingStyle*); 96 void applyBlockStyle(EditingStyle*);
96 void applyRelativeFontStyleChange(EditingStyle*); 97 void applyRelativeFontStyleChange(EditingStyle*);
97 void applyInlineStyle(EditingStyle*); 98 void applyInlineStyle(EditingStyle*);
98 void fixRangeAndApplyInlineStyle(EditingStyle*, const Position& start, const Position& end); 99 void fixRangeAndApplyInlineStyle(EditingStyle*, const Position& start, const Position& end);
99 void applyInlineStyleToNodeRange(EditingStyle*, PassRefPtrWillBeRawPtr<Node> startNode, PassRefPtrWillBeRawPtr<Node> pastEndNode); 100 void applyInlineStyleToNodeRange(EditingStyle*, PassRefPtrWillBeRawPtr<Node> startNode, PassRefPtrWillBeRawPtr<Node> pastEndNode);
100 void addBlockStyle(const StyleChange&, HTMLElement*); 101 void addBlockStyle(const StyleChange&, HTMLElement*);
101 void addInlineStyleIfNeeded(EditingStyle*, PassRefPtrWillBeRawPtr<Node> star t, PassRefPtrWillBeRawPtr<Node> end, EAddStyledElement = AddStyledElement); 102 void addInlineStyleIfNeeded(EditingStyle*, PassRefPtrWillBeRawPtr<Node> star t, PassRefPtrWillBeRawPtr<Node> end, EAddStyledElement = AddStyledElement);
102 Position positionToComputeInlineStyleChange(PassRefPtrWillBeRawPtr<Node>, Re fPtrWillBeMember<Node>& dummyElement); 103 Position positionToComputeInlineStyleChange(PassRefPtrWillBeRawPtr<Node>, Re fPtrWillBeMember<HTMLSpanElement>& dummyElement);
103 void applyInlineStyleChange(PassRefPtrWillBeRawPtr<Node> startNode, PassRefP trWillBeRawPtr<Node> endNode, StyleChange&, EAddStyledElement); 104 void applyInlineStyleChange(PassRefPtrWillBeRawPtr<Node> startNode, PassRefP trWillBeRawPtr<Node> endNode, StyleChange&, EAddStyledElement);
104 void splitTextAtStart(const Position& start, const Position& end); 105 void splitTextAtStart(const Position& start, const Position& end);
105 void splitTextAtEnd(const Position& start, const Position& end); 106 void splitTextAtEnd(const Position& start, const Position& end);
106 void splitTextElementAtStart(const Position& start, const Position& end); 107 void splitTextElementAtStart(const Position& start, const Position& end);
107 void splitTextElementAtEnd(const Position& start, const Position& end); 108 void splitTextElementAtEnd(const Position& start, const Position& end);
108 bool shouldSplitTextElement(Element*, EditingStyle*); 109 bool shouldSplitTextElement(Element*, EditingStyle*);
109 bool isValidCaretPositionInTextNode(const Position& position); 110 bool isValidCaretPositionInTextNode(const Position& position);
110 bool mergeStartWithPreviousIfIdentical(const Position& start, const Position & end); 111 bool mergeStartWithPreviousIfIdentical(const Position& start, const Position & end);
111 bool mergeEndWithNextIfIdentical(const Position& start, const Position& end) ; 112 bool mergeEndWithNextIfIdentical(const Position& start, const Position& end) ;
112 void cleanupUnstyledAppleStyleSpans(ContainerNode* dummySpanAncestor); 113 void cleanupUnstyledAppleStyleSpans(ContainerNode* dummySpanAncestor);
113 114
114 void surroundNodeRangeWithElement(PassRefPtrWillBeRawPtr<Node> start, PassRe fPtrWillBeRawPtr<Node> end, PassRefPtrWillBeRawPtr<Element>); 115 void surroundNodeRangeWithElement(PassRefPtrWillBeRawPtr<Node> start, PassRe fPtrWillBeRawPtr<Node> end, PassRefPtrWillBeRawPtr<Element>);
115 float computedFontSize(Node*); 116 float computedFontSize(Node*);
116 void joinChildTextNodes(ContainerNode*, const Position& start, const Positio n& end); 117 void joinChildTextNodes(ContainerNode*, const Position& start, const Positio n& end);
117 118
118 HTMLElement* splitAncestorsWithUnicodeBidi(Node*, bool before, WritingDirect ion allowedDirection); 119 HTMLElement* splitAncestorsWithUnicodeBidi(Node*, bool before, WritingDirect ion allowedDirection);
119 void removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsplitAncestor); 120 void removeEmbeddingUpToEnclosingBlock(Node*, HTMLElement* unsplitAncestor);
120 121
121 void updateStartEnd(const Position& newStart, const Position& newEnd); 122 void updateStartEnd(const Position& newStart, const Position& newEnd);
122 Position startPosition(); 123 Position startPosition();
123 Position endPosition(); 124 Position endPosition();
124 125
125 RefPtrWillBeMember<EditingStyle> m_style; 126 RefPtrWillBeMember<EditingStyle> m_style;
126 EditAction m_editingAction; 127 EditAction m_editingAction;
127 EPropertyLevel m_propertyLevel; 128 EPropertyLevel m_propertyLevel;
128 Position m_start; 129 Position m_start;
129 Position m_end; 130 Position m_end;
130 bool m_useEndingSelection; 131 bool m_useEndingSelection;
131 RefPtrWillBeMember<Element> m_styledInlineElement; 132 RefPtrWillBeMember<Element> m_styledInlineElement;
132 bool m_removeOnly; 133 bool m_removeOnly;
133 IsInlineElementToRemoveFunction m_isInlineElementToRemoveFunction; 134 IsInlineElementToRemoveFunction m_isInlineElementToRemoveFunction;
134 }; 135 };
135 136
136 enum ShouldStyleAttributeBeEmpty { AllowNonEmptyStyleAttribute, StyleAttributeSh ouldBeEmpty }; 137 enum ShouldStyleAttributeBeEmpty { AllowNonEmptyStyleAttribute, StyleAttributeSh ouldBeEmpty };
137 bool isEmptyFontTag(const Element*, ShouldStyleAttributeBeEmpty = StyleAttribute ShouldBeEmpty); 138 bool isEmptyFontTag(const Element*, ShouldStyleAttributeBeEmpty = StyleAttribute ShouldBeEmpty);
138 bool isLegacyAppleStyleSpan(const Node*); 139 bool isLegacyAppleStyleSpan(const Node*);
139 bool isStyleSpanOrSpanWithOnlyStyleAttribute(const Element*); 140 bool isStyleSpanOrSpanWithOnlyStyleAttribute(const Element*);
140 PassRefPtrWillBeRawPtr<HTMLElement> createStyleSpanElement(Document&); 141 PassRefPtrWillBeRawPtr<HTMLSpanElement> createStyleSpanElement(Document&);
141 142
142 } // namespace blink 143 } // namespace blink
143 144
144 #endif 145 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/ApplyStyleCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698