OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 // !START SYNC!: Keep this in sync with the copy constructor in | 195 // !START SYNC!: Keep this in sync with the copy constructor in |
196 // ComputedStyle.cpp and implicitlyInherited() in StyleResolver.cpp | 196 // ComputedStyle.cpp and implicitlyInherited() in StyleResolver.cpp |
197 | 197 |
198 // inherit | 198 // inherit |
199 struct InheritedData { | 199 struct InheritedData { |
200 bool operator==(const InheritedData& other) const { | 200 bool operator==(const InheritedData& other) const { |
201 return (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && | 201 return (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && |
202 (m_cursorStyle == other.m_cursorStyle) && | 202 (m_cursorStyle == other.m_cursorStyle) && |
203 (m_rtlOrdering == other.m_rtlOrdering) && | 203 (m_rtlOrdering == other.m_rtlOrdering) && |
204 (m_insideLink == other.m_insideLink) && | 204 (m_insideLink == other.m_insideLink); |
205 (m_writingMode == other.m_writingMode); | |
206 } | 205 } |
207 | 206 |
208 bool operator!=(const InheritedData& other) const { | 207 bool operator!=(const InheritedData& other) const { |
209 return !(*this == other); | 208 return !(*this == other); |
210 } | 209 } |
211 | 210 |
212 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only | 211 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only |
213 // text decoration on this element. | 212 // text decoration on this element. |
214 unsigned m_cursorStyle : 6; // ECursor | 213 unsigned m_cursorStyle : 6; // ECursor |
215 // 32 bits | |
216 | 214 |
217 // non CSS2 inherited | 215 // non CSS2 inherited |
218 unsigned m_rtlOrdering : 1; // EOrder | 216 unsigned m_rtlOrdering : 1; // EOrder |
219 unsigned m_insideLink : 2; // EInsideLink | 217 unsigned m_insideLink : 2; // EInsideLink |
220 | |
221 // CSS Text Layout Module Level 3: Vertical writing support | |
222 unsigned m_writingMode : 2; // WritingMode | |
223 // 42 bits | |
224 } m_inheritedData; | 218 } m_inheritedData; |
225 | 219 |
226 // don't inherit | 220 // don't inherit |
227 struct NonInheritedData { | 221 struct NonInheritedData { |
228 // Compare computed styles, differences in inherited bits or other flags | 222 // Compare computed styles, differences in inherited bits or other flags |
229 // should not cause an inequality. | 223 // should not cause an inequality. |
230 bool operator==(const NonInheritedData& other) const { | 224 bool operator==(const NonInheritedData& other) const { |
231 return m_effectiveDisplay == other.m_effectiveDisplay && | 225 return m_effectiveDisplay == other.m_effectiveDisplay && |
232 m_originalDisplay == other.m_originalDisplay && | 226 m_originalDisplay == other.m_originalDisplay && |
233 m_overflowAnchor == other.m_overflowAnchor && | 227 m_overflowAnchor == other.m_overflowAnchor && |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } m_nonInheritedData; | 300 } m_nonInheritedData; |
307 | 301 |
308 // !END SYNC! | 302 // !END SYNC! |
309 | 303 |
310 void setBitDefaults() { | 304 void setBitDefaults() { |
311 ComputedStyleBase::setBitDefaults(); | 305 ComputedStyleBase::setBitDefaults(); |
312 m_inheritedData.m_hasSimpleUnderline = false; | 306 m_inheritedData.m_hasSimpleUnderline = false; |
313 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); | 307 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); |
314 m_inheritedData.m_rtlOrdering = static_cast<unsigned>(initialRTLOrdering()); | 308 m_inheritedData.m_rtlOrdering = static_cast<unsigned>(initialRTLOrdering()); |
315 m_inheritedData.m_insideLink = NotInsideLink; | 309 m_inheritedData.m_insideLink = NotInsideLink; |
316 m_inheritedData.m_writingMode = static_cast<unsigned>(initialWritingMode()); | |
317 | 310 |
318 m_nonInheritedData.m_effectiveDisplay = | 311 m_nonInheritedData.m_effectiveDisplay = |
319 m_nonInheritedData.m_originalDisplay = | 312 m_nonInheritedData.m_originalDisplay = |
320 static_cast<unsigned>(initialDisplay()); | 313 static_cast<unsigned>(initialDisplay()); |
321 m_nonInheritedData.m_overflowAnchor = | 314 m_nonInheritedData.m_overflowAnchor = |
322 static_cast<unsigned>(initialOverflowAnchor()); | 315 static_cast<unsigned>(initialOverflowAnchor()); |
323 m_nonInheritedData.m_overflowX = static_cast<unsigned>(initialOverflowX()); | 316 m_nonInheritedData.m_overflowX = static_cast<unsigned>(initialOverflowX()); |
324 m_nonInheritedData.m_overflowY = static_cast<unsigned>(initialOverflowY()); | 317 m_nonInheritedData.m_overflowY = static_cast<unsigned>(initialOverflowY()); |
325 m_nonInheritedData.m_verticalAlign = | 318 m_nonInheritedData.m_verticalAlign = |
326 static_cast<unsigned>(initialVerticalAlign()); | 319 static_cast<unsigned>(initialVerticalAlign()); |
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 SET_VAR(m_rareInheritedData, wordBreak, b); | 2178 SET_VAR(m_rareInheritedData, wordBreak, b); |
2186 } | 2179 } |
2187 | 2180 |
2188 // -webkit-line-break | 2181 // -webkit-line-break |
2189 static LineBreak initialLineBreak() { return LineBreakAuto; } | 2182 static LineBreak initialLineBreak() { return LineBreakAuto; } |
2190 LineBreak getLineBreak() const { | 2183 LineBreak getLineBreak() const { |
2191 return static_cast<LineBreak>(m_rareInheritedData->lineBreak); | 2184 return static_cast<LineBreak>(m_rareInheritedData->lineBreak); |
2192 } | 2185 } |
2193 void setLineBreak(LineBreak b) { SET_VAR(m_rareInheritedData, lineBreak, b); } | 2186 void setLineBreak(LineBreak b) { SET_VAR(m_rareInheritedData, lineBreak, b); } |
2194 | 2187 |
2195 // writing-mode (aka -webkit-writing-mode, -epub-writing-mode) | |
2196 static WritingMode initialWritingMode() { return WritingMode::HorizontalTb; } | |
2197 WritingMode getWritingMode() const { | |
2198 return static_cast<WritingMode>(m_inheritedData.m_writingMode); | |
2199 } | |
2200 void setWritingMode(WritingMode v) { | |
2201 m_inheritedData.m_writingMode = static_cast<unsigned>(v); | |
2202 } | |
2203 | |
2204 // Text emphasis properties. | 2188 // Text emphasis properties. |
2205 static TextEmphasisFill initialTextEmphasisFill() { | 2189 static TextEmphasisFill initialTextEmphasisFill() { |
2206 return TextEmphasisFillFilled; | 2190 return TextEmphasisFillFilled; |
2207 } | 2191 } |
2208 static TextEmphasisMark initialTextEmphasisMark() { | 2192 static TextEmphasisMark initialTextEmphasisMark() { |
2209 return TextEmphasisMarkNone; | 2193 return TextEmphasisMarkNone; |
2210 } | 2194 } |
2211 static const AtomicString& initialTextEmphasisCustomMark() { | 2195 static const AtomicString& initialTextEmphasisCustomMark() { |
2212 return nullAtom; | 2196 return nullAtom; |
2213 } | 2197 } |
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3969 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); | 3953 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); |
3970 } | 3954 } |
3971 | 3955 |
3972 inline bool ComputedStyle::hasPseudoElementStyle() const { | 3956 inline bool ComputedStyle::hasPseudoElementStyle() const { |
3973 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 3957 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
3974 } | 3958 } |
3975 | 3959 |
3976 } // namespace blink | 3960 } // namespace blink |
3977 | 3961 |
3978 #endif // ComputedStyle_h | 3962 #endif // ComputedStyle_h |
OLD | NEW |