OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 namespace WebCore { | 44 namespace WebCore { |
45 | 45 |
46 class CSSStyleDeclaration; | 46 class CSSStyleDeclaration; |
47 class CSSComputedStyleDeclaration; | 47 class CSSComputedStyleDeclaration; |
48 class CSSPrimitiveValue; | 48 class CSSPrimitiveValue; |
49 class CSSValue; | 49 class CSSValue; |
50 class Document; | 50 class Document; |
51 class Element; | 51 class Element; |
52 class HTMLElement; | 52 class HTMLElement; |
| 53 class MutableStylePropertySet; |
53 class Node; | 54 class Node; |
54 class Position; | 55 class Position; |
55 class QualifiedName; | 56 class QualifiedName; |
56 class RenderStyle; | 57 class RenderStyle; |
57 class StylePropertySet; | 58 class StylePropertySet; |
58 class StyledElement; | 59 class StyledElement; |
59 class VisibleSelection; | 60 class VisibleSelection; |
60 | 61 |
61 class EditingStyle : public RefCounted<EditingStyle> { | 62 class EditingStyle : public RefCounted<EditingStyle> { |
62 public: | 63 public: |
(...skipping 28 matching lines...) Expand all Loading... |
91 return adoptRef(new EditingStyle(style)); | 92 return adoptRef(new EditingStyle(style)); |
92 } | 93 } |
93 | 94 |
94 static PassRefPtr<EditingStyle> create(CSSPropertyID propertyID, const Strin
g& value) | 95 static PassRefPtr<EditingStyle> create(CSSPropertyID propertyID, const Strin
g& value) |
95 { | 96 { |
96 return adoptRef(new EditingStyle(propertyID, value)); | 97 return adoptRef(new EditingStyle(propertyID, value)); |
97 } | 98 } |
98 | 99 |
99 ~EditingStyle(); | 100 ~EditingStyle(); |
100 | 101 |
101 StylePropertySet* style() { return m_mutableStyle.get(); } | 102 MutableStylePropertySet* style() { return m_mutableStyle.get(); } |
102 bool textDirection(WritingDirection&) const; | 103 bool textDirection(WritingDirection&) const; |
103 bool isEmpty() const; | 104 bool isEmpty() const; |
104 void setStyle(PassRefPtr<StylePropertySet>); | 105 void setStyle(PassRefPtr<MutableStylePropertySet>); |
105 void overrideWithStyle(const StylePropertySet*); | 106 void overrideWithStyle(const StylePropertySet*); |
106 void clear(); | 107 void clear(); |
107 PassRefPtr<EditingStyle> copy() const; | 108 PassRefPtr<EditingStyle> copy() const; |
108 PassRefPtr<EditingStyle> extractAndRemoveBlockProperties(); | 109 PassRefPtr<EditingStyle> extractAndRemoveBlockProperties(); |
109 PassRefPtr<EditingStyle> extractAndRemoveTextDirection(); | 110 PassRefPtr<EditingStyle> extractAndRemoveTextDirection(); |
110 void removeBlockProperties(); | 111 void removeBlockProperties(); |
111 void removeStyleAddedByNode(Node*); | 112 void removeStyleAddedByNode(Node*); |
112 void removeStyleConflictingWithStyleOfNode(Node*); | 113 void removeStyleConflictingWithStyleOfNode(Node*); |
113 void removeNonEditingProperties(); | 114 void removeNonEditingProperties(); |
114 void collapseTextDecorationProperties(); | 115 void collapseTextDecorationProperties(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 void init(Node*, PropertiesToInclude); | 157 void init(Node*, PropertiesToInclude); |
157 void removeTextFillAndStrokeColorsIfNeeded(RenderStyle*); | 158 void removeTextFillAndStrokeColorsIfNeeded(RenderStyle*); |
158 void setProperty(CSSPropertyID, const String& value, bool important = false)
; | 159 void setProperty(CSSPropertyID, const String& value, bool important = false)
; |
159 void replaceFontSizeByKeywordIfPossible(RenderStyle*, CSSComputedStyleDeclar
ation*); | 160 void replaceFontSizeByKeywordIfPossible(RenderStyle*, CSSComputedStyleDeclar
ation*); |
160 void extractFontSizeDelta(); | 161 void extractFontSizeDelta(); |
161 TriState triStateOfStyle(CSSStyleDeclaration* styleToCompare, ShouldIgnoreTe
xtOnlyProperties) const; | 162 TriState triStateOfStyle(CSSStyleDeclaration* styleToCompare, ShouldIgnoreTe
xtOnlyProperties) const; |
162 bool conflictsWithInlineStyleOfElement(StyledElement*, EditingStyle* extract
edStyle, Vector<CSSPropertyID>* conflictingProperties) const; | 163 bool conflictsWithInlineStyleOfElement(StyledElement*, EditingStyle* extract
edStyle, Vector<CSSPropertyID>* conflictingProperties) const; |
163 void mergeInlineAndImplicitStyleOfElement(StyledElement*, CSSPropertyOverrid
eMode, PropertiesToInclude); | 164 void mergeInlineAndImplicitStyleOfElement(StyledElement*, CSSPropertyOverrid
eMode, PropertiesToInclude); |
164 void mergeStyle(const StylePropertySet*, CSSPropertyOverrideMode); | 165 void mergeStyle(const StylePropertySet*, CSSPropertyOverrideMode); |
165 | 166 |
166 RefPtr<StylePropertySet> m_mutableStyle; | 167 RefPtr<MutableStylePropertySet> m_mutableStyle; |
167 bool m_shouldUseFixedDefaultFontSize; | 168 bool m_shouldUseFixedDefaultFontSize; |
168 float m_fontSizeDelta; | 169 float m_fontSizeDelta; |
169 | 170 |
170 friend class HTMLElementEquivalent; | 171 friend class HTMLElementEquivalent; |
171 friend class HTMLAttributeEquivalent; | 172 friend class HTMLAttributeEquivalent; |
172 }; | 173 }; |
173 | 174 |
174 class StyleChange { | 175 class StyleChange { |
175 public: | 176 public: |
176 StyleChange() | 177 StyleChange() |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 && m_applySuperscript == other.m_applySuperscript | 211 && m_applySuperscript == other.m_applySuperscript |
211 && m_applyFontColor == other.m_applyFontColor | 212 && m_applyFontColor == other.m_applyFontColor |
212 && m_applyFontFace == other.m_applyFontFace | 213 && m_applyFontFace == other.m_applyFontFace |
213 && m_applyFontSize == other.m_applyFontSize; | 214 && m_applyFontSize == other.m_applyFontSize; |
214 } | 215 } |
215 bool operator!=(const StyleChange& other) | 216 bool operator!=(const StyleChange& other) |
216 { | 217 { |
217 return !(*this == other); | 218 return !(*this == other); |
218 } | 219 } |
219 private: | 220 private: |
220 void extractTextStyles(Document*, StylePropertySet*, bool shouldUseFixedFont
DefaultSize); | 221 void extractTextStyles(Document*, MutableStylePropertySet*, bool shouldUseFi
xedFontDefaultSize); |
221 | 222 |
222 String m_cssStyle; | 223 String m_cssStyle; |
223 bool m_applyBold; | 224 bool m_applyBold; |
224 bool m_applyItalic; | 225 bool m_applyItalic; |
225 bool m_applyUnderline; | 226 bool m_applyUnderline; |
226 bool m_applyLineThrough; | 227 bool m_applyLineThrough; |
227 bool m_applySubscript; | 228 bool m_applySubscript; |
228 bool m_applySuperscript; | 229 bool m_applySuperscript; |
229 String m_applyFontColor; | 230 String m_applyFontColor; |
230 String m_applyFontFace; | 231 String m_applyFontFace; |
231 String m_applyFontSize; | 232 String m_applyFontSize; |
232 }; | 233 }; |
233 | 234 |
234 // FIXME: Remove these functions or make them non-global to discourage using CSS
StyleDeclaration directly. | 235 // FIXME: Remove these functions or make them non-global to discourage using CSS
StyleDeclaration directly. |
235 int getIdentifierValue(CSSStyleDeclaration*, CSSPropertyID); | 236 int getIdentifierValue(CSSStyleDeclaration*, CSSPropertyID); |
236 int getIdentifierValue(StylePropertySet*, CSSPropertyID); | 237 int getIdentifierValue(StylePropertySet*, CSSPropertyID); |
237 | 238 |
238 } // namespace WebCore | 239 } // namespace WebCore |
239 | 240 |
240 #endif // EditingStyle_h | 241 #endif // EditingStyle_h |
OLD | NEW |