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 r
ights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "platform/geometry/FloatRoundedRect.h" | 65 #include "platform/geometry/FloatRoundedRect.h" |
66 #include "platform/geometry/LayoutRectOutsets.h" | 66 #include "platform/geometry/LayoutRectOutsets.h" |
67 #include "platform/graphics/Color.h" | 67 #include "platform/graphics/Color.h" |
68 #include "platform/scroll/ScrollTypes.h" | 68 #include "platform/scroll/ScrollTypes.h" |
69 #include "platform/text/TextDirection.h" | 69 #include "platform/text/TextDirection.h" |
70 #include "platform/text/UnicodeBidi.h" | 70 #include "platform/text/UnicodeBidi.h" |
71 #include "platform/transforms/TransformOperations.h" | 71 #include "platform/transforms/TransformOperations.h" |
72 #include "wtf/Forward.h" | 72 #include "wtf/Forward.h" |
73 #include "wtf/LeakAnnotations.h" | 73 #include "wtf/LeakAnnotations.h" |
74 #include "wtf/RefCounted.h" | 74 #include "wtf/RefCounted.h" |
| 75 #include "wtf/TypeTraits.h" |
75 #include "wtf/Vector.h" | 76 #include "wtf/Vector.h" |
76 #include <memory> | 77 #include <memory> |
77 | 78 |
78 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u
) { return t == static_cast<T>(u); } | 79 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u
) { return t == static_cast<T>(u); } |
79 | 80 |
80 #define SET_VAR(group, variable, value) \ | 81 #define SET_VAR(group, variable, value) \ |
81 if (!compareEqual(group->variable, value)) \ | 82 if (!compareEqual(group->variable, value)) \ |
82 group.access()->variable = value | 83 group.access()->variable = value |
83 | 84 |
84 #define SET_NESTED_VAR(group, base, variable, value) \ | 85 #define SET_NESTED_VAR(group, base, variable, value) \ |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 && (m_boxDirection == other.m_boxDirection) | 180 && (m_boxDirection == other.m_boxDirection) |
180 && (m_rtlOrdering == other.m_rtlOrdering) | 181 && (m_rtlOrdering == other.m_rtlOrdering) |
181 && (m_printColorAdjust == other.m_printColorAdjust) | 182 && (m_printColorAdjust == other.m_printColorAdjust) |
182 && (m_pointerEvents == other.m_pointerEvents) | 183 && (m_pointerEvents == other.m_pointerEvents) |
183 && (m_insideLink == other.m_insideLink) | 184 && (m_insideLink == other.m_insideLink) |
184 && (m_writingMode == other.m_writingMode); | 185 && (m_writingMode == other.m_writingMode); |
185 } | 186 } |
186 | 187 |
187 bool operator!=(const InheritedData& other) const { return !(*this == ot
her); } | 188 bool operator!=(const InheritedData& other) const { return !(*this == ot
her); } |
188 | 189 |
| 190 static_assert(IsEnumSafeToStoreInBitfield<EVisibility>::value, "EVisibil
ity is stored in a bitfield on ComputedStyle"); |
| 191 |
189 unsigned m_emptyCells : 1; // EEmptyCells | 192 unsigned m_emptyCells : 1; // EEmptyCells |
190 unsigned m_captionSide : 2; // ECaptionSide | 193 unsigned m_captionSide : 2; // ECaptionSide |
191 unsigned m_listStyleType : 7; // EListStyleType | 194 unsigned m_listStyleType : 7; // EListStyleType |
192 unsigned m_listStylePosition : 1; // EListStylePosition | 195 unsigned m_listStylePosition : 1; // EListStylePosition |
193 unsigned m_visibility : 2; // EVisibility | 196 EVisibility m_visibility : 2; |
194 unsigned m_textAlign : 4; // ETextAlign | 197 unsigned m_textAlign : 4; // ETextAlign |
195 unsigned m_textTransform : 2; // ETextTransform | 198 unsigned m_textTransform : 2; // ETextTransform |
196 unsigned m_textUnderline : 1; | 199 unsigned m_textUnderline : 1; |
197 unsigned m_cursorStyle : 6; // ECursor | 200 unsigned m_cursorStyle : 6; // ECursor |
198 unsigned m_direction : 1; // TextDirection | 201 unsigned m_direction : 1; // TextDirection |
199 unsigned m_whiteSpace : 3; // EWhiteSpace | 202 unsigned m_whiteSpace : 3; // EWhiteSpace |
200 unsigned m_borderCollapse : 1; // EBorderCollapse | 203 unsigned m_borderCollapse : 1; // EBorderCollapse |
201 unsigned m_boxDirection : 1; // EBoxDirection (CSS3 box_direction proper
ty, flexible box layout module) | 204 unsigned m_boxDirection : 1; // EBoxDirection (CSS3 box_direction proper
ty, flexible box layout module) |
202 // 32 bits | 205 // 32 bits |
203 | 206 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } m_nonInheritedData; | 294 } m_nonInheritedData; |
292 | 295 |
293 // !END SYNC! | 296 // !END SYNC! |
294 | 297 |
295 void setBitDefaults() | 298 void setBitDefaults() |
296 { | 299 { |
297 m_inheritedData.m_emptyCells = initialEmptyCells(); | 300 m_inheritedData.m_emptyCells = initialEmptyCells(); |
298 m_inheritedData.m_captionSide = initialCaptionSide(); | 301 m_inheritedData.m_captionSide = initialCaptionSide(); |
299 m_inheritedData.m_listStyleType = initialListStyleType(); | 302 m_inheritedData.m_listStyleType = initialListStyleType(); |
300 m_inheritedData.m_listStylePosition = initialListStylePosition(); | 303 m_inheritedData.m_listStylePosition = initialListStylePosition(); |
301 m_inheritedData.m_visibility = static_cast<unsigned>(initialVisibility()
); | 304 m_inheritedData.m_visibility = initialVisibility(); |
302 m_inheritedData.m_textAlign = initialTextAlign(); | 305 m_inheritedData.m_textAlign = initialTextAlign(); |
303 m_inheritedData.m_textTransform = initialTextTransform(); | 306 m_inheritedData.m_textTransform = initialTextTransform(); |
304 m_inheritedData.m_textUnderline = false; | 307 m_inheritedData.m_textUnderline = false; |
305 m_inheritedData.m_cursorStyle = initialCursor(); | 308 m_inheritedData.m_cursorStyle = initialCursor(); |
306 m_inheritedData.m_direction = initialDirection(); | 309 m_inheritedData.m_direction = initialDirection(); |
307 m_inheritedData.m_whiteSpace = initialWhiteSpace(); | 310 m_inheritedData.m_whiteSpace = initialWhiteSpace(); |
308 m_inheritedData.m_borderCollapse = initialBorderCollapse(); | 311 m_inheritedData.m_borderCollapse = initialBorderCollapse(); |
309 m_inheritedData.m_rtlOrdering = initialRTLOrdering(); | 312 m_inheritedData.m_rtlOrdering = initialRTLOrdering(); |
310 m_inheritedData.m_boxDirection = initialBoxDirection(); | 313 m_inheritedData.m_boxDirection = initialBoxDirection(); |
311 m_inheritedData.m_printColorAdjust = initialPrintColorAdjust(); | 314 m_inheritedData.m_printColorAdjust = initialPrintColorAdjust(); |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1463 void setTextSizeAdjust(TextSizeAdjust sizeAdjust) { SET_VAR(m_rareInheritedD
ata, m_textSizeAdjust, sizeAdjust); } | 1466 void setTextSizeAdjust(TextSizeAdjust sizeAdjust) { SET_VAR(m_rareInheritedD
ata, m_textSizeAdjust, sizeAdjust); } |
1464 | 1467 |
1465 // text-transform (aka -epub-text-transform) | 1468 // text-transform (aka -epub-text-transform) |
1466 static ETextTransform initialTextTransform() { return TTNONE; } | 1469 static ETextTransform initialTextTransform() { return TTNONE; } |
1467 ETextTransform textTransform() const { return static_cast<ETextTransform>(m_
inheritedData.m_textTransform); } | 1470 ETextTransform textTransform() const { return static_cast<ETextTransform>(m_
inheritedData.m_textTransform); } |
1468 void setTextTransform(ETextTransform v) { m_inheritedData.m_textTransform =
v; } | 1471 void setTextTransform(ETextTransform v) { m_inheritedData.m_textTransform =
v; } |
1469 | 1472 |
1470 // visibility | 1473 // visibility |
1471 static EVisibility initialVisibility() { return EVisibility::Visible; } | 1474 static EVisibility initialVisibility() { return EVisibility::Visible; } |
1472 EVisibility visibility() const { return static_cast<EVisibility>(m_inherited
Data.m_visibility); } | 1475 EVisibility visibility() const { return static_cast<EVisibility>(m_inherited
Data.m_visibility); } |
1473 void setVisibility(EVisibility v) { m_inheritedData.m_visibility = static_ca
st<unsigned>(v); } | 1476 void setVisibility(EVisibility v) { m_inheritedData.m_visibility = v; } |
1474 | 1477 |
1475 // white-space inherited | 1478 // white-space inherited |
1476 static EWhiteSpace initialWhiteSpace() { return NORMAL; } | 1479 static EWhiteSpace initialWhiteSpace() { return NORMAL; } |
1477 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(m_inherited
Data.m_whiteSpace); } | 1480 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(m_inherited
Data.m_whiteSpace); } |
1478 void setWhiteSpace(EWhiteSpace v) { m_inheritedData.m_whiteSpace = v; } | 1481 void setWhiteSpace(EWhiteSpace v) { m_inheritedData.m_whiteSpace = v; } |
1479 | 1482 |
1480 // word-break inherited (aka -epub-word-break) | 1483 // word-break inherited (aka -epub-word-break) |
1481 static EWordBreak initialWordBreak() { return NormalWordBreak; } | 1484 static EWordBreak initialWordBreak() { return NormalWordBreak; } |
1482 EWordBreak wordBreak() const { return static_cast<EWordBreak>(m_rareInherite
dData->wordBreak); } | 1485 EWordBreak wordBreak() const { return static_cast<EWordBreak>(m_rareInherite
dData->wordBreak); } |
1483 void setWordBreak(EWordBreak b) { SET_VAR(m_rareInheritedData, wordBreak, b)
; } | 1486 void setWordBreak(EWordBreak b) { SET_VAR(m_rareInheritedData, wordBreak, b)
; } |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 } | 2557 } |
2555 | 2558 |
2556 inline bool ComputedStyle::hasPseudoElementStyle() const | 2559 inline bool ComputedStyle::hasPseudoElementStyle() const |
2557 { | 2560 { |
2558 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 2561 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
2559 } | 2562 } |
2560 | 2563 |
2561 } // namespace blink | 2564 } // namespace blink |
2562 | 2565 |
2563 #endif // ComputedStyle_h | 2566 #endif // ComputedStyle_h |
OLD | NEW |