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

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

Issue 2628943009: Introduce EditingStyleUtilities.{cpp,h} (Closed)
Patch Set: add STATIC_ONLY 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) 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 static EditingStyle* wrappingStyleForAnnotatedSerialization( 151 void mergeInlineAndImplicitStyleOfElement(Element*,
152 ContainerNode* context); 152 CSSPropertyOverrideMode,
153 static EditingStyle* wrappingStyleForSerialization(ContainerNode* context); 153 PropertiesToInclude);
154 void mergeStyleFromRules(Element*); 154 void mergeStyleFromRules(Element*);
155 void mergeStyleFromRulesForSerialization(Element*); 155 void mergeStyleFromRulesForSerialization(Element*);
156 void removeStyleFromRulesAndContext(Element*, ContainerNode* context); 156 void removeStyleFromRulesAndContext(Element*, ContainerNode* context);
157 void removePropertiesInElementDefaultStyle(Element*); 157 void removePropertiesInElementDefaultStyle(Element*);
158 void addAbsolutePositioningFromElement(const Element&); 158 void addAbsolutePositioningFromElement(const Element&);
159 void forceInline(); 159 void forceInline();
160 int legacyFontSize(Document*) const; 160 int legacyFontSize(Document*) const;
161 161
162 float fontSizeDelta() const { return m_fontSizeDelta; } 162 float fontSizeDelta() const { return m_fontSizeDelta; }
163 bool hasFontSizeDelta() const { return m_fontSizeDelta != NoFontDelta; } 163 bool hasFontSizeDelta() const { return m_fontSizeDelta != NoFontDelta; }
164 164 void setProperty(CSSPropertyID, const String& value, bool important = false);
165 static EditingStyle* styleAtSelectionStart(
166 const VisibleSelection&,
167 bool shouldUseBackgroundColorInEffect = false,
168 MutableStylePropertySet* styleToCheck = nullptr);
169 static WritingDirection textDirectionForSelection(
170 const VisibleSelection&,
171 EditingStyle* typingStyle,
172 bool& hasNestedOrMultipleEmbeddings);
173 static bool isEmbedOrIsolate(CSSValueID unicodeBidi) {
174 return unicodeBidi == CSSValueIsolate ||
175 unicodeBidi == CSSValueWebkitIsolate || unicodeBidi == CSSValueEmbed;
176 }
177 165
178 DECLARE_TRACE(); 166 DECLARE_TRACE();
179 167
180 private: 168 private:
181 EditingStyle() = default; 169 EditingStyle() = default;
182 EditingStyle(ContainerNode*, PropertiesToInclude); 170 EditingStyle(ContainerNode*, PropertiesToInclude);
183 EditingStyle(const Position&, PropertiesToInclude); 171 EditingStyle(const Position&, PropertiesToInclude);
184 explicit EditingStyle(const StylePropertySet*); 172 explicit EditingStyle(const StylePropertySet*);
185 EditingStyle(CSSPropertyID, const String& value); 173 EditingStyle(CSSPropertyID, const String& value);
186 void init(Node*, PropertiesToInclude); 174 void init(Node*, PropertiesToInclude);
187 void removeInheritedColorsIfNeeded(const ComputedStyle*); 175 void removeInheritedColorsIfNeeded(const ComputedStyle*);
188 void setProperty(CSSPropertyID, const String& value, bool important = false); 176
189 void replaceFontSizeByKeywordIfPossible(const ComputedStyle*, 177 void replaceFontSizeByKeywordIfPossible(const ComputedStyle*,
190 CSSComputedStyleDeclaration*); 178 CSSComputedStyleDeclaration*);
191 void extractFontSizeDelta(); 179 void extractFontSizeDelta();
192 TriState triStateOfStyle(CSSStyleDeclaration* styleToCompare, 180 TriState triStateOfStyle(CSSStyleDeclaration* styleToCompare,
193 ShouldIgnoreTextOnlyProperties) const; 181 ShouldIgnoreTextOnlyProperties) const;
194 bool conflictsWithInlineStyleOfElement( 182 bool conflictsWithInlineStyleOfElement(
195 HTMLElement*, 183 HTMLElement*,
196 EditingStyle* extractedStyle, 184 EditingStyle* extractedStyle,
197 Vector<CSSPropertyID>* conflictingProperties) const; 185 Vector<CSSPropertyID>* conflictingProperties) const;
198 void mergeInlineAndImplicitStyleOfElement(Element*,
199 CSSPropertyOverrideMode,
200 PropertiesToInclude);
201 void mergeStyle(const StylePropertySet*, CSSPropertyOverrideMode); 186 void mergeStyle(const StylePropertySet*, CSSPropertyOverrideMode);
202 187
203 Member<MutableStylePropertySet> m_mutableStyle; 188 Member<MutableStylePropertySet> m_mutableStyle;
204 bool m_isMonospaceFont = false; 189 bool m_isMonospaceFont = false;
205 float m_fontSizeDelta = NoFontDelta; 190 float m_fontSizeDelta = NoFontDelta;
206 bool m_isVerticalAlign = false; 191 bool m_isVerticalAlign = false;
207 192
208 friend class HTMLElementEquivalent; 193 friend class HTMLElementEquivalent;
209 friend class HTMLAttributeEquivalent; 194 friend class HTMLAttributeEquivalent;
210 }; 195 };
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 }; 254 };
270 255
271 // FIXME: Remove these functions or make them non-global to discourage using 256 // FIXME: Remove these functions or make them non-global to discourage using
272 // CSSStyleDeclaration directly. 257 // CSSStyleDeclaration directly.
273 CSSValueID getIdentifierValue(CSSStyleDeclaration*, CSSPropertyID); 258 CSSValueID getIdentifierValue(CSSStyleDeclaration*, CSSPropertyID);
274 CSSValueID getIdentifierValue(StylePropertySet*, CSSPropertyID); 259 CSSValueID getIdentifierValue(StylePropertySet*, CSSPropertyID);
275 260
276 } // namespace blink 261 } // namespace blink
277 262
278 #endif // EditingStyle_h 263 #endif // EditingStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/BUILD.gn ('k') | third_party/WebKit/Source/core/editing/EditingStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698