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

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

Issue 2685783004: Add EditingStyleUtitilies.{cpp,h} to BUILD.gn (Closed)
Patch Set: keep the original copyright comment Created 3 years, 10 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple 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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 static bool elementIsStyledSpanOrHTMLEquivalent(const HTMLElement*); 141 static bool elementIsStyledSpanOrHTMLEquivalent(const HTMLElement*);
142 142
143 void prepareToApplyAt( 143 void prepareToApplyAt(
144 const Position&, 144 const Position&,
145 ShouldPreserveWritingDirection = DoNotPreserveWritingDirection); 145 ShouldPreserveWritingDirection = DoNotPreserveWritingDirection);
146 void mergeTypingStyle(Document*); 146 void mergeTypingStyle(Document*);
147 enum CSSPropertyOverrideMode { OverrideValues, DoNotOverrideValues }; 147 enum CSSPropertyOverrideMode { OverrideValues, DoNotOverrideValues };
148 void mergeInlineStyleOfElement(HTMLElement*, 148 void mergeInlineStyleOfElement(HTMLElement*,
149 CSSPropertyOverrideMode, 149 CSSPropertyOverrideMode,
150 PropertiesToInclude = AllProperties); 150 PropertiesToInclude = AllProperties);
151 void mergeInlineAndImplicitStyleOfElement(Element*,
152 CSSPropertyOverrideMode,
153 PropertiesToInclude);
151 static EditingStyle* wrappingStyleForAnnotatedSerialization( 154 static EditingStyle* wrappingStyleForAnnotatedSerialization(
152 ContainerNode* context); 155 ContainerNode* context);
153 static EditingStyle* wrappingStyleForSerialization(ContainerNode* context); 156 static EditingStyle* wrappingStyleForSerialization(ContainerNode* context);
154 void mergeStyleFromRules(Element*); 157 void mergeStyleFromRules(Element*);
155 void mergeStyleFromRulesForSerialization(Element*); 158 void mergeStyleFromRulesForSerialization(Element*);
156 void removeStyleFromRulesAndContext(Element*, ContainerNode* context); 159 void removeStyleFromRulesAndContext(Element*, ContainerNode* context);
157 void removePropertiesInElementDefaultStyle(Element*); 160 void removePropertiesInElementDefaultStyle(Element*);
158 void addAbsolutePositioningFromElement(const Element&); 161 void addAbsolutePositioningFromElement(const Element&);
159 void forceInline(); 162 void forceInline();
160 int legacyFontSize(Document*) const; 163 int legacyFontSize(Document*) const;
161 164
162 float fontSizeDelta() const { return m_fontSizeDelta; } 165 float fontSizeDelta() const { return m_fontSizeDelta; }
163 bool hasFontSizeDelta() const { return m_fontSizeDelta != NoFontDelta; } 166 bool hasFontSizeDelta() const { return m_fontSizeDelta != NoFontDelta; }
164 167
168 void setProperty(CSSPropertyID, const String& value, bool important = false);
169
165 static EditingStyle* styleAtSelectionStart( 170 static EditingStyle* styleAtSelectionStart(
166 const VisibleSelection&, 171 const VisibleSelection&,
167 bool shouldUseBackgroundColorInEffect = false, 172 bool shouldUseBackgroundColorInEffect = false,
168 MutableStylePropertySet* styleToCheck = nullptr); 173 MutableStylePropertySet* styleToCheck = nullptr);
169 static WritingDirection textDirectionForSelection( 174 static WritingDirection textDirectionForSelection(
170 const VisibleSelection&, 175 const VisibleSelection&,
171 EditingStyle* typingStyle, 176 EditingStyle* typingStyle,
172 bool& hasNestedOrMultipleEmbeddings); 177 bool& hasNestedOrMultipleEmbeddings);
173 static bool isEmbedOrIsolate(CSSValueID unicodeBidi) { 178 static bool isEmbedOrIsolate(CSSValueID unicodeBidi) {
174 return unicodeBidi == CSSValueIsolate || 179 return unicodeBidi == CSSValueIsolate ||
175 unicodeBidi == CSSValueWebkitIsolate || unicodeBidi == CSSValueEmbed; 180 unicodeBidi == CSSValueWebkitIsolate || unicodeBidi == CSSValueEmbed;
176 } 181 }
177 182
178 DECLARE_TRACE(); 183 DECLARE_TRACE();
179 184
180 private: 185 private:
181 EditingStyle() = default; 186 EditingStyle() = default;
182 EditingStyle(ContainerNode*, PropertiesToInclude); 187 EditingStyle(ContainerNode*, PropertiesToInclude);
183 EditingStyle(const Position&, PropertiesToInclude); 188 EditingStyle(const Position&, PropertiesToInclude);
184 explicit EditingStyle(const StylePropertySet*); 189 explicit EditingStyle(const StylePropertySet*);
185 EditingStyle(CSSPropertyID, const String& value); 190 EditingStyle(CSSPropertyID, const String& value);
186 void init(Node*, PropertiesToInclude); 191 void init(Node*, PropertiesToInclude);
187 void removeInheritedColorsIfNeeded(const ComputedStyle*); 192 void removeInheritedColorsIfNeeded(const ComputedStyle*);
188 void setProperty(CSSPropertyID, const String& value, bool important = false);
189 void replaceFontSizeByKeywordIfPossible(const ComputedStyle*, 193 void replaceFontSizeByKeywordIfPossible(const ComputedStyle*,
190 CSSComputedStyleDeclaration*); 194 CSSComputedStyleDeclaration*);
191 void extractFontSizeDelta(); 195 void extractFontSizeDelta();
192 TriState triStateOfStyle(CSSStyleDeclaration* styleToCompare, 196 TriState triStateOfStyle(CSSStyleDeclaration* styleToCompare,
193 ShouldIgnoreTextOnlyProperties) const; 197 ShouldIgnoreTextOnlyProperties) const;
194 bool conflictsWithInlineStyleOfElement( 198 bool conflictsWithInlineStyleOfElement(
195 HTMLElement*, 199 HTMLElement*,
196 EditingStyle* extractedStyle, 200 EditingStyle* extractedStyle,
197 Vector<CSSPropertyID>* conflictingProperties) const; 201 Vector<CSSPropertyID>* conflictingProperties) const;
198 void mergeInlineAndImplicitStyleOfElement(Element*,
199 CSSPropertyOverrideMode,
200 PropertiesToInclude);
201 void mergeStyle(const StylePropertySet*, CSSPropertyOverrideMode); 202 void mergeStyle(const StylePropertySet*, CSSPropertyOverrideMode);
202 203
203 Member<MutableStylePropertySet> m_mutableStyle; 204 Member<MutableStylePropertySet> m_mutableStyle;
204 bool m_isMonospaceFont = false; 205 bool m_isMonospaceFont = false;
205 float m_fontSizeDelta = NoFontDelta; 206 float m_fontSizeDelta = NoFontDelta;
206 bool m_isVerticalAlign = false; 207 bool m_isVerticalAlign = false;
207 208
208 friend class HTMLElementEquivalent; 209 friend class HTMLElementEquivalent;
209 friend class HTMLAttributeEquivalent; 210 friend class HTMLAttributeEquivalent;
210 }; 211 };
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 }; 270 };
270 271
271 // FIXME: Remove these functions or make them non-global to discourage using 272 // FIXME: Remove these functions or make them non-global to discourage using
272 // CSSStyleDeclaration directly. 273 // CSSStyleDeclaration directly.
273 CSSValueID getIdentifierValue(CSSStyleDeclaration*, CSSPropertyID); 274 CSSValueID getIdentifierValue(CSSStyleDeclaration*, CSSPropertyID);
274 CSSValueID getIdentifierValue(StylePropertySet*, CSSPropertyID); 275 CSSValueID getIdentifierValue(StylePropertySet*, CSSPropertyID);
275 276
276 } // namespace blink 277 } // namespace blink
277 278
278 #endif // EditingStyle_h 279 #endif // EditingStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/BUILD.gn ('k') | third_party/WebKit/Source/core/editing/EditingStyleUtilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698