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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 | 250 |
251 unsigned _styleType : 6; // PseudoId | 251 unsigned _styleType : 6; // PseudoId |
252 unsigned _pseudoBits : 8; | 252 unsigned _pseudoBits : 8; |
253 unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property | 253 unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property |
254 unsigned currentColor : 1; // At least one color has the value 'currentC olor' | 254 unsigned currentColor : 1; // At least one color has the value 'currentC olor' |
255 unsigned unique : 1; // Style can not be shared. | 255 unsigned unique : 1; // Style can not be shared. |
256 unsigned emptyState : 1; | 256 unsigned emptyState : 1; |
257 unsigned firstChildState : 1; | 257 unsigned firstChildState : 1; |
258 unsigned lastChildState : 1; | 258 unsigned lastChildState : 1; |
259 | 259 |
260 // This is set if we used viewport units when resolving a length. | |
261 // It is mutable so we can pass around const RenderStyles to resolve len gths. | |
262 mutable unsigned hasViewportUnits : 1; | |
263 | |
260 bool affectedByFocus() const { return _affectedByFocus; } | 264 bool affectedByFocus() const { return _affectedByFocus; } |
261 void setAffectedByFocus(bool value) { _affectedByFocus = value; } | 265 void setAffectedByFocus(bool value) { _affectedByFocus = value; } |
262 bool affectedByHover() const { return _affectedByHover; } | 266 bool affectedByHover() const { return _affectedByHover; } |
263 void setAffectedByHover(bool value) { _affectedByHover = value; } | 267 void setAffectedByHover(bool value) { _affectedByHover = value; } |
264 bool affectedByActive() const { return _affectedByActive; } | 268 bool affectedByActive() const { return _affectedByActive; } |
265 void setAffectedByActive(bool value) { _affectedByActive = value; } | 269 void setAffectedByActive(bool value) { _affectedByActive = value; } |
266 bool affectedByDrag() const { return _affectedByDrag; } | 270 bool affectedByDrag() const { return _affectedByDrag; } |
267 void setAffectedByDrag(bool value) { _affectedByDrag = value; } | 271 void setAffectedByDrag(bool value) { _affectedByDrag = value; } |
268 bool isLink() const { return _isLink; } | 272 bool isLink() const { return _isLink; } |
269 void setIsLink(bool value) { _isLink = value; } | 273 void setIsLink(bool value) { _isLink = value; } |
270 private: | 274 private: |
271 unsigned _affectedByFocus : 1; | 275 unsigned _affectedByFocus : 1; |
272 unsigned _affectedByHover : 1; | 276 unsigned _affectedByHover : 1; |
273 unsigned _affectedByActive : 1; | 277 unsigned _affectedByActive : 1; |
274 unsigned _affectedByDrag : 1; | 278 unsigned _affectedByDrag : 1; |
275 unsigned _isLink : 1; | 279 unsigned _isLink : 1; |
276 // If you add more style bits here, you will also need to update RenderS tyle::copyNonInheritedFrom() | 280 // If you add more style bits here, you will also need to update RenderS tyle::copyNonInheritedFrom() |
277 // 60 bits | 281 // 63 bits |
esprehn
2013/12/18 01:03:55
Is the +3 a mistake, or did you count and was the
Timothy Loh
2013/12/18 01:54:43
Yep, the previous count was incorrect. I also move
| |
278 } noninherited_flags; | 282 } noninherited_flags; |
279 | 283 |
280 // !END SYNC! | 284 // !END SYNC! |
281 | 285 |
282 protected: | 286 protected: |
283 void setBitDefaults() | 287 void setBitDefaults() |
284 { | 288 { |
285 inherited_flags._empty_cells = initialEmptyCells(); | 289 inherited_flags._empty_cells = initialEmptyCells(); |
286 inherited_flags._caption_side = initialCaptionSide(); | 290 inherited_flags._caption_side = initialCaptionSide(); |
287 inherited_flags._list_style_type = initialListStyleType(); | 291 inherited_flags._list_style_type = initialListStyleType(); |
(...skipping 26 matching lines...) Expand all Loading... | |
314 noninherited_flags._page_break_after = initialPageBreak(); | 318 noninherited_flags._page_break_after = initialPageBreak(); |
315 noninherited_flags._page_break_inside = initialPageBreak(); | 319 noninherited_flags._page_break_inside = initialPageBreak(); |
316 noninherited_flags._styleType = NOPSEUDO; | 320 noninherited_flags._styleType = NOPSEUDO; |
317 noninherited_flags._pseudoBits = 0; | 321 noninherited_flags._pseudoBits = 0; |
318 noninherited_flags.explicitInheritance = false; | 322 noninherited_flags.explicitInheritance = false; |
319 noninherited_flags.currentColor = false; | 323 noninherited_flags.currentColor = false; |
320 noninherited_flags.unique = false; | 324 noninherited_flags.unique = false; |
321 noninherited_flags.emptyState = false; | 325 noninherited_flags.emptyState = false; |
322 noninherited_flags.firstChildState = false; | 326 noninherited_flags.firstChildState = false; |
323 noninherited_flags.lastChildState = false; | 327 noninherited_flags.lastChildState = false; |
328 noninherited_flags.hasViewportUnits = false; | |
324 noninherited_flags.setAffectedByFocus(false); | 329 noninherited_flags.setAffectedByFocus(false); |
325 noninherited_flags.setAffectedByHover(false); | 330 noninherited_flags.setAffectedByHover(false); |
326 noninherited_flags.setAffectedByActive(false); | 331 noninherited_flags.setAffectedByActive(false); |
327 noninherited_flags.setAffectedByDrag(false); | 332 noninherited_flags.setAffectedByDrag(false); |
328 noninherited_flags.setIsLink(false); | 333 noninherited_flags.setIsLink(false); |
329 } | 334 } |
330 | 335 |
331 private: | 336 private: |
332 ALWAYS_INLINE RenderStyle(); | 337 ALWAYS_INLINE RenderStyle(); |
333 | 338 |
(...skipping 21 matching lines...) Expand all Loading... | |
355 | 360 |
356 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags ._styleType); } | 361 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags ._styleType); } |
357 void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styl eType; } | 362 void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styl eType; } |
358 | 363 |
359 RenderStyle* getCachedPseudoStyle(PseudoId) const; | 364 RenderStyle* getCachedPseudoStyle(PseudoId) const; |
360 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>); | 365 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>); |
361 void removeCachedPseudoStyle(PseudoId); | 366 void removeCachedPseudoStyle(PseudoId); |
362 | 367 |
363 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoSt yles.get(); } | 368 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoSt yles.get(); } |
364 | 369 |
370 void setHasViewportUnits(bool hasViewportUnits = true) const { noninherited_ flags.hasViewportUnits = hasViewportUnits; } | |
371 bool hasViewportUnits() const { return noninherited_flags.hasViewportUnits; } | |
372 | |
365 void setVariable(const AtomicString& name, const String& value) { rareInheri tedData.access()->m_variables.access()->setVariable(name, value); } | 373 void setVariable(const AtomicString& name, const String& value) { rareInheri tedData.access()->m_variables.access()->setVariable(name, value); } |
366 const HashMap<AtomicString, String>* variables() { return &(rareInheritedDat a->m_variables->m_data); } | 374 const HashMap<AtomicString, String>* variables() { return &(rareInheritedDat a->m_variables->m_data); } |
367 | 375 |
368 bool affectedByFocus() const { return noninherited_flags.affectedByFocus(); } | 376 bool affectedByFocus() const { return noninherited_flags.affectedByFocus(); } |
369 bool affectedByHover() const { return noninherited_flags.affectedByHover(); } | 377 bool affectedByHover() const { return noninherited_flags.affectedByHover(); } |
370 bool affectedByActive() const { return noninherited_flags.affectedByActive() ; } | 378 bool affectedByActive() const { return noninherited_flags.affectedByActive() ; } |
371 bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); } | 379 bool affectedByDrag() const { return noninherited_flags.affectedByDrag(); } |
372 | 380 |
373 void setAffectedByFocus() { noninherited_flags.setAffectedByFocus(true); } | 381 void setAffectedByFocus() { noninherited_flags.setAffectedByFocus(true); } |
374 void setAffectedByHover() { noninherited_flags.setAffectedByHover(true); } | 382 void setAffectedByHover() { noninherited_flags.setAffectedByHover(true); } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
565 float letterSpacing() const; | 573 float letterSpacing() const; |
566 | 574 |
567 float zoom() const { return visual->m_zoom; } | 575 float zoom() const { return visual->m_zoom; } |
568 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; } | 576 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; } |
569 | 577 |
570 TextDirection direction() const { return static_cast<TextDirection>(inherite d_flags._direction); } | 578 TextDirection direction() const { return static_cast<TextDirection>(inherite d_flags._direction); } |
571 bool isLeftToRightDirection() const { return direction() == LTR; } | 579 bool isLeftToRightDirection() const { return direction() == LTR; } |
572 | 580 |
573 Length specifiedLineHeight() const; | 581 Length specifiedLineHeight() const; |
574 Length lineHeight() const; | 582 Length lineHeight() const; |
575 int computedLineHeight(RenderView* = 0) const; | 583 int computedLineHeight() const; |
576 | 584 |
577 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_f lags._white_space); } | 585 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_f lags._white_space); } |
578 static bool autoWrap(EWhiteSpace ws) | 586 static bool autoWrap(EWhiteSpace ws) |
579 { | 587 { |
580 // Nowrap and pre don't automatically wrap. | 588 // Nowrap and pre don't automatically wrap. |
581 return ws != NOWRAP && ws != PRE; | 589 return ws != NOWRAP && ws != PRE; |
582 } | 590 } |
583 | 591 |
584 bool autoWrap() const | 592 bool autoWrap() const |
585 { | 593 { |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1012 setBorderTopLeftRadius(s); | 1020 setBorderTopLeftRadius(s); |
1013 setBorderTopRightRadius(s); | 1021 setBorderTopRightRadius(s); |
1014 setBorderBottomLeftRadius(s); | 1022 setBorderBottomLeftRadius(s); |
1015 setBorderBottomRightRadius(s); | 1023 setBorderBottomRightRadius(s); |
1016 } | 1024 } |
1017 void setBorderRadius(const IntSize& s) | 1025 void setBorderRadius(const IntSize& s) |
1018 { | 1026 { |
1019 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed))); | 1027 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed))); |
1020 } | 1028 } |
1021 | 1029 |
1022 RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, RenderView* = 0, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) cons t; | 1030 RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLo gicalLeftEdge = true, bool includeLogicalRightEdge = true) const; |
1023 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool incl udeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; | 1031 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool incl udeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; |
1024 | 1032 |
1025 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, | 1033 RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, |
1026 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool inclu deLogicalLeftEdge, bool includeLogicalRightEdge) const; | 1034 int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool inclu deLogicalLeftEdge, bool includeLogicalRightEdge) const; |
1027 | 1035 |
1028 void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_widt h, v); } | 1036 void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_widt h, v); } |
1029 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_ style, v); } | 1037 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_ style, v); } |
1030 void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, bo rder.m_left, v); } | 1038 void setBorderLeftColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, bo rder.m_left, v); } |
1031 void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_wi dth, v); } | 1039 void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_wi dth, v); } |
1032 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right. m_style, v); } | 1040 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right. m_style, v); } |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1859 inline void RenderStyle::setHasPseudoStyle(PseudoId pseudo) | 1867 inline void RenderStyle::setHasPseudoStyle(PseudoId pseudo) |
1860 { | 1868 { |
1861 ASSERT(pseudo > NOPSEUDO); | 1869 ASSERT(pseudo > NOPSEUDO); |
1862 ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID); | 1870 ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID); |
1863 noninherited_flags._pseudoBits |= 1 << (pseudo - 1); | 1871 noninherited_flags._pseudoBits |= 1 << (pseudo - 1); |
1864 } | 1872 } |
1865 | 1873 |
1866 } // namespace WebCore | 1874 } // namespace WebCore |
1867 | 1875 |
1868 #endif // RenderStyle_h | 1876 #endif // RenderStyle_h |
OLD | NEW |