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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool operator!=(const InheritedData& other) const { | 205 bool operator!=(const InheritedData& other) const { |
206 return !(*this == other); | 206 return !(*this == other); |
207 } | 207 } |
208 | 208 |
209 inline bool compareEqualIndependent(const InheritedData& other) const { | 209 inline bool compareEqualIndependent(const InheritedData& other) const { |
210 // These must match the properties tagged 'independent' in | 210 // These must match the properties tagged 'independent' in |
211 // CSSProperties.in. | 211 // CSSProperties.in. |
212 // TODO(napper): Remove this once all independent properties are | 212 // TODO(napper): Remove this once all independent properties are |
213 // generated and replace with a private function used only in | 213 // generated and replace with a private function used only in |
214 // stylePropagationDiff(). | 214 // stylePropagationDiff(). |
215 return (m_pointerEvents == other.m_pointerEvents) && | 215 return (m_pointerEvents == other.m_pointerEvents); |
216 (m_whiteSpace == other.m_whiteSpace); | |
217 } | 216 } |
218 | 217 |
219 inline bool compareEqualNonIndependent(const InheritedData& other) const { | 218 inline bool compareEqualNonIndependent(const InheritedData& other) const { |
220 return (m_listStyleType == other.m_listStyleType) && | 219 return (m_listStyleType == other.m_listStyleType) && |
221 (m_textAlign == other.m_textAlign) && | 220 (m_textAlign == other.m_textAlign) && |
222 (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && | 221 (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && |
223 (m_cursorStyle == other.m_cursorStyle) && | 222 (m_cursorStyle == other.m_cursorStyle) && |
224 (m_direction == other.m_direction) && | 223 (m_direction == other.m_direction) && |
225 (m_boxDirection == other.m_boxDirection) && | 224 (m_boxDirection == other.m_boxDirection) && |
226 (m_rtlOrdering == other.m_rtlOrdering) && | 225 (m_rtlOrdering == other.m_rtlOrdering) && |
227 (m_printColorAdjust == other.m_printColorAdjust) && | 226 (m_printColorAdjust == other.m_printColorAdjust) && |
228 (m_insideLink == other.m_insideLink) && | 227 (m_insideLink == other.m_insideLink) && |
229 (m_writingMode == other.m_writingMode); | 228 (m_writingMode == other.m_writingMode); |
230 } | 229 } |
231 | 230 |
232 unsigned m_listStyleType : 7; // EListStyleType | 231 unsigned m_listStyleType : 7; // EListStyleType |
233 unsigned m_textAlign : 4; // ETextAlign | 232 unsigned m_textAlign : 4; // ETextAlign |
234 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only | 233 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only |
235 // text decoration on this element. | 234 // text decoration on this element. |
236 unsigned m_cursorStyle : 6; // ECursor | 235 unsigned m_cursorStyle : 6; // ECursor |
237 unsigned m_direction : 1; // TextDirection | 236 unsigned m_direction : 1; // TextDirection |
238 unsigned m_whiteSpace : 3; // EWhiteSpace | |
239 unsigned m_boxDirection : 1; // EBoxDirection (CSS3 box_direction property, | 237 unsigned m_boxDirection : 1; // EBoxDirection (CSS3 box_direction property, |
240 // flexible box layout module) | 238 // flexible box layout module) |
241 // 32 bits | 239 // 32 bits |
242 | 240 |
243 // non CSS2 inherited | 241 // non CSS2 inherited |
244 unsigned m_rtlOrdering : 1; // EOrder | 242 unsigned m_rtlOrdering : 1; // EOrder |
245 unsigned m_printColorAdjust : 1; // PrintColorAdjust | 243 unsigned m_printColorAdjust : 1; // PrintColorAdjust |
246 unsigned m_pointerEvents : 4; // EPointerEvents | 244 unsigned m_pointerEvents : 4; // EPointerEvents |
247 unsigned m_insideLink : 2; // EInsideLink | 245 unsigned m_insideLink : 2; // EInsideLink |
248 | 246 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // TODO(sashab): Move these flags closer to inheritedData so that it's | 338 // TODO(sashab): Move these flags closer to inheritedData so that it's |
341 // clear which inherited properties have a flag stored and which don't. | 339 // clear which inherited properties have a flag stored and which don't. |
342 // Keep this list of fields in sync with: | 340 // Keep this list of fields in sync with: |
343 // - setBitDefaults() | 341 // - setBitDefaults() |
344 // - The ComputedStyle setter, which must take an extra boolean parameter | 342 // - The ComputedStyle setter, which must take an extra boolean parameter |
345 // and set this - propagateIndependentInheritedProperties() in | 343 // and set this - propagateIndependentInheritedProperties() in |
346 // ComputedStyle.cpp | 344 // ComputedStyle.cpp |
347 // - The compareEqual() methods in the corresponding class | 345 // - The compareEqual() methods in the corresponding class |
348 // InheritedFlags | 346 // InheritedFlags |
349 unsigned m_isPointerEventsInherited : 1; | 347 unsigned m_isPointerEventsInherited : 1; |
350 unsigned m_isWhiteSpaceInherited : 1; | |
351 | 348 |
352 // If you add more style bits here, you will also need to update | 349 // If you add more style bits here, you will also need to update |
353 // ComputedStyle::copyNonInheritedFromCached() 68 bits | 350 // ComputedStyle::copyNonInheritedFromCached() 68 bits |
354 } m_nonInheritedData; | 351 } m_nonInheritedData; |
355 | 352 |
356 // !END SYNC! | 353 // !END SYNC! |
357 | 354 |
358 void setBitDefaults() { | 355 void setBitDefaults() { |
359 ComputedStyleBase::setBitDefaults(); | 356 ComputedStyleBase::setBitDefaults(); |
360 m_inheritedData.m_listStyleType = | 357 m_inheritedData.m_listStyleType = |
361 static_cast<unsigned>(initialListStyleType()); | 358 static_cast<unsigned>(initialListStyleType()); |
362 m_inheritedData.m_textAlign = static_cast<unsigned>(initialTextAlign()); | 359 m_inheritedData.m_textAlign = static_cast<unsigned>(initialTextAlign()); |
363 m_inheritedData.m_hasSimpleUnderline = false; | 360 m_inheritedData.m_hasSimpleUnderline = false; |
364 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); | 361 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); |
365 m_inheritedData.m_direction = initialDirection(); | 362 m_inheritedData.m_direction = initialDirection(); |
366 m_inheritedData.m_whiteSpace = static_cast<unsigned>(initialWhiteSpace()); | |
367 m_inheritedData.m_rtlOrdering = static_cast<unsigned>(initialRTLOrdering()); | 363 m_inheritedData.m_rtlOrdering = static_cast<unsigned>(initialRTLOrdering()); |
368 m_inheritedData.m_boxDirection = | 364 m_inheritedData.m_boxDirection = |
369 static_cast<unsigned>(initialBoxDirection()); | 365 static_cast<unsigned>(initialBoxDirection()); |
370 m_inheritedData.m_printColorAdjust = | 366 m_inheritedData.m_printColorAdjust = |
371 static_cast<unsigned>(initialPrintColorAdjust()); | 367 static_cast<unsigned>(initialPrintColorAdjust()); |
372 m_inheritedData.m_pointerEvents = | 368 m_inheritedData.m_pointerEvents = |
373 static_cast<unsigned>(initialPointerEvents()); | 369 static_cast<unsigned>(initialPointerEvents()); |
374 m_inheritedData.m_insideLink = NotInsideLink; | 370 m_inheritedData.m_insideLink = NotInsideLink; |
375 m_inheritedData.m_writingMode = initialWritingMode(); | 371 m_inheritedData.m_writingMode = initialWritingMode(); |
376 | 372 |
(...skipping 20 matching lines...) Expand all Loading... |
397 m_nonInheritedData.m_hasViewportUnits = false; | 393 m_nonInheritedData.m_hasViewportUnits = false; |
398 m_nonInheritedData.m_affectedByFocus = false; | 394 m_nonInheritedData.m_affectedByFocus = false; |
399 m_nonInheritedData.m_affectedByHover = false; | 395 m_nonInheritedData.m_affectedByHover = false; |
400 m_nonInheritedData.m_affectedByActive = false; | 396 m_nonInheritedData.m_affectedByActive = false; |
401 m_nonInheritedData.m_affectedByDrag = false; | 397 m_nonInheritedData.m_affectedByDrag = false; |
402 m_nonInheritedData.m_isLink = false; | 398 m_nonInheritedData.m_isLink = false; |
403 m_nonInheritedData.m_hasRemUnits = false; | 399 m_nonInheritedData.m_hasRemUnits = false; |
404 | 400 |
405 // All independently inherited properties default to being inherited. | 401 // All independently inherited properties default to being inherited. |
406 m_nonInheritedData.m_isPointerEventsInherited = true; | 402 m_nonInheritedData.m_isPointerEventsInherited = true; |
407 m_nonInheritedData.m_isWhiteSpaceInherited = true; | |
408 } | 403 } |
409 | 404 |
410 private: | 405 private: |
411 // TODO(sashab): Move these to the bottom of ComputedStyle. | 406 // TODO(sashab): Move these to the bottom of ComputedStyle. |
412 ALWAYS_INLINE ComputedStyle(); | 407 ALWAYS_INLINE ComputedStyle(); |
413 | 408 |
414 enum InitialStyleTag { InitialStyle }; | 409 enum InitialStyleTag { InitialStyle }; |
415 ALWAYS_INLINE explicit ComputedStyle(InitialStyleTag); | 410 ALWAYS_INLINE explicit ComputedStyle(InitialStyleTag); |
416 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); | 411 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); |
417 | 412 |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 static TextSizeAdjust initialTextSizeAdjust() { | 2254 static TextSizeAdjust initialTextSizeAdjust() { |
2260 return TextSizeAdjust::adjustAuto(); | 2255 return TextSizeAdjust::adjustAuto(); |
2261 } | 2256 } |
2262 TextSizeAdjust getTextSizeAdjust() const { | 2257 TextSizeAdjust getTextSizeAdjust() const { |
2263 return m_rareInheritedData->m_textSizeAdjust; | 2258 return m_rareInheritedData->m_textSizeAdjust; |
2264 } | 2259 } |
2265 void setTextSizeAdjust(TextSizeAdjust sizeAdjust) { | 2260 void setTextSizeAdjust(TextSizeAdjust sizeAdjust) { |
2266 SET_VAR(m_rareInheritedData, m_textSizeAdjust, sizeAdjust); | 2261 SET_VAR(m_rareInheritedData, m_textSizeAdjust, sizeAdjust); |
2267 } | 2262 } |
2268 | 2263 |
2269 // white-space inherited | |
2270 static EWhiteSpace initialWhiteSpace() { return EWhiteSpace::Normal; } | |
2271 EWhiteSpace whiteSpace() const { | |
2272 return static_cast<EWhiteSpace>(m_inheritedData.m_whiteSpace); | |
2273 } | |
2274 void setWhiteSpace(EWhiteSpace v) { | |
2275 m_inheritedData.m_whiteSpace = static_cast<unsigned>(v); | |
2276 } | |
2277 void setWhiteSpaceIsInherited(bool isInherited) { | |
2278 m_nonInheritedData.m_isWhiteSpaceInherited = isInherited; | |
2279 } | |
2280 | |
2281 // word-break inherited (aka -epub-word-break) | 2264 // word-break inherited (aka -epub-word-break) |
2282 static EWordBreak initialWordBreak() { return NormalWordBreak; } | 2265 static EWordBreak initialWordBreak() { return NormalWordBreak; } |
2283 EWordBreak wordBreak() const { | 2266 EWordBreak wordBreak() const { |
2284 return static_cast<EWordBreak>(m_rareInheritedData->wordBreak); | 2267 return static_cast<EWordBreak>(m_rareInheritedData->wordBreak); |
2285 } | 2268 } |
2286 void setWordBreak(EWordBreak b) { | 2269 void setWordBreak(EWordBreak b) { |
2287 SET_VAR(m_rareInheritedData, wordBreak, b); | 2270 SET_VAR(m_rareInheritedData, wordBreak, b); |
2288 } | 2271 } |
2289 | 2272 |
2290 // -webkit-line-break | 2273 // -webkit-line-break |
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4093 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); | 4076 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); |
4094 } | 4077 } |
4095 | 4078 |
4096 inline bool ComputedStyle::hasPseudoElementStyle() const { | 4079 inline bool ComputedStyle::hasPseudoElementStyle() const { |
4097 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 4080 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
4098 } | 4081 } |
4099 | 4082 |
4100 } // namespace blink | 4083 } // namespace blink |
4101 | 4084 |
4102 #endif // ComputedStyle_h | 4085 #endif // ComputedStyle_h |
OLD | NEW |