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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; | 191 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; |
192 | 192 |
193 DataRef<SVGComputedStyle> m_svgStyle; | 193 DataRef<SVGComputedStyle> m_svgStyle; |
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. | 196 // ComputedStyle.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 // Generated properties are compared in ComputedStyleBase | |
201 return (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && | 202 return (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && |
202 (m_cursorStyle == other.m_cursorStyle) && | 203 (m_cursorStyle == other.m_cursorStyle) && |
203 (m_insideLink == other.m_insideLink); | 204 (m_insideLink == other.m_insideLink); |
204 } | 205 } |
205 | 206 |
206 bool operator!=(const InheritedData& other) const { | 207 bool operator!=(const InheritedData& other) const { |
207 return !(*this == other); | 208 return !(*this == other); |
208 } | 209 } |
209 | 210 |
210 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only | 211 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only |
211 // text decoration on this element. | 212 // text decoration on this element. |
212 unsigned m_cursorStyle : 6; // ECursor | 213 unsigned m_cursorStyle : 6; // ECursor |
213 | 214 |
214 // non CSS2 inherited | 215 // non CSS2 inherited |
215 unsigned m_insideLink : 2; // EInsideLink | 216 unsigned m_insideLink : 2; // EInsideLink |
216 } m_inheritedData; | 217 } m_inheritedData; |
217 | 218 |
218 // don't inherit | 219 // don't inherit |
219 struct NonInheritedData { | 220 struct NonInheritedData { |
220 // Compare computed styles, differences in inherited bits or other flags | 221 // Compare computed styles, differences in inherited bits or other flags |
221 // should not cause an inequality. | 222 // should not cause an inequality. |
222 bool operator==(const NonInheritedData& other) const { | 223 bool operator==(const NonInheritedData& other) const { |
224 // Generated properties are compared in ComputedStyleBase | |
223 return m_effectiveDisplay == other.m_effectiveDisplay && | 225 return m_effectiveDisplay == other.m_effectiveDisplay && |
224 m_originalDisplay == other.m_originalDisplay && | 226 m_originalDisplay == other.m_originalDisplay && |
225 m_overflowAnchor == other.m_overflowAnchor && | 227 m_overflowAnchor == other.m_overflowAnchor && |
226 m_overflowX == other.m_overflowX && | 228 m_overflowX == other.m_overflowX && |
227 m_overflowY == other.m_overflowY && | 229 m_overflowY == other.m_overflowY && |
228 m_verticalAlign == other.m_verticalAlign && | 230 m_verticalAlign == other.m_verticalAlign && |
229 m_position == other.m_position && | 231 m_position == other.m_position && |
230 m_tableLayout == other.m_tableLayout && | |
231 // hasViewportUnits | 232 // hasViewportUnits |
232 m_breakBefore == other.m_breakBefore && | 233 m_breakBefore == other.m_breakBefore && |
233 m_breakAfter == other.m_breakAfter && | 234 m_breakAfter == other.m_breakAfter && |
234 m_breakInside == other.m_breakInside; | 235 m_breakInside == other.m_breakInside; |
235 // styleType | 236 // styleType |
236 // pseudoBits | 237 // pseudoBits |
237 // explicitInheritance | 238 // explicitInheritance |
238 // unique | 239 // unique |
239 // emptyState | 240 // emptyState |
240 // affectedByFocus | 241 // affectedByFocus |
241 // affectedByHover | 242 // affectedByHover |
242 // affectedByActive | 243 // affectedByActive |
243 // affectedByDrag | 244 // affectedByDrag |
244 // isLink | 245 // isLink |
245 // isInherited flags | 246 // isInherited flags |
246 } | 247 } |
247 | 248 |
248 bool operator!=(const NonInheritedData& other) const { | 249 bool operator!=(const NonInheritedData& other) const { |
249 return !(*this == other); | 250 return !(*this == other); |
250 } | 251 } |
251 | 252 |
252 unsigned m_effectiveDisplay : 5; // EDisplay | 253 unsigned m_effectiveDisplay : 5; // EDisplay |
253 unsigned m_originalDisplay : 5; // EDisplay | 254 unsigned m_originalDisplay : 5; // EDisplay |
254 unsigned m_overflowAnchor : 2; // EOverflowAnchor | 255 unsigned m_overflowAnchor : 2; // EOverflowAnchor |
255 unsigned m_overflowX : 3; // EOverflow | 256 unsigned m_overflowX : 3; // EOverflow |
256 unsigned m_overflowY : 3; // EOverflow | 257 unsigned m_overflowY : 3; // EOverflow |
257 unsigned m_verticalAlign : 4; // EVerticalAlign | 258 unsigned m_verticalAlign : 4; // EVerticalAlign |
258 unsigned m_position : 3; // EPosition | 259 unsigned m_position : 3; // EPosition |
259 unsigned m_tableLayout : 1; // ETableLayout | |
260 | 260 |
261 // This is set if we used viewport units when resolving a length. | 261 // This is set if we used viewport units when resolving a length. |
262 // It is mutable so we can pass around const ComputedStyles to resolve | 262 // It is mutable so we can pass around const ComputedStyles to resolve |
263 // lengths. | 263 // lengths. |
264 mutable unsigned m_hasViewportUnits : 1; | 264 mutable unsigned m_hasViewportUnits : 1; |
265 | 265 |
266 // 32 bits | 266 // 32 bits |
267 | 267 |
268 unsigned m_breakBefore : 4; // EBreak | 268 unsigned m_breakBefore : 4; // EBreak |
269 unsigned m_breakAfter : 4; // EBreak | 269 unsigned m_breakAfter : 4; // EBreak |
(...skipping 19 matching lines...) Expand all Loading... | |
289 unsigned m_isLink : 1; | 289 unsigned m_isLink : 1; |
290 | 290 |
291 mutable unsigned m_hasRemUnits : 1; | 291 mutable unsigned m_hasRemUnits : 1; |
292 | 292 |
293 // If you add more style bits here, you will also need to update | 293 // If you add more style bits here, you will also need to update |
294 // ComputedStyle::copyNonInheritedFromCached() 68 bits | 294 // ComputedStyle::copyNonInheritedFromCached() 68 bits |
295 } m_nonInheritedData; | 295 } m_nonInheritedData; |
296 | 296 |
297 // !END SYNC! | 297 // !END SYNC! |
298 | 298 |
299 void setBitDefaults() { | 299 void setBitDefaults() { |
Bugs Nash
2017/02/01 00:13:01
maybe add another comment about generated properti
| |
300 ComputedStyleBase::setBitDefaults(); | 300 ComputedStyleBase::setBitDefaults(); |
301 m_inheritedData.m_hasSimpleUnderline = false; | 301 m_inheritedData.m_hasSimpleUnderline = false; |
302 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); | 302 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); |
303 m_inheritedData.m_insideLink = | 303 m_inheritedData.m_insideLink = |
304 static_cast<unsigned>(EInsideLink::kNotInsideLink); | 304 static_cast<unsigned>(EInsideLink::kNotInsideLink); |
305 | 305 |
306 m_nonInheritedData.m_effectiveDisplay = | 306 m_nonInheritedData.m_effectiveDisplay = |
307 m_nonInheritedData.m_originalDisplay = | 307 m_nonInheritedData.m_originalDisplay = |
308 static_cast<unsigned>(initialDisplay()); | 308 static_cast<unsigned>(initialDisplay()); |
309 m_nonInheritedData.m_overflowAnchor = | 309 m_nonInheritedData.m_overflowAnchor = |
310 static_cast<unsigned>(initialOverflowAnchor()); | 310 static_cast<unsigned>(initialOverflowAnchor()); |
311 m_nonInheritedData.m_overflowX = static_cast<unsigned>(initialOverflowX()); | 311 m_nonInheritedData.m_overflowX = static_cast<unsigned>(initialOverflowX()); |
312 m_nonInheritedData.m_overflowY = static_cast<unsigned>(initialOverflowY()); | 312 m_nonInheritedData.m_overflowY = static_cast<unsigned>(initialOverflowY()); |
313 m_nonInheritedData.m_verticalAlign = | 313 m_nonInheritedData.m_verticalAlign = |
314 static_cast<unsigned>(initialVerticalAlign()); | 314 static_cast<unsigned>(initialVerticalAlign()); |
315 m_nonInheritedData.m_position = initialPosition(); | 315 m_nonInheritedData.m_position = initialPosition(); |
316 m_nonInheritedData.m_tableLayout = | |
317 static_cast<unsigned>(initialTableLayout()); | |
318 m_nonInheritedData.m_breakBefore = initialBreakBefore(); | 316 m_nonInheritedData.m_breakBefore = initialBreakBefore(); |
319 m_nonInheritedData.m_breakAfter = initialBreakAfter(); | 317 m_nonInheritedData.m_breakAfter = initialBreakAfter(); |
320 m_nonInheritedData.m_breakInside = initialBreakInside(); | 318 m_nonInheritedData.m_breakInside = initialBreakInside(); |
321 m_nonInheritedData.m_styleType = PseudoIdNone; | 319 m_nonInheritedData.m_styleType = PseudoIdNone; |
322 m_nonInheritedData.m_pseudoBits = 0; | 320 m_nonInheritedData.m_pseudoBits = 0; |
323 m_nonInheritedData.m_explicitInheritance = false; | 321 m_nonInheritedData.m_explicitInheritance = false; |
324 m_nonInheritedData.m_variableReference = false; | 322 m_nonInheritedData.m_variableReference = false; |
325 m_nonInheritedData.m_unique = false; | 323 m_nonInheritedData.m_unique = false; |
326 m_nonInheritedData.m_emptyState = false; | 324 m_nonInheritedData.m_emptyState = false; |
327 m_nonInheritedData.m_hasViewportUnits = false; | 325 m_nonInheritedData.m_hasViewportUnits = false; |
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1763 } | 1761 } |
1764 PageSizeType getPageSizeType() const { | 1762 PageSizeType getPageSizeType() const { |
1765 return static_cast<PageSizeType>(m_rareNonInheritedData->m_pageSizeType); | 1763 return static_cast<PageSizeType>(m_rareNonInheritedData->m_pageSizeType); |
1766 } | 1764 } |
1767 void setPageSize(const FloatSize& s) { | 1765 void setPageSize(const FloatSize& s) { |
1768 SET_VAR(m_rareNonInheritedData, m_pageSize, s); | 1766 SET_VAR(m_rareNonInheritedData, m_pageSize, s); |
1769 } | 1767 } |
1770 void setPageSizeType(PageSizeType t) { | 1768 void setPageSizeType(PageSizeType t) { |
1771 SET_VAR(m_rareNonInheritedData, m_pageSizeType, t); | 1769 SET_VAR(m_rareNonInheritedData, m_pageSizeType, t); |
1772 } | 1770 } |
1773 // table-layout | |
1774 static ETableLayout initialTableLayout() { return ETableLayout::kAuto; } | |
1775 ETableLayout tableLayout() const { | |
1776 return static_cast<ETableLayout>(m_nonInheritedData.m_tableLayout); | |
1777 } | |
1778 void setTableLayout(ETableLayout v) { | |
1779 m_nonInheritedData.m_tableLayout = static_cast<unsigned>(v); | |
1780 } | |
1781 | 1771 |
1782 // Text decoration properties. | 1772 // Text decoration properties. |
1783 // text-decoration-line | 1773 // text-decoration-line |
1784 static TextDecoration initialTextDecoration() { return TextDecorationNone; } | 1774 static TextDecoration initialTextDecoration() { return TextDecorationNone; } |
1785 TextDecoration getTextDecoration() const { | 1775 TextDecoration getTextDecoration() const { |
1786 return static_cast<TextDecoration>(m_visual->textDecoration); | 1776 return static_cast<TextDecoration>(m_visual->textDecoration); |
1787 } | 1777 } |
1788 void setTextDecoration(TextDecoration v) { | 1778 void setTextDecoration(TextDecoration v) { |
1789 SET_VAR(m_visual, textDecoration, v); | 1779 SET_VAR(m_visual, textDecoration, v); |
1790 } | 1780 } |
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3938 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); | 3928 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); |
3939 } | 3929 } |
3940 | 3930 |
3941 inline bool ComputedStyle::hasPseudoElementStyle() const { | 3931 inline bool ComputedStyle::hasPseudoElementStyle() const { |
3942 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 3932 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
3943 } | 3933 } |
3944 | 3934 |
3945 } // namespace blink | 3935 } // namespace blink |
3946 | 3936 |
3947 #endif // ComputedStyle_h | 3937 #endif // ComputedStyle_h |
OLD | NEW |